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
hawtio/hawtio-utilities
dist/hawtio-utilities.js
trimLeading
function trimLeading(text, prefix) { if (text && prefix) { if (_.startsWith(text, prefix) || text.indexOf(prefix) === 0) { return text.substring(prefix.length); } } return text; }
javascript
function trimLeading(text, prefix) { if (text && prefix) { if (_.startsWith(text, prefix) || text.indexOf(prefix) === 0) { return text.substring(prefix.length); } } return text; }
[ "function", "trimLeading", "(", "text", ",", "prefix", ")", "{", "if", "(", "text", "&&", "prefix", ")", "{", "if", "(", "_", ".", "startsWith", "(", "text", ",", "prefix", ")", "||", "text", ".", "indexOf", "(", "prefix", ")", "===", "0", ")", "...
Trims the leading prefix from a string if its present @method trimLeading @for Core @static @param {String} text @param {String} prefix @return {String}
[ "Trims", "the", "leading", "prefix", "from", "a", "string", "if", "its", "present" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L296-L303
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
trimTrailing
function trimTrailing(text, postfix) { if (text && postfix) { if (_.endsWith(text, postfix)) { return text.substring(0, text.length - postfix.length); } } return text; }
javascript
function trimTrailing(text, postfix) { if (text && postfix) { if (_.endsWith(text, postfix)) { return text.substring(0, text.length - postfix.length); } } return text; }
[ "function", "trimTrailing", "(", "text", ",", "postfix", ")", "{", "if", "(", "text", "&&", "postfix", ")", "{", "if", "(", "_", ".", "endsWith", "(", "text", ",", "postfix", ")", ")", "{", "return", "text", ".", "substring", "(", "0", ",", "text",...
Trims the trailing postfix from a string if its present @method trimTrailing @for Core @static @param {String} trim @param {String} postfix @return {String}
[ "Trims", "the", "trailing", "postfix", "from", "a", "string", "if", "its", "present" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L314-L321
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
adjustHeight
function adjustHeight() { var windowHeight = $(window).height(); var headerHeight = $("#main-nav").height(); var containerHeight = windowHeight - headerHeight; $("#main").css("min-height", "" + containerHeight + "px"); }
javascript
function adjustHeight() { var windowHeight = $(window).height(); var headerHeight = $("#main-nav").height(); var containerHeight = windowHeight - headerHeight; $("#main").css("min-height", "" + containerHeight + "px"); }
[ "function", "adjustHeight", "(", ")", "{", "var", "windowHeight", "=", "$", "(", "window", ")", ".", "height", "(", ")", ";", "var", "headerHeight", "=", "$", "(", "\"#main-nav\"", ")", ".", "height", "(", ")", ";", "var", "containerHeight", "=", "wind...
Ensure our main app container takes up at least the viewport height
[ "Ensure", "our", "main", "app", "container", "takes", "up", "at", "least", "the", "viewport", "height" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L327-L332
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
addCSS
function addCSS(path) { if ('createStyleSheet' in document) { // IE9 document.createStyleSheet(path); } else { // Everyone else var link = $("<link>"); $("head").append(link); link.attr({ rel: 'stylesheet', ...
javascript
function addCSS(path) { if ('createStyleSheet' in document) { // IE9 document.createStyleSheet(path); } else { // Everyone else var link = $("<link>"); $("head").append(link); link.attr({ rel: 'stylesheet', ...
[ "function", "addCSS", "(", "path", ")", "{", "if", "(", "'createStyleSheet'", "in", "document", ")", "{", "// IE9", "document", ".", "createStyleSheet", "(", "path", ")", ";", "}", "else", "{", "// Everyone else", "var", "link", "=", "$", "(", "\"<link>\""...
Adds the specified CSS file to the document's head, handy for external plugins that might bring along their own CSS @param path
[ "Adds", "the", "specified", "CSS", "file", "to", "the", "document", "s", "head", "handy", "for", "external", "plugins", "that", "might", "bring", "along", "their", "own", "CSS" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L352-L367
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
parseBooleanValue
function parseBooleanValue(value, defaultValue) { if (defaultValue === void 0) { defaultValue = false; } if (!angular.isDefined(value) || !value) { return defaultValue; } if (value.constructor === Boolean) { return value; } if (angular.isString(val...
javascript
function parseBooleanValue(value, defaultValue) { if (defaultValue === void 0) { defaultValue = false; } if (!angular.isDefined(value) || !value) { return defaultValue; } if (value.constructor === Boolean) { return value; } if (angular.isString(val...
[ "function", "parseBooleanValue", "(", "value", ",", "defaultValue", ")", "{", "if", "(", "defaultValue", "===", "void", "0", ")", "{", "defaultValue", "=", "false", ";", "}", "if", "(", "!", "angular", ".", "isDefined", "(", "value", ")", "||", "!", "v...
Ensure whatever value is passed in is converted to a boolean In the branding module for now as it's needed before bootstrap @method parseBooleanValue @for Core @param {any} value @param {Boolean} defaultValue default value to use if value is not defined @return {Boolean}
[ "Ensure", "whatever", "value", "is", "passed", "in", "is", "converted", "to", "a", "boolean" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L407-L429
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
pathGet
function pathGet(object, paths) { var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split("."); var value = object; angular.forEach(pathArray, function (name) { if (value) { try { value = value[name]; } ...
javascript
function pathGet(object, paths) { var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split("."); var value = object; angular.forEach(pathArray, function (name) { if (value) { try { value = value[name]; } ...
[ "function", "pathGet", "(", "object", ",", "paths", ")", "{", "var", "pathArray", "=", "(", "angular", ".", "isArray", "(", "paths", ")", ")", "?", "paths", ":", "(", "paths", "||", "\"\"", ")", ".", "split", "(", "\".\"", ")", ";", "var", "value",...
Navigates the given set of paths in turn on the source object and returns the last most value of the path or null if it could not be found. @method pathGet @for Core @static @param {Object} object the start object to start navigating from @param {Array} paths an array of path names to navigate or a string of dot separ...
[ "Navigates", "the", "given", "set", "of", "paths", "in", "turn", "on", "the", "source", "object", "and", "returns", "the", "last", "most", "value", "of", "the", "path", "or", "null", "if", "it", "could", "not", "be", "found", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L517-L535
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
pathSet
function pathSet(object, paths, newValue) { var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split("."); var value = object; var lastIndex = pathArray.length - 1; angular.forEach(pathArray, function (name, idx) { var next = value[name]; if (idx >= ...
javascript
function pathSet(object, paths, newValue) { var pathArray = (angular.isArray(paths)) ? paths : (paths || "").split("."); var value = object; var lastIndex = pathArray.length - 1; angular.forEach(pathArray, function (name, idx) { var next = value[name]; if (idx >= ...
[ "function", "pathSet", "(", "object", ",", "paths", ",", "newValue", ")", "{", "var", "pathArray", "=", "(", "angular", ".", "isArray", "(", "paths", ")", ")", "?", "paths", ":", "(", "paths", "||", "\"\"", ")", ".", "split", "(", "\".\"", ")", ";"...
Navigates the given set of paths in turn on the source object and updates the last path value to the given newValue @method pathSet @for Core @static @param {Object} object the start object to start navigating from @param {Array} paths an array of path names to navigate or a string of dot separated paths to navigate @...
[ "Navigates", "the", "given", "set", "of", "paths", "in", "turn", "on", "the", "source", "object", "and", "updates", "the", "last", "path", "value", "to", "the", "given", "newValue" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L549-L562
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
getOrCreateElements
function getOrCreateElements(domElement, arrayOfElementNames) { var element = domElement; angular.forEach(arrayOfElementNames, function (name) { if (element) { var children = $(element).children(name); if (!children || !children.length) { $...
javascript
function getOrCreateElements(domElement, arrayOfElementNames) { var element = domElement; angular.forEach(arrayOfElementNames, function (name) { if (element) { var children = $(element).children(name); if (!children || !children.length) { $...
[ "function", "getOrCreateElements", "(", "domElement", ",", "arrayOfElementNames", ")", "{", "var", "element", "=", "domElement", ";", "angular", ".", "forEach", "(", "arrayOfElementNames", ",", "function", "(", "name", ")", "{", "if", "(", "element", ")", "{",...
Look up a list of child element names or lazily create them. Useful for example to get the <tbody> <tr> element from a <table> lazily creating one if not present. Usage: var trElement = getOrCreateElements(tableElement, ["tbody", "tr"]) @method getOrCreateElements @for Core @static @param {Object} domElement @param {...
[ "Look", "up", "a", "list", "of", "child", "element", "names", "or", "lazily", "create", "them", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L654-L667
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
escapeHtml
function escapeHtml(str) { if (angular.isString(str)) { var newStr = ""; for (var i = 0; i < str.length; i++) { var ch = str.charAt(i); ch = _escapeHtmlChars[ch] || ch; newStr += ch; } return newStr; } ...
javascript
function escapeHtml(str) { if (angular.isString(str)) { var newStr = ""; for (var i = 0; i < str.length; i++) { var ch = str.charAt(i); ch = _escapeHtmlChars[ch] || ch; newStr += ch; } return newStr; } ...
[ "function", "escapeHtml", "(", "str", ")", "{", "if", "(", "angular", ".", "isString", "(", "str", ")", ")", "{", "var", "newStr", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "i", "++", ")", "...
static escapeHtml method @param str @returns {*}
[ "static", "escapeHtml", "method" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L697-L710
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
isBlank
function isBlank(str) { if (str === undefined || str === null) { return true; } if (angular.isString(str)) { return str.trim().length === 0; } else { // TODO - not undefined but also not a string... return false; } }
javascript
function isBlank(str) { if (str === undefined || str === null) { return true; } if (angular.isString(str)) { return str.trim().length === 0; } else { // TODO - not undefined but also not a string... return false; } }
[ "function", "isBlank", "(", "str", ")", "{", "if", "(", "str", "===", "undefined", "||", "str", "===", "null", ")", "{", "return", "true", ";", "}", "if", "(", "angular", ".", "isString", "(", "str", ")", ")", "{", "return", "str", ".", "trim", "...
Returns true if the string is either null or empty @method isBlank @for Core @static @param {String} str @return {Boolean}
[ "Returns", "true", "if", "the", "string", "is", "either", "null", "or", "empty" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L721-L732
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
humanizeValue
function humanizeValue(value) { if (value) { var text = value + ''; if (Core.isBlank(text)) { return text; } try { text = _.snakeCase(text); text = _.capitalize(text.split('_').join(' ')); } c...
javascript
function humanizeValue(value) { if (value) { var text = value + ''; if (Core.isBlank(text)) { return text; } try { text = _.snakeCase(text); text = _.capitalize(text.split('_').join(' ')); } c...
[ "function", "humanizeValue", "(", "value", ")", "{", "if", "(", "value", ")", "{", "var", "text", "=", "value", "+", "''", ";", "if", "(", "Core", ".", "isBlank", "(", "text", ")", ")", "{", "return", "text", ";", "}", "try", "{", "text", "=", ...
Converts camel-case and dash-separated strings into Human readable forms @param value @returns {*}
[ "Converts", "camel", "-", "case", "and", "dash", "-", "separated", "strings", "into", "Human", "readable", "forms" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L750-L766
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
lineCount
function lineCount(value) { var rows = 0; if (value) { rows = 1; value.toString().each(/\n/, function () { return rows++; }); } return rows; }
javascript
function lineCount(value) { var rows = 0; if (value) { rows = 1; value.toString().each(/\n/, function () { return rows++; }); } return rows; }
[ "function", "lineCount", "(", "value", ")", "{", "var", "rows", "=", "0", ";", "if", "(", "value", ")", "{", "rows", "=", "1", ";", "value", ".", "toString", "(", ")", ".", "each", "(", "/", "\\n", "/", ",", "function", "(", ")", "{", "return",...
Returns the number of lines in the given text @method lineCount @static @param {String} value @return {Number}
[ "Returns", "the", "number", "of", "lines", "in", "the", "given", "text" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L914-L921
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
toSearchArgumentArray
function toSearchArgumentArray(value) { if (value) { if (angular.isArray(value)) return value; if (angular.isString(value)) return value.split(','); } return []; }
javascript
function toSearchArgumentArray(value) { if (value) { if (angular.isArray(value)) return value; if (angular.isString(value)) return value.split(','); } return []; }
[ "function", "toSearchArgumentArray", "(", "value", ")", "{", "if", "(", "value", ")", "{", "if", "(", "angular", ".", "isArray", "(", "value", ")", ")", "return", "value", ";", "if", "(", "angular", ".", "isString", "(", "value", ")", ")", "return", ...
Converts the given value to an array of query arguments. If the value is null an empty array is returned. If the value is a non empty string then the string is split by commas @method toSearchArgumentArray @static @param {*} value @return {String[]}
[ "Converts", "the", "given", "value", "to", "an", "array", "of", "query", "arguments", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L998-L1006
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
onSuccess
function onSuccess(fn, options) { if (options === void 0) { options = {}; } options['mimeType'] = 'application/json'; if (!_.isUndefined(fn)) { options['success'] = fn; } if (!options['method']) { options['method'] = "POST"; } // the defaul...
javascript
function onSuccess(fn, options) { if (options === void 0) { options = {}; } options['mimeType'] = 'application/json'; if (!_.isUndefined(fn)) { options['success'] = fn; } if (!options['method']) { options['method'] = "POST"; } // the defaul...
[ "function", "onSuccess", "(", "fn", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "}", ";", "}", "options", "[", "'mimeType'", "]", "=", "'application/json'", ";", "if", "(", "!", "_", ".", "isUn...
Pass in null for the success function to switch to sync mode @method onSuccess @static @param {Function} Success callback function @param {Object} Options object to pass on to Jolokia request @return {Object} initialized options object
[ "Pass", "in", "null", "for", "the", "success", "function", "to", "switch", "to", "sync", "mode" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1058-L1074
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
defaultJolokiaErrorHandler
function defaultJolokiaErrorHandler(response, options) { if (options === void 0) { options = {}; } var operation = Core.pathGet(response, ['request', 'operation']) || "unknown"; var silent = options['silent']; var stacktrace = response.stacktrace; if (silent || isIgnorableExcepti...
javascript
function defaultJolokiaErrorHandler(response, options) { if (options === void 0) { options = {}; } var operation = Core.pathGet(response, ['request', 'operation']) || "unknown"; var silent = options['silent']; var stacktrace = response.stacktrace; if (silent || isIgnorableExcepti...
[ "function", "defaultJolokiaErrorHandler", "(", "response", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "}", ";", "}", "var", "operation", "=", "Core", ".", "pathGet", "(", "response", ",", "[", "'r...
The default error handler which logs errors either using debug or log level logging based on the silent setting @param response the response from a jolokia request
[ "The", "default", "error", "handler", "which", "logs", "errors", "either", "using", "debug", "or", "log", "level", "logging", "based", "on", "the", "silent", "setting" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1080-L1091
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
isIgnorableException
function isIgnorableException(response) { var isNotFound = function (target) { return target.indexOf("InstanceNotFoundException") >= 0 || target.indexOf("AttributeNotFoundException") >= 0 || target.indexOf("IllegalArgumentException: No operation") >= 0; }; ...
javascript
function isIgnorableException(response) { var isNotFound = function (target) { return target.indexOf("InstanceNotFoundException") >= 0 || target.indexOf("AttributeNotFoundException") >= 0 || target.indexOf("IllegalArgumentException: No operation") >= 0; }; ...
[ "function", "isIgnorableException", "(", "response", ")", "{", "var", "isNotFound", "=", "function", "(", "target", ")", "{", "return", "target", ".", "indexOf", "(", "\"InstanceNotFoundException\"", ")", ">=", "0", "||", "target", ".", "indexOf", "(", "\"Attr...
Checks if it's an error that can happen on timing issues such as its been removed or if we run against older containers @param {Object} response the error response from a jolokia request
[ "Checks", "if", "it", "s", "an", "error", "that", "can", "happen", "on", "timing", "issues", "such", "as", "its", "been", "removed", "or", "if", "we", "run", "against", "older", "containers" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1097-L1104
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
logJolokiaStackTrace
function logJolokiaStackTrace(response) { var stacktrace = response.stacktrace; if (stacktrace) { var operation = Core.pathGet(response, ['request', 'operation']) || "unknown"; log.info("Operation", operation, "failed due to:", response['error']); } }
javascript
function logJolokiaStackTrace(response) { var stacktrace = response.stacktrace; if (stacktrace) { var operation = Core.pathGet(response, ['request', 'operation']) || "unknown"; log.info("Operation", operation, "failed due to:", response['error']); } }
[ "function", "logJolokiaStackTrace", "(", "response", ")", "{", "var", "stacktrace", "=", "response", ".", "stacktrace", ";", "if", "(", "stacktrace", ")", "{", "var", "operation", "=", "Core", ".", "pathGet", "(", "response", ",", "[", "'request'", ",", "'...
Logs any failed operation and stack traces
[ "Logs", "any", "failed", "operation", "and", "stack", "traces" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1108-L1114
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
logLevelClass
function logLevelClass(level) { if (level) { var first = level[0]; if (first === 'w' || first === "W") { return "warning"; } else if (first === 'e' || first === "E") { return "error"; } else if (first === 'i'...
javascript
function logLevelClass(level) { if (level) { var first = level[0]; if (first === 'w' || first === "W") { return "warning"; } else if (first === 'e' || first === "E") { return "error"; } else if (first === 'i'...
[ "function", "logLevelClass", "(", "level", ")", "{", "if", "(", "level", ")", "{", "var", "first", "=", "level", "[", "0", "]", ";", "if", "(", "first", "===", "'w'", "||", "first", "===", "\"W\"", ")", "{", "return", "\"warning\"", ";", "}", "else...
Returns the CSS class for a log level based on if its info, warn, error etc. @method logLevelClass @static @param {String} level @return {String}
[ "Returns", "the", "CSS", "class", "for", "a", "log", "level", "based", "on", "if", "its", "info", "warn", "error", "etc", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1190-L1208
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
hashToString
function hashToString(hash) { var keyValuePairs = []; angular.forEach(hash, function (value, key) { keyValuePairs.push(key + "=" + value); }); var params = keyValuePairs.join("&"); return encodeURI(params); }
javascript
function hashToString(hash) { var keyValuePairs = []; angular.forEach(hash, function (value, key) { keyValuePairs.push(key + "=" + value); }); var params = keyValuePairs.join("&"); return encodeURI(params); }
[ "function", "hashToString", "(", "hash", ")", "{", "var", "keyValuePairs", "=", "[", "]", ";", "angular", ".", "forEach", "(", "hash", ",", "function", "(", "value", ",", "key", ")", "{", "keyValuePairs", ".", "push", "(", "key", "+", "\"=\"", "+", "...
Turns the given search hash into a URI style query string @method hashToString @for Core @static @param {Object} hash @return {String}
[ "Turns", "the", "given", "search", "hash", "into", "a", "URI", "style", "query", "string" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1275-L1282
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
stringToHash
function stringToHash(hashAsString) { var entries = {}; if (hashAsString) { var text = decodeURI(hashAsString); var items = text.split('&'); angular.forEach(items, function (item) { var kv = item.split('='); var key = kv[0]; ...
javascript
function stringToHash(hashAsString) { var entries = {}; if (hashAsString) { var text = decodeURI(hashAsString); var items = text.split('&'); angular.forEach(items, function (item) { var kv = item.split('='); var key = kv[0]; ...
[ "function", "stringToHash", "(", "hashAsString", ")", "{", "var", "entries", "=", "{", "}", ";", "if", "(", "hashAsString", ")", "{", "var", "text", "=", "decodeURI", "(", "hashAsString", ")", ";", "var", "items", "=", "text", ".", "split", "(", "'&'",...
Parses the given string of x=y&bar=foo into a hash @method stringToHash @for Core @static @param {String} hashAsString @return {Object}
[ "Parses", "the", "given", "string", "of", "x", "=", "y&bar", "=", "foo", "into", "a", "hash" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1292-L1305
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
registerForChanges
function registerForChanges(jolokia, $scope, arguments, callback, options) { var decorated = { responseJson: '', success: function (response) { var json = angular.toJson(response.value); if (decorated.responseJson !== json) { decorated....
javascript
function registerForChanges(jolokia, $scope, arguments, callback, options) { var decorated = { responseJson: '', success: function (response) { var json = angular.toJson(response.value); if (decorated.responseJson !== json) { decorated....
[ "function", "registerForChanges", "(", "jolokia", ",", "$scope", ",", "arguments", ",", "callback", ",", "options", ")", "{", "var", "decorated", "=", "{", "responseJson", ":", "''", ",", "success", ":", "function", "(", "response", ")", "{", "var", "json"...
Register a JMX operation to poll for changes, only calls back when a change occurs @param jolokia @param scope @param arguments @param callback @param options @returns Object
[ "Register", "a", "JMX", "operation", "to", "poll", "for", "changes", "only", "calls", "back", "when", "a", "change", "occurs" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1318-L1331
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
register
function register(jolokia, scope, arguments, callback) { if (scope.$$destroyed) { // fail fast to prevent registration leaks return; } /* if (scope && !Core.isBlank(scope.name)) { Core.log.debug("Calling register from scope: ", scope.name); } els...
javascript
function register(jolokia, scope, arguments, callback) { if (scope.$$destroyed) { // fail fast to prevent registration leaks return; } /* if (scope && !Core.isBlank(scope.name)) { Core.log.debug("Calling register from scope: ", scope.name); } els...
[ "function", "register", "(", "jolokia", ",", "scope", ",", "arguments", ",", "callback", ")", "{", "if", "(", "scope", ".", "$$destroyed", ")", "{", "// fail fast to prevent registration leaks", "return", ";", "}", "/*\n if (scope && !Core.isBlank(scope.name)) {\...
end jolokia caching stuff Register a JMX operation to poll for changes @method register @for Core @static @return {Function} a zero argument function for unregistering this registration @param {*} jolokia @param {*} scope @param {Object} arguments @param {Function} callback
[ "end", "jolokia", "caching", "stuff", "Register", "a", "JMX", "operation", "to", "poll", "for", "changes" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1465-L1523
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
unregister
function unregister(jolokia, scope) { if (angular.isDefined(scope.$jhandle)) { scope.$jhandle.forEach(function (handle) { jolokia.unregister(handle); }); delete scope.$jhandle; } }
javascript
function unregister(jolokia, scope) { if (angular.isDefined(scope.$jhandle)) { scope.$jhandle.forEach(function (handle) { jolokia.unregister(handle); }); delete scope.$jhandle; } }
[ "function", "unregister", "(", "jolokia", ",", "scope", ")", "{", "if", "(", "angular", ".", "isDefined", "(", "scope", ".", "$jhandle", ")", ")", "{", "scope", ".", "$jhandle", ".", "forEach", "(", "function", "(", "handle", ")", "{", "jolokia", ".", ...
Register a JMX operation to poll for changes using a jolokia search using the given mbean pattern @method registerSearch @for Core @static @paran {*} jolokia @param {*} scope @param {String} mbeanPattern @param {Function} callback /* TODO - won't compile, and where is 'arguments' coming from? export function registerS...
[ "Register", "a", "JMX", "operation", "to", "poll", "for", "changes", "using", "a", "jolokia", "search", "using", "the", "given", "mbean", "pattern" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1566-L1573
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
xmlNodeToString
function xmlNodeToString(xmlNode) { try { // Gecko- and Webkit-based browsers (Firefox, Chrome), Opera. return (new XMLSerializer()).serializeToString(xmlNode); } catch (e) { try { // Internet Explorer. return xmlNode.xml; ...
javascript
function xmlNodeToString(xmlNode) { try { // Gecko- and Webkit-based browsers (Firefox, Chrome), Opera. return (new XMLSerializer()).serializeToString(xmlNode); } catch (e) { try { // Internet Explorer. return xmlNode.xml; ...
[ "function", "xmlNodeToString", "(", "xmlNode", ")", "{", "try", "{", "// Gecko- and Webkit-based browsers (Firefox, Chrome), Opera.", "return", "(", "new", "XMLSerializer", "(", ")", ")", ".", "serializeToString", "(", "xmlNode", ")", ";", "}", "catch", "(", "e", ...
Converts the given XML node to a string representation of the XML @method xmlNodeToString @for Core @static @param {Object} xmlNode @return {Object}
[ "Converts", "the", "given", "XML", "node", "to", "a", "string", "representation", "of", "the", "XML" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1583-L1599
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
fileExtension
function fileExtension(name, defaultValue) { if (defaultValue === void 0) { defaultValue = ""; } var extension = defaultValue; if (name) { var idx = name.lastIndexOf("."); if (idx > 0) { extension = name.substring(idx + 1, name.length).toLowerCase(); ...
javascript
function fileExtension(name, defaultValue) { if (defaultValue === void 0) { defaultValue = ""; } var extension = defaultValue; if (name) { var idx = name.lastIndexOf("."); if (idx > 0) { extension = name.substring(idx + 1, name.length).toLowerCase(); ...
[ "function", "fileExtension", "(", "name", ",", "defaultValue", ")", "{", "if", "(", "defaultValue", "===", "void", "0", ")", "{", "defaultValue", "=", "\"\"", ";", "}", "var", "extension", "=", "defaultValue", ";", "if", "(", "name", ")", "{", "var", "...
Returns the lowercase file extension of the given file name or returns the empty string if the file does not have an extension @method fileExtension @for Core @static @param {String} name @param {String} defaultValue @return {String}
[ "Returns", "the", "lowercase", "file", "extension", "of", "the", "given", "file", "name", "or", "returns", "the", "empty", "string", "if", "the", "file", "does", "not", "have", "an", "extension" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1623-L1633
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
parseVersionNumbers
function parseVersionNumbers(text) { if (text) { var m = text.match(_versionRegex); if (m && m.length > 4) { var m1 = m[1]; var m2 = m[2]; var m4 = m[4]; if (angular.isDefined(m4)) { return [parseInt(m1),...
javascript
function parseVersionNumbers(text) { if (text) { var m = text.match(_versionRegex); if (m && m.length > 4) { var m1 = m[1]; var m2 = m[2]; var m4 = m[4]; if (angular.isDefined(m4)) { return [parseInt(m1),...
[ "function", "parseVersionNumbers", "(", "text", ")", "{", "if", "(", "text", ")", "{", "var", "m", "=", "text", ".", "match", "(", "_versionRegex", ")", ";", "if", "(", "m", "&&", "m", ".", "length", ">", "4", ")", "{", "var", "m1", "=", "m", "...
Parses some text of the form "xxxx2.3.4xxxx" to extract the version numbers as an array of numbers then returns an array of 2 or 3 numbers. Characters before the first digit are ignored as are characters after the last digit. @method parseVersionNumbers @for Core @static @param {String} text a maven like string contai...
[ "Parses", "some", "text", "of", "the", "form", "xxxx2", ".", "3", ".", "4xxxx", "to", "extract", "the", "version", "numbers", "as", "an", "array", "of", "numbers", "then", "returns", "an", "array", "of", "2", "or", "3", "numbers", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1654-L1673
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
versionToSortableString
function versionToSortableString(version, maxDigitsBetweenDots) { if (maxDigitsBetweenDots === void 0) { maxDigitsBetweenDots = 4; } return (version || "").split(".").map(function (x) { var length = x.length; return (length >= maxDigitsBetweenDots) ? x : _.padStar...
javascript
function versionToSortableString(version, maxDigitsBetweenDots) { if (maxDigitsBetweenDots === void 0) { maxDigitsBetweenDots = 4; } return (version || "").split(".").map(function (x) { var length = x.length; return (length >= maxDigitsBetweenDots) ? x : _.padStar...
[ "function", "versionToSortableString", "(", "version", ",", "maxDigitsBetweenDots", ")", "{", "if", "(", "maxDigitsBetweenDots", "===", "void", "0", ")", "{", "maxDigitsBetweenDots", "=", "4", ";", "}", "return", "(", "version", "||", "\"\"", ")", ".", "split"...
Converts a version string with numbers and dots of the form "123.456.790" into a string which is sortable as a string, by left padding each string between the dots to at least 4 characters so things just sort as a string. @param text @return {string} the sortable version string
[ "Converts", "a", "version", "string", "with", "numbers", "and", "dots", "of", "the", "form", "123", ".", "456", ".", "790", "into", "a", "string", "which", "is", "sortable", "as", "a", "string", "by", "left", "padding", "each", "string", "between", "the"...
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1683-L1690
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
compareVersionNumberArrays
function compareVersionNumberArrays(v1, v2) { if (v1 && !v2) { return 1; } if (!v1 && v2) { return -1; } if (v1 === v2) { return 0; } for (var i = 0; i < v1.length; i++) { var n1 = v1[i]; if (i >= v2.leng...
javascript
function compareVersionNumberArrays(v1, v2) { if (v1 && !v2) { return 1; } if (!v1 && v2) { return -1; } if (v1 === v2) { return 0; } for (var i = 0; i < v1.length; i++) { var n1 = v1[i]; if (i >= v2.leng...
[ "function", "compareVersionNumberArrays", "(", "v1", ",", "v2", ")", "{", "if", "(", "v1", "&&", "!", "v2", ")", "{", "return", "1", ";", "}", "if", "(", "!", "v1", "&&", "v2", ")", "{", "return", "-", "1", ";", "}", "if", "(", "v1", "===", "...
Compares the 2 version arrays and returns -1 if v1 is less than v2 or 0 if they are equal or 1 if v1 is greater than v2 @method compareVersionNumberArrays @for Core @static @param {Array} v1 an array of version numbers with the most significant version first (major, minor, patch). @param {Array} v2 @return {Number}
[ "Compares", "the", "2", "version", "arrays", "and", "returns", "-", "1", "if", "v1", "is", "less", "than", "v2", "or", "0", "if", "they", "are", "equal", "or", "1", "if", "v1", "is", "greater", "than", "v2" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1709-L1739
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
forEachLeafFolder
function forEachLeafFolder(folders, fn) { angular.forEach(folders, function (folder) { var children = folder["children"]; if (angular.isArray(children) && children.length > 0) { forEachLeafFolder(children, fn); } else { fn(folder); ...
javascript
function forEachLeafFolder(folders, fn) { angular.forEach(folders, function (folder) { var children = folder["children"]; if (angular.isArray(children) && children.length > 0) { forEachLeafFolder(children, fn); } else { fn(folder); ...
[ "function", "forEachLeafFolder", "(", "folders", ",", "fn", ")", "{", "angular", ".", "forEach", "(", "folders", ",", "function", "(", "folder", ")", "{", "var", "children", "=", "folder", "[", "\"children\"", "]", ";", "if", "(", "angular", ".", "isArra...
Invokes the given function on each leaf node in the array of folders @method forEachLeafFolder @for Core @static @param {Array[Folder]} folders @param {Function} fn
[ "Invokes", "the", "given", "function", "on", "each", "leaf", "node", "in", "the", "array", "of", "folders" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1888-L1898
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
parseUrl
function parseUrl(url) { if (Core.isBlank(url)) { return null; } var matches = url.match(httpRegex); if (matches === null) { return null; } //log.debug("matches: ", matches); var scheme = matches[1]; var host = matches[3]; v...
javascript
function parseUrl(url) { if (Core.isBlank(url)) { return null; } var matches = url.match(httpRegex); if (matches === null) { return null; } //log.debug("matches: ", matches); var scheme = matches[1]; var host = matches[3]; v...
[ "function", "parseUrl", "(", "url", ")", "{", "if", "(", "Core", ".", "isBlank", "(", "url", ")", ")", "{", "return", "null", ";", "}", "var", "matches", "=", "url", ".", "match", "(", "httpRegex", ")", ";", "if", "(", "matches", "===", "null", "...
Breaks a URL up into a nice object @method parseUrl @for Core @static @param url @returns object
[ "Breaks", "a", "URL", "up", "into", "a", "nice", "object" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1924-L1956
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
useProxyIfExternal
function useProxyIfExternal(connectUrl) { if (Core.isChromeApp()) { return connectUrl; } var host = window.location.host; if (!_.startsWith(connectUrl, "http://" + host + "/") && !_.startsWith(connectUrl, "https://" + host + "/")) { // lets remove the http stuff ...
javascript
function useProxyIfExternal(connectUrl) { if (Core.isChromeApp()) { return connectUrl; } var host = window.location.host; if (!_.startsWith(connectUrl, "http://" + host + "/") && !_.startsWith(connectUrl, "https://" + host + "/")) { // lets remove the http stuff ...
[ "function", "useProxyIfExternal", "(", "connectUrl", ")", "{", "if", "(", "Core", ".", "isChromeApp", "(", ")", ")", "{", "return", "connectUrl", ";", "}", "var", "host", "=", "window", ".", "location", ".", "host", ";", "if", "(", "!", "_", ".", "st...
If a URL is external to the current web application, then replace the URL with the proxy servlet URL @method useProxyIfExternal @for Core @static @param {String} connectUrl @return {String}
[ "If", "a", "URL", "is", "external", "to", "the", "current", "web", "application", "then", "replace", "the", "URL", "with", "the", "proxy", "servlet", "URL" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L1972-L1990
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
throttled
function throttled(fn, millis) { var nextInvokeTime = 0; var lastAnswer = null; return function () { var now = Date.now(); if (nextInvokeTime < now) { nextInvokeTime = now + millis; lastAnswer = fn(); } else { ...
javascript
function throttled(fn, millis) { var nextInvokeTime = 0; var lastAnswer = null; return function () { var now = Date.now(); if (nextInvokeTime < now) { nextInvokeTime = now + millis; lastAnswer = fn(); } else { ...
[ "function", "throttled", "(", "fn", ",", "millis", ")", "{", "var", "nextInvokeTime", "=", "0", ";", "var", "lastAnswer", "=", "null", ";", "return", "function", "(", ")", "{", "var", "now", "=", "Date", ".", "now", "(", ")", ";", "if", "(", "nextI...
Returns a new function which ensures that the delegate function is only invoked at most once within the given number of millseconds @method throttled @for Core @static @param {Function} fn the function to be invoked at most once within the given number of millis @param {Number} millis the time window during which this ...
[ "Returns", "a", "new", "function", "which", "ensures", "that", "the", "delegate", "function", "is", "only", "invoked", "at", "most", "once", "within", "the", "given", "number", "of", "millseconds" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2081-L2095
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
parseJsonText
function parseJsonText(text, message) { if (message === void 0) { message = "JSON"; } var answer = null; try { answer = angular.fromJson(text); } catch (e) { log.info("Failed to parse " + message + " from: " + text + ". " + e); } return ans...
javascript
function parseJsonText(text, message) { if (message === void 0) { message = "JSON"; } var answer = null; try { answer = angular.fromJson(text); } catch (e) { log.info("Failed to parse " + message + " from: " + text + ". " + e); } return ans...
[ "function", "parseJsonText", "(", "text", ",", "message", ")", "{", "if", "(", "message", "===", "void", "0", ")", "{", "message", "=", "\"JSON\"", ";", "}", "var", "answer", "=", "null", ";", "try", "{", "answer", "=", "angular", ".", "fromJson", "(...
Attempts to parse the given JSON text and returns the JSON object structure or null. Bad JSON is logged at info level. @param text a JSON formatted string @param message description of the thing being parsed logged if its invalid
[ "Attempts", "to", "parse", "the", "given", "JSON", "text", "and", "returns", "the", "JSON", "object", "structure", "or", "null", ".", "Bad", "JSON", "is", "logged", "at", "info", "level", "." ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2104-L2114
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
humanizeValueHtml
function humanizeValueHtml(value) { var formattedValue = ""; if (value === true) { formattedValue = '<i class="icon-check"></i>'; } else if (value === false) { formattedValue = '<i class="icon-check-empty"></i>'; } else { formattedValue...
javascript
function humanizeValueHtml(value) { var formattedValue = ""; if (value === true) { formattedValue = '<i class="icon-check"></i>'; } else if (value === false) { formattedValue = '<i class="icon-check-empty"></i>'; } else { formattedValue...
[ "function", "humanizeValueHtml", "(", "value", ")", "{", "var", "formattedValue", "=", "\"\"", ";", "if", "(", "value", "===", "true", ")", "{", "formattedValue", "=", "'<i class=\"icon-check\"></i>'", ";", "}", "else", "if", "(", "value", "===", "false", ")...
Returns the humanized markup of the given value
[ "Returns", "the", "humanized", "markup", "of", "the", "given", "value" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2119-L2131
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
getQueryParameterValue
function getQueryParameterValue(url, parameterName) { var parts; var query = (url || '').split('?'); if (query && query.length > 0) { parts = query[1]; } else { parts = ''; } var vars = parts.split('&'); for (var i = 0; i < vars.len...
javascript
function getQueryParameterValue(url, parameterName) { var parts; var query = (url || '').split('?'); if (query && query.length > 0) { parts = query[1]; } else { parts = ''; } var vars = parts.split('&'); for (var i = 0; i < vars.len...
[ "function", "getQueryParameterValue", "(", "url", ",", "parameterName", ")", "{", "var", "parts", ";", "var", "query", "=", "(", "url", "||", "''", ")", ".", "split", "(", "'?'", ")", ";", "if", "(", "query", "&&", "query", ".", "length", ">", "0", ...
Gets a query value from the given url @param url url @param parameterName the uri parameter value to get @returns {*}
[ "Gets", "a", "query", "value", "from", "the", "given", "url" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2140-L2158
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
humanizeMilliseconds
function humanizeMilliseconds(value) { if (!angular.isNumber(value)) { return "XXX"; } var seconds = value / 1000; var years = Math.floor(seconds / 31536000); if (years) { return maybePlural(years, "year"); } var days = Math.floor((seconds ...
javascript
function humanizeMilliseconds(value) { if (!angular.isNumber(value)) { return "XXX"; } var seconds = value / 1000; var years = Math.floor(seconds / 31536000); if (years) { return maybePlural(years, "year"); } var days = Math.floor((seconds ...
[ "function", "humanizeMilliseconds", "(", "value", ")", "{", "if", "(", "!", "angular", ".", "isNumber", "(", "value", ")", ")", "{", "return", "\"XXX\"", ";", "}", "var", "seconds", "=", "value", "/", "1000", ";", "var", "years", "=", "Math", ".", "f...
Takes a value in ms and returns a human readable duration @param value
[ "Takes", "a", "value", "in", "ms", "and", "returns", "a", "human", "readable", "duration" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2165-L2191
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
createControllerFunction
function createControllerFunction(_module, pluginName) { return function (name, inlineAnnotatedConstructor) { return _module.controller(pluginName + '.' + name, inlineAnnotatedConstructor); }; }
javascript
function createControllerFunction(_module, pluginName) { return function (name, inlineAnnotatedConstructor) { return _module.controller(pluginName + '.' + name, inlineAnnotatedConstructor); }; }
[ "function", "createControllerFunction", "(", "_module", ",", "pluginName", ")", "{", "return", "function", "(", "name", ",", "inlineAnnotatedConstructor", ")", "{", "return", "_module", ".", "controller", "(", "pluginName", "+", "'.'", "+", "name", ",", "inlineA...
creates a nice little shortcut function that plugins can use to easily prefix controllers with the plugin name, helps avoid redundancy and typos
[ "creates", "a", "nice", "little", "shortcut", "function", "that", "plugins", "can", "use", "to", "easily", "prefix", "controllers", "with", "the", "plugin", "name", "helps", "avoid", "redundancy", "and", "typos" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2744-L2748
train
hawtio/hawtio-utilities
dist/hawtio-utilities.js
parsePreferencesJson
function parsePreferencesJson(value, key) { var answer = null; if (angular.isDefined(value)) { answer = Core.parseJsonText(value, "localStorage for " + key); } return answer; }
javascript
function parsePreferencesJson(value, key) { var answer = null; if (angular.isDefined(value)) { answer = Core.parseJsonText(value, "localStorage for " + key); } return answer; }
[ "function", "parsePreferencesJson", "(", "value", ",", "key", ")", "{", "var", "answer", "=", "null", ";", "if", "(", "angular", ".", "isDefined", "(", "value", ")", ")", "{", "answer", "=", "Core", ".", "parseJsonText", "(", "value", ",", "\"localStorag...
Parsers the given value as JSON if it is define
[ "Parsers", "the", "given", "value", "as", "JSON", "if", "it", "is", "define" ]
c938a8936a0e547d61b0dfdfdc94145c280d2eeb
https://github.com/hawtio/hawtio-utilities/blob/c938a8936a0e547d61b0dfdfdc94145c280d2eeb/dist/hawtio-utilities.js#L2826-L2832
train
emreavsar/unjar-from-url
index.js
function () { // looking for keys passed as cli arguments with urls and download-dirs const urlsKey = "urls"; const downloadDirsKey = "download-dirs"; const destinationDir = "destination-dirs"; // keys used in the array (same as in configuration via package.json) for each item (so urls => url) const confUrlsKey ...
javascript
function () { // looking for keys passed as cli arguments with urls and download-dirs const urlsKey = "urls"; const downloadDirsKey = "download-dirs"; const destinationDir = "destination-dirs"; // keys used in the array (same as in configuration via package.json) for each item (so urls => url) const confUrlsKey ...
[ "function", "(", ")", "{", "// looking for keys passed as cli arguments with urls and download-dirs", "const", "urlsKey", "=", "\"urls\"", ";", "const", "downloadDirsKey", "=", "\"download-dirs\"", ";", "const", "destinationDir", "=", "\"destination-dirs\"", ";", "// keys use...
Finds the configuration passed by command line arguments. CLI args are limited, thus one have to pass the following CLI arguments: --urls = list of urls to download the jars from --download-dirs = names of the directories to put the jars into (uncompress jar into this directory) --destination-dirs = names of the direc...
[ "Finds", "the", "configuration", "passed", "by", "command", "line", "arguments", "." ]
998b45d0c67a6f21a552ac6780900549d6fb0026
https://github.com/emreavsar/unjar-from-url/blob/998b45d0c67a6f21a552ac6780900549d6fb0026/index.js#L48-L84
train
emreavsar/unjar-from-url
index.js
function (module) { const configKey = 'unjar-from-url-config'; if (module == null) { return []; } var highestParent; if (module.parent != null) { highestParent = module.parent; } else { highestParent = module; } var parentFound = false; // iterate up to all parents, until parent is undefined => root...
javascript
function (module) { const configKey = 'unjar-from-url-config'; if (module == null) { return []; } var highestParent; if (module.parent != null) { highestParent = module.parent; } else { highestParent = module; } var parentFound = false; // iterate up to all parents, until parent is undefined => root...
[ "function", "(", "module", ")", "{", "const", "configKey", "=", "'unjar-from-url-config'", ";", "if", "(", "module", "==", "null", ")", "{", "return", "[", "]", ";", "}", "var", "highestParent", ";", "if", "(", "module", ".", "parent", "!=", "null", ")...
Searches the unjar configuration inside the highest parent's package.json. This is typically used when this module is used inside another project which has the configuration inside the package.json of the project itself. Returns unjar configuration as a js object. Example for configuration: <pre><code> // package.jso...
[ "Searches", "the", "unjar", "configuration", "inside", "the", "highest", "parent", "s", "package", ".", "json", ".", "This", "is", "typically", "used", "when", "this", "module", "is", "used", "inside", "another", "project", "which", "has", "the", "configuratio...
998b45d0c67a6f21a552ac6780900549d6fb0026
https://github.com/emreavsar/unjar-from-url/blob/998b45d0c67a6f21a552ac6780900549d6fb0026/index.js#L109-L158
train
emreavsar/unjar-from-url
index.js
function (nodeModulesDir, unzipDirectory, url) { const download = require('download'); const fs = require('fs'); const zlib = require('zlib'); var exec = require('child_process').exec, child; var path = require("path"); // extracting filename from url var filename = path.basename(url); var fileDirectory = no...
javascript
function (nodeModulesDir, unzipDirectory, url) { const download = require('download'); const fs = require('fs'); const zlib = require('zlib'); var exec = require('child_process').exec, child; var path = require("path"); // extracting filename from url var filename = path.basename(url); var fileDirectory = no...
[ "function", "(", "nodeModulesDir", ",", "unzipDirectory", ",", "url", ")", "{", "const", "download", "=", "require", "(", "'download'", ")", ";", "const", "fs", "=", "require", "(", "'fs'", ")", ";", "const", "zlib", "=", "require", "(", "'zlib'", ")", ...
Downloads and uncompresses a jar from given url into node_modules directory. @param {string} nodeModulesDir absolute path to node_modules directory where a directory gets created where the jar gets uncompressed @param {string} unzipDirectory name of the directory where the jar file gets uncompressed in @param {string} ...
[ "Downloads", "and", "uncompresses", "a", "jar", "from", "given", "url", "into", "node_modules", "directory", "." ]
998b45d0c67a6f21a552ac6780900549d6fb0026
https://github.com/emreavsar/unjar-from-url/blob/998b45d0c67a6f21a552ac6780900549d6fb0026/index.js#L166-L229
train
Ensighten/Builder
dist/Builder.require.jquery.keys.js
Builder
function Builder(tmpl, data) { // Generate a this context for data var that = {'tmpl': tmpl, 'data': data}; // Run the beforeFns on tmpl tmpl = pre.call(that, tmpl); // Convert the template into content var content = template.call(that, tmpl, data); // Pass the template through the dom engine var $co...
javascript
function Builder(tmpl, data) { // Generate a this context for data var that = {'tmpl': tmpl, 'data': data}; // Run the beforeFns on tmpl tmpl = pre.call(that, tmpl); // Convert the template into content var content = template.call(that, tmpl, data); // Pass the template through the dom engine var $co...
[ "function", "Builder", "(", "tmpl", ",", "data", ")", "{", "// Generate a this context for data", "var", "that", "=", "{", "'tmpl'", ":", "tmpl", ",", "'data'", ":", "data", "}", ";", "// Run the beforeFns on tmpl", "tmpl", "=", "pre", ".", "call", "(", "tha...
Build chain for client side views. before -> template -> domify -> after -> return @param {String} tmpl Template to process through template engine @param {Object} [data] Data to pass through to template engine @returns {Mixed} Output from before -> template -> domify -> after -> return
[ "Build", "chain", "for", "client", "side", "views", ".", "before", "-", ">", "template", "-", ">", "domify", "-", ">", "after", "-", ">", "return" ]
eb1cf781f229588a3898fd2c0d7365feb29fb06b
https://github.com/Ensighten/Builder/blob/eb1cf781f229588a3898fd2c0d7365feb29fb06b/dist/Builder.require.jquery.keys.js#L27-L45
train
Ensighten/Builder
dist/Builder.require.jquery.keys.js
pre
function pre(tmpl) { // Iterate over the beforeFns var i = 0, len = beforeFns.length; for (; i < len; i++) { tmpl = beforeFns[i].call(this, tmpl) || tmpl; } // Return tmpl return tmpl; }
javascript
function pre(tmpl) { // Iterate over the beforeFns var i = 0, len = beforeFns.length; for (; i < len; i++) { tmpl = beforeFns[i].call(this, tmpl) || tmpl; } // Return tmpl return tmpl; }
[ "function", "pre", "(", "tmpl", ")", "{", "// Iterate over the beforeFns", "var", "i", "=", "0", ",", "len", "=", "beforeFns", ".", "length", ";", "for", "(", ";", "i", "<", "len", ";", "i", "++", ")", "{", "tmpl", "=", "beforeFns", "[", "i", "]", ...
Modify tmpl via beforeFns @param {String} tmpl Template string to modify @returns {String} Modified tmpl
[ "Modify", "tmpl", "via", "beforeFns" ]
eb1cf781f229588a3898fd2c0d7365feb29fb06b
https://github.com/Ensighten/Builder/blob/eb1cf781f229588a3898fd2c0d7365feb29fb06b/dist/Builder.require.jquery.keys.js#L52-L62
train
Ensighten/Builder
dist/Builder.require.jquery.keys.js
template
function template(tmpl, data) { // Grab the template engine var engine = settings['template engine']; // Process the template through the template engine var content = engine.call(this, tmpl, data); // Return the content return content; }
javascript
function template(tmpl, data) { // Grab the template engine var engine = settings['template engine']; // Process the template through the template engine var content = engine.call(this, tmpl, data); // Return the content return content; }
[ "function", "template", "(", "tmpl", ",", "data", ")", "{", "// Grab the template engine", "var", "engine", "=", "settings", "[", "'template engine'", "]", ";", "// Process the template through the template engine", "var", "content", "=", "engine", ".", "call", "(", ...
Parse template through its engine @param {String} tmpl Template to process through template engine @param {Object} [data] Data to pass through to template engine
[ "Parse", "template", "through", "its", "engine" ]
eb1cf781f229588a3898fd2c0d7365feb29fb06b
https://github.com/Ensighten/Builder/blob/eb1cf781f229588a3898fd2c0d7365feb29fb06b/dist/Builder.require.jquery.keys.js#L71-L80
train
Ensighten/Builder
dist/Builder.require.jquery.keys.js
set
function set(name, val) { // If the name is an object var key; if (typeof name === 'object') { // Iterate over its properties for (key in name) { if (name.hasOwnProperty(key)) { // Set each one set(key, name[key]); } } } else { // Otherwise, save to settings setting...
javascript
function set(name, val) { // If the name is an object var key; if (typeof name === 'object') { // Iterate over its properties for (key in name) { if (name.hasOwnProperty(key)) { // Set each one set(key, name[key]); } } } else { // Otherwise, save to settings setting...
[ "function", "set", "(", "name", ",", "val", ")", "{", "// If the name is an object", "var", "key", ";", "if", "(", "typeof", "name", "===", "'object'", ")", "{", "// Iterate over its properties", "for", "(", "key", "in", "name", ")", "{", "if", "(", "name"...
Settings helper for Builder @param {String|Object} name If object, interpret as key-value pairs of settings. If string, save val under settings key. @param {Mixed} [val] Value to save under name
[ "Settings", "helper", "for", "Builder" ]
eb1cf781f229588a3898fd2c0d7365feb29fb06b
https://github.com/Ensighten/Builder/blob/eb1cf781f229588a3898fd2c0d7365feb29fb06b/dist/Builder.require.jquery.keys.js#L123-L138
train
Ensighten/Builder
dist/Builder.require.jquery.keys.js
addPlugin
function addPlugin(params) { // If the params are a string, upcast it to an object if (typeof params === 'string') { params = { 'plugin': params }; } // Grab and fallback plugin and selector var plugin = params.plugin, selector = params.selector || '.' + plugin; // Generate an after fu...
javascript
function addPlugin(params) { // If the params are a string, upcast it to an object if (typeof params === 'string') { params = { 'plugin': params }; } // Grab and fallback plugin and selector var plugin = params.plugin, selector = params.selector || '.' + plugin; // Generate an after fu...
[ "function", "addPlugin", "(", "params", ")", "{", "// If the params are a string, upcast it to an object", "if", "(", "typeof", "params", "===", "'string'", ")", "{", "params", "=", "{", "'plugin'", ":", "params", "}", ";", "}", "// Grab and fallback plugin and select...
Initialize jQuery plugins after rendering @param {String|Object} params If a string, it will be used for params.plugin and we will search elements which use it as a class @param {String} params.plugin jQuery plugin to instantiate @param {Mixed} params.selector Selector to use within $content.filter and $content.find
[ "Initialize", "jQuery", "plugins", "after", "rendering" ]
eb1cf781f229588a3898fd2c0d7365feb29fb06b
https://github.com/Ensighten/Builder/blob/eb1cf781f229588a3898fd2c0d7365feb29fb06b/dist/Builder.require.jquery.keys.js#L166-L191
train
soldair/pinoccio-server
troop.js
handle
function handle(js,line){ // handle message from board. //stream.log("handle",stream.token,line); var hasToken = stream.token; if(js.type == "token") { // send in event stream. stream.queue(js); stream.token = js.token; if(!hasToken) { readycb(false,stream); c...
javascript
function handle(js,line){ // handle message from board. //stream.log("handle",stream.token,line); var hasToken = stream.token; if(js.type == "token") { // send in event stream. stream.queue(js); stream.token = js.token; if(!hasToken) { readycb(false,stream); c...
[ "function", "handle", "(", "js", ",", "line", ")", "{", "// handle message from board.", "//stream.log(\"handle\",stream.token,line);", "var", "hasToken", "=", "stream", ".", "token", ";", "if", "(", "js", ".", "type", "==", "\"token\"", ")", "{", "// send in even...
cannot send commands to boards that have not provided a token.
[ "cannot", "send", "commands", "to", "boards", "that", "have", "not", "provided", "a", "token", "." ]
5be3196d1ec8f340aaa3ca96282f871a243943df
https://github.com/soldair/pinoccio-server/blob/5be3196d1ec8f340aaa3ca96282f871a243943df/troop.js#L97-L156
train
kchapelier/in-browser-download
index.js
getElement
function getElement () { if (element === null) { element = document.createElement('a'); element.innerText = 'Download'; element.style.position = 'absolute'; element.style.top = '-100px'; element.style.left = '0px'; } return element; }
javascript
function getElement () { if (element === null) { element = document.createElement('a'); element.innerText = 'Download'; element.style.position = 'absolute'; element.style.top = '-100px'; element.style.left = '0px'; } return element; }
[ "function", "getElement", "(", ")", "{", "if", "(", "element", "===", "null", ")", "{", "element", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "element", ".", "innerText", "=", "'Download'", ";", "element", ".", "style", ".", "position",...
Get an anchor element. @returns {HTMLElement}
[ "Get", "an", "anchor", "element", "." ]
84cad967f85e8bd897c9587b5e87a1b0d9159c3a
https://github.com/kchapelier/in-browser-download/blob/84cad967f85e8bd897c9587b5e87a1b0d9159c3a/index.js#L11-L21
train
kchapelier/in-browser-download
index.js
getObjectUrl
function getObjectUrl (data) { let blob; if (typeof data === 'object' && data.constructor.name === 'Blob') { blob = data; } else if (typeof data === 'string') { blob = new Blob([getTextEncoder().encode(data).buffer], { type: 'application/octet-stream' }); } else if (typeof data === 'object' &...
javascript
function getObjectUrl (data) { let blob; if (typeof data === 'object' && data.constructor.name === 'Blob') { blob = data; } else if (typeof data === 'string') { blob = new Blob([getTextEncoder().encode(data).buffer], { type: 'application/octet-stream' }); } else if (typeof data === 'object' &...
[ "function", "getObjectUrl", "(", "data", ")", "{", "let", "blob", ";", "if", "(", "typeof", "data", "===", "'object'", "&&", "data", ".", "constructor", ".", "name", "===", "'Blob'", ")", "{", "blob", "=", "data", ";", "}", "else", "if", "(", "typeof...
Return an object URL based on the given data. @param {string|Blob|ArrayBuffer} data @returns {*}
[ "Return", "an", "object", "URL", "based", "on", "the", "given", "data", "." ]
84cad967f85e8bd897c9587b5e87a1b0d9159c3a
https://github.com/kchapelier/in-browser-download/blob/84cad967f85e8bd897c9587b5e87a1b0d9159c3a/index.js#L43-L61
train
kchapelier/in-browser-download
index.js
download
function download (data, filename) { const element = getElement(); const url = getObjectUrl(data); element.setAttribute('href', url); element.setAttribute('download', filename); document.body.appendChild(element); element.click(); document.body.removeChild(element); setTimeout(function () { URL.re...
javascript
function download (data, filename) { const element = getElement(); const url = getObjectUrl(data); element.setAttribute('href', url); element.setAttribute('download', filename); document.body.appendChild(element); element.click(); document.body.removeChild(element); setTimeout(function () { URL.re...
[ "function", "download", "(", "data", ",", "filename", ")", "{", "const", "element", "=", "getElement", "(", ")", ";", "const", "url", "=", "getObjectUrl", "(", "data", ")", ";", "element", ".", "setAttribute", "(", "'href'", ",", "url", ")", ";", "elem...
Download a Blob, a string or an ArrayBuffer as a file in the browser @param {string|ArrayBuffer} data The content of the file to download. @param {string} [filename] The name of the file to download.
[ "Download", "a", "Blob", "a", "string", "or", "an", "ArrayBuffer", "as", "a", "file", "in", "the", "browser" ]
84cad967f85e8bd897c9587b5e87a1b0d9159c3a
https://github.com/kchapelier/in-browser-download/blob/84cad967f85e8bd897c9587b5e87a1b0d9159c3a/index.js#L69-L82
train
seek-oss/nodejs-consumer-pact-verifier
verifier.js
makeObjectKeysLC
function makeObjectKeysLC (o){ var keys = Object.keys(o); var lcObject = {}; keys.forEach(function(k){ lcObject[k.toLowerCase()] = o[k]; }); return lcObject; }
javascript
function makeObjectKeysLC (o){ var keys = Object.keys(o); var lcObject = {}; keys.forEach(function(k){ lcObject[k.toLowerCase()] = o[k]; }); return lcObject; }
[ "function", "makeObjectKeysLC", "(", "o", ")", "{", "var", "keys", "=", "Object", ".", "keys", "(", "o", ")", ";", "var", "lcObject", "=", "{", "}", ";", "keys", ".", "forEach", "(", "function", "(", "k", ")", "{", "lcObject", "[", "k", ".", "toL...
Private API Takes an object and lower-cases its' keys @param {Object} o Expected to be a set of headers @return {Object} New object with lowercase keys
[ "Private", "API", "Takes", "an", "object", "and", "lower", "-", "cases", "its", "keys" ]
b7685a3283a8b51bd55d3e35f8918480b486df8e
https://github.com/seek-oss/nodejs-consumer-pact-verifier/blob/b7685a3283a8b51bd55d3e35f8918480b486df8e/verifier.js#L14-L21
train
arendjr/laces.js
laces.js
LacesObject
function LacesObject(options) { Object.defineProperty(this, "_bindings", { "value": [], "writable": true }); Object.defineProperty(this, "_eventListeners", { "value": {}, "writable": true }); Object.defineProperty(this, "_heldEvents", { "value": null, "writable": true }); Object.defineProperty(this, "_...
javascript
function LacesObject(options) { Object.defineProperty(this, "_bindings", { "value": [], "writable": true }); Object.defineProperty(this, "_eventListeners", { "value": {}, "writable": true }); Object.defineProperty(this, "_heldEvents", { "value": null, "writable": true }); Object.defineProperty(this, "_...
[ "function", "LacesObject", "(", "options", ")", "{", "Object", ".", "defineProperty", "(", "this", ",", "\"_bindings\"", ",", "{", "\"value\"", ":", "[", "]", ",", "\"writable\"", ":", "true", "}", ")", ";", "Object", ".", "defineProperty", "(", "this", ...
Laces Object constructor. This is the base class for the other laces object types. You should not instantiate this class directly. Instead, use LacesArray, LacesMap or LacesModel. The methods defined here are available on all said object types.
[ "Laces", "Object", "constructor", ".", "This", "is", "the", "base", "class", "for", "the", "other", "laces", "object", "types", ".", "You", "should", "not", "instantiate", "this", "class", "directly", ".", "Instead", "use", "LacesArray", "LacesMap", "or", "L...
e04fd060a4668abe58064267b1405e6a40f8a6f2
https://github.com/arendjr/laces.js/blob/e04fd060a4668abe58064267b1405e6a40f8a6f2/laces.js#L10-L17
train
MartinKolarik/ractive-render
lib/template.js
load
function load(file, options) { if (options.cache && rr.cache['tpl!' + file]) { return Promise.resolve(rr.cache['tpl!' + file]); } return fs.readFileAsync(file, 'utf8').then(function (template) { return utils.wrap(Ractive.parse(template, options), options); }).then(function (template) { var basePath = path.re...
javascript
function load(file, options) { if (options.cache && rr.cache['tpl!' + file]) { return Promise.resolve(rr.cache['tpl!' + file]); } return fs.readFileAsync(file, 'utf8').then(function (template) { return utils.wrap(Ractive.parse(template, options), options); }).then(function (template) { var basePath = path.re...
[ "function", "load", "(", "file", ",", "options", ")", "{", "if", "(", "options", ".", "cache", "&&", "rr", ".", "cache", "[", "'tpl!'", "+", "file", "]", ")", "{", "return", "Promise", ".", "resolve", "(", "rr", ".", "cache", "[", "'tpl!'", "+", ...
Create a component from the given file @param {String} file @param {Object} options @returns {Promise} @public
[ "Create", "a", "component", "from", "the", "given", "file" ]
417a97c42de4b1ea6c1ab13803f5470b3cc6f75a
https://github.com/MartinKolarik/ractive-render/blob/417a97c42de4b1ea6c1ab13803f5470b3cc6f75a/lib/template.js#L21-L48
train
fatalxiao/js-markdown
src/lib/syntax/block/Table.js
generateTableTree
function generateTableTree(head, separator) { return { type: 'Table', children: [{ type: 'TableHead', children: [{ type: 'TableRow', children: head.map((rawValue, index) => ({ type: 'TableHeadCell', align...
javascript
function generateTableTree(head, separator) { return { type: 'Table', children: [{ type: 'TableHead', children: [{ type: 'TableRow', children: head.map((rawValue, index) => ({ type: 'TableHeadCell', align...
[ "function", "generateTableTree", "(", "head", ",", "separator", ")", "{", "return", "{", "type", ":", "'Table'", ",", "children", ":", "[", "{", "type", ":", "'TableHead'", ",", "children", ":", "[", "{", "type", ":", "'TableRow'", ",", "children", ":", ...
get the initial table render tree that includes headers @param head @param separator @returns {{type: string, children: [*]}}
[ "get", "the", "initial", "table", "render", "tree", "that", "includes", "headers" ]
dffa23be561f50282e5ccc2f1595a51d18a81246
https://github.com/fatalxiao/js-markdown/blob/dffa23be561f50282e5ccc2f1595a51d18a81246/src/lib/syntax/block/Table.js#L36-L51
train
fatalxiao/js-markdown
src/lib/syntax/block/Table.js
generateTableRowNode
function generateTableRowNode(line, separator) { const tableRow = { type: 'TableRow', children: separator.map(align => ({ type: 'TableDataCell', align })) }; for (let i = 0, data = calRow(line), len = data.length; i < len; i++) { tableRow.children[i]...
javascript
function generateTableRowNode(line, separator) { const tableRow = { type: 'TableRow', children: separator.map(align => ({ type: 'TableDataCell', align })) }; for (let i = 0, data = calRow(line), len = data.length; i < len; i++) { tableRow.children[i]...
[ "function", "generateTableRowNode", "(", "line", ",", "separator", ")", "{", "const", "tableRow", "=", "{", "type", ":", "'TableRow'", ",", "children", ":", "separator", ".", "map", "(", "align", "=>", "(", "{", "type", ":", "'TableDataCell'", ",", "align"...
return a table row that includes table data cells @param line @param separator @returns {{type: string, children}}
[ "return", "a", "table", "row", "that", "includes", "table", "data", "cells" ]
dffa23be561f50282e5ccc2f1595a51d18a81246
https://github.com/fatalxiao/js-markdown/blob/dffa23be561f50282e5ccc2f1595a51d18a81246/src/lib/syntax/block/Table.js#L83-L99
train
fatalxiao/js-markdown
src/lib/syntax/block/Table.js
calSeparator
function calSeparator(str) { return calRow(str).map(item => { if (item.startsWith(':') && item.endsWith(':')) { return 'center'; } else if (item.startsWith(':')) { return 'left'; } else if (item.endsWith(':')) { return 'right'; } else if (item.ends...
javascript
function calSeparator(str) { return calRow(str).map(item => { if (item.startsWith(':') && item.endsWith(':')) { return 'center'; } else if (item.startsWith(':')) { return 'left'; } else if (item.endsWith(':')) { return 'right'; } else if (item.ends...
[ "function", "calSeparator", "(", "str", ")", "{", "return", "calRow", "(", "str", ")", ".", "map", "(", "item", "=>", "{", "if", "(", "item", ".", "startsWith", "(", "':'", ")", "&&", "item", ".", "endsWith", "(", "':'", ")", ")", "{", "return", ...
parse the separator line, and return a align info @param str @returns {Array}
[ "parse", "the", "separator", "line", "and", "return", "a", "align", "info" ]
dffa23be561f50282e5ccc2f1595a51d18a81246
https://github.com/fatalxiao/js-markdown/blob/dffa23be561f50282e5ccc2f1595a51d18a81246/src/lib/syntax/block/Table.js#L106-L118
train
mhdawson/google-auth-wrapper
lib/googleAuthWrapper.js
createOauthClient
function createOauthClient(storagePath, clientSecrets) { var secrets = fs.readFileSync(path.join(storagePath, clientSecrets + '.json')); if (secrets === undefined) { throw new Error('failed to read secrets file'); } secrets = JSON.parse(secrets); var gAuth = new googleAuth(); var oauthClient = new gA...
javascript
function createOauthClient(storagePath, clientSecrets) { var secrets = fs.readFileSync(path.join(storagePath, clientSecrets + '.json')); if (secrets === undefined) { throw new Error('failed to read secrets file'); } secrets = JSON.parse(secrets); var gAuth = new googleAuth(); var oauthClient = new gA...
[ "function", "createOauthClient", "(", "storagePath", ",", "clientSecrets", ")", "{", "var", "secrets", "=", "fs", ".", "readFileSync", "(", "path", ".", "join", "(", "storagePath", ",", "clientSecrets", "+", "'.json'", ")", ")", ";", "if", "(", "secrets", ...
common parts of oauth client creation
[ "common", "parts", "of", "oauth", "client", "creation" ]
7052af71889b4c72904be784b1fdde955782ec15
https://github.com/mhdawson/google-auth-wrapper/blob/7052af71889b4c72904be784b1fdde955782ec15/lib/googleAuthWrapper.js#L81-L93
train
meetings/gearsloth
lib/controllers/retry.js
Retry
function Retry(conf) { component.Component.call(this, 'controller', conf); this.registerGearman(conf.servers, { client: true, worker: { func_name: 'retryController', func: _.bind( function(json_string, worker) { try { // TODO: this parsing and meta parameter storing should be e...
javascript
function Retry(conf) { component.Component.call(this, 'controller', conf); this.registerGearman(conf.servers, { client: true, worker: { func_name: 'retryController', func: _.bind( function(json_string, worker) { try { // TODO: this parsing and meta parameter storing should be e...
[ "function", "Retry", "(", "conf", ")", "{", "component", ".", "Component", ".", "call", "(", "this", ",", "'controller'", ",", "conf", ")", ";", "this", ".", "registerGearman", "(", "conf", ".", "servers", ",", "{", "client", ":", "true", ",", "worker"...
Retry component. Emits 'connect' when at least one server for both worker and client roles are connected to.
[ "Retry", "component", ".", "Emits", "connect", "when", "at", "least", "one", "server", "for", "both", "worker", "and", "client", "roles", "are", "connected", "to", "." ]
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/controllers/retry.js#L10-L31
train
wilmoore/string-split.js
index.js
split
function split (splitBy, string) { return (typeof splitBy === 'function') ? predicate(splitBy, string) : string.split(splitBy) }
javascript
function split (splitBy, string) { return (typeof splitBy === 'function') ? predicate(splitBy, string) : string.split(splitBy) }
[ "function", "split", "(", "splitBy", ",", "string", ")", "{", "return", "(", "typeof", "splitBy", "===", "'function'", ")", "?", "predicate", "(", "splitBy", ",", "string", ")", ":", "string", ".", "split", "(", "splitBy", ")", "}" ]
A curried `String.prototype.split` with support for splitting by String, RegExp, or Function. @param {String|RegExp|Function} splitBy String, RegExp, or Function to split by. @param {String} string String to split. @return {Array} List of split string parts.
[ "A", "curried", "String", ".", "prototype", ".", "split", "with", "support", "for", "splitting", "by", "String", "RegExp", "or", "Function", "." ]
3584c106212c45c7a26c9f9b4f2b70e3b3b07d07
https://github.com/wilmoore/string-split.js/blob/3584c106212c45c7a26c9f9b4f2b70e3b3b07d07/index.js#L29-L33
train
wilmoore/string-split.js
index.js
predicate
function predicate (fn, string) { var idx = -1 var end = string.length var out = [] var buf = '' while (++idx < end) { if (fn(string[idx], idx) === true) { if (buf) out.push(buf) buf = '' } else { buf += string[idx] } } if (buf) out.push(buf) return out }
javascript
function predicate (fn, string) { var idx = -1 var end = string.length var out = [] var buf = '' while (++idx < end) { if (fn(string[idx], idx) === true) { if (buf) out.push(buf) buf = '' } else { buf += string[idx] } } if (buf) out.push(buf) return out }
[ "function", "predicate", "(", "fn", ",", "string", ")", "{", "var", "idx", "=", "-", "1", "var", "end", "=", "string", ".", "length", "var", "out", "=", "[", "]", "var", "buf", "=", "''", "while", "(", "++", "idx", "<", "end", ")", "{", "if", ...
Split via predicate function. @param {Function} fn Predicate function. @param {String} string String to split. @return {Array} List of split string parts.
[ "Split", "via", "predicate", "function", "." ]
3584c106212c45c7a26c9f9b4f2b70e3b3b07d07
https://github.com/wilmoore/string-split.js/blob/3584c106212c45c7a26c9f9b4f2b70e3b3b07d07/index.js#L48-L65
train
syarul/passwordless-nedb
lib/nedb.js
NedbStore
function NedbStore(datastore, documentsName) { if(arguments.length === 0 || typeof datastore !== 'object') { throw new Error('Valid datastore parameter have to be provided') } if (arguments[1]) { if (typeof arguments[1] !== 'string') { throw new Error('documentsName must be a va...
javascript
function NedbStore(datastore, documentsName) { if(arguments.length === 0 || typeof datastore !== 'object') { throw new Error('Valid datastore parameter have to be provided') } if (arguments[1]) { if (typeof arguments[1] !== 'string') { throw new Error('documentsName must be a va...
[ "function", "NedbStore", "(", "datastore", ",", "documentsName", ")", "{", "if", "(", "arguments", ".", "length", "===", "0", "||", "typeof", "datastore", "!==", "'object'", ")", "{", "throw", "new", "Error", "(", "'Valid datastore parameter have to be provided'",...
Constructor of NedbStore @param {Object} [datastore] the data storage declared upon creation/loading as defined by the NeDB specification. Please check the documentation for details: https://github.com/louischatriot/nedb @param {String} [documentsName] A valid string identifier. All created documents within database ha...
[ "Constructor", "of", "NedbStore" ]
249a96111d240f74e091ef250225f9d8c863a75a
https://github.com/syarul/passwordless-nedb/blob/249a96111d240f74e091ef250225f9d8c863a75a/lib/nedb.js#L19-L34
train
eventsauce/eventsauce
lib/overload.js
compatible
function compatible(value, descriptor) { if (!value) { // If we're a null, then we can't validate. return false; } else if (!descriptor) { return true; } const descriptorType = typeof descriptor; if (descriptorType === 'string') { return typeof value === descriptor; } else if (descriptorTyp...
javascript
function compatible(value, descriptor) { if (!value) { // If we're a null, then we can't validate. return false; } else if (!descriptor) { return true; } const descriptorType = typeof descriptor; if (descriptorType === 'string') { return typeof value === descriptor; } else if (descriptorTyp...
[ "function", "compatible", "(", "value", ",", "descriptor", ")", "{", "if", "(", "!", "value", ")", "{", "// If we're a null, then we can't validate.", "return", "false", ";", "}", "else", "if", "(", "!", "descriptor", ")", "{", "return", "true", ";", "}", ...
Is the specified value equivelent to the descriptor? @param {object} value - Value to check. @param {object} descriptor - Descriptor to compare to. @returns {Boolean} - True if equivelent.
[ "Is", "the", "specified", "value", "equivelent", "to", "the", "descriptor?" ]
934fb22134e0408861e3d2a5338c4ecc07ad4843
https://github.com/eventsauce/eventsauce/blob/934fb22134e0408861e3d2a5338c4ecc07ad4843/lib/overload.js#L15-L41
train
eventsauce/eventsauce
lib/overload.js
match
function match(args, typeMap) { // No arguments, no win. if (!args || !args.length) { throw new Error('Cannot perform overload.match: args must be non-null array'); } else if (!typeMap || !typeMap.length) { // We always satisfy a null or empty typeMap return true; } // Validate the arguments one ...
javascript
function match(args, typeMap) { // No arguments, no win. if (!args || !args.length) { throw new Error('Cannot perform overload.match: args must be non-null array'); } else if (!typeMap || !typeMap.length) { // We always satisfy a null or empty typeMap return true; } // Validate the arguments one ...
[ "function", "match", "(", "args", ",", "typeMap", ")", "{", "// No arguments, no win.", "if", "(", "!", "args", "||", "!", "args", ".", "length", ")", "{", "throw", "new", "Error", "(", "'Cannot perform overload.match: args must be non-null array'", ")", ";", "}...
Does the specified method match the overload requirements for the method? @param {Array} args - Method arguments @param {Array} typeMap - Type map @returns {Boolean} - True if matches, false otherwise.
[ "Does", "the", "specified", "method", "match", "the", "overload", "requirements", "for", "the", "method?" ]
934fb22134e0408861e3d2a5338c4ecc07ad4843
https://github.com/eventsauce/eventsauce/blob/934fb22134e0408861e3d2a5338c4ecc07ad4843/lib/overload.js#L49-L67
train
meetings/gearsloth
lib/daemon/runner.js
Runner
function Runner(conf) { component.Component.call(this, 'runner', conf); var that = this; this._default_controller = defaults.controllerfuncname(conf); this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { client: true }); this.on('connect', function() { that.startPolling(); }); this.on('d...
javascript
function Runner(conf) { component.Component.call(this, 'runner', conf); var that = this; this._default_controller = defaults.controllerfuncname(conf); this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { client: true }); this.on('connect', function() { that.startPolling(); }); this.on('d...
[ "function", "Runner", "(", "conf", ")", "{", "component", ".", "Component", ".", "call", "(", "this", ",", "'runner'", ",", "conf", ")", ";", "var", "that", "=", "this", ";", "this", ".", "_default_controller", "=", "defaults", ".", "controllerfuncname", ...
Runner component. Emits 'connect' when at least one server is connected.
[ "Runner", "component", ".", "Emits", "connect", "when", "at", "least", "one", "server", "is", "connected", "." ]
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/daemon/runner.js#L8-L21
train
naugtur/secure-dependencies
index.js
promiseCommand
function promiseCommand(command) { const opts = { env: process.env }; console.log('>>>>', command) return spawnShell(command, opts).exitPromise .then((exitCode) => { if (exitCode === 0) { return; } else { throw Error("Exit " + exitC...
javascript
function promiseCommand(command) { const opts = { env: process.env }; console.log('>>>>', command) return spawnShell(command, opts).exitPromise .then((exitCode) => { if (exitCode === 0) { return; } else { throw Error("Exit " + exitC...
[ "function", "promiseCommand", "(", "command", ")", "{", "const", "opts", "=", "{", "env", ":", "process", ".", "env", "}", ";", "console", ".", "log", "(", "'>>>>'", ",", "command", ")", "return", "spawnShell", "(", "command", ",", "opts", ")", ".", ...
The main purpose of this is to reject the promise based on exit code
[ "The", "main", "purpose", "of", "this", "is", "to", "reject", "the", "promise", "based", "on", "exit", "code" ]
6ccfe4078df31372f6f25011574291eba5d21832
https://github.com/naugtur/secure-dependencies/blob/6ccfe4078df31372f6f25011574291eba5d21832/index.js#L60-L73
train
thlorenz/resolve-jit-symbols
index.js
JITResolver
function JITResolver(map) { if (!(this instanceof JITResolver)) return new JITResolver(map); var lines = Array.isArray(map) ? map : map.split('\n') this._addresses = lines .reduce(processLine, []) .sort(byDecimalAddress) this._len = this._addresses.length; }
javascript
function JITResolver(map) { if (!(this instanceof JITResolver)) return new JITResolver(map); var lines = Array.isArray(map) ? map : map.split('\n') this._addresses = lines .reduce(processLine, []) .sort(byDecimalAddress) this._len = this._addresses.length; }
[ "function", "JITResolver", "(", "map", ")", "{", "if", "(", "!", "(", "this", "instanceof", "JITResolver", ")", ")", "return", "new", "JITResolver", "(", "map", ")", ";", "var", "lines", "=", "Array", ".", "isArray", "(", "map", ")", "?", "map", ":",...
Instantiates a JIT resolver for the given map. @name JITResolver @function @param {String|Array.<String>} map either a string or lines with space separated HexAddress, Size, Symbol on each line @return {Object} the initialized JIT resolver
[ "Instantiates", "a", "JIT", "resolver", "for", "the", "given", "map", "." ]
465e9a8d5b923e22b30ae909b336e7943de2221d
https://github.com/thlorenz/resolve-jit-symbols/blob/465e9a8d5b923e22b30ae909b336e7943de2221d/index.js#L42-L51
train
roeldev-deprecated-stuff/log-interceptor
lib/level.js
function($str) { if (!this.hasFormatOptions) { this.addToLog($str); return false; } // strip colors from the string. this is ok with multilines if (this.options.stripColor) { $str = Utils.stripColor($str); } var $r...
javascript
function($str) { if (!this.hasFormatOptions) { this.addToLog($str); return false; } // strip colors from the string. this is ok with multilines if (this.options.stripColor) { $str = Utils.stripColor($str); } var $r...
[ "function", "(", "$str", ")", "{", "if", "(", "!", "this", ".", "hasFormatOptions", ")", "{", "this", ".", "addToLog", "(", "$str", ")", ";", "return", "false", ";", "}", "// strip colors from the string. this is ok with multilines", "if", "(", "this", ".", ...
Will format and log the intercepted string and return an array with the formatted result, or `false` when no format options are enabled. @param {string} $str @return {boolean|array}
[ "Will", "format", "and", "log", "the", "intercepted", "string", "and", "return", "an", "array", "with", "the", "formatted", "result", "or", "false", "when", "no", "format", "options", "are", "enabled", "." ]
ccc958e47de73dffdf7d4c0d62766e6d85e5b066
https://github.com/roeldev-deprecated-stuff/log-interceptor/blob/ccc958e47de73dffdf7d4c0d62766e6d85e5b066/lib/level.js#L78-L127
train
Hexagon/abstractor
lib/log.js
function (fn, module, data, verbose) { let complete = module.toUpperCase() + " > "; // Only provide verbose log if logLevel > 5 verbose = config.logLevel >= 5 ? (verbose || undefined) : undefined; // When writing to console if ( config.destination === console) { ...
javascript
function (fn, module, data, verbose) { let complete = module.toUpperCase() + " > "; // Only provide verbose log if logLevel > 5 verbose = config.logLevel >= 5 ? (verbose || undefined) : undefined; // When writing to console if ( config.destination === console) { ...
[ "function", "(", "fn", ",", "module", ",", "data", ",", "verbose", ")", "{", "let", "complete", "=", "module", ".", "toUpperCase", "(", ")", "+", "\" > \"", ";", "// Only provide verbose log if logLevel > 5", "verbose", "=", "config", ".", "logLevel", ">=", ...
Log levels 0 = silent 1 = error 2 = warning 3 = log 4 = notice 5 = verbose Private
[ "Log", "levels", "0", "=", "silent", "1", "=", "error", "2", "=", "warning", "3", "=", "log", "4", "=", "notice", "5", "=", "verbose", "Private" ]
e4ab34e9404060998b4af1ad41544be5f436bffb
https://github.com/Hexagon/abstractor/blob/e4ab34e9404060998b4af1ad41544be5f436bffb/lib/log.js#L50-L84
train
cusspvz/method-throttle
src/method-throttle.js
throttle
function throttle ( fn, time, context ) { var lock, args, asyncKey, destroyed var later = function () { // reset lock and call if queued lock = false if ( args ) { throttled.apply( context, args ) args = false } } var checkDestroyed = function ()...
javascript
function throttle ( fn, time, context ) { var lock, args, asyncKey, destroyed var later = function () { // reset lock and call if queued lock = false if ( args ) { throttled.apply( context, args ) args = false } } var checkDestroyed = function ()...
[ "function", "throttle", "(", "fn", ",", "time", ",", "context", ")", "{", "var", "lock", ",", "args", ",", "asyncKey", ",", "destroyed", "var", "later", "=", "function", "(", ")", "{", "// reset lock and call if queued", "lock", "=", "false", "if", "(", ...
throttle - throttles provided fn for a specific time @param {Function} fn method that you wish to throttle @param {Integer} time amount of time that you want to ignore calls @param {mixed} context object that will context into provided fn @return {Function} returned method will check if it can r...
[ "throttle", "-", "throttles", "provided", "fn", "for", "a", "specific", "time" ]
6eeef472d026c6902addb34c6a6a1138a7ba4402
https://github.com/cusspvz/method-throttle/blob/6eeef472d026c6902addb34c6a6a1138a7ba4402/src/method-throttle.js#L11-L55
train
ceddl/ceddl-aditional-inputs
src/page-metadata.js
hasCookies
function hasCookies() { if (navigator.cookieEnabled) { return true; } document.cookie = "cookietest=1"; var ret = document.cookie.indexOf("cookietest=") != -1; document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"; return ret; }
javascript
function hasCookies() { if (navigator.cookieEnabled) { return true; } document.cookie = "cookietest=1"; var ret = document.cookie.indexOf("cookietest=") != -1; document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"; return ret; }
[ "function", "hasCookies", "(", ")", "{", "if", "(", "navigator", ".", "cookieEnabled", ")", "{", "return", "true", ";", "}", "document", ".", "cookie", "=", "\"cookietest=1\"", ";", "var", "ret", "=", "document", ".", "cookie", ".", "indexOf", "(", "\"co...
detects if the browser has Cookies enabled. @return {Boolean} ret
[ "detects", "if", "the", "browser", "has", "Cookies", "enabled", "." ]
0e018d463107a0b631c317d7bf372aa9e194b7da
https://github.com/ceddl/ceddl-aditional-inputs/blob/0e018d463107a0b631c317d7bf372aa9e194b7da/src/page-metadata.js#L24-L33
train
ceddl/ceddl-aditional-inputs
src/page-metadata.js
getPageMeta
function getPageMeta() { var data = detectFeatures(); data.title = document.title; data.url = window.location.href; data.path = document.location.pathname; data.referrer = document.referrer; data.url_section = window.location.pathname.split('/').filter(function(part){ ...
javascript
function getPageMeta() { var data = detectFeatures(); data.title = document.title; data.url = window.location.href; data.path = document.location.pathname; data.referrer = document.referrer; data.url_section = window.location.pathname.split('/').filter(function(part){ ...
[ "function", "getPageMeta", "(", ")", "{", "var", "data", "=", "detectFeatures", "(", ")", ";", "data", ".", "title", "=", "document", ".", "title", ";", "data", ".", "url", "=", "window", ".", "location", ".", "href", ";", "data", ".", "path", "=", ...
getPageState is a helper function to collect all the browser and custom element data converting it into the page data object.
[ "getPageState", "is", "a", "helper", "function", "to", "collect", "all", "the", "browser", "and", "custom", "element", "data", "converting", "it", "into", "the", "page", "data", "object", "." ]
0e018d463107a0b631c317d7bf372aa9e194b7da
https://github.com/ceddl/ceddl-aditional-inputs/blob/0e018d463107a0b631c317d7bf372aa9e194b7da/src/page-metadata.js#L138-L154
train
phun-ky/grunt-minified
tasks/minified.js
function(file){ // Sandboxed variables var filePath = ''; // Read file source var src = grunt.file.read(file); // Get file name var filename = path.basename(file); // set file extention if(_opts.ext) { filename = filename.replace('.js', _opts.ext); }...
javascript
function(file){ // Sandboxed variables var filePath = ''; // Read file source var src = grunt.file.read(file); // Get file name var filename = path.basename(file); // set file extention if(_opts.ext) { filename = filename.replace('.js', _opts.ext); }...
[ "function", "(", "file", ")", "{", "// Sandboxed variables", "var", "filePath", "=", "''", ";", "// Read file source", "var", "src", "=", "grunt", ".", "file", ".", "read", "(", "file", ")", ";", "// Get file name", "var", "filename", "=", "path", ".", "ba...
Set up callback function for file iteration
[ "Set", "up", "callback", "function", "for", "file", "iteration" ]
ba9a3896af6e1248087beb006fe82f354815730f
https://github.com/phun-ky/grunt-minified/blob/ba9a3896af6e1248087beb006fe82f354815730f/tasks/minified.js#L40-L96
train
IjzerenHein/famous-refresh-loader
RefreshLoader.js
_translateBehind
function _translateBehind() { if (this._zNode) { this._zNode = this._zNode.add(new Modifier({ transform: Transform.behind })); } else { this._zNode = this.add(new Modifier({ transform: Transform.behind })); }...
javascript
function _translateBehind() { if (this._zNode) { this._zNode = this._zNode.add(new Modifier({ transform: Transform.behind })); } else { this._zNode = this.add(new Modifier({ transform: Transform.behind })); }...
[ "function", "_translateBehind", "(", ")", "{", "if", "(", "this", ".", "_zNode", ")", "{", "this", ".", "_zNode", "=", "this", ".", "_zNode", ".", "add", "(", "new", "Modifier", "(", "{", "transform", ":", "Transform", ".", "behind", "}", ")", ")", ...
Helper function for giving all surfaces the correct z-index.
[ "Helper", "function", "for", "giving", "all", "surfaces", "the", "correct", "z", "-", "index", "." ]
4df7aa51d5f17d510915311e46c5ee6745498d86
https://github.com/IjzerenHein/famous-refresh-loader/blob/4df7aa51d5f17d510915311e46c5ee6745498d86/RefreshLoader.js#L62-L74
train
IjzerenHein/famous-refresh-loader
RefreshLoader.js
_createParticles
function _createParticles(node, count) { this._particles = []; var options = { size: [this.options.particleSize, this.options.particleSize], properties: { backgroundColor: this.options.color, borderRadius: '50%' } }; for...
javascript
function _createParticles(node, count) { this._particles = []; var options = { size: [this.options.particleSize, this.options.particleSize], properties: { backgroundColor: this.options.color, borderRadius: '50%' } }; for...
[ "function", "_createParticles", "(", "node", ",", "count", ")", "{", "this", ".", "_particles", "=", "[", "]", ";", "var", "options", "=", "{", "size", ":", "[", "this", ".", "options", ".", "particleSize", ",", "this", ".", "options", ".", "particleSi...
Creates the particles
[ "Creates", "the", "particles" ]
4df7aa51d5f17d510915311e46c5ee6745498d86
https://github.com/IjzerenHein/famous-refresh-loader/blob/4df7aa51d5f17d510915311e46c5ee6745498d86/RefreshLoader.js#L79-L96
train
IjzerenHein/famous-refresh-loader
RefreshLoader.js
_createForeground
function _createForeground(node) { this._foreground = { surface: new Surface({ size: this.options.size, properties: { backgroundColor: this.options.pullToRefreshBackgroundColor } }), mod: new Modifier({}) ...
javascript
function _createForeground(node) { this._foreground = { surface: new Surface({ size: this.options.size, properties: { backgroundColor: this.options.pullToRefreshBackgroundColor } }), mod: new Modifier({}) ...
[ "function", "_createForeground", "(", "node", ")", "{", "this", ".", "_foreground", "=", "{", "surface", ":", "new", "Surface", "(", "{", "size", ":", "this", ".", "options", ".", "size", ",", "properties", ":", "{", "backgroundColor", ":", "this", ".", ...
Creates the foreground behind which the particles can hide in case of pull to refresh.
[ "Creates", "the", "foreground", "behind", "which", "the", "particles", "can", "hide", "in", "case", "of", "pull", "to", "refresh", "." ]
4df7aa51d5f17d510915311e46c5ee6745498d86
https://github.com/IjzerenHein/famous-refresh-loader/blob/4df7aa51d5f17d510915311e46c5ee6745498d86/RefreshLoader.js#L101-L112
train
IjzerenHein/famous-refresh-loader
RefreshLoader.js
_positionForeground
function _positionForeground(renderSize) { if (this._pullToRefreshDirection) { this._foreground.mod.transformFrom(Transform.translate(0, renderSize[1], 0)); } else { this._foreground.mod.transformFrom(Transform.translate(renderSize[0], 0, 0)); } }
javascript
function _positionForeground(renderSize) { if (this._pullToRefreshDirection) { this._foreground.mod.transformFrom(Transform.translate(0, renderSize[1], 0)); } else { this._foreground.mod.transformFrom(Transform.translate(renderSize[0], 0, 0)); } }
[ "function", "_positionForeground", "(", "renderSize", ")", "{", "if", "(", "this", ".", "_pullToRefreshDirection", ")", "{", "this", ".", "_foreground", ".", "mod", ".", "transformFrom", "(", "Transform", ".", "translate", "(", "0", ",", "renderSize", "[", "...
Positions the foreground in front of the particles.
[ "Positions", "the", "foreground", "in", "front", "of", "the", "particles", "." ]
4df7aa51d5f17d510915311e46c5ee6745498d86
https://github.com/IjzerenHein/famous-refresh-loader/blob/4df7aa51d5f17d510915311e46c5ee6745498d86/RefreshLoader.js#L169-L176
train
stefan-dimitrov/i18n-compile
index.js
function (filePatterns, destination, options) { try { var fse = require('fs-extra') } catch (e) { console.error('This method can only be used in server applications.\n' + 'Consider using the alternative method "i18nCompile.fromString()" instead.') } options = options || {}; var matchedFiles = _...
javascript
function (filePatterns, destination, options) { try { var fse = require('fs-extra') } catch (e) { console.error('This method can only be used in server applications.\n' + 'Consider using the alternative method "i18nCompile.fromString()" instead.') } options = options || {}; var matchedFiles = _...
[ "function", "(", "filePatterns", ",", "destination", ",", "options", ")", "{", "try", "{", "var", "fse", "=", "require", "(", "'fs-extra'", ")", "}", "catch", "(", "e", ")", "{", "console", ".", "error", "(", "'This method can only be used in server applicatio...
Compile files to json. @param {String[]} filePatterns - files to compile. Glob patterns can be used to match many files @param {String} destination - where to write the compiled results @param {*} [options] - compiling options
[ "Compile", "files", "to", "json", "." ]
bb3133e0d60ac1eafd53510ecfbe101a103d203f
https://github.com/stefan-dimitrov/i18n-compile/blob/bb3133e0d60ac1eafd53510ecfbe101a103d203f/index.js#L14-L69
train
stewart/apod.js
index.js
randomDate
function randomDate() { var start = new Date(1995, 5, 16), end = new Date(), current = start, dates = []; while (current < end) { dates.push([ current.getFullYear(), current.getMonth() + 1, current.getDate() ].join("-")); current.setDate(current.getDate() + 1); } ...
javascript
function randomDate() { var start = new Date(1995, 5, 16), end = new Date(), current = start, dates = []; while (current < end) { dates.push([ current.getFullYear(), current.getMonth() + 1, current.getDate() ].join("-")); current.setDate(current.getDate() + 1); } ...
[ "function", "randomDate", "(", ")", "{", "var", "start", "=", "new", "Date", "(", "1995", ",", "5", ",", "16", ")", ",", "end", "=", "new", "Date", "(", ")", ",", "current", "=", "start", ",", "dates", "=", "[", "]", ";", "while", "(", "current...
anytime between start of APOD and now
[ "anytime", "between", "start", "of", "APOD", "and", "now" ]
84bea181ac69c3e23ac3659cb4ba3d871d89258f
https://github.com/stewart/apod.js/blob/84bea181ac69c3e23ac3659cb4ba3d871d89258f/index.js#L32-L49
train
rootslab/geco
lib/comb-set.js
function ( n, k ) { if ( ! n || ( n < k ) ) throw new RangeError( 'check input values' ) ; // buffer for generating combinations const buff = balloc( n, 0 ) // colex recursive generator , colex_gen = function *( n, k ) {...
javascript
function ( n, k ) { if ( ! n || ( n < k ) ) throw new RangeError( 'check input values' ) ; // buffer for generating combinations const buff = balloc( n, 0 ) // colex recursive generator , colex_gen = function *( n, k ) {...
[ "function", "(", "n", ",", "k", ")", "{", "if", "(", "!", "n", "||", "(", "n", "<", "k", ")", ")", "throw", "new", "RangeError", "(", "'check input values'", ")", ";", "// buffer for generating combinations", "const", "buff", "=", "balloc", "(", "n", "...
CAT generator for combinations without replacement
[ "CAT", "generator", "for", "combinations", "without", "replacement" ]
b19fb4820eccfecd903e8691d62783757fbd2817
https://github.com/rootslab/geco/blob/b19fb4820eccfecd903e8691d62783757fbd2817/lib/comb-set.js#L19-L57
train
kuno/neco
deps/npm/lib/build.js
build
function build (args, cb) { readAll(args, function (er, args) { if (er) return cb(er) // do all preinstalls, then check deps, then install all, then finish up. chain ( [asyncMap, args, function (a, cb) { return lifecycle(a, "preinstall", cb) }] , [asyncMap, args, function (a,...
javascript
function build (args, cb) { readAll(args, function (er, args) { if (er) return cb(er) // do all preinstalls, then check deps, then install all, then finish up. chain ( [asyncMap, args, function (a, cb) { return lifecycle(a, "preinstall", cb) }] , [asyncMap, args, function (a,...
[ "function", "build", "(", "args", ",", "cb", ")", "{", "readAll", "(", "args", ",", "function", "(", "er", ",", "args", ")", "{", "if", "(", "er", ")", "return", "cb", "(", "er", ")", "// do all preinstalls, then check deps, then install all, then finish up.",...
pkg is either a "package" folder, or a package.json data obj, or an object that has the package.json data on the _data member.
[ "pkg", "is", "either", "a", "package", "folder", "or", "a", "package", ".", "json", "data", "obj", "or", "an", "object", "that", "has", "the", "package", ".", "json", "data", "on", "the", "_data", "member", "." ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/build.js#L40-L66
train
kuno/neco
deps/npm/lib/build.js
resolveDependencies
function resolveDependencies (pkg, cb) { if (!pkg) return topCb(new Error( "Package not found to resolve dependencies")) // link foo-1.0.3 to ROOT/.npm/{pkg}/{version}/node_modules/foo // see if it's bundled already var bundleDir = path.join( npm.dir, pkg.name, pkg.version , "pac...
javascript
function resolveDependencies (pkg, cb) { if (!pkg) return topCb(new Error( "Package not found to resolve dependencies")) // link foo-1.0.3 to ROOT/.npm/{pkg}/{version}/node_modules/foo // see if it's bundled already var bundleDir = path.join( npm.dir, pkg.name, pkg.version , "pac...
[ "function", "resolveDependencies", "(", "pkg", ",", "cb", ")", "{", "if", "(", "!", "pkg", ")", "return", "topCb", "(", "new", "Error", "(", "\"Package not found to resolve dependencies\"", ")", ")", "// link foo-1.0.3 to ROOT/.npm/{pkg}/{version}/node_modules/foo", "//...
make sure that all the dependencies have been installed.
[ "make", "sure", "that", "all", "the", "dependencies", "have", "been", "installed", "." ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/build.js#L162-L203
train
kuno/neco
deps/npm/lib/build.js
dependentLink
function dependentLink (pkg, cb) { asyncMap(pkg._resolvedDeps, function (dep, cb) { var dependents = path.join(npm.dir, dep.name, dep.version, "dependents") , to = path.join(dependents, pkg.name + "@" + pkg.version) , from = path.join(npm.dir, pkg.name, pkg.version) link(from, to, cb) }, cb) }
javascript
function dependentLink (pkg, cb) { asyncMap(pkg._resolvedDeps, function (dep, cb) { var dependents = path.join(npm.dir, dep.name, dep.version, "dependents") , to = path.join(dependents, pkg.name + "@" + pkg.version) , from = path.join(npm.dir, pkg.name, pkg.version) link(from, to, cb) }, cb) }
[ "function", "dependentLink", "(", "pkg", ",", "cb", ")", "{", "asyncMap", "(", "pkg", ".", "_resolvedDeps", ",", "function", "(", "dep", ",", "cb", ")", "{", "var", "dependents", "=", "path", ".", "join", "(", "npm", ".", "dir", ",", "dep", ".", "n...
for each dependency, link this pkg into the proper "dependent" folder
[ "for", "each", "dependency", "link", "this", "pkg", "into", "the", "proper", "dependent", "folder" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/build.js#L216-L223
train
kuno/neco
deps/npm/lib/build.js
dependencyLink
function dependencyLink (pkg, cb) { var dependencies = path.join(npm.dir, pkg.name, pkg.version, "node_modules") , depBin = path.join(npm.dir, pkg.name, pkg.version, "dep-bin") asyncMap(pkg._resolvedDeps, function (dep, cb) { log.silly(dep, "dependency") var fromRoot = path.join(npm.dir, dep.name, dep.v...
javascript
function dependencyLink (pkg, cb) { var dependencies = path.join(npm.dir, pkg.name, pkg.version, "node_modules") , depBin = path.join(npm.dir, pkg.name, pkg.version, "dep-bin") asyncMap(pkg._resolvedDeps, function (dep, cb) { log.silly(dep, "dependency") var fromRoot = path.join(npm.dir, dep.name, dep.v...
[ "function", "dependencyLink", "(", "pkg", ",", "cb", ")", "{", "var", "dependencies", "=", "path", ".", "join", "(", "npm", ".", "dir", ",", "pkg", ".", "name", ",", "pkg", ".", "version", ",", "\"node_modules\"", ")", ",", "depBin", "=", "path", "."...
link each dep into this pkg's "node_modules" folder
[ "link", "each", "dep", "into", "this", "pkg", "s", "node_modules", "folder" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/build.js#L227-L253
train
fatalxiao/js-markdown
src/lib/syntax/block/Paragraph.js
getPrev
function getPrev(renderTree) { if (!renderTree || !renderTree.children || renderTree.children.length < 1 || !renderTree.children[renderTree.children.length - 1]) { return; } return renderTree.children[renderTree.children.length - 1]; }
javascript
function getPrev(renderTree) { if (!renderTree || !renderTree.children || renderTree.children.length < 1 || !renderTree.children[renderTree.children.length - 1]) { return; } return renderTree.children[renderTree.children.length - 1]; }
[ "function", "getPrev", "(", "renderTree", ")", "{", "if", "(", "!", "renderTree", "||", "!", "renderTree", ".", "children", "||", "renderTree", ".", "children", ".", "length", "<", "1", "||", "!", "renderTree", ".", "children", "[", "renderTree", ".", "c...
get prev node in render tree
[ "get", "prev", "node", "in", "render", "tree" ]
dffa23be561f50282e5ccc2f1595a51d18a81246
https://github.com/fatalxiao/js-markdown/blob/dffa23be561f50282e5ccc2f1595a51d18a81246/src/lib/syntax/block/Paragraph.js#L17-L26
train
jeanamarante/catena
tasks/deploy/parse.js
shuffleArray
function shuffleArray (options, arr) { if (!options.minify) { return undefined; } for (let i = 0, max = arr.length; i < max; i++) { let j = randomInt(max); if (arr[j] !== arr[i]) { let source = arr[i]; arr[i] = arr[j]; arr[j] = source; } } }
javascript
function shuffleArray (options, arr) { if (!options.minify) { return undefined; } for (let i = 0, max = arr.length; i < max; i++) { let j = randomInt(max); if (arr[j] !== arr[i]) { let source = arr[i]; arr[i] = arr[j]; arr[j] = source; } } }
[ "function", "shuffleArray", "(", "options", ",", "arr", ")", "{", "if", "(", "!", "options", ".", "minify", ")", "{", "return", "undefined", ";", "}", "for", "(", "let", "i", "=", "0", ",", "max", "=", "arr", ".", "length", ";", "i", "<", "max", ...
Fisher-Yates "inside-out" shuffle. Randomize order of modules and their properties when minifying. @function shuffleArray @param {Object} options @param {Array} arr @api private
[ "Fisher", "-", "Yates", "inside", "-", "out", "shuffle", ".", "Randomize", "order", "of", "modules", "and", "their", "properties", "when", "minifying", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/deploy/parse.js#L107-L120
train
jeanamarante/catena
tasks/deploy/parse.js
parseExtend
function parseExtend (ast) { for (let i = 0, max = ast.body.length; i < max; i++) { let node = ast.body[i]; // Search for extend('Parent', 'Child'); if (isExpressionStatement(node) && isCallExpression(node.expression) && node.expression.callee.name === 'extend') { node = node.ex...
javascript
function parseExtend (ast) { for (let i = 0, max = ast.body.length; i < max; i++) { let node = ast.body[i]; // Search for extend('Parent', 'Child'); if (isExpressionStatement(node) && isCallExpression(node.expression) && node.expression.callee.name === 'extend') { node = node.ex...
[ "function", "parseExtend", "(", "ast", ")", "{", "for", "(", "let", "i", "=", "0", ",", "max", "=", "ast", ".", "body", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "let", "node", "=", "ast", ".", "body", "[", "i", "]", ";...
Search for top level extend invocation and store parent and child modules as hierarchical nodes. @function parseExtend @param {Object} ast @return {Boolean} @api private
[ "Search", "for", "top", "level", "extend", "invocation", "and", "store", "parent", "and", "child", "modules", "as", "hierarchical", "nodes", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/deploy/parse.js#L257-L282
train
jeanamarante/catena
tasks/deploy/parse.js
parseClass
function parseClass (ast, content) { let appendNode = null; let appendName = ''; let constructorNode = null; let constructorName = ''; for (let i = 0, max = ast.body.length; i < max; i++) { let node = ast.body[i]; if (!isExpressionStatement(node) || !isAssignmentExpression(node.exp...
javascript
function parseClass (ast, content) { let appendNode = null; let appendName = ''; let constructorNode = null; let constructorName = ''; for (let i = 0, max = ast.body.length; i < max; i++) { let node = ast.body[i]; if (!isExpressionStatement(node) || !isAssignmentExpression(node.exp...
[ "function", "parseClass", "(", "ast", ",", "content", ")", "{", "let", "appendNode", "=", "null", ";", "let", "appendName", "=", "''", ";", "let", "constructorNode", "=", "null", ";", "let", "constructorName", "=", "''", ";", "for", "(", "let", "i", "=...
Search for top level CLASS constructor and append assignment expressions. @function parseClass @param {Object} ast @param {String} content @return {Boolean} @api private
[ "Search", "for", "top", "level", "CLASS", "constructor", "and", "append", "assignment", "expressions", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/deploy/parse.js#L294-L342
train
jeanamarante/catena
tasks/deploy/parse.js
processClass
function processClass (options, name, node) { processClassConstructor(options, name, node); processClassAppend(options, name, node); shuffleArray(options, node.children); for (let i = 0, max = node.children.length; i < max; i++) { let child = node.children[i]; processClass(options, ch...
javascript
function processClass (options, name, node) { processClassConstructor(options, name, node); processClassAppend(options, name, node); shuffleArray(options, node.children); for (let i = 0, max = node.children.length; i < max; i++) { let child = node.children[i]; processClass(options, ch...
[ "function", "processClass", "(", "options", ",", "name", ",", "node", ")", "{", "processClassConstructor", "(", "options", ",", "name", ",", "node", ")", ";", "processClassAppend", "(", "options", ",", "name", ",", "node", ")", ";", "shuffleArray", "(", "o...
Recursively process the content of class modules into writeArray. @function processClass @param {Object} options @param {String} name @param {Object} node @return {Boolean} @api private
[ "Recursively", "process", "the", "content", "of", "class", "modules", "into", "writeArray", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/deploy/parse.js#L355-L366
train
kuno/neco
deps/npm/lib/config.js
config
function config (args, cb) { var action = args.shift() switch (action) { case "set": return set(args[0], args[1], cb) case "get": return get(args[0], cb) case "delete": case "rm": case "del": return del(args[0], cb) case "list": case "ls": return list(cb) case "edit": return edit(cb) default...
javascript
function config (args, cb) { var action = args.shift() switch (action) { case "set": return set(args[0], args[1], cb) case "get": return get(args[0], cb) case "delete": case "rm": case "del": return del(args[0], cb) case "list": case "ls": return list(cb) case "edit": return edit(cb) default...
[ "function", "config", "(", "args", ",", "cb", ")", "{", "var", "action", "=", "args", ".", "shift", "(", ")", "switch", "(", "action", ")", "{", "case", "\"set\"", ":", "return", "set", "(", "args", "[", "0", "]", ",", "args", "[", "1", "]", ",...
npm config set key value npm config get key npm config list
[ "npm", "config", "set", "key", "value", "npm", "config", "get", "key", "npm", "config", "list" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/config.js#L36-L46
train
lteacher/mysql-query-wrapper
lib/wrapper.js
init
function init(input) { // Use provided pool if(typeof input == 'function') db.pool = input; else { // Create the pool with any options merged with the below defaults db.pool = mysql.createPool(Object.assign({ user: 'root', password: 'root', database: 'test' },input)); } // Set ...
javascript
function init(input) { // Use provided pool if(typeof input == 'function') db.pool = input; else { // Create the pool with any options merged with the below defaults db.pool = mysql.createPool(Object.assign({ user: 'root', password: 'root', database: 'test' },input)); } // Set ...
[ "function", "init", "(", "input", ")", "{", "// Use provided pool", "if", "(", "typeof", "input", "==", "'function'", ")", "db", ".", "pool", "=", "input", ";", "else", "{", "// Create the pool with any options merged with the below defaults", "db", ".", "pool", "...
The db function is the initialiser for setting a pool if provided on require @param {Pool|Object} [input] - Either a mysql.Pool OR a config options object @return {Function} Returns the db function so we can attach additional exports
[ "The", "db", "function", "is", "the", "initialiser", "for", "setting", "a", "pool", "if", "provided", "on", "require" ]
09211b08ef1f8ce429957f42de83cba533df56d5
https://github.com/lteacher/mysql-query-wrapper/blob/09211b08ef1f8ce429957f42de83cba533df56d5/lib/wrapper.js#L12-L29
train
lteacher/mysql-query-wrapper
lib/wrapper.js
_checkConnection
function _checkConnection(conn) { // Return Promise for getConnection callback wrapping return new Promise((resolve, reject) => { if (conn) { resolve(conn); } else { _pool.getConnection((err, conn) => { if (err) reject(err); // Reject this error else resolve(conn); // Resolve the...
javascript
function _checkConnection(conn) { // Return Promise for getConnection callback wrapping return new Promise((resolve, reject) => { if (conn) { resolve(conn); } else { _pool.getConnection((err, conn) => { if (err) reject(err); // Reject this error else resolve(conn); // Resolve the...
[ "function", "_checkConnection", "(", "conn", ")", "{", "// Return Promise for getConnection callback wrapping", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "if", "(", "conn", ")", "{", "resolve", "(", "conn", ")", ";", "}", ...
Check and return a connection, or get new connection from the pool
[ "Check", "and", "return", "a", "connection", "or", "get", "new", "connection", "from", "the", "pool" ]
09211b08ef1f8ce429957f42de83cba533df56d5
https://github.com/lteacher/mysql-query-wrapper/blob/09211b08ef1f8ce429957f42de83cba533df56d5/lib/wrapper.js#L141-L153
train
lteacher/mysql-query-wrapper
lib/wrapper.js
function(sql, val, callback) { let qry = (typeof sql === 'object') ? sql : mysql.format(sql, val); if (!callback && typeof val === 'function') callback = val; // Handle 2 parm scenario _pool.getConnection((err, conn) => { _pool.query(qry, (err, items, fields) => { if (err) return callback(err); ...
javascript
function(sql, val, callback) { let qry = (typeof sql === 'object') ? sql : mysql.format(sql, val); if (!callback && typeof val === 'function') callback = val; // Handle 2 parm scenario _pool.getConnection((err, conn) => { _pool.query(qry, (err, items, fields) => { if (err) return callback(err); ...
[ "function", "(", "sql", ",", "val", ",", "callback", ")", "{", "let", "qry", "=", "(", "typeof", "sql", "===", "'object'", ")", "?", "sql", ":", "mysql", ".", "format", "(", "sql", ",", "val", ")", ";", "if", "(", "!", "callback", "&&", "typeof",...
Exposes the basic query without promise
[ "Exposes", "the", "basic", "query", "without", "promise" ]
09211b08ef1f8ce429957f42de83cba533df56d5
https://github.com/lteacher/mysql-query-wrapper/blob/09211b08ef1f8ce429957f42de83cba533df56d5/lib/wrapper.js#L156-L169
train
morungos/log4js-knex
lib/log4js-knex.js
knexAppender
function knexAppender(config, layouts) { if (! config.knex) { throw new Error('knex.js connection parameters are missing'); } let layout = null; if (config.layout) { layout = layouts.layout(config.layout.type, config.layout); } else { layout = layouts.messagePassThroughLayout; } let tableNa...
javascript
function knexAppender(config, layouts) { if (! config.knex) { throw new Error('knex.js connection parameters are missing'); } let layout = null; if (config.layout) { layout = layouts.layout(config.layout.type, config.layout); } else { layout = layouts.messagePassThroughLayout; } let tableNa...
[ "function", "knexAppender", "(", "config", ",", "layouts", ")", "{", "if", "(", "!", "config", ".", "knex", ")", "{", "throw", "new", "Error", "(", "'knex.js connection parameters are missing'", ")", ";", "}", "let", "layout", "=", "null", ";", "if", "(", ...
Returns a function to log data in knex. @param {Object} config The configuration object. @param {string} config.connectionString The connection string to the mongo db. @param {string=} config.layout The log4js layout. @param {string=} config.write The write mode. @returns {Function}
[ "Returns", "a", "function", "to", "log", "data", "in", "knex", "." ]
973d7072136d1b67624cdd821b59c019798f3349
https://github.com/morungos/log4js-knex/blob/973d7072136d1b67624cdd821b59c019798f3349/lib/log4js-knex.js#L15-L48
train
bholloway/browserify-debug-tools
lib/match.js
match
function match(regex, callback) { return inspect(onComplete); function onComplete(filename, contents, done) { callback(filename, contents.match(regex), done); if (callback.length < 3) { done(); } } }
javascript
function match(regex, callback) { return inspect(onComplete); function onComplete(filename, contents, done) { callback(filename, contents.match(regex), done); if (callback.length < 3) { done(); } } }
[ "function", "match", "(", "regex", ",", "callback", ")", "{", "return", "inspect", "(", "onComplete", ")", ";", "function", "onComplete", "(", "filename", ",", "contents", ",", "done", ")", "{", "callback", "(", "filename", ",", "contents", ".", "match", ...
Match a regular expression in the transformed file's contents and call the given method for each file. @param {RegExp} regex A regular expression to test the file contents @param {function} callback A method to call with the filename and matches for each file
[ "Match", "a", "regular", "expression", "in", "the", "transformed", "file", "s", "contents", "and", "call", "the", "given", "method", "for", "each", "file", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/match.js#L10-L19
train
avoidwork/mpass
src/random.js
random
function random (arg, used) { var n; do { n = Math.floor(Math.random() * arg); } while (used[n]); used[n] = 1; return n; }
javascript
function random (arg, used) { var n; do { n = Math.floor(Math.random() * arg); } while (used[n]); used[n] = 1; return n; }
[ "function", "random", "(", "arg", ",", "used", ")", "{", "var", "n", ";", "do", "{", "n", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "arg", ")", ";", "}", "while", "(", "used", "[", "n", "]", ")", ";", "used", "["...
Generates a random number between 0 & ceiling @method random @param {Number} arg Ceiling @param {Object} used Hash of used indices @return {Number} Random number between 0 and ceiling
[ "Generates", "a", "random", "number", "between", "0", "&", "ceiling" ]
3881af71808c1eba55a9f0525c919f0491e949cb
https://github.com/avoidwork/mpass/blob/3881af71808c1eba55a9f0525c919f0491e949cb/src/random.js#L9-L19
train
chrisJohn404/LabJack-nodejs
lib/device.js
function(err, res) { if(err) { return onError('Weird Error open', err); } //Check for no errors if(res === 0) { //Save the handle & other information to the // device class self.handle = refDeviceHandle.readInt32LE(0); self.deviceType = deviceType; self.connectionType = co...
javascript
function(err, res) { if(err) { return onError('Weird Error open', err); } //Check for no errors if(res === 0) { //Save the handle & other information to the // device class self.handle = refDeviceHandle.readInt32LE(0); self.deviceType = deviceType; self.connectionType = co...
[ "function", "(", "err", ",", "res", ")", "{", "if", "(", "err", ")", "{", "return", "onError", "(", "'Weird Error open'", ",", "err", ")", ";", "}", "//Check for no errors", "if", "(", "res", "===", "0", ")", "{", "//Save the handle & other information to th...
Function for handling the ffi callback
[ "Function", "for", "handling", "the", "ffi", "callback" ]
6f638eb039f3e1619e46ba5aac20d827fecafc29
https://github.com/chrisJohn404/LabJack-nodejs/blob/6f638eb039f3e1619e46ba5aac20d827fecafc29/lib/device.js#L207-L230
train
chrisJohn404/LabJack-nodejs
lib/device.js
function(address, writeData) { var writeInfo = { 'isValid': false, 'message': 'Unknown Reason', // Data to be written 'address': undefined, 'type': undefined, 'numValues': undefined, 'aValues': undefined, 'errorAddress': undefined, }; var info = self.constants.getAddressInfo(address, 'W'...
javascript
function(address, writeData) { var writeInfo = { 'isValid': false, 'message': 'Unknown Reason', // Data to be written 'address': undefined, 'type': undefined, 'numValues': undefined, 'aValues': undefined, 'errorAddress': undefined, }; var info = self.constants.getAddressInfo(address, 'W'...
[ "function", "(", "address", ",", "writeData", ")", "{", "var", "writeInfo", "=", "{", "'isValid'", ":", "false", ",", "'message'", ":", "'Unknown Reason'", ",", "// Data to be written", "'address'", ":", "undefined", ",", "'type'", ":", "undefined", ",", "'num...
A helper function for the writeArray and writeArraySync function to parse or interpret the data to be written.
[ "A", "helper", "function", "for", "the", "writeArray", "and", "writeArraySync", "function", "to", "parse", "or", "interpret", "the", "data", "to", "be", "written", "." ]
6f638eb039f3e1619e46ba5aac20d827fecafc29
https://github.com/chrisJohn404/LabJack-nodejs/blob/6f638eb039f3e1619e46ba5aac20d827fecafc29/lib/device.js#L1590-L1668
train
oleynikd/gulp-wp-file-header
index.js
function(manifest) { var out = "/*\n"; _.forEach(fields, function(n, key) { if (typeof manifest[key] != "undefined") { out += pad(n+":", 20) + manifest[key] + "\n"; } }); out += "*/\n"; return out; }
javascript
function(manifest) { var out = "/*\n"; _.forEach(fields, function(n, key) { if (typeof manifest[key] != "undefined") { out += pad(n+":", 20) + manifest[key] + "\n"; } }); out += "*/\n"; return out; }
[ "function", "(", "manifest", ")", "{", "var", "out", "=", "\"/*\\n\"", ";", "_", ".", "forEach", "(", "fields", ",", "function", "(", "n", ",", "key", ")", "{", "if", "(", "typeof", "manifest", "[", "key", "]", "!=", "\"undefined\"", ")", "{", "out...
Creates style.css header content. @param {Object} manifest @return {string} TODO: add Author URI TODO: add license info
[ "Creates", "style", ".", "css", "header", "content", "." ]
6834e1a83208f6875bf6010de021c7bc5a28efe5
https://github.com/oleynikd/gulp-wp-file-header/blob/6834e1a83208f6875bf6010de021c7bc5a28efe5/index.js#L89-L99
train
jeanamarante/catena
tasks/catena.js
streamWrappers
function streamWrappers (grunt, fileData, options) { stream.createWriteStream(fileData.tmpWrapStart, () => { streamWrapperEnd(grunt, fileData, options); }); if (options.license) { streamLicense(grunt, fileData, options); } else { streamWrapperStart(grunt, fileData, options); ...
javascript
function streamWrappers (grunt, fileData, options) { stream.createWriteStream(fileData.tmpWrapStart, () => { streamWrapperEnd(grunt, fileData, options); }); if (options.license) { streamLicense(grunt, fileData, options); } else { streamWrapperStart(grunt, fileData, options); ...
[ "function", "streamWrappers", "(", "grunt", ",", "fileData", ",", "options", ")", "{", "stream", ".", "createWriteStream", "(", "fileData", ".", "tmpWrapStart", ",", "(", ")", "=>", "{", "streamWrapperEnd", "(", "grunt", ",", "fileData", ",", "options", ")",...
Create files that will be used to wrap all the matched Javascript files. @function streamWrappers @param {Object} grunt @param {Object} fileData @param {Object} options @api private
[ "Create", "files", "that", "will", "be", "used", "to", "wrap", "all", "the", "matched", "Javascript", "files", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/catena.js#L151-L161
train
jeanamarante/catena
tasks/catena.js
streamLicense
function streamLicense (grunt, fileData, options) { let content = grunt.file.read(options.license); // Use JSDoc license tag to preserve file content as // comment when minifying. if (options.deploy && options.minify) { content = `/**@license ${content}*/`; } else { content = `/*\x0...
javascript
function streamLicense (grunt, fileData, options) { let content = grunt.file.read(options.license); // Use JSDoc license tag to preserve file content as // comment when minifying. if (options.deploy && options.minify) { content = `/**@license ${content}*/`; } else { content = `/*\x0...
[ "function", "streamLicense", "(", "grunt", ",", "fileData", ",", "options", ")", "{", "let", "content", "=", "grunt", ".", "file", ".", "read", "(", "options", ".", "license", ")", ";", "// Use JSDoc license tag to preserve file content as", "// comment when minifyi...
Prepend license in the starting wrapper. @function streamLicense @param {Object} grunt @param {Object} fileData @param {Object} options @api private
[ "Prepend", "license", "in", "the", "starting", "wrapper", "." ]
c7762332f71c0fd7cfafba8d1e3cd66053529954
https://github.com/jeanamarante/catena/blob/c7762332f71c0fd7cfafba8d1e3cd66053529954/tasks/catena.js#L173-L187
train