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
rossmartin/cordova-uglify
after_prepare/uglify.js
run
function run() { platforms.forEach(function(platform) { var wwwPath; switch (platform) { case 'android': wwwPath = path.join(platformPath, platform, 'assets', 'www'); if (!fs.existsSync(wwwPath)) { wwwPath = path.join(platformPath, platform, 'app', 'src', 'main', 'assets', 'ww...
javascript
function run() { platforms.forEach(function(platform) { var wwwPath; switch (platform) { case 'android': wwwPath = path.join(platformPath, platform, 'assets', 'www'); if (!fs.existsSync(wwwPath)) { wwwPath = path.join(platformPath, platform, 'app', 'src', 'main', 'assets', 'ww...
[ "function", "run", "(", ")", "{", "platforms", ".", "forEach", "(", "function", "(", "platform", ")", "{", "var", "wwwPath", ";", "switch", "(", "platform", ")", "{", "case", "'android'", ":", "wwwPath", "=", "path", ".", "join", "(", "platformPath", "...
Run compression for all specified platforms. @return {undefined}
[ "Run", "compression", "for", "all", "specified", "platforms", "." ]
b9beccc8956d3215e6bd104c4d57d1f5a894bf68
https://github.com/rossmartin/cordova-uglify/blob/b9beccc8956d3215e6bd104c4d57d1f5a894bf68/after_prepare/uglify.js#L40-L66
train
rossmartin/cordova-uglify
after_prepare/uglify.js
processFolders
function processFolders(wwwPath) { foldersToProcess.forEach(function(folder) { processFiles(path.join(wwwPath, folder)); }); }
javascript
function processFolders(wwwPath) { foldersToProcess.forEach(function(folder) { processFiles(path.join(wwwPath, folder)); }); }
[ "function", "processFolders", "(", "wwwPath", ")", "{", "foldersToProcess", ".", "forEach", "(", "function", "(", "folder", ")", "{", "processFiles", "(", "path", ".", "join", "(", "wwwPath", ",", "folder", ")", ")", ";", "}", ")", ";", "}" ]
Processes defined folders. @param {string} wwwPath - Path to www directory @return {undefined}
[ "Processes", "defined", "folders", "." ]
b9beccc8956d3215e6bd104c4d57d1f5a894bf68
https://github.com/rossmartin/cordova-uglify/blob/b9beccc8956d3215e6bd104c4d57d1f5a894bf68/after_prepare/uglify.js#L73-L77
train
rossmartin/cordova-uglify
after_prepare/uglify.js
compress
function compress(file) { var ext = path.extname(file), res, source, result; switch (ext) { case '.js': console.log('uglifying js file ' + file); res = ngAnnotate(String(fs.readFileSync(file, 'utf8')), { add: true }); result = UglifyJS.minify(res.src, hookConfig.ugl...
javascript
function compress(file) { var ext = path.extname(file), res, source, result; switch (ext) { case '.js': console.log('uglifying js file ' + file); res = ngAnnotate(String(fs.readFileSync(file, 'utf8')), { add: true }); result = UglifyJS.minify(res.src, hookConfig.ugl...
[ "function", "compress", "(", "file", ")", "{", "var", "ext", "=", "path", ".", "extname", "(", "file", ")", ",", "res", ",", "source", ",", "result", ";", "switch", "(", "ext", ")", "{", "case", "'.js'", ":", "console", ".", "log", "(", "'uglifying...
Compresses file. @param {string} file - File path @return {undefined}
[ "Compresses", "file", "." ]
b9beccc8956d3215e6bd104c4d57d1f5a894bf68
https://github.com/rossmartin/cordova-uglify/blob/b9beccc8956d3215e6bd104c4d57d1f5a894bf68/after_prepare/uglify.js#L117-L146
train
mozilla/makedrive
lib/fs-utils.js
hasAttr
function hasAttr(fs, path, attr, callback) { fs.getxattr(path, attr, function(err, attrVal) { // File doesn't exist locally at all if(err && err.code === 'ENOENT') { return callback(null, false); } // Deal with unexpected error if(err && err.code !== 'ENOATTR') { return callback(err);...
javascript
function hasAttr(fs, path, attr, callback) { fs.getxattr(path, attr, function(err, attrVal) { // File doesn't exist locally at all if(err && err.code === 'ENOENT') { return callback(null, false); } // Deal with unexpected error if(err && err.code !== 'ENOATTR') { return callback(err);...
[ "function", "hasAttr", "(", "fs", ",", "path", ",", "attr", ",", "callback", ")", "{", "fs", ".", "getxattr", "(", "path", ",", "attr", ",", "function", "(", "err", ",", "attrVal", ")", "{", "// File doesn't exist locally at all", "if", "(", "err", "&&",...
See if a given path a) exists, and whether it is marked with an xattr.
[ "See", "if", "a", "given", "path", "a", ")", "exists", "and", "whether", "it", "is", "marked", "with", "an", "xattr", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L7-L21
train
mozilla/makedrive
lib/fs-utils.js
removeAttr
function removeAttr(fs, pathOrFd, attr, isFd, callback) { var removeFn = 'fremovexattr'; if(isFd !== true) { callback = isFd; removeFn = 'removexattr'; } fs[removeFn](pathOrFd, attr, function(err) { if(err && err.code !== 'ENOATTR') { return callback(err); } callback(); }); }
javascript
function removeAttr(fs, pathOrFd, attr, isFd, callback) { var removeFn = 'fremovexattr'; if(isFd !== true) { callback = isFd; removeFn = 'removexattr'; } fs[removeFn](pathOrFd, attr, function(err) { if(err && err.code !== 'ENOATTR') { return callback(err); } callback(); }); }
[ "function", "removeAttr", "(", "fs", ",", "pathOrFd", ",", "attr", ",", "isFd", ",", "callback", ")", "{", "var", "removeFn", "=", "'fremovexattr'", ";", "if", "(", "isFd", "!==", "true", ")", "{", "callback", "=", "isFd", ";", "removeFn", "=", "'remov...
Remove the metadata from a path or file descriptor
[ "Remove", "the", "metadata", "from", "a", "path", "or", "file", "descriptor" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L24-L39
train
mozilla/makedrive
lib/fs-utils.js
getAttr
function getAttr(fs, pathOrFd, attr, isFd, callback) { var getFn = 'fgetxattr'; if(isFd !== true) { callback = isFd; getFn = 'getxattr'; } fs[getFn](pathOrFd, attr, function(err, value) { if(err && err.code !== 'ENOATTR') { return callback(err); } callback(null, value); }); }
javascript
function getAttr(fs, pathOrFd, attr, isFd, callback) { var getFn = 'fgetxattr'; if(isFd !== true) { callback = isFd; getFn = 'getxattr'; } fs[getFn](pathOrFd, attr, function(err, value) { if(err && err.code !== 'ENOATTR') { return callback(err); } callback(null, value); }); }
[ "function", "getAttr", "(", "fs", ",", "pathOrFd", ",", "attr", ",", "isFd", ",", "callback", ")", "{", "var", "getFn", "=", "'fgetxattr'", ";", "if", "(", "isFd", "!==", "true", ")", "{", "callback", "=", "isFd", ";", "getFn", "=", "'getxattr'", ";"...
Get the metadata for a path or file descriptor
[ "Get", "the", "metadata", "for", "a", "path", "or", "file", "descriptor" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L42-L57
train
mozilla/makedrive
lib/fs-utils.js
forceCopy
function forceCopy(fs, oldPath, newPath, callback) { fs.unlink(newPath, function(err) { if(err && err.code !== 'ENOENT') { return callback(err); } fs.readFile(oldPath, function(err, buf) { if(err) { return callback(err); } fs.writeFile(newPath, buf, callback); }); }...
javascript
function forceCopy(fs, oldPath, newPath, callback) { fs.unlink(newPath, function(err) { if(err && err.code !== 'ENOENT') { return callback(err); } fs.readFile(oldPath, function(err, buf) { if(err) { return callback(err); } fs.writeFile(newPath, buf, callback); }); }...
[ "function", "forceCopy", "(", "fs", ",", "oldPath", ",", "newPath", ",", "callback", ")", "{", "fs", ".", "unlink", "(", "newPath", ",", "function", "(", "err", ")", "{", "if", "(", "err", "&&", "err", ".", "code", "!==", "'ENOENT'", ")", "{", "ret...
copy oldPath to newPath, deleting newPath if it exists
[ "copy", "oldPath", "to", "newPath", "deleting", "newPath", "if", "it", "exists" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L60-L74
train
mozilla/makedrive
lib/fs-utils.js
isPathUnsynced
function isPathUnsynced(fs, path, callback) { hasAttr(fs, path, constants.attributes.unsynced, callback); }
javascript
function isPathUnsynced(fs, path, callback) { hasAttr(fs, path, constants.attributes.unsynced, callback); }
[ "function", "isPathUnsynced", "(", "fs", ",", "path", ",", "callback", ")", "{", "hasAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "unsynced", ",", "callback", ")", ";", "}" ]
See if a given path a) exists, and whether it is marked unsynced.
[ "See", "if", "a", "given", "path", "a", ")", "exists", "and", "whether", "it", "is", "marked", "unsynced", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L77-L79
train
mozilla/makedrive
lib/fs-utils.js
removeUnsynced
function removeUnsynced(fs, path, callback) { removeAttr(fs, path, constants.attributes.unsynced, callback); }
javascript
function removeUnsynced(fs, path, callback) { removeAttr(fs, path, constants.attributes.unsynced, callback); }
[ "function", "removeUnsynced", "(", "fs", ",", "path", ",", "callback", ")", "{", "removeAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "unsynced", ",", "callback", ")", ";", "}" ]
Remove the unsynced metadata from a path
[ "Remove", "the", "unsynced", "metadata", "from", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L82-L84
train
mozilla/makedrive
lib/fs-utils.js
setUnsynced
function setUnsynced(fs, path, callback) { fs.setxattr(path, constants.attributes.unsynced, Date.now(), callback); }
javascript
function setUnsynced(fs, path, callback) { fs.setxattr(path, constants.attributes.unsynced, Date.now(), callback); }
[ "function", "setUnsynced", "(", "fs", ",", "path", ",", "callback", ")", "{", "fs", ".", "setxattr", "(", "path", ",", "constants", ".", "attributes", ".", "unsynced", ",", "Date", ".", "now", "(", ")", ",", "callback", ")", ";", "}" ]
Set the unsynced metadata for a path
[ "Set", "the", "unsynced", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L90-L92
train
mozilla/makedrive
lib/fs-utils.js
getUnsynced
function getUnsynced(fs, path, callback) { getAttr(fs, path, constants.attributes.unsynced, callback); }
javascript
function getUnsynced(fs, path, callback) { getAttr(fs, path, constants.attributes.unsynced, callback); }
[ "function", "getUnsynced", "(", "fs", ",", "path", ",", "callback", ")", "{", "getAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "unsynced", ",", "callback", ")", ";", "}" ]
Get the unsynced metadata for a path
[ "Get", "the", "unsynced", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L98-L100
train
mozilla/makedrive
lib/fs-utils.js
removeChecksum
function removeChecksum(fs, path, callback) { removeAttr(fs, path, constants.attributes.checksum, callback); }
javascript
function removeChecksum(fs, path, callback) { removeAttr(fs, path, constants.attributes.checksum, callback); }
[ "function", "removeChecksum", "(", "fs", ",", "path", ",", "callback", ")", "{", "removeAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "checksum", ",", "callback", ")", ";", "}" ]
Remove the Checksum metadata from a path
[ "Remove", "the", "Checksum", "metadata", "from", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L106-L108
train
mozilla/makedrive
lib/fs-utils.js
setChecksum
function setChecksum(fs, path, checksum, callback) { fs.setxattr(path, constants.attributes.checksum, checksum, callback); }
javascript
function setChecksum(fs, path, checksum, callback) { fs.setxattr(path, constants.attributes.checksum, checksum, callback); }
[ "function", "setChecksum", "(", "fs", ",", "path", ",", "checksum", ",", "callback", ")", "{", "fs", ".", "setxattr", "(", "path", ",", "constants", ".", "attributes", ".", "checksum", ",", "checksum", ",", "callback", ")", ";", "}" ]
Set the Checksum metadata for a path
[ "Set", "the", "Checksum", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L114-L116
train
mozilla/makedrive
lib/fs-utils.js
getChecksum
function getChecksum(fs, path, callback) { getAttr(fs, path, constants.attributes.checksum, callback); }
javascript
function getChecksum(fs, path, callback) { getAttr(fs, path, constants.attributes.checksum, callback); }
[ "function", "getChecksum", "(", "fs", ",", "path", ",", "callback", ")", "{", "getAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "checksum", ",", "callback", ")", ";", "}" ]
Get the Checksum metadata for a path
[ "Get", "the", "Checksum", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L122-L124
train
mozilla/makedrive
lib/fs-utils.js
isPathPartial
function isPathPartial(fs, path, callback) { hasAttr(fs, path, constants.attributes.partial, callback); }
javascript
function isPathPartial(fs, path, callback) { hasAttr(fs, path, constants.attributes.partial, callback); }
[ "function", "isPathPartial", "(", "fs", ",", "path", ",", "callback", ")", "{", "hasAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "partial", ",", "callback", ")", ";", "}" ]
See if a given path a) exists, and whether it is marked partial.
[ "See", "if", "a", "given", "path", "a", ")", "exists", "and", "whether", "it", "is", "marked", "partial", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L130-L132
train
mozilla/makedrive
lib/fs-utils.js
removePartial
function removePartial(fs, path, callback) { removeAttr(fs, path, constants.attributes.partial, callback); }
javascript
function removePartial(fs, path, callback) { removeAttr(fs, path, constants.attributes.partial, callback); }
[ "function", "removePartial", "(", "fs", ",", "path", ",", "callback", ")", "{", "removeAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "partial", ",", "callback", ")", ";", "}" ]
Remove the partial metadata from a path
[ "Remove", "the", "partial", "metadata", "from", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L135-L137
train
mozilla/makedrive
lib/fs-utils.js
setPartial
function setPartial(fs, path, nodeCount, callback) { fs.setxattr(path, constants.attributes.partial, nodeCount, callback); }
javascript
function setPartial(fs, path, nodeCount, callback) { fs.setxattr(path, constants.attributes.partial, nodeCount, callback); }
[ "function", "setPartial", "(", "fs", ",", "path", ",", "nodeCount", ",", "callback", ")", "{", "fs", ".", "setxattr", "(", "path", ",", "constants", ".", "attributes", ".", "partial", ",", "nodeCount", ",", "callback", ")", ";", "}" ]
Set the partial metadata for a path
[ "Set", "the", "partial", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L143-L145
train
mozilla/makedrive
lib/fs-utils.js
getPartial
function getPartial(fs, path, callback) { getAttr(fs, path, constants.attributes.partial, callback); }
javascript
function getPartial(fs, path, callback) { getAttr(fs, path, constants.attributes.partial, callback); }
[ "function", "getPartial", "(", "fs", ",", "path", ",", "callback", ")", "{", "getAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "partial", ",", "callback", ")", ";", "}" ]
Get the partial metadata for a path
[ "Get", "the", "partial", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L151-L153
train
mozilla/makedrive
lib/fs-utils.js
setPathsToSync
function setPathsToSync(fs, path, pathsToSync, callback) { fs.setxattr(path, constants.attributes.pathsToSync, pathsToSync, callback); }
javascript
function setPathsToSync(fs, path, pathsToSync, callback) { fs.setxattr(path, constants.attributes.pathsToSync, pathsToSync, callback); }
[ "function", "setPathsToSync", "(", "fs", ",", "path", ",", "pathsToSync", ",", "callback", ")", "{", "fs", ".", "setxattr", "(", "path", ",", "constants", ".", "attributes", ".", "pathsToSync", ",", "pathsToSync", ",", "callback", ")", ";", "}" ]
Set the pathsToSync metadata for a path
[ "Set", "the", "pathsToSync", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L159-L161
train
mozilla/makedrive
lib/fs-utils.js
getPathsToSync
function getPathsToSync(fs, path, callback) { getAttr(fs, path, constants.attributes.pathsToSync, callback); }
javascript
function getPathsToSync(fs, path, callback) { getAttr(fs, path, constants.attributes.pathsToSync, callback); }
[ "function", "getPathsToSync", "(", "fs", ",", "path", ",", "callback", ")", "{", "getAttr", "(", "fs", ",", "path", ",", "constants", ".", "attributes", ".", "pathsToSync", ",", "callback", ")", ";", "}" ]
Get the pathsToSync metadata for a path
[ "Get", "the", "pathsToSync", "metadata", "for", "a", "path" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/fs-utils.js#L167-L169
train
mozilla/makedrive
server/lib/sync-lock.js
request
function request(client, path, callback) { var key = SyncLock.generateKey(client.username); var id = client.id; // Try to set this key/value pair, but fail if the path for the key already exists. redis.hsetnx(key, path, id, function(err, reply) { if(err) { log.error({err: err, client: client}, 'Error...
javascript
function request(client, path, callback) { var key = SyncLock.generateKey(client.username); var id = client.id; // Try to set this key/value pair, but fail if the path for the key already exists. redis.hsetnx(key, path, id, function(err, reply) { if(err) { log.error({err: err, client: client}, 'Error...
[ "function", "request", "(", "client", ",", "path", ",", "callback", ")", "{", "var", "key", "=", "SyncLock", ".", "generateKey", "(", "client", ".", "username", ")", ";", "var", "id", "=", "client", ".", "id", ";", "// Try to set this key/value pair, but fai...
Request a lock for the current client.
[ "Request", "a", "lock", "for", "the", "current", "client", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/sync-lock.js#L159-L211
train
mozilla/makedrive
server/lib/sync-lock.js
isUserLocked
function isUserLocked(username, path, callback) { var key = SyncLock.generateKey(username); redis.hget(key, path, function(err, value) { if(err) { log.error(err, 'Error getting redis lock key %s.', key); return callback(err); } callback(null, !!value); }); }
javascript
function isUserLocked(username, path, callback) { var key = SyncLock.generateKey(username); redis.hget(key, path, function(err, value) { if(err) { log.error(err, 'Error getting redis lock key %s.', key); return callback(err); } callback(null, !!value); }); }
[ "function", "isUserLocked", "(", "username", ",", "path", ",", "callback", ")", "{", "var", "key", "=", "SyncLock", ".", "generateKey", "(", "username", ")", ";", "redis", ".", "hget", "(", "key", ",", "path", ",", "function", "(", "err", ",", "value",...
Check to see if a lock is held for the given username.
[ "Check", "to", "see", "if", "a", "lock", "is", "held", "for", "the", "given", "username", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/sync-lock.js#L216-L226
train
mozilla/makedrive
lib/rsync/rsync-utils.js
validateParams
function validateParams(fs, param2) { var err; if(!fs) { err = new Errors.EINVAL('No filesystem provided'); } else if(!param2) { err = new Errors.EINVAL('Second argument must be specified'); } return err; }
javascript
function validateParams(fs, param2) { var err; if(!fs) { err = new Errors.EINVAL('No filesystem provided'); } else if(!param2) { err = new Errors.EINVAL('Second argument must be specified'); } return err; }
[ "function", "validateParams", "(", "fs", ",", "param2", ")", "{", "var", "err", ";", "if", "(", "!", "fs", ")", "{", "err", "=", "new", "Errors", ".", "EINVAL", "(", "'No filesystem provided'", ")", ";", "}", "else", "if", "(", "!", "param2", ")", ...
Validate the parameters sent to each rsync method
[ "Validate", "the", "parameters", "sent", "to", "each", "rsync", "method" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L62-L72
train
mozilla/makedrive
lib/rsync/rsync-utils.js
calcWeak32
function calcWeak32(data, prev, start, end) { var a = 0; var b = 0; var M = 1 << 16; var N = 65521; if (!prev) { var len = (start >= 0 && end >= 0) ? (end - start + 1) : data.length; var datai; for (var i = 0; i < len; i++) { datai = data[i]; a += datai; b += ((len - i) * datai)...
javascript
function calcWeak32(data, prev, start, end) { var a = 0; var b = 0; var M = 1 << 16; var N = 65521; if (!prev) { var len = (start >= 0 && end >= 0) ? (end - start + 1) : data.length; var datai; for (var i = 0; i < len; i++) { datai = data[i]; a += datai; b += ((len - i) * datai)...
[ "function", "calcWeak32", "(", "data", ",", "prev", ",", "start", ",", "end", ")", "{", "var", "a", "=", "0", ";", "var", "b", "=", "0", ";", "var", "M", "=", "1", "<<", "16", ";", "var", "N", "=", "65521", ";", "if", "(", "!", "prev", ")",...
Weak32 hashing for RSync based on Mark Adler's 32bit checksum algorithm
[ "Weak32", "hashing", "for", "RSync", "based", "on", "Mark", "Adler", "s", "32bit", "checksum", "algorithm" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L80-L109
train
mozilla/makedrive
lib/rsync/rsync-utils.js
createHashtable
function createHashtable(checksums) { var hashtable = {}; var len = checksums.length; var checksum; var weak16; for (var i = 0; i < len; i++) { checksum = checksums[i]; weak16 = calcWeak16(checksum.weak); if (hashtable[weak16]) { hashtable[weak16].push(checksum); } else { hashtabl...
javascript
function createHashtable(checksums) { var hashtable = {}; var len = checksums.length; var checksum; var weak16; for (var i = 0; i < len; i++) { checksum = checksums[i]; weak16 = calcWeak16(checksum.weak); if (hashtable[weak16]) { hashtable[weak16].push(checksum); } else { hashtabl...
[ "function", "createHashtable", "(", "checksums", ")", "{", "var", "hashtable", "=", "{", "}", ";", "var", "len", "=", "checksums", ".", "length", ";", "var", "checksum", ";", "var", "weak16", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "l...
RSync algorithm to create a hashtable from checksums
[ "RSync", "algorithm", "to", "create", "a", "hashtable", "from", "checksums" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L117-L133
train
mozilla/makedrive
lib/rsync/rsync-utils.js
roll
function roll(data, checksums, blockSize) { var results = []; var hashtable = createHashtable(checksums); var length = data.length; var start = 0; var end = blockSize > length ? length : blockSize; // Updated when a block matches var lastMatchedEnd = 0; // This gets updated every iteration with the prev...
javascript
function roll(data, checksums, blockSize) { var results = []; var hashtable = createHashtable(checksums); var length = data.length; var start = 0; var end = blockSize > length ? length : blockSize; // Updated when a block matches var lastMatchedEnd = 0; // This gets updated every iteration with the prev...
[ "function", "roll", "(", "data", ",", "checksums", ",", "blockSize", ")", "{", "var", "results", "=", "[", "]", ";", "var", "hashtable", "=", "createHashtable", "(", "checksums", ")", ";", "var", "length", "=", "data", ".", "length", ";", "var", "start...
RSync algorithm to perform data rolling
[ "RSync", "algorithm", "to", "perform", "data", "rolling" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L136-L209
train
mozilla/makedrive
lib/rsync/rsync-utils.js
blockChecksums
function blockChecksums(fs, path, size, callback) { var cache = {}; fs.readFile(path, function (err, data) { if (!err) { // cache file cache[path] = data; } else if (err && err.code === 'ENOENT') { cache[path] = []; } else { return callback(err); } var length = cache[pa...
javascript
function blockChecksums(fs, path, size, callback) { var cache = {}; fs.readFile(path, function (err, data) { if (!err) { // cache file cache[path] = data; } else if (err && err.code === 'ENOENT') { cache[path] = []; } else { return callback(err); } var length = cache[pa...
[ "function", "blockChecksums", "(", "fs", ",", "path", ",", "size", ",", "callback", ")", "{", "var", "cache", "=", "{", "}", ";", "fs", ".", "readFile", "(", "path", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "!", "err", ")", ...
Rsync function to calculate checksums for a file by dividing it into blocks of data whose size is passed in and checksuming each block of data
[ "Rsync", "function", "to", "calculate", "checksums", "for", "a", "file", "by", "dividing", "it", "into", "blocks", "of", "data", "whose", "size", "is", "passed", "in", "and", "checksuming", "each", "block", "of", "data" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L215-L257
train
mozilla/makedrive
lib/rsync/rsync-utils.js
getChecksum
function getChecksum(fs, path, callback) { fs.readFile(path, function(err, data) { if(!err) { callback(null, md5sum(data)); } else if(err.code === 'ENOENT') { // File does not exist so the checksum is an empty string callback(null, ""); } else { callback(err); } }); }
javascript
function getChecksum(fs, path, callback) { fs.readFile(path, function(err, data) { if(!err) { callback(null, md5sum(data)); } else if(err.code === 'ENOENT') { // File does not exist so the checksum is an empty string callback(null, ""); } else { callback(err); } }); }
[ "function", "getChecksum", "(", "fs", ",", "path", ",", "callback", ")", "{", "fs", ".", "readFile", "(", "path", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "!", "err", ")", "{", "callback", "(", "null", ",", "md5sum", "(", "d...
Generate the MD5 hash for the data of a file in its entirety
[ "Generate", "the", "MD5", "hash", "for", "the", "data", "of", "a", "file", "in", "its", "entirety" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L261-L272
train
mozilla/makedrive
lib/rsync/rsync-utils.js
generateChecksums
function generateChecksums(fs, paths, stampNode, callback) { // Maybe stampNode was not passed in if(typeof callback !== 'function') { callback = findCallback(callback, stampNode); stampNode = false; } var paramError = validateParams(fs, paths); if(paramError) { return callback(paramError); } ...
javascript
function generateChecksums(fs, paths, stampNode, callback) { // Maybe stampNode was not passed in if(typeof callback !== 'function') { callback = findCallback(callback, stampNode); stampNode = false; } var paramError = validateParams(fs, paths); if(paramError) { return callback(paramError); } ...
[ "function", "generateChecksums", "(", "fs", ",", "paths", ",", "stampNode", ",", "callback", ")", "{", "// Maybe stampNode was not passed in", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "callback", "=", "findCallback", "(", "callback", ",", ...
Generate checksums for an array of paths to be used for comparison It also takes an optional parameter called stampNode, a boolean which indicates whether the checksum should be stamped as an xattr on the node.
[ "Generate", "checksums", "for", "an", "array", "of", "paths", "to", "be", "used", "for", "comparison", "It", "also", "takes", "an", "optional", "parameter", "called", "stampNode", "a", "boolean", "which", "indicates", "whether", "the", "checksum", "should", "b...
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L277-L374
train
mozilla/makedrive
lib/rsync/rsync-utils.js
maybeAddChecksumNode
function maybeAddChecksumNode(path, nodeType, callback) { fsUtils.isPathUnsynced(fs, path, function(err, unsynced) { if(err) { return callback(err); } if(unsynced) { return callback(); } getChecksum(fs, path, function(err, checksum) { if(err) { retur...
javascript
function maybeAddChecksumNode(path, nodeType, callback) { fsUtils.isPathUnsynced(fs, path, function(err, unsynced) { if(err) { return callback(err); } if(unsynced) { return callback(); } getChecksum(fs, path, function(err, checksum) { if(err) { retur...
[ "function", "maybeAddChecksumNode", "(", "path", ",", "nodeType", ",", "callback", ")", "{", "fsUtils", ".", "isPathUnsynced", "(", "fs", ",", "path", ",", "function", "(", "err", ",", "unsynced", ")", "{", "if", "(", "err", ")", "{", "return", "callback...
Only calculate the checksums for synced paths
[ "Only", "calculate", "the", "checksums", "for", "synced", "paths" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L313-L344
train
mozilla/makedrive
lib/rsync/rsync-utils.js
compareContents
function compareContents(fs, checksumList, callback) { var ECHKSUM = "Checksums do not match"; var paramError = validateParams(fs, checksumList); if(paramError) { return callback(paramError); } function compare(checksumNode, callback) { var path = checksumNode.path; fs.lstat(path, function(err,...
javascript
function compareContents(fs, checksumList, callback) { var ECHKSUM = "Checksums do not match"; var paramError = validateParams(fs, checksumList); if(paramError) { return callback(paramError); } function compare(checksumNode, callback) { var path = checksumNode.path; fs.lstat(path, function(err,...
[ "function", "compareContents", "(", "fs", ",", "checksumList", ",", "callback", ")", "{", "var", "ECHKSUM", "=", "\"Checksums do not match\"", ";", "var", "paramError", "=", "validateParams", "(", "fs", ",", "checksumList", ")", ";", "if", "(", "paramError", "...
Compare two file systems. This is done by comparing the checksums for a collection of paths in one file system against the checksums for the same those paths in another file system
[ "Compare", "two", "file", "systems", ".", "This", "is", "done", "by", "comparing", "the", "checksums", "for", "a", "collection", "of", "paths", "in", "one", "file", "system", "against", "the", "checksums", "for", "the", "same", "those", "paths", "in", "ano...
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/rsync-utils.js#L380-L433
train
mozilla/makedrive
lib/rsync/patch.js
createParentDirectories
function createParentDirectories(path, callback) { (new fs.Shell()).mkdirp(Path.dirname(path), function(err) { if(err && err.code !== 'EEXIST') { return callback(err); } callback(); }); }
javascript
function createParentDirectories(path, callback) { (new fs.Shell()).mkdirp(Path.dirname(path), function(err) { if(err && err.code !== 'EEXIST') { return callback(err); } callback(); }); }
[ "function", "createParentDirectories", "(", "path", ",", "callback", ")", "{", "(", "new", "fs", ".", "Shell", "(", ")", ")", ".", "mkdirp", "(", "Path", ".", "dirname", "(", "path", ")", ",", "function", "(", "err", ")", "{", "if", "(", "err", "&&...
Create any parent directories that do not exist
[ "Create", "any", "parent", "directories", "that", "do", "not", "exist" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/rsync/patch.js#L482-L490
train
mozilla/makedrive
lib/util.js
findPathIndexInArray
function findPathIndexInArray(array, path) { for(var i = 0; i < array.length; i++) { if(array[i].path === path) { return i; } } return -1; }
javascript
function findPathIndexInArray(array, path) { for(var i = 0; i < array.length; i++) { if(array[i].path === path) { return i; } } return -1; }
[ "function", "findPathIndexInArray", "(", "array", ",", "path", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", ".", "path", "===", "path", ")", "{",...
General utility methods
[ "General", "utility", "methods" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/lib/util.js#L3-L11
train
mozilla/makedrive
server/lib/filer-www/json-handler.js
handle404
function handle404(url, res) { var json = { error: { code: 404, message: 'The requested URL ' + url + ' was not found on this server.' } }; write(json, res, 404); }
javascript
function handle404(url, res) { var json = { error: { code: 404, message: 'The requested URL ' + url + ' was not found on this server.' } }; write(json, res, 404); }
[ "function", "handle404", "(", "url", ",", "res", ")", "{", "var", "json", "=", "{", "error", ":", "{", "code", ":", "404", ",", "message", ":", "'The requested URL '", "+", "url", "+", "' was not found on this server.'", "}", "}", ";", "write", "(", "jso...
Send an Apache-style 404
[ "Send", "an", "Apache", "-", "style", "404" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/filer-www/json-handler.js#L15-L23
train
mozilla/makedrive
server/lib/filer-www/json-handler.js
handleDir
function handleDir(fs, path, res) { var sh = new fs.Shell(); sh.ls(path, {recursive: true}, function(err, listing) { if(err) { log.error(err, 'Unable to get listing for path `%s`', path); handle404(path, res); return; } write(listing, res); }); }
javascript
function handleDir(fs, path, res) { var sh = new fs.Shell(); sh.ls(path, {recursive: true}, function(err, listing) { if(err) { log.error(err, 'Unable to get listing for path `%s`', path); handle404(path, res); return; } write(listing, res); }); }
[ "function", "handleDir", "(", "fs", ",", "path", ",", "res", ")", "{", "var", "sh", "=", "new", "fs", ".", "Shell", "(", ")", ";", "sh", ".", "ls", "(", "path", ",", "{", "recursive", ":", "true", "}", ",", "function", "(", "err", ",", "listing...
Send recursive dir listing
[ "Send", "recursive", "dir", "listing" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/filer-www/json-handler.js#L51-L62
train
mozilla/makedrive
server/lib/sync-protocol-handler.js
ensureLock
function ensureLock(client, path) { var lock = client.lock; if(!(lock && !('unlocked' in lock))) { // Create an error so we get a stack, too. var err = new Error('Attempted sync step without lock.'); log.error({client: client, err: err}, 'Client should own lock but does not for ' + path); return fal...
javascript
function ensureLock(client, path) { var lock = client.lock; if(!(lock && !('unlocked' in lock))) { // Create an error so we get a stack, too. var err = new Error('Attempted sync step without lock.'); log.error({client: client, err: err}, 'Client should own lock but does not for ' + path); return fal...
[ "function", "ensureLock", "(", "client", ",", "path", ")", "{", "var", "lock", "=", "client", ".", "lock", ";", "if", "(", "!", "(", "lock", "&&", "!", "(", "'unlocked'", "in", "lock", ")", ")", ")", "{", "// Create an error so we get a stack, too.", "va...
Most upstream sync steps require a lock to be held. It's a bug if we get into one of these steps without the lock.
[ "Most", "upstream", "sync", "steps", "require", "a", "lock", "to", "be", "held", ".", "It", "s", "a", "bug", "if", "we", "get", "into", "one", "of", "these", "steps", "without", "the", "lock", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/sync-protocol-handler.js#L90-L99
train
mozilla/makedrive
server/lib/sync-protocol-handler.js
checkFileSizeLimit
function checkFileSizeLimit(client, srcList) { function maxSizeExceeded(obj) { var errorMsg; client.lock.release(function(err) { if(err) { log.error({err: err, client: client}, 'Error releasing sync lock'); } releaseLock(client); errorMsg = SyncMessage.error.maxsizeExceeded;...
javascript
function checkFileSizeLimit(client, srcList) { function maxSizeExceeded(obj) { var errorMsg; client.lock.release(function(err) { if(err) { log.error({err: err, client: client}, 'Error releasing sync lock'); } releaseLock(client); errorMsg = SyncMessage.error.maxsizeExceeded;...
[ "function", "checkFileSizeLimit", "(", "client", ",", "srcList", ")", "{", "function", "maxSizeExceeded", "(", "obj", ")", "{", "var", "errorMsg", ";", "client", ".", "lock", ".", "release", "(", "function", "(", "err", ")", "{", "if", "(", "err", ")", ...
Returns true if file sizes are all within limit, false if not. The client's lock is released, and an error sent to client in the false case.
[ "Returns", "true", "if", "file", "sizes", "are", "all", "within", "limit", "false", "if", "not", ".", "The", "client", "s", "lock", "is", "released", "and", "an", "error", "sent", "to", "client", "in", "the", "false", "case", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/sync-protocol-handler.js#L113-L149
train
mozilla/makedrive
server/lib/sync-protocol-handler.js
maybeReleaseLock
function maybeReleaseLock() { var lock = self.client.lock; function done(err) { log.debug({client: self.client}, 'Closed client sync handler'); self.client.lock = null; self.client = null; callback(err); } // No lock if(!lock) { return done(); } // Lock refere...
javascript
function maybeReleaseLock() { var lock = self.client.lock; function done(err) { log.debug({client: self.client}, 'Closed client sync handler'); self.client.lock = null; self.client = null; callback(err); } // No lock if(!lock) { return done(); } // Lock refere...
[ "function", "maybeReleaseLock", "(", ")", "{", "var", "lock", "=", "self", ".", "client", ".", "lock", ";", "function", "done", "(", "err", ")", "{", "log", ".", "debug", "(", "{", "client", ":", "self", ".", "client", "}", ",", "'Closed client sync ha...
If we're still holding a valid lock, release it first.
[ "If", "we", "re", "still", "holding", "a", "valid", "lock", "release", "it", "first", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/sync-protocol-handler.js#L225-L251
train
mozilla/makedrive
server/lib/websocket-auth.js
getUsernameByToken
function getUsernameByToken(token) { for(var username in authTable) { if(authTable[username].indexOf(token) > -1) { return username; } } return null; }
javascript
function getUsernameByToken(token) { for(var username in authTable) { if(authTable[username].indexOf(token) > -1) { return username; } } return null; }
[ "function", "getUsernameByToken", "(", "token", ")", "{", "for", "(", "var", "username", "in", "authTable", ")", "{", "if", "(", "authTable", "[", "username", "]", ".", "indexOf", "(", "token", ")", ">", "-", "1", ")", "{", "return", "username", ";", ...
Default to 60 sec
[ "Default", "to", "60", "sec" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/websocket-auth.js#L23-L30
train
mozilla/makedrive
client/src/message-handler.js
handlePatchAckResponse
function handlePatchAckResponse() { var syncedPath = data.content.path; function complete() { fsUtils.removeUnsynced(fs, syncedPath, function(err) { if(err && err.code !== 'ENOENT') { log.error('Failed to remove unsynced attribute for ' + syncedPath + ' in handlePatchAckResponse, comple...
javascript
function handlePatchAckResponse() { var syncedPath = data.content.path; function complete() { fsUtils.removeUnsynced(fs, syncedPath, function(err) { if(err && err.code !== 'ENOENT') { log.error('Failed to remove unsynced attribute for ' + syncedPath + ' in handlePatchAckResponse, comple...
[ "function", "handlePatchAckResponse", "(", ")", "{", "var", "syncedPath", "=", "data", ".", "content", ".", "path", ";", "function", "complete", "(", ")", "{", "fsUtils", ".", "removeUnsynced", "(", "fs", ",", "syncedPath", ",", "function", "(", "err", ")"...
As soon as an upstream sync happens, the file synced becomes the last synced version and must be stamped with its checksum to version it and the unsynced attribute must be removed
[ "As", "soon", "as", "an", "upstream", "sync", "happens", "the", "file", "synced", "becomes", "the", "last", "synced", "version", "and", "must", "be", "stamped", "with", "its", "checksum", "to", "version", "it", "and", "the", "unsynced", "attribute", "must", ...
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/client/src/message-handler.js#L282-L342
train
ns1/ns1-js
src/rest_resource.js
convert_json_to_objects
function convert_json_to_objects(data) { if (Array.isArray(data)) { return data.map((item, index, arr) => { return new this(item, true) }) } else { return new this(data, true) } }
javascript
function convert_json_to_objects(data) { if (Array.isArray(data)) { return data.map((item, index, arr) => { return new this(item, true) }) } else { return new this(data, true) } }
[ "function", "convert_json_to_objects", "(", "data", ")", "{", "if", "(", "Array", ".", "isArray", "(", "data", ")", ")", "{", "return", "data", ".", "map", "(", "(", "item", ",", "index", ",", "arr", ")", "=>", "{", "return", "new", "this", "(", "i...
Takes in JSON from requests and converts internal objects into objects representing the resource class. @param {Array/Object} data - JSON data, either a single object or an array of objects @return {Array/Object} - Returns the data as objects of the resource class @private
[ "Takes", "in", "JSON", "from", "requests", "and", "converts", "internal", "objects", "into", "objects", "representing", "the", "resource", "class", "." ]
750ad13d97054196732dd957ca574a698e4ce4c2
https://github.com/ns1/ns1-js/blob/750ad13d97054196732dd957ca574a698e4ce4c2/src/rest_resource.js#L143-L151
train
mozilla/makedrive
server/lib/client-manager.js
runClient
function runClient(client) { var ws = client.ws; function invalidMessage() { var message = SyncMessage.error.format; message.content = {error: 'Unable to parse/handle message, invalid message format.'}; client.sendMessage(message); } ws.onmessage = function(msg, flags) { var data; var mess...
javascript
function runClient(client) { var ws = client.ws; function invalidMessage() { var message = SyncMessage.error.format; message.content = {error: 'Unable to parse/handle message, invalid message format.'}; client.sendMessage(message); } ws.onmessage = function(msg, flags) { var data; var mess...
[ "function", "runClient", "(", "client", ")", "{", "var", "ws", "=", "client", ".", "ws", ";", "function", "invalidMessage", "(", ")", "{", "var", "message", "=", "SyncMessage", ".", "error", ".", "format", ";", "message", ".", "content", "=", "{", "err...
Run the client normally through protocol steps.
[ "Run", "the", "client", "normally", "through", "protocol", "steps", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/client-manager.js#L12-L53
train
mozilla/makedrive
server/lib/client-manager.js
initClient
function initClient(client) { var ws = client.ws; client.state = States.CONNECTING; // Wait until we get the user's token so we can finish authorizing ws.onmessage = function(msg) { var data; var info; try { // Keep track of how much data we receive info = client.info(); if(info...
javascript
function initClient(client) { var ws = client.ws; client.state = States.CONNECTING; // Wait until we get the user's token so we can finish authorizing ws.onmessage = function(msg) { var data; var info; try { // Keep track of how much data we receive info = client.info(); if(info...
[ "function", "initClient", "(", "client", ")", "{", "var", "ws", "=", "client", ".", "ws", ";", "client", ".", "state", "=", "States", ".", "CONNECTING", ";", "// Wait until we get the user's token so we can finish authorizing", "ws", ".", "onmessage", "=", "functi...
Handle initial connection and authentication, bind user data to client, including filesystem, and switch the client to normal run mode.
[ "Handle", "initial", "connection", "and", "authentication", "bind", "user", "data", "to", "client", "including", "filesystem", "and", "switch", "the", "client", "to", "normal", "run", "mode", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/client-manager.js#L60-L111
train
mozilla/makedrive
server/lib/client-manager.js
remove
function remove(client) { if(!clients) { return; } var idx = clients.indexOf(client); if(idx > -1) { clients.splice(idx, 1); } }
javascript
function remove(client) { if(!clients) { return; } var idx = clients.indexOf(client); if(idx > -1) { clients.splice(idx, 1); } }
[ "function", "remove", "(", "client", ")", "{", "if", "(", "!", "clients", ")", "{", "return", ";", "}", "var", "idx", "=", "clients", ".", "indexOf", "(", "client", ")", ";", "if", "(", "idx", ">", "-", "1", ")", "{", "clients", ".", "splice", ...
Remove client from the list. Does not affect client state or life-cycle.
[ "Remove", "client", "from", "the", "list", ".", "Does", "not", "affect", "client", "state", "or", "life", "-", "cycle", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/client-manager.js#L122-L131
train
mozilla/makedrive
server/lib/client-manager.js
add
function add(client) { // Auto-remove clients on close client.once('closed', function() { remove(client); }); clients = clients || []; clients.push(client); initClient(client); }
javascript
function add(client) { // Auto-remove clients on close client.once('closed', function() { remove(client); }); clients = clients || []; clients.push(client); initClient(client); }
[ "function", "add", "(", "client", ")", "{", "// Auto-remove clients on close", "client", ".", "once", "(", "'closed'", ",", "function", "(", ")", "{", "remove", "(", "client", ")", ";", "}", ")", ";", "clients", "=", "clients", "||", "[", "]", ";", "cl...
Add a client to the list, and manage its life-cycle.
[ "Add", "a", "client", "to", "the", "list", "and", "manage", "its", "life", "-", "cycle", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/client-manager.js#L136-L145
train
mozilla/makedrive
server/lib/client-manager.js
shutdown
function shutdown(callback) { var closed = 0; var connected = clients ? clients.length : 0; function maybeFinished() { if(++closed >= connected) { clients = null; log.info('[Shutdown] All client connections safely closed.'); return callback(); } log.info('[Shutdown] Closed client %...
javascript
function shutdown(callback) { var closed = 0; var connected = clients ? clients.length : 0; function maybeFinished() { if(++closed >= connected) { clients = null; log.info('[Shutdown] All client connections safely closed.'); return callback(); } log.info('[Shutdown] Closed client %...
[ "function", "shutdown", "(", "callback", ")", "{", "var", "closed", "=", "0", ";", "var", "connected", "=", "clients", "?", "clients", ".", "length", ":", "0", ";", "function", "maybeFinished", "(", ")", "{", "if", "(", "++", "closed", ">=", "connected...
Safe shutdown, waiting on all clients to close.
[ "Safe", "shutdown", "waiting", "on", "all", "clients", "to", "close", "." ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/client-manager.js#L150-L183
train
ns1/ns1-js
src/NS1_request.js
apply_data
function apply_data(query, files) { if(startCb){ startCb(); } if (query !== undefined) { if (this.method === 'get') { this.request = this.request.query(query) } else { this.request = this.request.send(query) } } if (files !== undefined) { if (files instanceof FormData) { ...
javascript
function apply_data(query, files) { if(startCb){ startCb(); } if (query !== undefined) { if (this.method === 'get') { this.request = this.request.query(query) } else { this.request = this.request.send(query) } } if (files !== undefined) { if (files instanceof FormData) { ...
[ "function", "apply_data", "(", "query", ",", "files", ")", "{", "if", "(", "startCb", ")", "{", "startCb", "(", ")", ";", "}", "if", "(", "query", "!==", "undefined", ")", "{", "if", "(", "this", ".", "method", "===", "'get'", ")", "{", "this", "...
Applies data to the this.request superagent object. Works with query params or file attachments. @param {Object} query - Any parameters to be sent in the query string for GET requests or in the req body for others @param {Object/FormData} files - Key / value mapped object containing file paths for uploads, or a Form...
[ "Applies", "data", "to", "the", "this", ".", "request", "superagent", "object", ".", "Works", "with", "query", "params", "or", "file", "attachments", "." ]
750ad13d97054196732dd957ca574a698e4ce4c2
https://github.com/ns1/ns1-js/blob/750ad13d97054196732dd957ca574a698e4ce4c2/src/NS1_request.js#L94-L115
train
mozilla/makedrive
server/lib/filer-www/default-handler.js
handleFile
function handleFile(fs, path, res) { var contentType = mime.lookup(path); var encoding = mime.charsets.lookup(contentType) === "UTF-8" ? "utf8" : null; fs.readFile(path, {encoding: encoding}, function(err, data) { if(err) { log.error(err, 'Unable to read file path `%s`', path); handle404(path, re...
javascript
function handleFile(fs, path, res) { var contentType = mime.lookup(path); var encoding = mime.charsets.lookup(contentType) === "UTF-8" ? "utf8" : null; fs.readFile(path, {encoding: encoding}, function(err, data) { if(err) { log.error(err, 'Unable to read file path `%s`', path); handle404(path, re...
[ "function", "handleFile", "(", "fs", ",", "path", ",", "res", ")", "{", "var", "contentType", "=", "mime", ".", "lookup", "(", "path", ")", ";", "var", "encoding", "=", "mime", ".", "charsets", ".", "lookup", "(", "contentType", ")", "===", "\"UTF-8\""...
Send the raw file, making it somewhat more readable
[ "Send", "the", "raw", "file", "making", "it", "somewhat", "more", "readable" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/filer-www/default-handler.js#L27-L40
train
mozilla/makedrive
server/lib/filer-www/default-handler.js
handleDir
function handleDir(fs, path, res) { var sh = new fs.Shell(); var parent = Path.dirname(path); var header = '<!DOCTYPE html>' + '<html><head><title>Index of ' + path + '</title></head>' + '<body><h1>Index of ' + path + '</h1>' + '<table><tr><th><img src="/icons/blank.png" alt="[ICO]"></th>...
javascript
function handleDir(fs, path, res) { var sh = new fs.Shell(); var parent = Path.dirname(path); var header = '<!DOCTYPE html>' + '<html><head><title>Index of ' + path + '</title></head>' + '<body><h1>Index of ' + path + '</h1>' + '<table><tr><th><img src="/icons/blank.png" alt="[ICO]"></th>...
[ "function", "handleDir", "(", "fs", ",", "path", ",", "res", ")", "{", "var", "sh", "=", "new", "fs", ".", "Shell", "(", ")", ";", "var", "parent", "=", "Path", ".", "dirname", "(", "path", ")", ";", "var", "header", "=", "'<!DOCTYPE html>'", "+", ...
Send an Apache-style directory listing
[ "Send", "an", "Apache", "-", "style", "directory", "listing" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/lib/filer-www/default-handler.js#L45-L115
train
mozilla/makedrive
server/redis-clients.js
onmessage
function onmessage(channel, message) { if(closing) { return; } switch(channel) { case ChannelConstants.syncChannel: module.exports.emit('sync', message); break; case ChannelConstants.lockRequestChannel: module.exports.emit('lock-request', message); break; case ChannelConst...
javascript
function onmessage(channel, message) { if(closing) { return; } switch(channel) { case ChannelConstants.syncChannel: module.exports.emit('sync', message); break; case ChannelConstants.lockRequestChannel: module.exports.emit('lock-request', message); break; case ChannelConst...
[ "function", "onmessage", "(", "channel", ",", "message", ")", "{", "if", "(", "closing", ")", "{", "return", ";", "}", "switch", "(", "channel", ")", "{", "case", "ChannelConstants", ".", "syncChannel", ":", "module", ".", "exports", ".", "emit", "(", ...
redis subscription messages. Split the different types out based on channel
[ "redis", "subscription", "messages", ".", "Split", "the", "different", "types", "out", "based", "on", "channel" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/server/redis-clients.js#L60-L79
train
mozilla/makedrive
client/src/index.js
windowCloseHandler
function windowCloseHandler(event) { if(!options.windowCloseWarning) { return; } if(sync.state !== sync.SYNC_SYNCING) { return; } var confirmationMessage = "Sync currently underway, are you sure you want to close?"; (event || global.event).returnValue = confirmationMessage; re...
javascript
function windowCloseHandler(event) { if(!options.windowCloseWarning) { return; } if(sync.state !== sync.SYNC_SYNCING) { return; } var confirmationMessage = "Sync currently underway, are you sure you want to close?"; (event || global.event).returnValue = confirmationMessage; re...
[ "function", "windowCloseHandler", "(", "event", ")", "{", "if", "(", "!", "options", ".", "windowCloseWarning", ")", "{", "return", ";", "}", "if", "(", "sync", ".", "state", "!==", "sync", ".", "SYNC_SYNCING", ")", "{", "return", ";", "}", "var", "con...
Optionally warn when closing the window if still syncing
[ "Optionally", "warn", "when", "closing", "the", "window", "if", "still", "syncing" ]
542b8acf595cd37a88ca880b3730befeb7e86743
https://github.com/mozilla/makedrive/blob/542b8acf595cd37a88ca880b3730befeb7e86743/client/src/index.js#L151-L164
train
crudlio/crudl
gulpfile.js
continuousBundle
function continuousBundle() { const bundle = b => b.bundle() .on('error', (err) => { notifier.notify({ title: 'Browserify Error', message: err.message, }); gutil.log('Browserify Error', err); }) .pipe(source('crudl.js')) ...
javascript
function continuousBundle() { const bundle = b => b.bundle() .on('error', (err) => { notifier.notify({ title: 'Browserify Error', message: err.message, }); gutil.log('Browserify Error', err); }) .pipe(source('crudl.js')) ...
[ "function", "continuousBundle", "(", ")", "{", "const", "bundle", "=", "b", "=>", "b", ".", "bundle", "(", ")", ".", "on", "(", "'error'", ",", "(", "err", ")", "=>", "{", "notifier", ".", "notify", "(", "{", "title", ":", "'Browserify Error'", ",", ...
Watch for changes and bundle
[ "Watch", "for", "changes", "and", "bundle" ]
2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361
https://github.com/crudlio/crudl/blob/2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361/gulpfile.js#L47-L70
train
crudlio/crudl
gulpfile.js
bundleDevelopment
function bundleDevelopment() { const opts = assign({}, browersifyOptions, { debug: true }); const bundler = browserify(opts).transform(babelify.configure(babelifyOptions)); bundler.on('log', gutil.log); // output build logs to terminal return bundler.bundle() .on('error', (err) => { // log errors i...
javascript
function bundleDevelopment() { const opts = assign({}, browersifyOptions, { debug: true }); const bundler = browserify(opts).transform(babelify.configure(babelifyOptions)); bundler.on('log', gutil.log); // output build logs to terminal return bundler.bundle() .on('error', (err) => { // log errors i...
[ "function", "bundleDevelopment", "(", ")", "{", "const", "opts", "=", "assign", "(", "{", "}", ",", "browersifyOptions", ",", "{", "debug", ":", "true", "}", ")", ";", "const", "bundler", "=", "browserify", "(", "opts", ")", ".", "transform", "(", "bab...
Bundle the dev module
[ "Bundle", "the", "dev", "module" ]
2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361
https://github.com/crudlio/crudl/blob/2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361/gulpfile.js#L73-L87
train
crudlio/crudl
gulpfile.js
bundleProduction
function bundleProduction() { return browserify(browersifyOptions) .transform(babelify.configure(babelifyOptions)) .transform(envify({ _: 'purge', NODE_ENV: 'production' }), { global: true }) .on('log', gutil.log) .bundle() // minify .pipe(source('crudl.js')) .pipe(buffer()) .pipe(u...
javascript
function bundleProduction() { return browserify(browersifyOptions) .transform(babelify.configure(babelifyOptions)) .transform(envify({ _: 'purge', NODE_ENV: 'production' }), { global: true }) .on('log', gutil.log) .bundle() // minify .pipe(source('crudl.js')) .pipe(buffer()) .pipe(u...
[ "function", "bundleProduction", "(", ")", "{", "return", "browserify", "(", "browersifyOptions", ")", ".", "transform", "(", "babelify", ".", "configure", "(", "babelifyOptions", ")", ")", ".", "transform", "(", "envify", "(", "{", "_", ":", "'purge'", ",", ...
Bundle task for the production environment
[ "Bundle", "task", "for", "the", "production", "environment" ]
2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361
https://github.com/crudlio/crudl/blob/2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361/gulpfile.js#L90-L114
train
crudlio/crudl
gulpfile.js
sassWatch
function sassWatch() { return gulp // ... and compile if necessary .watch(sassSrcFiles, ['sass-compile']) .on('change', (event) => { gutil.log(`File ${event.path} was ${event.type}, running tasks...`); }); }
javascript
function sassWatch() { return gulp // ... and compile if necessary .watch(sassSrcFiles, ['sass-compile']) .on('change', (event) => { gutil.log(`File ${event.path} was ${event.type}, running tasks...`); }); }
[ "function", "sassWatch", "(", ")", "{", "return", "gulp", "// ... and compile if necessary", ".", "watch", "(", "sassSrcFiles", ",", "[", "'sass-compile'", "]", ")", ".", "on", "(", "'change'", ",", "(", "event", ")", "=>", "{", "gutil", ".", "log", "(", ...
Watch sass files ...
[ "Watch", "sass", "files", "..." ]
2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361
https://github.com/crudlio/crudl/blob/2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361/gulpfile.js#L129-L136
train
crudlio/crudl
src/reducers/core.js
transit
function transit(state, variable, value) { // FIXME: deep copying of the whole state can be eventually slow... const newState = cloneDeep(state) set(newState, variable, value) return newState }
javascript
function transit(state, variable, value) { // FIXME: deep copying of the whole state can be eventually slow... const newState = cloneDeep(state) set(newState, variable, value) return newState }
[ "function", "transit", "(", "state", ",", "variable", ",", "value", ")", "{", "// FIXME: deep copying of the whole state can be eventually slow...", "const", "newState", "=", "cloneDeep", "(", "state", ")", "set", "(", "newState", ",", "variable", ",", "value", ")",...
Returns a copy of the state with a new value of the given variable
[ "Returns", "a", "copy", "of", "the", "state", "with", "a", "new", "value", "of", "the", "given", "variable" ]
2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361
https://github.com/crudlio/crudl/blob/2b2e2a6cecd8a0e25f1e097c3098ebaaabe2e361/src/reducers/core.js#L28-L33
train
mongodb-js/data-service
lib/instance-detail-helper.js
getStats
function getStats(results, done) { const databases = results.databases; const keys = ['document_count', 'storage_size', 'index_count', 'index_size']; const stats = {}; keys.map(function(k) { stats[k] = 0; }); databases.map(function(db) { keys.map(function(k) { stats[k] += db[k]; }); });...
javascript
function getStats(results, done) { const databases = results.databases; const keys = ['document_count', 'storage_size', 'index_count', 'index_size']; const stats = {}; keys.map(function(k) { stats[k] = 0; }); databases.map(function(db) { keys.map(function(k) { stats[k] += db[k]; }); });...
[ "function", "getStats", "(", "results", ",", "done", ")", "{", "const", "databases", "=", "results", ".", "databases", ";", "const", "keys", "=", "[", "'document_count'", ",", "'storage_size'", ",", "'index_count'", ",", "'index_size'", "]", ";", "const", "s...
aggregates stats across all found databases @param {Object} results async.auto results @param {Function} done callback
[ "aggregates", "stats", "across", "all", "found", "databases" ]
49f0e1470df6d0675f6328a2a0a2a58ac31640e9
https://github.com/mongodb-js/data-service/blob/49f0e1470df6d0675f6328a2a0a2a58ac31640e9/lib/instance-detail-helper.js#L25-L39
train
mongodb-js/data-service
lib/instance-detail-helper.js
getInstanceDetail
function getInstanceDetail(client, db, done) { const tasks = { client: attach.bind(null, client), db: attach.bind(null, db), userInfo: ['client', 'db', getUserInfo], host: ['client', 'db', getHostInfo], build: ['client', 'db', getBuildInfo], cmdLineOpts: ['client', 'db', getCmdLineOpts], ...
javascript
function getInstanceDetail(client, db, done) { const tasks = { client: attach.bind(null, client), db: attach.bind(null, db), userInfo: ['client', 'db', getUserInfo], host: ['client', 'db', getHostInfo], build: ['client', 'db', getBuildInfo], cmdLineOpts: ['client', 'db', getCmdLineOpts], ...
[ "function", "getInstanceDetail", "(", "client", ",", "db", ",", "done", ")", "{", "const", "tasks", "=", "{", "client", ":", "attach", ".", "bind", "(", "null", ",", "client", ")", ",", "db", ":", "attach", ".", "bind", "(", "null", ",", "db", ")",...
Retrieves many instance details, such as the build and host info, databases and collections which the user has access to. @param {MongoClient} client - The client. @param {DB} db - database handle from the node driver @param {Function} done - callback
[ "Retrieves", "many", "instance", "details", "such", "as", "the", "build", "and", "host", "info", "databases", "and", "collections", "which", "the", "user", "has", "access", "to", "." ]
49f0e1470df6d0675f6328a2a0a2a58ac31640e9
https://github.com/mongodb-js/data-service/blob/49f0e1470df6d0675f6328a2a0a2a58ac31640e9/lib/instance-detail-helper.js#L549-L602
train
reaktor/express-gauth
index.js
saveReturnUrlToSession
function saveReturnUrlToSession(req, isReturnUrlAllowed) { const referrer = req.get("referrer") const isInternalRequest = Boolean( referrer && url.parse(referrer).hostname === req.hostname ) const isUrlAllowed = isReturnUrlAllowed(req.originalUrl) const isSessionSet = Boolean(req.session && req.session.r...
javascript
function saveReturnUrlToSession(req, isReturnUrlAllowed) { const referrer = req.get("referrer") const isInternalRequest = Boolean( referrer && url.parse(referrer).hostname === req.hostname ) const isUrlAllowed = isReturnUrlAllowed(req.originalUrl) const isSessionSet = Boolean(req.session && req.session.r...
[ "function", "saveReturnUrlToSession", "(", "req", ",", "isReturnUrlAllowed", ")", "{", "const", "referrer", "=", "req", ".", "get", "(", "\"referrer\"", ")", "const", "isInternalRequest", "=", "Boolean", "(", "referrer", "&&", "url", ".", "parse", "(", "referr...
Browser might try to fetch assets already before the "main request" reaches our server. We must tell apart these locations from where the user really tries to go. Also, we should set returnTo only once per session.
[ "Browser", "might", "try", "to", "fetch", "assets", "already", "before", "the", "main", "request", "reaches", "our", "server", ".", "We", "must", "tell", "apart", "these", "locations", "from", "where", "the", "user", "really", "tries", "to", "go", ".", "Al...
d23d86d65f68b695431ce99840e7ea7311c0b675
https://github.com/reaktor/express-gauth/blob/d23d86d65f68b695431ce99840e7ea7311c0b675/index.js#L175-L189
train
mongodb-js/runner
lib/index.js
stop
function stop(opts, done) { debug('stopping...'); killIfRunning(opts, function(err) { debug('Any running workers have been sent a stop command'); done(err); }); }
javascript
function stop(opts, done) { debug('stopping...'); killIfRunning(opts, function(err) { debug('Any running workers have been sent a stop command'); done(err); }); }
[ "function", "stop", "(", "opts", ",", "done", ")", "{", "debug", "(", "'stopping...'", ")", ";", "killIfRunning", "(", "opts", ",", "function", "(", "err", ")", "{", "debug", "(", "'Any running workers have been sent a stop command'", ")", ";", "done", "(", ...
Cleans up artifacts from this specific run and then kills the process. @param {Object} opts @param {Function} done @api private
[ "Cleans", "up", "artifacts", "from", "this", "specific", "run", "and", "then", "kills", "the", "process", "." ]
a1b17754a6d079e9059e0d9b9d7efe709c8b0d08
https://github.com/mongodb-js/runner/blob/a1b17754a6d079e9059e0d9b9d7efe709c8b0d08/lib/index.js#L254-L261
train
mongodb-js/runner
lib/index.js
configure
function configure(opts, done) { delete opts._; opts = defaults(opts, { topology: process.env.MONGODB_TOPOLOGY || 'standalone' }); opts = defaults(opts, { name: opts.topology }); opts = defaults(opts, { logpath: untildify( process.env.MONGODB_LOGPATH || format('~/.mongodb/runner...
javascript
function configure(opts, done) { delete opts._; opts = defaults(opts, { topology: process.env.MONGODB_TOPOLOGY || 'standalone' }); opts = defaults(opts, { name: opts.topology }); opts = defaults(opts, { logpath: untildify( process.env.MONGODB_LOGPATH || format('~/.mongodb/runner...
[ "function", "configure", "(", "opts", ",", "done", ")", "{", "delete", "opts", ".", "_", ";", "opts", "=", "defaults", "(", "opts", ",", "{", "topology", ":", "process", ".", "env", ".", "MONGODB_TOPOLOGY", "||", "'standalone'", "}", ")", ";", "opts", ...
Populate `opts` as specified by environment specifies or defaults. TODO (imlucas): Document options. @param {Object} opts - user specified options @param {Function} done - callback @api private
[ "Populate", "opts", "as", "specified", "by", "environment", "specifies", "or", "defaults", "." ]
a1b17754a6d079e9059e0d9b9d7efe709c8b0d08
https://github.com/mongodb-js/runner/blob/a1b17754a6d079e9059e0d9b9d7efe709c8b0d08/lib/index.js#L316-L381
train
mongodb-js/runner
mocha/before.js
mongodb_runner_mocha_before
function mongodb_runner_mocha_before(opts) { if (typeof opts === 'function') { // So you can just do `before(require('mongodb-runner/mocha/before'));` return mongodb_runner_mocha_before({}).apply(this, arguments); } opts = opts || {}; defaults(opts, { port: 27017, timeout: 10000, slow: 10000...
javascript
function mongodb_runner_mocha_before(opts) { if (typeof opts === 'function') { // So you can just do `before(require('mongodb-runner/mocha/before'));` return mongodb_runner_mocha_before({}).apply(this, arguments); } opts = opts || {}; defaults(opts, { port: 27017, timeout: 10000, slow: 10000...
[ "function", "mongodb_runner_mocha_before", "(", "opts", ")", "{", "if", "(", "typeof", "opts", "===", "'function'", ")", "{", "// So you can just do `before(require('mongodb-runner/mocha/before'));`", "return", "mongodb_runner_mocha_before", "(", "{", "}", ")", ".", "appl...
Start MongoDB on demand before running your tests. @example describe('my app', function(){ before(require('mongodb-runner/mocha/before'); it('should connect', function(done){ require('mongodb').connect('mongodb://localhost:27017/', done); }); }); @param {Object|Function} [opts] - options or the `done` callback. @retur...
[ "Start", "MongoDB", "on", "demand", "before", "running", "your", "tests", "." ]
a1b17754a6d079e9059e0d9b9d7efe709c8b0d08
https://github.com/mongodb-js/runner/blob/a1b17754a6d079e9059e0d9b9d7efe709c8b0d08/mocha/before.js#L20-L73
train
mongodb-js/runner
mocha/after.js
mongodb_runner_mocha_after
function mongodb_runner_mocha_after(opts) { if (typeof opts === 'function') { // So you can just do `after(require('mongodb-runner/mocha/after'));` return mongodb_runner_mocha_after({}).apply(this, arguments); } opts = opts || {}; defaults(opts, { port: 27017 }); return function(done) { if ...
javascript
function mongodb_runner_mocha_after(opts) { if (typeof opts === 'function') { // So you can just do `after(require('mongodb-runner/mocha/after'));` return mongodb_runner_mocha_after({}).apply(this, arguments); } opts = opts || {}; defaults(opts, { port: 27017 }); return function(done) { if ...
[ "function", "mongodb_runner_mocha_after", "(", "opts", ")", "{", "if", "(", "typeof", "opts", "===", "'function'", ")", "{", "// So you can just do `after(require('mongodb-runner/mocha/after'));`", "return", "mongodb_runner_mocha_after", "(", "{", "}", ")", ".", "apply", ...
Stop MongoDB on demand after running your tests. @example describe('my app', function(){ before(require('mongodb-runner/mocha/before')); after(require('mongodb-runner/mocha/after')); it('should connect', function(done){ require('mongodb').connect('mongodb://localhost:27017/', done); }); }); @param {Object|Function} [o...
[ "Stop", "MongoDB", "on", "demand", "after", "running", "your", "tests", "." ]
a1b17754a6d079e9059e0d9b9d7efe709c8b0d08
https://github.com/mongodb-js/runner/blob/a1b17754a6d079e9059e0d9b9d7efe709c8b0d08/mocha/after.js#L20-L43
train
salesforce/global-tunnel
index.js
tryParse
function tryParse(url) { if (!url) { return null; } var conf = {}; var parsed = urlParse(url); conf.protocol = parsed.protocol; conf.host = parsed.hostname; conf.port = parseInt(parsed.port,10); return conf; }
javascript
function tryParse(url) { if (!url) { return null; } var conf = {}; var parsed = urlParse(url); conf.protocol = parsed.protocol; conf.host = parsed.hostname; conf.port = parseInt(parsed.port,10); return conf; }
[ "function", "tryParse", "(", "url", ")", "{", "if", "(", "!", "url", ")", "{", "return", "null", ";", "}", "var", "conf", "=", "{", "}", ";", "var", "parsed", "=", "urlParse", "(", "url", ")", ";", "conf", ".", "protocol", "=", "parsed", ".", "...
Parses the de facto `http_proxy` environment.
[ "Parses", "the", "de", "facto", "http_proxy", "environment", "." ]
d7feb2ec25029527d2debb21e087db058434b62b
https://github.com/salesforce/global-tunnel/blob/d7feb2ec25029527d2debb21e087db058434b62b/index.js#L33-L44
train
salesforce/global-tunnel
lib/agents.js
mixinProxying
function mixinProxying(agent, proxyOpts) { agent.proxy = proxyOpts; var orig = _.pick(agent, 'createConnection', 'addRequest'); // Make the tcp or tls connection go to the proxy, ignoring the // destination host:port arguments. agent.createConnection = function(port, host, options) { return orig.createC...
javascript
function mixinProxying(agent, proxyOpts) { agent.proxy = proxyOpts; var orig = _.pick(agent, 'createConnection', 'addRequest'); // Make the tcp or tls connection go to the proxy, ignoring the // destination host:port arguments. agent.createConnection = function(port, host, options) { return orig.createC...
[ "function", "mixinProxying", "(", "agent", ",", "proxyOpts", ")", "{", "agent", ".", "proxy", "=", "proxyOpts", ";", "var", "orig", "=", "_", ".", "pick", "(", "agent", ",", "'createConnection'", ",", "'addRequest'", ")", ";", "// Make the tcp or tls connectio...
Override createConnection and addRequest methods on the supplied agent. http.Agent and https.Agent will set up createConnection in the constructor.
[ "Override", "createConnection", "and", "addRequest", "methods", "on", "the", "supplied", "agent", ".", "http", ".", "Agent", "and", "https", ".", "Agent", "will", "set", "up", "createConnection", "in", "the", "constructor", "." ]
d7feb2ec25029527d2debb21e087db058434b62b
https://github.com/salesforce/global-tunnel/blob/d7feb2ec25029527d2debb21e087db058434b62b/lib/agents.js#L36-L57
train
AmpersandJS/ampersand-view
ampersand-view.js
function () { if (this.el && this.el.parentNode) this.el.parentNode.removeChild(this.el); this._rendered = false; this._downsertBindings(); return this; }
javascript
function () { if (this.el && this.el.parentNode) this.el.parentNode.removeChild(this.el); this._rendered = false; this._downsertBindings(); return this; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "el", "&&", "this", ".", "el", ".", "parentNode", ")", "this", ".", "el", ".", "parentNode", ".", "removeChild", "(", "this", ".", "el", ")", ";", "this", ".", "_rendered", "=", "false", ";", "th...
Removes this view by taking the element out of the DOM, and removing any applicable events listeners.
[ "Removes", "this", "view", "by", "taking", "the", "element", "out", "of", "the", "DOM", "and", "removing", "any", "applicable", "events", "listeners", "." ]
283b599dafbfcc3736730758aa9c19b281a77187
https://github.com/AmpersandJS/ampersand-view/blob/283b599dafbfcc3736730758aa9c19b281a77187/ampersand-view.js#L157-L162
train
AmpersandJS/ampersand-view
ampersand-view.js
function (context, templateArg) { var template = templateArg || this.template; if (!template) throw new Error('Template string or function needed.'); var newDom = isString(template) ? template : template.call(this, context || this); if (isString(newDom)) newDom = domify(newDom); ...
javascript
function (context, templateArg) { var template = templateArg || this.template; if (!template) throw new Error('Template string or function needed.'); var newDom = isString(template) ? template : template.call(this, context || this); if (isString(newDom)) newDom = domify(newDom); ...
[ "function", "(", "context", ",", "templateArg", ")", "{", "var", "template", "=", "templateArg", "||", "this", ".", "template", ";", "if", "(", "!", "template", ")", "throw", "new", "Error", "(", "'Template string or function needed.'", ")", ";", "var", "new...
Shortcut for doing everything we need to do to render and fully replace current root element. Either define a `template` property of your view or pass in a template directly. The template can either be a string or a function. If it's a function it will be passed the `context` argument.
[ "Shortcut", "for", "doing", "everything", "we", "need", "to", "do", "to", "render", "and", "fully", "replace", "current", "root", "element", ".", "Either", "define", "a", "template", "property", "of", "your", "view", "or", "pass", "in", "a", "template", "d...
283b599dafbfcc3736730758aa9c19b281a77187
https://github.com/AmpersandJS/ampersand-view/blob/283b599dafbfcc3736730758aa9c19b281a77187/ampersand-view.js#L319-L329
train
apiaryio/fury-adapter-swagger
src/json-schema.js
checkSchemaHasReferences
function checkSchemaHasReferences(schema) { if (schema.$ref) { return true; } return Object.values(schema).some((value) => { if (_.isArray(value)) { return value.some(checkSchemaHasReferences); } else if (_.isObject(value)) { return checkSchemaHasReferences(value); } return false...
javascript
function checkSchemaHasReferences(schema) { if (schema.$ref) { return true; } return Object.values(schema).some((value) => { if (_.isArray(value)) { return value.some(checkSchemaHasReferences); } else if (_.isObject(value)) { return checkSchemaHasReferences(value); } return false...
[ "function", "checkSchemaHasReferences", "(", "schema", ")", "{", "if", "(", "schema", ".", "$ref", ")", "{", "return", "true", ";", "}", "return", "Object", ".", "values", "(", "schema", ")", ".", "some", "(", "(", "value", ")", "=>", "{", "if", "(",...
Returns true if the given schema contains any references
[ "Returns", "true", "if", "the", "given", "schema", "contains", "any", "references" ]
cc772bbd1ba10fdc61de0e5c069a5ab5abfcefa5
https://github.com/apiaryio/fury-adapter-swagger/blob/cc772bbd1ba10fdc61de0e5c069a5ab5abfcefa5/src/json-schema.js#L212-L226
train
apiaryio/fury-adapter-swagger
src/json-schema.js
findReferences
function findReferences(schema) { if (schema.$ref) { return [schema.$ref]; } let references = []; if (schema.allOf) { references = references.concat(...schema.allOf.map(findReferences)); } if (schema.anyOf) { references = references.concat(...schema.anyOf.map(findReferences)); } if (sche...
javascript
function findReferences(schema) { if (schema.$ref) { return [schema.$ref]; } let references = []; if (schema.allOf) { references = references.concat(...schema.allOf.map(findReferences)); } if (schema.anyOf) { references = references.concat(...schema.anyOf.map(findReferences)); } if (sche...
[ "function", "findReferences", "(", "schema", ")", "{", "if", "(", "schema", ".", "$ref", ")", "{", "return", "[", "schema", ".", "$ref", "]", ";", "}", "let", "references", "=", "[", "]", ";", "if", "(", "schema", ".", "allOf", ")", "{", "reference...
Traverses the entire schema to find all of the references @returns array of each reference that is found in the schema
[ "Traverses", "the", "entire", "schema", "to", "find", "all", "of", "the", "references" ]
cc772bbd1ba10fdc61de0e5c069a5ab5abfcefa5
https://github.com/apiaryio/fury-adapter-swagger/blob/cc772bbd1ba10fdc61de0e5c069a5ab5abfcefa5/src/json-schema.js#L231-L287
train
abhishekkyd/protractor-html-reporter-2
lib/protractor-xml2html-reporter.js
getTime
function getTime(time) { var hours = Math.floor(time/3600); var minutes = Math.floor(time % 3600/60); var seconds = (time % 3600) % 60; return hours + 'h ' + minutes + 'min ' + seconds + 's'; }
javascript
function getTime(time) { var hours = Math.floor(time/3600); var minutes = Math.floor(time % 3600/60); var seconds = (time % 3600) % 60; return hours + 'h ' + minutes + 'min ' + seconds + 's'; }
[ "function", "getTime", "(", "time", ")", "{", "var", "hours", "=", "Math", ".", "floor", "(", "time", "/", "3600", ")", ";", "var", "minutes", "=", "Math", ".", "floor", "(", "time", "%", "3600", "/", "60", ")", ";", "var", "seconds", "=", "(", ...
time passed in seconds
[ "time", "passed", "in", "seconds" ]
c053ffc00510496375d950d284e53b44f4614b33
https://github.com/abhishekkyd/protractor-html-reporter-2/blob/c053ffc00510496375d950d284e53b44f4614b33/lib/protractor-xml2html-reporter.js#L73-L79
train
openpgpjs/web-stream-tools
lib/util.js
isStream
function isStream(input) { if (ReadableStream.prototype.isPrototypeOf(input)) { return 'web'; } if (NodeReadableStream && NodeReadableStream.prototype.isPrototypeOf(input)) { return 'node'; } return false; }
javascript
function isStream(input) { if (ReadableStream.prototype.isPrototypeOf(input)) { return 'web'; } if (NodeReadableStream && NodeReadableStream.prototype.isPrototypeOf(input)) { return 'node'; } return false; }
[ "function", "isStream", "(", "input", ")", "{", "if", "(", "ReadableStream", ".", "prototype", ".", "isPrototypeOf", "(", "input", ")", ")", "{", "return", "'web'", ";", "}", "if", "(", "NodeReadableStream", "&&", "NodeReadableStream", ".", "prototype", ".",...
Check whether data is a Stream, and if so of which type @param {Any} input data to check @returns {'web'|'node'|false}
[ "Check", "whether", "data", "is", "a", "Stream", "and", "if", "so", "of", "which", "type" ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/util.js#L8-L16
train
feedhenry/fh-mbaas-api
lib/push.js
getPushSettings
function getPushSettings(opts) { assert.ok(opts, 'opts is undefined'); var headers = { 'X-Project-Id': opts.widget, 'X-App-Id': opts.instance }; fhutils.addAppApiKeyHeader(headers, opts.appapikey); return { url: 'https://' + opts.millicore + ':' + opts.port + '/box/api/unifiedpu...
javascript
function getPushSettings(opts) { assert.ok(opts, 'opts is undefined'); var headers = { 'X-Project-Id': opts.widget, 'X-App-Id': opts.instance }; fhutils.addAppApiKeyHeader(headers, opts.appapikey); return { url: 'https://' + opts.millicore + ':' + opts.port + '/box/api/unifiedpu...
[ "function", "getPushSettings", "(", "opts", ")", "{", "assert", ".", "ok", "(", "opts", ",", "'opts is undefined'", ")", ";", "var", "headers", "=", "{", "'X-Project-Id'", ":", "opts", ".", "widget", ",", "'X-App-Id'", ":", "opts", ".", "instance", "}", ...
Generates settings to the used when creating an AeroGear.sender. @param {Object} opts [description] @return {Object}
[ "Generates", "settings", "to", "the", "used", "when", "creating", "an", "AeroGear", ".", "sender", "." ]
3bd60e54a34f216d5f2d35a31f3e4b96ae19956e
https://github.com/feedhenry/fh-mbaas-api/blob/3bd60e54a34f216d5f2d35a31f3e4b96ae19956e/lib/push.js#L17-L33
train
openpgpjs/web-stream-tools
lib/streams.js
toStream
function toStream(input) { let streamType = isStream(input); if (streamType === 'node') { return nodeToWeb(input); } else if (streamType) { return input; } return new ReadableStream({ start(controller) { controller.enqueue(input); controller.close(); } }); }
javascript
function toStream(input) { let streamType = isStream(input); if (streamType === 'node') { return nodeToWeb(input); } else if (streamType) { return input; } return new ReadableStream({ start(controller) { controller.enqueue(input); controller.close(); } }); }
[ "function", "toStream", "(", "input", ")", "{", "let", "streamType", "=", "isStream", "(", "input", ")", ";", "if", "(", "streamType", "===", "'node'", ")", "{", "return", "nodeToWeb", "(", "input", ")", ";", "}", "else", "if", "(", "streamType", ")", ...
Convert data to Stream @param {ReadableStream|Uint8array|String} input data to convert @returns {ReadableStream} Converted data
[ "Convert", "data", "to", "Stream" ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L12-L25
train
openpgpjs/web-stream-tools
lib/streams.js
concat
function concat(list) { if (list.some(isStream)) { return concatStream(list); } if (typeof list[0] === 'string') { return list.join(''); } if (NodeBuffer && NodeBuffer.isBuffer(list[0])) { return NodeBuffer.concat(list); } return concatUint8Array(list); }
javascript
function concat(list) { if (list.some(isStream)) { return concatStream(list); } if (typeof list[0] === 'string') { return list.join(''); } if (NodeBuffer && NodeBuffer.isBuffer(list[0])) { return NodeBuffer.concat(list); } return concatUint8Array(list); }
[ "function", "concat", "(", "list", ")", "{", "if", "(", "list", ".", "some", "(", "isStream", ")", ")", "{", "return", "concatStream", "(", "list", ")", ";", "}", "if", "(", "typeof", "list", "[", "0", "]", "===", "'string'", ")", "{", "return", ...
Concat a list of Uint8Arrays, Strings or Streams The caller should not mix Uint8Arrays with Strings, but may mix Streams with non-Streams. @param {Array<Uint8array|String|ReadableStream>} Array of Uint8Arrays/Strings/Streams to concatenate @returns {Uint8array|String|ReadableStream} Concatenated array
[ "Concat", "a", "list", "of", "Uint8Arrays", "Strings", "or", "Streams", "The", "caller", "should", "not", "mix", "Uint8Arrays", "with", "Strings", "but", "may", "mix", "Streams", "with", "non", "-", "Streams", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L33-L44
train
openpgpjs/web-stream-tools
lib/streams.js
concatStream
function concatStream(list) { list = list.map(toStream); const transform = transformWithCancel(async function(reason) { await Promise.all(transforms.map(stream => cancel(stream, reason))); }); let prev = Promise.resolve(); const transforms = list.map((stream, i) => transformPair(stream, (readable, writabl...
javascript
function concatStream(list) { list = list.map(toStream); const transform = transformWithCancel(async function(reason) { await Promise.all(transforms.map(stream => cancel(stream, reason))); }); let prev = Promise.resolve(); const transforms = list.map((stream, i) => transformPair(stream, (readable, writabl...
[ "function", "concatStream", "(", "list", ")", "{", "list", "=", "list", ".", "map", "(", "toStream", ")", ";", "const", "transform", "=", "transformWithCancel", "(", "async", "function", "(", "reason", ")", "{", "await", "Promise", ".", "all", "(", "tran...
Concat a list of Streams @param {Array<ReadableStream|Uint8array|String>} list Array of Uint8Arrays/Strings/Streams to concatenate @returns {ReadableStream} Concatenated list
[ "Concat", "a", "list", "of", "Streams" ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L51-L64
train
openpgpjs/web-stream-tools
lib/streams.js
getWriter
function getWriter(input) { const writer = input.getWriter(); const releaseLock = writer.releaseLock; writer.releaseLock = () => { writer.closed.catch(function() {}); releaseLock.call(writer); }; return writer; }
javascript
function getWriter(input) { const writer = input.getWriter(); const releaseLock = writer.releaseLock; writer.releaseLock = () => { writer.closed.catch(function() {}); releaseLock.call(writer); }; return writer; }
[ "function", "getWriter", "(", "input", ")", "{", "const", "writer", "=", "input", ".", "getWriter", "(", ")", ";", "const", "releaseLock", "=", "writer", ".", "releaseLock", ";", "writer", ".", "releaseLock", "=", "(", ")", "=>", "{", "writer", ".", "c...
Get a Writer @param {WritableStream} input @returns {WritableStreamDefaultWriter}
[ "Get", "a", "Writer" ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L80-L88
train
openpgpjs/web-stream-tools
lib/streams.js
pipe
async function pipe(input, target, options) { input = toStream(input); try { if (input[externalBuffer]) { const writer = getWriter(target); for (let i = 0; i < input[externalBuffer].length; i++) { await writer.ready; await writer.write(input[externalBuffer][i]); } writer....
javascript
async function pipe(input, target, options) { input = toStream(input); try { if (input[externalBuffer]) { const writer = getWriter(target); for (let i = 0; i < input[externalBuffer].length; i++) { await writer.ready; await writer.write(input[externalBuffer][i]); } writer....
[ "async", "function", "pipe", "(", "input", ",", "target", ",", "options", ")", "{", "input", "=", "toStream", "(", "input", ")", ";", "try", "{", "if", "(", "input", "[", "externalBuffer", "]", ")", "{", "const", "writer", "=", "getWriter", "(", "tar...
Pipe a readable stream to a writable stream. Don't throw on input stream errors, but forward them to the output stream. @param {ReadableStream|Uint8array|String} input @param {WritableStream} target @param {Object} (optional) options @returns {Promise<undefined>} Promise indicating when piping has finished (input strea...
[ "Pipe", "a", "readable", "stream", "to", "a", "writable", "stream", ".", "Don", "t", "throw", "on", "input", "stream", "errors", "but", "forward", "them", "to", "the", "output", "stream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L98-L111
train
openpgpjs/web-stream-tools
lib/streams.js
transformRaw
function transformRaw(input, options) { const transformStream = new TransformStream(options); pipe(input, transformStream.writable); return transformStream.readable; }
javascript
function transformRaw(input, options) { const transformStream = new TransformStream(options); pipe(input, transformStream.writable); return transformStream.readable; }
[ "function", "transformRaw", "(", "input", ",", "options", ")", "{", "const", "transformStream", "=", "new", "TransformStream", "(", "options", ")", ";", "pipe", "(", "input", ",", "transformStream", ".", "writable", ")", ";", "return", "transformStream", ".", ...
Pipe a readable stream through a transform stream. @param {ReadableStream|Uint8array|String} input @param {Object} (optional) options @returns {ReadableStream} transformed stream
[ "Pipe", "a", "readable", "stream", "through", "a", "transform", "stream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L119-L123
train
openpgpjs/web-stream-tools
lib/streams.js
transformWithCancel
function transformWithCancel(cancel) { let pulled = false; let backpressureChangePromiseResolve; let outputController; return { readable: new ReadableStream({ start(controller) { outputController = controller; }, pull() { if (backpressureChangePromiseResolve) { ba...
javascript
function transformWithCancel(cancel) { let pulled = false; let backpressureChangePromiseResolve; let outputController; return { readable: new ReadableStream({ start(controller) { outputController = controller; }, pull() { if (backpressureChangePromiseResolve) { ba...
[ "function", "transformWithCancel", "(", "cancel", ")", "{", "let", "pulled", "=", "false", ";", "let", "backpressureChangePromiseResolve", ";", "let", "outputController", ";", "return", "{", "readable", ":", "new", "ReadableStream", "(", "{", "start", "(", "cont...
Create a cancelable TransformStream. @param {Function} cancel @returns {TransformStream}
[ "Create", "a", "cancelable", "TransformStream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L130-L164
train
openpgpjs/web-stream-tools
lib/streams.js
transform
function transform(input, process = () => undefined, finish = () => undefined) { if (isStream(input)) { return transformRaw(input, { async transform(value, controller) { try { const result = await process(value); if (result !== undefined) controller.enqueue(result); } cat...
javascript
function transform(input, process = () => undefined, finish = () => undefined) { if (isStream(input)) { return transformRaw(input, { async transform(value, controller) { try { const result = await process(value); if (result !== undefined) controller.enqueue(result); } cat...
[ "function", "transform", "(", "input", ",", "process", "=", "(", ")", "=>", "undefined", ",", "finish", "=", "(", ")", "=>", "undefined", ")", "{", "if", "(", "isStream", "(", "input", ")", ")", "{", "return", "transformRaw", "(", "input", ",", "{", ...
Transform a stream using helper functions which are called on each chunk, and on stream close, respectively. @param {ReadableStream|Uint8array|String} input @param {Function} process @param {Function} finish @returns {ReadableStream|Uint8array|String}
[ "Transform", "a", "stream", "using", "helper", "functions", "which", "are", "called", "on", "each", "chunk", "and", "on", "stream", "close", "respectively", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L173-L198
train
openpgpjs/web-stream-tools
lib/streams.js
transformPair
function transformPair(input, fn) { let incomingTransformController; const incoming = new TransformStream({ start(controller) { incomingTransformController = controller; } }); const pipeDonePromise = pipe(input, incoming.writable); const outgoing = transformWithCancel(async function() { in...
javascript
function transformPair(input, fn) { let incomingTransformController; const incoming = new TransformStream({ start(controller) { incomingTransformController = controller; } }); const pipeDonePromise = pipe(input, incoming.writable); const outgoing = transformWithCancel(async function() { in...
[ "function", "transformPair", "(", "input", ",", "fn", ")", "{", "let", "incomingTransformController", ";", "const", "incoming", "=", "new", "TransformStream", "(", "{", "start", "(", "controller", ")", "{", "incomingTransformController", "=", "controller", ";", ...
Transform a stream using a helper function which is passed a readable and a writable stream. This function also maintains the possibility to cancel the input stream, and does so on cancelation of the output stream, despite cancelation normally being impossible when the input stream is being read from. @param {ReadableS...
[ "Transform", "a", "stream", "using", "a", "helper", "function", "which", "is", "passed", "a", "readable", "and", "a", "writable", "stream", ".", "This", "function", "also", "maintains", "the", "possibility", "to", "cancel", "the", "input", "stream", "and", "...
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L209-L226
train
openpgpjs/web-stream-tools
lib/streams.js
passiveClone
function passiveClone(input) { if (isStream(input)) { return new ReadableStream({ start(controller) { const transformed = transformPair(input, async (readable, writable) => { const reader = getReader(readable); const writer = getWriter(writable); try { while...
javascript
function passiveClone(input) { if (isStream(input)) { return new ReadableStream({ start(controller) { const transformed = transformPair(input, async (readable, writable) => { const reader = getReader(readable); const writer = getWriter(writable); try { while...
[ "function", "passiveClone", "(", "input", ")", "{", "if", "(", "isStream", "(", "input", ")", ")", "{", "return", "new", "ReadableStream", "(", "{", "start", "(", "controller", ")", "{", "const", "transformed", "=", "transformPair", "(", "input", ",", "a...
Clone a Stream for reading it twice. Data will arrive at the same rate as the input stream is being read. Reading from the clone will NOT pull from the input stream. Data only arrives when reading the input stream. The input stream will NOT be canceled if the clone is canceled, only if the input stream are canceled. If...
[ "Clone", "a", "Stream", "for", "reading", "it", "twice", ".", "Data", "will", "arrive", "at", "the", "same", "rate", "as", "the", "input", "stream", "is", "being", "read", ".", "Reading", "from", "the", "clone", "will", "NOT", "pull", "from", "the", "i...
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L291-L320
train
openpgpjs/web-stream-tools
lib/streams.js
slice
function slice(input, begin=0, end=Infinity) { if (isStream(input)) { if (begin >= 0 && end >= 0) { let bytesRead = 0; return transformRaw(input, { transform(value, controller) { if (bytesRead < end) { if (bytesRead + value.length >= begin) { controller.enqu...
javascript
function slice(input, begin=0, end=Infinity) { if (isStream(input)) { if (begin >= 0 && end >= 0) { let bytesRead = 0; return transformRaw(input, { transform(value, controller) { if (bytesRead < end) { if (bytesRead + value.length >= begin) { controller.enqu...
[ "function", "slice", "(", "input", ",", "begin", "=", "0", ",", "end", "=", "Infinity", ")", "{", "if", "(", "isStream", "(", "input", ")", ")", "{", "if", "(", "begin", ">=", "0", "&&", "end", ">=", "0", ")", "{", "let", "bytesRead", "=", "0",...
Return a stream pointing to a part of the input stream. @param {ReadableStream|Uint8array|String} input @returns {ReadableStream|Uint8array|String} clone
[ "Return", "a", "stream", "pointing", "to", "a", "part", "of", "the", "input", "stream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L348-L395
train
openpgpjs/web-stream-tools
lib/streams.js
cancel
async function cancel(input, reason) { if (isStream(input) && input.cancel) { return input.cancel(reason); } }
javascript
async function cancel(input, reason) { if (isStream(input) && input.cancel) { return input.cancel(reason); } }
[ "async", "function", "cancel", "(", "input", ",", "reason", ")", "{", "if", "(", "isStream", "(", "input", ")", "&&", "input", ".", "cancel", ")", "{", "return", "input", ".", "cancel", "(", "reason", ")", ";", "}", "}" ]
Cancel a stream. @param {ReadableStream|Uint8array|String} input @param {Any} reason @returns {Promise<Any>} indicates when the stream has been canceled @async
[ "Cancel", "a", "stream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L418-L422
train
openpgpjs/web-stream-tools
lib/streams.js
fromAsync
function fromAsync(fn) { return new ReadableStream({ pull: async controller => { try { controller.enqueue(await fn()); controller.close(); } catch(e) { controller.error(e); } } }); }
javascript
function fromAsync(fn) { return new ReadableStream({ pull: async controller => { try { controller.enqueue(await fn()); controller.close(); } catch(e) { controller.error(e); } } }); }
[ "function", "fromAsync", "(", "fn", ")", "{", "return", "new", "ReadableStream", "(", "{", "pull", ":", "async", "controller", "=>", "{", "try", "{", "controller", ".", "enqueue", "(", "await", "fn", "(", ")", ")", ";", "controller", ".", "close", "(",...
Convert an async function to a Stream. When the function returns, its return value is enqueued to the stream. @param {Function} fn @returns {ReadableStream}
[ "Convert", "an", "async", "function", "to", "a", "Stream", ".", "When", "the", "function", "returns", "its", "return", "value", "is", "enqueued", "to", "the", "stream", "." ]
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/streams.js#L429-L440
train
feedhenry/fh-mbaas-api
lib/db.js
mongoConnectionStringOS3
function mongoConnectionStringOS3(cb) { debug('Running in OpenShift 3, requesting db connection string from MBaaS'); mbaasClient.app.databaseConnectionString({ "domain": config.fhmbaas.domain, "environment": config.fhmbaas.environment }, function retrieved(err, resp) { if (err) { return cb(err)...
javascript
function mongoConnectionStringOS3(cb) { debug('Running in OpenShift 3, requesting db connection string from MBaaS'); mbaasClient.app.databaseConnectionString({ "domain": config.fhmbaas.domain, "environment": config.fhmbaas.environment }, function retrieved(err, resp) { if (err) { return cb(err)...
[ "function", "mongoConnectionStringOS3", "(", "cb", ")", "{", "debug", "(", "'Running in OpenShift 3, requesting db connection string from MBaaS'", ")", ";", "mbaasClient", ".", "app", ".", "databaseConnectionString", "(", "{", "\"domain\"", ":", "config", ".", "fhmbaas", ...
use mbaas client set process.env.FH_MONGODB_CONN_URL to cache it
[ "use", "mbaas", "client", "set", "process", ".", "env", ".", "FH_MONGODB_CONN_URL", "to", "cache", "it" ]
3bd60e54a34f216d5f2d35a31f3e4b96ae19956e
https://github.com/feedhenry/fh-mbaas-api/blob/3bd60e54a34f216d5f2d35a31f3e4b96ae19956e/lib/db.js#L46-L59
train
feedhenry/fh-mbaas-api
lib/forms/index.js
findFieldDefinition
function findFieldDefinition() { var foundField; if (!(params.fieldId || params.fieldCode)) { return undefined; } //Iterating through each of the pages to find a matching field. _.each(self.form.pages, function(page) { _.each(page.fields, function(field) { var fieldId = field._i...
javascript
function findFieldDefinition() { var foundField; if (!(params.fieldId || params.fieldCode)) { return undefined; } //Iterating through each of the pages to find a matching field. _.each(self.form.pages, function(page) { _.each(page.fields, function(field) { var fieldId = field._i...
[ "function", "findFieldDefinition", "(", ")", "{", "var", "foundField", ";", "if", "(", "!", "(", "params", ".", "fieldId", "||", "params", ".", "fieldCode", ")", ")", "{", "return", "undefined", ";", "}", "//Iterating through each of the pages to find a matching f...
Finding the JSON definition of a field to add data to.
[ "Finding", "the", "JSON", "definition", "of", "a", "field", "to", "add", "data", "to", "." ]
3bd60e54a34f216d5f2d35a31f3e4b96ae19956e
https://github.com/feedhenry/fh-mbaas-api/blob/3bd60e54a34f216d5f2d35a31f3e4b96ae19956e/lib/forms/index.js#L243-L262
train
feedhenry/fh-mbaas-api
lib/forms/index.js
processInputValue
function processInputValue() { var value = params.value; var index = params.index || 0; var fieldType = field.type; //Checking for a value. if (typeof(value) === "undefined" || value === null) { return "No value entered."; } /** * File-base fields (photo, signature and file) nee...
javascript
function processInputValue() { var value = params.value; var index = params.index || 0; var fieldType = field.type; //Checking for a value. if (typeof(value) === "undefined" || value === null) { return "No value entered."; } /** * File-base fields (photo, signature and file) nee...
[ "function", "processInputValue", "(", ")", "{", "var", "value", "=", "params", ".", "value", ";", "var", "index", "=", "params", ".", "index", "||", "0", ";", "var", "fieldType", "=", "field", ".", "type", ";", "//Checking for a value.", "if", "(", "type...
Adding a value to an index. Most inputs are validated by the rules engine, but file inputs need to be a file location on the local app. It is advisible to download the file to local storage first. @returns {error/undefined}
[ "Adding", "a", "value", "to", "an", "index", ".", "Most", "inputs", "are", "validated", "by", "the", "rules", "engine", "but", "file", "inputs", "need", "to", "be", "a", "file", "location", "on", "the", "local", "app", ".", "It", "is", "advisible", "to...
3bd60e54a34f216d5f2d35a31f3e4b96ae19956e
https://github.com/feedhenry/fh-mbaas-api/blob/3bd60e54a34f216d5f2d35a31f3e4b96ae19956e/lib/forms/index.js#L270-L315
train
feedhenry/fh-mbaas-api
lib/api.js
FHapi
function FHapi(cfg) { var api = { getVersion: function() { //Getting The Version of fh-mbaas-api return packageJSON.version; }, cache: require('./cache')(cfg), db: require('./db')(cfg), events: new EventEmitter(), forms: require('./forms')(cfg), log: false, stringify: fals...
javascript
function FHapi(cfg) { var api = { getVersion: function() { //Getting The Version of fh-mbaas-api return packageJSON.version; }, cache: require('./cache')(cfg), db: require('./db')(cfg), events: new EventEmitter(), forms: require('./forms')(cfg), log: false, stringify: fals...
[ "function", "FHapi", "(", "cfg", ")", "{", "var", "api", "=", "{", "getVersion", ":", "function", "(", ")", "{", "//Getting The Version of fh-mbaas-api", "return", "packageJSON", ".", "version", ";", "}", ",", "cache", ":", "require", "(", "'./cache'", ")", ...
Main FHapi constructor function..
[ "Main", "FHapi", "constructor", "function", ".." ]
3bd60e54a34f216d5f2d35a31f3e4b96ae19956e
https://github.com/feedhenry/fh-mbaas-api/blob/3bd60e54a34f216d5f2d35a31f3e4b96ae19956e/lib/api.js#L29-L100
train
openpgpjs/web-stream-tools
lib/reader.js
Reader
function Reader(input) { this.stream = input; if (input[externalBuffer]) { this[externalBuffer] = input[externalBuffer].slice(); } let streamType = streams.isStream(input); if (streamType === 'node') { input = streams.nodeToWeb(input); } if (streamType) { const reader = input.getReader(); ...
javascript
function Reader(input) { this.stream = input; if (input[externalBuffer]) { this[externalBuffer] = input[externalBuffer].slice(); } let streamType = streams.isStream(input); if (streamType === 'node') { input = streams.nodeToWeb(input); } if (streamType) { const reader = input.getReader(); ...
[ "function", "Reader", "(", "input", ")", "{", "this", ".", "stream", "=", "input", ";", "if", "(", "input", "[", "externalBuffer", "]", ")", "{", "this", "[", "externalBuffer", "]", "=", "input", "[", "externalBuffer", "]", ".", "slice", "(", ")", ";...
A wrapper class over the native ReadableStreamDefaultReader. This additionally implements pushing back data on the stream, which lets us implement peeking and a host of convenience functions. It also lets you read data other than streams, such as a Uint8Array. @class
[ "A", "wrapper", "class", "over", "the", "native", "ReadableStreamDefaultReader", ".", "This", "additionally", "implements", "pushing", "back", "data", "on", "the", "stream", "which", "lets", "us", "implement", "peeking", "and", "a", "host", "of", "convenience", ...
84a497715c9df271a673f8616318264ab42ab3cc
https://github.com/openpgpjs/web-stream-tools/blob/84a497715c9df271a673f8616318264ab42ab3cc/lib/reader.js#L13-L46
train
rei/rei-cedar
build/vue-docs.js
createMarkdownTemplate
function createMarkdownTemplate(file, vueObj) { let json2mdTemplate = [], mdTablesTemplate; mdTablesTemplate = buildTables(vueObj) if(mdTablesTemplate.length > 0) { json2mdTemplate = json2mdTemplate.concat(mdTablesTemplate) } return json2md(json2mdTemplate) }
javascript
function createMarkdownTemplate(file, vueObj) { let json2mdTemplate = [], mdTablesTemplate; mdTablesTemplate = buildTables(vueObj) if(mdTablesTemplate.length > 0) { json2mdTemplate = json2mdTemplate.concat(mdTablesTemplate) } return json2md(json2mdTemplate) }
[ "function", "createMarkdownTemplate", "(", "file", ",", "vueObj", ")", "{", "let", "json2mdTemplate", "=", "[", "]", ",", "mdTablesTemplate", ";", "mdTablesTemplate", "=", "buildTables", "(", "vueObj", ")", "if", "(", "mdTablesTemplate", ".", "length", ">", "0...
take json object returned from vue-docgen-api and create markdown template
[ "take", "json", "object", "returned", "from", "vue", "-", "docgen", "-", "api", "and", "create", "markdown", "template" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L173-L184
train
rei/rei-cedar
build/vue-docs.js
buildTables
function buildTables(vueObj) { let updatedTemplate = [{h3: "<button class='title'>PROPS, METHODS, EVENTS, SLOTS</button>"}] let mdTable mdTable = tableFromProps(vueObj["props"]) if(mdTable != null) { updatedTemplate.push(mdTable) } mdTable = tableFromMethods(vueObj["methods"]) if(mdTable != null...
javascript
function buildTables(vueObj) { let updatedTemplate = [{h3: "<button class='title'>PROPS, METHODS, EVENTS, SLOTS</button>"}] let mdTable mdTable = tableFromProps(vueObj["props"]) if(mdTable != null) { updatedTemplate.push(mdTable) } mdTable = tableFromMethods(vueObj["methods"]) if(mdTable != null...
[ "function", "buildTables", "(", "vueObj", ")", "{", "let", "updatedTemplate", "=", "[", "{", "h3", ":", "\"<button class='title'>PROPS, METHODS, EVENTS, SLOTS</button>\"", "}", "]", "let", "mdTable", "mdTable", "=", "tableFromProps", "(", "vueObj", "[", "\"props\"", ...
build tables for Vue props, methods, events, and slots
[ "build", "tables", "for", "Vue", "props", "methods", "events", "and", "slots" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L187-L212
train
rei/rei-cedar
build/vue-docs.js
tableFromProps
function tableFromProps(propsObj) { const headers = ["Prop Name", "Type", "Default", "Require", "Description"] let rows = [] // construct rows of table from object of properties for(const prop in propsObj) { // Don't document properties with `@ignore` tag if (propsObj[prop].tags.ignore) { continu...
javascript
function tableFromProps(propsObj) { const headers = ["Prop Name", "Type", "Default", "Require", "Description"] let rows = [] // construct rows of table from object of properties for(const prop in propsObj) { // Don't document properties with `@ignore` tag if (propsObj[prop].tags.ignore) { continu...
[ "function", "tableFromProps", "(", "propsObj", ")", "{", "const", "headers", "=", "[", "\"Prop Name\"", ",", "\"Type\"", ",", "\"Default\"", ",", "\"Require\"", ",", "\"Description\"", "]", "let", "rows", "=", "[", "]", "// construct rows of table from object of pro...
auxilary function to create table from `props` property of json2md object
[ "auxilary", "function", "to", "create", "table", "from", "props", "property", "of", "json2md", "object" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L215-L237
train
rei/rei-cedar
build/vue-docs.js
tableFromMethods
function tableFromMethods(methodsArr) { const headers = ["Method Name", "Type", "Parameters", "Description"] let rows = [] // construct rows of table array of methods methodsArr.forEach((method) => { let cols = [] cols.push(method["name"]) // method name let paramList = '' method["params"].for...
javascript
function tableFromMethods(methodsArr) { const headers = ["Method Name", "Type", "Parameters", "Description"] let rows = [] // construct rows of table array of methods methodsArr.forEach((method) => { let cols = [] cols.push(method["name"]) // method name let paramList = '' method["params"].for...
[ "function", "tableFromMethods", "(", "methodsArr", ")", "{", "const", "headers", "=", "[", "\"Method Name\"", ",", "\"Type\"", ",", "\"Parameters\"", ",", "\"Description\"", "]", "let", "rows", "=", "[", "]", "// construct rows of table array of methods", "methodsArr"...
auxilary function to create table from `methods` property of json2md object
[ "auxilary", "function", "to", "create", "table", "from", "methods", "property", "of", "json2md", "object" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L240-L260
train
rei/rei-cedar
build/vue-docs.js
tableFromEvents
function tableFromEvents(eventsObj) { const headers = ["Event Name", "Type", "Description"] let rows = [] for(const evt in eventsObj) { let cols = [] cols.push(`${evt}`) // event name let typeList = '' eventsObj[evt]["type"]["names"].forEach((type, idx, arr) => { typeList += `${type}$...
javascript
function tableFromEvents(eventsObj) { const headers = ["Event Name", "Type", "Description"] let rows = [] for(const evt in eventsObj) { let cols = [] cols.push(`${evt}`) // event name let typeList = '' eventsObj[evt]["type"]["names"].forEach((type, idx, arr) => { typeList += `${type}$...
[ "function", "tableFromEvents", "(", "eventsObj", ")", "{", "const", "headers", "=", "[", "\"Event Name\"", ",", "\"Type\"", ",", "\"Description\"", "]", "let", "rows", "=", "[", "]", "for", "(", "const", "evt", "in", "eventsObj", ")", "{", "let", "cols", ...
auxilary function to create table from `events` property of json2md object
[ "auxilary", "function", "to", "create", "table", "from", "events", "property", "of", "json2md", "object" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L263-L283
train
rei/rei-cedar
build/vue-docs.js
tableFromSlots
function tableFromSlots(slotsObj) { const headers = ["Slot", "Description"] let rows = [] for(const slot in slotsObj) { let cols = [] cols.push(`${slot}`) // name of the slot cols.push(`${slotsObj[slot]["description"] || ''}`) // description of the slot rows.push(cols) } return rows.length ...
javascript
function tableFromSlots(slotsObj) { const headers = ["Slot", "Description"] let rows = [] for(const slot in slotsObj) { let cols = [] cols.push(`${slot}`) // name of the slot cols.push(`${slotsObj[slot]["description"] || ''}`) // description of the slot rows.push(cols) } return rows.length ...
[ "function", "tableFromSlots", "(", "slotsObj", ")", "{", "const", "headers", "=", "[", "\"Slot\"", ",", "\"Description\"", "]", "let", "rows", "=", "[", "]", "for", "(", "const", "slot", "in", "slotsObj", ")", "{", "let", "cols", "=", "[", "]", "cols",...
auxilary function to create table from `slots` property of json2md object
[ "auxilary", "function", "to", "create", "table", "from", "slots", "property", "of", "json2md", "object" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/vue-docs.js#L286-L299
train
rei/rei-cedar
build/component-docs-build.js
buildAPIs
function buildAPIs(vueObj) { const funcArray = [propsAPIObject, methodsAPIObject, eventsAPIObject, slotsAPIObject] const compAPIObj = funcArray.reduce((apiObj, curFn) => { const obj = curFn(vueObj) if (obj !== null) { Object.assign(apiObj, obj) } return apiObj }, {}) return compAPIObj...
javascript
function buildAPIs(vueObj) { const funcArray = [propsAPIObject, methodsAPIObject, eventsAPIObject, slotsAPIObject] const compAPIObj = funcArray.reduce((apiObj, curFn) => { const obj = curFn(vueObj) if (obj !== null) { Object.assign(apiObj, obj) } return apiObj }, {}) return compAPIObj...
[ "function", "buildAPIs", "(", "vueObj", ")", "{", "const", "funcArray", "=", "[", "propsAPIObject", ",", "methodsAPIObject", ",", "eventsAPIObject", ",", "slotsAPIObject", "]", "const", "compAPIObj", "=", "funcArray", ".", "reduce", "(", "(", "apiObj", ",", "c...
build data objects for Vue props, methods, events, and slots @param {Object} vueObj -- JSON object returned by vue-docgen-api library @returns {Object} -- obJect representing different parts of component API
[ "build", "data", "objects", "for", "Vue", "props", "methods", "events", "and", "slots" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/component-docs-build.js#L83-L96
train
rei/rei-cedar
build/component-docs-build.js
propsAPIObject
function propsAPIObject(vueObj) { const propsObj = vueObj["props"] || {} let props = [] // construct array of objects for props for (const prop in propsObj) { if (propsObj.hasOwnProperty(prop)) { // Don't document properties with `@ignore` tag if (propsObj[prop].tags.ignore) { contin...
javascript
function propsAPIObject(vueObj) { const propsObj = vueObj["props"] || {} let props = [] // construct array of objects for props for (const prop in propsObj) { if (propsObj.hasOwnProperty(prop)) { // Don't document properties with `@ignore` tag if (propsObj[prop].tags.ignore) { contin...
[ "function", "propsAPIObject", "(", "vueObj", ")", "{", "const", "propsObj", "=", "vueObj", "[", "\"props\"", "]", "||", "{", "}", "let", "props", "=", "[", "]", "// construct array of objects for props", "for", "(", "const", "prop", "in", "propsObj", ")", "{...
Create object representing component props @param {Object} -- JSON object from vue-docgen-api library @returns {Object} -- Object for component props that goes into Cedar Data Object
[ "Create", "object", "representing", "component", "props" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/component-docs-build.js#L103-L128
train
rei/rei-cedar
build/component-docs-build.js
methodsAPIObject
function methodsAPIObject(vueObj) { const methodsArr = vueObj["methods"] || [] let methods = [] // construct array of objects for public methods methodsArr.forEach((method) => { const ele = { "name": `${method["name"]}`, "parameters": `${method["params"].reduce((paramList, param) => { ...
javascript
function methodsAPIObject(vueObj) { const methodsArr = vueObj["methods"] || [] let methods = [] // construct array of objects for public methods methodsArr.forEach((method) => { const ele = { "name": `${method["name"]}`, "parameters": `${method["params"].reduce((paramList, param) => { ...
[ "function", "methodsAPIObject", "(", "vueObj", ")", "{", "const", "methodsArr", "=", "vueObj", "[", "\"methods\"", "]", "||", "[", "]", "let", "methods", "=", "[", "]", "// construct array of objects for public methods", "methodsArr", ".", "forEach", "(", "(", "...
Create object representing component public methods @param {Object} -- JSON object from vue-docgen-api library @returns {Object} -- Object for component methods that goes into Cedar Data Object
[ "Create", "object", "representing", "component", "public", "methods" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/component-docs-build.js#L135-L152
train
rei/rei-cedar
build/component-docs-build.js
eventsAPIObject
function eventsAPIObject(vueObj) { const eventsObj = vueObj["events"] || {} let events = [] for (const evt in eventsObj) { if (eventsObj.hasOwnProperty(evt)) { const ele = { "name": `${evt}`, "type": `${eventsObj[evt]["type"]["names"].reduce((typeList, type, idx, arr) => { typ...
javascript
function eventsAPIObject(vueObj) { const eventsObj = vueObj["events"] || {} let events = [] for (const evt in eventsObj) { if (eventsObj.hasOwnProperty(evt)) { const ele = { "name": `${evt}`, "type": `${eventsObj[evt]["type"]["names"].reduce((typeList, type, idx, arr) => { typ...
[ "function", "eventsAPIObject", "(", "vueObj", ")", "{", "const", "eventsObj", "=", "vueObj", "[", "\"events\"", "]", "||", "{", "}", "let", "events", "=", "[", "]", "for", "(", "const", "evt", "in", "eventsObj", ")", "{", "if", "(", "eventsObj", ".", ...
Create object representing component events @param {Object} -- JSON object from vue-docgen-api library @returns {Object} -- Object for component events that goes into Cedar Data Object
[ "Create", "object", "representing", "component", "events" ]
5ddcce5ccda8fee41235483760332ad5e63c5455
https://github.com/rei/rei-cedar/blob/5ddcce5ccda8fee41235483760332ad5e63c5455/build/component-docs-build.js#L159-L177
train