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
feedhenry/fh-mbaas-express
lib/cloud/fh-reports.js
getMessagingConfig
function getMessagingConfig() { return { host: process.env.FH_MESSAGING_HOST || '', cluster: process.env.FH_MESSAGING_CLUSTER || '', realTimeLoggingEnabled: isRealtimeLoggingEnabled(), mbaasType: mbaasType(), decoupled: process.env.FH_MBAAS_DECOUPLED || false, msgServer: { ...
javascript
function getMessagingConfig() { return { host: process.env.FH_MESSAGING_HOST || '', cluster: process.env.FH_MESSAGING_CLUSTER || '', realTimeLoggingEnabled: isRealtimeLoggingEnabled(), mbaasType: mbaasType(), decoupled: process.env.FH_MBAAS_DECOUPLED || false, msgServer: { ...
[ "function", "getMessagingConfig", "(", ")", "{", "return", "{", "host", ":", "process", ".", "env", ".", "FH_MESSAGING_HOST", "||", "''", ",", "cluster", ":", "process", ".", "env", ".", "FH_MESSAGING_CLUSTER", "||", "''", ",", "realTimeLoggingEnabled", ":", ...
Build the messaging configuration for the Reporting Client
[ "Build", "the", "messaging", "configuration", "for", "the", "Reporting", "Client" ]
381c2a5842b49a4cbc4519d55b9a3c870b364d3c
https://github.com/feedhenry/fh-mbaas-express/blob/381c2a5842b49a4cbc4519d55b9a3c870b364d3c/lib/cloud/fh-reports.js#L60-L77
train
feedhenry/fh-mbaas-express
lib/cloud/fh-reports.js
getLogMessageURL
function getLogMessageURL() { var url = ''; if (process.env.OPENSHIFT_FEEDHENRY_REPORTER_IP) { url = 'http://' + process.env.OPENSHIFT_FEEDHENRY_REPORTER_IP + ':' + process.env.OPENSHIFT_FEEDHENRY_REPORTER_PORT; url += '/sys/admin/reports/TOPIC'; } else { url = process.env.FH_MESSAGING_SERVER || ''; /...
javascript
function getLogMessageURL() { var url = ''; if (process.env.OPENSHIFT_FEEDHENRY_REPORTER_IP) { url = 'http://' + process.env.OPENSHIFT_FEEDHENRY_REPORTER_IP + ':' + process.env.OPENSHIFT_FEEDHENRY_REPORTER_PORT; url += '/sys/admin/reports/TOPIC'; } else { url = process.env.FH_MESSAGING_SERVER || ''; /...
[ "function", "getLogMessageURL", "(", ")", "{", "var", "url", "=", "''", ";", "if", "(", "process", ".", "env", ".", "OPENSHIFT_FEEDHENRY_REPORTER_IP", ")", "{", "url", "=", "'http://'", "+", "process", ".", "env", ".", "OPENSHIFT_FEEDHENRY_REPORTER_IP", "+", ...
Get the logging message URL taking into account OpenShift environmental factors
[ "Get", "the", "logging", "message", "URL", "taking", "into", "account", "OpenShift", "environmental", "factors" ]
381c2a5842b49a4cbc4519d55b9a3c870b364d3c
https://github.com/feedhenry/fh-mbaas-express/blob/381c2a5842b49a4cbc4519d55b9a3c870b364d3c/lib/cloud/fh-reports.js#L82-L91
train
feedhenry/fh-mbaas-express
lib/cloud/fh-reports.js
isRealtimeLoggingEnabled
function isRealtimeLoggingEnabled() { var flag = process.env.FH_MESSAGING_REALTIME_ENABLED; if (flag && (flag === 'true' || flag === true) ) { return true; } return false; }
javascript
function isRealtimeLoggingEnabled() { var flag = process.env.FH_MESSAGING_REALTIME_ENABLED; if (flag && (flag === 'true' || flag === true) ) { return true; } return false; }
[ "function", "isRealtimeLoggingEnabled", "(", ")", "{", "var", "flag", "=", "process", ".", "env", ".", "FH_MESSAGING_REALTIME_ENABLED", ";", "if", "(", "flag", "&&", "(", "flag", "===", "'true'", "||", "flag", "===", "true", ")", ")", "{", "return", "true"...
Is realtime logging enabled for this application
[ "Is", "realtime", "logging", "enabled", "for", "this", "application" ]
381c2a5842b49a4cbc4519d55b9a3c870b364d3c
https://github.com/feedhenry/fh-mbaas-express/blob/381c2a5842b49a4cbc4519d55b9a3c870b364d3c/lib/cloud/fh-reports.js#L105-L111
train
yhtml5/yhtml5-cli
packages/yhtml5-cli/demo/lib/options.js
getMetadata
function getMetadata (dir) { var json = path.join(dir, 'meta.json') var js = path.join(dir, 'meta.js') var opts = {} if (exists(json)) { opts = metadata.sync(json) } else if (exists(js)) { var req = require(path.resolve(js)) if (req !== Object(req)) { throw new Error('meta.js needs to expos...
javascript
function getMetadata (dir) { var json = path.join(dir, 'meta.json') var js = path.join(dir, 'meta.js') var opts = {} if (exists(json)) { opts = metadata.sync(json) } else if (exists(js)) { var req = require(path.resolve(js)) if (req !== Object(req)) { throw new Error('meta.js needs to expos...
[ "function", "getMetadata", "(", "dir", ")", "{", "var", "json", "=", "path", ".", "join", "(", "dir", ",", "'meta.json'", ")", "var", "js", "=", "path", ".", "join", "(", "dir", ",", "'meta.js'", ")", "var", "opts", "=", "{", "}", "if", "(", "exi...
Gets the metadata from either a meta.json or meta.js file. @param {String} dir @return {Object}
[ "Gets", "the", "metadata", "from", "either", "a", "meta", ".", "json", "or", "meta", ".", "js", "file", "." ]
521a8ad160058e453dff87c7cc9bfb16215715c6
https://github.com/yhtml5/yhtml5-cli/blob/521a8ad160058e453dff87c7cc9bfb16215715c6/packages/yhtml5-cli/demo/lib/options.js#L35-L51
train
dowjones/distribucache
lib/decorators/PopulateDecorator.js
PopulateDecorator
function PopulateDecorator(cache, config) { BaseDecorator.call(this, cache, config, joi.object().keys({ populate: joi.func().required(), timeoutPopulateIn: joi.number().integer().default(1000 * 30), leaseExpiresIn: joi.number().integer() })); this._store = this._getStore(); this._lease = this._store...
javascript
function PopulateDecorator(cache, config) { BaseDecorator.call(this, cache, config, joi.object().keys({ populate: joi.func().required(), timeoutPopulateIn: joi.number().integer().default(1000 * 30), leaseExpiresIn: joi.number().integer() })); this._store = this._getStore(); this._lease = this._store...
[ "function", "PopulateDecorator", "(", "cache", ",", "config", ")", "{", "BaseDecorator", ".", "call", "(", "this", ",", "cache", ",", "config", ",", "joi", ".", "object", "(", ")", ".", "keys", "(", "{", "populate", ":", "joi", ".", "func", "(", ")",...
Self-populating data-store independent cache @param {Cache} cache @param {Object} config @param {Function} config.populate @param {Number} [config.leaseExpiresIn] in ms @param {Number} [config.timeoutPopulateIn] in ms, defaults to 30sec
[ "Self", "-", "populating", "data", "-", "store", "independent", "cache" ]
ad79caee277771a6e49ee4a98c4983480cd89945
https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/PopulateDecorator.js#L22-L32
train
SandJS/http
lib/middleware/logRequestTime.js
logRequest
function logRequest(err, res) { if (res) { let ms = new Date() - res.requestStartTime; var time = ms < 1000 ? `${ms}ms` : `${(ms/1000).toFixed(2)}s`; logRoute(`${res.req.method} ${res.statusCode} (${time}): ${res.req.originalUrl}`); } }
javascript
function logRequest(err, res) { if (res) { let ms = new Date() - res.requestStartTime; var time = ms < 1000 ? `${ms}ms` : `${(ms/1000).toFixed(2)}s`; logRoute(`${res.req.method} ${res.statusCode} (${time}): ${res.req.originalUrl}`); } }
[ "function", "logRequest", "(", "err", ",", "res", ")", "{", "if", "(", "res", ")", "{", "let", "ms", "=", "new", "Date", "(", ")", "-", "res", ".", "requestStartTime", ";", "var", "time", "=", "ms", "<", "1000", "?", "`", "${", "ms", "}", "`", ...
Log the request time when finished @param {null|Error} err - Request error if there was one @param {Request} req - Request Object
[ "Log", "the", "request", "time", "when", "finished" ]
8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f
https://github.com/SandJS/http/blob/8f8b4d23eb5f59d802c9537e0ccd67b47fa79d2f/lib/middleware/logRequestTime.js#L30-L38
train
Rhinostone/gina
script/post_install.js
function() { self.isWin32 = ( os.platform() == 'win32' ) ? true : false; self.path = _( __dirname.substring(0, (__dirname.length - "script".length)-1 ) ); self.root = process.cwd().toString(); createVersionFile(); //console.log('[ debug ] createVersionFile()'); ...
javascript
function() { self.isWin32 = ( os.platform() == 'win32' ) ? true : false; self.path = _( __dirname.substring(0, (__dirname.length - "script".length)-1 ) ); self.root = process.cwd().toString(); createVersionFile(); //console.log('[ debug ] createVersionFile()'); ...
[ "function", "(", ")", "{", "self", ".", "isWin32", "=", "(", "os", ".", "platform", "(", ")", "==", "'win32'", ")", "?", "true", ":", "false", ";", "self", ".", "path", "=", "_", "(", "__dirname", ".", "substring", "(", "0", ",", "(", "__dirname"...
Initialize post installation scripts.
[ "Initialize", "post", "installation", "scripts", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/script/post_install.js#L33-L43
train
Rhinostone/gina
script/post_install.js
function(win32Name, callback) { var name = require( _(self.path + '/package.json') ).name; var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) ); var source = _(self.path + '/core/template/command/gina.tpl'); var target = _(appPath +'/'...
javascript
function(win32Name, callback) { var name = require( _(self.path + '/package.json') ).name; var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) ); var source = _(self.path + '/core/template/command/gina.tpl'); var target = _(appPath +'/'...
[ "function", "(", "win32Name", ",", "callback", ")", "{", "var", "name", "=", "require", "(", "_", "(", "self", ".", "path", "+", "'/package.json'", ")", ")", ".", "name", ";", "var", "appPath", "=", "_", "(", "self", ".", "path", ".", "substring", ...
Creating framework command line file for nix.
[ "Creating", "framework", "command", "line", "file", "for", "nix", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/script/post_install.js#L75-L98
train
Jack12816/greppy
lib/http/mvc/loader.js
function(callback) { try { var controller = require(path); callback(null, controller); } catch (e) { return callback(e); } }
javascript
function(callback) { try { var controller = require(path); callback(null, controller); } catch (e) { return callback(e); } }
[ "function", "(", "callback", ")", "{", "try", "{", "var", "controller", "=", "require", "(", "path", ")", ";", "callback", "(", "null", ",", "controller", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "callback", "(", "e", ")", ";", "}", ...
Prepare the controller
[ "Prepare", "the", "controller" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L237-L245
train
Jack12816/greppy
lib/http/mvc/loader.js
function(controller, callback) { // Allow configure-method less controllers if ('function' !== typeof controller.configure) { return callback(null, controller); } controller.configure( self.worker.app, self.worker.server, ...
javascript
function(controller, callback) { // Allow configure-method less controllers if ('function' !== typeof controller.configure) { return callback(null, controller); } controller.configure( self.worker.app, self.worker.server, ...
[ "function", "(", "controller", ",", "callback", ")", "{", "// Allow configure-method less controllers", "if", "(", "'function'", "!==", "typeof", "controller", ".", "configure", ")", "{", "return", "callback", "(", "null", ",", "controller", ")", ";", "}", "cont...
Run the configure method of the current controller
[ "Run", "the", "configure", "method", "of", "the", "current", "controller" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L248-L261
train
Jack12816/greppy
lib/http/mvc/loader.js
function(controller, callback) { // Add the given name to the controller controller.name = name; controller.module = module; // Set default value on the controller instance controller.basePath = self.getBasePath( controller, path, module ...
javascript
function(controller, callback) { // Add the given name to the controller controller.name = name; controller.module = module; // Set default value on the controller instance controller.basePath = self.getBasePath( controller, path, module ...
[ "function", "(", "controller", ",", "callback", ")", "{", "// Add the given name to the controller", "controller", ".", "name", "=", "name", ";", "controller", ".", "module", "=", "module", ";", "// Set default value on the controller instance", "controller", ".", "base...
Run any options generation
[ "Run", "any", "options", "generation" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L264-L281
train
Jack12816/greppy
lib/http/mvc/loader.js
function(controller, callback) { self.prepareControllerActions(controller, function(err, actions) { callback(err, controller, actions); }); }
javascript
function(controller, callback) { self.prepareControllerActions(controller, function(err, actions) { callback(err, controller, actions); }); }
[ "function", "(", "controller", ",", "callback", ")", "{", "self", ".", "prepareControllerActions", "(", "controller", ",", "function", "(", "err", ",", "actions", ")", "{", "callback", "(", "err", ",", "controller", ",", "actions", ")", ";", "}", ")", ";...
Prepare all actions of the controller
[ "Prepare", "all", "actions", "of", "the", "controller" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L284-L288
train
Jack12816/greppy
lib/http/mvc/loader.js
function(controller, actions, callback) { self.worker.context.routes = self.worker.context.routes.concat( actions ); callback(null, controller); }
javascript
function(controller, actions, callback) { self.worker.context.routes = self.worker.context.routes.concat( actions ); callback(null, controller); }
[ "function", "(", "controller", ",", "actions", ",", "callback", ")", "{", "self", ".", "worker", ".", "context", ".", "routes", "=", "self", ".", "worker", ".", "context", ".", "routes", ".", "concat", "(", "actions", ")", ";", "callback", "(", "null",...
Register routes to the worker context
[ "Register", "routes", "to", "the", "worker", "context" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L291-L296
train
Jack12816/greppy
lib/http/mvc/loader.js
function(callback) { async.map(modules, function(module, callback) { callback && callback( null, { name: module, path: process.cwd() + '/modules/' + module + '/controllers/' ...
javascript
function(callback) { async.map(modules, function(module, callback) { callback && callback( null, { name: module, path: process.cwd() + '/modules/' + module + '/controllers/' ...
[ "function", "(", "callback", ")", "{", "async", ".", "map", "(", "modules", ",", "function", "(", "module", ",", "callback", ")", "{", "callback", "&&", "callback", "(", "null", ",", "{", "name", ":", "module", ",", "path", ":", "process", ".", "cwd"...
Build module paths
[ "Build", "module", "paths" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L329-L340
train
Jack12816/greppy
lib/http/mvc/loader.js
function(map, callback) { async.filter(map, function(module, callback) { fs.exists(module.path, callback); }, function(map) { callback(null, map); }); }
javascript
function(map, callback) { async.filter(map, function(module, callback) { fs.exists(module.path, callback); }, function(map) { callback(null, map); }); }
[ "function", "(", "map", ",", "callback", ")", "{", "async", ".", "filter", "(", "map", ",", "function", "(", "module", ",", "callback", ")", "{", "fs", ".", "exists", "(", "module", ".", "path", ",", "callback", ")", ";", "}", ",", "function", "(",...
Check for valid modules - paths
[ "Check", "for", "valid", "modules", "-", "paths" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L343-L349
train
Jack12816/greppy
lib/http/mvc/loader.js
function(map, callback) { // Walk through all modules in parallel async.map(map, function(module, callback) { // Filter all non-js files in parallel async.filter( pathHelper.list(module.path), function(path, callback) { ...
javascript
function(map, callback) { // Walk through all modules in parallel async.map(map, function(module, callback) { // Filter all non-js files in parallel async.filter( pathHelper.list(module.path), function(path, callback) { ...
[ "function", "(", "map", ",", "callback", ")", "{", "// Walk through all modules in parallel", "async", ".", "map", "(", "map", ",", "function", "(", "module", ",", "callback", ")", "{", "// Filter all non-js files in parallel", "async", ".", "filter", "(", "pathHe...
Search for javascript files
[ "Search", "for", "javascript", "files" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L352-L368
train
Jack12816/greppy
lib/http/mvc/loader.js
function(map, callback) { // Walk through all modules in parallel async.map(map, function(module, callback) { logger.info('Loading ' + (module.name).blue + ' module'); // Walk through all possible controllers of the module async.map(module.paths...
javascript
function(map, callback) { // Walk through all modules in parallel async.map(map, function(module, callback) { logger.info('Loading ' + (module.name).blue + ' module'); // Walk through all possible controllers of the module async.map(module.paths...
[ "function", "(", "map", ",", "callback", ")", "{", "// Walk through all modules in parallel", "async", ".", "map", "(", "map", ",", "function", "(", "module", ",", "callback", ")", "{", "logger", ".", "info", "(", "'Loading '", "+", "(", "module", ".", "na...
Load controllers of the modules
[ "Load", "controllers", "of", "the", "modules" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/http/mvc/loader.js#L371-L394
train
zhennann/egg-born-backend
lib/module/locales.js
getText
function getText(locale, ...args) { const key = args[0]; if (!key) return null; // try locale let resource = ebLocales[locale] || {}; let text = resource[key]; if (text === undefined && locale !== 'en-us') { // try en-us resource = ebLocales['en-us'] || {}; text = resource[key...
javascript
function getText(locale, ...args) { const key = args[0]; if (!key) return null; // try locale let resource = ebLocales[locale] || {}; let text = resource[key]; if (text === undefined && locale !== 'en-us') { // try en-us resource = ebLocales['en-us'] || {}; text = resource[key...
[ "function", "getText", "(", "locale", ",", "...", "args", ")", "{", "const", "key", "=", "args", "[", "0", "]", ";", "if", "(", "!", "key", ")", "return", "null", ";", "// try locale", "let", "resource", "=", "ebLocales", "[", "locale", "]", "||", ...
based on koa-locales https://github.com/koajs/locales/blob/master/index.js
[ "based", "on", "koa", "-", "locales" ]
5b376e22b00b1284b56d9cb563aa28b49cf9ac73
https://github.com/zhennann/egg-born-backend/blob/5b376e22b00b1284b56d9cb563aa28b49cf9ac73/lib/module/locales.js#L91-L110
train
township/township-access
index.js
create
function create (key, scopes, callback) { const data = { key: key, scopes: scopes } db.put(key, data, function (err) { if (err) return callback(err) else callback(null, data) }) }
javascript
function create (key, scopes, callback) { const data = { key: key, scopes: scopes } db.put(key, data, function (err) { if (err) return callback(err) else callback(null, data) }) }
[ "function", "create", "(", "key", ",", "scopes", ",", "callback", ")", "{", "const", "data", "=", "{", "key", ":", "key", ",", "scopes", ":", "scopes", "}", "db", ".", "put", "(", "key", ",", "data", ",", "function", "(", "err", ")", "{", "if", ...
Create a set of access scopes @name access.create @memberof townshipAccess @param {string} key - the key for the access scopes @param {array} scopes - array of strings @param {function} callback - callback with `err`, `data` arguments
[ "Create", "a", "set", "of", "access", "scopes" ]
c710f40e96712c1e1ee936b01da299010f6c4086
https://github.com/township/township-access/blob/c710f40e96712c1e1ee936b01da299010f6c4086/index.js#L41-L51
train
township/township-access
index.js
update
function update (key, scopes, callback) { const unlock = lock(key) get(key, function (err, account) { if (err) { unlock() return callback(err) } account.scopes = scopes db.put(key, account, function (err) { unlock() if (err) return callback(err) ...
javascript
function update (key, scopes, callback) { const unlock = lock(key) get(key, function (err, account) { if (err) { unlock() return callback(err) } account.scopes = scopes db.put(key, account, function (err) { unlock() if (err) return callback(err) ...
[ "function", "update", "(", "key", ",", "scopes", ",", "callback", ")", "{", "const", "unlock", "=", "lock", "(", "key", ")", "get", "(", "key", ",", "function", "(", "err", ",", "account", ")", "{", "if", "(", "err", ")", "{", "unlock", "(", ")",...
Update a set of access scopes @name access.update @memberof townshipAccess @param {string} key - the key for the access scopes @param {array} scopes - array of strings @param {function} callback - callback with `err`, `data` arguments
[ "Update", "a", "set", "of", "access", "scopes" ]
c710f40e96712c1e1ee936b01da299010f6c4086
https://github.com/township/township-access/blob/c710f40e96712c1e1ee936b01da299010f6c4086/index.js#L62-L79
train
township/township-access
index.js
verify
function verify (key, scopes, callback) { db.get(key, function (err, account) { if (err) return callback(err) var scopeAccess = verifyScopes(account, scopes) if (scopeAccess) return callback(null, account) else callback(new Error('Access denied')) }) }
javascript
function verify (key, scopes, callback) { db.get(key, function (err, account) { if (err) return callback(err) var scopeAccess = verifyScopes(account, scopes) if (scopeAccess) return callback(null, account) else callback(new Error('Access denied')) }) }
[ "function", "verify", "(", "key", ",", "scopes", ",", "callback", ")", "{", "db", ".", "get", "(", "key", ",", "function", "(", "err", ",", "account", ")", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", "var", "scopeAccess", "="...
Verify that a set of scopes match what is in the db for a key @name access.verify @memberof townshipAccess @param {string} key - the key for the access scopes @param {array} scopes - array of strings with scopes that must match @param {function} callback - callback with `err`, `data` arguments
[ "Verify", "that", "a", "set", "of", "scopes", "match", "what", "is", "in", "the", "db", "for", "a", "key" ]
c710f40e96712c1e1ee936b01da299010f6c4086
https://github.com/township/township-access/blob/c710f40e96712c1e1ee936b01da299010f6c4086/index.js#L102-L109
train
township/township-access
index.js
verifyScopes
function verifyScopes (data, scopes) { let i = 0 const l = scopes.length for (i; i < l; i++) { if (!verifyScope(data, scopes[i])) return false } return true }
javascript
function verifyScopes (data, scopes) { let i = 0 const l = scopes.length for (i; i < l; i++) { if (!verifyScope(data, scopes[i])) return false } return true }
[ "function", "verifyScopes", "(", "data", ",", "scopes", ")", "{", "let", "i", "=", "0", "const", "l", "=", "scopes", ".", "length", "for", "(", "i", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "!", "verifyScope", "(", "data", ",", ...
Verify that a set of scopes match what is available in an object with a scopes property @name access.verifyScopes @memberof townshipAccess @param {object} data @param {array} data.scopes - array of strings @param {array} scopes - array of strings with scopes that must match @return {boolean} returns `true` if `scopes`...
[ "Verify", "that", "a", "set", "of", "scopes", "match", "what", "is", "available", "in", "an", "object", "with", "a", "scopes", "property" ]
c710f40e96712c1e1ee936b01da299010f6c4086
https://github.com/township/township-access/blob/c710f40e96712c1e1ee936b01da299010f6c4086/index.js#L121-L130
train
township/township-access
index.js
verifyScope
function verifyScope (account, scope) { if (!account || !account.scopes || !account.scopes.length || !scope) return false return account.scopes.includes(scope) }
javascript
function verifyScope (account, scope) { if (!account || !account.scopes || !account.scopes.length || !scope) return false return account.scopes.includes(scope) }
[ "function", "verifyScope", "(", "account", ",", "scope", ")", "{", "if", "(", "!", "account", "||", "!", "account", ".", "scopes", "||", "!", "account", ".", "scopes", ".", "length", "||", "!", "scope", ")", "return", "false", "return", "account", ".",...
Verify that a scope matches what is available in an object with a scopes property @name access.verifyScope @memberof townshipAccess @param {string} key - the key for the access scopes @param {function} callback - callback with `err`, `data` arguments @return {boolean} returns `true` if `scope` is found in `data.scopes...
[ "Verify", "that", "a", "scope", "matches", "what", "is", "available", "in", "an", "object", "with", "a", "scopes", "property" ]
c710f40e96712c1e1ee936b01da299010f6c4086
https://github.com/township/township-access/blob/c710f40e96712c1e1ee936b01da299010f6c4086/index.js#L141-L144
train
doug-martin/it
examples/requirejs/scripts/it.js
_suite
function _suite(description, cb) { var test = new this(description, {}); var it = test._addAction; _(["suite", "test", "timeout", "getAction", "beforeAll", "beforeEach", "afterAll", "afterEach", "context", "get", "set", "skip"]).forEach(function (key) { ...
javascript
function _suite(description, cb) { var test = new this(description, {}); var it = test._addAction; _(["suite", "test", "timeout", "getAction", "beforeAll", "beforeEach", "afterAll", "afterEach", "context", "get", "set", "skip"]).forEach(function (key) { ...
[ "function", "_suite", "(", "description", ",", "cb", ")", "{", "var", "test", "=", "new", "this", "(", "description", ",", "{", "}", ")", ";", "var", "it", "=", "test", ".", "_addAction", ";", "_", "(", "[", "\"suite\"", ",", "\"test\"", ",", "\"ti...
Creates a test with it. @param {String} description the description of the test. @param {Function} [cb] the function to invoke in the scope of the test. The it suite is passed as the first argument. @return {it.Suite} the test.
[ "Creates", "a", "test", "with", "it", "." ]
0f8036ef6495fbef9dec1111e7913bec1af7301d
https://github.com/doug-martin/it/blob/0f8036ef6495fbef9dec1111e7913bec1af7301d/examples/requirejs/scripts/it.js#L6300-L6309
train
doug-martin/it
examples/requirejs/scripts/it.js
run
function run(filter) { var filter; if (typeof window !== "undefined") { try { it.reporter("html", "it"); } catch (e) { it.reporter("tap"); } var paramStr = wind...
javascript
function run(filter) { var filter; if (typeof window !== "undefined") { try { it.reporter("html", "it"); } catch (e) { it.reporter("tap"); } var paramStr = wind...
[ "function", "run", "(", "filter", ")", "{", "var", "filter", ";", "if", "(", "typeof", "window", "!==", "\"undefined\"", ")", "{", "try", "{", "it", ".", "reporter", "(", "\"html\"", ",", "\"it\"", ")", ";", "}", "catch", "(", "e", ")", "{", "it", ...
Run all tests that are currently registered. @return {comb.Promise} a promise that is resolved once all tests are done running.
[ "Run", "all", "tests", "that", "are", "currently", "registered", "." ]
0f8036ef6495fbef9dec1111e7913bec1af7301d
https://github.com/doug-martin/it/blob/0f8036ef6495fbef9dec1111e7913bec1af7301d/examples/requirejs/scripts/it.js#L8919-L8942
train
Kronos-Integration/kronos-interceptor-object-data-processor-row
lib/recordCheck/data-check-number.js
parseNumberString
function parseNumberString(numberString, type, decimalSeparator) { let result; if (numberString !== undefined) { if (typeof numberString === 'string') { // The given value is a string if (decimalSeparator === ',') { numberString = numberString.replace(/\./g, ''); numberString = numb...
javascript
function parseNumberString(numberString, type, decimalSeparator) { let result; if (numberString !== undefined) { if (typeof numberString === 'string') { // The given value is a string if (decimalSeparator === ',') { numberString = numberString.replace(/\./g, ''); numberString = numb...
[ "function", "parseNumberString", "(", "numberString", ",", "type", ",", "decimalSeparator", ")", "{", "let", "result", ";", "if", "(", "numberString", "!==", "undefined", ")", "{", "if", "(", "typeof", "numberString", "===", "'string'", ")", "{", "// The given...
Parses a string and try to convert it in a valid number. If the string does not match a valid number it will return the error message, else the parsed number. @param numberString The string to be checked @param type The expected type ["float", "integer", "number"] @param decimalSeparator The used decimal separator.
[ "Parses", "a", "string", "and", "try", "to", "convert", "it", "in", "a", "valid", "number", ".", "If", "the", "string", "does", "not", "match", "a", "valid", "number", "it", "will", "return", "the", "error", "message", "else", "the", "parsed", "number", ...
678a59b84dab4a9082377c90849a0d62d97a1ea4
https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/recordCheck/data-check-number.js#L259-L309
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
validateModel
function validateModel(json, model) { var schemaKeys = []; for (var keyInSchema in model) { schemaKeys.push(keyInSchema); } // Check if foreing keys are allowed. if (!model[SCHEMAALLOWUNKNOWN]) { // TODO ensure that null and false enter here. checkUnknown(json, schemaKeys); } ...
javascript
function validateModel(json, model) { var schemaKeys = []; for (var keyInSchema in model) { schemaKeys.push(keyInSchema); } // Check if foreing keys are allowed. if (!model[SCHEMAALLOWUNKNOWN]) { // TODO ensure that null and false enter here. checkUnknown(json, schemaKeys); } ...
[ "function", "validateModel", "(", "json", ",", "model", ")", "{", "var", "schemaKeys", "=", "[", "]", ";", "for", "(", "var", "keyInSchema", "in", "model", ")", "{", "schemaKeys", ".", "push", "(", "keyInSchema", ")", ";", "}", "// Check if foreing keys ar...
Validate model. Mode is an object in the schema, it can be root node or an object inside it. @param {[type]} json [description] @param {[type]} model [description] @return {[type]} [description]
[ "Validate", "model", ".", "Mode", "is", "an", "object", "in", "the", "schema", "it", "can", "be", "root", "node", "or", "an", "object", "inside", "it", "." ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L68-L88
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
isRequired
function isRequired(schema) { var required = false; if (schema[SCHEMAREQUIRED]) { try { required = schema[SCHEMAREQUIRED]; if (typeof required != "boolean") { throw new ValidationException( schema[SCHEMAREQUIRED] + " cast exception." ); } } cat...
javascript
function isRequired(schema) { var required = false; if (schema[SCHEMAREQUIRED]) { try { required = schema[SCHEMAREQUIRED]; if (typeof required != "boolean") { throw new ValidationException( schema[SCHEMAREQUIRED] + " cast exception." ); } } cat...
[ "function", "isRequired", "(", "schema", ")", "{", "var", "required", "=", "false", ";", "if", "(", "schema", "[", "SCHEMAREQUIRED", "]", ")", "{", "try", "{", "required", "=", "schema", "[", "SCHEMAREQUIRED", "]", ";", "if", "(", "typeof", "required", ...
Check if a key is required by schema @param {[type]} schema [description] @return {Boolean} [description]
[ "Check", "if", "a", "key", "is", "required", "by", "schema" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L128-L145
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
checkUnknown
function checkUnknown(json, schemaKeys) { var jsonKeys = []; for (var k in json) { if (schemaKeys.indexOf(k) === -1) { throw new ValidationException( "The key: " + k + " is not declared in the schema. Declare it or allow unknown keys." ); } } }
javascript
function checkUnknown(json, schemaKeys) { var jsonKeys = []; for (var k in json) { if (schemaKeys.indexOf(k) === -1) { throw new ValidationException( "The key: " + k + " is not declared in the schema. Declare it or allow unknown keys." ); } } }
[ "function", "checkUnknown", "(", "json", ",", "schemaKeys", ")", "{", "var", "jsonKeys", "=", "[", "]", ";", "for", "(", "var", "k", "in", "json", ")", "{", "if", "(", "schemaKeys", ".", "indexOf", "(", "k", ")", "===", "-", "1", ")", "{", "throw...
Check for unknown keys @param {[type]} json [description] @param {[type]} schemaKeys [description] @return {[type]} [description]
[ "Check", "for", "unknown", "keys" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L162-L173
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
validateObject
function validateObject(node, schema, key) { if (typeof node == "object") { try { validateModel(node, schema[SCHEMADATA]); } catch (e) { throw new ValidationException(e.message + " at " + key + "."); } } else { throw new ValidationException("Expected object for " + key); ...
javascript
function validateObject(node, schema, key) { if (typeof node == "object") { try { validateModel(node, schema[SCHEMADATA]); } catch (e) { throw new ValidationException(e.message + " at " + key + "."); } } else { throw new ValidationException("Expected object for " + key); ...
[ "function", "validateObject", "(", "node", ",", "schema", ",", "key", ")", "{", "if", "(", "typeof", "node", "==", "\"object\"", ")", "{", "try", "{", "validateModel", "(", "node", ",", "schema", "[", "SCHEMADATA", "]", ")", ";", "}", "catch", "(", "...
Validate an object node @param {[type]} node [description] @param {[type]} schema [description] @param {[type]} key [description] @return {[type]} [description]
[ "Validate", "an", "object", "node" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L182-L192
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
validateArray
function validateArray(node, schema, key) { if (Array.isArray(node)) { if (schema[SCHEMALENGTH]) { checkLength(node.length, schema, key); } for (var arrayI = 0; arrayI < node.length; arrayI++) { try { validateNode(node[arrayI], schema[SCHEMADATA], ""); } catch (e)...
javascript
function validateArray(node, schema, key) { if (Array.isArray(node)) { if (schema[SCHEMALENGTH]) { checkLength(node.length, schema, key); } for (var arrayI = 0; arrayI < node.length; arrayI++) { try { validateNode(node[arrayI], schema[SCHEMADATA], ""); } catch (e)...
[ "function", "validateArray", "(", "node", ",", "schema", ",", "key", ")", "{", "if", "(", "Array", ".", "isArray", "(", "node", ")", ")", "{", "if", "(", "schema", "[", "SCHEMALENGTH", "]", ")", "{", "checkLength", "(", "node", ".", "length", ",", ...
Validate an array node. @param {[type]} node [description] @param {[type]} schema [description] @param {[type]} key [description] @return {[type]} [description]
[ "Validate", "an", "array", "node", "." ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L201-L218
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
validateNumber
function validateNumber(node, schema, key) { if (isNaN(parseFloat(node)) || !isFinite(node)) { throw new ValidationException("Expected number for " + key); } if (schema[SCHEMAREGEX]) { checkRegex(node, schema, key); } }
javascript
function validateNumber(node, schema, key) { if (isNaN(parseFloat(node)) || !isFinite(node)) { throw new ValidationException("Expected number for " + key); } if (schema[SCHEMAREGEX]) { checkRegex(node, schema, key); } }
[ "function", "validateNumber", "(", "node", ",", "schema", ",", "key", ")", "{", "if", "(", "isNaN", "(", "parseFloat", "(", "node", ")", ")", "||", "!", "isFinite", "(", "node", ")", ")", "{", "throw", "new", "ValidationException", "(", "\"Expected numbe...
Validate a number node @param {[type]} node [description] @param {[type]} schema [description] @param {[type]} key [description] @return {[type]} [description]
[ "Validate", "a", "number", "node" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L227-L234
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
checkLength
function checkLength(size, schema, key) { //Check if it is an int if (Number.isInteger(schema[SCHEMALENGTH])) { if (size != schema[SCHEMALENGTH]) { throw new ValidationException("Size of " + key + " is not correct."); } } else if (typeof schema[SCHEMALENGTH] == "string") { if ( ...
javascript
function checkLength(size, schema, key) { //Check if it is an int if (Number.isInteger(schema[SCHEMALENGTH])) { if (size != schema[SCHEMALENGTH]) { throw new ValidationException("Size of " + key + " is not correct."); } } else if (typeof schema[SCHEMALENGTH] == "string") { if ( ...
[ "function", "checkLength", "(", "size", ",", "schema", ",", "key", ")", "{", "//Check if it is an int", "if", "(", "Number", ".", "isInteger", "(", "schema", "[", "SCHEMALENGTH", "]", ")", ")", "{", "if", "(", "size", "!=", "schema", "[", "SCHEMALENGTH", ...
Check that an array fit its lenght @param {[type]} size [description] @param {[type]} schema [description] @param {[type]} key [description] @return {[type]} [description]
[ "Check", "that", "an", "array", "fit", "its", "lenght" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L264-L280
train
vimlet/vimlet-commons
src/browser/schemaValidator.js
checkRegex
function checkRegex(node, schema, key) { try { schema[SCHEMAREGEX].test(node); } catch (e) { throw new ValidationException(key + " doesn't match its regex."); } }
javascript
function checkRegex(node, schema, key) { try { schema[SCHEMAREGEX].test(node); } catch (e) { throw new ValidationException(key + " doesn't match its regex."); } }
[ "function", "checkRegex", "(", "node", ",", "schema", ",", "key", ")", "{", "try", "{", "schema", "[", "SCHEMAREGEX", "]", ".", "test", "(", "node", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "ValidationException", "(", "key", "+", ...
Check regex. @param {[type]} node [description] @param {[type]} schema [description] @param {[type]} key [description] @return {[type]} [description]
[ "Check", "regex", "." ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/src/browser/schemaValidator.js#L329-L335
train
kevinoid/promise-nodeify
benchmark/index.js
defineGlobals
function defineGlobals() { Object.keys(NODEIFY_FUNCTIONS).forEach((nodeifyName) => { global[nodeifyName] = NODEIFY_FUNCTIONS[nodeifyName].nodeify; }); Object.keys(PROMISE_TYPES).forEach((promiseName) => { global[promiseName] = PROMISE_TYPES[promiseName].Promise; }); }
javascript
function defineGlobals() { Object.keys(NODEIFY_FUNCTIONS).forEach((nodeifyName) => { global[nodeifyName] = NODEIFY_FUNCTIONS[nodeifyName].nodeify; }); Object.keys(PROMISE_TYPES).forEach((promiseName) => { global[promiseName] = PROMISE_TYPES[promiseName].Promise; }); }
[ "function", "defineGlobals", "(", ")", "{", "Object", ".", "keys", "(", "NODEIFY_FUNCTIONS", ")", ".", "forEach", "(", "(", "nodeifyName", ")", "=>", "{", "global", "[", "nodeifyName", "]", "=", "NODEIFY_FUNCTIONS", "[", "nodeifyName", "]", ".", "nodeify", ...
Exposes nodeify functions and promise types as globals so that they can be accessed in the benchmark code. @private
[ "Exposes", "nodeify", "functions", "and", "promise", "types", "as", "globals", "so", "that", "they", "can", "be", "accessed", "in", "the", "benchmark", "code", "." ]
1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd
https://github.com/kevinoid/promise-nodeify/blob/1542cb7824c1b5e0e19e925dfb9650bfe8c7cdbd/benchmark/index.js#L123-L131
train
Rhinostone/gina
core/asset/js/plugin/dist/gina.min.js
Collection
function Collection(name) { // retrieve collections state collections = JSON.parse(storage.getItem(this['bucket'])); //console.log('collections ', (collections || null) ); if ( typeof(collections[name]) == 'undefined' ) { collections[name] = []; storage.setItem(th...
javascript
function Collection(name) { // retrieve collections state collections = JSON.parse(storage.getItem(this['bucket'])); //console.log('collections ', (collections || null) ); if ( typeof(collections[name]) == 'undefined' ) { collections[name] = []; storage.setItem(th...
[ "function", "Collection", "(", "name", ")", "{", "// retrieve collections state", "collections", "=", "JSON", ".", "parse", "(", "storage", ".", "getItem", "(", "this", "[", "'bucket'", "]", ")", ")", ";", "//console.log('collections ', (collections || null) );", "i...
Create or Get Collection by name @param {string} name - Collection name
[ "Create", "or", "Get", "Collection", "by", "name" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/asset/js/plugin/dist/gina.min.js#L3992-L4006
train
Rhinostone/gina
core/asset/js/plugin/dist/gina.min.js
collectionInsert
function collectionInsert(content) { // TODO - add uuid content['_id'] = uuid.v1(); content['_createdAt'] = new Date().format("isoDateTime"); content['_updatedAt'] = new Date().format("isoDateTime"); collections[ this['_collection'] ][ collections[ this['_collection']...
javascript
function collectionInsert(content) { // TODO - add uuid content['_id'] = uuid.v1(); content['_createdAt'] = new Date().format("isoDateTime"); content['_updatedAt'] = new Date().format("isoDateTime"); collections[ this['_collection'] ][ collections[ this['_collection']...
[ "function", "collectionInsert", "(", "content", ")", "{", "// TODO - add uuid", "content", "[", "'_id'", "]", "=", "uuid", ".", "v1", "(", ")", ";", "content", "[", "'_createdAt'", "]", "=", "new", "Date", "(", ")", ".", "format", "(", "\"isoDateTime\"", ...
Insert into collection @param {object} content
[ "Insert", "into", "collection" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/asset/js/plugin/dist/gina.min.js#L4029-L4039
train
Rhinostone/gina
core/asset/js/plugin/dist/gina.min.js
collectionFind
function collectionFind(filter, options) { if (!filter) { // TODO - limit of ten by return collections[ this['_collection'] ] } if ( typeof(filter) !== 'object' ) { // == findAll throw new Error('filter must be an object'); } else { //cons...
javascript
function collectionFind(filter, options) { if (!filter) { // TODO - limit of ten by return collections[ this['_collection'] ] } if ( typeof(filter) !== 'object' ) { // == findAll throw new Error('filter must be an object'); } else { //cons...
[ "function", "collectionFind", "(", "filter", ",", "options", ")", "{", "if", "(", "!", "filter", ")", "{", "// TODO - limit of ten by", "return", "collections", "[", "this", "[", "'_collection'", "]", "]", "}", "if", "(", "typeof", "(", "filter", ")", "!==...
Find from collection // TODO - add options @param {object} filter @param {object} [options] - e.g.: limit @return {array} result
[ "Find", "from", "collection" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/asset/js/plugin/dist/gina.min.js#L4051-L4085
train
Rhinostone/gina
core/asset/js/plugin/dist/gina.min.js
collectionDelete
function collectionDelete(filter) { if ( typeof(filter) !== 'object' ) { throw new Error('filter must be an object'); } else { var content = JSON.parse(JSON.stringify( collections[ this['_collection'] ] )) //, condition = filter.count() , i ...
javascript
function collectionDelete(filter) { if ( typeof(filter) !== 'object' ) { throw new Error('filter must be an object'); } else { var content = JSON.parse(JSON.stringify( collections[ this['_collection'] ] )) //, condition = filter.count() , i ...
[ "function", "collectionDelete", "(", "filter", ")", "{", "if", "(", "typeof", "(", "filter", ")", "!==", "'object'", ")", "{", "throw", "new", "Error", "(", "'filter must be an object'", ")", ";", "}", "else", "{", "var", "content", "=", "JSON", ".", "pa...
Delete from collection @param {object} filter @return {array} result
[ "Delete", "from", "collection" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/asset/js/plugin/dist/gina.min.js#L4257-L4291
train
Rhinostone/gina
core/asset/js/plugin/dist/gina.min.js
WS
function WS(opts) { var forceBase64 = opts && opts.forceBase64; if (forceBase64) { this.supportsBinary = false; } this.perMessageDeflate = opts.perMessageDeflate; this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; this.protocols = opts.protocols; if (!this.usingBrowserWebSocket)...
javascript
function WS(opts) { var forceBase64 = opts && opts.forceBase64; if (forceBase64) { this.supportsBinary = false; } this.perMessageDeflate = opts.perMessageDeflate; this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; this.protocols = opts.protocols; if (!this.usingBrowserWebSocket)...
[ "function", "WS", "(", "opts", ")", "{", "var", "forceBase64", "=", "opts", "&&", "opts", ".", "forceBase64", ";", "if", "(", "forceBase64", ")", "{", "this", ".", "supportsBinary", "=", "false", ";", "}", "this", ".", "perMessageDeflate", "=", "opts", ...
WebSocket transport constructor. @api {Object} connection options @api public
[ "WebSocket", "transport", "constructor", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/asset/js/plugin/dist/gina.min.js#L9489-L9501
train
AlCalzone/shared-utils
build/typeguards/index.js
isArray
function isArray(it) { if (Array.isArray != null) return Array.isArray(it); return Object.prototype.toString.call(it) === "[object Array]"; }
javascript
function isArray(it) { if (Array.isArray != null) return Array.isArray(it); return Object.prototype.toString.call(it) === "[object Array]"; }
[ "function", "isArray", "(", "it", ")", "{", "if", "(", "Array", ".", "isArray", "!=", "null", ")", "return", "Array", ".", "isArray", "(", "it", ")", ";", "return", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "it", ")", "===", "\...
Tests whether the given variable is really an Array @param it The variable to test
[ "Tests", "whether", "the", "given", "variable", "is", "really", "an", "Array" ]
9048e1f8793909fae7acb503984a4d8aadad4f3b
https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/typeguards/index.js#L20-L24
train
Rhinostone/gina
core/gna.js
function(err) { if ( process.argv[2] == '-s' && startWithGina || process.argv[2] == '--start' && startWithGina //Avoid -h, -v .... || !startWithGina && isPath && process.argv.length > 3 ) { if (isPath && !startWithGina) { console.log('You are...
javascript
function(err) { if ( process.argv[2] == '-s' && startWithGina || process.argv[2] == '--start' && startWithGina //Avoid -h, -v .... || !startWithGina && isPath && process.argv.length > 3 ) { if (isPath && !startWithGina) { console.log('You are...
[ "function", "(", "err", ")", "{", "if", "(", "process", ".", "argv", "[", "2", "]", "==", "'-s'", "&&", "startWithGina", "||", "process", ".", "argv", "[", "2", "]", "==", "'--start'", "&&", "startWithGina", "//Avoid -h, -v ....", "||", "!", "startWithG...
Todo - load from env.json or locals or project.json ??
[ "Todo", "-", "load", "from", "env", ".", "json", "or", "locals", "or", "project", ".", "json", "??" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/gna.js#L228-L245
train
MarkGriffiths/badges
src/cli.js
render
async function render(template) { const content = { badges: await badges(argv.context), usage: '' } if (argv.usage) { content.usage = readFileSync(resolve(argv.usage)) } const page = await remark().use(gap).use(squeeze).process(template(content)) process.stdout.write(page.toString()) }
javascript
async function render(template) { const content = { badges: await badges(argv.context), usage: '' } if (argv.usage) { content.usage = readFileSync(resolve(argv.usage)) } const page = await remark().use(gap).use(squeeze).process(template(content)) process.stdout.write(page.toString()) }
[ "async", "function", "render", "(", "template", ")", "{", "const", "content", "=", "{", "badges", ":", "await", "badges", "(", "argv", ".", "context", ")", ",", "usage", ":", "''", "}", "if", "(", "argv", ".", "usage", ")", "{", "content", ".", "us...
Render the page to stdout @param {lodash} template A processed lodash template of the source
[ "Render", "the", "page", "to", "stdout" ]
94fd02f96f50b0a6e3995c6acbd8f28497e43244
https://github.com/MarkGriffiths/badges/blob/94fd02f96f50b0a6e3995c6acbd8f28497e43244/src/cli.js#L134-L146
train
AlCalzone/shared-utils
build/async/index.js
promiseSequence
function promiseSequence(promiseFactories) { return __awaiter(this, void 0, void 0, function* () { const ret = []; for (const f of promiseFactories) { ret.push(yield f()); } return ret; }); }
javascript
function promiseSequence(promiseFactories) { return __awaiter(this, void 0, void 0, function* () { const ret = []; for (const f of promiseFactories) { ret.push(yield f()); } return ret; }); }
[ "function", "promiseSequence", "(", "promiseFactories", ")", "{", "return", "__awaiter", "(", "this", ",", "void", "0", ",", "void", "0", ",", "function", "*", "(", ")", "{", "const", "ret", "=", "[", "]", ";", "for", "(", "const", "f", "of", "promis...
Executes the given promise-returning functions in sequence @param promiseFactories An array of promise-returning functions @returns An array containing all return values of the executed promises
[ "Executes", "the", "given", "promise", "-", "returning", "functions", "in", "sequence" ]
9048e1f8793909fae7acb503984a4d8aadad4f3b
https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/async/index.js#L54-L62
train
Rhinostone/gina
core/utils/helpers/path.js
function(source, destination, i, callback, excluded) { var isExcluded = false; if ( typeof(excluded) != 'undefined' && excluded != undefined) { var f, p = source.split('/'); f = p[p.length-1]; for (var r= 0; r<excluded.length; ++r) { if ( typeof(exclud...
javascript
function(source, destination, i, callback, excluded) { var isExcluded = false; if ( typeof(excluded) != 'undefined' && excluded != undefined) { var f, p = source.split('/'); f = p[p.length-1]; for (var r= 0; r<excluded.length; ++r) { if ( typeof(exclud...
[ "function", "(", "source", ",", "destination", ",", "i", ",", "callback", ",", "excluded", ")", "{", "var", "isExcluded", "=", "false", ";", "if", "(", "typeof", "(", "excluded", ")", "!=", "'undefined'", "&&", "excluded", "!=", "undefined", ")", "{", ...
Copy file to file @param {string} source @param {string} destination @param {number} [i] @param {number} [fileCount] @callback callback @param {bool|string} err
[ "Copy", "file", "to", "file" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/helpers/path.js#L788-L853
train
AlCalzone/shared-utils
build/objects/index.js
entries
function entries(obj) { return Object.keys(obj) .map(key => [key, obj[key]]); }
javascript
function entries(obj) { return Object.keys(obj) .map(key => [key, obj[key]]); }
[ "function", "entries", "(", "obj", ")", "{", "return", "Object", ".", "keys", "(", "obj", ")", ".", "map", "(", "key", "=>", "[", "key", ",", "obj", "[", "key", "]", "]", ")", ";", "}" ]
Provides a polyfill for Object.entries
[ "Provides", "a", "polyfill", "for", "Object", ".", "entries" ]
9048e1f8793909fae7acb503984a4d8aadad4f3b
https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/objects/index.js#L5-L8
train
AlCalzone/shared-utils
build/objects/index.js
filter
function filter(obj, predicate) { return composeObject(entries(obj).filter(([key, value]) => predicate(value, key))); }
javascript
function filter(obj, predicate) { return composeObject(entries(obj).filter(([key, value]) => predicate(value, key))); }
[ "function", "filter", "(", "obj", ",", "predicate", ")", "{", "return", "composeObject", "(", "entries", "(", "obj", ")", ".", "filter", "(", "(", "[", "key", ",", "value", "]", ")", "=>", "predicate", "(", "value", ",", "key", ")", ")", ")", ";", ...
Returns a subset of an object, whose properties match the given predicate @param obj The object whose properties should be filtered @param predicate A predicate function which is applied to the object's properties
[ "Returns", "a", "subset", "of", "an", "object", "whose", "properties", "match", "the", "given", "predicate" ]
9048e1f8793909fae7acb503984a4d8aadad4f3b
https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/objects/index.js#L21-L23
train
AlCalzone/shared-utils
build/objects/index.js
composeObject
function composeObject(properties) { return properties.reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}); }
javascript
function composeObject(properties) { return properties.reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}); }
[ "function", "composeObject", "(", "properties", ")", "{", "return", "properties", ".", "reduce", "(", "(", "acc", ",", "[", "key", ",", "value", "]", ")", "=>", "{", "acc", "[", "key", "]", "=", "value", ";", "return", "acc", ";", "}", ",", "{", ...
Combines multiple key value pairs into an object @param properties The key value pairs to combine into an object
[ "Combines", "multiple", "key", "value", "pairs", "into", "an", "object" ]
9048e1f8793909fae7acb503984a4d8aadad4f3b
https://github.com/AlCalzone/shared-utils/blob/9048e1f8793909fae7acb503984a4d8aadad4f3b/build/objects/index.js#L29-L34
train
dowjones/distribucache
lib/decorators/MarshallDecorator.js
unmarshallWrapper
function unmarshallWrapper (cb) { return function (err, value) { if (err) return cb(err); var m = unmarshall(value); cb(m.error, m.value); }; }
javascript
function unmarshallWrapper (cb) { return function (err, value) { if (err) return cb(err); var m = unmarshall(value); cb(m.error, m.value); }; }
[ "function", "unmarshallWrapper", "(", "cb", ")", "{", "return", "function", "(", "err", ",", "value", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";", "var", "m", "=", "unmarshall", "(", "value", ")", ";", "cb", "(", "m", "....
Helper for unmarshalling values provided to a callback. @param {Object} cb @return {Function} (err, marshalledValue)
[ "Helper", "for", "unmarshalling", "values", "provided", "to", "a", "callback", "." ]
ad79caee277771a6e49ee4a98c4983480cd89945
https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/MarshallDecorator.js#L85-L91
train
redgeoff/quelle
scripts/filtered-stream-iterator.js
function (streamIterator, onItem) { StreamIterator.apply(this, arguments); this._streamIterator = streamIterator; this._onItem = onItem; // Pipe data so that we can filter it in FilteredStreamIterator streamIterator.pipe(this); }
javascript
function (streamIterator, onItem) { StreamIterator.apply(this, arguments); this._streamIterator = streamIterator; this._onItem = onItem; // Pipe data so that we can filter it in FilteredStreamIterator streamIterator.pipe(this); }
[ "function", "(", "streamIterator", ",", "onItem", ")", "{", "StreamIterator", ".", "apply", "(", "this", ",", "arguments", ")", ";", "this", ".", "_streamIterator", "=", "streamIterator", ";", "this", ".", "_onItem", "=", "onItem", ";", "// Pipe data so that w...
onItem can be a promise factory or just a factory. It should return null when the item should be filtered out.
[ "onItem", "can", "be", "a", "promise", "factory", "or", "just", "a", "factory", ".", "It", "should", "return", "null", "when", "the", "item", "should", "be", "filtered", "out", "." ]
f919d8fc59a1e3cb468f43dc322f799ab817ce3e
https://github.com/redgeoff/quelle/blob/f919d8fc59a1e3cb468f43dc322f799ab817ce3e/scripts/filtered-stream-iterator.js#L9-L17
train
Jack12816/greppy
lib/db/adapter/mongodb.js
function(callback) { // Connect to the given URI with the given options self.mongo.MongoClient.connect(self.config.uri, defaultOpts, function(err, db) { if (err) { return callback && callback(err); } // Rewrite connection self.connect...
javascript
function(callback) { // Connect to the given URI with the given options self.mongo.MongoClient.connect(self.config.uri, defaultOpts, function(err, db) { if (err) { return callback && callback(err); } // Rewrite connection self.connect...
[ "function", "(", "callback", ")", "{", "// Connect to the given URI with the given options", "self", ".", "mongo", ".", "MongoClient", ".", "connect", "(", "self", ".", "config", ".", "uri", ",", "defaultOpts", ",", "function", "(", "err", ",", "db", ")", "{",...
Setup the plain MongoDB connection
[ "Setup", "the", "plain", "MongoDB", "connection" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/db/adapter/mongodb.js#L64-L78
train
vimlet/vimlet-commons
docs/release/framework/vcomet/data/store/StoreRest.js
restXhr
function restXhr(store, url, eventName, sortRequest) { // Set up request var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); // TODO - Set range header parameter xhr.setRequestHeader("Content-Type", "application/json"); // Callback xhr.onload = function(e) { // ...
javascript
function restXhr(store, url, eventName, sortRequest) { // Set up request var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); // TODO - Set range header parameter xhr.setRequestHeader("Content-Type", "application/json"); // Callback xhr.onload = function(e) { // ...
[ "function", "restXhr", "(", "store", ",", "url", ",", "eventName", ",", "sortRequest", ")", "{", "// Set up request", "var", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ";", "xhr", ".", "open", "(", "\"GET\"", ",", "url", ",", "true", ")", ";", "// ...
Set up and execute xhr request @param {[type]} el [description] @param {[type]} url [description] @param {[type]} event [description] @return {[type]} [description] /* @function restXhr @description Set up and execute xhr request @param {Object} store [Store element] @param {String} url [Request ...
[ "Set", "up", "and", "execute", "xhr", "request" ]
c2d06dd64637e6729872ef82b40e99b7155b0dea
https://github.com/vimlet/vimlet-commons/blob/c2d06dd64637e6729872ef82b40e99b7155b0dea/docs/release/framework/vcomet/data/store/StoreRest.js#L311-L339
train
Jack12816/greppy
bin/command/new.js
function(callback) { var binary = binaries.bower; binary.command = 'bower --allow-root install'; helper.runCommand( binary, path, 'bower binary is not ready to use, fix this (npm install -g bower) and retry ' + 'installation of front...
javascript
function(callback) { var binary = binaries.bower; binary.command = 'bower --allow-root install'; helper.runCommand( binary, path, 'bower binary is not ready to use, fix this (npm install -g bower) and retry ' + 'installation of front...
[ "function", "(", "callback", ")", "{", "var", "binary", "=", "binaries", ".", "bower", ";", "binary", ".", "command", "=", "'bower --allow-root install'", ";", "helper", ".", "runCommand", "(", "binary", ",", "path", ",", "'bower binary is not ready to use, fix th...
Run bower to install all frontend dependencies
[ "Run", "bower", "to", "install", "all", "frontend", "dependencies" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/bin/command/new.js#L183-L194
train
Jack12816/greppy
bin/command/new.js
function(binaries, callback) { helper.createProjectStructure(appPath, function(err) { callback && callback(err, binaries); }); }
javascript
function(binaries, callback) { helper.createProjectStructure(appPath, function(err) { callback && callback(err, binaries); }); }
[ "function", "(", "binaries", ",", "callback", ")", "{", "helper", ".", "createProjectStructure", "(", "appPath", ",", "function", "(", "err", ")", "{", "callback", "&&", "callback", "(", "err", ",", "binaries", ")", ";", "}", ")", ";", "}" ]
Create the project structure
[ "Create", "the", "project", "structure" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/bin/command/new.js#L245-L249
train
Kronos-Integration/kronos-interceptor-object-data-processor-row
lib/recordCheck/data-check-date.js
function (fieldDefinition, fieldName) { const fieldType = propertyHelper.getFieldType(fieldDefinition); if (fieldType === 'date') { // This field is a date field. Create the checks return createDateChecks(fieldDefinition, fieldName); } }
javascript
function (fieldDefinition, fieldName) { const fieldType = propertyHelper.getFieldType(fieldDefinition); if (fieldType === 'date') { // This field is a date field. Create the checks return createDateChecks(fieldDefinition, fieldName); } }
[ "function", "(", "fieldDefinition", ",", "fieldName", ")", "{", "const", "fieldType", "=", "propertyHelper", ".", "getFieldType", "(", "fieldDefinition", ")", ";", "if", "(", "fieldType", "===", "'date'", ")", "{", "// This field is a date field. Create the checks", ...
Creates the date checks for a date field @param fieldDefinition The field_definition schema @param fieldName The name of the current field
[ "Creates", "the", "date", "checks", "for", "a", "date", "field" ]
678a59b84dab4a9082377c90849a0d62d97a1ea4
https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/recordCheck/data-check-date.js#L15-L22
train
Rhinostone/gina
core/utils/lib/url/index.js
function(route) { return (route != null && self.routes != null && typeof(self.routes[route]) != 'undefined' && self.routes[route] != null) }
javascript
function(route) { return (route != null && self.routes != null && typeof(self.routes[route]) != 'undefined' && self.routes[route] != null) }
[ "function", "(", "route", ")", "{", "return", "(", "route", "!=", "null", "&&", "self", ".", "routes", "!=", "null", "&&", "typeof", "(", "self", ".", "routes", "[", "route", "]", ")", "!=", "'undefined'", "&&", "self", ".", "routes", "[", "route", ...
Check if the route name exists in routing.
[ "Check", "if", "the", "route", "name", "exists", "in", "routing", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/url/index.js#L111-L113
train
Rhinostone/gina
core/utils/lib/url/index.js
function(route, args) { var index; // There is a requirement for this route. if (typeof(self.routes[route].requirements) != 'undefined') { // For each arguments. for (index in args) { // If there is a requirement. if (self.routes[route].re...
javascript
function(route, args) { var index; // There is a requirement for this route. if (typeof(self.routes[route].requirements) != 'undefined') { // For each arguments. for (index in args) { // If there is a requirement. if (self.routes[route].re...
[ "function", "(", "route", ",", "args", ")", "{", "var", "index", ";", "// There is a requirement for this route.", "if", "(", "typeof", "(", "self", ".", "routes", "[", "route", "]", ".", "requirements", ")", "!=", "'undefined'", ")", "{", "// For each argumen...
Check if each arguments given has a requirement and check if it is fulfilled.
[ "Check", "if", "each", "arguments", "given", "has", "a", "requirement", "and", "check", "if", "it", "is", "fulfilled", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/url/index.js#L116-L135
train
Kronos-Integration/kronos-interceptor-object-data-processor-row
lib/data-processor-row.js
getCheckInfo
function getCheckInfo(checkProperty, fieldName) { let severity; let value; if (typeof checkProperty[fieldName] === 'object') { severity = checkProperty[fieldName].severity; value = checkProperty[fieldName].val; } else { severity = checkProperty.severity; value = checkProperty[fieldName]; } return { val...
javascript
function getCheckInfo(checkProperty, fieldName) { let severity; let value; if (typeof checkProperty[fieldName] === 'object') { severity = checkProperty[fieldName].severity; value = checkProperty[fieldName].val; } else { severity = checkProperty.severity; value = checkProperty[fieldName]; } return { val...
[ "function", "getCheckInfo", "(", "checkProperty", ",", "fieldName", ")", "{", "let", "severity", ";", "let", "value", ";", "if", "(", "typeof", "checkProperty", "[", "fieldName", "]", "===", "'object'", ")", "{", "severity", "=", "checkProperty", "[", "field...
Extracts the type value and the severity of a given check name from the checkProperty @param checkProperty The checkProperty as defined in the schema @param fieldName The name of the field in the checkProperty @return infoObject An object containing the boolean value and the severity
[ "Extracts", "the", "type", "value", "and", "the", "severity", "of", "a", "given", "check", "name", "from", "the", "checkProperty" ]
678a59b84dab4a9082377c90849a0d62d97a1ea4
https://github.com/Kronos-Integration/kronos-interceptor-object-data-processor-row/blob/678a59b84dab4a9082377c90849a0d62d97a1ea4/lib/data-processor-row.js#L130-L145
train
dowjones/distribucache
lib/decorators/PromiseDecorator.js
PromiseDecorator
function PromiseDecorator(cache) { BaseDecorator.call(this, cache); this.get = promisify(this.get.bind(this)); this.set = promisify(this.set.bind(this)); this.del = promisify(this.del.bind(this)); }
javascript
function PromiseDecorator(cache) { BaseDecorator.call(this, cache); this.get = promisify(this.get.bind(this)); this.set = promisify(this.set.bind(this)); this.del = promisify(this.del.bind(this)); }
[ "function", "PromiseDecorator", "(", "cache", ")", "{", "BaseDecorator", ".", "call", "(", "this", ",", "cache", ")", ";", "this", ".", "get", "=", "promisify", "(", "this", ".", "get", ".", "bind", "(", "this", ")", ")", ";", "this", ".", "set", "...
If no callbacks are provided to get, set or del a Promise will be returned.
[ "If", "no", "callbacks", "are", "provided", "to", "get", "set", "or", "del", "a", "Promise", "will", "be", "returned", "." ]
ad79caee277771a6e49ee4a98c4983480cd89945
https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/PromiseDecorator.js#L13-L18
train
Rhinostone/gina
core/utils/lib/config.js
function(app, file, content, callback) { var paths = { root : content.paths.root, utils : content.paths.utils }; var gnaFolder = content.paths.root + '/.gna'; self.project = content.project; self.paths = paths; //Create path. var create...
javascript
function(app, file, content, callback) { var paths = { root : content.paths.root, utils : content.paths.utils }; var gnaFolder = content.paths.root + '/.gna'; self.project = content.project; self.paths = paths; //Create path. var create...
[ "function", "(", "app", ",", "file", ",", "content", ",", "callback", ")", "{", "var", "paths", "=", "{", "root", ":", "content", ".", "paths", ".", "root", ",", "utils", ":", "content", ".", "paths", ".", "utils", "}", ";", "var", "gnaFolder", "="...
Create a config file @param {string} app - Targeted application @param {string} file - File save @param {string} content - Content fo the file to save TOTO - Avoid systematics file override. @private
[ "Create", "a", "config", "file" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/config.js#L196-L286
train
Rhinostone/gina
core/utils/lib/config.js
function(){ if ( fs.existsSync(gnaFolder) ) { if ( !fs.existsSync(gnaFolder +'/'+ file) ) { createContent(gnaFolder +'/'+ file, gnaFolder, content, function(err){ setTimeout(function(){ callback(err) ...
javascript
function(){ if ( fs.existsSync(gnaFolder) ) { if ( !fs.existsSync(gnaFolder +'/'+ file) ) { createContent(gnaFolder +'/'+ file, gnaFolder, content, function(err){ setTimeout(function(){ callback(err) ...
[ "function", "(", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "gnaFolder", ")", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "gnaFolder", "+", "'/'", "+", "file", ")", ")", "{", "createContent", "(", "gnaFolder", "+", "'/'", "+", ...
Create path.
[ "Create", "path", "." ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/config.js#L209-L237
train
Rhinostone/gina
core/utils/lib/config.js
function(path, callback){ fs.exists(path, function(exists){ if (exists) { fs.lstat(path, function(err, stats){ if (err) console.error(err.stack); if ( stats.isSymbolicLink() ) fs.unlink(path, function(err){ if (err) { ...
javascript
function(path, callback){ fs.exists(path, function(exists){ if (exists) { fs.lstat(path, function(err, stats){ if (err) console.error(err.stack); if ( stats.isSymbolicLink() ) fs.unlink(path, function(err){ if (err) { ...
[ "function", "(", "path", ",", "callback", ")", "{", "fs", ".", "exists", "(", "path", ",", "function", "(", "exists", ")", "{", "if", "(", "exists", ")", "{", "fs", ".", "lstat", "(", "path", ",", "function", "(", "err", ",", "stats", ")", "{", ...
Remove symbolic link @param {string} path @callback callback @private
[ "Remove", "symbolic", "link" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/config.js#L297-L330
train
Rhinostone/gina
core/utils/lib/config.js
function(namespace, config) { if ( typeof(config) == "undefined" ) var config = self.getSync(app); if (config != null) { var split = namespace.split('.'), k=0; while (k<split.length) { config = config[split[k++]] } return confi...
javascript
function(namespace, config) { if ( typeof(config) == "undefined" ) var config = self.getSync(app); if (config != null) { var split = namespace.split('.'), k=0; while (k<split.length) { config = config[split[k++]] } return confi...
[ "function", "(", "namespace", ",", "config", ")", "{", "if", "(", "typeof", "(", "config", ")", "==", "\"undefined\"", ")", "var", "config", "=", "self", ".", "getSync", "(", "app", ")", ";", "if", "(", "config", "!=", "null", ")", "{", "var", "spl...
Get var value by namespace @param {string} namespace @param {object} [config ] - Config object @return {*} value - Can be String or Array @private
[ "Get", "var", "value", "by", "namespace" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/config.js#L406-L419
train
Rhinostone/gina
core/utils/lib/config.js
function(app, namespace, callback){ self.get(app, function(err, config){ if (err) { //logger.error('gina', 'UTILS:CONFIG:ERR:4', err, __stack); console.error(err.stack||err.message); callback(err + 'Utils.Config.get(...)'); } ...
javascript
function(app, namespace, callback){ self.get(app, function(err, config){ if (err) { //logger.error('gina', 'UTILS:CONFIG:ERR:4', err, __stack); console.error(err.stack||err.message); callback(err + 'Utils.Config.get(...)'); } ...
[ "function", "(", "app", ",", "namespace", ",", "callback", ")", "{", "self", ".", "get", "(", "app", ",", "function", "(", "err", ",", "config", ")", "{", "if", "(", "err", ")", "{", "//logger.error('gina', 'UTILS:CONFIG:ERR:4', err, __stack);", "console", "...
Get path by app & namespance @param {string} app @param {string} namespace @callback callback @param {string} err @param {string} path @private
[ "Get", "path", "by", "app", "&", "namespance" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/config.js#L433-L450
train
Rhinostone/gina
core/utils/lib/cmd/gina-add-bundle.js
function(callback) { var data = JSON.parse(JSON.stringify(self.projectData, null, 4)); data.bundles[self.bundle] = { "comment" : "Your comment goes here.", "tag" : "001", "src" : "src/" + bundle, "release" : { "version" : "0.0.1", ...
javascript
function(callback) { var data = JSON.parse(JSON.stringify(self.projectData, null, 4)); data.bundles[self.bundle] = { "comment" : "Your comment goes here.", "tag" : "001", "src" : "src/" + bundle, "release" : { "version" : "0.0.1", ...
[ "function", "(", "callback", ")", "{", "var", "data", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "self", ".", "projectData", ",", "null", ",", "4", ")", ")", ";", "data", ".", "bundles", "[", "self", ".", "bundle", "]", "=", "...
Save project.json @param {string} projectPath @param {object} content - Project file content to save
[ "Save", "project", ".", "json" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/cmd/gina-add-bundle.js#L113-L130
train
majorleaguesoccer/respectify
lib/respectify.js
validVersion
function validVersion(version, spec) { // Normalize route versions var test = spec.versions || [spec.version] // Check for direct version match if (~test.indexOf(version)) { return true } // Use semver and attempt to match on supplied version return !!test.filter(function(v) { return semver.sati...
javascript
function validVersion(version, spec) { // Normalize route versions var test = spec.versions || [spec.version] // Check for direct version match if (~test.indexOf(version)) { return true } // Use semver and attempt to match on supplied version return !!test.filter(function(v) { return semver.sati...
[ "function", "validVersion", "(", "version", ",", "spec", ")", "{", "// Normalize route versions", "var", "test", "=", "spec", ".", "versions", "||", "[", "spec", ".", "version", "]", "// Check for direct version match", "if", "(", "~", "test", ".", "indexOf", ...
Check if a version is valid for a given route spec @param {String} version @param {Object} route specification @return {Boolean} valid @api private
[ "Check", "if", "a", "version", "is", "valid", "for", "a", "given", "route", "spec" ]
d19bac22526c1719c954864b74944e8a2707be15
https://github.com/majorleaguesoccer/respectify/blob/d19bac22526c1719c954864b74944e8a2707be15/lib/respectify.js#L37-L50
train
majorleaguesoccer/respectify
lib/respectify.js
errorWrap
function errorWrap(err, param, sent) { if (err instanceof restify.RestError) { err.body.parameter = param err.body.received = sent } return err }
javascript
function errorWrap(err, param, sent) { if (err instanceof restify.RestError) { err.body.parameter = param err.body.received = sent } return err }
[ "function", "errorWrap", "(", "err", ",", "param", ",", "sent", ")", "{", "if", "(", "err", "instanceof", "restify", ".", "RestError", ")", "{", "err", ".", "body", ".", "parameter", "=", "param", "err", ".", "body", ".", "received", "=", "sent", "}"...
Add extra information to a restify error instance @param {Error} restify RestError @param {Object} parameter spec @param {Any} value received
[ "Add", "extra", "information", "to", "a", "restify", "error", "instance" ]
d19bac22526c1719c954864b74944e8a2707be15
https://github.com/majorleaguesoccer/respectify/blob/d19bac22526c1719c954864b74944e8a2707be15/lib/respectify.js#L60-L66
train
majorleaguesoccer/respectify
lib/respectify.js
arrayDefaults
function arrayDefaults(arr, values) { values.forEach(function(x) { if (!~arr.indexOf(x)) arr.push(x) }) }
javascript
function arrayDefaults(arr, values) { values.forEach(function(x) { if (!~arr.indexOf(x)) arr.push(x) }) }
[ "function", "arrayDefaults", "(", "arr", ",", "values", ")", "{", "values", ".", "forEach", "(", "function", "(", "x", ")", "{", "if", "(", "!", "~", "arr", ".", "indexOf", "(", "x", ")", ")", "arr", ".", "push", "(", "x", ")", "}", ")", "}" ]
Array defaults helper, ensure all elements within `default` exist in the `arr` input @param {Array} source array @param {Array} default values to check @api private
[ "Array", "defaults", "helper", "ensure", "all", "elements", "within", "default", "exist", "in", "the", "arr", "input" ]
d19bac22526c1719c954864b74944e8a2707be15
https://github.com/majorleaguesoccer/respectify/blob/d19bac22526c1719c954864b74944e8a2707be15/lib/respectify.js#L77-L81
train
majorleaguesoccer/respectify
lib/respectify.js
getParams
function getParams(obj) { var defs = [] for (var name in obj) { var data = obj[name] , fromPath = ~required.indexOf(name) // If string, assume a single data type if (typeof data === 'string') { data = data.split(',') } // If array, assume array of data types ...
javascript
function getParams(obj) { var defs = [] for (var name in obj) { var data = obj[name] , fromPath = ~required.indexOf(name) // If string, assume a single data type if (typeof data === 'string') { data = data.split(',') } // If array, assume array of data types ...
[ "function", "getParams", "(", "obj", ")", "{", "var", "defs", "=", "[", "]", "for", "(", "var", "name", "in", "obj", ")", "{", "var", "data", "=", "obj", "[", "name", "]", ",", "fromPath", "=", "~", "required", ".", "indexOf", "(", "name", ")", ...
Iterate through all defined parameter definitions
[ "Iterate", "through", "all", "defined", "parameter", "definitions" ]
d19bac22526c1719c954864b74944e8a2707be15
https://github.com/majorleaguesoccer/respectify/blob/d19bac22526c1719c954864b74944e8a2707be15/lib/respectify.js#L745-L820
train
artdecocode/spawncommand
build/index.js
spawnCommand
function spawnCommand(command, args, options) { if (!command) throw new Error('Please specify a command to spawn.') const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (spawn(command, args, options)) const promise = getPromise(proc) proc.promise = promise /** @suppress {checkTypes} */ proc.s...
javascript
function spawnCommand(command, args, options) { if (!command) throw new Error('Please specify a command to spawn.') const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (spawn(command, args, options)) const promise = getPromise(proc) proc.promise = promise /** @suppress {checkTypes} */ proc.s...
[ "function", "spawnCommand", "(", "command", ",", "args", ",", "options", ")", "{", "if", "(", "!", "command", ")", "throw", "new", "Error", "(", "'Please specify a command to spawn.'", ")", "const", "proc", "=", "/** @type {!_spawncommand.ChildProcessWithPromise} */",...
Spawns a new process using the `command` and returns an instance of a ChildProcess, extended to have a `promise` property which is resolved when the process exits. The resolved value is an object with `stdout`, `stderr` and `code` properties. @param {string} command The command to run. @param {!Array<string>} [args] Li...
[ "Spawns", "a", "new", "process", "using", "the", "command", "and", "returns", "an", "instance", "of", "a", "ChildProcess", "extended", "to", "have", "a", "promise", "property", "which", "is", "resolved", "when", "the", "process", "exits", ".", "The", "resolv...
baf242e35b8214230aee69a6f28288cb303be04b
https://github.com/artdecocode/spawncommand/blob/baf242e35b8214230aee69a6f28288cb303be04b/build/index.js#L32-L41
train
artdecocode/spawncommand
build/index.js
fork
function fork(mod, args, options) { if (!mod) throw new Error('Please specify a module to fork') const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (forkCp(mod, args, options)) const promise = getPromise(proc) proc.promise = promise /** @suppress {checkTypes} */ proc.spawnCommand = proc['sp...
javascript
function fork(mod, args, options) { if (!mod) throw new Error('Please specify a module to fork') const proc = /** @type {!_spawncommand.ChildProcessWithPromise} */ (forkCp(mod, args, options)) const promise = getPromise(proc) proc.promise = promise /** @suppress {checkTypes} */ proc.spawnCommand = proc['sp...
[ "function", "fork", "(", "mod", ",", "args", ",", "options", ")", "{", "if", "(", "!", "mod", ")", "throw", "new", "Error", "(", "'Please specify a module to fork'", ")", "const", "proc", "=", "/** @type {!_spawncommand.ChildProcessWithPromise} */", "(", "forkCp",...
Forks a process and assign a `promise` property to it, resolved with `stderr`, `stdout` and `code` properties on exit. @param {string} mod The module to run in the child. @param {!Array<string>} [args] List of string arguments. @param {!child_process.ForkOptions} [options] Options to fork the process with.
[ "Forks", "a", "process", "and", "assign", "a", "promise", "property", "to", "it", "resolved", "with", "stderr", "stdout", "and", "code", "properties", "on", "exit", "." ]
baf242e35b8214230aee69a6f28288cb303be04b
https://github.com/artdecocode/spawncommand/blob/baf242e35b8214230aee69a6f28288cb303be04b/build/index.js#L49-L58
train
invisible-tech/mongoose-extras
helpers/mongooseHelper.js
isSameObjectId
function isSameObjectId(a, b) { assert(isObjectId(a), '1st argument is not an ObjectId') assert(isObjectId(b), '2nd argument is not an ObjectId') return a.toString() === b.toString() }
javascript
function isSameObjectId(a, b) { assert(isObjectId(a), '1st argument is not an ObjectId') assert(isObjectId(b), '2nd argument is not an ObjectId') return a.toString() === b.toString() }
[ "function", "isSameObjectId", "(", "a", ",", "b", ")", "{", "assert", "(", "isObjectId", "(", "a", ")", ",", "'1st argument is not an ObjectId'", ")", "assert", "(", "isObjectId", "(", "b", ")", ",", "'2nd argument is not an ObjectId'", ")", "return", "a", "."...
A boolean representing if the objects given have the same Mongoose Object Id. Throws if the objects given aren't a Mongoose Object Id. @method isSameObjectId @param {ObjectId} a - A Mongoose Object Id (see mongoose.Types.ObjectId) @param {ObjectId} b - A Mongoose Object Id (see mongoose.Types.ObjectId) @return {Boolean...
[ "A", "boolean", "representing", "if", "the", "objects", "given", "have", "the", "same", "Mongoose", "Object", "Id", ".", "Throws", "if", "the", "objects", "given", "aren", "t", "a", "Mongoose", "Object", "Id", "." ]
9b572554a292ead1644b0afa3fc5a5b382d5dec9
https://github.com/invisible-tech/mongoose-extras/blob/9b572554a292ead1644b0afa3fc5a5b382d5dec9/helpers/mongooseHelper.js#L72-L76
train
invisible-tech/mongoose-extras
helpers/mongooseHelper.js
assertInstance
function assertInstance(instance, model) { const modelName = get('modelName')(model) try { mongoose.model(modelName) } catch (err) { throw Error(`no such model as ${modelName}`) } const errMsg = stripIndents` Expected an instance of ${modelName} but got this: ${JSON.stringify(instance, undefin...
javascript
function assertInstance(instance, model) { const modelName = get('modelName')(model) try { mongoose.model(modelName) } catch (err) { throw Error(`no such model as ${modelName}`) } const errMsg = stripIndents` Expected an instance of ${modelName} but got this: ${JSON.stringify(instance, undefin...
[ "function", "assertInstance", "(", "instance", ",", "model", ")", "{", "const", "modelName", "=", "get", "(", "'modelName'", ")", "(", "model", ")", "try", "{", "mongoose", ".", "model", "(", "modelName", ")", "}", "catch", "(", "err", ")", "{", "throw...
Throws if a given object is not an instance of given model. @method assertInstance @param {Mixed} instance - Could be anything, but most likely a mongoose Model @param {Model} model - The Model from Mongoose (see mongoose.model('User')) @return {undefined} @throws {Error} - Throws if input is not an instance of model, ...
[ "Throws", "if", "a", "given", "object", "is", "not", "an", "instance", "of", "given", "model", "." ]
9b572554a292ead1644b0afa3fc5a5b382d5dec9
https://github.com/invisible-tech/mongoose-extras/blob/9b572554a292ead1644b0afa3fc5a5b382d5dec9/helpers/mongooseHelper.js#L86-L97
train
dowjones/distribucache
lib/decorators/ExpiresDecorator.js
ExpiresDecorator
function ExpiresDecorator(cache, config) { BaseDecorator.call(this, cache, config, joi.object().keys({ expiresIn: joi.number().integer().min(0).default(Infinity), staleIn: joi.number().integer().min(0).default(Infinity) })); this.on('set:after', this.setCreatedAt.bind(this)); this._store = this._getStor...
javascript
function ExpiresDecorator(cache, config) { BaseDecorator.call(this, cache, config, joi.object().keys({ expiresIn: joi.number().integer().min(0).default(Infinity), staleIn: joi.number().integer().min(0).default(Infinity) })); this.on('set:after', this.setCreatedAt.bind(this)); this._store = this._getStor...
[ "function", "ExpiresDecorator", "(", "cache", ",", "config", ")", "{", "BaseDecorator", ".", "call", "(", "this", ",", "cache", ",", "config", ",", "joi", ".", "object", "(", ")", ".", "keys", "(", "{", "expiresIn", ":", "joi", ".", "number", "(", ")...
Expire Redis-backed cache @param {Cache} cache @param {Object} [config] @param {String} [config.expiresIn] in ms @param {String} [config.staleIn] in ms
[ "Expire", "Redis", "-", "backed", "cache" ]
ad79caee277771a6e49ee4a98c4983480cd89945
https://github.com/dowjones/distribucache/blob/ad79caee277771a6e49ee4a98c4983480cd89945/lib/decorators/ExpiresDecorator.js#L18-L25
train
Jack12816/greppy
lib/helper/service/json-wsp/client.js
function(err) { var message = 'Error occured while performing a JSON-WSP request. ' + err.message + '\n' + JSON.stringify({ options : curOpts }, null, ' ').yellow; logger.error(message); }
javascript
function(err) { var message = 'Error occured while performing a JSON-WSP request. ' + err.message + '\n' + JSON.stringify({ options : curOpts }, null, ' ').yellow; logger.error(message); }
[ "function", "(", "err", ")", "{", "var", "message", "=", "'Error occured while performing a JSON-WSP request. '", "+", "err", ".", "message", "+", "'\\n'", "+", "JSON", ".", "stringify", "(", "{", "options", ":", "curOpts", "}", ",", "null", ",", "' '", ")"...
Default error handler
[ "Default", "error", "handler" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/helper/service/json-wsp/client.js#L140-L149
train
angrykoala/xejs
main.js
promesify
function promesify(err, res) { if (!err) return Promise.resolve(res); else return Promise.reject(err); }
javascript
function promesify(err, res) { if (!err) return Promise.resolve(res); else return Promise.reject(err); }
[ "function", "promesify", "(", "err", ",", "res", ")", "{", "if", "(", "!", "err", ")", "return", "Promise", ".", "resolve", "(", "res", ")", ";", "else", "return", "Promise", ".", "reject", "(", "err", ")", ";", "}" ]
Private function to return a promise if no done is found
[ "Private", "function", "to", "return", "a", "promise", "if", "no", "done", "is", "found" ]
9c5ec8d880d416d39b4e51c17b88694fb3bae9ce
https://github.com/angrykoala/xejs/blob/9c5ec8d880d416d39b4e51c17b88694fb3bae9ce/main.js#L65-L68
train
smartholdem/sth-js
lib/ecsignature.js
ECSignature
function ECSignature (r, s) { typeforce(types.tuple(types.BigInt, types.BigInt), arguments) /** @type {BigInteger} */ this.r = r /** @type {BigInteger} */ this.s = s }
javascript
function ECSignature (r, s) { typeforce(types.tuple(types.BigInt, types.BigInt), arguments) /** @type {BigInteger} */ this.r = r /** @type {BigInteger} */ this.s = s }
[ "function", "ECSignature", "(", "r", ",", "s", ")", "{", "typeforce", "(", "types", ".", "tuple", "(", "types", ".", "BigInt", ",", "types", ".", "BigInt", ")", ",", "arguments", ")", "/** @type {BigInteger} */", "this", ".", "r", "=", "r", "/** @type {B...
Creates a new ECSignature. @constructor @param {BigInteger} r @param {BigInteger} s
[ "Creates", "a", "new", "ECSignature", "." ]
c65cb4fb97dd691d01d7089ec812b749948882f9
https://github.com/smartholdem/sth-js/blob/c65cb4fb97dd691d01d7089ec812b749948882f9/lib/ecsignature.js#L14-L19
train
stormpath/stormpath-node-config
lib/ConfigLoader.js
ConfigLoader
function ConfigLoader(strategies, logger) { this.strategies = []; if (logger) { if (typeof logger.debug !== 'function') { throw new Error('Provided logger is required to have method debug().'); } this.logger = logger; } if (strategies && !(strategies instanceof Array)) { throw new Error(...
javascript
function ConfigLoader(strategies, logger) { this.strategies = []; if (logger) { if (typeof logger.debug !== 'function') { throw new Error('Provided logger is required to have method debug().'); } this.logger = logger; } if (strategies && !(strategies instanceof Array)) { throw new Error(...
[ "function", "ConfigLoader", "(", "strategies", ",", "logger", ")", "{", "this", ".", "strategies", "=", "[", "]", ";", "if", "(", "logger", ")", "{", "if", "(", "typeof", "logger", ".", "debug", "!==", "'function'", ")", "{", "throw", "new", "Error", ...
ConfigLoader Represents a configuration loader that loads a configuration through a list of strategies. @constructor
[ "ConfigLoader", "Represents", "a", "configuration", "loader", "that", "loads", "a", "configuration", "through", "a", "list", "of", "strategies", "." ]
c9983cea3afada94d122aac395b1472e7d99b854
https://github.com/stormpath/stormpath-node-config/blob/c9983cea3afada94d122aac395b1472e7d99b854/lib/ConfigLoader.js#L14-L31
train
Rhinostone/gina
core/utils/lib/proc.js
function() { //Default. var pathObj = new _( getPath('root') + '/tmp/pid/' ); var path = pathObj.toString(); //Create dir if needed. //console.debug("MKDIR pathObj (pid:"+self.proc.pid+") - ", self.bundle); process.list = (process.list == undefined) ? [] : process.list...
javascript
function() { //Default. var pathObj = new _( getPath('root') + '/tmp/pid/' ); var path = pathObj.toString(); //Create dir if needed. //console.debug("MKDIR pathObj (pid:"+self.proc.pid+") - ", self.bundle); process.list = (process.list == undefined) ? [] : process.list...
[ "function", "(", ")", "{", "//Default.", "var", "pathObj", "=", "new", "_", "(", "getPath", "(", "'root'", ")", "+", "'/tmp/pid/'", ")", ";", "var", "path", "=", "pathObj", ".", "toString", "(", ")", ";", "//Create dir if needed.", "//console.debug(\"MKDIR ...
Check target path @param {string} path @param {integer} PID Id of the PID to save
[ "Check", "target", "path" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/utils/lib/proc.js#L80-L107
train
Jack12816/greppy
lib/db/adapter/mysql.js
function(callback) { self.pool = (require('mysql')).createPool({ user : self.config.username, password : self.config.password, database : self.config.db, host : self.config.host, port : self.config.port }); // Initiate ...
javascript
function(callback) { self.pool = (require('mysql')).createPool({ user : self.config.username, password : self.config.password, database : self.config.db, host : self.config.host, port : self.config.port }); // Initiate ...
[ "function", "(", "callback", ")", "{", "self", ".", "pool", "=", "(", "require", "(", "'mysql'", ")", ")", ".", "createPool", "(", "{", "user", ":", "self", ".", "config", ".", "username", ",", "password", ":", "self", ".", "config", ".", "password",...
Setup the plain MySQL connection, pooling enabled
[ "Setup", "the", "plain", "MySQL", "connection", "pooling", "enabled" ]
ede2157b90c207896781cc41fb9ea115e83951dd
https://github.com/Jack12816/greppy/blob/ede2157b90c207896781cc41fb9ea115e83951dd/lib/db/adapter/mysql.js#L45-L69
train
Rhinostone/gina
core/locales/index.js
Locales
function Locales() { var _require = function(path) { var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true; if (cacheless) { try { delete require.cache[require.resolve(path)]; return require(path) } catch (err) { ...
javascript
function Locales() { var _require = function(path) { var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true; if (cacheless) { try { delete require.cache[require.resolve(path)]; return require(path) } catch (err) { ...
[ "function", "Locales", "(", ")", "{", "var", "_require", "=", "function", "(", "path", ")", "{", "var", "cacheless", "=", "(", "process", ".", "env", ".", "IS_CACHELESS", "==", "'false'", ")", "?", "false", ":", "true", ";", "if", "(", "cacheless", "...
Gina.Core.Locales Class @package Gina.Core @author Rhinostone <gina@rhinostone.com>
[ "Gina", ".", "Core", ".", "Locales", "Class" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/locales/index.js#L18-L62
train
Rhinostone/gina
core/config.js
function(bundle, env) { if ( !self.isStandalone ) { if ( !bundle && typeof(self.bundle) != 'undefined' ) { var bundle = self.bundle } return ( typeof(self.envConf) != "undefined" ) ? self.envConf[bundle][env] : null; } else { ...
javascript
function(bundle, env) { if ( !self.isStandalone ) { if ( !bundle && typeof(self.bundle) != 'undefined' ) { var bundle = self.bundle } return ( typeof(self.envConf) != "undefined" ) ? self.envConf[bundle][env] : null; } else { ...
[ "function", "(", "bundle", ",", "env", ")", "{", "if", "(", "!", "self", ".", "isStandalone", ")", "{", "if", "(", "!", "bundle", "&&", "typeof", "(", "self", ".", "bundle", ")", "!=", "'undefined'", ")", "{", "var", "bundle", "=", "self", ".", "...
Get env config @param {string} bundle @param {string} env @return {Object} json conf
[ "Get", "env", "config" ]
c6ba13d3255a43734c54880ff12d3a50df53ebea
https://github.com/Rhinostone/gina/blob/c6ba13d3255a43734c54880ff12d3a50df53ebea/core/config.js#L291-L332
train
maichong/string-random
index.js
random
function random(length, options) { length || (length = 8); options || (options = {}); var chars = ''; var result = ''; if (options === true) { chars = numbers + letters + specials; } else if (typeof options == 'string') { chars = options; } else { if (options.numbers !== false) { chars...
javascript
function random(length, options) { length || (length = 8); options || (options = {}); var chars = ''; var result = ''; if (options === true) { chars = numbers + letters + specials; } else if (typeof options == 'string') { chars = options; } else { if (options.numbers !== false) { chars...
[ "function", "random", "(", "length", ",", "options", ")", "{", "length", "||", "(", "length", "=", "8", ")", ";", "options", "||", "(", "options", "=", "{", "}", ")", ";", "var", "chars", "=", "''", ";", "var", "result", "=", "''", ";", "if", "...
Generate random string @param {Number} length @param {Object} options
[ "Generate", "random", "string" ]
1d1adf06fe6740b8aecfe82ac9fd6937e5486e0d
https://github.com/maichong/string-random/blob/1d1adf06fe6740b8aecfe82ac9fd6937e5486e0d/index.js#L18-L48
train
rackfx/Node-WAV-File-Info
wav-file-info.js
post_process
function post_process(){ var error = false; var invalid_reasons = [] if (read_result.riff_head != "RIFF") invalid_reasons.push("Expected \"RIFF\" string at 0" ) if (read_result.wave_identifier != "WAVE") invalid_reasons.push("Expected \"WAVE\" string at 4") if (read_result.fmt_identifier...
javascript
function post_process(){ var error = false; var invalid_reasons = [] if (read_result.riff_head != "RIFF") invalid_reasons.push("Expected \"RIFF\" string at 0" ) if (read_result.wave_identifier != "WAVE") invalid_reasons.push("Expected \"WAVE\" string at 4") if (read_result.fmt_identifier...
[ "function", "post_process", "(", ")", "{", "var", "error", "=", "false", ";", "var", "invalid_reasons", "=", "[", "]", "if", "(", "read_result", ".", "riff_head", "!=", "\"RIFF\"", ")", "invalid_reasons", ".", "push", "(", "\"Expected \\\"RIFF\\\" string at 0\""...
end fs.read
[ "end", "fs", ".", "read" ]
000e6bc3c98c032178564c178862026724c015ce
https://github.com/rackfx/Node-WAV-File-Info/blob/000e6bc3c98c032178564c178862026724c015ce/wav-file-info.js#L65-L96
train
oskariorg/rpc-client
OskariRPC.js
function (name) { /** * Any of the allowed functions. Arguments are shifted if params is a function so there's no need to give an empty params array. * @param {Array} params optional array of parameters for the function. Treated as success callback if a function instead...
javascript
function (name) { /** * Any of the allowed functions. Arguments are shifted if params is a function so there's no need to give an empty params array. * @param {Array} params optional array of parameters for the function. Treated as success callback if a function instead...
[ "function", "(", "name", ")", "{", "/**\n * Any of the allowed functions. Arguments are shifted if params is a function so there's no need to give an empty params array.\n * @param {Array} params optional array of parameters for the function. Treated as success callback if ...
connect and setup allowed functions
[ "connect", "and", "setup", "allowed", "functions" ]
14a5fc2a5480dffbc35cc1e5b65e09edfb19da4c
https://github.com/oskariorg/rpc-client/blob/14a5fc2a5480dffbc35cc1e5b65e09edfb19da4c/OskariRPC.js#L200-L228
train
jkroso/abs-svg-path
index.js
absolutize
function absolutize(path){ var startX = 0 var startY = 0 var x = 0 var y = 0 return path.map(function(seg){ seg = seg.slice() var type = seg[0] var command = type.toUpperCase() // is relative if (type != command) { seg[0] = command switch (type) { case 'a': seg[6] += x seg[7] += y ...
javascript
function absolutize(path){ var startX = 0 var startY = 0 var x = 0 var y = 0 return path.map(function(seg){ seg = seg.slice() var type = seg[0] var command = type.toUpperCase() // is relative if (type != command) { seg[0] = command switch (type) { case 'a': seg[6] += x seg[7] += y ...
[ "function", "absolutize", "(", "path", ")", "{", "var", "startX", "=", "0", "var", "startY", "=", "0", "var", "x", "=", "0", "var", "y", "=", "0", "return", "path", ".", "map", "(", "function", "(", "seg", ")", "{", "seg", "=", "seg", ".", "sli...
redefine `path` with absolute coordinates @param {Array} path @return {Array}
[ "redefine", "path", "with", "absolute", "coordinates" ]
f0f57c97b12cdc4fc1d94798256fba357394e40a
https://github.com/jkroso/abs-svg-path/blob/f0f57c97b12cdc4fc1d94798256fba357394e40a/index.js#L11-L67
train
timwis/vizwit
src/scripts/views/basechart.js
function (config) { var guide = config.categoryAxis.guides[0] var filter = this.filteredCollection.getFilters(this.filteredCollection.getTriggerField()) if (filter) { if (config.categoryAxis.parseDates) { guide.date = filter.expression.value[0].value guide.toDate = filter.expression.va...
javascript
function (config) { var guide = config.categoryAxis.guides[0] var filter = this.filteredCollection.getFilters(this.filteredCollection.getTriggerField()) if (filter) { if (config.categoryAxis.parseDates) { guide.date = filter.expression.value[0].value guide.toDate = filter.expression.va...
[ "function", "(", "config", ")", "{", "var", "guide", "=", "config", ".", "categoryAxis", ".", "guides", "[", "0", "]", "var", "filter", "=", "this", ".", "filteredCollection", ".", "getFilters", "(", "this", ".", "filteredCollection", ".", "getTriggerField",...
Show guide on selected item or remove it if nothing's selected
[ "Show", "guide", "on", "selected", "item", "or", "remove", "it", "if", "nothing", "s", "selected" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/basechart.js#L88-L103
train
timwis/vizwit
src/scripts/views/datetime.js
function (e) { // console.log('Filtered by', (new Date(e.start)).toISOString(), (new Date(e.end)).toISOString()) var field = this.collection.getTriggerField() var start = new Date(e.start) var startIso = trimLastCharacter(start.toISOString()) var startFriendly = start.toLocaleDateString() var ...
javascript
function (e) { // console.log('Filtered by', (new Date(e.start)).toISOString(), (new Date(e.end)).toISOString()) var field = this.collection.getTriggerField() var start = new Date(e.start) var startIso = trimLastCharacter(start.toISOString()) var startFriendly = start.toLocaleDateString() var ...
[ "function", "(", "e", ")", "{", "// console.log('Filtered by', (new Date(e.start)).toISOString(), (new Date(e.end)).toISOString())", "var", "field", "=", "this", ".", "collection", ".", "getTriggerField", "(", ")", "var", "start", "=", "new", "Date", "(", "e", ".", "s...
When the user clicks on a bar in this chart
[ "When", "the", "user", "clicks", "on", "a", "bar", "in", "this", "chart" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/datetime.js#L102-L133
train
timwis/vizwit
src/scripts/views/table.js
function (tableState, dataTablesCallback, dataTablesSettings) { this.collection.setSearch(tableState.search.value ? tableState.search.value : null) this.collection.unsetRecordCount() this.renderFilters() // Get record count first because it needs to be passed into the collection.fetch callback this...
javascript
function (tableState, dataTablesCallback, dataTablesSettings) { this.collection.setSearch(tableState.search.value ? tableState.search.value : null) this.collection.unsetRecordCount() this.renderFilters() // Get record count first because it needs to be passed into the collection.fetch callback this...
[ "function", "(", "tableState", ",", "dataTablesCallback", ",", "dataTablesSettings", ")", "{", "this", ".", "collection", ".", "setSearch", "(", "tableState", ".", "search", ".", "value", "?", "tableState", ".", "search", ".", "value", ":", "null", ")", "thi...
Adjust collection using table state, then pass off to collection.fetch with datatables callback
[ "Adjust", "collection", "using", "table", "state", "then", "pass", "off", "to", "collection", ".", "fetch", "with", "datatables", "callback" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/table.js#L74-L103
train
timwis/vizwit
src/scripts/views/table.js
function (data) { this.collection.setFilter(data) this.collection.unsetRecordCount() this.table.ajax.reload() this.renderFilters() }
javascript
function (data) { this.collection.setFilter(data) this.collection.unsetRecordCount() this.table.ajax.reload() this.renderFilters() }
[ "function", "(", "data", ")", "{", "this", ".", "collection", ".", "setFilter", "(", "data", ")", "this", ".", "collection", ".", "unsetRecordCount", "(", ")", "this", ".", "table", ".", "ajax", ".", "reload", "(", ")", "this", ".", "renderFilters", "(...
When another chart is filtered, filter this collection
[ "When", "another", "chart", "is", "filtered", "filter", "this", "collection" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/table.js#L111-L116
train
timwis/vizwit
src/scripts/views/bar.js
function (e) { if (e.index == null) { this.hovering = null } else { this.hovering = this.chart.categoryAxis.data[e.index] } }
javascript
function (e) { if (e.index == null) { this.hovering = null } else { this.hovering = this.chart.categoryAxis.data[e.index] } }
[ "function", "(", "e", ")", "{", "if", "(", "e", ".", "index", "==", "null", ")", "{", "this", ".", "hovering", "=", "null", "}", "else", "{", "this", ".", "hovering", "=", "this", ".", "chart", ".", "categoryAxis", ".", "data", "[", "e", ".", "...
Keep track of which column the cursor is hovered over
[ "Keep", "track", "of", "which", "column", "the", "cursor", "is", "hovered", "over" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/bar.js#L155-L161
train
timwis/vizwit
src/scripts/views/pie.js
function (data) { // Add the filter to the filtered collection and fetch it with the filter this.filteredCollection.setFilter(data) // Only re-fetch if it's another chart (since this view doesn't filter itself) if (data.field !== this.filteredCollection.getTriggerField()) { this.filteredCollectio...
javascript
function (data) { // Add the filter to the filtered collection and fetch it with the filter this.filteredCollection.setFilter(data) // Only re-fetch if it's another chart (since this view doesn't filter itself) if (data.field !== this.filteredCollection.getTriggerField()) { this.filteredCollectio...
[ "function", "(", "data", ")", "{", "// Add the filter to the filtered collection and fetch it with the filter", "this", ".", "filteredCollection", ".", "setFilter", "(", "data", ")", "// Only re-fetch if it's another chart (since this view doesn't filter itself)", "if", "(", "data"...
When a chart has been filtered
[ "When", "a", "chart", "has", "been", "filtered" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/pie.js#L135-L148
train
timwis/vizwit
src/scripts/views/choropleth.js
function () { // Create hash table for easy reference var collectionValues = hashTable(this.collection.toJSON(), 'label', 'value') var filteredCollectionValues = hashTable(this.filteredCollection.toJSON(), 'label', 'value') // Add value from hash tables to geojson properties var idAttribute = this....
javascript
function () { // Create hash table for easy reference var collectionValues = hashTable(this.collection.toJSON(), 'label', 'value') var filteredCollectionValues = hashTable(this.filteredCollection.toJSON(), 'label', 'value') // Add value from hash tables to geojson properties var idAttribute = this....
[ "function", "(", ")", "{", "// Create hash table for easy reference", "var", "collectionValues", "=", "hashTable", "(", "this", ".", "collection", ".", "toJSON", "(", ")", ",", "'label'", ",", "'value'", ")", "var", "filteredCollectionValues", "=", "hashTable", "(...
Loop through features, find the matching dataset record, and put the specific field into the feature Done via reference
[ "Loop", "through", "features", "find", "the", "matching", "dataset", "record", "and", "put", "the", "specific", "field", "into", "the", "feature", "Done", "via", "reference" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/src/scripts/views/choropleth.js#L102-L118
train
timwis/vizwit
gulpfile.js
scripts
function scripts (src, dest, watch) { var bundleOpts = _.extend({}, watchify.args) if (watch) bundleOpts.debug = true var bundle = browserify(src, bundleOpts) if (watch) { bundle = watchify(bundle) bundle.on('update', function () { compileBundle(bundle, dest) }) // when a dependency changes, recompil...
javascript
function scripts (src, dest, watch) { var bundleOpts = _.extend({}, watchify.args) if (watch) bundleOpts.debug = true var bundle = browserify(src, bundleOpts) if (watch) { bundle = watchify(bundle) bundle.on('update', function () { compileBundle(bundle, dest) }) // when a dependency changes, recompil...
[ "function", "scripts", "(", "src", ",", "dest", ",", "watch", ")", "{", "var", "bundleOpts", "=", "_", ".", "extend", "(", "{", "}", ",", "watchify", ".", "args", ")", "if", "(", "watch", ")", "bundleOpts", ".", "debug", "=", "true", "var", "bundle...
Build scripts and optionally watch for changes
[ "Build", "scripts", "and", "optionally", "watch", "for", "changes" ]
cca5d4e8fb522e8359696c15d032074374bd6c5e
https://github.com/timwis/vizwit/blob/cca5d4e8fb522e8359696c15d032074374bd6c5e/gulpfile.js#L69-L85
train
intervolga/optimize-cssnano-plugin
index.js
OptimizeCssnanoPlugin
function OptimizeCssnanoPlugin(options) { this.options = Object.assign({ sourceMap: false, cssnanoOptions: { preset: 'default', }, }, options); if (this.options.sourceMap) { this.options.sourceMap = Object.assign( {inline: false}, this.options.sourceMap || {}); } }
javascript
function OptimizeCssnanoPlugin(options) { this.options = Object.assign({ sourceMap: false, cssnanoOptions: { preset: 'default', }, }, options); if (this.options.sourceMap) { this.options.sourceMap = Object.assign( {inline: false}, this.options.sourceMap || {}); } }
[ "function", "OptimizeCssnanoPlugin", "(", "options", ")", "{", "this", ".", "options", "=", "Object", ".", "assign", "(", "{", "sourceMap", ":", "false", ",", "cssnanoOptions", ":", "{", "preset", ":", "'default'", ",", "}", ",", "}", ",", "options", ")"...
Optimize cssnano plugin @param {Object} options
[ "Optimize", "cssnano", "plugin" ]
123de8b2212dbe5335be1a5c49e981ec8c2e1268
https://github.com/intervolga/optimize-cssnano-plugin/blob/123de8b2212dbe5335be1a5c49e981ec8c2e1268/index.js#L9-L22
train
papnkukn/qrcode-svg
app.js
help
function help() { console.log("Usage:"); console.log(" qrcode-svg [options] <content>"); console.log(""); console.log("Options:"); console.log(" --help Print this message"); console.log(" --padding [value] Offset in number of modules"); console.log(" --width [px] Image w...
javascript
function help() { console.log("Usage:"); console.log(" qrcode-svg [options] <content>"); console.log(""); console.log("Options:"); console.log(" --help Print this message"); console.log(" --padding [value] Offset in number of modules"); console.log(" --width [px] Image w...
[ "function", "help", "(", ")", "{", "console", ".", "log", "(", "\"Usage:\"", ")", ";", "console", ".", "log", "(", "\" qrcode-svg [options] <content>\"", ")", ";", "console", ".", "log", "(", "\"\"", ")", ";", "console", ".", "log", "(", "\"Options:\"", ...
Prints help message
[ "Prints", "help", "message" ]
e48892136b1655fa557d45b521120f482afafd3d
https://github.com/papnkukn/qrcode-svg/blob/e48892136b1655fa557d45b521120f482afafd3d/app.js#L70-L91
train
vicapow/react-map-gl-heatmap-overlay
index.js
_getGradientTexture
function _getGradientTexture() { // Only update the texture when the gradient has changed. if (this._prevGradientColors === this.props.gradientColors) { return this._gradientTexture; } var canvas = document.createElement('canvas'); // 512, 10 because these are the sam...
javascript
function _getGradientTexture() { // Only update the texture when the gradient has changed. if (this._prevGradientColors === this.props.gradientColors) { return this._gradientTexture; } var canvas = document.createElement('canvas'); // 512, 10 because these are the sam...
[ "function", "_getGradientTexture", "(", ")", "{", "// Only update the texture when the gradient has changed.", "if", "(", "this", ".", "_prevGradientColors", "===", "this", ".", "props", ".", "gradientColors", ")", "{", "return", "this", ".", "_gradientTexture", ";", ...
Updates `this._gradientTexture` Image if `props.gradientColors` has changed. @returns {Image} `this._gradientTexture`.
[ "Updates", "this", ".", "_gradientTexture", "Image", "if", "props", ".", "gradientColors", "has", "changed", "." ]
3049506b58c1bbfc6592f2cd211a703d46216924
https://github.com/vicapow/react-map-gl-heatmap-overlay/blob/3049506b58c1bbfc6592f2cd211a703d46216924/index.js#L69-L93
train
realmq/realmq-web-sdk
lib/utils/utf8.js
decodeUTF8
function decodeUTF8(bytes) { var s = ''; var i = 0; while (i < bytes.length) { var c = bytes[i++]; if (c > 127) { if (c > 191 && c < 224) { if (i >= bytes.length) throw new Error('UTF-8 decode: incomplete 2-byte sequence'); c = ((c & 31) << 6) | (bytes[i] & 63); } els...
javascript
function decodeUTF8(bytes) { var s = ''; var i = 0; while (i < bytes.length) { var c = bytes[i++]; if (c > 127) { if (c > 191 && c < 224) { if (i >= bytes.length) throw new Error('UTF-8 decode: incomplete 2-byte sequence'); c = ((c & 31) << 6) | (bytes[i] & 63); } els...
[ "function", "decodeUTF8", "(", "bytes", ")", "{", "var", "s", "=", "''", ";", "var", "i", "=", "0", ";", "while", "(", "i", "<", "bytes", ".", "length", ")", "{", "var", "c", "=", "bytes", "[", "i", "++", "]", ";", "if", "(", "c", ">", "127...
Unmarshals an Uint8Array to string.
[ "Unmarshals", "an", "Uint8Array", "to", "string", "." ]
d9ef1b85bf4798beed1988f2e78ed04d862c19ef
https://github.com/realmq/realmq-web-sdk/blob/d9ef1b85bf4798beed1988f2e78ed04d862c19ef/lib/utils/utf8.js#L8-L51
train
realmq/realmq-web-sdk
vendor/paho-mqtt.js
function(obj, keys) { for (var key in obj) { if (obj.hasOwnProperty(key)) { if (keys.hasOwnProperty(key)) { if (typeof obj[key] !== keys[key]) throw new Error(format(ERROR.INVALID_TYPE, [typeof obj[key], key])); } else { var errorStr = "Unknown pro...
javascript
function(obj, keys) { for (var key in obj) { if (obj.hasOwnProperty(key)) { if (keys.hasOwnProperty(key)) { if (typeof obj[key] !== keys[key]) throw new Error(format(ERROR.INVALID_TYPE, [typeof obj[key], key])); } else { var errorStr = "Unknown pro...
[ "function", "(", "obj", ",", "keys", ")", "{", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "if", "(", "keys", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "if", "(", ...
Collection of utility methods used to simplify module code and promote the DRY pattern. Validate an object's parameter names to ensure they match a list of expected variables name for this option type. Used to ensure option object passed into the API don't contain erroneous parameters. @param {Object} obj - User optio...
[ "Collection", "of", "utility", "methods", "used", "to", "simplify", "module", "code", "and", "promote", "the", "DRY", "pattern", ".", "Validate", "an", "object", "s", "parameter", "names", "to", "ensure", "they", "match", "a", "list", "of", "expected", "vari...
d9ef1b85bf4798beed1988f2e78ed04d862c19ef
https://github.com/realmq/realmq-web-sdk/blob/d9ef1b85bf4798beed1988f2e78ed04d862c19ef/vendor/paho-mqtt.js#L143-L158
train
realmq/realmq-web-sdk
vendor/paho-mqtt.js
function(client, window, timeoutSeconds, action, args) { this._window = window; if (!timeoutSeconds) timeoutSeconds = 30; var doTimeout = function (action, client, args) { return function () { return action.apply(client, args); }; }; this.timeout = setTim...
javascript
function(client, window, timeoutSeconds, action, args) { this._window = window; if (!timeoutSeconds) timeoutSeconds = 30; var doTimeout = function (action, client, args) { return function () { return action.apply(client, args); }; }; this.timeout = setTim...
[ "function", "(", "client", ",", "window", ",", "timeoutSeconds", ",", "action", ",", "args", ")", "{", "this", ".", "_window", "=", "window", ";", "if", "(", "!", "timeoutSeconds", ")", "timeoutSeconds", "=", "30", ";", "var", "doTimeout", "=", "function...
Monitor request completion. @ignore
[ "Monitor", "request", "completion", "." ]
d9ef1b85bf4798beed1988f2e78ed04d862c19ef
https://github.com/realmq/realmq-web-sdk/blob/d9ef1b85bf4798beed1988f2e78ed04d862c19ef/vendor/paho-mqtt.js#L735-L750
train