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
azendal/argon
argon/storage/json_rest.js
_sendRequest
function _sendRequest(requestObj, callback) { var Storage, ajaxConfig; Storage = this; ajaxConfig = { url : requestObj.config.url, type : requestObj.config.type || this.REQUEST_TYPE_GET, contentType : requestObj.config.contentType || 'applicat...
javascript
function _sendRequest(requestObj, callback) { var Storage, ajaxConfig; Storage = this; ajaxConfig = { url : requestObj.config.url, type : requestObj.config.type || this.REQUEST_TYPE_GET, contentType : requestObj.config.contentType || 'applicat...
[ "function", "_sendRequest", "(", "requestObj", ",", "callback", ")", "{", "var", "Storage", ",", "ajaxConfig", ";", "Storage", "=", "this", ";", "ajaxConfig", "=", "{", "url", ":", "requestObj", ".", "config", ".", "url", ",", "type", ":", "requestObj", ...
Internal implementation of the communication sequence with the service All requests at some point rely on this method to format the data and send the request to the service @method _sendRequest <public, static> [Function] @argument requestObj @argument callback the function to execute when the process finishes @return ...
[ "Internal", "implementation", "of", "the", "communication", "sequence", "with", "the", "service", "All", "requests", "at", "some", "point", "rely", "on", "this", "method", "to", "format", "the", "data", "and", "send", "the", "request", "to", "the", "service" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/json_rest.js#L139-L170
train
azendal/argon
argon/storage/json_rest.js
function (xhr, message, callback) { var response; switch (xhr.status) { case this.RESPONSE_OK: response = JSON.parse(xhr.responseText); break; case this.RESPONSE_UNPROCESSABLE_ENTITY: response = JSON.parse(xhr.responseText); ...
javascript
function (xhr, message, callback) { var response; switch (xhr.status) { case this.RESPONSE_OK: response = JSON.parse(xhr.responseText); break; case this.RESPONSE_UNPROCESSABLE_ENTITY: response = JSON.parse(xhr.responseText); ...
[ "function", "(", "xhr", ",", "message", ",", "callback", ")", "{", "var", "response", ";", "switch", "(", "xhr", ".", "status", ")", "{", "case", "this", ".", "RESPONSE_OK", ":", "response", "=", "JSON", ".", "parse", "(", "xhr", ".", "responseText", ...
Internal data processing for request responses In order to transform the responses from the server to native models this process does certain operations to transform the data from the server notation to JavaScript notation @method _processResponse <public, static> [Function] @argument xhr @argument message @argument ca...
[ "Internal", "data", "processing", "for", "request", "responses", "In", "order", "to", "transform", "the", "responses", "from", "the", "server", "to", "native", "models", "this", "process", "does", "certain", "operations", "to", "transform", "the", "data", "from"...
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/json_rest.js#L181-L213
train
azendal/argon
argon/storage/json_rest.js
create
function create(requestObj, callback) { var i, requestConfig, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; } ...
javascript
function create(requestObj, callback) { var i, requestConfig, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; } ...
[ "function", "create", "(", "requestObj", ",", "callback", ")", "{", "var", "i", ",", "requestConfig", ",", "storage", ";", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "(", ")", "{", "}", ";", "if", "(", "(", "typeof", ...
Pushes the instance to the storage service @method post <public> @argument requestObj <optional> [Object] the data to post, generally this comes from a model @argument callback <optional> [Function]
[ "Pushes", "the", "instance", "to", "the", "storage", "service" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/json_rest.js#L276-L305
train
azendal/argon
argon/storage/json_rest.js
update
function update(requestObj, callback) { var i, found, storedData, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; }...
javascript
function update(requestObj, callback) { var i, found, storedData, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; }...
[ "function", "update", "(", "requestObj", ",", "callback", ")", "{", "var", "i", ",", "found", ",", "storedData", ",", "storage", ";", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "(", ")", "{", "}", ";", "if", "(", "(",...
Updates from the resource @method put <public> @argument params <optional> [Object] @argument callback <optional> [Function]
[ "Updates", "from", "the", "resource" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/json_rest.js#L385-L416
train
azendal/argon
argon/storage/json_rest.js
remove
function remove(requestObj, callback) { var i, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; } reque...
javascript
function remove(requestObj, callback) { var i, storage; storage = this; callback = callback || function(){}; if ((typeof requestObj) === 'undefined' || requestObj === null) { callback(null); return this; } reque...
[ "function", "remove", "(", "requestObj", ",", "callback", ")", "{", "var", "i", ",", "storage", ";", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "(", ")", "{", "}", ";", "if", "(", "(", "typeof", "requestObj", ")", "==...
Removes this from the resource Delete cannot be used because its a reserved word on JavaScript and for now is safer to use a synonim later this could be aliased by the correct method @method remove <public> @argument params <optional> [Object] @argument callback <optional> [Function]
[ "Removes", "this", "from", "the", "resource" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/json_rest.js#L428-L456
train
KenanY/alea-random
index.js
aleaRandom
function aleaRandom(min, max, floating) { var gen = new Alea(uuid.v4()); if (floating && typeof floating !== 'boolean' && isIterateeCall(min, max, floating)) { max = floating = undefined; } if (floating === undefined) { if (typeof max === 'boolean') { floating = max; max = undefined; }...
javascript
function aleaRandom(min, max, floating) { var gen = new Alea(uuid.v4()); if (floating && typeof floating !== 'boolean' && isIterateeCall(min, max, floating)) { max = floating = undefined; } if (floating === undefined) { if (typeof max === 'boolean') { floating = max; max = undefined; }...
[ "function", "aleaRandom", "(", "min", ",", "max", ",", "floating", ")", "{", "var", "gen", "=", "new", "Alea", "(", "uuid", ".", "v4", "(", ")", ")", ";", "if", "(", "floating", "&&", "typeof", "floating", "!==", "'boolean'", "&&", "isIterateeCall", ...
Produces a random number between the inclusive `min` and `max` bounds. If only one argument is provided a number between `0` and the given number is returned. If `floating` is `true`, or either `min` or `max` are floats, a floating-point number is returned instead of an integer. **Note:** JavaScript follows the IEEE-7...
[ "Produces", "a", "random", "number", "between", "the", "inclusive", "min", "and", "max", "bounds", ".", "If", "only", "one", "argument", "is", "provided", "a", "number", "between", "0", "and", "the", "given", "number", "is", "returned", ".", "If", "floatin...
f6752504570a6314ea201c5abb0c8b13157403db
https://github.com/KenanY/alea-random/blob/f6752504570a6314ea201c5abb0c8b13157403db/index.js#L34-L79
train
wojtkowiak/private-decorator
src/privateMember.js
_functionBelongsToObject
function _functionBelongsToObject(self, caller, target, protectedMode = false) { if (!caller) return false; // We are caching the results for better performance. let cacheOfResultsForSelf = resultCache.get(self); if (cacheOfResultsForSelf && cacheOfResultsForSelf.has(caller)) { return cacheOfR...
javascript
function _functionBelongsToObject(self, caller, target, protectedMode = false) { if (!caller) return false; // We are caching the results for better performance. let cacheOfResultsForSelf = resultCache.get(self); if (cacheOfResultsForSelf && cacheOfResultsForSelf.has(caller)) { return cacheOfR...
[ "function", "_functionBelongsToObject", "(", "self", ",", "caller", ",", "target", ",", "protectedMode", "=", "false", ")", "{", "if", "(", "!", "caller", ")", "return", "false", ";", "// We are caching the results for better performance.", "let", "cacheOfResultsForSe...
Checks if `caller` belongs to `self`. @param {Object} self - The current `this`. @param {Object} caller - The caller function. @param {Object} target - The original define property target. @param {boolean} protectedMode - Whether this should be protected instead of private. @returns {bool} @private
[ "Checks", "if", "caller", "belongs", "to", "self", "." ]
5895bb37a8b9bf5bf6d21f120d7217f23c304f1b
https://github.com/wojtkowiak/private-decorator/blob/5895bb37a8b9bf5bf6d21f120d7217f23c304f1b/src/privateMember.js#L225-L268
train
spacemaus/postvox
vox-client/vox-client.js
prepareProfileDir
function prepareProfileDir(profilesDir, nick) { var nick = nick || '.tmp'; // Just in case `nick` has any funny business... nick = nick.replace(/[^\w\d.]/g, '-').replace('..', '-'); var profileDir = path.join(profilesDir, util.format('vox-%s', nick)); debug('Ensuring directory at %s', profileDir); mkdirp.sy...
javascript
function prepareProfileDir(profilesDir, nick) { var nick = nick || '.tmp'; // Just in case `nick` has any funny business... nick = nick.replace(/[^\w\d.]/g, '-').replace('..', '-'); var profileDir = path.join(profilesDir, util.format('vox-%s', nick)); debug('Ensuring directory at %s', profileDir); mkdirp.sy...
[ "function", "prepareProfileDir", "(", "profilesDir", ",", "nick", ")", "{", "var", "nick", "=", "nick", "||", "'.tmp'", ";", "// Just in case `nick` has any funny business...", "nick", "=", "nick", ".", "replace", "(", "/", "[^\\w\\d.]", "/", "g", ",", "'-'", ...
Ensures that profilesDir exists and formats an appropriate name for the profile directory. @return {String} DB file path.
[ "Ensures", "that", "profilesDir", "exists", "and", "formats", "an", "appropriate", "name", "for", "the", "profile", "directory", "." ]
de98e5ed37edaee1b1edadf93e15eb8f8d21f457
https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-client/vox-client.js#L725-L733
train
SwirlNetworks/discus
src/list_view.js
function(model) { var _d = this._d; // quicker lookup if (!_d.hasData) { // if we've never rendered data yet, queue up a reset collection // this probably means we just finished our very first fetch // reset needed to clear out loading / no data state.. return this.resetCollection(); } _d.modelChang...
javascript
function(model) { var _d = this._d; // quicker lookup if (!_d.hasData) { // if we've never rendered data yet, queue up a reset collection // this probably means we just finished our very first fetch // reset needed to clear out loading / no data state.. return this.resetCollection(); } _d.modelChang...
[ "function", "(", "model", ")", "{", "var", "_d", "=", "this", ".", "_d", ";", "// quicker lookup", "if", "(", "!", "_d", ".", "hasData", ")", "{", "// if we've never rendered data yet, queue up a reset collection", "// this probably means we just finished our very first f...
these next coupl of methods queue up structures to then be flushed using updateViews updateViews should really be updateInternalCache or something...
[ "these", "next", "coupl", "of", "methods", "queue", "up", "structures", "to", "then", "be", "flushed", "using", "updateViews", "updateViews", "should", "really", "be", "updateInternalCache", "or", "something", "..." ]
79df8de5ec268879e50ec1e12e78b62a13b4a427
https://github.com/SwirlNetworks/discus/blob/79df8de5ec268879e50ec1e12e78b62a13b4a427/src/list_view.js#L273-L283
train
SwirlNetworks/discus
src/list_view.js
function(id) { var self = this; this.collection.each(function(model) { if (model.id == id || _(id).contains(model.id)) { return; } // console.log("Unselecting model", model.id, id); self.getStateModel(model).set({ selected: false }); }); }
javascript
function(id) { var self = this; this.collection.each(function(model) { if (model.id == id || _(id).contains(model.id)) { return; } // console.log("Unselecting model", model.id, id); self.getStateModel(model).set({ selected: false }); }); }
[ "function", "(", "id", ")", "{", "var", "self", "=", "this", ";", "this", ".", "collection", ".", "each", "(", "function", "(", "model", ")", "{", "if", "(", "model", ".", "id", "==", "id", "||", "_", "(", "id", ")", ".", "contains", "(", "mode...
optional, unselect all but id
[ "optional", "unselect", "all", "but", "id" ]
79df8de5ec268879e50ec1e12e78b62a13b4a427
https://github.com/SwirlNetworks/discus/blob/79df8de5ec268879e50ec1e12e78b62a13b4a427/src/list_view.js#L1387-L1397
train
ebrelsford/cartodb-export
index.js
exportVis
function exportVis(url, dest, callback) { if (dest === undefined) dest = '.'; (0, _mkdirp2['default'])(dest, function (err) { if (err && callback) return callback(err); if (!isVisUrl(url)) { url = getVisUrl(url); } getVisJson(url, _path2['default'].join(dest, 'viz.js...
javascript
function exportVis(url, dest, callback) { if (dest === undefined) dest = '.'; (0, _mkdirp2['default'])(dest, function (err) { if (err && callback) return callback(err); if (!isVisUrl(url)) { url = getVisUrl(url); } getVisJson(url, _path2['default'].join(dest, 'viz.js...
[ "function", "exportVis", "(", "url", ",", "dest", ",", "callback", ")", "{", "if", "(", "dest", "===", "undefined", ")", "dest", "=", "'.'", ";", "(", "0", ",", "_mkdirp2", "[", "'default'", "]", ")", "(", "dest", ",", "function", "(", "err", ")", ...
Export a visualization at the given url. @param {String} url the visualization's url @param {String} dest the directory to export the visualization into @example exportVis('https://eric.cartodb.com/api/v2/viz/85c59718-082c-11e3-86d3-5404a6a69006/viz.json', 'my_vis');
[ "Export", "a", "visualization", "at", "the", "given", "url", "." ]
939cc17f16dc6777f1267e4c12425a9ad17b77ab
https://github.com/ebrelsford/cartodb-export/blob/939cc17f16dc6777f1267e4c12425a9ad17b77ab/index.js#L60-L72
train
ebrelsford/cartodb-export
index.js
getVisUrl
function getVisUrl(url) { var match = /https?:\/\/(\S+)\.cartodb\.com\/viz\/(\S+)\/(?:public_)?map/.exec(url); if (match) { var user = match[1], mapId = match[2]; return 'https://' + user + '.cartodb.com/api/v2/viz/' + mapId + '/viz.json'; } }
javascript
function getVisUrl(url) { var match = /https?:\/\/(\S+)\.cartodb\.com\/viz\/(\S+)\/(?:public_)?map/.exec(url); if (match) { var user = match[1], mapId = match[2]; return 'https://' + user + '.cartodb.com/api/v2/viz/' + mapId + '/viz.json'; } }
[ "function", "getVisUrl", "(", "url", ")", "{", "var", "match", "=", "/", "https?:\\/\\/(\\S+)\\.cartodb\\.com\\/viz\\/(\\S+)\\/(?:public_)?map", "/", ".", "exec", "(", "url", ")", ";", "if", "(", "match", ")", "{", "var", "user", "=", "match", "[", "1", "]",...
Convert a map's url into the viz.json url for that map. @param {String} url the map's url @return {String} the viz.json url, if found
[ "Convert", "a", "map", "s", "url", "into", "the", "viz", ".", "json", "url", "for", "that", "map", "." ]
939cc17f16dc6777f1267e4c12425a9ad17b77ab
https://github.com/ebrelsford/cartodb-export/blob/939cc17f16dc6777f1267e4c12425a9ad17b77ab/index.js#L86-L93
train
ebrelsford/cartodb-export
index.js
downloadVisualizationData
function downloadVisualizationData(_visJson, destDir, callback) { if (destDir === undefined) destDir = '.'; withVisJson(_visJson, function (err, visJson) { if (err && callback) return callback(err); _async2['default'].forEachOf(visJson.layers, function (layer, layerIndex, callback) { ...
javascript
function downloadVisualizationData(_visJson, destDir, callback) { if (destDir === undefined) destDir = '.'; withVisJson(_visJson, function (err, visJson) { if (err && callback) return callback(err); _async2['default'].forEachOf(visJson.layers, function (layer, layerIndex, callback) { ...
[ "function", "downloadVisualizationData", "(", "_visJson", ",", "destDir", ",", "callback", ")", "{", "if", "(", "destDir", "===", "undefined", ")", "destDir", "=", "'.'", ";", "withVisJson", "(", "_visJson", ",", "function", "(", "err", ",", "visJson", ")", ...
Download the layer data for a visualization. @param {Object|String} visJson the visualization's JSON or the url where it can be found @param {String} destDir the base directory where the data should be saved
[ "Download", "the", "layer", "data", "for", "a", "visualization", "." ]
939cc17f16dc6777f1267e4c12425a9ad17b77ab
https://github.com/ebrelsford/cartodb-export/blob/939cc17f16dc6777f1267e4c12425a9ad17b77ab/index.js#L147-L167
train
ebrelsford/cartodb-export
index.js
downloadSublayerData
function downloadSublayerData(visJson, layerIndex, sublayerIndex, dest, callback) { var layer = visJson.layers[layerIndex], sublayer = layer.options.layer_definition.layers[sublayerIndex]; (0, _mkdirp2['default'])(_path2['default'].dirname(dest), function () { var dataFile = _fs2['default'].cre...
javascript
function downloadSublayerData(visJson, layerIndex, sublayerIndex, dest, callback) { var layer = visJson.layers[layerIndex], sublayer = layer.options.layer_definition.layers[sublayerIndex]; (0, _mkdirp2['default'])(_path2['default'].dirname(dest), function () { var dataFile = _fs2['default'].cre...
[ "function", "downloadSublayerData", "(", "visJson", ",", "layerIndex", ",", "sublayerIndex", ",", "dest", ",", "callback", ")", "{", "var", "layer", "=", "visJson", ".", "layers", "[", "layerIndex", "]", ",", "sublayer", "=", "layer", ".", "options", ".", ...
Download the data for a single sublayer. @param {Object} visJson the visualization's JSON @param {Number} layerIndex the index of the layer @param {Number} sublayerIndex the index of the sublayer @param {String} dest the directory to save the sublayer's data in @param {Function} callback called on success
[ "Download", "the", "data", "for", "a", "single", "sublayer", "." ]
939cc17f16dc6777f1267e4c12425a9ad17b77ab
https://github.com/ebrelsford/cartodb-export/blob/939cc17f16dc6777f1267e4c12425a9ad17b77ab/index.js#L211-L251
train
ClickInspire/sails-relational-fixtures
index.js
function(folder) { var files, modelName; folder = folder || process.cwd() + '/test/fixtures'; files = fs.readdirSync(folder); for (var i = 0; i < files.length; i++) { if (getFileExtension(files[i]) === '.json') { modelName = fileToModelName(files[i]); this.objects[modelName] = require(path.joi...
javascript
function(folder) { var files, modelName; folder = folder || process.cwd() + '/test/fixtures'; files = fs.readdirSync(folder); for (var i = 0; i < files.length; i++) { if (getFileExtension(files[i]) === '.json') { modelName = fileToModelName(files[i]); this.objects[modelName] = require(path.joi...
[ "function", "(", "folder", ")", "{", "var", "files", ",", "modelName", ";", "folder", "=", "folder", "||", "process", ".", "cwd", "(", ")", "+", "'/test/fixtures'", ";", "files", "=", "fs", ".", "readdirSync", "(", "folder", ")", ";", "for", "(", "va...
Read fixtures from JSON files into `objects` @param {String} [folder='<project_root>/test/fixtures'] path to fixtures @return {Object} this module, where the objects member is holding loaded fixtures
[ "Read", "fixtures", "from", "JSON", "files", "into", "objects" ]
50fc57b328bb0da22049cb6e16b3fb3e1f1cc7b4
https://github.com/ClickInspire/sails-relational-fixtures/blob/50fc57b328bb0da22049cb6e16b3fb3e1f1cc7b4/index.js#L27-L42
train
ClickInspire/sails-relational-fixtures
index.js
function () { var that = this, independent, dependencyNotRequired; promiseIndependent = this.saveFixturesFromArray(independentFixtures); promiseDelayedDependency = this.saveFixturesFromArray(delayedDependencyFixtures); promise = Q.all([ promiseIndependent, promiseDelayedDependency ]) .then(fun...
javascript
function () { var that = this, independent, dependencyNotRequired; promiseIndependent = this.saveFixturesFromArray(independentFixtures); promiseDelayedDependency = this.saveFixturesFromArray(delayedDependencyFixtures); promise = Q.all([ promiseIndependent, promiseDelayedDependency ]) .then(fun...
[ "function", "(", ")", "{", "var", "that", "=", "this", ",", "independent", ",", "dependencyNotRequired", ";", "promiseIndependent", "=", "this", ".", "saveFixturesFromArray", "(", "independentFixtures", ")", ";", "promiseDelayedDependency", "=", "this", ".", "save...
Create all of the fixtures in order using grouped arrays.
[ "Create", "all", "of", "the", "fixtures", "in", "order", "using", "grouped", "arrays", "." ]
50fc57b328bb0da22049cb6e16b3fb3e1f1cc7b4
https://github.com/ClickInspire/sails-relational-fixtures/blob/50fc57b328bb0da22049cb6e16b3fb3e1f1cc7b4/index.js#L149-L163
train
jhermsmeier/node-cyclic-32
lib/crc32.js
crc32
function crc32( buffer, seed, table ) { var crc = seed ^ -1 var length = buffer.length - 15 var TABLE = table || crc32.TABLE.DEFAULT var i = 0 while( i < length ) { crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ] crc = (...
javascript
function crc32( buffer, seed, table ) { var crc = seed ^ -1 var length = buffer.length - 15 var TABLE = table || crc32.TABLE.DEFAULT var i = 0 while( i < length ) { crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ] crc = ( crc >>> 8 ) ^ TABLE[ 0xFF & ( crc ^ buffer[ i++ ] ) ] crc = (...
[ "function", "crc32", "(", "buffer", ",", "seed", ",", "table", ")", "{", "var", "crc", "=", "seed", "^", "-", "1", "var", "length", "=", "buffer", ".", "length", "-", "15", "var", "TABLE", "=", "table", "||", "crc32", ".", "TABLE", ".", "DEFAULT", ...
Calculate the CRC32 checksum of a given buffer @param {Buffer} buffer @param {Number} [seed=0] @param {Int32Array} [table=crc32.TABLE.DEFAULT] @returns {Number} checksum
[ "Calculate", "the", "CRC32", "checksum", "of", "a", "given", "buffer" ]
5ba7f4d8c9c3c1e61ae52591461f3225fde064e2
https://github.com/jhermsmeier/node-cyclic-32/blob/5ba7f4d8c9c3c1e61ae52591461f3225fde064e2/lib/crc32.js#L12-L45
train
joemccann/photopipe
plugins/twitter/twitter.js
normalizeTwitterData
function normalizeTwitterData(data,req,res){ var normalized = { error: false, error_message: '', media: [] } // console.dir(req.session.twitter) if( isTwitterOverCapacity() ){ normalized.error = true normalized.error_message = "It appears Twitter is over capacity. Try again." } ...
javascript
function normalizeTwitterData(data,req,res){ var normalized = { error: false, error_message: '', media: [] } // console.dir(req.session.twitter) if( isTwitterOverCapacity() ){ normalized.error = true normalized.error_message = "It appears Twitter is over capacity. Try again." } ...
[ "function", "normalizeTwitterData", "(", "data", ",", "req", ",", "res", ")", "{", "var", "normalized", "=", "{", "error", ":", "false", ",", "error_message", ":", "''", ",", "media", ":", "[", "]", "}", "// console.dir(req.session.twitter)", "if", "(", "i...
Let's normalize the response of media data to only include the photos we want.
[ "Let", "s", "normalize", "the", "response", "of", "media", "data", "to", "only", "include", "the", "photos", "we", "want", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/plugins/twitter/twitter.js#L33-L261
train
craigbilner/eslint-plugin-react-props
lib/utilities.js
isPropTypesDeclaration
function isPropTypesDeclaration(context, node) { // Special case for class properties // (babel-eslint does not expose property name so we have to rely on tokens) if (node.type === 'ClassProperty') { const tokens = context.getFirstTokens(node, 2); if (isTypesDecl(tokens[0].value) || isTypesDecl(tokens[1]....
javascript
function isPropTypesDeclaration(context, node) { // Special case for class properties // (babel-eslint does not expose property name so we have to rely on tokens) if (node.type === 'ClassProperty') { const tokens = context.getFirstTokens(node, 2); if (isTypesDecl(tokens[0].value) || isTypesDecl(tokens[1]....
[ "function", "isPropTypesDeclaration", "(", "context", ",", "node", ")", "{", "// Special case for class properties", "// (babel-eslint does not expose property name so we have to rely on tokens)", "if", "(", "node", ".", "type", "===", "'ClassProperty'", ")", "{", "const", "t...
Checks if node is `propTypes` declaration @param {ASTNode} node The AST node being checked. @returns {Boolean} True if node is `propTypes` declaration, false if not.
[ "Checks", "if", "node", "is", "propTypes", "declaration" ]
d4138351d36cadb7ce319440b75d5437772e6882
https://github.com/craigbilner/eslint-plugin-react-props/blob/d4138351d36cadb7ce319440b75d5437772e6882/lib/utilities.js#L14-L26
train
sdawood/functional-pipelines
src/functional-pipelines.js
reduce
function reduce(reducingFn, initFn, enumerable, resultFn) { if (isFunction(resultFn)) { resultFn = pipe(unreduced, resultFn); } else { resultFn = unreduced; } let result; const iter = iterator(enumerable); if (!initFn) { const [initValue] = iter; initFn = lazy(in...
javascript
function reduce(reducingFn, initFn, enumerable, resultFn) { if (isFunction(resultFn)) { resultFn = pipe(unreduced, resultFn); } else { resultFn = unreduced; } let result; const iter = iterator(enumerable); if (!initFn) { const [initValue] = iter; initFn = lazy(in...
[ "function", "reduce", "(", "reducingFn", ",", "initFn", ",", "enumerable", ",", "resultFn", ")", "{", "if", "(", "isFunction", "(", "resultFn", ")", ")", "{", "resultFn", "=", "pipe", "(", "unreduced", ",", "resultFn", ")", ";", "}", "else", "{", "resu...
Implements reduce for iterables Uses the for-of to reduce an iterable, accepting a reducing function @param iterable @param reducingFn: function of arity 2, (acc, input) -> new acc @param initFn: produces the initial value for the accumulator @returns {Accumulator-Collection}
[ "Implements", "reduce", "for", "iterables" ]
c613b19546d013a851843660c830df30f8d9e800
https://github.com/sdawood/functional-pipelines/blob/c613b19546d013a851843660c830df30f8d9e800/src/functional-pipelines.js#L409-L431
train
Joris-van-der-Wel/node-throwable
lib/Throwable.js
Throwable
function Throwable(wrapped) { if (!(this instanceof Throwable)) { return new Throwable(wrapped); } /* istanbul ignore if */ if (typeof wrapped !== 'object') { throw Error('Throwable should wrap an Error'); } // Wrap the Er...
javascript
function Throwable(wrapped) { if (!(this instanceof Throwable)) { return new Throwable(wrapped); } /* istanbul ignore if */ if (typeof wrapped !== 'object') { throw Error('Throwable should wrap an Error'); } // Wrap the Er...
[ "function", "Throwable", "(", "wrapped", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Throwable", ")", ")", "{", "return", "new", "Throwable", "(", "wrapped", ")", ";", "}", "/* istanbul ignore if */", "if", "(", "typeof", "wrapped", "!==", "'obje...
Inherit from Error without performance penalties, `instanceof` behaves as expected and the error stack is correct. This module can be used cross-browser using Browserify. @module Throwable @author Joris van der Wel <joris@jorisvanderwel.com> Constructs a new Throwable by wrapping around an Error() (a decorator). All ...
[ "Inherit", "from", "Error", "without", "performance", "penalties", "instanceof", "behaves", "as", "expected", "and", "the", "error", "stack", "is", "correct", ".", "This", "module", "can", "be", "used", "cross", "-", "browser", "using", "Browserify", "." ]
5b7dab5fd8807b5ed8b2eb010d5ae65d2b35fe31
https://github.com/Joris-van-der-Wel/node-throwable/blob/5b7dab5fd8807b5ed8b2eb010d5ae65d2b35fe31/lib/Throwable.js#L25-L41
train
akashacms/akashacms-epub
index.js
_bundleEPUB
function _bundleEPUB(config, done) { var epubconfig = config.akashacmsEPUB; var archive = archiver('zip'); var output = fs.createWriteStream(config.akashacmsEPUB.bookmetadata.epub); output.on('close', function() { logger.info(archive.pointer() + ' total bytes'); ...
javascript
function _bundleEPUB(config, done) { var epubconfig = config.akashacmsEPUB; var archive = archiver('zip'); var output = fs.createWriteStream(config.akashacmsEPUB.bookmetadata.epub); output.on('close', function() { logger.info(archive.pointer() + ' total bytes'); ...
[ "function", "_bundleEPUB", "(", "config", ",", "done", ")", "{", "var", "epubconfig", "=", "config", ".", "akashacmsEPUB", ";", "var", "archive", "=", "archiver", "(", "'zip'", ")", ";", "var", "output", "=", "fs", ".", "createWriteStream", "(", "config", ...
Construct the .epub file
[ "Construct", "the", ".", "epub", "file" ]
d292c9e3b8c82cc1378239485ed130022ff31bd3
https://github.com/akashacms/akashacms-epub/blob/d292c9e3b8c82cc1378239485ed130022ff31bd3/index.js#L524-L576
train
akashacms/akashacms-epub
index.js
function(next) { // Stylesheet and JavaScript files are listed in the config config.headerScripts.stylesheets.forEach(function(cssentry) { config.akashacmsEPUB.manifest.push({ id: cssentry.id, type: "text/c...
javascript
function(next) { // Stylesheet and JavaScript files are listed in the config config.headerScripts.stylesheets.forEach(function(cssentry) { config.akashacmsEPUB.manifest.push({ id: cssentry.id, type: "text/c...
[ "function", "(", "next", ")", "{", "// Stylesheet and JavaScript files are listed in the config", "config", ".", "headerScripts", ".", "stylesheets", ".", "forEach", "(", "function", "(", "cssentry", ")", "{", "config", ".", "akashacmsEPUB", ".", "manifest", ".", "p...
fill in manifest entries for asset files
[ "fill", "in", "manifest", "entries", "for", "asset", "files" ]
d292c9e3b8c82cc1378239485ed130022ff31bd3
https://github.com/akashacms/akashacms-epub/blob/d292c9e3b8c82cc1378239485ed130022ff31bd3/index.js#L823-L912
train
unkhz/almost-static-site
main/directives/fixContainerHeight.js
waitAndSet
function waitAndSet() { var i; var times = [0,200,400,700,1000,1500,2000]; var len = times.length; for ( i = 0; i < len; i++ ) { $timeout(setParentHeight,times[i]); } }
javascript
function waitAndSet() { var i; var times = [0,200,400,700,1000,1500,2000]; var len = times.length; for ( i = 0; i < len; i++ ) { $timeout(setParentHeight,times[i]); } }
[ "function", "waitAndSet", "(", ")", "{", "var", "i", ";", "var", "times", "=", "[", "0", ",", "200", ",", "400", ",", "700", ",", "1000", ",", "1500", ",", "2000", "]", ";", "var", "len", "=", "times", ".", "length", ";", "for", "(", "i", "="...
Wait for the content to be appended and set parent height
[ "Wait", "for", "the", "content", "to", "be", "appended", "and", "set", "parent", "height" ]
cd09f02ffec06ee2c7494a76ef9a545dbdb58653
https://github.com/unkhz/almost-static-site/blob/cd09f02ffec06ee2c7494a76ef9a545dbdb58653/main/directives/fixContainerHeight.js#L20-L27
train
aerobatic/grunt-aerobatic
tasks/lib/simulator.js
uploadIndexPages
function uploadIndexPages(pagePaths, config, options, callback) { var requestOptions = { method: 'POST', url: options.airport + '/dev/' + config.appId + '/simulator', form: {} }; // Attach the files as multi-part var request = api(config, requestOptions, callback); var form = requ...
javascript
function uploadIndexPages(pagePaths, config, options, callback) { var requestOptions = { method: 'POST', url: options.airport + '/dev/' + config.appId + '/simulator', form: {} }; // Attach the files as multi-part var request = api(config, requestOptions, callback); var form = requ...
[ "function", "uploadIndexPages", "(", "pagePaths", ",", "config", ",", "options", ",", "callback", ")", "{", "var", "requestOptions", "=", "{", "method", ":", "'POST'", ",", "url", ":", "options", ".", "airport", "+", "'/dev/'", "+", "config", ".", "appId",...
Upload the indexx.html file to the server.
[ "Upload", "the", "indexx", ".", "html", "file", "to", "the", "server", "." ]
a1788d1889186b78b7f7d09e53c811fb664b621c
https://github.com/aerobatic/grunt-aerobatic/blob/a1788d1889186b78b7f7d09e53c811fb664b621c/tasks/lib/simulator.js#L18-L33
train
anandthakker/css-rule-stream
lib/match.js
write
function write(token, enc, next) { var type = token[0], buf = token[1]; if(('rule_start' === type || 'atrule_start' === type)) depth++; if(depth > 0 && !current) current = {location: [line, column], buffers:[]}; if('rule_end' === type || 'atrule_end' === type) depth--; if...
javascript
function write(token, enc, next) { var type = token[0], buf = token[1]; if(('rule_start' === type || 'atrule_start' === type)) depth++; if(depth > 0 && !current) current = {location: [line, column], buffers:[]}; if('rule_end' === type || 'atrule_end' === type) depth--; if...
[ "function", "write", "(", "token", ",", "enc", ",", "next", ")", "{", "var", "type", "=", "token", "[", "0", "]", ",", "buf", "=", "token", "[", "1", "]", ";", "if", "(", "(", "'rule_start'", "===", "type", "||", "'atrule_start'", "===", "type", ...
track this and pass it downstream for source mapping.
[ "track", "this", "and", "pass", "it", "downstream", "for", "source", "mapping", "." ]
3797400bfbe4df660690858254b953607a5fe7f3
https://github.com/anandthakker/css-rule-stream/blob/3797400bfbe4df660690858254b953607a5fe7f3/lib/match.js#L13-L30
train
Augmentedjs/next-core-model
dist/core-next-model.js
createPartial
function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength)...
javascript
function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength)...
[ "function", "createPartial", "(", "func", ",", "bitmask", ",", "thisArg", ",", "partials", ")", "{", "var", "isBind", "=", "bitmask", "&", "BIND_FLAG", ",", "Ctor", "=", "createCtor", "(", "func", ")", ";", "function", "wrapper", "(", ")", "{", "var", ...
Creates a function that wraps `func` to invoke it with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. @private @param {Function} func The function to wrap. @param {number} bitmask The bitmask flags. See `createWrap` for more details. @param {*} thisArg The `this` binding of `fun...
[ "Creates", "a", "function", "that", "wraps", "func", "to", "invoke", "it", "with", "the", "this", "binding", "of", "thisArg", "and", "partials", "prepended", "to", "the", "arguments", "it", "receives", "." ]
9a702a1c64021a79a8988f903df85baa72d389b8
https://github.com/Augmentedjs/next-core-model/blob/9a702a1c64021a79a8988f903df85baa72d389b8/dist/core-next-model.js#L753-L774
train
femto113/node-ec2-instance-data
index.js
deep_set
function deep_set(root, path, value) { var twig = root; path.split('/').forEach(function (branch, index, branches) { if (branch) { if (self.camelize) { branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); }) } if (index < b...
javascript
function deep_set(root, path, value) { var twig = root; path.split('/').forEach(function (branch, index, branches) { if (branch) { if (self.camelize) { branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); }) } if (index < b...
[ "function", "deep_set", "(", "root", ",", "path", ",", "value", ")", "{", "var", "twig", "=", "root", ";", "path", ".", "split", "(", "'/'", ")", ".", "forEach", "(", "function", "(", "branch", ",", "index", ",", "branches", ")", "{", "if", "(", ...
helper to turn a set of paths into nested objects
[ "helper", "to", "turn", "a", "set", "of", "paths", "into", "nested", "objects" ]
0b7f297c2ec13b095706f151a5ab46a4bf17ffb5
https://github.com/femto113/node-ec2-instance-data/blob/0b7f297c2ec13b095706f151a5ab46a4bf17ffb5/index.js#L81-L100
train
femto113/node-ec2-instance-data
index.js
deep_get
function deep_get(root, path) { var twig = root, result = undefined; path.split('/').forEach(function (branch, index, branches) { if (branch) { if (self.camelize) { branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); }) } ...
javascript
function deep_get(root, path) { var twig = root, result = undefined; path.split('/').forEach(function (branch, index, branches) { if (branch) { if (self.camelize) { branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); }) } ...
[ "function", "deep_get", "(", "root", ",", "path", ")", "{", "var", "twig", "=", "root", ",", "result", "=", "undefined", ";", "path", ".", "split", "(", "'/'", ")", ".", "forEach", "(", "function", "(", "branch", ",", "index", ",", "branches", ")", ...
sort of inverse of above, get a nested object value from a path
[ "sort", "of", "inverse", "of", "above", "get", "a", "nested", "object", "value", "from", "a", "path" ]
0b7f297c2ec13b095706f151a5ab46a4bf17ffb5
https://github.com/femto113/node-ec2-instance-data/blob/0b7f297c2ec13b095706f151a5ab46a4bf17ffb5/index.js#L103-L118
train
femto113/node-ec2-instance-data
index.js
parse_date_strings
function parse_date_strings(root) { for (key in root) { if (!root.hasOwnProperty(key)) continue; var value = root[key]; if (typeof(value) === 'object') { parse_date_strings(value); } else if (typeof(value) === 'string' && /\d{4}-?\d{2}-?\d{2}(T?\d{2}:?\d{2}:?\d{2}(Z)?)?/...
javascript
function parse_date_strings(root) { for (key in root) { if (!root.hasOwnProperty(key)) continue; var value = root[key]; if (typeof(value) === 'object') { parse_date_strings(value); } else if (typeof(value) === 'string' && /\d{4}-?\d{2}-?\d{2}(T?\d{2}:?\d{2}:?\d{2}(Z)?)?/...
[ "function", "parse_date_strings", "(", "root", ")", "{", "for", "(", "key", "in", "root", ")", "{", "if", "(", "!", "root", ".", "hasOwnProperty", "(", "key", ")", ")", "continue", ";", "var", "value", "=", "root", "[", "key", "]", ";", "if", "(", ...
helper to recursively parse all date strings into Date objects
[ "helper", "to", "recursively", "parse", "all", "date", "strings", "into", "Date", "objects" ]
0b7f297c2ec13b095706f151a5ab46a4bf17ffb5
https://github.com/femto113/node-ec2-instance-data/blob/0b7f297c2ec13b095706f151a5ab46a4bf17ffb5/index.js#L121-L134
train
MechanicalHuman/hnp-utilities
packages/commitizen-adapter/lib/commitizen-adapter.js
getChoices
function getChoices() { const name = choice => fp.padStart(MAX_DESC)(choice.value) const desc = choice => wrap(choice.description, MAX) return types.map(choice => { if (choice.value === 'separator') return SEPARATOR return { name: `${name(choice)} ${choice.emoji} ${desc(choice)}`, value: cho...
javascript
function getChoices() { const name = choice => fp.padStart(MAX_DESC)(choice.value) const desc = choice => wrap(choice.description, MAX) return types.map(choice => { if (choice.value === 'separator') return SEPARATOR return { name: `${name(choice)} ${choice.emoji} ${desc(choice)}`, value: cho...
[ "function", "getChoices", "(", ")", "{", "const", "name", "=", "choice", "=>", "fp", ".", "padStart", "(", "MAX_DESC", ")", "(", "choice", ".", "value", ")", "const", "desc", "=", "choice", "=>", "wrap", "(", "choice", ".", "description", ",", "MAX", ...
Parses the types to create a pretty choice
[ "Parses", "the", "types", "to", "create", "a", "pretty", "choice" ]
7c2893be5b5ca4d8c6afb1d5838811de9a720424
https://github.com/MechanicalHuman/hnp-utilities/blob/7c2893be5b5ca4d8c6afb1d5838811de9a720424/packages/commitizen-adapter/lib/commitizen-adapter.js#L69-L80
train
anoopchaurasia/jsfm
jsfm.js
createObj
function createObj( str ) { if (!str || str.length == 0) { return window; } var d = str.split("."), j, o = window; for (j = 0; j < d.length; j = j + 1) { o[d[j]] = o[d[j]] || {}; o = o[d[j]]; } return o; }
javascript
function createObj( str ) { if (!str || str.length == 0) { return window; } var d = str.split("."), j, o = window; for (j = 0; j < d.length; j = j + 1) { o[d[j]] = o[d[j]] || {}; o = o[d[j]]; } return o; }
[ "function", "createObj", "(", "str", ")", "{", "if", "(", "!", "str", "||", "str", ".", "length", "==", "0", ")", "{", "return", "window", ";", "}", "var", "d", "=", "str", ".", "split", "(", "\".\"", ")", ",", "j", ",", "o", "=", "window", "...
Map string to corresponding object.
[ "Map", "string", "to", "corresponding", "object", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L25-L35
train
anoopchaurasia/jsfm
jsfm.js
addPrototypeBeforeCall
function addPrototypeBeforeCall( Class, isAbstract ) { var constStatic = {}, currentState = { Static: window.Static, Abstract: window.Abstract, Const: window.Const, Private: window.Private }; saveState.push(currentState); window.Static = Class.prototype.Static = {Const:constStatic};...
javascript
function addPrototypeBeforeCall( Class, isAbstract ) { var constStatic = {}, currentState = { Static: window.Static, Abstract: window.Abstract, Const: window.Const, Private: window.Private }; saveState.push(currentState); window.Static = Class.prototype.Static = {Const:constStatic};...
[ "function", "addPrototypeBeforeCall", "(", "Class", ",", "isAbstract", ")", "{", "var", "constStatic", "=", "{", "}", ",", "currentState", "=", "{", "Static", ":", "window", ".", "Static", ",", "Abstract", ":", "window", ".", "Abstract", ",", "Const", ":",...
Add information before calling the class.
[ "Add", "information", "before", "calling", "the", "class", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L68-L81
train
anoopchaurasia/jsfm
jsfm.js
deleteAddedProtoTypes
function deleteAddedProtoTypes( Class ) { delete Class.prototype.Static; delete Class.prototype.Const; delete Class.prototype.Private; delete Class.prototype.Abstract; var currentState = saveState.pop(); window.Private = currentState.Private; window.Const = currentState.Const; window...
javascript
function deleteAddedProtoTypes( Class ) { delete Class.prototype.Static; delete Class.prototype.Const; delete Class.prototype.Private; delete Class.prototype.Abstract; var currentState = saveState.pop(); window.Private = currentState.Private; window.Const = currentState.Const; window...
[ "function", "deleteAddedProtoTypes", "(", "Class", ")", "{", "delete", "Class", ".", "prototype", ".", "Static", ";", "delete", "Class", ".", "prototype", ".", "Const", ";", "delete", "Class", ".", "prototype", ".", "Private", ";", "delete", "Class", ".", ...
Delete all added information after call.
[ "Delete", "all", "added", "information", "after", "call", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L84-L96
train
anoopchaurasia/jsfm
jsfm.js
simpleExtend
function simpleExtend( from, to ) { for ( var k in from) { if (to[k] == undefined) { to[k] = from[k]; } } return to; }
javascript
function simpleExtend( from, to ) { for ( var k in from) { if (to[k] == undefined) { to[k] = from[k]; } } return to; }
[ "function", "simpleExtend", "(", "from", ",", "to", ")", "{", "for", "(", "var", "k", "in", "from", ")", "{", "if", "(", "to", "[", "k", "]", "==", "undefined", ")", "{", "to", "[", "k", "]", "=", "from", "[", "k", "]", ";", "}", "}", "retu...
Extend to one level.
[ "Extend", "to", "one", "level", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L99-L106
train
anoopchaurasia/jsfm
jsfm.js
addAddedFileInnScript
function addAddedFileInnScript(key, path, dot_path){ dot_path = dot_path || path; // checking if same file imported twice for same Class. if(!dot_path) return; var script = scriptArr[scriptArr.length - 1]; if( !script ){ return; } var arr = script[key] || (script[key] = []); if( arr.indexOf...
javascript
function addAddedFileInnScript(key, path, dot_path){ dot_path = dot_path || path; // checking if same file imported twice for same Class. if(!dot_path) return; var script = scriptArr[scriptArr.length - 1]; if( !script ){ return; } var arr = script[key] || (script[key] = []); if( arr.indexOf...
[ "function", "addAddedFileInnScript", "(", "key", ",", "path", ",", "dot_path", ")", "{", "dot_path", "=", "dot_path", "||", "path", ";", "// checking if same file imported twice for same Class.", "if", "(", "!", "dot_path", ")", "return", ";", "var", "script", "="...
Add imports for current loaded javascript file. Add imported javascript file for current class into scriptArr.
[ "Add", "imports", "for", "current", "loaded", "javascript", "file", ".", "Add", "imported", "javascript", "file", "for", "current", "class", "into", "scriptArr", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L244-L257
train
anoopchaurasia/jsfm
jsfm.js
include
function include( path, isFromInclude, dot_path ) { if(!path){ return; } all_paths.push(path) if(isNode){ require(path); listenFileChange(path); if(isFromInclude){ fileLoadeManager.iamready(dot_path); } return; } if (fm.isConcatinated) { fileLoadeManager.iamready(dot_p...
javascript
function include( path, isFromInclude, dot_path ) { if(!path){ return; } all_paths.push(path) if(isNode){ require(path); listenFileChange(path); if(isFromInclude){ fileLoadeManager.iamready(dot_path); } return; } if (fm.isConcatinated) { fileLoadeManager.iamready(dot_p...
[ "function", "include", "(", "path", ",", "isFromInclude", ",", "dot_path", ")", "{", "if", "(", "!", "path", ")", "{", "return", ";", "}", "all_paths", ".", "push", "(", "path", ")", "if", "(", "isNode", ")", "{", "require", "(", "path", ")", ";", ...
Create script tag inside head.
[ "Create", "script", "tag", "inside", "head", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L276-L317
train
anoopchaurasia/jsfm
jsfm.js
getReleventClassInfo
function getReleventClassInfo( Class, fn, pofn ) { /// this is script addPrototypeBeforeCall(Class, this.isAbstract); var tempObj, k, len; tempObj = invoke(Class, this.args, pofn.base, this.ics, this.Package, pofn); tempObj.setMe && tempObj.setMe(pofn); tempObj.base = pofn.base; delete tempObj.setM...
javascript
function getReleventClassInfo( Class, fn, pofn ) { /// this is script addPrototypeBeforeCall(Class, this.isAbstract); var tempObj, k, len; tempObj = invoke(Class, this.args, pofn.base, this.ics, this.Package, pofn); tempObj.setMe && tempObj.setMe(pofn); tempObj.base = pofn.base; delete tempObj.setM...
[ "function", "getReleventClassInfo", "(", "Class", ",", "fn", ",", "pofn", ")", "{", "/// this is script", "addPrototypeBeforeCall", "(", "Class", ",", "this", ".", "isAbstract", ")", ";", "var", "tempObj", ",", "k", ",", "len", ";", "tempObj", "=", "invoke",...
Set relevent class information.
[ "Set", "relevent", "class", "information", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L927-L978
train
anoopchaurasia/jsfm
jsfm.js
checkAvailability
function checkAvailability( obj ) { for ( var k = 1, len = arguments.length; k < len; k++) { for ( var m in arguments[k]) { if (obj.hasOwnProperty(m)) { throw obj.getClass() + ": has " + m + " at more than one places"; } } } }
javascript
function checkAvailability( obj ) { for ( var k = 1, len = arguments.length; k < len; k++) { for ( var m in arguments[k]) { if (obj.hasOwnProperty(m)) { throw obj.getClass() + ": has " + m + " at more than one places"; } } } }
[ "function", "checkAvailability", "(", "obj", ")", "{", "for", "(", "var", "k", "=", "1", ",", "len", "=", "arguments", ".", "length", ";", "k", "<", "len", ";", "k", "++", ")", "{", "for", "(", "var", "m", "in", "arguments", "[", "k", "]", ")",...
Check if same property already available in object for static and Const;
[ "Check", "if", "same", "property", "already", "available", "in", "object", "for", "static", "and", "Const", ";" ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L981-L989
train
anoopchaurasia/jsfm
jsfm.js
addTransient
function addTransient( internalObj, tempObj ) { var temp = {}, k, tr = tempObj["transient"] || []; tr.push("shortHand"); for (k = 0; k < tr.length; k++) { (temp[tr[k]] = true); } eachPropertyOf(internalObj.Static, function( v, key ) { temp[key] = true; }); eachPropertyOf(internalObj.staticC...
javascript
function addTransient( internalObj, tempObj ) { var temp = {}, k, tr = tempObj["transient"] || []; tr.push("shortHand"); for (k = 0; k < tr.length; k++) { (temp[tr[k]] = true); } eachPropertyOf(internalObj.Static, function( v, key ) { temp[key] = true; }); eachPropertyOf(internalObj.staticC...
[ "function", "addTransient", "(", "internalObj", ",", "tempObj", ")", "{", "var", "temp", "=", "{", "}", ",", "k", ",", "tr", "=", "tempObj", "[", "\"transient\"", "]", "||", "[", "]", ";", "tr", ".", "push", "(", "\"shortHand\"", ")", ";", "for", "...
add all transient fields to list.
[ "add", "all", "transient", "fields", "to", "list", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L992-L1006
train
anoopchaurasia/jsfm
jsfm.js
separeteMethodsAndFields
function separeteMethodsAndFields( obj ) { var methods = [], fields = {}; eachPropertyOf(obj, function( v, k ) { if (typeof v == 'function') { methods.push(k + ""); } else { fields[k + ""] = v; } }); obj = undefined; return { methods : methods, fields : fields }...
javascript
function separeteMethodsAndFields( obj ) { var methods = [], fields = {}; eachPropertyOf(obj, function( v, k ) { if (typeof v == 'function') { methods.push(k + ""); } else { fields[k + ""] = v; } }); obj = undefined; return { methods : methods, fields : fields }...
[ "function", "separeteMethodsAndFields", "(", "obj", ")", "{", "var", "methods", "=", "[", "]", ",", "fields", "=", "{", "}", ";", "eachPropertyOf", "(", "obj", ",", "function", "(", "v", ",", "k", ")", "{", "if", "(", "typeof", "v", "==", "'function'...
Separate all methods and fields of object;
[ "Separate", "all", "methods", "and", "fields", "of", "object", ";" ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L1051-L1066
train
anoopchaurasia/jsfm
jsfm.js
getAllImportClass
function getAllImportClass( imp ) { var newImports = {}, splited; for ( var k = 0; imp && k < imp.length; k++) { splited = imp[k].split("."); newImports[splited[splited.length - 1]] = fm.stringToObject(imp[k]); } return newImports; }
javascript
function getAllImportClass( imp ) { var newImports = {}, splited; for ( var k = 0; imp && k < imp.length; k++) { splited = imp[k].split("."); newImports[splited[splited.length - 1]] = fm.stringToObject(imp[k]); } return newImports; }
[ "function", "getAllImportClass", "(", "imp", ")", "{", "var", "newImports", "=", "{", "}", ",", "splited", ";", "for", "(", "var", "k", "=", "0", ";", "imp", "&&", "k", "<", "imp", ".", "length", ";", "k", "++", ")", "{", "splited", "=", "imp", ...
return all imported classes string into object
[ "return", "all", "imported", "classes", "string", "into", "object" ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L1080-L1087
train
anoopchaurasia/jsfm
jsfm.js
addExtras
function addExtras( currentObj, baseObj, fn ) { // Return function name. var clss = currentObj.getClass(); for ( var k in currentObj) { if (currentObj.hasOwnProperty(k) && typeof currentObj[k] == 'function' && k != fn) { currentObj[k] = currentObj[k].bind(currentObj); currentObj[k].$name = k; ...
javascript
function addExtras( currentObj, baseObj, fn ) { // Return function name. var clss = currentObj.getClass(); for ( var k in currentObj) { if (currentObj.hasOwnProperty(k) && typeof currentObj[k] == 'function' && k != fn) { currentObj[k] = currentObj[k].bind(currentObj); currentObj[k].$name = k; ...
[ "function", "addExtras", "(", "currentObj", ",", "baseObj", ",", "fn", ")", "{", "// Return function name.", "var", "clss", "=", "currentObj", ".", "getClass", "(", ")", ";", "for", "(", "var", "k", "in", "currentObj", ")", "{", "if", "(", "currentObj", ...
Add extra information into newly created object.
[ "Add", "extra", "information", "into", "newly", "created", "object", "." ]
20ca3bd7417008c331285237e64b106c30887e36
https://github.com/anoopchaurasia/jsfm/blob/20ca3bd7417008c331285237e64b106c30887e36/jsfm.js#L1241-L1297
train
linyngfly/omelo
lib/connectors/commands/heartbeat.js
function(opts) { opts = opts || {}; this.heartbeat = null; this.timeout = null; this.disconnectOnTimeout = opts.disconnectOnTimeout; if(opts.heartbeat) { this.heartbeat = opts.heartbeat * 1000; // heartbeat interval this.timeout = opts.timeout * 1000 || this.heartbeat * 2; // max heartbeat messa...
javascript
function(opts) { opts = opts || {}; this.heartbeat = null; this.timeout = null; this.disconnectOnTimeout = opts.disconnectOnTimeout; if(opts.heartbeat) { this.heartbeat = opts.heartbeat * 1000; // heartbeat interval this.timeout = opts.timeout * 1000 || this.heartbeat * 2; // max heartbeat messa...
[ "function", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "heartbeat", "=", "null", ";", "this", ".", "timeout", "=", "null", ";", "this", ".", "disconnectOnTimeout", "=", "opts", ".", "disconnectOnTimeout", ";", "if", ...
Process heartbeat request. @param {Object} opts option request opts.heartbeat heartbeat interval
[ "Process", "heartbeat", "request", "." ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/connectors/commands/heartbeat.js#L10-L24
train
meyfa/fs-adapters
lib/memory.js
MemoryAdapter
function MemoryAdapter(initialFiles) { if (!(this instanceof MemoryAdapter)) { return new MemoryAdapter(initialFiles); } this.entries = new Map(); // load initial file buffers if (typeof initialFiles === "object" && initialFiles) { Object.keys(initialFiles).forEach((fileName) => { ...
javascript
function MemoryAdapter(initialFiles) { if (!(this instanceof MemoryAdapter)) { return new MemoryAdapter(initialFiles); } this.entries = new Map(); // load initial file buffers if (typeof initialFiles === "object" && initialFiles) { Object.keys(initialFiles).forEach((fileName) => { ...
[ "function", "MemoryAdapter", "(", "initialFiles", ")", "{", "if", "(", "!", "(", "this", "instanceof", "MemoryAdapter", ")", ")", "{", "return", "new", "MemoryAdapter", "(", "initialFiles", ")", ";", "}", "this", ".", "entries", "=", "new", "Map", "(", "...
Construct a new MemoryAdapter. @param {Object.<string, Buffer>} initialFiles The files already in this virtual directory. @constructor
[ "Construct", "a", "new", "MemoryAdapter", "." ]
20708bcc4512da1931cfb97a14a840d369ba1311
https://github.com/meyfa/fs-adapters/blob/20708bcc4512da1931cfb97a14a840d369ba1311/lib/memory.js#L18-L32
train
erizocosmico/node-cordova
index.js
function (cmd, cwd, callback) { var async = typeof callback === 'function'; var result = exec( cmd, {cwd: cwd}, async ? callback : undefined ); return result.code !== 0 && !async ? result.stdout : undefined; }
javascript
function (cmd, cwd, callback) { var async = typeof callback === 'function'; var result = exec( cmd, {cwd: cwd}, async ? callback : undefined ); return result.code !== 0 && !async ? result.stdout : undefined; }
[ "function", "(", "cmd", ",", "cwd", ",", "callback", ")", "{", "var", "async", "=", "typeof", "callback", "===", "'function'", ";", "var", "result", "=", "exec", "(", "cmd", ",", "{", "cwd", ":", "cwd", "}", ",", "async", "?", "callback", ":", "und...
Executes a terminal command @param {String} cmd Command to execute @param {String} cwd Current working directory @param {Function} callback Callback only if the command is async @return {String|undefined}
[ "Executes", "a", "terminal", "command" ]
e5244dc6a2093b0b2593b6741e72aba40eef0254
https://github.com/erizocosmico/node-cordova/blob/e5244dc6a2093b0b2593b6741e72aba40eef0254/index.js#L22-L32
train
erizocosmico/node-cordova
index.js
function () { return [CORDOVA_PATH] .concat(Array.prototype.map.call(arguments || [], function (arg) { return '\'' + arg.replace("'", "\\'") + '\''; })).join(' '); }
javascript
function () { return [CORDOVA_PATH] .concat(Array.prototype.map.call(arguments || [], function (arg) { return '\'' + arg.replace("'", "\\'") + '\''; })).join(' '); }
[ "function", "(", ")", "{", "return", "[", "CORDOVA_PATH", "]", ".", "concat", "(", "Array", ".", "prototype", ".", "map", ".", "call", "(", "arguments", "||", "[", "]", ",", "function", "(", "arg", ")", "{", "return", "'\\''", "+", "arg", ".", "rep...
Builds a command escaping all command parts @return {String} Final command
[ "Builds", "a", "command", "escaping", "all", "command", "parts" ]
e5244dc6a2093b0b2593b6741e72aba40eef0254
https://github.com/erizocosmico/node-cordova/blob/e5244dc6a2093b0b2593b6741e72aba40eef0254/index.js#L38-L43
train
teabyii/qa
lib/prompts/list.js
moveRender
function moveRender (type) { var method = type ? 'down' : 'up' ui .left(lastLen + 2) .up(count - cur) .write(' ') // Each time move to right-bottom. ui[method]() .left(2) .write(chalk.blue(pointer)) .left(2) .down(count - (type ? ++cur : --cur)) ...
javascript
function moveRender (type) { var method = type ? 'down' : 'up' ui .left(lastLen + 2) .up(count - cur) .write(' ') // Each time move to right-bottom. ui[method]() .left(2) .write(chalk.blue(pointer)) .left(2) .down(count - (type ? ++cur : --cur)) ...
[ "function", "moveRender", "(", "type", ")", "{", "var", "method", "=", "type", "?", "'down'", ":", "'up'", "ui", ".", "left", "(", "lastLen", "+", "2", ")", ".", "up", "(", "count", "-", "cur", ")", ".", "write", "(", "' '", ")", "// Each time mov...
Move cursor and render pointer, type 0 for up, 1 for down.
[ "Move", "cursor", "and", "render", "pointer", "type", "0", "for", "up", "1", "for", "down", "." ]
9224180dcb9e6b57c021f83b259316e84ebc573e
https://github.com/teabyii/qa/blob/9224180dcb9e6b57c021f83b259316e84ebc573e/lib/prompts/list.js#L62-L77
train
aledbf/deis-api
lib/auth.js
cancel
function cancel(callback) { if (!deis._authenticated) { return callback(new Error('You need to login first')); } commons.del(format('/%s/auth/cancel/', deis.version), function() { deis.api.logout(callback); }); }
javascript
function cancel(callback) { if (!deis._authenticated) { return callback(new Error('You need to login first')); } commons.del(format('/%s/auth/cancel/', deis.version), function() { deis.api.logout(callback); }); }
[ "function", "cancel", "(", "callback", ")", "{", "if", "(", "!", "deis", ".", "_authenticated", ")", "{", "return", "callback", "(", "new", "Error", "(", "'You need to login first'", ")", ")", ";", "}", "commons", ".", "del", "(", "format", "(", "'/%s/au...
remove the account currently logged
[ "remove", "the", "account", "currently", "logged" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/auth.js#L11-L19
train
AndreasMadsen/steer
steer.js
createProfile
function createProfile(done) { if (self.closed) return done(null); temp.mkdir('browser-controller', function(err, dirpath) { if (err) return done(err); self.userDir = dirpath; done(null); }); }
javascript
function createProfile(done) { if (self.closed) return done(null); temp.mkdir('browser-controller', function(err, dirpath) { if (err) return done(err); self.userDir = dirpath; done(null); }); }
[ "function", "createProfile", "(", "done", ")", "{", "if", "(", "self", ".", "closed", ")", "return", "done", "(", "null", ")", ";", "temp", ".", "mkdir", "(", "'browser-controller'", ",", "function", "(", "err", ",", "dirpath", ")", "{", "if", "(", "...
create a chrome profile directory
[ "create", "a", "chrome", "profile", "directory" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/steer.js#L66-L76
train
AndreasMadsen/steer
steer.js
closeChromium
function closeChromium(done) { var child = self.process; // remove error handlers if (child) { child.removeListener('error', handlers.relayError); child.removeListener('exit', handlers.prematureExit); child.stderr.removeListener('error...
javascript
function closeChromium(done) { var child = self.process; // remove error handlers if (child) { child.removeListener('error', handlers.relayError); child.removeListener('exit', handlers.prematureExit); child.stderr.removeListener('error...
[ "function", "closeChromium", "(", "done", ")", "{", "var", "child", "=", "self", ".", "process", ";", "// remove error handlers", "if", "(", "child", ")", "{", "child", ".", "removeListener", "(", "'error'", ",", "handlers", ".", "relayError", ")", ";", "c...
if browser is alive, kill it
[ "if", "browser", "is", "alive", "kill", "it" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/steer.js#L282-L304
train
AndreasMadsen/steer
steer.js
removePofile
function removePofile(done) { if (!self.userDir) return done(null); rimraf(self.userDir, done); }
javascript
function removePofile(done) { if (!self.userDir) return done(null); rimraf(self.userDir, done); }
[ "function", "removePofile", "(", "done", ")", "{", "if", "(", "!", "self", ".", "userDir", ")", "return", "done", "(", "null", ")", ";", "rimraf", "(", "self", ".", "userDir", ",", "done", ")", ";", "}" ]
cleanup profile directory
[ "cleanup", "profile", "directory" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/steer.js#L329-L333
train
glennschler/spotspec
lib/service.js
SvcAws
function SvcAws (requestedSvc, options) { if (this.constructor.name === 'Object') { throw new Error('Must be instantiated using new') } else if (this.constructor.name === 'SvcAws') { throw new Error('Abstract class ' + this.constructor.name + ' should not be instantiated') } EventEmitter.call(this...
javascript
function SvcAws (requestedSvc, options) { if (this.constructor.name === 'Object') { throw new Error('Must be instantiated using new') } else if (this.constructor.name === 'SvcAws') { throw new Error('Abstract class ' + this.constructor.name + ' should not be instantiated') } EventEmitter.call(this...
[ "function", "SvcAws", "(", "requestedSvc", ",", "options", ")", "{", "if", "(", "this", ".", "constructor", ".", "name", "===", "'Object'", ")", "{", "throw", "new", "Error", "(", "'Must be instantiated using new'", ")", "}", "else", "if", "(", "this", "."...
Constructs a new SvcAws object for managing aws credentials @constructor @abstract @arg {class} requestedSvc - The AWS.Service class to instantiate [aws docs]{@link http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Service.html} @arg {object} options - The AWS service IAM credentials @arg {object} options.keys - C...
[ "Constructs", "a", "new", "SvcAws", "object", "for", "managing", "aws", "credentials" ]
ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727
https://github.com/glennschler/spotspec/blob/ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727/lib/service.js#L75-L114
train
mitchallen/maze-generator-core
modules/index.js
function(x,y,depth,maxDepth) { if( depth >= maxDepth ) { console.warn("MAXIMUM DEPTH REACHED: %d", maxDepth); return; } if(!this.isCell(x,y)) { return; } let dirs = this.getShuffledNeighborDirs( x, y ); for( var key in dirs )...
javascript
function(x,y,depth,maxDepth) { if( depth >= maxDepth ) { console.warn("MAXIMUM DEPTH REACHED: %d", maxDepth); return; } if(!this.isCell(x,y)) { return; } let dirs = this.getShuffledNeighborDirs( x, y ); for( var key in dirs )...
[ "function", "(", "x", ",", "y", ",", "depth", ",", "maxDepth", ")", "{", "if", "(", "depth", ">=", "maxDepth", ")", "{", "console", ".", "warn", "(", "\"MAXIMUM DEPTH REACHED: %d\"", ",", "maxDepth", ")", ";", "return", ";", "}", "if", "(", "!", "thi...
leave undocumented for now
[ "leave", "undocumented", "for", "now" ]
dddf3f2645dd8719b5361bbbba99dcf44b54fd14
https://github.com/mitchallen/maze-generator-core/blob/dddf3f2645dd8719b5361bbbba99dcf44b54fd14/modules/index.js#L55-L83
train
mitchallen/maze-generator-core
modules/index.js
function(spec) { spec = spec || {}; let aMask = spec.mask || [], start = spec.start || {}, x = start.c || 0, y = start.r || 0; this.fill(0); for( var mKey in aMask ) { var mask = aMask[mKey]; ...
javascript
function(spec) { spec = spec || {}; let aMask = spec.mask || [], start = spec.start || {}, x = start.c || 0, y = start.r || 0; this.fill(0); for( var mKey in aMask ) { var mask = aMask[mKey]; ...
[ "function", "(", "spec", ")", "{", "spec", "=", "spec", "||", "{", "}", ";", "let", "aMask", "=", "spec", ".", "mask", "||", "[", "]", ",", "start", "=", "spec", ".", "start", "||", "{", "}", ",", "x", "=", "start", ".", "c", "||", "0", ","...
Generators a maze @param {Object} options Named parameters for generating a maze @param {Array} options.mask An array of cells to mask off from maze generation @param {Array} options.open An array of objects designation what borders to open after generation @param {Object} opions.start An object containing the x and y ...
[ "Generators", "a", "maze" ]
dddf3f2645dd8719b5361bbbba99dcf44b54fd14
https://github.com/mitchallen/maze-generator-core/blob/dddf3f2645dd8719b5361bbbba99dcf44b54fd14/modules/index.js#L139-L163
train
lewisdawson/slinker
index.js
invokeOnComplete
function invokeOnComplete(slinkerOptions) { if (typeof slinkerOptions.onComplete === 'function' && slinkerOptions.modules.length === symlinksCreated.length) { slinkerOptions.onComplete(); } }
javascript
function invokeOnComplete(slinkerOptions) { if (typeof slinkerOptions.onComplete === 'function' && slinkerOptions.modules.length === symlinksCreated.length) { slinkerOptions.onComplete(); } }
[ "function", "invokeOnComplete", "(", "slinkerOptions", ")", "{", "if", "(", "typeof", "slinkerOptions", ".", "onComplete", "===", "'function'", "&&", "slinkerOptions", ".", "modules", ".", "length", "===", "symlinksCreated", ".", "length", ")", "{", "slinkerOption...
Invoked when slinker has finished creating all symlinks. If an onComplete callback has been specified, it is invoked. @param {Object} slinkerOptions The options passed to slinker
[ "Invoked", "when", "slinker", "has", "finished", "creating", "all", "symlinks", ".", "If", "an", "onComplete", "callback", "has", "been", "specified", "it", "is", "invoked", "." ]
5b2662fc8bd04e6ea910ea7c5b64ccc84341dbbc
https://github.com/lewisdawson/slinker/blob/5b2662fc8bd04e6ea910ea7c5b64ccc84341dbbc/index.js#L69-L73
train
lewisdawson/slinker
index.js
checkPreconditions
function checkPreconditions(options) { if (!options) { throw Error("'options' must be specified!"); } if (!(options.modules instanceof Array)) { throw Error("'options.modules' must be an array!"); } // If the modules array is empty, immediately call the onComplete() if it exists ...
javascript
function checkPreconditions(options) { if (!options) { throw Error("'options' must be specified!"); } if (!(options.modules instanceof Array)) { throw Error("'options.modules' must be an array!"); } // If the modules array is empty, immediately call the onComplete() if it exists ...
[ "function", "checkPreconditions", "(", "options", ")", "{", "if", "(", "!", "options", ")", "{", "throw", "Error", "(", "\"'options' must be specified!\"", ")", ";", "}", "if", "(", "!", "(", "options", ".", "modules", "instanceof", "Array", ")", ")", "{",...
Checks the preconditions when slinker is invoked. Returns true if all preconditions have been met and slinker should be invoked. options {Object} options The options passed to slinker
[ "Checks", "the", "preconditions", "when", "slinker", "is", "invoked", ".", "Returns", "true", "if", "all", "preconditions", "have", "been", "met", "and", "slinker", "should", "be", "invoked", "." ]
5b2662fc8bd04e6ea910ea7c5b64ccc84341dbbc
https://github.com/lewisdawson/slinker/blob/5b2662fc8bd04e6ea910ea7c5b64ccc84341dbbc/index.js#L97-L116
train
tjbutz/class.js
class.js
function() { if (!(this instanceof clazz)) { throw new Error("Use new keyword to create a new instance or call/apply class with right scope"); } Class.onBeforeInstantiation && Class.onBeforeInstantiation(this); // remember the current super property var temp = ...
javascript
function() { if (!(this instanceof clazz)) { throw new Error("Use new keyword to create a new instance or call/apply class with right scope"); } Class.onBeforeInstantiation && Class.onBeforeInstantiation(this); // remember the current super property var temp = ...
[ "function", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "clazz", ")", ")", "{", "throw", "new", "Error", "(", "\"Use new keyword to create a new instance or call/apply class with right scope\"", ")", ";", "}", "Class", ".", "onBeforeInstantiation", "&&...
use clazz instead of class as it is a reserved keyword
[ "use", "clazz", "instead", "of", "class", "as", "it", "is", "a", "reserved", "keyword" ]
92914c9b164ede1198b42cc0f210f7c85cd88d69
https://github.com/tjbutz/class.js/blob/92914c9b164ede1198b42cc0f210f7c85cd88d69/class.js#L64-L84
train
ForbesLindesay/code-mirror
mode/clojure.js
eatCharacter
function eatCharacter(stream) { var first = stream.next(); // Read special literals: backspace, newline, space, return. // Just read all lowercase letters. if (first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) { return; } // Read unicode character: \u1000 ...
javascript
function eatCharacter(stream) { var first = stream.next(); // Read special literals: backspace, newline, space, return. // Just read all lowercase letters. if (first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) { return; } // Read unicode character: \u1000 ...
[ "function", "eatCharacter", "(", "stream", ")", "{", "var", "first", "=", "stream", ".", "next", "(", ")", ";", "// Read special literals: backspace, newline, space, return.", "// Just read all lowercase letters.", "if", "(", "first", ".", "match", "(", "/", "[a-z]", ...
Eat character that starts after backslash \
[ "Eat", "character", "that", "starts", "after", "backslash", "\\" ]
d790ea213aa354756adc7d4d9fcfffcfdc2f1278
https://github.com/ForbesLindesay/code-mirror/blob/d790ea213aa354756adc7d4d9fcfffcfdc2f1278/mode/clojure.js#L100-L111
train
MonetDBSolutions/npm-monetdb-import
index.js
__typeCheck
function __typeCheck(type, valueToCheck, optional) { var correct = typeof(valueToCheck) == type; if(optional) { // Exception if the variable is optional, than it also may be undefined or null correct = correct || valueToCheck === undefined || valueToCheck === null; } if(!correct) { ...
javascript
function __typeCheck(type, valueToCheck, optional) { var correct = typeof(valueToCheck) == type; if(optional) { // Exception if the variable is optional, than it also may be undefined or null correct = correct || valueToCheck === undefined || valueToCheck === null; } if(!correct) { ...
[ "function", "__typeCheck", "(", "type", ",", "valueToCheck", ",", "optional", ")", "{", "var", "correct", "=", "typeof", "(", "valueToCheck", ")", "==", "type", ";", "if", "(", "optional", ")", "{", "// Exception if the variable is optional, than it also may be unde...
Private functions that are not tied to the Importer object and thus do not use the this keyword
[ "Private", "functions", "that", "are", "not", "tied", "to", "the", "Importer", "object", "and", "thus", "do", "not", "use", "the", "this", "keyword" ]
396acf530d2c822b92a5a918e9e0fb22bd9b2b93
https://github.com/MonetDBSolutions/npm-monetdb-import/blob/396acf530d2c822b92a5a918e9e0fb22bd9b2b93/index.js#L11-L21
train
NumminorihSF/bramqp-wrapper
domain/queue.js
Queue
function Queue(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
javascript
function Queue(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
[ "function", "Queue", "(", "client", ",", "channel", ")", "{", "EE", ".", "call", "(", "this", ")", ";", "this", ".", "client", "=", "client", ";", "this", ".", "channel", "=", "channel", ";", "this", ".", "id", "=", "channel", ".", "$getId", "(", ...
Work with queues. Queues store and forward messages. Queues can be configured in the server or created at runtime. Queues must be attached to at least one exchange in order to receive messages from publishers. @param {BRAMQPClient} client Client object that returns from bramqp#openAMQPCommunication() method. @param {C...
[ "Work", "with", "queues", "." ]
3e2bd769a2828f7592eba79556c9ef1491177781
https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/queue.js#L29-L36
train
joemccann/photopipe
public/js/pipe.js
checkForAuths
function checkForAuths(){ $twitter.isAuthenticated = $body.attr('data-twitter-auth') === 'true' ? true : false $facebook.isAuthenticated = $body.attr('data-facebook-auth') === 'true' ? true : false $dropbox.isAuthenticated = $body.attr('data-dropbox-auth') === 'true' ? true : false }
javascript
function checkForAuths(){ $twitter.isAuthenticated = $body.attr('data-twitter-auth') === 'true' ? true : false $facebook.isAuthenticated = $body.attr('data-facebook-auth') === 'true' ? true : false $dropbox.isAuthenticated = $body.attr('data-dropbox-auth') === 'true' ? true : false }
[ "function", "checkForAuths", "(", ")", "{", "$twitter", ".", "isAuthenticated", "=", "$body", ".", "attr", "(", "'data-twitter-auth'", ")", "===", "'true'", "?", "true", ":", "false", "$facebook", ".", "isAuthenticated", "=", "$body", ".", "attr", "(", "'dat...
Set some flags for later to see if we are auth'd for said service or not.
[ "Set", "some", "flags", "for", "later", "to", "see", "if", "we", "are", "auth", "d", "for", "said", "service", "or", "not", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L51-L57
train
joemccann/photopipe
public/js/pipe.js
wireDestinationClickHandlers
function wireDestinationClickHandlers(){ $twitter.isAuthenticated && $twitterDestination.bind('click', twitterDestinationClickHandler) $facebook.isAuthenticated && $facebookDestination.bind('click', facebookDestinationClickHandler) $dropbox.isAuthenticated && $dropboxDestination.bind('click', dropboxDestin...
javascript
function wireDestinationClickHandlers(){ $twitter.isAuthenticated && $twitterDestination.bind('click', twitterDestinationClickHandler) $facebook.isAuthenticated && $facebookDestination.bind('click', facebookDestinationClickHandler) $dropbox.isAuthenticated && $dropboxDestination.bind('click', dropboxDestin...
[ "function", "wireDestinationClickHandlers", "(", ")", "{", "$twitter", ".", "isAuthenticated", "&&", "$twitterDestination", ".", "bind", "(", "'click'", ",", "twitterDestinationClickHandler", ")", "$facebook", ".", "isAuthenticated", "&&", "$facebookDestination", ".", "...
Attach click handlers to respective elements.
[ "Attach", "click", "handlers", "to", "respective", "elements", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L77-L83
train
joemccann/photopipe
public/js/pipe.js
fetchImagesForFbGallery
function fetchImagesForFbGallery(id){ $ .get('/facebook/get_photos_from_album_id?id='+id) .success(function(d, resp, x){ console.dir(d) var thumbs = "" if(d.message) thumbs += "<p>"+d.message+"</p>" else{ d.data.forEach(function(el,i){ // console.dir(el) ...
javascript
function fetchImagesForFbGallery(id){ $ .get('/facebook/get_photos_from_album_id?id='+id) .success(function(d, resp, x){ console.dir(d) var thumbs = "" if(d.message) thumbs += "<p>"+d.message+"</p>" else{ d.data.forEach(function(el,i){ // console.dir(el) ...
[ "function", "fetchImagesForFbGallery", "(", "id", ")", "{", "$", ".", "get", "(", "'/facebook/get_photos_from_album_id?id='", "+", "id", ")", ".", "success", "(", "function", "(", "d", ",", "resp", ",", "x", ")", "{", "console", ".", "dir", "(", "d", ")"...
Initial fetch of fb galleries
[ "Initial", "fetch", "of", "fb", "galleries" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L246-L289
train
joemccann/photopipe
public/js/pipe.js
twitterOneUpClickHandler
function twitterOneUpClickHandler(e){ closeOneUp() var standardResUrl = $(e.target).attr('data-standard-resolution') // e.target.dataset.standardResolution var img = new Image() $spin.show() img.src = standardResUrl img.onload = function(){ $spin.hide() $one...
javascript
function twitterOneUpClickHandler(e){ closeOneUp() var standardResUrl = $(e.target).attr('data-standard-resolution') // e.target.dataset.standardResolution var img = new Image() $spin.show() img.src = standardResUrl img.onload = function(){ $spin.hide() $one...
[ "function", "twitterOneUpClickHandler", "(", "e", ")", "{", "closeOneUp", "(", ")", "var", "standardResUrl", "=", "$", "(", "e", ".", "target", ")", ".", "attr", "(", "'data-standard-resolution'", ")", "// e.target.dataset.standardResolution", "var", "img", "=", ...
Fetch twitter image and show in one up
[ "Fetch", "twitter", "image", "and", "show", "in", "one", "up" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L374-L405
train
joemccann/photopipe
public/js/pipe.js
wireOneUpHandlers
function wireOneUpHandlers(){ // Bind ESC key $document.bind('keyup', function(e){ if (e.keyCode === 27) { return closeOneUp() } }) // end keyup // The "x" button on the one up, close it. $closeOneUp.bind('click', closeOneUp ) // The overlay $overlay.bind('click', c...
javascript
function wireOneUpHandlers(){ // Bind ESC key $document.bind('keyup', function(e){ if (e.keyCode === 27) { return closeOneUp() } }) // end keyup // The "x" button on the one up, close it. $closeOneUp.bind('click', closeOneUp ) // The overlay $overlay.bind('click', c...
[ "function", "wireOneUpHandlers", "(", ")", "{", "// Bind ESC key", "$document", ".", "bind", "(", "'keyup'", ",", "function", "(", "e", ")", "{", "if", "(", "e", ".", "keyCode", "===", "27", ")", "{", "return", "closeOneUp", "(", ")", "}", "}", ")", ...
Bind events to the document & close button to close the one up view
[ "Bind", "events", "to", "the", "document", "&", "close", "button", "to", "close", "the", "one", "up", "view" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L459-L473
train
joemccann/photopipe
public/js/pipe.js
wireUsePhotoHandlers
function wireUsePhotoHandlers(){ $usePhoto.bind('click submit', function(e){ if(e.target.id === 'facebook-use-photo'){ // We don't want to show the facebook option, because // it is the source of the image. $facebookDestination.hide() _photoToUse = localS...
javascript
function wireUsePhotoHandlers(){ $usePhoto.bind('click submit', function(e){ if(e.target.id === 'facebook-use-photo'){ // We don't want to show the facebook option, because // it is the source of the image. $facebookDestination.hide() _photoToUse = localS...
[ "function", "wireUsePhotoHandlers", "(", ")", "{", "$usePhoto", ".", "bind", "(", "'click submit'", ",", "function", "(", "e", ")", "{", "if", "(", "e", ".", "target", ".", "id", "===", "'facebook-use-photo'", ")", "{", "// We don't want to show the facebook opt...
Bind up the click handlers for one-up view when a user selects the photo they want to pipe
[ "Bind", "up", "the", "click", "handlers", "for", "one", "-", "up", "view", "when", "a", "user", "selects", "the", "photo", "they", "want", "to", "pipe" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L477-L544
train
joemccann/photopipe
public/js/pipe.js
_cleanseInput
function _cleanseInput(dirty){ var clean = '' clean = dirty.replace('@', '') clean = clean.replace('#', '') clean = clean.replace(/\s/g, '') return clean }
javascript
function _cleanseInput(dirty){ var clean = '' clean = dirty.replace('@', '') clean = clean.replace('#', '') clean = clean.replace(/\s/g, '') return clean }
[ "function", "_cleanseInput", "(", "dirty", ")", "{", "var", "clean", "=", "''", "clean", "=", "dirty", ".", "replace", "(", "'@'", ",", "''", ")", "clean", "=", "clean", ".", "replace", "(", "'#'", ",", "''", ")", "clean", "=", "clean", ".", "repla...
Super hack and certainly not bullet proof.
[ "Super", "hack", "and", "certainly", "not", "bullet", "proof", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L734-L740
train
joemccann/photopipe
public/js/pipe.js
_failHandler
function _failHandler(e){ $spin.hide() if(e.status === 400) alert(e.responseText || 'Bad request.') if(e.status === 401) alert(e.responseText || 'Unauthorized request.') if(e.status === 402) alert(e.responseText || 'Forbidden request.') if(e.status === 403) alert(e.responseText ...
javascript
function _failHandler(e){ $spin.hide() if(e.status === 400) alert(e.responseText || 'Bad request.') if(e.status === 401) alert(e.responseText || 'Unauthorized request.') if(e.status === 402) alert(e.responseText || 'Forbidden request.') if(e.status === 403) alert(e.responseText ...
[ "function", "_failHandler", "(", "e", ")", "{", "$spin", ".", "hide", "(", ")", "if", "(", "e", ".", "status", "===", "400", ")", "alert", "(", "e", ".", "responseText", "||", "'Bad request.'", ")", "if", "(", "e", ".", "status", "===", "401", ")",...
end done handler
[ "end", "done", "handler" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L823-L839
train
joemccann/photopipe
public/js/pipe.js
_selectPhotoForPipe
function _selectPhotoForPipe(e){ var img = $('.one-up:visible').find('img')[0].src localStorage.imageToPipe = img closeOneUp() window.location = "/instagram/pipe/to" }
javascript
function _selectPhotoForPipe(e){ var img = $('.one-up:visible').find('img')[0].src localStorage.imageToPipe = img closeOneUp() window.location = "/instagram/pipe/to" }
[ "function", "_selectPhotoForPipe", "(", "e", ")", "{", "var", "img", "=", "$", "(", "'.one-up:visible'", ")", ".", "find", "(", "'img'", ")", "[", "0", "]", ".", "src", "localStorage", ".", "imageToPipe", "=", "img", "closeOneUp", "(", ")", "window", "...
This method is where we select the image to be piped to another location.
[ "This", "method", "is", "where", "we", "select", "the", "image", "to", "be", "piped", "to", "another", "location", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L979-L988
train
joemccann/photopipe
public/js/pipe.js
positionFromTop
function positionFromTop(container, el){ var containerTop = container.position().top , windowTop = $window.scrollTop() if(containerTop > windowTop) return el.css('top', 0) var pos = windowTop - containerTop return el.css('top', pos) }
javascript
function positionFromTop(container, el){ var containerTop = container.position().top , windowTop = $window.scrollTop() if(containerTop > windowTop) return el.css('top', 0) var pos = windowTop - containerTop return el.css('top', pos) }
[ "function", "positionFromTop", "(", "container", ",", "el", ")", "{", "var", "containerTop", "=", "container", ".", "position", "(", ")", ".", "top", ",", "windowTop", "=", "$window", ".", "scrollTop", "(", ")", "if", "(", "containerTop", ">", "windowTop",...
Position via offset
[ "Position", "via", "offset" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L1398-L1409
train
joemccann/photopipe
public/js/pipe.js
featureDetector
function featureDetector(){ // Check if client can access file sytem (from Modernizer) var elem = document.createElement('input') elem.type = 'file' window.Photopipe.hasFileSystem = !elem.disabled // Check if client has media capture access window.Photopipe.hasMediaCapture = !!navigator.getU...
javascript
function featureDetector(){ // Check if client can access file sytem (from Modernizer) var elem = document.createElement('input') elem.type = 'file' window.Photopipe.hasFileSystem = !elem.disabled // Check if client has media capture access window.Photopipe.hasMediaCapture = !!navigator.getU...
[ "function", "featureDetector", "(", ")", "{", "// Check if client can access file sytem (from Modernizer) ", "var", "elem", "=", "document", ".", "createElement", "(", "'input'", ")", "elem", ".", "type", "=", "'file'", "window", ".", "Photopipe", ".", "hasFileSystem...
Determine browser capabilities
[ "Determine", "browser", "capabilities" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/public/js/pipe.js#L1417-L1437
train
yeptlabs/wns
src/core/base/wnEvent.js
function (listener,evtObj) { if (!_.isFunction(listener) || !_.isObject(evtObj)) return false; var args = evtObj.arguments; switch (args.length) { case 1: listener(args[0]); break; case 2: listener(args[0],args[1]); break; case 3: listener(args[0],args[1],args[...
javascript
function (listener,evtObj) { if (!_.isFunction(listener) || !_.isObject(evtObj)) return false; var args = evtObj.arguments; switch (args.length) { case 1: listener(args[0]); break; case 2: listener(args[0],args[1]); break; case 3: listener(args[0],args[1],args[...
[ "function", "(", "listener", ",", "evtObj", ")", "{", "if", "(", "!", "_", ".", "isFunction", "(", "listener", ")", "||", "!", "_", ".", "isObject", "(", "evtObj", ")", ")", "return", "false", ";", "var", "args", "=", "evtObj", ".", "arguments", ";...
Call the listener @param {function} listener @param {object} event object
[ "Call", "the", "listener" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnEvent.js#L43-L69
train
yeptlabs/wns
src/core/base/wnEvent.js
function (listener,prepend) { if ('function' !== typeof listener) return false; if (!_listeners) _listeners=listener; else if (typeof _listeners == 'object') { if (!prepend) _listeners.push(listener); else _listeners.unshift(listener); } else { if (!prepend) _list...
javascript
function (listener,prepend) { if ('function' !== typeof listener) return false; if (!_listeners) _listeners=listener; else if (typeof _listeners == 'object') { if (!prepend) _listeners.push(listener); else _listeners.unshift(listener); } else { if (!prepend) _list...
[ "function", "(", "listener", ",", "prepend", ")", "{", "if", "(", "'function'", "!==", "typeof", "listener", ")", "return", "false", ";", "if", "(", "!", "_listeners", ")", "_listeners", "=", "listener", ";", "else", "if", "(", "typeof", "_listeners", "=...
Add a new handler to this event.' @param function $listener listener of the event @param boolean $prepend
[ "Add", "a", "new", "handler", "to", "this", "event", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnEvent.js#L151-L172
train
yeptlabs/wns
src/core/base/wnEvent.js
function (listener, prepend) { if ('function' === typeof listener) { var self = this, g = function (e) { e.lastListeners--; self.removeListener(g); listener.apply(listener, arguments); }; g.listener = listener; this.addListener(g,prepend) } return this; }
javascript
function (listener, prepend) { if ('function' === typeof listener) { var self = this, g = function (e) { e.lastListeners--; self.removeListener(g); listener.apply(listener, arguments); }; g.listener = listener; this.addListener(g,prepend) } return this; }
[ "function", "(", "listener", ",", "prepend", ")", "{", "if", "(", "'function'", "===", "typeof", "listener", ")", "{", "var", "self", "=", "this", ",", "g", "=", "function", "(", "e", ")", "{", "e", ".", "lastListeners", "--", ";", "self", ".", "re...
Add a new one-time-listener to this event. @param $listener function listener of the event
[ "Add", "a", "new", "one", "-", "time", "-", "listener", "to", "this", "event", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnEvent.js#L195-L210
train
yeptlabs/wns
src/core/base/wnEvent.js
function (listener) { if ('function' !== typeof listener) return false; var list = _listeners; var position = -1; if (list === listener || (typeof list.listener === 'function' && list.listener === listener)) _listeners = undefined; else if (typeof list === 'object') { for ...
javascript
function (listener) { if ('function' !== typeof listener) return false; var list = _listeners; var position = -1; if (list === listener || (typeof list.listener === 'function' && list.listener === listener)) _listeners = undefined; else if (typeof list === 'object') { for ...
[ "function", "(", "listener", ")", "{", "if", "(", "'function'", "!==", "typeof", "listener", ")", "return", "false", ";", "var", "list", "=", "_listeners", ";", "var", "position", "=", "-", "1", ";", "if", "(", "list", "===", "listener", "||", "(", "...
Remove a listener from this event. @param $listener function listener of the event
[ "Remove", "a", "listener", "from", "this", "event", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnEvent.js#L216-L248
train
icetan/backbone-recursive-model
index.js
function(b) { if (b instanceof Model) { if (this.constructor !== b.constructor) return false; b = b.attributes; } return _.isEqual(this.attributes, b); }
javascript
function(b) { if (b instanceof Model) { if (this.constructor !== b.constructor) return false; b = b.attributes; } return _.isEqual(this.attributes, b); }
[ "function", "(", "b", ")", "{", "if", "(", "b", "instanceof", "Model", ")", "{", "if", "(", "this", ".", "constructor", "!==", "b", ".", "constructor", ")", "return", "false", ";", "b", "=", "b", ".", "attributes", ";", "}", "return", "_", ".", "...
Custom Underscore equality method.
[ "Custom", "Underscore", "equality", "method", "." ]
f28eaf85040fcbf03f624a7fbc9e837355d28951
https://github.com/icetan/backbone-recursive-model/blob/f28eaf85040fcbf03f624a7fbc9e837355d28951/index.js#L14-L20
train
supercrabtree/tape-worm
index.js
setInitalStyle
function setInitalStyle() { document.body.style.margin = 0; document.body.style.borderTopWidth = '10px'; document.body.style.borderTopStyle = 'solid'; }
javascript
function setInitalStyle() { document.body.style.margin = 0; document.body.style.borderTopWidth = '10px'; document.body.style.borderTopStyle = 'solid'; }
[ "function", "setInitalStyle", "(", ")", "{", "document", ".", "body", ".", "style", ".", "margin", "=", "0", ";", "document", ".", "body", ".", "style", ".", "borderTopWidth", "=", "'10px'", ";", "document", ".", "body", ".", "style", ".", "borderTopStyl...
Some initial styles, border color is changed when tests are run
[ "Some", "initial", "styles", "border", "color", "is", "changed", "when", "tests", "are", "run" ]
fe448d916cf7ee233e494580a89c8a44545603ae
https://github.com/supercrabtree/tape-worm/blob/fe448d916cf7ee233e494580a89c8a44545603ae/index.js#L52-L56
train
supercrabtree/tape-worm
index.js
style
function style() { var testsAre = 'pending'; if (failed > 0) { testsAre = 'failing'; } else if (passed > 0) { testsAre = 'passing'; } document.body.style.borderTopColor = richColors[testsAre]; faviconEl.setAttribute('href', favicons[testsAre]); document.body.style.backgroundColor = colors[test...
javascript
function style() { var testsAre = 'pending'; if (failed > 0) { testsAre = 'failing'; } else if (passed > 0) { testsAre = 'passing'; } document.body.style.borderTopColor = richColors[testsAre]; faviconEl.setAttribute('href', favicons[testsAre]); document.body.style.backgroundColor = colors[test...
[ "function", "style", "(", ")", "{", "var", "testsAre", "=", "'pending'", ";", "if", "(", "failed", ">", "0", ")", "{", "testsAre", "=", "'failing'", ";", "}", "else", "if", "(", "passed", ">", "0", ")", "{", "testsAre", "=", "'passing'", ";", "}", ...
Style the page
[ "Style", "the", "page" ]
fe448d916cf7ee233e494580a89c8a44545603ae
https://github.com/supercrabtree/tape-worm/blob/fe448d916cf7ee233e494580a89c8a44545603ae/index.js#L74-L87
train
supercrabtree/tape-worm
index.js
hijackLog
function hijackLog() { var oldLog = console.log; console.log = function (message) { count(message); style(); var match = (message + '').match(/^# #tapeworm-html(.*)/); var isHtml = !!match; if (match) { var html = match[1]; var div = testResults.appendChild(document.createElement...
javascript
function hijackLog() { var oldLog = console.log; console.log = function (message) { count(message); style(); var match = (message + '').match(/^# #tapeworm-html(.*)/); var isHtml = !!match; if (match) { var html = match[1]; var div = testResults.appendChild(document.createElement...
[ "function", "hijackLog", "(", ")", "{", "var", "oldLog", "=", "console", ".", "log", ";", "console", ".", "log", "=", "function", "(", "message", ")", "{", "count", "(", "message", ")", ";", "style", "(", ")", ";", "var", "match", "=", "(", "messag...
Create a wrapper around console.log
[ "Create", "a", "wrapper", "around", "console", ".", "log" ]
fe448d916cf7ee233e494580a89c8a44545603ae
https://github.com/supercrabtree/tape-worm/blob/fe448d916cf7ee233e494580a89c8a44545603ae/index.js#L108-L132
train
supercrabtree/tape-worm
index.js
infect
function infect(tape) { if (!document) { tape.Test.prototype.html = function () {}; return; } injectFavicon(); createTestResults(); setInitalStyle(); decorateTape(tape); hijackLog(); style(); }
javascript
function infect(tape) { if (!document) { tape.Test.prototype.html = function () {}; return; } injectFavicon(); createTestResults(); setInitalStyle(); decorateTape(tape); hijackLog(); style(); }
[ "function", "infect", "(", "tape", ")", "{", "if", "(", "!", "document", ")", "{", "tape", ".", "Test", ".", "prototype", ".", "html", "=", "function", "(", ")", "{", "}", ";", "return", ";", "}", "injectFavicon", "(", ")", ";", "createTestResults", ...
Infect is the only exposed method @param tape - A instace of tape / bluetape / redtape etc.
[ "Infect", "is", "the", "only", "exposed", "method" ]
fe448d916cf7ee233e494580a89c8a44545603ae
https://github.com/supercrabtree/tape-worm/blob/fe448d916cf7ee233e494580a89c8a44545603ae/index.js#L147-L158
train
SolarNetwork/solarnetwork-d3
src/ui/Matrix.js
function(angle) { // TODO this clears any scale, should we care? var a = Math.cos(angle); var b = Math.sin(angle); this.matrix[0] = this.matrix[3] = a; this.matrix[1] = (0-b); this.matrix[2] = b; }
javascript
function(angle) { // TODO this clears any scale, should we care? var a = Math.cos(angle); var b = Math.sin(angle); this.matrix[0] = this.matrix[3] = a; this.matrix[1] = (0-b); this.matrix[2] = b; }
[ "function", "(", "angle", ")", "{", "// TODO this clears any scale, should we care?", "var", "a", "=", "Math", ".", "cos", "(", "angle", ")", ";", "var", "b", "=", "Math", ".", "sin", "(", "angle", ")", ";", "this", ".", "matrix", "[", "0", "]", "=", ...
Set the z-axis rotation of the matrix. @param {Number} angle the rotation angle, in radians @preserve
[ "Set", "the", "z", "-", "axis", "rotation", "of", "the", "matrix", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/ui/Matrix.js#L113-L120
train
dogada/tflow
tflow.js
nextTickFn
function nextTickFn() { // setImmediate allows to run task after already queued I/O callbacks if (typeof setImmediate === 'function') { return setImmediate; } else if (typeof process !== 'undefined' && process.nextTick) { return function(fn) { process.nextTick(fn); } } else { return functi...
javascript
function nextTickFn() { // setImmediate allows to run task after already queued I/O callbacks if (typeof setImmediate === 'function') { return setImmediate; } else if (typeof process !== 'undefined' && process.nextTick) { return function(fn) { process.nextTick(fn); } } else { return functi...
[ "function", "nextTickFn", "(", ")", "{", "// setImmediate allows to run task after already queued I/O callbacks", "if", "(", "typeof", "setImmediate", "===", "'function'", ")", "{", "return", "setImmediate", ";", "}", "else", "if", "(", "typeof", "process", "!==", "'u...
Return next tick function for current environment.
[ "Return", "next", "tick", "function", "for", "current", "environment", "." ]
e3ea0d7f45862abf55ec7dc1c6bd573fd3e71664
https://github.com/dogada/tflow/blob/e3ea0d7f45862abf55ec7dc1c6bd573fd3e71664/tflow.js#L6-L19
train
clempat/gulp-systemjs-resolver
index.js
resolve
function resolve(val, i, isPath) { val = val.replace('~', ''); return Promise.resolve(System.normalize(val)) .then(function(normalized) { return System.locate({name: normalized, metadata: {}}); }) .then(function(address) { if (isPath) { options.includePaths.push( path.re...
javascript
function resolve(val, i, isPath) { val = val.replace('~', ''); return Promise.resolve(System.normalize(val)) .then(function(normalized) { return System.locate({name: normalized, metadata: {}}); }) .then(function(address) { if (isPath) { options.includePaths.push( path.re...
[ "function", "resolve", "(", "val", ",", "i", ",", "isPath", ")", "{", "val", "=", "val", ".", "replace", "(", "'~'", ",", "''", ")", ";", "return", "Promise", ".", "resolve", "(", "System", ".", "normalize", "(", "val", ")", ")", ".", "then", "("...
Use systemjs to resolve include files @param val @param i @param {Boolean} isPath @returns {*}
[ "Use", "systemjs", "to", "resolve", "include", "files" ]
b486e8ffd23d4e295dfa57634e6435685dc1d27c
https://github.com/clempat/gulp-systemjs-resolver/blob/b486e8ffd23d4e295dfa57634e6435685dc1d27c/index.js#L51-L74
train
clempat/gulp-systemjs-resolver
index.js
resolveAll
function resolveAll(fileContent) { var matches = [].concat(fileContent.match(regexFile)).filter(Boolean).map(extractFile); var pathsMatches = [].concat(fileContent.match(regexPath)).filter(Boolean).map(extractFile); if (matches.length === 0 && pathsMatches.length === 0) { return new RSVP.Promise(func...
javascript
function resolveAll(fileContent) { var matches = [].concat(fileContent.match(regexFile)).filter(Boolean).map(extractFile); var pathsMatches = [].concat(fileContent.match(regexPath)).filter(Boolean).map(extractFile); if (matches.length === 0 && pathsMatches.length === 0) { return new RSVP.Promise(func...
[ "function", "resolveAll", "(", "fileContent", ")", "{", "var", "matches", "=", "[", "]", ".", "concat", "(", "fileContent", ".", "match", "(", "regexFile", ")", ")", ".", "filter", "(", "Boolean", ")", ".", "map", "(", "extractFile", ")", ";", "var", ...
Resolve the imports @param fileContent
[ "Resolve", "the", "imports" ]
b486e8ffd23d4e295dfa57634e6435685dc1d27c
https://github.com/clempat/gulp-systemjs-resolver/blob/b486e8ffd23d4e295dfa57634e6435685dc1d27c/index.js#L109-L129
train
colmharte/geteventstore-client
lib/Client.js
Client
function Client(opts) { this.opts = new clientOptions(opts) this.streamData = {} this.currentIndex = 0 this.cachedItems = new lru({maxSize: this.opts.maxCacheSize}) }
javascript
function Client(opts) { this.opts = new clientOptions(opts) this.streamData = {} this.currentIndex = 0 this.cachedItems = new lru({maxSize: this.opts.maxCacheSize}) }
[ "function", "Client", "(", "opts", ")", "{", "this", ".", "opts", "=", "new", "clientOptions", "(", "opts", ")", "this", ".", "streamData", "=", "{", "}", "this", ".", "currentIndex", "=", "0", "this", ".", "cachedItems", "=", "new", "lru", "(", "{",...
Client interface fabricator
[ "Client", "interface", "fabricator" ]
49ac3ea0d4b5a3383144053bc42d7417921880da
https://github.com/colmharte/geteventstore-client/blob/49ac3ea0d4b5a3383144053bc42d7417921880da/lib/Client.js#L32-L38
train
chrishayesmu/DubBotBase
src/config.js
create
function create(basedir, defaults) { LOG.info("Initializing application configuration"); var config = defaults || {}; _loadConfigurationFiles(basedir, config); _validateConfig(config); if (config.DubBotBase.isConfigImmutable) { _freezeConfig(config); LOG.info("Configuration set up ...
javascript
function create(basedir, defaults) { LOG.info("Initializing application configuration"); var config = defaults || {}; _loadConfigurationFiles(basedir, config); _validateConfig(config); if (config.DubBotBase.isConfigImmutable) { _freezeConfig(config); LOG.info("Configuration set up ...
[ "function", "create", "(", "basedir", ",", "defaults", ")", "{", "LOG", ".", "info", "(", "\"Initializing application configuration\"", ")", ";", "var", "config", "=", "defaults", "||", "{", "}", ";", "_loadConfigurationFiles", "(", "basedir", ",", "config", "...
Initializes the application's configuration by reading from a config file defined in NPM configuration. @param {string} basedir - The base directory of the bot, containing a "config" subdirectory @param {object} defaults - An optional object containing default configuration. @returns {object} An object representing co...
[ "Initializes", "the", "application", "s", "configuration", "by", "reading", "from", "a", "config", "file", "defined", "in", "NPM", "configuration", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/config.js#L25-L41
train
chrishayesmu/DubBotBase
src/config.js
_copyConfigFromFile
function _copyConfigFromFile(filePath, config) { LOG.info("Attempting to load configuration file '{}'", filePath); var fileConfig = require(filePath); _mergeConfig(config, fileConfig); LOG.info("Successfully read configuration file '{}'", filePath); }
javascript
function _copyConfigFromFile(filePath, config) { LOG.info("Attempting to load configuration file '{}'", filePath); var fileConfig = require(filePath); _mergeConfig(config, fileConfig); LOG.info("Successfully read configuration file '{}'", filePath); }
[ "function", "_copyConfigFromFile", "(", "filePath", ",", "config", ")", "{", "LOG", ".", "info", "(", "\"Attempting to load configuration file '{}'\"", ",", "filePath", ")", ";", "var", "fileConfig", "=", "require", "(", "filePath", ")", ";", "_mergeConfig", "(", ...
Reads the JSON configuration out of the file specified. @param {string} filePath - The path to the file to load @params {object} config - The current config object
[ "Reads", "the", "JSON", "configuration", "out", "of", "the", "file", "specified", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/config.js#L80-L87
train
chrishayesmu/DubBotBase
src/config.js
_freezeConfig
function _freezeConfig(config) { Object.freeze(config); for (var key in config) { if (typeof config[key] === "object") { _freezeConfig(config[key]); } } }
javascript
function _freezeConfig(config) { Object.freeze(config); for (var key in config) { if (typeof config[key] === "object") { _freezeConfig(config[key]); } } }
[ "function", "_freezeConfig", "(", "config", ")", "{", "Object", ".", "freeze", "(", "config", ")", ";", "for", "(", "var", "key", "in", "config", ")", "{", "if", "(", "typeof", "config", "[", "key", "]", "===", "\"object\"", ")", "{", "_freezeConfig", ...
Freezes the configuration object and makes it immutable. This is a deep method; all subobjects will also be immutable. @param {object} config - The current config object
[ "Freezes", "the", "configuration", "object", "and", "makes", "it", "immutable", ".", "This", "is", "a", "deep", "method", ";", "all", "subobjects", "will", "also", "be", "immutable", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/config.js#L95-L103
train
chrishayesmu/DubBotBase
src/config.js
_mergeConfig
function _mergeConfig(base, override) { for (var key in override) { if (base[key] && typeof base[key] === "object" && typeof override[key] === "object") { _mergeConfig(base[key], override[key]); } else { base[key] = override[key]; } } }
javascript
function _mergeConfig(base, override) { for (var key in override) { if (base[key] && typeof base[key] === "object" && typeof override[key] === "object") { _mergeConfig(base[key], override[key]); } else { base[key] = override[key]; } } }
[ "function", "_mergeConfig", "(", "base", ",", "override", ")", "{", "for", "(", "var", "key", "in", "override", ")", "{", "if", "(", "base", "[", "key", "]", "&&", "typeof", "base", "[", "key", "]", "===", "\"object\"", "&&", "typeof", "override", "[...
Merges the 'override' object into the 'base' object. Scalar values which exist in both places are overridden, while object values are merged recursively. @param {object} base - The base object to merge into @param {object} override - An object containing overriding values to merge from
[ "Merges", "the", "override", "object", "into", "the", "base", "object", ".", "Scalar", "values", "which", "exist", "in", "both", "places", "are", "overridden", "while", "object", "values", "are", "merged", "recursively", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/config.js#L112-L121
train
chrishayesmu/DubBotBase
src/config.js
_validateConfig
function _validateConfig(config) { for (var i = 0; i < REQUIRED_CONFIG_VARIABLES.length; i++) { var key = REQUIRED_CONFIG_VARIABLES[i]; var value = config.DubBotBase[key]; if (!value || value === "UNSET") { throw new Error("No value has been set in config for key: DubBotBase." + ...
javascript
function _validateConfig(config) { for (var i = 0; i < REQUIRED_CONFIG_VARIABLES.length; i++) { var key = REQUIRED_CONFIG_VARIABLES[i]; var value = config.DubBotBase[key]; if (!value || value === "UNSET") { throw new Error("No value has been set in config for key: DubBotBase." + ...
[ "function", "_validateConfig", "(", "config", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "REQUIRED_CONFIG_VARIABLES", ".", "length", ";", "i", "++", ")", "{", "var", "key", "=", "REQUIRED_CONFIG_VARIABLES", "[", "i", "]", ";", "var", "v...
Performs validation to ensure the npm environment has been set up properly. If anything is wrong, throws an error. @params {object} config - The current config object to validate
[ "Performs", "validation", "to", "ensure", "the", "npm", "environment", "has", "been", "set", "up", "properly", ".", "If", "anything", "is", "wrong", "throws", "an", "error", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/config.js#L129-L137
train
robgietema/twist
public/libs/less.js/1.3.1/less.js
function () { var value, c = input.charCodeAt(i); if ((c > 57 || c < 45) || c === 47) return; if (value = $(/^(-?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi|dpcm|dppx|rem|vw|vh|vmin|vm|ch)?/)) { return new(tree.Dime...
javascript
function () { var value, c = input.charCodeAt(i); if ((c > 57 || c < 45) || c === 47) return; if (value = $(/^(-?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi|dpcm|dppx|rem|vw|vh|vmin|vm|ch)?/)) { return new(tree.Dime...
[ "function", "(", ")", "{", "var", "value", ",", "c", "=", "input", ".", "charCodeAt", "(", "i", ")", ";", "if", "(", "(", "c", ">", "57", "||", "c", "<", "45", ")", "||", "c", "===", "47", ")", "return", ";", "if", "(", "value", "=", "$", ...
A Dimension, that is, a number and a unit 0.5em 95%
[ "A", "Dimension", "that", "is", "a", "number", "and", "a", "unit", "0", ".", "5em", "95%" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/less.js/1.3.1/less.js#L847-L854
train
robgietema/twist
public/libs/tquery/r53/tquery-bundle.js
function(srcUrl, dstW, dstH, callback){ // to compute the width/height while keeping aspect var cpuScaleAspect = function(maxW, maxH, curW, curH){ var ratio = curH / curW; if( curW >= maxW && ratio <= 1 ){ curW = maxW; curH = maxW * ratio; }else if(curH >= maxH){ curH = maxH; curW = maxH /...
javascript
function(srcUrl, dstW, dstH, callback){ // to compute the width/height while keeping aspect var cpuScaleAspect = function(maxW, maxH, curW, curH){ var ratio = curH / curW; if( curW >= maxW && ratio <= 1 ){ curW = maxW; curH = maxW * ratio; }else if(curH >= maxH){ curH = maxH; curW = maxH /...
[ "function", "(", "srcUrl", ",", "dstW", ",", "dstH", ",", "callback", ")", "{", "// to compute the width/height while keeping aspect", "var", "cpuScaleAspect", "=", "function", "(", "maxW", ",", "maxH", ",", "curW", ",", "curH", ")", "{", "var", "ratio", "=", ...
resize an image to another resolution while preserving aspect @param {String} srcUrl the url of the image to resize @param {Number} dstWidth the destination width of the image @param {Number} dstHeight the destination height of the image @param {Number} callback the callback to notify once completed with callback(newI...
[ "resize", "an", "image", "to", "another", "resolution", "while", "preserving", "aspect" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/tquery/r53/tquery-bundle.js#L39155-L39199
train
purtuga/observables
src/objectCreateComputedProp.js
objectCreateComputedProp
function objectCreateComputedProp(obj, prop, setter, enumerable = true) { let propValue; let newValue; let needsInitialization = true; let allowSet = false; let needsNewValue = true; let isGeneratingNewValue = false; const dependencyTracker = () => { if (needsNewValue) { ...
javascript
function objectCreateComputedProp(obj, prop, setter, enumerable = true) { let propValue; let newValue; let needsInitialization = true; let allowSet = false; let needsNewValue = true; let isGeneratingNewValue = false; const dependencyTracker = () => { if (needsNewValue) { ...
[ "function", "objectCreateComputedProp", "(", "obj", ",", "prop", ",", "setter", ",", "enumerable", "=", "true", ")", "{", "let", "propValue", ";", "let", "newValue", ";", "let", "needsInitialization", "=", "true", ";", "let", "allowSet", "=", "false", ";", ...
Creates a computed property on a given object. @param {Object} obj @param {String} prop @param {Function} setter A callback function that will be used to retrieve the computed prop's value. Function is called with a context (`this`) of the object and will receive one input param - the Object itself. Callback is exec...
[ "Creates", "a", "computed", "property", "on", "a", "given", "object", "." ]
68847b1294734c4cd50b26e5f6156a8b460f77a2
https://github.com/purtuga/observables/blob/68847b1294734c4cd50b26e5f6156a8b460f77a2/src/objectCreateComputedProp.js#L51-L160
train
jhermsmeier/node-mime-lib
lib/mime.js
function( input, charset ) { if( charset && !Buffer.isBuffer( input ) ) { return MIME.Iconv.encode( input, charset ) } else { return Buffer.isBuffer( input ) ? input.toString( 'base64' ) : Buffer.from( input ).toString( 'base64' ) } }
javascript
function( input, charset ) { if( charset && !Buffer.isBuffer( input ) ) { return MIME.Iconv.encode( input, charset ) } else { return Buffer.isBuffer( input ) ? input.toString( 'base64' ) : Buffer.from( input ).toString( 'base64' ) } }
[ "function", "(", "input", ",", "charset", ")", "{", "if", "(", "charset", "&&", "!", "Buffer", ".", "isBuffer", "(", "input", ")", ")", "{", "return", "MIME", ".", "Iconv", ".", "encode", "(", "input", ",", "charset", ")", "}", "else", "{", "return...
Base64 encodes a buffer or string. @param {String|Buffer} input @param {String} charset @return {String}
[ "Base64", "encodes", "a", "buffer", "or", "string", "." ]
7260792c2ba00720c193a539064f1f939aaa508e
https://github.com/jhermsmeier/node-mime-lib/blob/7260792c2ba00720c193a539064f1f939aaa508e/lib/mime.js#L66-L74
train
jhermsmeier/node-mime-lib
lib/mime.js
function( input, charset ) { if( /iso-?2022-?jp/i.test( charset ) ) { charset = 'shift_jis' } if( charset ) { return MIME.Iconv.decode( Buffer.from( input, 'base64' ), charset ) } else { return Buffer.from( input, 'base64' ).toString() } }
javascript
function( input, charset ) { if( /iso-?2022-?jp/i.test( charset ) ) { charset = 'shift_jis' } if( charset ) { return MIME.Iconv.decode( Buffer.from( input, 'base64' ), charset ) } else { return Buffer.from( input, 'base64' ).toString() } }
[ "function", "(", "input", ",", "charset", ")", "{", "if", "(", "/", "iso-?2022-?jp", "/", "i", ".", "test", "(", "charset", ")", ")", "{", "charset", "=", "'shift_jis'", "}", "if", "(", "charset", ")", "{", "return", "MIME", ".", "Iconv", ".", "dec...
Decodes a base64 encoded string. @param {String} input @param {String} charset @return {String|Buffer}
[ "Decodes", "a", "base64", "encoded", "string", "." ]
7260792c2ba00720c193a539064f1f939aaa508e
https://github.com/jhermsmeier/node-mime-lib/blob/7260792c2ba00720c193a539064f1f939aaa508e/lib/mime.js#L83-L95
train
twolfson/icomoon-phantomjs
lib/icomoon-phantomjs.js
waitFor
function waitFor(checkFn, timeout, cb) { var start = Date.now(); function runWaitFor() { if (checkFn()) { cb(); } else if ((Date.now() - start) <= timeout) { setTimeout(runWaitFor, 100); } else { cb(new Error('Timeout of ' + timeout + 'ms reached. This usually means something went wron...
javascript
function waitFor(checkFn, timeout, cb) { var start = Date.now(); function runWaitFor() { if (checkFn()) { cb(); } else if ((Date.now() - start) <= timeout) { setTimeout(runWaitFor, 100); } else { cb(new Error('Timeout of ' + timeout + 'ms reached. This usually means something went wron...
[ "function", "waitFor", "(", "checkFn", ",", "timeout", ",", "cb", ")", "{", "var", "start", "=", "Date", ".", "now", "(", ")", ";", "function", "runWaitFor", "(", ")", "{", "if", "(", "checkFn", "(", ")", ")", "{", "cb", "(", ")", ";", "}", "el...
Run a check function every 100 ms
[ "Run", "a", "check", "function", "every", "100", "ms" ]
6c513af003e49c57e81859da2276810fc03d4366
https://github.com/twolfson/icomoon-phantomjs/blob/6c513af003e49c57e81859da2276810fc03d4366/lib/icomoon-phantomjs.js#L20-L32
train
ljharb/set-tojson
index.js
function (set, receive) { var values = setValues.call(set); var next; do { next = values.next(); } while (!next.done && receive(next.value)); }
javascript
function (set, receive) { var values = setValues.call(set); var next; do { next = values.next(); } while (!next.done && receive(next.value)); }
[ "function", "(", "set", ",", "receive", ")", "{", "var", "values", "=", "setValues", ".", "call", "(", "set", ")", ";", "var", "next", ";", "do", "{", "next", "=", "values", ".", "next", "(", ")", ";", "}", "while", "(", "!", "next", ".", "done...
polyfilled Sets with es6-shim might exist without for..of
[ "polyfilled", "Sets", "with", "es6", "-", "shim", "might", "exist", "without", "for", "..", "of" ]
0c39288f0a05c80271eef235c752bbaf087577f5
https://github.com/ljharb/set-tojson/blob/0c39288f0a05c80271eef235c752bbaf087577f5/index.js#L13-L19
train
ahultgren/hamster
lib/Cache.js
done
function done () { that.fetchQueue.stopFetching(key, arguments); that.store(key, arguments, callback); }
javascript
function done () { that.fetchQueue.stopFetching(key, arguments); that.store(key, arguments, callback); }
[ "function", "done", "(", ")", "{", "that", ".", "fetchQueue", ".", "stopFetching", "(", "key", ",", "arguments", ")", ";", "that", ".", "store", "(", "key", ",", "arguments", ",", "callback", ")", ";", "}" ]
This callback is used if async
[ "This", "callback", "is", "used", "if", "async" ]
d56acb53d2261fcbc31c8be8ebcce3eafcfd5ffd
https://github.com/ahultgren/hamster/blob/d56acb53d2261fcbc31c8be8ebcce3eafcfd5ffd/lib/Cache.js#L219-L222
train
robgietema/twist
public/libs/obviel/1.0b5/obviel-forms.js
function(source, target) { var linkedTarget = $(target); clearLinkedData(target); $.each(source, function(key, sourceValue) { if (isInternal(key)) { return; } var targetValue = null; if ($.isPlainObject(sourceValue)) { ...
javascript
function(source, target) { var linkedTarget = $(target); clearLinkedData(target); $.each(source, function(key, sourceValue) { if (isInternal(key)) { return; } var targetValue = null; if ($.isPlainObject(sourceValue)) { ...
[ "function", "(", "source", ",", "target", ")", "{", "var", "linkedTarget", "=", "$", "(", "target", ")", ";", "clearLinkedData", "(", "target", ")", ";", "$", ".", "each", "(", "source", ",", "function", "(", "key", ",", "sourceValue", ")", "{", "if"...
use setField to set values in target according to source source and target must have same structure
[ "use", "setField", "to", "set", "values", "in", "target", "according", "to", "source", "source", "and", "target", "must", "have", "same", "structure" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/obviel/1.0b5/obviel-forms.js#L312-L334
train