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
tomaszczechowski/jsbeautify-loader
index.js
function (options, fileExtension) { var getOptionsKey = function (options, fileExtension) { for (var prop in options) { var _prop = prop.toLowerCase(); if ((options[_prop].hasOwnProperty('allowed_file_extensions') && options[_prop].allowed_file_extensions.indexOf(fileExtension) > -1) || (!options[_pr...
javascript
function (options, fileExtension) { var getOptionsKey = function (options, fileExtension) { for (var prop in options) { var _prop = prop.toLowerCase(); if ((options[_prop].hasOwnProperty('allowed_file_extensions') && options[_prop].allowed_file_extensions.indexOf(fileExtension) > -1) || (!options[_pr...
[ "function", "(", "options", ",", "fileExtension", ")", "{", "var", "getOptionsKey", "=", "function", "(", "options", ",", "fileExtension", ")", "{", "for", "(", "var", "prop", "in", "options", ")", "{", "var", "_prop", "=", "prop", ".", "toLowerCase", "(...
Method checks whether file's extension has corresponded configuration object. @param {Object} options - configuration object. @param {String} fileExtension - file's extension. @return {String|Object} - object key or null.
[ "Method", "checks", "whether", "file", "s", "extension", "has", "corresponded", "configuration", "object", "." ]
a896ee6c348d779c27694e3225cf5355f88b2e74
https://github.com/tomaszczechowski/jsbeautify-loader/blob/a896ee6c348d779c27694e3225cf5355f88b2e74/index.js#L73-L92
train
tomaszczechowski/jsbeautify-loader
index.js
function (source, fileExtension, globalOptions, beautify) { var path = rcFile.for(this.resourcePath) , options = globalOptions || {}; if (globalOptions === null && typeof path === "string") { this.addDependency(path); options = JSON.parse(stripJsonComments(fs.readFileSync(path, "utf8"))); } return...
javascript
function (source, fileExtension, globalOptions, beautify) { var path = rcFile.for(this.resourcePath) , options = globalOptions || {}; if (globalOptions === null && typeof path === "string") { this.addDependency(path); options = JSON.parse(stripJsonComments(fs.readFileSync(path, "utf8"))); } return...
[ "function", "(", "source", ",", "fileExtension", ",", "globalOptions", ",", "beautify", ")", "{", "var", "path", "=", "rcFile", ".", "for", "(", "this", ".", "resourcePath", ")", ",", "options", "=", "globalOptions", "||", "{", "}", ";", "if", "(", "gl...
Method parses file synchronously @param {String} source - file's content. @param {String} fileExtension - file's extension. @param {Object} globalOptions - configuration from weback file. @return {String} - parsed content of file.
[ "Method", "parses", "file", "synchronously" ]
a896ee6c348d779c27694e3225cf5355f88b2e74
https://github.com/tomaszczechowski/jsbeautify-loader/blob/a896ee6c348d779c27694e3225cf5355f88b2e74/index.js#L101-L111
train
tomaszczechowski/jsbeautify-loader
index.js
function (source, fileExtension, globalOptions, beautify, callback) { var _this = this; if (globalOptions === null) { rcFile.for(this.resourcePath, function (err, path) { if (!err) { if (typeof path === "string") { _this.addDependency(path); fs.readFile(path, "utf8", function...
javascript
function (source, fileExtension, globalOptions, beautify, callback) { var _this = this; if (globalOptions === null) { rcFile.for(this.resourcePath, function (err, path) { if (!err) { if (typeof path === "string") { _this.addDependency(path); fs.readFile(path, "utf8", function...
[ "function", "(", "source", ",", "fileExtension", ",", "globalOptions", ",", "beautify", ",", "callback", ")", "{", "var", "_this", "=", "this", ";", "if", "(", "globalOptions", "===", "null", ")", "{", "rcFile", ".", "for", "(", "this", ".", "resourcePat...
Method parses file asynchronously @param {String} source - file's content. @param {String} fileExtension - file's extension. @param {Object} globalOptions - configuration from weback file. @param {Function} callback - callback function with processed file content or with error message.
[ "Method", "parses", "file", "asynchronously" ]
a896ee6c348d779c27694e3225cf5355f88b2e74
https://github.com/tomaszczechowski/jsbeautify-loader/blob/a896ee6c348d779c27694e3225cf5355f88b2e74/index.js#L120-L147
train
joelabair/Bracket-Templates
index.js
_extract
function _extract(keyStr, dataObj) { var altkey, _subKey, _splitPoint, _found = false, dataValue = null, _queryParts = []; if (dataObj && typeof dataObj === 'object') { dataValue = Object.create(dataObj); _queryParts = keyStr.split(/[\-\_\.]/); //console.warn("INIT:", keyStr, _queryParts); // tes...
javascript
function _extract(keyStr, dataObj) { var altkey, _subKey, _splitPoint, _found = false, dataValue = null, _queryParts = []; if (dataObj && typeof dataObj === 'object') { dataValue = Object.create(dataObj); _queryParts = keyStr.split(/[\-\_\.]/); //console.warn("INIT:", keyStr, _queryParts); // tes...
[ "function", "_extract", "(", "keyStr", ",", "dataObj", ")", "{", "var", "altkey", ",", "_subKey", ",", "_splitPoint", ",", "_found", "=", "false", ",", "dataValue", "=", "null", ",", "_queryParts", "=", "[", "]", ";", "if", "(", "dataObj", "&&", "typeo...
key notation value extraction @param {String} keyStr The key string, including sub-key notation (i.e. this.prop.key or thing-prop). @param {Object} dataObj The data object an array or object. @returns {Mixed}
[ "key", "notation", "value", "extraction" ]
6a2025b900e1dde68bf20820c3dec7c48bf98c7d
https://github.com/joelabair/Bracket-Templates/blob/6a2025b900e1dde68bf20820c3dec7c48bf98c7d/index.js#L50-L96
train
joelabair/Bracket-Templates
index.js
renderData
function renderData(textString, options, data, doSpecials) { var replacer = function replacer(match, $1, $2) { var extracted, dataValue, key = String($1 || '').trim(), defaultValue = String($2 || '').trim(); // literal bracket excaping via \[ text ] if(match.substr(0, 1) === "\\") { return match.su...
javascript
function renderData(textString, options, data, doSpecials) { var replacer = function replacer(match, $1, $2) { var extracted, dataValue, key = String($1 || '').trim(), defaultValue = String($2 || '').trim(); // literal bracket excaping via \[ text ] if(match.substr(0, 1) === "\\") { return match.su...
[ "function", "renderData", "(", "textString", ",", "options", ",", "data", ",", "doSpecials", ")", "{", "var", "replacer", "=", "function", "replacer", "(", "match", ",", "$1", ",", "$2", ")", "{", "var", "extracted", ",", "dataValue", ",", "key", "=", ...
Text tag renderer @param {String} textString The template string. @param {Object} options The current options config. @param {Object} data The source keys and values as an object. @param {Bool} doSpecials Optional - render plain special keys [KEY, INDEX, VALUE] @returns {String}
[ "Text", "tag", "renderer" ]
6a2025b900e1dde68bf20820c3dec7c48bf98c7d
https://github.com/joelabair/Bracket-Templates/blob/6a2025b900e1dde68bf20820c3dec7c48bf98c7d/index.js#L199-L244
train
joelabair/Bracket-Templates
index.js
getOptions
function getOptions(opts) { var obj = Object.create(_options); obj = util._extend(obj, opts); return obj; }
javascript
function getOptions(opts) { var obj = Object.create(_options); obj = util._extend(obj, opts); return obj; }
[ "function", "getOptions", "(", "opts", ")", "{", "var", "obj", "=", "Object", ".", "create", "(", "_options", ")", ";", "obj", "=", "util", ".", "_extend", "(", "obj", ",", "opts", ")", ";", "return", "obj", ";", "}" ]
Return options inheriting form the module defaults. @param {Object} options Custom options passed in. @returns {Object}
[ "Return", "options", "inheriting", "form", "the", "module", "defaults", "." ]
6a2025b900e1dde68bf20820c3dec7c48bf98c7d
https://github.com/joelabair/Bracket-Templates/blob/6a2025b900e1dde68bf20820c3dec7c48bf98c7d/index.js#L253-L257
train
mkormendy/node-alarm-dot-com
index.js
getCurrentState
function getCurrentState(systemID, authOpts) { return authenticatedGet(SYSTEM_URL + systemID, authOpts).then(res => { const rels = res.data.relationships const partTasks = rels.partitions.data.map(p => getPartition(p.id, authOpts) ) const sensorIDs = rels.sensors.data.map(s => s.id) return ...
javascript
function getCurrentState(systemID, authOpts) { return authenticatedGet(SYSTEM_URL + systemID, authOpts).then(res => { const rels = res.data.relationships const partTasks = rels.partitions.data.map(p => getPartition(p.id, authOpts) ) const sensorIDs = rels.sensors.data.map(s => s.id) return ...
[ "function", "getCurrentState", "(", "systemID", ",", "authOpts", ")", "{", "return", "authenticatedGet", "(", "SYSTEM_URL", "+", "systemID", ",", "authOpts", ")", ".", "then", "(", "res", "=>", "{", "const", "rels", "=", "res", ".", "data", ".", "relations...
Retrieve information about the current state of a security system including attributes, partitions, sensors, and relationships. @param {string} systemID ID of the system to query. The Authentication object returned from the `login` method contains a `systems` property which is an array of system IDs. @param {Object} a...
[ "Retrieve", "information", "about", "the", "current", "state", "of", "a", "security", "system", "including", "attributes", "partitions", "sensors", "and", "relationships", "." ]
b4ac45886eaddd5e739cd49b7aa8f9189c0124cc
https://github.com/mkormendy/node-alarm-dot-com/blob/b4ac45886eaddd5e739cd49b7aa8f9189c0124cc/index.js#L167-L189
train
mkormendy/node-alarm-dot-com
index.js
getSensors
function getSensors(sensorIDs, authOpts) { if (!Array.isArray(sensorIDs)) sensorIDs = [sensorIDs] const query = sensorIDs.map(id => `ids%5B%5D=${id}`).join('&') const url = `${SENSORS_URL}?${query}` return authenticatedGet(url, authOpts) }
javascript
function getSensors(sensorIDs, authOpts) { if (!Array.isArray(sensorIDs)) sensorIDs = [sensorIDs] const query = sensorIDs.map(id => `ids%5B%5D=${id}`).join('&') const url = `${SENSORS_URL}?${query}` return authenticatedGet(url, authOpts) }
[ "function", "getSensors", "(", "sensorIDs", ",", "authOpts", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "sensorIDs", ")", ")", "sensorIDs", "=", "[", "sensorIDs", "]", "const", "query", "=", "sensorIDs", ".", "map", "(", "id", "=>", "`", ...
Get information for one or more sensors. @param {string|string[]} sensorIDs Array of sensor ID strings. @param {Object} authOpts Authentication object returned from the `login` method. @returns {Promise}
[ "Get", "information", "for", "one", "or", "more", "sensors", "." ]
b4ac45886eaddd5e739cd49b7aa8f9189c0124cc
https://github.com/mkormendy/node-alarm-dot-com/blob/b4ac45886eaddd5e739cd49b7aa8f9189c0124cc/index.js#L211-L216
train
buttercup/buttercup-core-web
source/StorageInterface.js
function(key, defaultValue) { var value = window.localStorage.getItem(key); return value ? JSON.parse(value) : defaultValue; }
javascript
function(key, defaultValue) { var value = window.localStorage.getItem(key); return value ? JSON.parse(value) : defaultValue; }
[ "function", "(", "key", ",", "defaultValue", ")", "{", "var", "value", "=", "window", ".", "localStorage", ".", "getItem", "(", "key", ")", ";", "return", "value", "?", "JSON", ".", "parse", "(", "value", ")", ":", "defaultValue", ";", "}" ]
Get data from storage @memberof StorageInterface @name getData @static @param {String} key The key to fetch for @param {*} defaultValue The default value if the key is not found @returns {*} The fetched data
[ "Get", "data", "from", "storage" ]
40b6ff7ee4b04a085720dbb013782be8e921f864
https://github.com/buttercup/buttercup-core-web/blob/40b6ff7ee4b04a085720dbb013782be8e921f864/source/StorageInterface.js#L18-L21
train
cgalvarez/atom-coverage
lib/util.js
writeConfig
function writeConfig(filePath, data, fileFormat) { if (!filePath || !data) { throw new Error('No file/data to save!'); } const ext = rgxExt.exec(filePath) || []; const format = fileFormat || ext[1]; if (format === 'yaml' || format === 'yml') { return writeFileSync(filePath, yaml.safeDump(data), { en...
javascript
function writeConfig(filePath, data, fileFormat) { if (!filePath || !data) { throw new Error('No file/data to save!'); } const ext = rgxExt.exec(filePath) || []; const format = fileFormat || ext[1]; if (format === 'yaml' || format === 'yml') { return writeFileSync(filePath, yaml.safeDump(data), { en...
[ "function", "writeConfig", "(", "filePath", ",", "data", ",", "fileFormat", ")", "{", "if", "(", "!", "filePath", "||", "!", "data", ")", "{", "throw", "new", "Error", "(", "'No file/data to save!'", ")", ";", "}", "const", "ext", "=", "rgxExt", ".", "...
Writes a given JSON object `data` to a `filePath` with the requested `format`. @param {String} filePath The path where to write the file. @param {Object} data The object to write into the file contents. @param {String} fileFormat One of "yaml", "yml", "json".
[ "Writes", "a", "given", "JSON", "object", "data", "to", "a", "filePath", "with", "the", "requested", "format", "." ]
c0f9f621bad474079f809b56b532ab2f4004c151
https://github.com/cgalvarez/atom-coverage/blob/c0f9f621bad474079f809b56b532ab2f4004c151/lib/util.js#L35-L48
train
cgalvarez/atom-coverage
lib/util.js
readConfig
function readConfig(globPattern, fileFormat) { const filepath = findConfigFile(globPattern); if (!filepath) { this.settings = {}; return; } const ext = rgxExt.exec(filepath) || []; const format = fileFormat || ext[1]; const settings = (format === 'yaml' || format === 'yml') ? yaml.safeLoad(re...
javascript
function readConfig(globPattern, fileFormat) { const filepath = findConfigFile(globPattern); if (!filepath) { this.settings = {}; return; } const ext = rgxExt.exec(filepath) || []; const format = fileFormat || ext[1]; const settings = (format === 'yaml' || format === 'yml') ? yaml.safeLoad(re...
[ "function", "readConfig", "(", "globPattern", ",", "fileFormat", ")", "{", "const", "filepath", "=", "findConfigFile", "(", "globPattern", ")", ";", "if", "(", "!", "filepath", ")", "{", "this", ".", "settings", "=", "{", "}", ";", "return", ";", "}", ...
Searches a config file under current working dir, using the provided glob pattern `globPattern`. If found, parses its contents based on the provided `fileFormat`. Currently only supports YAML or JSON formats (defaults to JSON if format not provided and cannot be inferred from file extension). NOTE This function is me...
[ "Searches", "a", "config", "file", "under", "current", "working", "dir", "using", "the", "provided", "glob", "pattern", "globPattern", "." ]
c0f9f621bad474079f809b56b532ab2f4004c151
https://github.com/cgalvarez/atom-coverage/blob/c0f9f621bad474079f809b56b532ab2f4004c151/lib/util.js#L79-L96
train
Marketcloud/marketcloud-js
src/request.js
createXMLHTTPObject
function createXMLHTTPObject () { var xmlhttp = false for (var i = 0; i < XMLHttpFactories.length; i++) { try { xmlhttp = XMLHttpFactories[i]() } catch (e) { continue } break } return xmlhttp }
javascript
function createXMLHTTPObject () { var xmlhttp = false for (var i = 0; i < XMLHttpFactories.length; i++) { try { xmlhttp = XMLHttpFactories[i]() } catch (e) { continue } break } return xmlhttp }
[ "function", "createXMLHTTPObject", "(", ")", "{", "var", "xmlhttp", "=", "false", "for", "(", "var", "i", "=", "0", ";", "i", "<", "XMLHttpFactories", ".", "length", ";", "i", "++", ")", "{", "try", "{", "xmlhttp", "=", "XMLHttpFactories", "[", "i", ...
Builds an AJAX request in a cross browser fashion @returns {XMLHttpRequest|ActiveXObject} The crafted request
[ "Builds", "an", "AJAX", "request", "in", "a", "cross", "browser", "fashion" ]
b41faa9b26445c39422aa167a5cc804ef00d9552
https://github.com/Marketcloud/marketcloud-js/blob/b41faa9b26445c39422aa167a5cc804ef00d9552/src/request.js#L20-L31
train
sydneystockholm/jpegmini
index.js
optionString
function optionString(options) { return Object.keys(options).map(function (key) { var value = options[key]; if (value === null) { return '-' + key; } else if (typeof value === 'number') { value += ''; } else if (typeof value === 'string') { value =...
javascript
function optionString(options) { return Object.keys(options).map(function (key) { var value = options[key]; if (value === null) { return '-' + key; } else if (typeof value === 'number') { value += ''; } else if (typeof value === 'string') { value =...
[ "function", "optionString", "(", "options", ")", "{", "return", "Object", ".", "keys", "(", "options", ")", ".", "map", "(", "function", "(", "key", ")", "{", "var", "value", "=", "options", "[", "key", "]", ";", "if", "(", "value", "===", "null", ...
Convert an options object to a string.
[ "Convert", "an", "options", "object", "to", "a", "string", "." ]
4ac2377286510817a079dcc84c9d8b1db9a746f6
https://github.com/sydneystockholm/jpegmini/blob/4ac2377286510817a079dcc84c9d8b1db9a746f6/index.js#L168-L180
train
sydneystockholm/jpegmini
index.js
randomString
function randomString() { var str = '', length = 32; while (length--) { str += String.fromCharCode(Math.random() * 26 | 97); } return str; }
javascript
function randomString() { var str = '', length = 32; while (length--) { str += String.fromCharCode(Math.random() * 26 | 97); } return str; }
[ "function", "randomString", "(", ")", "{", "var", "str", "=", "''", ",", "length", "=", "32", ";", "while", "(", "length", "--", ")", "{", "str", "+=", "String", ".", "fromCharCode", "(", "Math", ".", "random", "(", ")", "*", "26", "|", "97", ")"...
Get a random 32 byte string.
[ "Get", "a", "random", "32", "byte", "string", "." ]
4ac2377286510817a079dcc84c9d8b1db9a746f6
https://github.com/sydneystockholm/jpegmini/blob/4ac2377286510817a079dcc84c9d8b1db9a746f6/index.js#L186-L192
train
kotfire/jquery-clockpicker
dist/jquery-clockpicker.js
function() { var element = this.element, template = this.template, offset = element.offset(), width = element.outerWidth(), height = element.outerHeight(), position = this.options.position, alignment = this.optio...
javascript
function() { var element = this.element, template = this.template, offset = element.offset(), width = element.outerWidth(), height = element.outerHeight(), position = this.options.position, alignment = this.optio...
[ "function", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "template", "=", "this", ".", "template", ",", "offset", "=", "element", ".", "offset", "(", ")", ",", "width", "=", "element", ".", "outerWidth", "(", ")", ",", "height",...
Set template position
[ "Set", "template", "position" ]
dc41cc5efb1dcd5a583db25cd92fb9f62933a92a
https://github.com/kotfire/jquery-clockpicker/blob/dc41cc5efb1dcd5a583db25cd92fb9f62933a92a/dist/jquery-clockpicker.js#L451-L491
train
kotfire/jquery-clockpicker
dist/jquery-clockpicker.js
function(view, delay) { var self = this; var raiseAfterShowHours = false; var raiseAfterShowMinutes = false; if (view === 'hours') { raiseCallback(this.options.beforeShowHours); raiseAfterShowHours = true; } if (vie...
javascript
function(view, delay) { var self = this; var raiseAfterShowHours = false; var raiseAfterShowMinutes = false; if (view === 'hours') { raiseCallback(this.options.beforeShowHours); raiseAfterShowHours = true; } if (vie...
[ "function", "(", "view", ",", "delay", ")", "{", "var", "self", "=", "this", ";", "var", "raiseAfterShowHours", "=", "false", ";", "var", "raiseAfterShowMinutes", "=", "false", ";", "if", "(", "view", "===", "'hours'", ")", "{", "raiseCallback", "(", "th...
Toggle to hours or minutes view
[ "Toggle", "to", "hours", "or", "minutes", "view" ]
dc41cc5efb1dcd5a583db25cd92fb9f62933a92a
https://github.com/kotfire/jquery-clockpicker/blob/dc41cc5efb1dcd5a583db25cd92fb9f62933a92a/dist/jquery-clockpicker.js#L575-L619
train
kotfire/jquery-clockpicker
dist/jquery-clockpicker.js
function(delay) { var view = this.currentView, value = this[view], isHours = view === 'hours', unit = Math.PI / (isHours ? 6 : 30), radian = value * unit, radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius, ...
javascript
function(delay) { var view = this.currentView, value = this[view], isHours = view === 'hours', unit = Math.PI / (isHours ? 6 : 30), radian = value * unit, radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius, ...
[ "function", "(", "delay", ")", "{", "var", "view", "=", "this", ".", "currentView", ",", "value", "=", "this", "[", "view", "]", ",", "isHours", "=", "view", "===", "'hours'", ",", "unit", "=", "Math", ".", "PI", "/", "(", "isHours", "?", "6", ":...
Reset clock hand
[ "Reset", "clock", "hand" ]
dc41cc5efb1dcd5a583db25cd92fb9f62933a92a
https://github.com/kotfire/jquery-clockpicker/blob/dc41cc5efb1dcd5a583db25cd92fb9f62933a92a/dist/jquery-clockpicker.js#L622-L642
train
kotfire/jquery-clockpicker
dist/jquery-clockpicker.js
function(timeObject) { this.hours = timeObject.hours; this.minutes = timeObject.minutes; this.amOrPm = timeObject.amOrPm; this._checkTimeLimits(); this._updateLabels(); this.resetClock(); }
javascript
function(timeObject) { this.hours = timeObject.hours; this.minutes = timeObject.minutes; this.amOrPm = timeObject.amOrPm; this._checkTimeLimits(); this._updateLabels(); this.resetClock(); }
[ "function", "(", "timeObject", ")", "{", "this", ".", "hours", "=", "timeObject", ".", "hours", ";", "this", ".", "minutes", "=", "timeObject", ".", "minutes", ";", "this", ".", "amOrPm", "=", "timeObject", ".", "amOrPm", ";", "this", ".", "_checkTimeLim...
Set time from ClockTime object
[ "Set", "time", "from", "ClockTime", "object" ]
dc41cc5efb1dcd5a583db25cd92fb9f62933a92a
https://github.com/kotfire/jquery-clockpicker/blob/dc41cc5efb1dcd5a583db25cd92fb9f62933a92a/dist/jquery-clockpicker.js#L848-L858
train
vrest-io/vrunner
lib/replacingStrings.js
function(str, methodDec, methodName, method, methodsMap, options){ var methodValue = getMethodValue(methodDec, methodName, method, methodsMap, options); if(str === methodDec) return methodValue; return str.replace(methodDec, function(){ return methodValue; }); }
javascript
function(str, methodDec, methodName, method, methodsMap, options){ var methodValue = getMethodValue(methodDec, methodName, method, methodsMap, options); if(str === methodDec) return methodValue; return str.replace(methodDec, function(){ return methodValue; }); }
[ "function", "(", "str", ",", "methodDec", ",", "methodName", ",", "method", ",", "methodsMap", ",", "options", ")", "{", "var", "methodValue", "=", "getMethodValue", "(", "methodDec", ",", "methodName", ",", "method", ",", "methodsMap", ",", "options", ")", ...
invokes a single method and replaces its value in the string
[ "invokes", "a", "single", "method", "and", "replaces", "its", "value", "in", "the", "string" ]
cad70c21cb9a763e74dcffebad1c45ca11a63a1e
https://github.com/vrest-io/vrunner/blob/cad70c21cb9a763e74dcffebad1c45ca11a63a1e/lib/replacingStrings.js#L179-L183
train
nickclaw/alexa-ssml
src/renderToString.js
renderNode
function renderNode(node, children = []) { [...children].forEach(child => { if (child && child.tag) { node.ele(child.tag, child.props); renderNode(node, child.children); node.end(); } else { node.text(child); } }); }
javascript
function renderNode(node, children = []) { [...children].forEach(child => { if (child && child.tag) { node.ele(child.tag, child.props); renderNode(node, child.children); node.end(); } else { node.text(child); } }); }
[ "function", "renderNode", "(", "node", ",", "children", "=", "[", "]", ")", "{", "[", "...", "children", "]", ".", "forEach", "(", "child", "=>", "{", "if", "(", "child", "&&", "child", ".", "tag", ")", "{", "node", ".", "ele", "(", "child", ".",...
Recursively turns jsx children into xml nodes @param {Array} children @param {XMLNode} node
[ "Recursively", "turns", "jsx", "children", "into", "xml", "nodes" ]
f857e2daa9e4e5d7ed1ff40b78fd56a66d9d228d
https://github.com/nickclaw/alexa-ssml/blob/f857e2daa9e4e5d7ed1ff40b78fd56a66d9d228d/src/renderToString.js#L21-L31
train
naturalatlas/tilestrata-vtile-raster
index.js
initialize
function initialize(server, callback) { source = new Backend(server, options); source.initialize(callback); }
javascript
function initialize(server, callback) { source = new Backend(server, options); source.initialize(callback); }
[ "function", "initialize", "(", "server", ",", "callback", ")", "{", "source", "=", "new", "Backend", "(", "server", ",", "options", ")", ";", "source", ".", "initialize", "(", "callback", ")", ";", "}" ]
Initializes the mapnik datasource. @param {TileServer} server @param {function} callback(err, fn) @return {void}
[ "Initializes", "the", "mapnik", "datasource", "." ]
e97ae82894362023aed05f0391defd434f974aff
https://github.com/naturalatlas/tilestrata-vtile-raster/blob/e97ae82894362023aed05f0391defd434f974aff/index.js#L30-L33
train
laurent22/joplin-turndown
src/turndown.js
replacementForNode
function replacementForNode (node) { var rule = this.rules.forNode(node) var content = process.call(this, node) var whitespace = node.flankingWhitespace if (whitespace.leading || whitespace.trailing) content = content.trim() return ( whitespace.leading + rule.replacement(content, node, this.options) +...
javascript
function replacementForNode (node) { var rule = this.rules.forNode(node) var content = process.call(this, node) var whitespace = node.flankingWhitespace if (whitespace.leading || whitespace.trailing) content = content.trim() return ( whitespace.leading + rule.replacement(content, node, this.options) +...
[ "function", "replacementForNode", "(", "node", ")", "{", "var", "rule", "=", "this", ".", "rules", ".", "forNode", "(", "node", ")", "var", "content", "=", "process", ".", "call", "(", "this", ",", "node", ")", "var", "whitespace", "=", "node", ".", ...
Converts an element node to its Markdown equivalent @private @param {HTMLElement} node The node to convert @returns A Markdown representation of the node @type String
[ "Converts", "an", "element", "node", "to", "its", "Markdown", "equivalent" ]
0ef389619b0b70e18e3d679c0fbed088591a3ab2
https://github.com/laurent22/joplin-turndown/blob/0ef389619b0b70e18e3d679c0fbed088591a3ab2/src/turndown.js#L233-L243
train
laurent22/joplin-turndown
src/turndown.js
separatingNewlines
function separatingNewlines (output, replacement) { var newlines = [ output.match(trailingNewLinesRegExp)[0], replacement.match(leadingNewLinesRegExp)[0] ].sort() var maxNewlines = newlines[newlines.length - 1] return maxNewlines.length < 2 ? maxNewlines : '\n\n' }
javascript
function separatingNewlines (output, replacement) { var newlines = [ output.match(trailingNewLinesRegExp)[0], replacement.match(leadingNewLinesRegExp)[0] ].sort() var maxNewlines = newlines[newlines.length - 1] return maxNewlines.length < 2 ? maxNewlines : '\n\n' }
[ "function", "separatingNewlines", "(", "output", ",", "replacement", ")", "{", "var", "newlines", "=", "[", "output", ".", "match", "(", "trailingNewLinesRegExp", ")", "[", "0", "]", ",", "replacement", ".", "match", "(", "leadingNewLinesRegExp", ")", "[", "...
Determines the new lines between the current output and the replacement @private @param {String} output The current conversion output @param {String} replacement The string to append to the output @returns The whitespace to separate the current output and the replacement @type String
[ "Determines", "the", "new", "lines", "between", "the", "current", "output", "and", "the", "replacement" ]
0ef389619b0b70e18e3d679c0fbed088591a3ab2
https://github.com/laurent22/joplin-turndown/blob/0ef389619b0b70e18e3d679c0fbed088591a3ab2/src/turndown.js#L254-L261
train
mikolalysenko/mesh-geodesic
lib/geodesic.js
quadratic_distance
function quadratic_distance(a, b, c, dpa, dpb, orientation) { var ab = new Array(3); var ac = new Array(3); var dab2 = 0.0; for(var i=0; i<3; ++i) { ab[i] = b[i] - a[i]; dab2 += ab[i] * ab[i]; ac[i] = c[i] - a[i]; } if(dab2 < EPSILON) { return 1e30; } //Transform c into triangle co...
javascript
function quadratic_distance(a, b, c, dpa, dpb, orientation) { var ab = new Array(3); var ac = new Array(3); var dab2 = 0.0; for(var i=0; i<3; ++i) { ab[i] = b[i] - a[i]; dab2 += ab[i] * ab[i]; ac[i] = c[i] - a[i]; } if(dab2 < EPSILON) { return 1e30; } //Transform c into triangle co...
[ "function", "quadratic_distance", "(", "a", ",", "b", ",", "c", ",", "dpa", ",", "dpb", ",", "orientation", ")", "{", "var", "ab", "=", "new", "Array", "(", "3", ")", ";", "var", "ac", "=", "new", "Array", "(", "3", ")", ";", "var", "dab2", "="...
Computes quadratic distance to point c
[ "Computes", "quadratic", "distance", "to", "point", "c" ]
066d741f3b6f890e1c749e14fd42ff9a57294d14
https://github.com/mikolalysenko/mesh-geodesic/blob/066d741f3b6f890e1c749e14fd42ff9a57294d14/lib/geodesic.js#L7-L54
train
mikolalysenko/mesh-geodesic
lib/geodesic.js
geodesic_distance
function geodesic_distance(cells, positions, p, max_distance, tolerance, stars) { if(typeof(max_distance) === "undefined") { max_distance = Number.POSITIVE_INFINITY } if(typeof(tolerance) === "undefined") { tolerance = 1e-4 } if(typeof(dual) === "undefined") { stars = top.dual(cells, positions.le...
javascript
function geodesic_distance(cells, positions, p, max_distance, tolerance, stars) { if(typeof(max_distance) === "undefined") { max_distance = Number.POSITIVE_INFINITY } if(typeof(tolerance) === "undefined") { tolerance = 1e-4 } if(typeof(dual) === "undefined") { stars = top.dual(cells, positions.le...
[ "function", "geodesic_distance", "(", "cells", ",", "positions", ",", "p", ",", "max_distance", ",", "tolerance", ",", "stars", ")", "{", "if", "(", "typeof", "(", "max_distance", ")", "===", "\"undefined\"", ")", "{", "max_distance", "=", "Number", ".", "...
Computes a distances to a vertex p
[ "Computes", "a", "distances", "to", "a", "vertex", "p" ]
066d741f3b6f890e1c749e14fd42ff9a57294d14
https://github.com/mikolalysenko/mesh-geodesic/blob/066d741f3b6f890e1c749e14fd42ff9a57294d14/lib/geodesic.js#L177-L197
train
weexteam/weex-templater
index.js
walk
function walk(node, output, previousNode) { // tag name validator.checkTagName(node, output) // attrs: id/class/style/if/repeat/append/event/attr var attrs = node.attrs || [] attrs.forEach(function switchAttr(attr) { var name = attr.name var value = attr.value var locationInfo = {line: 1, colum...
javascript
function walk(node, output, previousNode) { // tag name validator.checkTagName(node, output) // attrs: id/class/style/if/repeat/append/event/attr var attrs = node.attrs || [] attrs.forEach(function switchAttr(attr) { var name = attr.name var value = attr.value var locationInfo = {line: 1, colum...
[ "function", "walk", "(", "node", ",", "output", ",", "previousNode", ")", "{", "// tag name", "validator", ".", "checkTagName", "(", "node", ",", "output", ")", "// attrs: id/class/style/if/repeat/append/event/attr", "var", "attrs", "=", "node", ".", "attrs", "||"...
walk all nodes - tag name checking - attrs checking - children checking @param {Node} node @param {object} output{result, deps[], log[]} @param {Node} previousNode
[ "walk", "all", "nodes", "-", "tag", "name", "checking", "-", "attrs", "checking", "-", "children", "checking" ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/index.js#L15-L98
train
sjonnet19/mocha-cobertura-reporter
lib/reporters/cobertura.js
Cobertura
function Cobertura(runner) { var jade = require('jade') jade.doctypes.cobertura = '<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd">' var file = __dirname + '/templates/cobertura.jade', str = fs.readFileSync(file, 'utf8'), fn = jade.compile(str, { filename: file }), self = this ...
javascript
function Cobertura(runner) { var jade = require('jade') jade.doctypes.cobertura = '<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd">' var file = __dirname + '/templates/cobertura.jade', str = fs.readFileSync(file, 'utf8'), fn = jade.compile(str, { filename: file }), self = this ...
[ "function", "Cobertura", "(", "runner", ")", "{", "var", "jade", "=", "require", "(", "'jade'", ")", "jade", ".", "doctypes", ".", "cobertura", "=", "'<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/coverage-03.dtd\">'", "var", "file", "=", "__dirname",...
Initialize a new `Cobertura` reporter. @param {Runner} runner @api public
[ "Initialize", "a", "new", "Cobertura", "reporter", "." ]
c4f3c2c7820a35e665be42118767f1621f0923d3
https://github.com/sjonnet19/mocha-cobertura-reporter/blob/c4f3c2c7820a35e665be42118767f1621f0923d3/lib/reporters/cobertura.js#L22-L39
train
arve0/deep-reduce
index.js
deepReduce
function deepReduce(obj, reducer, reduced, path, thisArg) { if (reduced === void 0) { reduced = {}; } if (path === void 0) { path = ''; } if (thisArg === void 0) { thisArg = {}; } var pathArr = path === '' ? [] : path.split('.'); var root = obj; // keep value of root object, for recursion if (pa...
javascript
function deepReduce(obj, reducer, reduced, path, thisArg) { if (reduced === void 0) { reduced = {}; } if (path === void 0) { path = ''; } if (thisArg === void 0) { thisArg = {}; } var pathArr = path === '' ? [] : path.split('.'); var root = obj; // keep value of root object, for recursion if (pa...
[ "function", "deepReduce", "(", "obj", ",", "reducer", ",", "reduced", ",", "path", ",", "thisArg", ")", "{", "if", "(", "reduced", "===", "void", "0", ")", "{", "reduced", "=", "{", "}", ";", "}", "if", "(", "path", "===", "void", "0", ")", "{", ...
Reduce objects deeply, like Array.prototype.reduce but for objects. @param obj Object to traverse. @param reducer Reducer function. @param reduced Initial accumulated value. @param path Root of traversal. @param thisArg Binds `thisArg` as `this` on `reducer`. @returns Accumulated value.
[ "Reduce", "objects", "deeply", "like", "Array", ".", "prototype", ".", "reduce", "but", "for", "objects", "." ]
375e1058b61671656dc602b2b58d742fe9dd95a2
https://github.com/arve0/deep-reduce/blob/375e1058b61671656dc602b2b58d742fe9dd95a2/index.js#L12-L42
train
dkozar/raycast-dom
build/lookup/evaluateID.js
evaluateID
function evaluateID(sub, element) { var id = element.id; return id && id.indexOf(sub) === 0; }
javascript
function evaluateID(sub, element) { var id = element.id; return id && id.indexOf(sub) === 0; }
[ "function", "evaluateID", "(", "sub", ",", "element", ")", "{", "var", "id", "=", "element", ".", "id", ";", "return", "id", "&&", "id", ".", "indexOf", "(", "sub", ")", "===", "0", ";", "}" ]
Checks whether the substring is present within element ID @param sub Substring to check for @param element DOM element @returns {*|boolean}
[ "Checks", "whether", "the", "substring", "is", "present", "within", "element", "ID" ]
91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98
https://github.com/dkozar/raycast-dom/blob/91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98/build/lookup/evaluateID.js#L13-L17
train
gaurav-nelson/retext-google-styleguide
index.js
removeA
function removeA(arr) { var what, a = arguments, L = a.length, ax; while (L > 1 && arr.length) { what = a[--L]; while ((ax = arr.indexOf(what)) !== -1) { arr.splice(ax, 1); } } return arr; }
javascript
function removeA(arr) { var what, a = arguments, L = a.length, ax; while (L > 1 && arr.length) { what = a[--L]; while ((ax = arr.indexOf(what)) !== -1) { arr.splice(ax, 1); } } return arr; }
[ "function", "removeA", "(", "arr", ")", "{", "var", "what", ",", "a", "=", "arguments", ",", "L", "=", "a", ".", "length", ",", "ax", ";", "while", "(", "L", ">", "1", "&&", "arr", ".", "length", ")", "{", "what", "=", "a", "[", "--", "L", ...
to remove passed values from the array, used to find and remove empty vlaues
[ "to", "remove", "passed", "values", "from", "the", "array", "used", "to", "find", "and", "remove", "empty", "vlaues" ]
9c601b11e2c4bed57376b78566bad26ecbbeadca
https://github.com/gaurav-nelson/retext-google-styleguide/blob/9c601b11e2c4bed57376b78566bad26ecbbeadca/index.js#L28-L40
train
gaurav-nelson/retext-google-styleguide
index.js
countWords
function countWords(s) { s = s.replace(/(^\s*)|(\s*$)/gi, ""); //exclude start and end white-space s = s.replace(/[ ]{2,}/gi, " "); //2 or more space to 1 s = s.replace(/\n /, "\n"); // exclude newline with a start spacing return s.split(" ").length; }
javascript
function countWords(s) { s = s.replace(/(^\s*)|(\s*$)/gi, ""); //exclude start and end white-space s = s.replace(/[ ]{2,}/gi, " "); //2 or more space to 1 s = s.replace(/\n /, "\n"); // exclude newline with a start spacing return s.split(" ").length; }
[ "function", "countWords", "(", "s", ")", "{", "s", "=", "s", ".", "replace", "(", "/", "(^\\s*)|(\\s*$)", "/", "gi", ",", "\"\"", ")", ";", "//exclude start and end white-space", "s", "=", "s", ".", "replace", "(", "/", "[ ]{2,}", "/", "gi", ",", "\" ...
to check number of words in an array
[ "to", "check", "number", "of", "words", "in", "an", "array" ]
9c601b11e2c4bed57376b78566bad26ecbbeadca
https://github.com/gaurav-nelson/retext-google-styleguide/blob/9c601b11e2c4bed57376b78566bad26ecbbeadca/index.js#L43-L48
train
gaurav-nelson/retext-google-styleguide
index.js
function(needle) { // Per spec, the way to identify NaN is that it is not equal to itself var findNaN = needle !== needle; var indexOf; if (!findNaN && typeof Array.prototype.indexOf === "function") { indexOf = Array.prototype.indexOf; } else { indexOf = function(needle) { var i = -1, i...
javascript
function(needle) { // Per spec, the way to identify NaN is that it is not equal to itself var findNaN = needle !== needle; var indexOf; if (!findNaN && typeof Array.prototype.indexOf === "function") { indexOf = Array.prototype.indexOf; } else { indexOf = function(needle) { var i = -1, i...
[ "function", "(", "needle", ")", "{", "// Per spec, the way to identify NaN is that it is not equal to itself", "var", "findNaN", "=", "needle", "!==", "needle", ";", "var", "indexOf", ";", "if", "(", "!", "findNaN", "&&", "typeof", "Array", ".", "prototype", ".", ...
to check if all values in the array are same
[ "to", "check", "if", "all", "values", "in", "the", "array", "are", "same" ]
9c601b11e2c4bed57376b78566bad26ecbbeadca
https://github.com/gaurav-nelson/retext-google-styleguide/blob/9c601b11e2c4bed57376b78566bad26ecbbeadca/index.js#L51-L77
train
tdreyno/morlock.js
controllers/breakpoint-controller.js
BreakpointController
function BreakpointController(options) { if (!(this instanceof BreakpointController)) { return new BreakpointController(options); } Emitter.mixin(this); var breakpointStream = BreakpointStream.create(options.breakpoints, { throttleMs: options.throttleMs, debounceMs: options.debounceMs }); var...
javascript
function BreakpointController(options) { if (!(this instanceof BreakpointController)) { return new BreakpointController(options); } Emitter.mixin(this); var breakpointStream = BreakpointStream.create(options.breakpoints, { throttleMs: options.throttleMs, debounceMs: options.debounceMs }); var...
[ "function", "BreakpointController", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "BreakpointController", ")", ")", "{", "return", "new", "BreakpointController", "(", "options", ")", ";", "}", "Emitter", ".", "mixin", "(", "this", ")",...
Provides a familiar OO-style API for tracking breakpoint events. @constructor @param {Object=} options The options passed to the breakpoint tracker. @return {Object} The API with a `on` function to attach callbacks to breakpoint changes.
[ "Provides", "a", "familiar", "OO", "-", "style", "API", "for", "tracking", "breakpoint", "events", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/controllers/breakpoint-controller.js#L13-L40
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GridIndex.js
function(x, y) { var array = this.getAllData(x, y); return array && array.length ? array[0] : undefined; }
javascript
function(x, y) { var array = this.getAllData(x, y); return array && array.length ? array[0] : undefined; }
[ "function", "(", "x", ",", "y", ")", "{", "var", "array", "=", "this", ".", "getAllData", "(", "x", ",", "y", ")", ";", "return", "array", "&&", "array", ".", "length", "?", "array", "[", "0", "]", ":", "undefined", ";", "}" ]
Returns data associated with the specified position on the canvas.
[ "Returns", "data", "associated", "with", "the", "specified", "position", "on", "the", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GridIndex.js#L19-L22
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GridIndex.js
function(x, y) { var maskX = this._getMaskX(x); var maskY = this._getMaskY(y); var key = this._getIndexKey(maskX, maskY); return this._dataIndex[key]; }
javascript
function(x, y) { var maskX = this._getMaskX(x); var maskY = this._getMaskY(y); var key = this._getIndexKey(maskX, maskY); return this._dataIndex[key]; }
[ "function", "(", "x", ",", "y", ")", "{", "var", "maskX", "=", "this", ".", "_getMaskX", "(", "x", ")", ";", "var", "maskY", "=", "this", ".", "_getMaskY", "(", "y", ")", ";", "var", "key", "=", "this", ".", "_getIndexKey", "(", "maskX", ",", "...
Returns all data objects associated with the specified position on the canvas.
[ "Returns", "all", "data", "objects", "associated", "with", "the", "specified", "position", "on", "the", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GridIndex.js#L28-L33
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GridIndex.js
function(x, y, options) { var maskX = this._getMaskX(x); var maskY = this._getMaskY(y); var key = this._getIndexKey(maskX, maskY); return this._addDataToIndex(key, options); }
javascript
function(x, y, options) { var maskX = this._getMaskX(x); var maskY = this._getMaskY(y); var key = this._getIndexKey(maskX, maskY); return this._addDataToIndex(key, options); }
[ "function", "(", "x", ",", "y", ",", "options", ")", "{", "var", "maskX", "=", "this", ".", "_getMaskX", "(", "x", ")", ";", "var", "maskY", "=", "this", ".", "_getMaskY", "(", "y", ")", ";", "var", "key", "=", "this", ".", "_getIndexKey", "(", ...
Sets data in the specified position on the canvas. @param x @param y @param options.data a data object to set
[ "Sets", "data", "in", "the", "specified", "position", "on", "the", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GridIndex.js#L43-L48
train
dkozar/raycast-dom
build/lookup/evaluateReactID.js
evaluateReactID
function evaluateReactID(sub, element) { var id = element.getAttribute && element.getAttribute('data-reactid'); return id && id.indexOf(sub) > -1; }
javascript
function evaluateReactID(sub, element) { var id = element.getAttribute && element.getAttribute('data-reactid'); return id && id.indexOf(sub) > -1; }
[ "function", "evaluateReactID", "(", "sub", ",", "element", ")", "{", "var", "id", "=", "element", ".", "getAttribute", "&&", "element", ".", "getAttribute", "(", "'data-reactid'", ")", ";", "return", "id", "&&", "id", ".", "indexOf", "(", "sub", ")", ">"...
Checks whether the substring is present within element's React ID @param sub Substring to check for @param element DOM element @returns {*|boolean}
[ "Checks", "whether", "the", "substring", "is", "present", "within", "element", "s", "React", "ID" ]
91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98
https://github.com/dkozar/raycast-dom/blob/91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98/build/lookup/evaluateReactID.js#L13-L17
train
weexteam/weex-templater
lib/validator.js
checkTagName
function checkTagName(node, output) { var result = output.result var deps = output.deps var log = output.log var tagName = node.tagName var childNodes = node.childNodes || [] var location = node.__location || {} // alias if (TAG_NAME_ALIAS_MAP[tagName]) { if (tagName !== 'img') { // FIXME: `parse5...
javascript
function checkTagName(node, output) { var result = output.result var deps = output.deps var log = output.log var tagName = node.tagName var childNodes = node.childNodes || [] var location = node.__location || {} // alias if (TAG_NAME_ALIAS_MAP[tagName]) { if (tagName !== 'img') { // FIXME: `parse5...
[ "function", "checkTagName", "(", "node", ",", "output", ")", "{", "var", "result", "=", "output", ".", "result", "var", "deps", "=", "output", ".", "deps", "var", "log", "=", "output", ".", "log", "var", "tagName", "=", "node", ".", "tagName", "var", ...
tag name checking - autofix alias - append deps - check parent requirements - check children requirements and the result, deps, log will be updated @param {Node} node @param {object} output{result, deps[], log[]}
[ "tag", "name", "checking", "-", "autofix", "alias", "-", "append", "deps", "-", "check", "parent", "requirements", "-", "check", "children", "requirements", "and", "the", "result", "deps", "log", "will", "be", "updated" ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/validator.js#L99-L185
train
crcn/emailify
lib/index.js
_parse
function _parse(content, options, callback) { if(typeof options == 'function') { callback = options; options.test = false; } var on = outcome.error(callback), warnings, window; step( /** * load it. */ function() { jsdom.env({ html: content, scripts: [ __dirname + "/jqu...
javascript
function _parse(content, options, callback) { if(typeof options == 'function') { callback = options; options.test = false; } var on = outcome.error(callback), warnings, window; step( /** * load it. */ function() { jsdom.env({ html: content, scripts: [ __dirname + "/jqu...
[ "function", "_parse", "(", "content", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "==", "'function'", ")", "{", "callback", "=", "options", ";", "options", ".", "test", "=", "false", ";", "}", "var", "on", "=", "outcome",...
parses content into email-safe HTML
[ "parses", "content", "into", "email", "-", "safe", "HTML" ]
9ef187d60828ce393195396e87326fdceb1d1d57
https://github.com/crcn/emailify/blob/9ef187d60828ce393195396e87326fdceb1d1d57/lib/index.js#L30-L129
train
tdreyno/morlock.js
core/stream.js
attachListener_
function attachListener_() { if (isListening) { return; } isListening = true; unsubFunc = Events.eventListener(target, eventName, function() { if (outputStream.closed) { detachListener_(); } else { Util.apply(boundEmit, arguments); } }); onClose(outputStream, deta...
javascript
function attachListener_() { if (isListening) { return; } isListening = true; unsubFunc = Events.eventListener(target, eventName, function() { if (outputStream.closed) { detachListener_(); } else { Util.apply(boundEmit, arguments); } }); onClose(outputStream, deta...
[ "function", "attachListener_", "(", ")", "{", "if", "(", "isListening", ")", "{", "return", ";", "}", "isListening", "=", "true", ";", "unsubFunc", "=", "Events", ".", "eventListener", "(", "target", ",", "eventName", ",", "function", "(", ")", "{", "if"...
Lazily subscribes to a dom event.
[ "Lazily", "subscribes", "to", "a", "dom", "event", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/stream.js#L132-L145
train
tdreyno/morlock.js
core/stream.js
attach_
function attach_() { var i = 0; var intervalId = setInterval(function() { if (outputStream.closed) { clearInterval(intervalId); } else { boundEmit(i++); } }, ms); }
javascript
function attach_() { var i = 0; var intervalId = setInterval(function() { if (outputStream.closed) { clearInterval(intervalId); } else { boundEmit(i++); } }, ms); }
[ "function", "attach_", "(", ")", "{", "var", "i", "=", "0", ";", "var", "intervalId", "=", "setInterval", "(", "function", "(", ")", "{", "if", "(", "outputStream", ".", "closed", ")", "{", "clearInterval", "(", "intervalId", ")", ";", "}", "else", "...
Lazily subscribes to a timeout event.
[ "Lazily", "subscribes", "to", "a", "timeout", "event", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/stream.js#L160-L169
train
tdreyno/morlock.js
controllers/scroll-controller.js
ScrollController
function ScrollController(options) { if (!(this instanceof ScrollController)) { return new ScrollController(options); } Emitter.mixin(this); options = options || {}; var scrollStream = ScrollStream.create({ scrollTarget: options.scrollTarget }); Stream.onValue(scrollStream, Util.partial(this.t...
javascript
function ScrollController(options) { if (!(this instanceof ScrollController)) { return new ScrollController(options); } Emitter.mixin(this); options = options || {}; var scrollStream = ScrollStream.create({ scrollTarget: options.scrollTarget }); Stream.onValue(scrollStream, Util.partial(this.t...
[ "function", "ScrollController", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ScrollController", ")", ")", "{", "return", "new", "ScrollController", "(", "options", ")", ";", "}", "Emitter", ".", "mixin", "(", "this", ")", ";", "o...
Provides a familiar OO-style API for tracking scroll events. @constructor @param {Object=} options The options passed to the scroll tracker. @return {Object} The API with a `on` function to attach scrollEnd callbacks and an `observeElement` function to detect when elements enter and exist the viewport.
[ "Provides", "a", "familiar", "OO", "-", "style", "API", "for", "tracking", "scroll", "events", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/controllers/scroll-controller.js#L14-L34
train
gwicke/node-web-streams
lib/conversions.js
arrayToWeb
function arrayToWeb(arr) { return new ReadableStream({ start(controller) { for (var i = 0; i < arr.length; i++) { controller.enqueue(arr[i]); } controller.close(); } }); }
javascript
function arrayToWeb(arr) { return new ReadableStream({ start(controller) { for (var i = 0; i < arr.length; i++) { controller.enqueue(arr[i]); } controller.close(); } }); }
[ "function", "arrayToWeb", "(", "arr", ")", "{", "return", "new", "ReadableStream", "(", "{", "start", "(", "controller", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "controller", ".", ...
ReadableStream wrapping an array. @param {Array} arr, the array to wrap into a stream. @return {ReadableStream}
[ "ReadableStream", "wrapping", "an", "array", "." ]
5af50c2e91502d577178d7bd85f9e8b7408ea6e7
https://github.com/gwicke/node-web-streams/blob/5af50c2e91502d577178d7bd85f9e8b7408ea6e7/lib/conversions.js#L36-L45
train
scripting/opml
daveopml.js
copyone
function copyone (name) { if (metadata !== undefined) { //3/11/18 by DW var val = metadata [name]; if ((val !== undefined) && (val != null)) { theOutline [name] = val; } } }
javascript
function copyone (name) { if (metadata !== undefined) { //3/11/18 by DW var val = metadata [name]; if ((val !== undefined) && (val != null)) { theOutline [name] = val; } } }
[ "function", "copyone", "(", "name", ")", "{", "if", "(", "metadata", "!==", "undefined", ")", "{", "//3/11/18 by DW", "var", "val", "=", "metadata", "[", "name", "]", ";", "if", "(", "(", "val", "!==", "undefined", ")", "&&", "(", "val", "!=", "null"...
copy elements of the metadata object into the root of the outline
[ "copy", "elements", "of", "the", "metadata", "object", "into", "the", "root", "of", "the", "outline" ]
1c2b9ca804c48cd9d3be39ac1752663564e979e2
https://github.com/scripting/opml/blob/1c2b9ca804c48cd9d3be39ac1752663564e979e2/daveopml.js#L253-L260
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(image, position, options) { this._drawOnCanvasContext(options, function(g) { this._setImageStyles(g, options); g.drawImage(image, position[0], position[1]); return true; }); }
javascript
function(image, position, options) { this._drawOnCanvasContext(options, function(g) { this._setImageStyles(g, options); g.drawImage(image, position[0], position[1]); return true; }); }
[ "function", "(", "image", ",", "position", ",", "options", ")", "{", "this", ".", "_drawOnCanvasContext", "(", "options", ",", "function", "(", "g", ")", "{", "this", ".", "_setImageStyles", "(", "g", ",", "options", ")", ";", "g", ".", "drawImage", "(...
Copies an image to the main canvas. @param image the image to copy; it could be an Image or Canvas @param position position of the image on the main canvas @param options options object containing "data" field to associate with the image
[ "Copies", "an", "image", "to", "the", "main", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L65-L71
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(polygon, options) { // Create new canvas where the polygon should be drawn this._drawOnCanvasContext(options, function(g) { options = options || {}; g.beginPath(); for (var i = 0; i < polygon.length; i++) { var ring = this._simplify(polygon[i]...
javascript
function(polygon, options) { // Create new canvas where the polygon should be drawn this._drawOnCanvasContext(options, function(g) { options = options || {}; g.beginPath(); for (var i = 0; i < polygon.length; i++) { var ring = this._simplify(polygon[i]...
[ "function", "(", "polygon", ",", "options", ")", "{", "// Create new canvas where the polygon should be drawn", "this", ".", "_drawOnCanvasContext", "(", "options", ",", "function", "(", "g", ")", "{", "options", "=", "options", "||", "{", "}", ";", "g", ".", ...
Draws polygons with holes on the canvas.
[ "Draws", "polygons", "with", "holes", "on", "the", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L95-L117
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(coords) { var tolerance = this.options.tolerance || 0.8; var enableHighQuality = !!this.options.highQuality; var points = GeometryUtils.simplify(coords, tolerance, enableHighQuality); return points; }
javascript
function(coords) { var tolerance = this.options.tolerance || 0.8; var enableHighQuality = !!this.options.highQuality; var points = GeometryUtils.simplify(coords, tolerance, enableHighQuality); return points; }
[ "function", "(", "coords", ")", "{", "var", "tolerance", "=", "this", ".", "options", ".", "tolerance", "||", "0.8", ";", "var", "enableHighQuality", "=", "!", "!", "this", ".", "options", ".", "highQuality", ";", "var", "points", "=", "GeometryUtils", "...
Simplifies the given line.
[ "Simplifies", "the", "given", "line", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L140-L146
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// g.fillStyle = options.fillColor || options.color; if (options.fillImage) { g.fillStyle = g.c...
javascript
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// g.fillStyle = options.fillColor || options.color; if (options.fillImage) { g.fillStyle = g.c...
[ "function", "(", "g", ",", "options", ")", "{", "var", "compositeOperation", "=", "options", ".", "compositeOperation", "||", "options", ".", "composition", "||", "'source-over'", ";", "g", ".", "globalCompositeOperation", "=", "compositeOperation", ";", "// ", ...
Copies fill styles from the specified style object to the canvas context.
[ "Copies", "fill", "styles", "from", "the", "specified", "style", "object", "to", "the", "canvas", "context", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L158-L167
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// g.globalAlpha = options.stokeOpacity || options.lineOpacity || options.opacity || 0; g.s...
javascript
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// g.globalAlpha = options.stokeOpacity || options.lineOpacity || options.opacity || 0; g.s...
[ "function", "(", "g", ",", "options", ")", "{", "var", "compositeOperation", "=", "options", ".", "compositeOperation", "||", "options", ".", "composition", "||", "'source-over'", ";", "g", ".", "globalCompositeOperation", "=", "compositeOperation", ";", "// ", ...
Copies stroke styles from the specified style object to the canvas context.
[ "Copies", "stroke", "styles", "from", "the", "specified", "style", "object", "to", "the", "canvas", "context", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L173-L183
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/CanvasContext.js
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// }
javascript
function(g, options) { var compositeOperation = options.compositeOperation || options.composition || 'source-over'; g.globalCompositeOperation = compositeOperation;// }
[ "function", "(", "g", ",", "options", ")", "{", "var", "compositeOperation", "=", "options", ".", "compositeOperation", "||", "options", ".", "composition", "||", "'source-over'", ";", "g", ".", "globalCompositeOperation", "=", "compositeOperation", ";", "//", "...
Copies image styles from the specified style object to the canvas context.
[ "Copies", "image", "styles", "from", "the", "specified", "style", "object", "to", "the", "canvas", "context", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/CanvasContext.js#L189-L193
train
tdreyno/morlock.js
controllers/element-visible-controller.js
ElementVisibleController
function ElementVisibleController(elem, options) { if (!(this instanceof ElementVisibleController)) { return new ElementVisibleController(elem, options); } Emitter.mixin(this); options = options || {}; this.elem = elem; this.buffer = Util.getOption(options.buffer, 0); this.isVisible = false; this...
javascript
function ElementVisibleController(elem, options) { if (!(this instanceof ElementVisibleController)) { return new ElementVisibleController(elem, options); } Emitter.mixin(this); options = options || {}; this.elem = elem; this.buffer = Util.getOption(options.buffer, 0); this.isVisible = false; this...
[ "function", "ElementVisibleController", "(", "elem", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ElementVisibleController", ")", ")", "{", "return", "new", "ElementVisibleController", "(", "elem", ",", "options", ")", ";", "}", "Emitt...
Provides a familiar OO-style API for tracking element position. @constructor @param {Element} elem The element to track @param {Object=} options The options passed to the position tracker. @return {Object} The API with a `on` function to attach scrollEnd callbacks and an `observeElement` function to detect when element...
[ "Provides", "a", "familiar", "OO", "-", "style", "API", "for", "tracking", "element", "position", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/controllers/element-visible-controller.js#L17-L58
train
simonepri/phc-format
index.js
deserialize
function deserialize(phcstr) { if (typeof phcstr !== 'string' || phcstr === '') { throw new TypeError('pchstr must be a non-empty string'); } if (phcstr[0] !== '$') { throw new TypeError('pchstr must contain a $ as first char'); } const fields = phcstr.split('$'); // Remove first empty $ fields.sh...
javascript
function deserialize(phcstr) { if (typeof phcstr !== 'string' || phcstr === '') { throw new TypeError('pchstr must be a non-empty string'); } if (phcstr[0] !== '$') { throw new TypeError('pchstr must contain a $ as first char'); } const fields = phcstr.split('$'); // Remove first empty $ fields.sh...
[ "function", "deserialize", "(", "phcstr", ")", "{", "if", "(", "typeof", "phcstr", "!==", "'string'", "||", "phcstr", "===", "''", ")", "{", "throw", "new", "TypeError", "(", "'pchstr must be a non-empty string'", ")", ";", "}", "if", "(", "phcstr", "[", "...
Parses data from a PHC string. @param {string} phcstr A PHC string to parse. @return {Object} The object containing the data parsed from the PHC string.
[ "Parses", "data", "from", "a", "PHC", "string", "." ]
0e359490bab263577ec80a5cba67803063e1c8d6
https://github.com/simonepri/phc-format/blob/0e359490bab263577ec80a5cba67803063e1c8d6/index.js#L133-L212
train
pthm/redular
index.js
function(options){ var _this = this; this.handlers = {}; if(!options){ options = {}; } if(!options.redis){ options.redis = {}; } this.options = { id: options.id || shortId.generate(), autoConfig: options.autoConfig || false, dataExpiry: options.dataExpiry || 30, redis: { ...
javascript
function(options){ var _this = this; this.handlers = {}; if(!options){ options = {}; } if(!options.redis){ options.redis = {}; } this.options = { id: options.id || shortId.generate(), autoConfig: options.autoConfig || false, dataExpiry: options.dataExpiry || 30, redis: { ...
[ "function", "(", "options", ")", "{", "var", "_this", "=", "this", ";", "this", ".", "handlers", "=", "{", "}", ";", "if", "(", "!", "options", ")", "{", "options", "=", "{", "}", ";", "}", "if", "(", "!", "options", ".", "redis", ")", "{", "...
Node.js scheduling system powered by Redis Keyspace Notifications @param options {Object} @constructor
[ "Node", ".", "js", "scheduling", "system", "powered", "by", "Redis", "Keyspace", "Notifications" ]
571d0430065a521c5b0d5da81fc5ae288fd587ec
https://github.com/pthm/redular/blob/571d0430065a521c5b0d5da81fc5ae288fd587ec/index.js#L11-L87
train
weexteam/weex-templater
lib/parsers/expression.js
rewrite
function rewrite (raw) { var c = raw.charAt(0) var path = raw.slice(1) if (allowedKeywordsRE.test(path)) { return raw } else { path = path.indexOf('"') > -1 ? path.replace(restoreRE, restore) : path return c + 'this.' + path } }
javascript
function rewrite (raw) { var c = raw.charAt(0) var path = raw.slice(1) if (allowedKeywordsRE.test(path)) { return raw } else { path = path.indexOf('"') > -1 ? path.replace(restoreRE, restore) : path return c + 'this.' + path } }
[ "function", "rewrite", "(", "raw", ")", "{", "var", "c", "=", "raw", ".", "charAt", "(", "0", ")", "var", "path", "=", "raw", ".", "slice", "(", "1", ")", "if", "(", "allowedKeywordsRE", ".", "test", "(", "path", ")", ")", "{", "return", "raw", ...
Path rewrite replacer @param {String} raw @return {String}
[ "Path", "rewrite", "replacer" ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/parsers/expression.js#L65-L76
train
weexteam/weex-templater
lib/parsers/expression.js
parseExpression
function parseExpression (exp) { exp = exp.trim() var res = isSimplePath(exp) && exp.indexOf('[') < 0 // optimized super simple getter ? 'this.' + exp // dynamic getter : compileGetter(exp) return res }
javascript
function parseExpression (exp) { exp = exp.trim() var res = isSimplePath(exp) && exp.indexOf('[') < 0 // optimized super simple getter ? 'this.' + exp // dynamic getter : compileGetter(exp) return res }
[ "function", "parseExpression", "(", "exp", ")", "{", "exp", "=", "exp", ".", "trim", "(", ")", "var", "res", "=", "isSimplePath", "(", "exp", ")", "&&", "exp", ".", "indexOf", "(", "'['", ")", "<", "0", "// optimized super simple getter", "?", "'this.'",...
Parse an expression into re-written getter. @param {String} exp @return {String}
[ "Parse", "an", "expression", "into", "re", "-", "written", "getter", "." ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/parsers/expression.js#L121-L129
train
weexteam/weex-templater
lib/parsers/expression.js
isSimplePath
function isSimplePath (exp) { return pathTestRE.test(exp) && // don't treat true/false as paths !booleanLiteralRE.test(exp) && // Math constants e.g. Math.PI, Math.E etc. exp.slice(0, 5) !== 'Math.' }
javascript
function isSimplePath (exp) { return pathTestRE.test(exp) && // don't treat true/false as paths !booleanLiteralRE.test(exp) && // Math constants e.g. Math.PI, Math.E etc. exp.slice(0, 5) !== 'Math.' }
[ "function", "isSimplePath", "(", "exp", ")", "{", "return", "pathTestRE", ".", "test", "(", "exp", ")", "&&", "// don't treat true/false as paths", "!", "booleanLiteralRE", ".", "test", "(", "exp", ")", "&&", "// Math constants e.g. Math.PI, Math.E etc.", "exp", "."...
Check if an expression is a simple path. @param {String} exp @return {Boolean}
[ "Check", "if", "an", "expression", "is", "a", "simple", "path", "." ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/parsers/expression.js#L137-L143
train
NatalieWolfe/node-promise-pool
lib/PromisePool.js
PromisePool
function PromisePool(opts) { this._opts = { // Configuration options name: opts.name || 'pool', idleTimeoutMillis: opts.idleTimeoutMillis || 30000, reapInterval: opts.reapIntervalMillis || 1000, drainCheckInterval: opts.drainCheckIntervalMillis || 100, ...
javascript
function PromisePool(opts) { this._opts = { // Configuration options name: opts.name || 'pool', idleTimeoutMillis: opts.idleTimeoutMillis || 30000, reapInterval: opts.reapIntervalMillis || 1000, drainCheckInterval: opts.drainCheckIntervalMillis || 100, ...
[ "function", "PromisePool", "(", "opts", ")", "{", "this", ".", "_opts", "=", "{", "// Configuration options", "name", ":", "opts", ".", "name", "||", "'pool'", ",", "idleTimeoutMillis", ":", "opts", ".", "idleTimeoutMillis", "||", "30000", ",", "reapInterval",...
Constructs a new pool with the provided factory options. @constructor @classdesc A resource pooling class with a promise-based API. @param {PromisePool.Factory} opts The connection factory which specifies the functionality for the pool.
[ "Constructs", "a", "new", "pool", "with", "the", "provided", "factory", "options", "." ]
e98208593893ad89af3889c8398eac76a09c20b8
https://github.com/NatalieWolfe/node-promise-pool/blob/e98208593893ad89af3889c8398eac76a09c20b8/lib/PromisePool.js#L17-L61
train
NatalieWolfe/node-promise-pool
lib/PromisePool.js
_ensureMinimum
function _ensureMinimum() { // Nothing to do if draining. if (this._draining) { return Promise.resolve(); } var diff = this._opts.min - this._count + this.availableLength; var promises = []; for (var i = 0; i < diff; ++i) { promises.push(this.acquire(function(client){ return Pro...
javascript
function _ensureMinimum() { // Nothing to do if draining. if (this._draining) { return Promise.resolve(); } var diff = this._opts.min - this._count + this.availableLength; var promises = []; for (var i = 0; i < diff; ++i) { promises.push(this.acquire(function(client){ return Pro...
[ "function", "_ensureMinimum", "(", ")", "{", "// Nothing to do if draining.", "if", "(", "this", ".", "_draining", ")", "{", "return", "Promise", ".", "resolve", "(", ")", ";", "}", "var", "diff", "=", "this", ".", "_opts", ".", "min", "-", "this", ".", ...
Constructs more resources to bring the current count up to the minimum specified in the factory. @private @memberof PromisePool @return {Promise} A promise to create all the resources needed.
[ "Constructs", "more", "resources", "to", "bring", "the", "current", "count", "up", "to", "the", "minimum", "specified", "in", "the", "factory", "." ]
e98208593893ad89af3889c8398eac76a09c20b8
https://github.com/NatalieWolfe/node-promise-pool/blob/e98208593893ad89af3889c8398eac76a09c20b8/lib/PromisePool.js#L216-L229
train
NatalieWolfe/node-promise-pool
lib/PromisePool.js
_createResource
function _createResource() { this._log( util.format( 'PromisePool._createResource() - creating client - count=%d min=%d max=%d', this._count, this._opts.min, this._opts.max ), 'verbose' ); return Promise.resolve(this._opts.create()); }
javascript
function _createResource() { this._log( util.format( 'PromisePool._createResource() - creating client - count=%d min=%d max=%d', this._count, this._opts.min, this._opts.max ), 'verbose' ); return Promise.resolve(this._opts.create()); }
[ "function", "_createResource", "(", ")", "{", "this", ".", "_log", "(", "util", ".", "format", "(", "'PromisePool._createResource() - creating client - count=%d min=%d max=%d'", ",", "this", ".", "_count", ",", "this", ".", "_opts", ".", "min", ",", "this", ".", ...
Constructs a new resource. @private @this {PromisePool} @return {Promise.<PromisePool.Client>} A promise for the to-be created client.
[ "Constructs", "a", "new", "resource", "." ]
e98208593893ad89af3889c8398eac76a09c20b8
https://github.com/NatalieWolfe/node-promise-pool/blob/e98208593893ad89af3889c8398eac76a09c20b8/lib/PromisePool.js#L239-L249
train
NatalieWolfe/node-promise-pool
lib/PromisePool.js
_scheduleRemoveIdle
function _scheduleRemoveIdle(){ if (!this._removeIdleScheduled) { this._removeIdleScheduled = true; this._removeIdleTimer = setTimeout(_removeIdle.bind(this), this._opts.reapInterval); } }
javascript
function _scheduleRemoveIdle(){ if (!this._removeIdleScheduled) { this._removeIdleScheduled = true; this._removeIdleTimer = setTimeout(_removeIdle.bind(this), this._opts.reapInterval); } }
[ "function", "_scheduleRemoveIdle", "(", ")", "{", "if", "(", "!", "this", ".", "_removeIdleScheduled", ")", "{", "this", ".", "_removeIdleScheduled", "=", "true", ";", "this", ".", "_removeIdleTimer", "=", "setTimeout", "(", "_removeIdle", ".", "bind", "(", ...
Schedule removal of idle items in the pool. Only one removal at a time can be scheduled. @private @this {PromisePool} @return {undefined}
[ "Schedule", "removal", "of", "idle", "items", "in", "the", "pool", "." ]
e98208593893ad89af3889c8398eac76a09c20b8
https://github.com/NatalieWolfe/node-promise-pool/blob/e98208593893ad89af3889c8398eac76a09c20b8/lib/PromisePool.js#L308-L313
train
NatalieWolfe/node-promise-pool
lib/PromisePool.js
_objFilter
function _objFilter(obj, eql) { return function(objWithTimeout){ return (eql ? (obj === objWithTimeout.obj) : (obj !== objWithTimeout.obj)); }; }
javascript
function _objFilter(obj, eql) { return function(objWithTimeout){ return (eql ? (obj === objWithTimeout.obj) : (obj !== objWithTimeout.obj)); }; }
[ "function", "_objFilter", "(", "obj", ",", "eql", ")", "{", "return", "function", "(", "objWithTimeout", ")", "{", "return", "(", "eql", "?", "(", "obj", "===", "objWithTimeout", ".", "obj", ")", ":", "(", "obj", "!==", "objWithTimeout", ".", "obj", ")...
Creates a filter usable for finding a client in the available clients list. @private @memberof PromisePool @param {PromisePool.Client} obj The client to filter the list for. @param {bool} eql Indicates if the test should be for equality (`===`) or not (`!==`). @return {Function} A function which can be used for arr...
[ "Creates", "a", "filter", "usable", "for", "finding", "a", "client", "in", "the", "available", "clients", "list", "." ]
e98208593893ad89af3889c8398eac76a09c20b8
https://github.com/NatalieWolfe/node-promise-pool/blob/e98208593893ad89af3889c8398eac76a09c20b8/lib/PromisePool.js#L395-L399
train
alykoshin/require-dir-all
index.js
_requireDirAll
function _requireDirAll(originalModule, absDir, options) { var modules = {}; var files = []; try { files = fs.readdirSync(absDir); } catch (e) { if (options.throwNoDir) { throw e; } } for (var length=files.length, i=0; i<length; ++i) { var reqModule = {}; reqModule.filename = fi...
javascript
function _requireDirAll(originalModule, absDir, options) { var modules = {}; var files = []; try { files = fs.readdirSync(absDir); } catch (e) { if (options.throwNoDir) { throw e; } } for (var length=files.length, i=0; i<length; ++i) { var reqModule = {}; reqModule.filename = fi...
[ "function", "_requireDirAll", "(", "originalModule", ",", "absDir", ",", "options", ")", "{", "var", "modules", "=", "{", "}", ";", "var", "files", "=", "[", "]", ";", "try", "{", "files", "=", "fs", ".", "readdirSync", "(", "absDir", ")", ";", "}", ...
Main function. Recursively go through directories and require modules according to options @param {object} originalModule @param {string} absDir @param {RequireOptions} options @returns {object} @private
[ "Main", "function", ".", "Recursively", "go", "through", "directories", "and", "require", "modules", "according", "to", "options" ]
ab891571b3737f4b83f2836fca0530d12e4ee1c3
https://github.com/alykoshin/require-dir-all/blob/ab891571b3737f4b83f2836fca0530d12e4ee1c3/index.js#L139-L230
train
tdreyno/morlock.js
streams/scroll-stream.js
create
function create(options) { options = options || {}; var scrollParent = (options.scrollTarget && options.scrollTarget.parentNode) || window; var oldScrollY; var scrollDirty = true; var scrollEventsStream = Stream.createFromEvents(scrollParent, 'scroll'); Stream.onValue(scrollEventsStream, function onScrol...
javascript
function create(options) { options = options || {}; var scrollParent = (options.scrollTarget && options.scrollTarget.parentNode) || window; var oldScrollY; var scrollDirty = true; var scrollEventsStream = Stream.createFromEvents(scrollParent, 'scroll'); Stream.onValue(scrollEventsStream, function onScrol...
[ "function", "create", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "scrollParent", "=", "(", "options", ".", "scrollTarget", "&&", "options", ".", "scrollTarget", ".", "parentNode", ")", "||", "window", ";", "var", "ol...
Create a stream of onscroll events, but only calculate their position on requestAnimationFrame frames. @param {Element=} options.scrollTarget - Targeted for scroll checking. @return {Stream}
[ "Create", "a", "stream", "of", "onscroll", "events", "but", "only", "calculate", "their", "position", "on", "requestAnimationFrame", "frames", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/streams/scroll-stream.js#L12-L47
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/ImageGridIndex.js
function(image, x, y, options) { var result = false; var data = options.data; if (!data) return result; var mask = this._getImageMask(image, options); var imageMaskWidth = this._getMaskX(image.width); var maskShiftX = this._getMaskX(x); var maskShiftY ...
javascript
function(image, x, y, options) { var result = false; var data = options.data; if (!data) return result; var mask = this._getImageMask(image, options); var imageMaskWidth = this._getMaskX(image.width); var maskShiftX = this._getMaskX(x); var maskShiftY ...
[ "function", "(", "image", ",", "x", ",", "y", ",", "options", ")", "{", "var", "result", "=", "false", ";", "var", "data", "=", "options", ".", "data", ";", "if", "(", "!", "data", ")", "return", "result", ";", "var", "mask", "=", "this", ".", ...
Adds all pixels occupied by the specified image to a data mask associated with canvas.
[ "Adds", "all", "pixels", "occupied", "by", "the", "specified", "image", "to", "a", "data", "mask", "associated", "with", "canvas", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/ImageGridIndex.js#L13-L32
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/ImageGridIndex.js
function(image, options) { var index = options.imageMaskIndex || this.options.imageMaskIndex; if (!index) return; if (typeof index === 'function') { index = index(image, options); } return index; }
javascript
function(image, options) { var index = options.imageMaskIndex || this.options.imageMaskIndex; if (!index) return; if (typeof index === 'function') { index = index(image, options); } return index; }
[ "function", "(", "image", ",", "options", ")", "{", "var", "index", "=", "options", ".", "imageMaskIndex", "||", "this", ".", "options", ".", "imageMaskIndex", ";", "if", "(", "!", "index", ")", "return", ";", "if", "(", "typeof", "index", "===", "'fun...
This method maintain an index of image masks associated with the provided canvas. This method could be overloaded to implement a global index of image masks.
[ "This", "method", "maintain", "an", "index", "of", "image", "masks", "associated", "with", "the", "provided", "canvas", ".", "This", "method", "could", "be", "overloaded", "to", "implement", "a", "global", "index", "of", "image", "masks", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/ImageGridIndex.js#L71-L79
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/ImageGridIndex.js
function(image) { var maskWidth = this._getMaskX(image.width); var maskHeight = this._getMaskY(image.height); var buf = this._getResizedImageBuffer(image, maskWidth, maskHeight); var mask = new Array(maskWidth * maskHeight); for (var y = 0; y < maskHeight; y++) { for ...
javascript
function(image) { var maskWidth = this._getMaskX(image.width); var maskHeight = this._getMaskY(image.height); var buf = this._getResizedImageBuffer(image, maskWidth, maskHeight); var mask = new Array(maskWidth * maskHeight); for (var y = 0; y < maskHeight; y++) { for ...
[ "function", "(", "image", ")", "{", "var", "maskWidth", "=", "this", ".", "_getMaskX", "(", "image", ".", "width", ")", ";", "var", "maskHeight", "=", "this", ".", "_getMaskY", "(", "image", ".", "height", ")", ";", "var", "buf", "=", "this", ".", ...
Creates and returns an image mask.
[ "Creates", "and", "returns", "an", "image", "mask", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/ImageGridIndex.js#L82-L95
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/ImageGridIndex.js
function(image, width, height) { var g; if (image.tagName === 'CANVAS' && image.width === width && image.height === height) { g = image.getContext('2d'); } else { var canvas = this._newCanvas(width, height); canvas.width = width; ca...
javascript
function(image, width, height) { var g; if (image.tagName === 'CANVAS' && image.width === width && image.height === height) { g = image.getContext('2d'); } else { var canvas = this._newCanvas(width, height); canvas.width = width; ca...
[ "function", "(", "image", ",", "width", ",", "height", ")", "{", "var", "g", ";", "if", "(", "image", ".", "tagName", "===", "'CANVAS'", "&&", "image", ".", "width", "===", "width", "&&", "image", ".", "height", "===", "height", ")", "{", "g", "=",...
Returns a raw data for the resized image.
[ "Returns", "a", "raw", "data", "for", "the", "resized", "image", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/ImageGridIndex.js#L109-L123
train
tdreyno/morlock.js
core/responsive-image.js
applyAspectRatioPadding
function applyAspectRatioPadding(image) { var ratioPadding = (image.knownDimensions[1] / image.knownDimensions[0]) * 100.0; DOM.setStyle(image.element, 'paddingBottom', ratioPadding + '%'); }
javascript
function applyAspectRatioPadding(image) { var ratioPadding = (image.knownDimensions[1] / image.knownDimensions[0]) * 100.0; DOM.setStyle(image.element, 'paddingBottom', ratioPadding + '%'); }
[ "function", "applyAspectRatioPadding", "(", "image", ")", "{", "var", "ratioPadding", "=", "(", "image", ".", "knownDimensions", "[", "1", "]", "/", "image", ".", "knownDimensions", "[", "0", "]", ")", "*", "100.0", ";", "DOM", ".", "setStyle", "(", "ima...
Set a padding percentage which allows the image to scale proportionally. @param {ResponsiveImage} image The image data.
[ "Set", "a", "padding", "percentage", "which", "allows", "the", "image", "to", "scale", "proportionally", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L113-L116
train
tdreyno/morlock.js
core/responsive-image.js
getBreakpointSizes
function getBreakpointSizes(element) { var breakpointString = element.getAttribute('data-breakpoints'); var knownSizes = Util.map(function(s) { return Util.parseInteger(s); }, breakpointString ? breakpointString.split(',') : []); if (knownSizes.length <= 0) { return [0]; } else { return Util.sor...
javascript
function getBreakpointSizes(element) { var breakpointString = element.getAttribute('data-breakpoints'); var knownSizes = Util.map(function(s) { return Util.parseInteger(s); }, breakpointString ? breakpointString.split(',') : []); if (knownSizes.length <= 0) { return [0]; } else { return Util.sor...
[ "function", "getBreakpointSizes", "(", "element", ")", "{", "var", "breakpointString", "=", "element", ".", "getAttribute", "(", "'data-breakpoints'", ")", ";", "var", "knownSizes", "=", "Util", ".", "map", "(", "function", "(", "s", ")", "{", "return", "Uti...
Parse the breakpoints = require(the `data-breakpoints` attribute. @param {Element} element The source element. @return {Array} Sorted array of known sizes.
[ "Parse", "the", "breakpoints", "=", "require", "(", "the", "data", "-", "breakpoints", "attribute", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L123-L137
train
tdreyno/morlock.js
core/responsive-image.js
update
function update(image) { if (image.lazyLoad) { return; } var rect = DOM.getRect(image.element); var foundBreakpoint; for (var i = 0; i < image.knownSizes.length; i++) { var s = image.knownSizes[i]; if (rect.width <= s) { foundBreakpoint = s; } else { break; } } if (!fou...
javascript
function update(image) { if (image.lazyLoad) { return; } var rect = DOM.getRect(image.element); var foundBreakpoint; for (var i = 0; i < image.knownSizes.length; i++) { var s = image.knownSizes[i]; if (rect.width <= s) { foundBreakpoint = s; } else { break; } } if (!fou...
[ "function", "update", "(", "image", ")", "{", "if", "(", "image", ".", "lazyLoad", ")", "{", "return", ";", "}", "var", "rect", "=", "DOM", ".", "getRect", "(", "image", ".", "element", ")", ";", "var", "foundBreakpoint", ";", "for", "(", "var", "i...
Detect the current breakpoint and update the element if necessary.
[ "Detect", "the", "current", "breakpoint", "and", "update", "the", "element", "if", "necessary", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L142-L168
train
tdreyno/morlock.js
core/responsive-image.js
loadImageForBreakpoint
function loadImageForBreakpoint(image, s) { var alreadyLoaded = image.loadedSizes[s]; if ('undefined' !== typeof alreadyLoaded) { setImage(image, alreadyLoaded); } else { var img = new Image(); img.onload = function() { image.loadedSizes[s] = img; setImage(image, img); update(image...
javascript
function loadImageForBreakpoint(image, s) { var alreadyLoaded = image.loadedSizes[s]; if ('undefined' !== typeof alreadyLoaded) { setImage(image, alreadyLoaded); } else { var img = new Image(); img.onload = function() { image.loadedSizes[s] = img; setImage(image, img); update(image...
[ "function", "loadImageForBreakpoint", "(", "image", ",", "s", ")", "{", "var", "alreadyLoaded", "=", "image", ".", "loadedSizes", "[", "s", "]", ";", "if", "(", "'undefined'", "!==", "typeof", "alreadyLoaded", ")", "{", "setImage", "(", "image", ",", "alre...
Load the requested image. @param {ResponsiveImage} image The ResponsiveImage instance. @param {String} s Filename.
[ "Load", "the", "requested", "image", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L183-L218
train
tdreyno/morlock.js
core/responsive-image.js
setImage
function setImage(image, img) { if (!image.hasLoaded) { image.hasLoaded = true; setTimeout(function() { image.element.className += ' loaded'; }, 100); } image.trigger('load', img); if (image.element.tagName.toLowerCase() === 'img') { return setImageTag(image, img); } else { return...
javascript
function setImage(image, img) { if (!image.hasLoaded) { image.hasLoaded = true; setTimeout(function() { image.element.className += ' loaded'; }, 100); } image.trigger('load', img); if (image.element.tagName.toLowerCase() === 'img') { return setImageTag(image, img); } else { return...
[ "function", "setImage", "(", "image", ",", "img", ")", "{", "if", "(", "!", "image", ".", "hasLoaded", ")", "{", "image", ".", "hasLoaded", "=", "true", ";", "setTimeout", "(", "function", "(", ")", "{", "image", ".", "element", ".", "className", "+=...
Set the image on the element. @param {Element} img Image element.
[ "Set", "the", "image", "on", "the", "element", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L224-L240
train
tdreyno/morlock.js
core/responsive-image.js
setDivTag
function setDivTag(image, img) { var setElemStyle = DOM.setStyle(image.element); setElemStyle('backgroundImage', 'url(' + img.src + ')'); if (image.preserveAspectRatio) { var w, h; if (image.knownDimensions) { w = image.knownDimensions[0]; h = image.knownDimensions[1]; } else { w =...
javascript
function setDivTag(image, img) { var setElemStyle = DOM.setStyle(image.element); setElemStyle('backgroundImage', 'url(' + img.src + ')'); if (image.preserveAspectRatio) { var w, h; if (image.knownDimensions) { w = image.knownDimensions[0]; h = image.knownDimensions[1]; } else { w =...
[ "function", "setDivTag", "(", "image", ",", "img", ")", "{", "var", "setElemStyle", "=", "DOM", ".", "setStyle", "(", "image", ".", "element", ")", ";", "setElemStyle", "(", "'backgroundImage'", ",", "'url('", "+", "img", ".", "src", "+", "')'", ")", "...
Set the image on the div element. @param {Element} img Image element.
[ "Set", "the", "image", "on", "the", "div", "element", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L254-L278
train
tdreyno/morlock.js
core/responsive-image.js
getPath
function getPath(image, s, wantsRetina) { if (s === 0) { return image.src; } var parts = image.src.split('.'); var ext = parts.pop(); return parts.join('.') + '-' + s + (wantsRetina ? '@2x' : '') + '.' + ext; }
javascript
function getPath(image, s, wantsRetina) { if (s === 0) { return image.src; } var parts = image.src.split('.'); var ext = parts.pop(); return parts.join('.') + '-' + s + (wantsRetina ? '@2x' : '') + '.' + ext; }
[ "function", "getPath", "(", "image", ",", "s", ",", "wantsRetina", ")", "{", "if", "(", "s", "===", "0", ")", "{", "return", "image", ".", "src", ";", "}", "var", "parts", "=", "image", ".", "src", ".", "split", "(", "'.'", ")", ";", "var", "ex...
Get the path for the image given the current breakpoints and browser features. @param {ResponsiveImage} image The image data. @param {String} s Requested path. @param {boolean} wantsRetina If we should look for retina. @return {String} The resulting path.
[ "Get", "the", "path", "for", "the", "image", "given", "the", "current", "breakpoints", "and", "browser", "features", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/responsive-image.js#L288-L295
train
ramakrishnan/db-migrate-cassandra
index.js
function(tableName, columnName, callback) { var cqlString = util.format('ALTER TABLE %s DROP %s', tableName, columnName); return this.runSql(cqlString, callback).nodeify(callback); }
javascript
function(tableName, columnName, callback) { var cqlString = util.format('ALTER TABLE %s DROP %s', tableName, columnName); return this.runSql(cqlString, callback).nodeify(callback); }
[ "function", "(", "tableName", ",", "columnName", ",", "callback", ")", "{", "var", "cqlString", "=", "util", ".", "format", "(", "'ALTER TABLE %s DROP %s'", ",", "tableName", ",", "columnName", ")", ";", "return", "this", ".", "runSql", "(", "cqlString", ","...
Remove a column form an existing table @param string tableName - The name of the table to be altered @param string columnName - Name of the column to be removed @param callback
[ "Remove", "a", "column", "form", "an", "existing", "table" ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L86-L89
train
ramakrishnan/db-migrate-cassandra
index.js
function(callback) { var cqlString = 'SELECT * from migrations'; return this.runSql(cqlString) .then(function(data) { var sortedData = data.rows.map(function(item) { item.moment_time = moment(item.ran_on).valueOf(); return item }); // Order migration records in ...
javascript
function(callback) { var cqlString = 'SELECT * from migrations'; return this.runSql(cqlString) .then(function(data) { var sortedData = data.rows.map(function(item) { item.moment_time = moment(item.ran_on).valueOf(); return item }); // Order migration records in ...
[ "function", "(", "callback", ")", "{", "var", "cqlString", "=", "'SELECT * from migrations'", ";", "return", "this", ".", "runSql", "(", "cqlString", ")", ".", "then", "(", "function", "(", "data", ")", "{", "var", "sortedData", "=", "data", ".", "rows", ...
List all existing migrations @param callback
[ "List", "all", "existing", "migrations" ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L121-L137
train
ramakrishnan/db-migrate-cassandra
index.js
function (name, callback) { var formattedDate = name.split('-')[0].replace('/', ''); formattedDate = moment(formattedDate, 'YYYY-MM-DD HH:mm:ss'); formattedDate = moment(formattedDate).format('YYYY-MM-DD HH:mm:ss'); var command = util.format('INSERT INTO %s (name, ran_on) VALUES (\'%s\', \'%s\')', inte...
javascript
function (name, callback) { var formattedDate = name.split('-')[0].replace('/', ''); formattedDate = moment(formattedDate, 'YYYY-MM-DD HH:mm:ss'); formattedDate = moment(formattedDate).format('YYYY-MM-DD HH:mm:ss'); var command = util.format('INSERT INTO %s (name, ran_on) VALUES (\'%s\', \'%s\')', inte...
[ "function", "(", "name", ",", "callback", ")", "{", "var", "formattedDate", "=", "name", ".", "split", "(", "'-'", ")", "[", "0", "]", ".", "replace", "(", "'/'", ",", "''", ")", ";", "formattedDate", "=", "moment", "(", "formattedDate", ",", "'YYYY-...
Add a new migration to migrations table @param string name - Migration file name @param callback
[ "Add", "a", "new", "migration", "to", "migrations", "table" ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L144-L150
train
ramakrishnan/db-migrate-cassandra
index.js
function(migrationName, callback) { var command = util.format('DELETE FROM %s where name = \'/%s\'', internals.migrationTable, migrationName); return this.runSql(command).nodeify(callback); }
javascript
function(migrationName, callback) { var command = util.format('DELETE FROM %s where name = \'/%s\'', internals.migrationTable, migrationName); return this.runSql(command).nodeify(callback); }
[ "function", "(", "migrationName", ",", "callback", ")", "{", "var", "command", "=", "util", ".", "format", "(", "'DELETE FROM %s where name = \\'/%s\\''", ",", "internals", ".", "migrationTable", ",", "migrationName", ")", ";", "return", "this", ".", "runSql", "...
Deletes a migration @param migrationName - The name of the migration to be deleted @param callback
[ "Deletes", "a", "migration" ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L158-L161
train
ramakrishnan/db-migrate-cassandra
index.js
function(callback) { var tableOptions = { 'name': 'varchar', 'ran_on': 'timestamp' }; var constraints = { 'primary_key': 'name' }; return this.createTable(internals.migrationTable, tableOptions, constraints).nodeify(callback); }
javascript
function(callback) { var tableOptions = { 'name': 'varchar', 'ran_on': 'timestamp' }; var constraints = { 'primary_key': 'name' }; return this.createTable(internals.migrationTable, tableOptions, constraints).nodeify(callback); }
[ "function", "(", "callback", ")", "{", "var", "tableOptions", "=", "{", "'name'", ":", "'varchar'", ",", "'ran_on'", ":", "'timestamp'", "}", ";", "var", "constraints", "=", "{", "'primary_key'", ":", "'name'", "}", ";", "return", "this", ".", "createTable...
Creates a migration table for the current Cassnadra's keyspace @param callback
[ "Creates", "a", "migration", "table", "for", "the", "current", "Cassnadra", "s", "keyspace" ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L174-L183
train
ramakrishnan/db-migrate-cassandra
index.js
function(command, callback) { var self = this; return new Promise(function(resolve, reject) { var prCB = function(err, data) { if (err) { log.error(err.message); log.debug(command); } return (err ? reject('err') : resolve(data)); }; s...
javascript
function(command, callback) { var self = this; return new Promise(function(resolve, reject) { var prCB = function(err, data) { if (err) { log.error(err.message); log.debug(command); } return (err ? reject('err') : resolve(data)); }; s...
[ "function", "(", "command", ",", "callback", ")", "{", "var", "self", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "prCB", "=", "function", "(", "err", ",", "data", ")", "{", "if", "...
Function to execute the CQL statement through cassandra-driver execute method. @param string command - A Cassandra query to run. @param Object callback
[ "Function", "to", "execute", "the", "CQL", "statement", "through", "cassandra", "-", "driver", "execute", "method", "." ]
bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8
https://github.com/ramakrishnan/db-migrate-cassandra/blob/bd843bd8a94d22f9a87c5b0d9ec1781bc05545f8/index.js#L192-L206
train
arsduo/elm-rings
example-0.19/elm.js
_Markdown_formatOptions
function _Markdown_formatOptions(options) { function toHighlight(code, lang) { if (!lang && elm$core$Maybe$isJust(options.defaultHighlighting)) { lang = options.defaultHighlighting.a; } if ( typeof hljs !== "undefined" && lang && hljs.listLanguages().indexOf(lang) ...
javascript
function _Markdown_formatOptions(options) { function toHighlight(code, lang) { if (!lang && elm$core$Maybe$isJust(options.defaultHighlighting)) { lang = options.defaultHighlighting.a; } if ( typeof hljs !== "undefined" && lang && hljs.listLanguages().indexOf(lang) ...
[ "function", "_Markdown_formatOptions", "(", "options", ")", "{", "function", "toHighlight", "(", "code", ",", "lang", ")", "{", "if", "(", "!", "lang", "&&", "elm$core$Maybe$isJust", "(", "options", ".", "defaultHighlighting", ")", ")", "{", "lang", "=", "op...
FORMAT OPTIONS FOR MARKED IMPLEMENTATION
[ "FORMAT", "OPTIONS", "FOR", "MARKED", "IMPLEMENTATION" ]
a5af4362ff166a61436c6aa72afae454568719bb
https://github.com/arsduo/elm-rings/blob/a5af4362ff166a61436c6aa72afae454568719bb/example-0.19/elm.js#L5958-L5985
train
mosaicjs/Leaflet.CanvasDataGrid
src/canvas/ImageUtils.js
function(g, x, y, width, height, radius) { g.beginPath(); // a g.moveTo(x + width / 2, y); // b g.bezierCurveTo(// x + width / 2 + radius / 2, y, // x + width / 2 + radius, y + radius / 2, // x + width / 2 + radius, y + radius); // c g.bezi...
javascript
function(g, x, y, width, height, radius) { g.beginPath(); // a g.moveTo(x + width / 2, y); // b g.bezierCurveTo(// x + width / 2 + radius / 2, y, // x + width / 2 + radius, y + radius / 2, // x + width / 2 + radius, y + radius); // c g.bezi...
[ "function", "(", "g", ",", "x", ",", "y", ",", "width", ",", "height", ",", "radius", ")", "{", "g", ".", "beginPath", "(", ")", ";", "// a", "g", ".", "moveTo", "(", "x", "+", "width", "/", "2", ",", "y", ")", ";", "// b", "g", ".", "bezie...
Draws a simple marker on the specified canvas 2d context.
[ "Draws", "a", "simple", "marker", "on", "the", "specified", "canvas", "2d", "context", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/canvas/ImageUtils.js#L6-L31
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GeometryUtils.js
simplifyDouglasPeucker
function simplifyDouglasPeucker(points, sqTolerance) { var len = points.length; var MarkerArray = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; var markers = new MarkerArray(len); var first = 0; var last = len - 1; va...
javascript
function simplifyDouglasPeucker(points, sqTolerance) { var len = points.length; var MarkerArray = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; var markers = new MarkerArray(len); var first = 0; var last = len - 1; va...
[ "function", "simplifyDouglasPeucker", "(", "points", ",", "sqTolerance", ")", "{", "var", "len", "=", "points", ".", "length", ";", "var", "MarkerArray", "=", "typeof", "Uint8Array", "!==", "'undefined'", "?", "Uint8Array", ":", "Array", ";", "var", "markers",...
simplification using optimized Douglas-Peucker algorithm with recursion elimination
[ "simplification", "using", "optimized", "Douglas", "-", "Peucker", "algorithm", "with", "recursion", "elimination" ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GeometryUtils.js#L250-L296
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GeometryUtils.js
simplify
function simplify(points, tolerance, highestQuality) { if (points.length <= 1) return points; var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1; points = highestQuality ? points : simplifyRadialDist(points, ...
javascript
function simplify(points, tolerance, highestQuality) { if (points.length <= 1) return points; var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1; points = highestQuality ? points : simplifyRadialDist(points, ...
[ "function", "simplify", "(", "points", ",", "tolerance", ",", "highestQuality", ")", "{", "if", "(", "points", ".", "length", "<=", "1", ")", "return", "points", ";", "var", "sqTolerance", "=", "tolerance", "!==", "undefined", "?", "tolerance", "*", "toler...
both algorithms combined for awesome performance
[ "both", "algorithms", "combined", "for", "awesome", "performance" ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GeometryUtils.js#L299-L312
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/GeometryUtils.js
function(polygons, clipPolygon) { var result = []; for (var i = 0; i < polygons.length; i++) { var r = this.clipPolygon(polygons[i], clipPolygon); if (r && r.length) { result.push(r); } } return result; }
javascript
function(polygons, clipPolygon) { var result = []; for (var i = 0; i < polygons.length; i++) { var r = this.clipPolygon(polygons[i], clipPolygon); if (r && r.length) { result.push(r); } } return result; }
[ "function", "(", "polygons", ",", "clipPolygon", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "polygons", ".", "length", ";", "i", "++", ")", "{", "var", "r", "=", "this", ".", "clipPolygon", "...
Returns an interection of a list of polygons with the specified clip polygon
[ "Returns", "an", "interection", "of", "a", "list", "of", "polygons", "with", "the", "specified", "clip", "polygon" ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/GeometryUtils.js#L402-L411
train
weexteam/weex-templater
lib/richtext.js
format
function format(node) { var ret = node.children.map(function (child) { var val = stringify(child) val = val.replace(/\"function\s*\(\)\s*{\s*return\s*(.*?)}\"/g, function ($0, $1) { return $1 }).replace(/\"([^,]*?)\":/g, function ($0, $1) { return $1 + ': ' }).replace(/(,)(\S)/g, function ...
javascript
function format(node) { var ret = node.children.map(function (child) { var val = stringify(child) val = val.replace(/\"function\s*\(\)\s*{\s*return\s*(.*?)}\"/g, function ($0, $1) { return $1 }).replace(/\"([^,]*?)\":/g, function ($0, $1) { return $1 + ': ' }).replace(/(,)(\S)/g, function ...
[ "function", "format", "(", "node", ")", "{", "var", "ret", "=", "node", ".", "children", ".", "map", "(", "function", "(", "child", ")", "{", "var", "val", "=", "stringify", "(", "child", ")", "val", "=", "val", ".", "replace", "(", "/", "\\\"funct...
format richtext root node - children -> attr.value binding function @param {Node} node TODO: support event
[ "format", "richtext", "root", "node", "-", "children", "-", ">", "attr", ".", "value", "binding", "function" ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/richtext.js#L17-L47
train
weexteam/weex-templater
lib/richtext.js
walkAndFormat
function walkAndFormat(node) { if (node) { if (node.append !== 'once') { if (node.children && node.children.length) { for (var i = 0, len = node.children.length; i < len; i++) { walkAndFormat(node.children[i]) } } } else { format(node) } } }
javascript
function walkAndFormat(node) { if (node) { if (node.append !== 'once') { if (node.children && node.children.length) { for (var i = 0, len = node.children.length; i < len; i++) { walkAndFormat(node.children[i]) } } } else { format(node) } } }
[ "function", "walkAndFormat", "(", "node", ")", "{", "if", "(", "node", ")", "{", "if", "(", "node", ".", "append", "!==", "'once'", ")", "{", "if", "(", "node", ".", "children", "&&", "node", ".", "children", ".", "length", ")", "{", "for", "(", ...
walk all nodes and format richtext root node @param {Node} node
[ "walk", "all", "nodes", "and", "format", "richtext", "root", "node" ]
200c1fbeb923b70e304193752fdf1db9802650c7
https://github.com/weexteam/weex-templater/blob/200c1fbeb923b70e304193752fdf1db9802650c7/lib/richtext.js#L54-L67
train
waka/gulp-sprockets
src/builders/scss.js
assetHashPath
function assetHashPath(url) { const parsedUrl = path.parse(url.getValue()); const asset = manifest.getAssetValue(parsedUrl.base); return compiler.types.String('url("' + asset + '")'); }
javascript
function assetHashPath(url) { const parsedUrl = path.parse(url.getValue()); const asset = manifest.getAssetValue(parsedUrl.base); return compiler.types.String('url("' + asset + '")'); }
[ "function", "assetHashPath", "(", "url", ")", "{", "const", "parsedUrl", "=", "path", ".", "parse", "(", "url", ".", "getValue", "(", ")", ")", ";", "const", "asset", "=", "manifest", ".", "getAssetValue", "(", "parsedUrl", ".", "base", ")", ";", "retu...
Return file path from manifest. @param {String} url . @return {String} Manifest path.
[ "Return", "file", "path", "from", "manifest", "." ]
cb60c0973b3bc2aa347870aa879ce6f2fa0d5a3f
https://github.com/waka/gulp-sprockets/blob/cb60c0973b3bc2aa347870aa879ce6f2fa0d5a3f/src/builders/scss.js#L18-L22
train
waka/gulp-sprockets
src/builders/scss.js
assetPath
function assetPath(url) { const parsedUrl = path.parse(url.getValue()); return compiler.types.String('url("' + parsedUrl.base + '")'); }
javascript
function assetPath(url) { const parsedUrl = path.parse(url.getValue()); return compiler.types.String('url("' + parsedUrl.base + '")'); }
[ "function", "assetPath", "(", "url", ")", "{", "const", "parsedUrl", "=", "path", ".", "parse", "(", "url", ".", "getValue", "(", ")", ")", ";", "return", "compiler", ".", "types", ".", "String", "(", "'url(\"'", "+", "parsedUrl", ".", "base", "+", "...
Return file path. @param {String} url . @return {String} Raw asset path.
[ "Return", "file", "path", "." ]
cb60c0973b3bc2aa347870aa879ce6f2fa0d5a3f
https://github.com/waka/gulp-sprockets/blob/cb60c0973b3bc2aa347870aa879ce6f2fa0d5a3f/src/builders/scss.js#L30-L33
train
dkozar/raycast-dom
build/lookup/evaluateClassName.js
evaluateClassName
function evaluateClassName(sub, element) { var className = BLANK_STRING + element.className + BLANK_STRING; sub = BLANK_STRING + sub + BLANK_STRING; return className && className.indexOf(sub) > -1; }
javascript
function evaluateClassName(sub, element) { var className = BLANK_STRING + element.className + BLANK_STRING; sub = BLANK_STRING + sub + BLANK_STRING; return className && className.indexOf(sub) > -1; }
[ "function", "evaluateClassName", "(", "sub", ",", "element", ")", "{", "var", "className", "=", "BLANK_STRING", "+", "element", ".", "className", "+", "BLANK_STRING", ";", "sub", "=", "BLANK_STRING", "+", "sub", "+", "BLANK_STRING", ";", "return", "className",...
Checks whether the substring is present within element className @param sub Substring to check for @param element DOM element @returns {*|boolean}
[ "Checks", "whether", "the", "substring", "is", "present", "within", "element", "className" ]
91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98
https://github.com/dkozar/raycast-dom/blob/91eb7ad1fbc4c91f8f3ccca69a33e1083f6d5d98/build/lookup/evaluateClassName.js#L15-L20
train
akonoupakis/mongodb-proxy
lib/Store.js
function () { OptionsProcessor.apply(this, arguments) this._single = false this._cached = false this._resolved = true this._query = undefined this._fields = undefined this._options = { limit: 500 } }
javascript
function () { OptionsProcessor.apply(this, arguments) this._single = false this._cached = false this._resolved = true this._query = undefined this._fields = undefined this._options = { limit: 500 } }
[ "function", "(", ")", "{", "OptionsProcessor", ".", "apply", "(", "this", ",", "arguments", ")", "this", ".", "_single", "=", "false", "this", ".", "_cached", "=", "false", "this", ".", "_resolved", "=", "true", "this", ".", "_query", "=", "undefined", ...
The processor for get actions. @constructor
[ "The", "processor", "for", "get", "actions", "." ]
d0b3a9f6dea525f6dafdaa3084b7aefd51c7f577
https://github.com/akonoupakis/mongodb-proxy/blob/d0b3a9f6dea525f6dafdaa3084b7aefd51c7f577/lib/Store.js#L1113-L1125
train
tdreyno/morlock.js
core/util.js
indexOf
function indexOf(list, item) { if (NATIVE_ARRAY_INDEXOF) { return NATIVE_ARRAY_INDEXOF.call(list, item); } for (var i = 0; i < list.length; i++) { if (list[i] === item) { return i; } } return -1; }
javascript
function indexOf(list, item) { if (NATIVE_ARRAY_INDEXOF) { return NATIVE_ARRAY_INDEXOF.call(list, item); } for (var i = 0; i < list.length; i++) { if (list[i] === item) { return i; } } return -1; }
[ "function", "indexOf", "(", "list", ",", "item", ")", "{", "if", "(", "NATIVE_ARRAY_INDEXOF", ")", "{", "return", "NATIVE_ARRAY_INDEXOF", ".", "call", "(", "list", ",", "item", ")", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "list", ...
Backwards compatible Array.prototype.indexOf @param {array} list List of items. @param {object} item Item to search for. @return {number} Index of match or -1 if not found.
[ "Backwards", "compatible", "Array", ".", "prototype", ".", "indexOf" ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L44-L56
train
tdreyno/morlock.js
core/util.js
throttle
function throttle(f, delay) { var timeoutId; var previous = 0; return function throttleExecute_() { var args = arguments; var now = +(new Date()); var remaining = delay - (now - previous); if (remaining <= 0) { clearTimeout(timeoutId); timeoutId = null; previous = now; f...
javascript
function throttle(f, delay) { var timeoutId; var previous = 0; return function throttleExecute_() { var args = arguments; var now = +(new Date()); var remaining = delay - (now - previous); if (remaining <= 0) { clearTimeout(timeoutId); timeoutId = null; previous = now; f...
[ "function", "throttle", "(", "f", ",", "delay", ")", "{", "var", "timeoutId", ";", "var", "previous", "=", "0", ";", "return", "function", "throttleExecute_", "(", ")", "{", "var", "args", "=", "arguments", ";", "var", "now", "=", "+", "(", "new", "D...
Throttle a function. @param {function} f The function. @param {number} delay The delay in ms. @return {function} A function which calls the passed-in function throttled.
[ "Throttle", "a", "function", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L64-L88
train
tdreyno/morlock.js
core/util.js
debounce
function debounce(f, delay) { var timeoutId = null; return function debounceExecute_() { clearTimeout(timeoutId); var lastArgs = arguments; timeoutId = setTimeout(function() { timeoutId = null; f.apply(null, lastArgs); }, delay); }; }
javascript
function debounce(f, delay) { var timeoutId = null; return function debounceExecute_() { clearTimeout(timeoutId); var lastArgs = arguments; timeoutId = setTimeout(function() { timeoutId = null; f.apply(null, lastArgs); }, delay); }; }
[ "function", "debounce", "(", "f", ",", "delay", ")", "{", "var", "timeoutId", "=", "null", ";", "return", "function", "debounceExecute_", "(", ")", "{", "clearTimeout", "(", "timeoutId", ")", ";", "var", "lastArgs", "=", "arguments", ";", "timeoutId", "=",...
Debounce a function. @param {function} f The function. @param {number} delay The delay in ms. @return {function} A function which calls the passed-in function debounced.
[ "Debounce", "a", "function", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L96-L108
train
tdreyno/morlock.js
core/util.js
forEach
function forEach(f, arr) { if (NATIVE_ARRAY_FOREACH) { if (arr) { NATIVE_ARRAY_FOREACH.call(arr, f); } return; } for (var i = 0; i < arr.length; i++) { f(arr[i], i, arr); } }
javascript
function forEach(f, arr) { if (NATIVE_ARRAY_FOREACH) { if (arr) { NATIVE_ARRAY_FOREACH.call(arr, f); } return; } for (var i = 0; i < arr.length; i++) { f(arr[i], i, arr); } }
[ "function", "forEach", "(", "f", ",", "arr", ")", "{", "if", "(", "NATIVE_ARRAY_FOREACH", ")", "{", "if", "(", "arr", ")", "{", "NATIVE_ARRAY_FOREACH", ".", "call", "(", "arr", ",", "f", ")", ";", "}", "return", ";", "}", "for", "(", "var", "i", ...
Loop a function over an object, for side-effects. @param {object} obj The object. @param {function} f The function.
[ "Loop", "a", "function", "over", "an", "object", "for", "side", "-", "effects", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L216-L228
train
tdreyno/morlock.js
core/util.js
objectKeys
function objectKeys(obj) { if (!obj) { return null; } if (Object.keys) { return Object.keys(obj); } var out = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { out.push(key); } } return out; }
javascript
function objectKeys(obj) { if (!obj) { return null; } if (Object.keys) { return Object.keys(obj); } var out = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { out.push(key); } } return out; }
[ "function", "objectKeys", "(", "obj", ")", "{", "if", "(", "!", "obj", ")", "{", "return", "null", ";", "}", "if", "(", "Object", ".", "keys", ")", "{", "return", "Object", ".", "keys", "(", "obj", ")", ";", "}", "var", "out", "=", "[", "]", ...
Get the keys of an object. @param {object} obj The object. @return {array} An array of keys.
[ "Get", "the", "keys", "of", "an", "object", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L235-L251
train
tdreyno/morlock.js
core/util.js
eq
function eq(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) { return a !== 0 || 1 / a == 1 / b; } // A strict comparison is necessary because `null == und...
javascript
function eq(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) { return a !== 0 || 1 / a == 1 / b; } // A strict comparison is necessary because `null == und...
[ "function", "eq", "(", "a", ",", "b", ",", "aStack", ",", "bStack", ")", "{", "// Identical objects are equal. `0 === -0`, but they aren't identical.", "// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).", "if", "(", "a", "===", "b", ")",...
Recursive comparison function for `isEqual`.
[ "Recursive", "comparison", "function", "for", "isEqual", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L346-L457
train
tdreyno/morlock.js
core/util.js
functionBind
function functionBind(f, obj) { if (NATIVE_FUNCTION_BIND) { return NATIVE_FUNCTION_BIND.call(f, obj); } return function boundFunction_() { return f.apply(obj, arguments); }; }
javascript
function functionBind(f, obj) { if (NATIVE_FUNCTION_BIND) { return NATIVE_FUNCTION_BIND.call(f, obj); } return function boundFunction_() { return f.apply(obj, arguments); }; }
[ "function", "functionBind", "(", "f", ",", "obj", ")", "{", "if", "(", "NATIVE_FUNCTION_BIND", ")", "{", "return", "NATIVE_FUNCTION_BIND", ".", "call", "(", "f", ",", "obj", ")", ";", "}", "return", "function", "boundFunction_", "(", ")", "{", "return", ...
Bind a function's 'this' value. @param {function} f The function. @param {object} obj The object. @return {function} The bound function.
[ "Bind", "a", "function", "s", "this", "value", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L491-L499
train
tdreyno/morlock.js
core/util.js
partial
function partial(f /*, args*/) { var args = rest(arguments); if (NATIVE_FUNCTION_BIND) { args.unshift(undefined); return NATIVE_FUNCTION_BIND.apply(f, args); } return function partialExecute_() { var args2 = slice(arguments, 0); return f.apply(this, args.concat(args2)); }; }
javascript
function partial(f /*, args*/) { var args = rest(arguments); if (NATIVE_FUNCTION_BIND) { args.unshift(undefined); return NATIVE_FUNCTION_BIND.apply(f, args); } return function partialExecute_() { var args2 = slice(arguments, 0); return f.apply(this, args.concat(args2)); }; }
[ "function", "partial", "(", "f", "/*, args*/", ")", "{", "var", "args", "=", "rest", "(", "arguments", ")", ";", "if", "(", "NATIVE_FUNCTION_BIND", ")", "{", "args", ".", "unshift", "(", "undefined", ")", ";", "return", "NATIVE_FUNCTION_BIND", ".", "apply"...
Partially apply a function.
[ "Partially", "apply", "a", "function", "." ]
a1d3f1f177887485b084aa38c91189fd9f9cfedf
https://github.com/tdreyno/morlock.js/blob/a1d3f1f177887485b084aa38c91189fd9f9cfedf/core/util.js#L504-L516
train
mosaicjs/Leaflet.CanvasDataGrid
src/data/DataProvider.js
function(options) { this.options = options || {}; if (typeof this.options.getGeometry === 'function') { this.getGeometry = this.options.getGeometry; } this.setData(this.options.data); }
javascript
function(options) { this.options = options || {}; if (typeof this.options.getGeometry === 'function') { this.getGeometry = this.options.getGeometry; } this.setData(this.options.data); }
[ "function", "(", "options", ")", "{", "this", ".", "options", "=", "options", "||", "{", "}", ";", "if", "(", "typeof", "this", ".", "options", ".", "getGeometry", "===", "'function'", ")", "{", "this", ".", "getGeometry", "=", "this", ".", "options", ...
Initializes this object and indexes the initial data set.
[ "Initializes", "this", "object", "and", "indexes", "the", "initial", "data", "set", "." ]
ebf193b12c390ef2b00b6faa2be878751d0b1fc3
https://github.com/mosaicjs/Leaflet.CanvasDataGrid/blob/ebf193b12c390ef2b00b6faa2be878751d0b1fc3/src/data/DataProvider.js#L15-L21
train