id
int32
0
58k
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
52,200
deftly/node-deftly
src/log.js
addFilter
function addFilter (config, filter) { if (filter) { if (filter[ 0 ] === '-') { config.filters.ignore[ filter ] = new RegExp('^' + filter.slice(1).replace(/[*]/g, '.*?') + '$') } else { config.filters.should[ filter ] = new RegExp('^' + filter.replace(/[*]/g, '.*?') + '$') } } }
javascript
function addFilter (config, filter) { if (filter) { if (filter[ 0 ] === '-') { config.filters.ignore[ filter ] = new RegExp('^' + filter.slice(1).replace(/[*]/g, '.*?') + '$') } else { config.filters.should[ filter ] = new RegExp('^' + filter.replace(/[*]/g, '.*?') + '$') } } }
[ "function", "addFilter", "(", "config", ",", "filter", ")", "{", "if", "(", "filter", ")", "{", "if", "(", "filter", "[", "0", "]", "===", "'-'", ")", "{", "config", ".", "filters", ".", "ignore", "[", "filter", "]", "=", "new", "RegExp", "(", "'...
add the regex filter to the right hash for use later
[ "add", "the", "regex", "filter", "to", "the", "right", "hash", "for", "use", "later" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L52-L60
52,201
deftly/node-deftly
src/log.js
addLogger
function addLogger (state, name, config, adapter) { config = Object.assign({}, defaultConfig, config) setFilters(config) const logger = { name: name, config: config, adapter: adapter, addFilter: addFilter.bind(null, config), removeFilter: removeFilter.bind(null, config), setFilter: setFilt...
javascript
function addLogger (state, name, config, adapter) { config = Object.assign({}, defaultConfig, config) setFilters(config) const logger = { name: name, config: config, adapter: adapter, addFilter: addFilter.bind(null, config), removeFilter: removeFilter.bind(null, config), setFilter: setFilt...
[ "function", "addLogger", "(", "state", ",", "name", ",", "config", ",", "adapter", ")", "{", "config", "=", "Object", ".", "assign", "(", "{", "}", ",", "defaultConfig", ",", "config", ")", "setFilters", "(", "config", ")", "const", "logger", "=", "{",...
creates a logger from a user supplied adapter
[ "creates", "a", "logger", "from", "a", "user", "supplied", "adapter" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L63-L80
52,202
deftly/node-deftly
src/log.js
attach
function attach (state, logger, namespace) { _.each(levels, function (level, name) { logger[ name ] = prepMessage.bind(null, state, name, namespace) }) }
javascript
function attach (state, logger, namespace) { _.each(levels, function (level, name) { logger[ name ] = prepMessage.bind(null, state, name, namespace) }) }
[ "function", "attach", "(", "state", ",", "logger", ",", "namespace", ")", "{", "_", ".", "each", "(", "levels", ",", "function", "(", "level", ",", "name", ")", "{", "logger", "[", "name", "]", "=", "prepMessage", ".", "bind", "(", "null", ",", "st...
create a bound prepMessage call for each log level
[ "create", "a", "bound", "prepMessage", "call", "for", "each", "log", "level" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L83-L87
52,203
deftly/node-deftly
src/log.js
init
function init (state, namespace) { namespace = namespace || 'deftly' const logger = { namespace: namespace } attach(state, logger, namespace) return logger }
javascript
function init (state, namespace) { namespace = namespace || 'deftly' const logger = { namespace: namespace } attach(state, logger, namespace) return logger }
[ "function", "init", "(", "state", ",", "namespace", ")", "{", "namespace", "=", "namespace", "||", "'deftly'", "const", "logger", "=", "{", "namespace", ":", "namespace", "}", "attach", "(", "state", ",", "logger", ",", "namespace", ")", "return", "logger"...
create a namespaced log instance for use in modules
[ "create", "a", "namespaced", "log", "instance", "for", "use", "in", "modules" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L90-L95
52,204
deftly/node-deftly
src/log.js
log
function log (state, type, namespace, message) { const level = levels[ type ] _.each(state.loggers, function (logger) { logger.log({ type: type, level: level, namespace: namespace, message: message }) }) }
javascript
function log (state, type, namespace, message) { const level = levels[ type ] _.each(state.loggers, function (logger) { logger.log({ type: type, level: level, namespace: namespace, message: message }) }) }
[ "function", "log", "(", "state", ",", "type", ",", "namespace", ",", "message", ")", "{", "const", "level", "=", "levels", "[", "type", "]", "_", ".", "each", "(", "state", ".", "loggers", ",", "function", "(", "logger", ")", "{", "logger", ".", "l...
calls log for each logger
[ "calls", "log", "for", "each", "logger" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L98-L108
52,205
deftly/node-deftly
src/log.js
prepMessage
function prepMessage (state, level, namespace, message) { if (_.isString(message)) { const formatArgs = Array.prototype.slice.call(arguments, 3) message = format.apply(null, formatArgs) } log(state, level, namespace, message) }
javascript
function prepMessage (state, level, namespace, message) { if (_.isString(message)) { const formatArgs = Array.prototype.slice.call(arguments, 3) message = format.apply(null, formatArgs) } log(state, level, namespace, message) }
[ "function", "prepMessage", "(", "state", ",", "level", ",", "namespace", ",", "message", ")", "{", "if", "(", "_", ".", "isString", "(", "message", ")", ")", "{", "const", "formatArgs", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", ...
handles message format if necessary before calling the actual log function to emit
[ "handles", "message", "format", "if", "necessary", "before", "calling", "the", "actual", "log", "function", "to", "emit" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L136-L142
52,206
deftly/node-deftly
src/log.js
removeFilter
function removeFilter (config, filter) { if (filter) { if (config.filters.ignore[ filter ]) { delete config.filters.ignore[ filter ] } else { delete config.filters.should[ filter ] } } }
javascript
function removeFilter (config, filter) { if (filter) { if (config.filters.ignore[ filter ]) { delete config.filters.ignore[ filter ] } else { delete config.filters.should[ filter ] } } }
[ "function", "removeFilter", "(", "config", ",", "filter", ")", "{", "if", "(", "filter", ")", "{", "if", "(", "config", ".", "filters", ".", "ignore", "[", "filter", "]", ")", "{", "delete", "config", ".", "filters", ".", "ignore", "[", "filter", "]"...
remove the regex filter from the correct hash
[ "remove", "the", "regex", "filter", "from", "the", "correct", "hash" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L145-L153
52,207
deftly/node-deftly
src/log.js
setFilters
function setFilters (config) { const parts = config.filter.split(/[\s,]+/) config.filters = { should: {}, ignore: {} } _.each(parts, addFilter.bind(null, config)) }
javascript
function setFilters (config) { const parts = config.filter.split(/[\s,]+/) config.filters = { should: {}, ignore: {} } _.each(parts, addFilter.bind(null, config)) }
[ "function", "setFilters", "(", "config", ")", "{", "const", "parts", "=", "config", ".", "filter", ".", "split", "(", "/", "[\\s,]+", "/", ")", "config", ".", "filters", "=", "{", "should", ":", "{", "}", ",", "ignore", ":", "{", "}", "}", "_", "...
sets should and musn't filters
[ "sets", "should", "and", "musn", "t", "filters" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L167-L174
52,208
deftly/node-deftly
src/log.js
shouldRender
function shouldRender (config, entry) { // if we're below the log level, return false if (config.level < entry.level) { return false } // if we match the ignore list at all, return false const ignoreMatch = _.find(_.values(config.filters.ignore), ignore => { return ignore.test(entry.namespace) }) ...
javascript
function shouldRender (config, entry) { // if we're below the log level, return false if (config.level < entry.level) { return false } // if we match the ignore list at all, return false const ignoreMatch = _.find(_.values(config.filters.ignore), ignore => { return ignore.test(entry.namespace) }) ...
[ "function", "shouldRender", "(", "config", ",", "entry", ")", "{", "// if we're below the log level, return false", "if", "(", "config", ".", "level", "<", "entry", ".", "level", ")", "{", "return", "false", "}", "// if we match the ignore list at all, return false", ...
check entry against configuration to see if it should be logged by adapter
[ "check", "entry", "against", "configuration", "to", "see", "if", "it", "should", "be", "logged", "by", "adapter" ]
0c34205fd6726356b69bcdd6dec4fcba55027af6
https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L178-L203
52,209
skylarkax/skylark-slax-nodeserver
bin/cli.js
initTerminateHandlers
function initTerminateHandlers() { var readLine; if (process.platform === "win32"){ readLine = require("readline"); readLine.createInterface ({ input: process.stdin, output: process.stdout }).on("SIGINT", function () { process.emit("SIGINT"); }); } // handle INTERRUPT (CTRL+...
javascript
function initTerminateHandlers() { var readLine; if (process.platform === "win32"){ readLine = require("readline"); readLine.createInterface ({ input: process.stdin, output: process.stdout }).on("SIGINT", function () { process.emit("SIGINT"); }); } // handle INTERRUPT (CTRL+...
[ "function", "initTerminateHandlers", "(", ")", "{", "var", "readLine", ";", "if", "(", "process", ".", "platform", "===", "\"win32\"", ")", "{", "readLine", "=", "require", "(", "\"readline\"", ")", ";", "readLine", ".", "createInterface", "(", "{", "input",...
Prepare the 'exit' handler for the program termination
[ "Prepare", "the", "exit", "handler", "for", "the", "program", "termination" ]
af0840a4689495a1efa3b23ad34848034fcc313f
https://github.com/skylarkax/skylark-slax-nodeserver/blob/af0840a4689495a1efa3b23ad34848034fcc313f/bin/cli.js#L55-L85
52,210
sendanor/nor-nopg
src/schema/v0020.js
fetch_object_by_uuid
function fetch_object_by_uuid(data, prop, uuid) { if(!is_object(data)) { return error('fetch_object_by_uuid(data, ..., ...) not object: '+ data); } if(!is_string(prop)) { return error('fetch_object_by_uuid(..., prop, ...) not string: '+ prop); } if(!is_uuid(uuid)) { return warn('Property ' + prop + ' was no...
javascript
function fetch_object_by_uuid(data, prop, uuid) { if(!is_object(data)) { return error('fetch_object_by_uuid(data, ..., ...) not object: '+ data); } if(!is_string(prop)) { return error('fetch_object_by_uuid(..., prop, ...) not string: '+ prop); } if(!is_uuid(uuid)) { return warn('Property ' + prop + ' was no...
[ "function", "fetch_object_by_uuid", "(", "data", ",", "prop", ",", "uuid", ")", "{", "if", "(", "!", "is_object", "(", "data", ")", ")", "{", "return", "error", "(", "'fetch_object_by_uuid(data, ..., ...) not object: '", "+", "data", ")", ";", "}", "if", "("...
Get document by UUID
[ "Get", "document", "by", "UUID" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0020.js#L60-L69
52,211
buzzin0609/tagbuildr
src/setDomAttrs.js
setDomAttrs
function setDomAttrs(attrs, el) { for (let attr in attrs) { if (!attrs.hasOwnProperty(attr)) { continue; } switch (attr) { case 'className': case 'id': el[attr] = attrs[attr]; break; default: el.setAttribute(attr, attrs[attr]); break; } } return el; }
javascript
function setDomAttrs(attrs, el) { for (let attr in attrs) { if (!attrs.hasOwnProperty(attr)) { continue; } switch (attr) { case 'className': case 'id': el[attr] = attrs[attr]; break; default: el.setAttribute(attr, attrs[attr]); break; } } return el; }
[ "function", "setDomAttrs", "(", "attrs", ",", "el", ")", "{", "for", "(", "let", "attr", "in", "attrs", ")", "{", "if", "(", "!", "attrs", ".", "hasOwnProperty", "(", "attr", ")", ")", "{", "continue", ";", "}", "switch", "(", "attr", ")", "{", "...
Add attributes to the dom element @private @param {Object} attrs object of key-value pairs of dom attributes. Classes and Id are added directly to element and others are set via setAttribute @param {Element} el the dom element
[ "Add", "attributes", "to", "the", "dom", "element" ]
9d6a52ad51c0fc3230de2da1e8e3f63f95a6e542
https://github.com/buzzin0609/tagbuildr/blob/9d6a52ad51c0fc3230de2da1e8e3f63f95a6e542/src/setDomAttrs.js#L7-L22
52,212
rqt/github
build/api/activity/star.js
del
async function del(owner, repo) { const endpoint = `/user/starred/${owner}/${repo}` const { statusCode } = await this._request({ method: 'PUT', data: {}, endpoint, }) if (statusCode != 204) { throw new Error(`Unexpected status code ${statusCode}.`) } }
javascript
async function del(owner, repo) { const endpoint = `/user/starred/${owner}/${repo}` const { statusCode } = await this._request({ method: 'PUT', data: {}, endpoint, }) if (statusCode != 204) { throw new Error(`Unexpected status code ${statusCode}.`) } }
[ "async", "function", "del", "(", "owner", ",", "repo", ")", "{", "const", "endpoint", "=", "`", "${", "owner", "}", "${", "repo", "}", "`", "const", "{", "statusCode", "}", "=", "await", "this", ".", "_request", "(", "{", "method", ":", "'PUT'", ",...
Star a repository. @param {string} owner @param {string} repo
[ "Star", "a", "repository", "." ]
e6d3cdd8633628cd4aba30e70d8258aa7f6f0c5a
https://github.com/rqt/github/blob/e6d3cdd8633628cd4aba30e70d8258aa7f6f0c5a/build/api/activity/star.js#L6-L16
52,213
jigarjain/object-clean
index.js
objCleaner
function objCleaner(obj, removeTypes) { var defaultRemoveTypes = [null, 'undefined', false, '', [], {}]; var key; function allowEmptyObject() { var i; for (i = 0; i < removeTypes.length; i++) { if (removeTypes[i] instanceof Object && Object.keys(removeTypes[i]).length === 0) { ...
javascript
function objCleaner(obj, removeTypes) { var defaultRemoveTypes = [null, 'undefined', false, '', [], {}]; var key; function allowEmptyObject() { var i; for (i = 0; i < removeTypes.length; i++) { if (removeTypes[i] instanceof Object && Object.keys(removeTypes[i]).length === 0) { ...
[ "function", "objCleaner", "(", "obj", ",", "removeTypes", ")", "{", "var", "defaultRemoveTypes", "=", "[", "null", ",", "'undefined'", ",", "false", ",", "''", ",", "[", "]", ",", "{", "}", "]", ";", "var", "key", ";", "function", "allowEmptyObject", "...
Will delete the keys of the object which are set to null, undefined or empty string @param {Object/Array} obj An object or array which needs to be cleaned @param {Array} removeTypes Array of values and/or types which needs to be discarded (OPTIONAL) @return {Object/Array}
[ "Will", "delete", "the", "keys", "of", "the", "object", "which", "are", "set", "to", "null", "undefined", "or", "empty", "string" ]
ebfad9301e6588796abb4f08a44fb3ab4b9af823
https://github.com/jigarjain/object-clean/blob/ebfad9301e6588796abb4f08a44fb3ab4b9af823/index.js#L11-L80
52,214
byron-dupreez/rcc-redis-mock-adapter
rcc-redis-mock-adapter.js
createClient
function createClient(redisClientOptions) { const client = redis.createClient(redisClientOptions); if (!client._options) { client._options = redisClientOptions; } return client; }
javascript
function createClient(redisClientOptions) { const client = redis.createClient(redisClientOptions); if (!client._options) { client._options = redisClientOptions; } return client; }
[ "function", "createClient", "(", "redisClientOptions", ")", "{", "const", "client", "=", "redis", ".", "createClient", "(", "redisClientOptions", ")", ";", "if", "(", "!", "client", ".", "_options", ")", "{", "client", ".", "_options", "=", "redisClientOptions...
Creates a new RedisClient instance. @param {RedisClientOptions|undefined} [redisClientOptions] - the options to use to construct the new RedisClient instance @return {RedisClient} returns the new RedisClient instance
[ "Creates", "a", "new", "RedisClient", "instance", "." ]
30297a11c2319b215f7826a39fc61a9d95ed810f
https://github.com/byron-dupreez/rcc-redis-mock-adapter/blob/30297a11c2319b215f7826a39fc61a9d95ed810f/rcc-redis-mock-adapter.js#L100-L106
52,215
alexcu/node-pact-publisher
lib/pact-publisher.js
PactPublisher
function PactPublisher (configOrVersion, brokerBaseUrl, pacts) { var _version, _brokerBaseUrl, _pacts; if (!_.contains(['object', 'string'], typeof configOrVersion)) { throw new TypeError('Invalid first parameter provided constructing Pact Publisher. Expected a config object or version string for first paramete...
javascript
function PactPublisher (configOrVersion, brokerBaseUrl, pacts) { var _version, _brokerBaseUrl, _pacts; if (!_.contains(['object', 'string'], typeof configOrVersion)) { throw new TypeError('Invalid first parameter provided constructing Pact Publisher. Expected a config object or version string for first paramete...
[ "function", "PactPublisher", "(", "configOrVersion", ",", "brokerBaseUrl", ",", "pacts", ")", "{", "var", "_version", ",", "_brokerBaseUrl", ",", "_pacts", ";", "if", "(", "!", "_", ".", "contains", "(", "[", "'object'", ",", "'string'", "]", ",", "typeof"...
A pact publisher @param {Object|String} configOrVersion Config object or version number. If config object is provided, it's just an object containing: - {String} appVersion - {String} brokerBaseUrl - {Array|String} pact - {Boolean} logging (if set to false, no logs will be output) @param {String} brokerBaseU...
[ "A", "pact", "publisher" ]
b87bf328e1699409c09680d182505e18e0e397e0
https://github.com/alexcu/node-pact-publisher/blob/b87bf328e1699409c09680d182505e18e0e397e0/lib/pact-publisher.js#L36-L72
52,216
tolokoban/ToloFrameWork
ker/mod/wdg.input.js
function(opts) { Widget.call(this); var input = Widget.tag("input"); this._input = input; var that = this; this.addClass("wdg-input"); if (typeof opts !== 'object') opts = {}; if (typeof opts.type !== 'string') opts.type = 'text'; input.attr("type", opts.type); if (typeof op...
javascript
function(opts) { Widget.call(this); var input = Widget.tag("input"); this._input = input; var that = this; this.addClass("wdg-input"); if (typeof opts !== 'object') opts = {}; if (typeof opts.type !== 'string') opts.type = 'text'; input.attr("type", opts.type); if (typeof op...
[ "function", "(", "opts", ")", "{", "Widget", ".", "call", "(", "this", ")", ";", "var", "input", "=", "Widget", ".", "tag", "(", "\"input\"", ")", ";", "this", ".", "_input", "=", "input", ";", "var", "that", "=", "this", ";", "this", ".", "addCl...
HTML5 text input with many options. @param {string} opts.value Initial value. @param {string} opts.type Input's type. Can be `text`, `password`, ... @param {string} opts.name The name can be used by the browser to give a help combo. @param {string} opts.placeholder Text to display when input is empty. @param {functio...
[ "HTML5", "text", "input", "with", "many", "options", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.input.js#L55-L142
52,217
tombenke/proper
bin/cli.js
function( fileName ) { // console.log('Read configuration from ' + fileName); var pathSep = require('path').sep; var inFileName = process.cwd() + pathSep + fileName; var config = require( inFileName ); // TODO: validate config for ( var procs in config ) { ...
javascript
function( fileName ) { // console.log('Read configuration from ' + fileName); var pathSep = require('path').sep; var inFileName = process.cwd() + pathSep + fileName; var config = require( inFileName ); // TODO: validate config for ( var procs in config ) { ...
[ "function", "(", "fileName", ")", "{", "// console.log('Read configuration from ' + fileName);", "var", "pathSep", "=", "require", "(", "'path'", ")", ".", "sep", ";", "var", "inFileName", "=", "process", ".", "cwd", "(", ")", "+", "pathSep", "+", "fileName", ...
Read the config file @param {string} fileName The name of the config file @return {Object} The configuration object
[ "Read", "the", "config", "file" ]
3f766df6ec7dbb0c4d136373a94002d00d340a48
https://github.com/tombenke/proper/blob/3f766df6ec7dbb0c4d136373a94002d00d340a48/bin/cli.js#L19-L38
52,218
redisjs/jsr-persistence
lib/index.js
saveSync
function saveSync(store, conf) { try { this.save(store, conf); }catch(e) { log.warning('failed to save rdb snapshot: %s', e.message); } }
javascript
function saveSync(store, conf) { try { this.save(store, conf); }catch(e) { log.warning('failed to save rdb snapshot: %s', e.message); } }
[ "function", "saveSync", "(", "store", ",", "conf", ")", "{", "try", "{", "this", ".", "save", "(", "store", ",", "conf", ")", ";", "}", "catch", "(", "e", ")", "{", "log", ".", "warning", "(", "'failed to save rdb snapshot: %s'", ",", "e", ".", "mess...
Synchronous save.
[ "Synchronous", "save", "." ]
77f3fc84ea7cbdb9f41a4dfa7ee1d89be61f7510
https://github.com/redisjs/jsr-persistence/blob/77f3fc84ea7cbdb9f41a4dfa7ee1d89be61f7510/lib/index.js#L20-L26
52,219
pkrll/Salvation
src/salvation.js
function () { var emptyFunction = new RegExp(/(\{\s\})|(\{\})/), publicMethods = {}; for (property in this.settings) { if (typeof this.settings[property] == 'function' && typeof this[property] == 'function') { var method = t...
javascript
function () { var emptyFunction = new RegExp(/(\{\s\})|(\{\})/), publicMethods = {}; for (property in this.settings) { if (typeof this.settings[property] == 'function' && typeof this[property] == 'function') { var method = t...
[ "function", "(", ")", "{", "var", "emptyFunction", "=", "new", "RegExp", "(", "/", "(\\{\\s\\})|(\\{\\})", "/", ")", ",", "publicMethods", "=", "{", "}", ";", "for", "(", "property", "in", "this", ".", "settings", ")", "{", "if", "(", "typeof", "this",...
Creates an object of pseudo-public methods that will be returned when the plugin is initialized. @returns Object
[ "Creates", "an", "object", "of", "pseudo", "-", "public", "methods", "that", "will", "be", "returned", "when", "the", "plugin", "is", "initialized", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L97-L117
52,220
pkrll/Salvation
src/salvation.js
function(name) { if (/[A-Z]/.test(name.charAt(0))) return "default" + name; var firstLetter = name.charAt(0); return "default" + firstLetter.toUpperCase() + name.substring(1); }
javascript
function(name) { if (/[A-Z]/.test(name.charAt(0))) return "default" + name; var firstLetter = name.charAt(0); return "default" + firstLetter.toUpperCase() + name.substring(1); }
[ "function", "(", "name", ")", "{", "if", "(", "/", "[A-Z]", "/", ".", "test", "(", "name", ".", "charAt", "(", "0", ")", ")", ")", "return", "\"default\"", "+", "name", ";", "var", "firstLetter", "=", "name", ".", "charAt", "(", "0", ")", ";", ...
Prepends method name with string "default", using camelCase. @param string Name to manipulate @returns string
[ "Prepends", "method", "name", "with", "string", "default", "using", "camelCase", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L125-L130
52,221
pkrll/Salvation
src/salvation.js
function (primary, secondary) { var primary = primary || {}; for (var property in secondary) if (secondary.hasOwnProperty(property)) primary[property] = secondary[property]; return primary; }
javascript
function (primary, secondary) { var primary = primary || {}; for (var property in secondary) if (secondary.hasOwnProperty(property)) primary[property] = secondary[property]; return primary; }
[ "function", "(", "primary", ",", "secondary", ")", "{", "var", "primary", "=", "primary", "||", "{", "}", ";", "for", "(", "var", "property", "in", "secondary", ")", "if", "(", "secondary", ".", "hasOwnProperty", "(", "property", ")", ")", "primary", "...
Extend a given object with another object. @param object Object that is to be extended @param object Object with properties to add to first object @returns object
[ "Extend", "a", "given", "object", "with", "another", "object", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L149-L155
52,222
pkrll/Salvation
src/salvation.js
function (event) { var self = this; if (this.invalidElements.length > 0) event.preventDefault(); // Even if the invalidElements count // does not indicate any invalidated // elements, the plugin should make // sure that there are no...
javascript
function (event) { var self = this; if (this.invalidElements.length > 0) event.preventDefault(); // Even if the invalidElements count // does not indicate any invalidated // elements, the plugin should make // sure that there are no...
[ "function", "(", "event", ")", "{", "var", "self", "=", "this", ";", "if", "(", "this", ".", "invalidElements", ".", "length", ">", "0", ")", "event", ".", "preventDefault", "(", ")", ";", "// Even if the invalidElements count", "// does not indicate any invalid...
Callback function for event submit. Validates elements, but will first check if the global "formInvalid"- variable is set, before validation. @param Event
[ "Callback", "function", "for", "event", "submit", ".", "Validates", "elements", "but", "will", "first", "check", "if", "the", "global", "formInvalid", "-", "variable", "is", "set", "before", "validation", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L164-L184
52,223
pkrll/Salvation
src/salvation.js
function(event) { var target = event.target; if (this.checkElementByPattern(target)) { if (this.invalidElements.indexOf(target) > -1) this.invalidElements.splice(this.invalidElements.indexOf(target), 1); this.publicInterface.onValidation([targe...
javascript
function(event) { var target = event.target; if (this.checkElementByPattern(target)) { if (this.invalidElements.indexOf(target) > -1) this.invalidElements.splice(this.invalidElements.indexOf(target), 1); this.publicInterface.onValidation([targe...
[ "function", "(", "event", ")", "{", "var", "target", "=", "event", ".", "target", ";", "if", "(", "this", ".", "checkElementByPattern", "(", "target", ")", ")", "{", "if", "(", "this", ".", "invalidElements", ".", "indexOf", "(", "target", ")", ">", ...
Callback function for the change event. Validates elements live. @param Event
[ "Callback", "function", "for", "the", "change", "event", ".", "Validates", "elements", "live", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L191-L203
52,224
pkrll/Salvation
src/salvation.js
function (event) { // Check if the node is a child of the plugin's element. if (event.relatedNode === this.element) { var attributeValues = event.target.getAttribute("data-validate"); if (attributeValues !== null) { attributeValues = this.split...
javascript
function (event) { // Check if the node is a child of the plugin's element. if (event.relatedNode === this.element) { var attributeValues = event.target.getAttribute("data-validate"); if (attributeValues !== null) { attributeValues = this.split...
[ "function", "(", "event", ")", "{", "// Check if the node is a child of the plugin's element.", "if", "(", "event", ".", "relatedNode", "===", "this", ".", "element", ")", "{", "var", "attributeValues", "=", "event", ".", "target", ".", "getAttribute", "(", "\"dat...
Callback for DOMNodeInserted. Adds inserted element to the elements list, if it has the appropriate attributes. @param Event
[ "Callback", "for", "DOMNodeInserted", ".", "Adds", "inserted", "element", "to", "the", "elements", "list", "if", "it", "has", "the", "appropriate", "attributes", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L212-L229
52,225
pkrll/Salvation
src/salvation.js
function (elements, legend) { var elements = elements || []; for (var i = 0; i < elements.length; i++) { if (elements[i].classList.contains(this.stylings.error) === false) elements[i].classList.add(this.stylings.error); var legend = elements[i]...
javascript
function (elements, legend) { var elements = elements || []; for (var i = 0; i < elements.length; i++) { if (elements[i].classList.contains(this.stylings.error) === false) elements[i].classList.add(this.stylings.error); var legend = elements[i]...
[ "function", "(", "elements", ",", "legend", ")", "{", "var", "elements", "=", "elements", "||", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "if", "(", "elements", "[", "i"...
Performs the default invalidation action on invalid elements. @param HTMLFormElement
[ "Performs", "the", "default", "invalidation", "action", "on", "invalid", "elements", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L236-L247
52,226
pkrll/Salvation
src/salvation.js
function (elements) { var elements = elements || []; for (var i = 0; i < elements.length; i++) { if (elements[i].classList.contains(this.stylings.error)) { elements[i].classList.remove(this.stylings.error); var parent = elements[i].parentNo...
javascript
function (elements) { var elements = elements || []; for (var i = 0; i < elements.length; i++) { if (elements[i].classList.contains(this.stylings.error)) { elements[i].classList.remove(this.stylings.error); var parent = elements[i].parentNo...
[ "function", "(", "elements", ")", "{", "var", "elements", "=", "elements", "||", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "if", "(", "elements", "[", "i", "]", ".", "...
Performs the default validation action on revalidated elements. @param HTMLFormElement
[ "Performs", "the", "default", "validation", "action", "on", "revalidated", "elements", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L254-L263
52,227
pkrll/Salvation
src/salvation.js
function (elements, attribute, value) { var foundElements = [], value = value || null; for (i = 0; i < elements.length; i++) { // If the value parameter is set, return only the // elements that has the given attribute value. if (value !== null) { ...
javascript
function (elements, attribute, value) { var foundElements = [], value = value || null; for (i = 0; i < elements.length; i++) { // If the value parameter is set, return only the // elements that has the given attribute value. if (value !== null) { ...
[ "function", "(", "elements", ",", "attribute", ",", "value", ")", "{", "var", "foundElements", "=", "[", "]", ",", "value", "=", "value", "||", "null", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")",...
Find elements by attribute name, with option to also go by the attribute value. @param elements Array of elements to search @param string Value to find @returns array List of elements found
[ "Find", "elements", "by", "attribute", "name", "with", "option", "to", "also", "go", "by", "the", "attribute", "value", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L284-L299
52,228
pkrll/Salvation
src/salvation.js
function (elements, attribute) { var foundElements = {}; for (i = 0; i < elements.length; i++) { var attributeValues = elements[i].getAttribute(attribute); if (attributeValues === undefined || attributeValues === null) continue; ...
javascript
function (elements, attribute) { var foundElements = {}; for (i = 0; i < elements.length; i++) { var attributeValues = elements[i].getAttribute(attribute); if (attributeValues === undefined || attributeValues === null) continue; ...
[ "function", "(", "elements", ",", "attribute", ")", "{", "var", "foundElements", "=", "{", "}", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "var", "attributeValues", "=", "elements", "[", "i",...
Find elements by attribute name, and return them as an object with attribute value as key. This method will sort elements in different objects, depending on attributes. An element with multiple attribute values will be added to multiple objects. @param elements Array of elements to search @param string ...
[ "Find", "elements", "by", "attribute", "name", "and", "return", "them", "as", "an", "object", "with", "attribute", "value", "as", "key", ".", "This", "method", "will", "sort", "elements", "in", "different", "objects", "depending", "on", "attributes", ".", "A...
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L340-L364
52,229
pkrll/Salvation
src/salvation.js
function (element) { // Begin with checking the validate var elementAsArray = [ element ], validationType = element.getAttribute("data-validate") || null; invalidElement = []; if (validationType !== null) { validationType = this.splitSt...
javascript
function (element) { // Begin with checking the validate var elementAsArray = [ element ], validationType = element.getAttribute("data-validate") || null; invalidElement = []; if (validationType !== null) { validationType = this.splitSt...
[ "function", "(", "element", ")", "{", "// Begin with checking the validate", "var", "elementAsArray", "=", "[", "element", "]", ",", "validationType", "=", "element", ".", "getAttribute", "(", "\"data-validate\"", ")", "||", "null", ";", "invalidElement", "=", "["...
Validates a single element. Used as callback on invalidated elements to check when they are valid. @param element The element to check. @returns bool True on valid
[ "Validates", "a", "single", "element", ".", "Used", "as", "callback", "on", "invalidated", "elements", "to", "check", "when", "they", "are", "valid", "." ]
143e8a69d1b81b409b4aeff106f7fba21cf14645
https://github.com/pkrll/Salvation/blob/143e8a69d1b81b409b4aeff106f7fba21cf14645/src/salvation.js#L527-L553
52,230
robertontiu/wrapper6
build/packages.js
requireDependencies
function requireDependencies(dependencies) { var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var promise = new _es6Promise.Promise(function (succeed, fail) { var requirements = {}; // no requirements if (!(dependencies instanceof Array)) { ...
javascript
function requireDependencies(dependencies) { var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var promise = new _es6Promise.Promise(function (succeed, fail) { var requirements = {}; // no requirements if (!(dependencies instanceof Array)) { ...
[ "function", "requireDependencies", "(", "dependencies", ")", "{", "var", "callback", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "null", ";", "var", "promise", "="...
Resolve an array of dependencies @param dependencies @returns {Promise}
[ "Resolve", "an", "array", "of", "dependencies" ]
70f99dcda0f2e0926b689be349ab9bb95e84a22d
https://github.com/robertontiu/wrapper6/blob/70f99dcda0f2e0926b689be349ab9bb95e84a22d/build/packages.js#L48-L82
52,231
robertontiu/wrapper6
build/packages.js
definePackage
function definePackage(name, dependencies, callback) { // Adjust arguments if (typeof name === "function") { callback = name; name = null; dependencies = null; } else if (typeof dependencies === "function") { callback = dependencies; dependencies = null; if (...
javascript
function definePackage(name, dependencies, callback) { // Adjust arguments if (typeof name === "function") { callback = name; name = null; dependencies = null; } else if (typeof dependencies === "function") { callback = dependencies; dependencies = null; if (...
[ "function", "definePackage", "(", "name", ",", "dependencies", ",", "callback", ")", "{", "// Adjust arguments", "if", "(", "typeof", "name", "===", "\"function\"", ")", "{", "callback", "=", "name", ";", "name", "=", "null", ";", "dependencies", "=", "null"...
Define a package @param name @param dependencies @param callback @returns {Promise.<TResult>}
[ "Define", "a", "package" ]
70f99dcda0f2e0926b689be349ab9bb95e84a22d
https://github.com/robertontiu/wrapper6/blob/70f99dcda0f2e0926b689be349ab9bb95e84a22d/build/packages.js#L92-L169
52,232
robertontiu/wrapper6
build/packages.js
wrapAll
function wrapAll(callback) { // Prepare packages var packs = {}; packages.forEach(function (pack, name) { packs[name] = pack; }); return callback(packs); }
javascript
function wrapAll(callback) { // Prepare packages var packs = {}; packages.forEach(function (pack, name) { packs[name] = pack; }); return callback(packs); }
[ "function", "wrapAll", "(", "callback", ")", "{", "// Prepare packages", "var", "packs", "=", "{", "}", ";", "packages", ".", "forEach", "(", "function", "(", "pack", ",", "name", ")", "{", "packs", "[", "name", "]", "=", "pack", ";", "}", ")", ";", ...
Runs the callback with all currently loaded packages @param callback @returns {*}
[ "Runs", "the", "callback", "with", "all", "currently", "loaded", "packages" ]
70f99dcda0f2e0926b689be349ab9bb95e84a22d
https://github.com/robertontiu/wrapper6/blob/70f99dcda0f2e0926b689be349ab9bb95e84a22d/build/packages.js#L177-L186
52,233
gethuman/jyt
lib/jyt.utils.js
isEmptyObject
function isEmptyObject(obj) { if (obj === null) { return true; } if (!isObject(obj)) { return false; } for (var key in obj) { if (obj.hasOwnProperty(key) && obj[key]) { return false; } } return true; }
javascript
function isEmptyObject(obj) { if (obj === null) { return true; } if (!isObject(obj)) { return false; } for (var key in obj) { if (obj.hasOwnProperty(key) && obj[key]) { return false; } } return true; }
[ "function", "isEmptyObject", "(", "obj", ")", "{", "if", "(", "obj", "===", "null", ")", "{", "return", "true", ";", "}", "if", "(", "!", "isObject", "(", "obj", ")", ")", "{", "return", "false", ";", "}", "for", "(", "var", "key", "in", "obj", ...
Return true if an object and is empty @param obj @returns {boolean}
[ "Return", "true", "if", "an", "object", "and", "is", "empty" ]
716be37e09217b4be917e179389f752212a428b3
https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.utils.js#L53-L68
52,234
gethuman/jyt
lib/jyt.utils.js
dashToCamelCase
function dashToCamelCase(dashCase) { if (!dashCase) { return dashCase; } var parts = dashCase.split('-'); var camelCase = parts[0]; var part; for (var i = 1; i < parts.length; i++) { part = parts[i]; camelCase += part.substring(0, 1).toUpperCase() + part.substring(1); } re...
javascript
function dashToCamelCase(dashCase) { if (!dashCase) { return dashCase; } var parts = dashCase.split('-'); var camelCase = parts[0]; var part; for (var i = 1; i < parts.length; i++) { part = parts[i]; camelCase += part.substring(0, 1).toUpperCase() + part.substring(1); } re...
[ "function", "dashToCamelCase", "(", "dashCase", ")", "{", "if", "(", "!", "dashCase", ")", "{", "return", "dashCase", ";", "}", "var", "parts", "=", "dashCase", ".", "split", "(", "'-'", ")", ";", "var", "camelCase", "=", "parts", "[", "0", "]", ";",...
Convert a string with dashes to camel case @param dashCase
[ "Convert", "a", "string", "with", "dashes", "to", "camel", "case" ]
716be37e09217b4be917e179389f752212a428b3
https://github.com/gethuman/jyt/blob/716be37e09217b4be917e179389f752212a428b3/lib/jyt.utils.js#L74-L87
52,235
esoodev/eve-swagger-simple
index.js
function (route, parameters) { return new Promise((resolve, reject) => { request.get({ url: baseUrl + route + '?' + querystring.stringify(parameters) }, (error, response, body) => { if (error) { reject(error); } else ...
javascript
function (route, parameters) { return new Promise((resolve, reject) => { request.get({ url: baseUrl + route + '?' + querystring.stringify(parameters) }, (error, response, body) => { if (error) { reject(error); } else ...
[ "function", "(", "route", ",", "parameters", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "request", ".", "get", "(", "{", "url", ":", "baseUrl", "+", "route", "+", "'?'", "+", "querystring", ".", "stringi...
Send a GET request to ESI - try POST if it fails.
[ "Send", "a", "GET", "request", "to", "ESI", "-", "try", "POST", "if", "it", "fails", "." ]
1a47aeb5074bc95c2e5caa7caf9fdbcc5ed302f9
https://github.com/esoodev/eve-swagger-simple/blob/1a47aeb5074bc95c2e5caa7caf9fdbcc5ed302f9/index.js#L8-L40
52,236
esoodev/eve-swagger-simple
index.js
function (route, parameters) { return new Promise((resolve, reject) => { request.post({ url: baseUrl + route, qs: parameters }, (error, response, body) => { if (error) { reject(error); } else { resolve...
javascript
function (route, parameters) { return new Promise((resolve, reject) => { request.post({ url: baseUrl + route, qs: parameters }, (error, response, body) => { if (error) { reject(error); } else { resolve...
[ "function", "(", "route", ",", "parameters", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "request", ".", "post", "(", "{", "url", ":", "baseUrl", "+", "route", ",", "qs", ":", "parameters", "}", ",", "(...
Send a post request to ESI
[ "Send", "a", "post", "request", "to", "ESI" ]
1a47aeb5074bc95c2e5caa7caf9fdbcc5ed302f9
https://github.com/esoodev/eve-swagger-simple/blob/1a47aeb5074bc95c2e5caa7caf9fdbcc5ed302f9/index.js#L43-L57
52,237
danillouz/product-hunt
src/utils/http.js
GET
function GET(uri, params) { const reqUrl = `${uri}${url.format({ query: params })}`; log(`request URL: ${reqUrl}`); return fetch(reqUrl) .then(function handleGetRequest(res) { const status = res.status; const statusText = res.statusText; log(`status code: ${status}`); log(`status text: ${statusText}...
javascript
function GET(uri, params) { const reqUrl = `${uri}${url.format({ query: params })}`; log(`request URL: ${reqUrl}`); return fetch(reqUrl) .then(function handleGetRequest(res) { const status = res.status; const statusText = res.statusText; log(`status code: ${status}`); log(`status text: ${statusText}...
[ "function", "GET", "(", "uri", ",", "params", ")", "{", "const", "reqUrl", "=", "`", "${", "uri", "}", "${", "url", ".", "format", "(", "{", "query", ":", "params", "}", ")", "}", "`", ";", "log", "(", "`", "${", "reqUrl", "}", "`", ")", ";",...
Makes an HTTP GET request for a specific URI. @param {String} uri - the request URI @param {Object} params - the request query parameters @return {Promise} resolves with the HTTP response
[ "Makes", "an", "HTTP", "GET", "request", "for", "a", "specific", "URI", "." ]
de7196db39365874055ad363cf3736de6de13856
https://github.com/danillouz/product-hunt/blob/de7196db39365874055ad363cf3736de6de13856/src/utils/http.js#L17-L52
52,238
jamiter/swapi-schema
src/schema.js
jsonSchemaTypeToGraphQL
function jsonSchemaTypeToGraphQL(jsonSchemaType, schemaName) { if (jsonSchemaType === "array") { if (graphQLObjectTypes[schemaName]) { return new GraphQLList(graphQLObjectTypes[schemaName]); } else { const translated = { pilots: "people", characters: "people", residents: "p...
javascript
function jsonSchemaTypeToGraphQL(jsonSchemaType, schemaName) { if (jsonSchemaType === "array") { if (graphQLObjectTypes[schemaName]) { return new GraphQLList(graphQLObjectTypes[schemaName]); } else { const translated = { pilots: "people", characters: "people", residents: "p...
[ "function", "jsonSchemaTypeToGraphQL", "(", "jsonSchemaType", ",", "schemaName", ")", "{", "if", "(", "jsonSchemaType", "===", "\"array\"", ")", "{", "if", "(", "graphQLObjectTypes", "[", "schemaName", "]", ")", "{", "return", "new", "GraphQLList", "(", "graphQL...
Convert the JSON Schema types to the actual GraphQL types in our schema
[ "Convert", "the", "JSON", "Schema", "types", "to", "the", "actual", "GraphQL", "types", "in", "our", "schema" ]
f05b28b75d7205739c0415bf379b5cd1f4936a7d
https://github.com/jamiter/swapi-schema/blob/f05b28b75d7205739c0415bf379b5cd1f4936a7d/src/schema.js#L55-L85
52,239
jamiter/swapi-schema
src/schema.js
fetchPageOfType
function fetchPageOfType(typePluralName, pageNumber) { let url = `http://swapi.co/api/${typePluralName}/`; if (pageNumber) { url += `?page=${pageNumber}`; }; return restLoader.load(url).then((data) => { // Paginated results have a different shape return data.results; }); }
javascript
function fetchPageOfType(typePluralName, pageNumber) { let url = `http://swapi.co/api/${typePluralName}/`; if (pageNumber) { url += `?page=${pageNumber}`; }; return restLoader.load(url).then((data) => { // Paginated results have a different shape return data.results; }); }
[ "function", "fetchPageOfType", "(", "typePluralName", ",", "pageNumber", ")", "{", "let", "url", "=", "`", "${", "typePluralName", "}", "`", ";", "if", "(", "pageNumber", ")", "{", "url", "+=", "`", "${", "pageNumber", "}", "`", ";", "}", ";", "return"...
A helper to unwrap the paginated object from SWAPI
[ "A", "helper", "to", "unwrap", "the", "paginated", "object", "from", "SWAPI" ]
f05b28b75d7205739c0415bf379b5cd1f4936a7d
https://github.com/jamiter/swapi-schema/blob/f05b28b75d7205739c0415bf379b5cd1f4936a7d/src/schema.js#L134-L144
52,240
tolokoban/ToloFrameWork
ker/mod/tfw.color.js
rgb2hsl
function rgb2hsl() { const R = this.R, G = this.G, B = this.B, min = Math.min( R, G, B ), max = Math.max( R, G, B ), delta = max - min; this.L = 0.5 * ( max + min ); if ( delta < 0.000001 ) { this.H = 0; this.S = 0; } else {...
javascript
function rgb2hsl() { const R = this.R, G = this.G, B = this.B, min = Math.min( R, G, B ), max = Math.max( R, G, B ), delta = max - min; this.L = 0.5 * ( max + min ); if ( delta < 0.000001 ) { this.H = 0; this.S = 0; } else {...
[ "function", "rgb2hsl", "(", ")", "{", "const", "R", "=", "this", ".", "R", ",", "G", "=", "this", ".", "G", ",", "B", "=", "this", ".", "B", ",", "min", "=", "Math", ".", "min", "(", "R", ",", "G", ",", "B", ")", ",", "max", "=", "Math", ...
Read R,G,B and write H,S,L. @this Color @returns {undefined}
[ "Read", "R", "G", "B", "and", "write", "H", "S", "L", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.color.js#L106-L134
52,241
BlueRival/confection
lib/core/index.js
getConf
function getConf( path, environment, callback, context ) { // relative paths need to be auto-prefixed with the environment if ( path.match( /^[^\.]/ ) ) { path = "." + environment + "." + path; } if ( !context ) { context = { pathsSeen: {} }; } // avoid circular references if ( context.pathsSeen[path...
javascript
function getConf( path, environment, callback, context ) { // relative paths need to be auto-prefixed with the environment if ( path.match( /^[^\.]/ ) ) { path = "." + environment + "." + path; } if ( !context ) { context = { pathsSeen: {} }; } // avoid circular references if ( context.pathsSeen[path...
[ "function", "getConf", "(", "path", ",", "environment", ",", "callback", ",", "context", ")", "{", "// relative paths need to be auto-prefixed with the environment", "if", "(", "path", ".", "match", "(", "/", "^[^\\.]", "/", ")", ")", "{", "path", "=", "\".\"", ...
getConf is responsible for the core logic in the API. It handles applying all extensions and wildcard lookups. External Params: @param path the dot notation path to pull from the storage engine @param environment the name of the environment to pull the configuration for @param callback Recursive Params: @param contex...
[ "getConf", "is", "responsible", "for", "the", "core", "logic", "in", "the", "API", ".", "It", "handles", "applying", "all", "extensions", "and", "wildcard", "lookups", "." ]
c1eb8c78bae9eb059b825978896d0a4ef8ca6771
https://github.com/BlueRival/confection/blob/c1eb8c78bae9eb059b825978896d0a4ef8ca6771/lib/core/index.js#L131-L191
52,242
BlueRival/confection
lib/core/index.js
getPath
function getPath( req, res, next ) { var path = req.path.replace( /\..*$/, '' ).replace( /\//g, '.' ).replace( /^\.conf/, '' ).replace( /\.$/, '' ).trim(); if ( path.length < 1 ) { path = null; } var outputFilter = req.path.trim().match( /\.(.*)$/ ); if ( outputFilter ) { outputFilter = outputFilter[1].trim...
javascript
function getPath( req, res, next ) { var path = req.path.replace( /\..*$/, '' ).replace( /\//g, '.' ).replace( /^\.conf/, '' ).replace( /\.$/, '' ).trim(); if ( path.length < 1 ) { path = null; } var outputFilter = req.path.trim().match( /\.(.*)$/ ); if ( outputFilter ) { outputFilter = outputFilter[1].trim...
[ "function", "getPath", "(", "req", ",", "res", ",", "next", ")", "{", "var", "path", "=", "req", ".", "path", ".", "replace", "(", "/", "\\..*$", "/", ",", "''", ")", ".", "replace", "(", "/", "\\/", "/", "g", ",", "'.'", ")", ".", "replace", ...
Get the conf path from the URL path. @param req The express request handle @param res The response object passed to the middleware @param next The next function to trigger the next middleware @return {null}
[ "Get", "the", "conf", "path", "from", "the", "URL", "path", "." ]
c1eb8c78bae9eb059b825978896d0a4ef8ca6771
https://github.com/BlueRival/confection/blob/c1eb8c78bae9eb059b825978896d0a4ef8ca6771/lib/core/index.js#L343-L365
52,243
BlueRival/confection
lib/core/index.js
configureExpress
function configureExpress() { // create configuration routes moduleConfig.express.get( /^\/conf.*/, checkAuth, getPath, getMiddlewareWrapper( onGetConf ) ); moduleConfig.express.post( /^\/conf.*/, storeRequestBody, checkAuth, getPath, getMiddlewareWrapper( onPostConf ) ); moduleConfig.express.delete( /^\/conf.*/, ...
javascript
function configureExpress() { // create configuration routes moduleConfig.express.get( /^\/conf.*/, checkAuth, getPath, getMiddlewareWrapper( onGetConf ) ); moduleConfig.express.post( /^\/conf.*/, storeRequestBody, checkAuth, getPath, getMiddlewareWrapper( onPostConf ) ); moduleConfig.express.delete( /^\/conf.*/, ...
[ "function", "configureExpress", "(", ")", "{", "// create configuration routes", "moduleConfig", ".", "express", ".", "get", "(", "/", "^\\/conf.*", "/", ",", "checkAuth", ",", "getPath", ",", "getMiddlewareWrapper", "(", "onGetConf", ")", ")", ";", "moduleConfig"...
Configures the express instance.
[ "Configures", "the", "express", "instance", "." ]
c1eb8c78bae9eb059b825978896d0a4ef8ca6771
https://github.com/BlueRival/confection/blob/c1eb8c78bae9eb059b825978896d0a4ef8ca6771/lib/core/index.js#L386-L397
52,244
BlueRival/confection
lib/core/index.js
getMiddlewareWrapper
function getMiddlewareWrapper( middleware ) { return function ( req, res, next ) { try { middleware( req, res, next ); } catch ( e ) { getResponder( req, res )( 500 ); } }; }
javascript
function getMiddlewareWrapper( middleware ) { return function ( req, res, next ) { try { middleware( req, res, next ); } catch ( e ) { getResponder( req, res )( 500 ); } }; }
[ "function", "getMiddlewareWrapper", "(", "middleware", ")", "{", "return", "function", "(", "req", ",", "res", ",", "next", ")", "{", "try", "{", "middleware", "(", "req", ",", "res", ",", "next", ")", ";", "}", "catch", "(", "e", ")", "{", "getRespo...
This wrapper simply traps any uncaught exceptions. @param middleware The middleware function to wrap @return {Function} The wrapper function to pass to express
[ "This", "wrapper", "simply", "traps", "any", "uncaught", "exceptions", "." ]
c1eb8c78bae9eb059b825978896d0a4ef8ca6771
https://github.com/BlueRival/confection/blob/c1eb8c78bae9eb059b825978896d0a4ef8ca6771/lib/core/index.js#L405-L414
52,245
BlueRival/confection
lib/core/index.js
getResponder
function getResponder( req, res ) { return function ( code, body, contentType ) { if ( code !== 200 ) { body = ""; contentType = "text/html; charset=utf-8"; } if ( !contentType ) { contentType = "text/html; charset=utf-8"; } res.writeHead( code, { "Content-type": contentType } ); res.end...
javascript
function getResponder( req, res ) { return function ( code, body, contentType ) { if ( code !== 200 ) { body = ""; contentType = "text/html; charset=utf-8"; } if ( !contentType ) { contentType = "text/html; charset=utf-8"; } res.writeHead( code, { "Content-type": contentType } ); res.end...
[ "function", "getResponder", "(", "req", ",", "res", ")", "{", "return", "function", "(", "code", ",", "body", ",", "contentType", ")", "{", "if", "(", "code", "!==", "200", ")", "{", "body", "=", "\"\"", ";", "contentType", "=", "\"text/html; charset=utf...
Gets a response generating function. Used in middleware to simplify response logic. @param res A handle to a response object to send the response to when the responder function is called @return {Function} The responder function for middleware to call to send a response to a request
[ "Gets", "a", "response", "generating", "function", ".", "Used", "in", "middleware", "to", "simplify", "response", "logic", "." ]
c1eb8c78bae9eb059b825978896d0a4ef8ca6771
https://github.com/BlueRival/confection/blob/c1eb8c78bae9eb059b825978896d0a4ef8ca6771/lib/core/index.js#L422-L442
52,246
billinghamj/resilient-mailer-sendgrid
lib/sendgrid-provider.js
SendgridProvider
function SendgridProvider(apiUser, apiKey, options) { if (typeof apiUser !== 'string' || typeof apiKey !== 'string') { throw new Error('Invalid parameters'); } options = options || {}; if (typeof options.apiSecure === 'undefined') options.apiSecure = true; options.apiHostname = options.apiHostname || 'api...
javascript
function SendgridProvider(apiUser, apiKey, options) { if (typeof apiUser !== 'string' || typeof apiKey !== 'string') { throw new Error('Invalid parameters'); } options = options || {}; if (typeof options.apiSecure === 'undefined') options.apiSecure = true; options.apiHostname = options.apiHostname || 'api...
[ "function", "SendgridProvider", "(", "apiUser", ",", "apiKey", ",", "options", ")", "{", "if", "(", "typeof", "apiUser", "!==", "'string'", "||", "typeof", "apiKey", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Invalid parameters'", ")", ";",...
Creates an instance of the SendGrid email provider. @constructor @this {SendgridProvider} @param {string} apiUser API user for the SendGrid account. @param {string} apiKey API key for the SendGrid account. @param {object} [options] Additional optional configuration. @param {boolean} [options.apiSecure=true] API connec...
[ "Creates", "an", "instance", "of", "the", "SendGrid", "email", "provider", "." ]
89eec1fe27da6ba54dcb32fed111163d81a919f6
https://github.com/billinghamj/resilient-mailer-sendgrid/blob/89eec1fe27da6ba54dcb32fed111163d81a919f6/lib/sendgrid-provider.js#L19-L36
52,247
me-ventures/microservice-toolkit
src/context.js
consume
function consume(exchangeName, topics, handler) { // Setup chain var messageHandler = function(message) { // make sure we don't have things like buffers message.content = JSON.parse(message.content.toString()); topics.forEach(function(topic){ statusProvider.setEventConsumeEx...
javascript
function consume(exchangeName, topics, handler) { // Setup chain var messageHandler = function(message) { // make sure we don't have things like buffers message.content = JSON.parse(message.content.toString()); topics.forEach(function(topic){ statusProvider.setEventConsumeEx...
[ "function", "consume", "(", "exchangeName", ",", "topics", ",", "handler", ")", "{", "// Setup chain", "var", "messageHandler", "=", "function", "(", "message", ")", "{", "// make sure we don't have things like buffers", "message", ".", "content", "=", "JSON", ".", ...
Create a consume function for an exchange. Handler should return a promise and accept a message. If this is reject promise the message is not acknowledged. If the resolves it should contain the original message. @param exchangeName @param topics @param handler
[ "Create", "a", "consume", "function", "for", "an", "exchange", "." ]
9aedc9542dffdc274a5142515bd22e92833220d2
https://github.com/me-ventures/microservice-toolkit/blob/9aedc9542dffdc274a5142515bd22e92833220d2/src/context.js#L35-L58
52,248
me-ventures/microservice-toolkit
src/context.js
consumeShared
function consumeShared(exchangeName, topics, queueName, handler, fetchCount = 1) { var messageHandler = function(message) { // make sure we don't have things like buffers message.content = JSON.parse(message.content.toString()); topics.forEach(function(topic){ statusProvider.set...
javascript
function consumeShared(exchangeName, topics, queueName, handler, fetchCount = 1) { var messageHandler = function(message) { // make sure we don't have things like buffers message.content = JSON.parse(message.content.toString()); topics.forEach(function(topic){ statusProvider.set...
[ "function", "consumeShared", "(", "exchangeName", ",", "topics", ",", "queueName", ",", "handler", ",", "fetchCount", "=", "1", ")", "{", "var", "messageHandler", "=", "function", "(", "message", ")", "{", "// make sure we don't have things like buffers", "message",...
Create a consume function for an exchange using a shared queue. This queue can be used by other workers and the messages will be shared round-robin. Handler should return a promise and accept a message. If this is reject promise the message is not acknowledged. If the resolves it should contain the original message. ...
[ "Create", "a", "consume", "function", "for", "an", "exchange", "using", "a", "shared", "queue", ".", "This", "queue", "can", "be", "used", "by", "other", "workers", "and", "the", "messages", "will", "be", "shared", "round", "-", "robin", "." ]
9aedc9542dffdc274a5142515bd22e92833220d2
https://github.com/me-ventures/microservice-toolkit/blob/9aedc9542dffdc274a5142515bd22e92833220d2/src/context.js#L73-L95
52,249
integreat-io/great-uri-template
lib/filters/upper.js
upper
function upper (value) { if (value === null || value === undefined) { return value } return String.prototype.toUpperCase.call(value) }
javascript
function upper (value) { if (value === null || value === undefined) { return value } return String.prototype.toUpperCase.call(value) }
[ "function", "upper", "(", "value", ")", "{", "if", "(", "value", "===", "null", "||", "value", "===", "undefined", ")", "{", "return", "value", "}", "return", "String", ".", "prototype", ".", "toUpperCase", ".", "call", "(", "value", ")", "}" ]
Returns the value in upper case. @param {string} value - The value @returns {string} Upper case value
[ "Returns", "the", "value", "in", "upper", "case", "." ]
0e896ead0567737cf31a4a8b76a26cfa6ce60759
https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/filters/upper.js#L6-L11
52,250
phelpstream/svp
lib/functions/iftr.js
iftr
function iftr(conditionResult, trueValue, falseValue) { if (conditionResult && (0, _is.isDefined)(trueValue)) return trueValue; if (!conditionResult && (0, _is.isDefined)(falseValue)) return falseValue; }
javascript
function iftr(conditionResult, trueValue, falseValue) { if (conditionResult && (0, _is.isDefined)(trueValue)) return trueValue; if (!conditionResult && (0, _is.isDefined)(falseValue)) return falseValue; }
[ "function", "iftr", "(", "conditionResult", ",", "trueValue", ",", "falseValue", ")", "{", "if", "(", "conditionResult", "&&", "(", "0", ",", "_is", ".", "isDefined", ")", "(", "trueValue", ")", ")", "return", "trueValue", ";", "if", "(", "!", "condition...
If Then Return
[ "If", "Then", "Return" ]
2f99adb9c5d0709e567264bba896d6a59f6a0a59
https://github.com/phelpstream/svp/blob/2f99adb9c5d0709e567264bba896d6a59f6a0a59/lib/functions/iftr.js#L11-L14
52,251
telyn/node-jrc
lib/message.js
function() { switch(self.command) { case constants.WHOIS: return (self.params[0][0] == 'A'); case constants.PASSWORD: return true; case constants.NUMERICINFO: case constants.GENERALINFO: // client-to-server ...
javascript
function() { switch(self.command) { case constants.WHOIS: return (self.params[0][0] == 'A'); case constants.PASSWORD: return true; case constants.NUMERICINFO: case constants.GENERALINFO: // client-to-server ...
[ "function", "(", ")", "{", "switch", "(", "self", ".", "command", ")", "{", "case", "constants", ".", "WHOIS", ":", "return", "(", "self", ".", "params", "[", "0", "]", "[", "0", "]", "==", "'A'", ")", ";", "case", "constants", ".", "PASSWORD", "...
returns true for commands like HcCreatures
[ "returns", "true", "for", "commands", "like", "HcCreatures" ]
c91b8d0a7d95856b7650b815234d8ab77f06b3f5
https://github.com/telyn/node-jrc/blob/c91b8d0a7d95856b7650b815234d8ab77f06b3f5/lib/message.js#L13-L27
52,252
CHENXCHEN/merges-utils
lib/index.js
merge
function merge(need, options, level){ // 如果没有传第三个参数,默认无限递归右边覆盖左边 if (level == undefined) level = -1; if (options === undefined) options = {}; if (need.length == 1) return need[0]; var res = {}; for (var i = 0; i < need.length; i++){ _merge(res, need[i], options, level - 1); } ret...
javascript
function merge(need, options, level){ // 如果没有传第三个参数,默认无限递归右边覆盖左边 if (level == undefined) level = -1; if (options === undefined) options = {}; if (need.length == 1) return need[0]; var res = {}; for (var i = 0; i < need.length; i++){ _merge(res, need[i], options, level - 1); } ret...
[ "function", "merge", "(", "need", ",", "options", ",", "level", ")", "{", "// 如果没有传第三个参数,默认无限递归右边覆盖左边", "if", "(", "level", "==", "undefined", ")", "level", "=", "-", "1", ";", "if", "(", "options", "===", "undefined", ")", "options", "=", "{", "}", ";...
global merge function @param {Array} need need to merge @param {Object} options options for merge method @param {Number} level merge level @return {Object} the result of merges
[ "global", "merge", "function" ]
5fde6058ba791c58102a109ac4ac20e0afe7ebe7
https://github.com/CHENXCHEN/merges-utils/blob/5fde6058ba791c58102a109ac4ac20e0afe7ebe7/lib/index.js#L47-L57
52,253
meltmedia/node-usher
lib/decider/tasks/loop.js
Loop
function Loop(name, deps, fragment, loopFn, options) { if (!(this instanceof Loop)) { return new Loop(name, deps, fragment, loopFn, options); } Task.apply(this, Array.prototype.slice.call(arguments)); this.fragment = fragment; this.loopFn = (_.isFunction(loopFn)) ? loopFn : function (input) { return [i...
javascript
function Loop(name, deps, fragment, loopFn, options) { if (!(this instanceof Loop)) { return new Loop(name, deps, fragment, loopFn, options); } Task.apply(this, Array.prototype.slice.call(arguments)); this.fragment = fragment; this.loopFn = (_.isFunction(loopFn)) ? loopFn : function (input) { return [i...
[ "function", "Loop", "(", "name", ",", "deps", ",", "fragment", ",", "loopFn", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Loop", ")", ")", "{", "return", "new", "Loop", "(", "name", ",", "deps", ",", "fragment", ",", "loop...
The loop executes in batches to help alleviate rate limit exceptions The number of items to proccess per batch and the delay between batches are both configurable @constructor
[ "The", "loop", "executes", "in", "batches", "to", "help", "alleviate", "rate", "limit", "exceptions", "The", "number", "of", "items", "to", "proccess", "per", "batch", "and", "the", "delay", "between", "batches", "are", "both", "configurable" ]
fe6183bf7097f84bef935e8d9c19463accc08ad6
https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/decider/tasks/loop.js#L26-L37
52,254
quantumpayments/media
lib/qpm_media.js
createTables
function createTables() { // setup config var config = require('../config/config.js') var db = wc_db.getConnection(config.db) var sql = fs.readFileSync('model/Media.sql').toString() debug(sql) db.query(sql).then(function(ret){ debug(ret) }).catch(function(err) { debug(err) }) var sql = fs.re...
javascript
function createTables() { // setup config var config = require('../config/config.js') var db = wc_db.getConnection(config.db) var sql = fs.readFileSync('model/Media.sql').toString() debug(sql) db.query(sql).then(function(ret){ debug(ret) }).catch(function(err) { debug(err) }) var sql = fs.re...
[ "function", "createTables", "(", ")", "{", "// setup config", "var", "config", "=", "require", "(", "'../config/config.js'", ")", "var", "db", "=", "wc_db", ".", "getConnection", "(", "config", ".", "db", ")", "var", "sql", "=", "fs", ".", "readFileSync", ...
Creates database tables.
[ "Creates", "database", "tables", "." ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L37-L98
52,255
quantumpayments/media
lib/qpm_media.js
addMedia
function addMedia(uri, contentType, safe) { if (!uri || uri === '') { return 'You must enter a valid uri' } safe = safe || 0 return new Promise((resolve, reject) => { var config = require('../config/config.js') var conn = wc_db.getConnection(config.db) // sniff content type if (!contentTyp...
javascript
function addMedia(uri, contentType, safe) { if (!uri || uri === '') { return 'You must enter a valid uri' } safe = safe || 0 return new Promise((resolve, reject) => { var config = require('../config/config.js') var conn = wc_db.getConnection(config.db) // sniff content type if (!contentTyp...
[ "function", "addMedia", "(", "uri", ",", "contentType", ",", "safe", ")", "{", "if", "(", "!", "uri", "||", "uri", "===", "''", ")", "{", "return", "'You must enter a valid uri'", "}", "safe", "=", "safe", "||", "0", "return", "new", "Promise", "(", "(...
Adds media to the database @param {string} uri The URI to add. @param {string} contentType The content type. @param {Object} callback The callback.
[ "Adds", "media", "to", "the", "database" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L106-L175
52,256
quantumpayments/media
lib/qpm_media.js
addRating
function addRating(rating, config, conn) { // validate if (!rating.uri || rating.uri === '') { return 'You must enter a valid uri' } if (!rating.reviewer || rating.reviewer === '') { return 'You must enter a valid reviewer' } if (isNaN(rating.rating)) { return 'You must enter a valid rating' ...
javascript
function addRating(rating, config, conn) { // validate if (!rating.uri || rating.uri === '') { return 'You must enter a valid uri' } if (!rating.reviewer || rating.reviewer === '') { return 'You must enter a valid reviewer' } if (isNaN(rating.rating)) { return 'You must enter a valid rating' ...
[ "function", "addRating", "(", "rating", ",", "config", ",", "conn", ")", "{", "// validate", "if", "(", "!", "rating", ".", "uri", "||", "rating", ".", "uri", "===", "''", ")", "{", "return", "'You must enter a valid uri'", "}", "if", "(", "!", "rating",...
Adds rating to the database @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Adds", "rating", "to", "the", "database" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L185-L224
52,257
quantumpayments/media
lib/qpm_media.js
addMeta
function addMeta(params, config, conn) { params = params || {} // validate if (!params.uri || params.uri === '') { return 'You must enter a valid uri' } // defaults config = config || require('../config/config.js') debug(params) // main // main return new Promise((resolve, reject) => { ...
javascript
function addMeta(params, config, conn) { params = params || {} // validate if (!params.uri || params.uri === '') { return 'You must enter a valid uri' } // defaults config = config || require('../config/config.js') debug(params) // main // main return new Promise((resolve, reject) => { ...
[ "function", "addMeta", "(", "params", ",", "config", ",", "conn", ")", "{", "params", "=", "params", "||", "{", "}", "// validate", "if", "(", "!", "params", ".", "uri", "||", "params", ".", "uri", "===", "''", ")", "{", "return", "'You must enter a va...
Adds a meta record to the database @param {Object} params The meta info. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Adds", "a", "meta", "record", "to", "the", "database" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L274-L315
52,258
quantumpayments/media
lib/qpm_media.js
addFragment
function addFragment(params, config, conn) { // validate if ( (!params.id || params.id === '') && (!params.uri || params.uri === '') ) { return 'You must enter a valid id or uri' } // defaults config = config || require('../config/config.js') debug(params) // main return new Promise((resolve, re...
javascript
function addFragment(params, config, conn) { // validate if ( (!params.id || params.id === '') && (!params.uri || params.uri === '') ) { return 'You must enter a valid id or uri' } // defaults config = config || require('../config/config.js') debug(params) // main return new Promise((resolve, re...
[ "function", "addFragment", "(", "params", ",", "config", ",", "conn", ")", "{", "// validate", "if", "(", "(", "!", "params", ".", "id", "||", "params", ".", "id", "===", "''", ")", "&&", "(", "!", "params", ".", "uri", "||", "params", ".", "uri", ...
Adds a fragment to the database @param {Object} params The parameter info. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Adds", "a", "fragment", "to", "the", "database" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L324-L359
52,259
quantumpayments/media
lib/qpm_media.js
insertRating
function insertRating(rating, config, conn) { // validate if ( (!rating.uri || rating.uri === '') && (!rating.cacheURI || rating.cacheURI === '') ) { return 'You must enter a valid uri' } if (!rating.reviewer || rating.reviewer === '') { return 'You must enter a valid reviewer' } // defaults co...
javascript
function insertRating(rating, config, conn) { // validate if ( (!rating.uri || rating.uri === '') && (!rating.cacheURI || rating.cacheURI === '') ) { return 'You must enter a valid uri' } if (!rating.reviewer || rating.reviewer === '') { return 'You must enter a valid reviewer' } // defaults co...
[ "function", "insertRating", "(", "rating", ",", "config", ",", "conn", ")", "{", "// validate", "if", "(", "(", "!", "rating", ".", "uri", "||", "rating", ".", "uri", "===", "''", ")", "&&", "(", "!", "rating", ".", "cacheURI", "||", "rating", ".", ...
Inserts rating to the database @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Inserts", "rating", "to", "the", "database" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L413-L451
52,260
quantumpayments/media
lib/qpm_media.js
getTopImages
function getTopImages(params, config, conn) { // defaults config = config || require('../config/config.js') var limit = 10 if (!isNaN(params.limit)) { limit = params.limit } // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.db) } ...
javascript
function getTopImages(params, config, conn) { // defaults config = config || require('../config/config.js') var limit = 10 if (!isNaN(params.limit)) { limit = params.limit } // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.db) } ...
[ "function", "getTopImages", "(", "params", ",", "config", ",", "conn", ")", "{", "// defaults", "config", "=", "config", "||", "require", "(", "'../config/config.js'", ")", "var", "limit", "=", "10", "if", "(", "!", "isNaN", "(", "params", ".", "limit", ...
Get the top images @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Get", "the", "top", "images" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L633-L667
52,261
quantumpayments/media
lib/qpm_media.js
getTags
function getTags(params, config, conn) { // defaults config = config || require('../config/config.js') params.limit = 100 // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.db) } if (params.uri) { var sql = 'SELECT t.tag from Med...
javascript
function getTags(params, config, conn) { // defaults config = config || require('../config/config.js') params.limit = 100 // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.db) } if (params.uri) { var sql = 'SELECT t.tag from Med...
[ "function", "getTags", "(", "params", ",", "config", ",", "conn", ")", "{", "// defaults", "config", "=", "config", "||", "require", "(", "'../config/config.js'", ")", "params", ".", "limit", "=", "100", "// main", "return", "new", "Promise", "(", "(", "re...
Get list of tags @param {Object} params Info about tags. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Get", "list", "of", "tags" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L677-L708
52,262
quantumpayments/media
lib/qpm_media.js
getRandomUnseenImage
function getRandomUnseenImage(params, config, conn) { // defaults config = config || require('../config/config.js') params = params || {} var max = config.db.max || 0 var optimization = config.optimization || 0 var offset = Math.floor(Math.random() * max) params.optimization = optimization params.of...
javascript
function getRandomUnseenImage(params, config, conn) { // defaults config = config || require('../config/config.js') params = params || {} var max = config.db.max || 0 var optimization = config.optimization || 0 var offset = Math.floor(Math.random() * max) params.optimization = optimization params.of...
[ "function", "getRandomUnseenImage", "(", "params", ",", "config", ",", "conn", ")", "{", "// defaults", "config", "=", "config", "||", "require", "(", "'../config/config.js'", ")", "params", "=", "params", "||", "{", "}", "var", "max", "=", "config", ".", ...
Get a random unseen image @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Get", "a", "random", "unseen", "image" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L861-L909
52,263
quantumpayments/media
lib/qpm_media.js
getLastSeen
function getLastSeen(params, config, conn) { // defaults config = config || require('../config/config.js') params = params || {} params.webid = params.webid || 'http://melvincarvalho.com/#me' // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.d...
javascript
function getLastSeen(params, config, conn) { // defaults config = config || require('../config/config.js') params = params || {} params.webid = params.webid || 'http://melvincarvalho.com/#me' // main return new Promise((resolve, reject) => { if (!conn) { var conn = wc_db.getConnection(config.d...
[ "function", "getLastSeen", "(", "params", ",", "config", ",", "conn", ")", "{", "// defaults", "config", "=", "config", "||", "require", "(", "'../config/config.js'", ")", "params", "=", "params", "||", "{", "}", "params", ".", "webid", "=", "params", ".",...
Get get the last seen item @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "Get", "get", "the", "last", "seen", "item" ]
b53034e6dd2a94dca950e60a49e403aceaa1cdf1
https://github.com/quantumpayments/media/blob/b53034e6dd2a94dca950e60a49e403aceaa1cdf1/lib/qpm_media.js#L1040-L1087
52,264
ljcl/hubot-iss
src/index.js
astroViewer
function astroViewer (options, cb) { request({ url: 'http://astroviewer-sat2c.appspot.com/predictor', qs: { var: 'passesData', lat: options.lat, lon: options.lon, name: options.name }, headers: { 'User-Agent': 'request' } }, function (error, response, body) { if...
javascript
function astroViewer (options, cb) { request({ url: 'http://astroviewer-sat2c.appspot.com/predictor', qs: { var: 'passesData', lat: options.lat, lon: options.lon, name: options.name }, headers: { 'User-Agent': 'request' } }, function (error, response, body) { if...
[ "function", "astroViewer", "(", "options", ",", "cb", ")", "{", "request", "(", "{", "url", ":", "'http://astroviewer-sat2c.appspot.com/predictor'", ",", "qs", ":", "{", "var", ":", "'passesData'", ",", "lat", ":", "options", ".", "lat", ",", "lon", ":", "...
Query astroviewer and dangerously turn the javascript into parsable JSON. @param {object} options An object containing the latitude, longitude and location name @param {Function} cb
[ "Query", "astroviewer", "and", "dangerously", "turn", "the", "javascript", "into", "parsable", "JSON", "." ]
15103c9e491e417406ae99a09e098d87fa02251f
https://github.com/ljcl/hubot-iss/blob/15103c9e491e417406ae99a09e098d87fa02251f/src/index.js#L27-L51
52,265
ljcl/hubot-iss
src/index.js
listPasses
function listPasses (data, cb) { var index = 0 var passes = data.passes var newpasses = '' if (passes.length === 0) { newpasses += ':( No results found for **' + data.location.name + '**' } else { passes.map(function (obj) { if (index === 0) { newpasses += '**' + data.location.name + '**...
javascript
function listPasses (data, cb) { var index = 0 var passes = data.passes var newpasses = '' if (passes.length === 0) { newpasses += ':( No results found for **' + data.location.name + '**' } else { passes.map(function (obj) { if (index === 0) { newpasses += '**' + data.location.name + '**...
[ "function", "listPasses", "(", "data", ",", "cb", ")", "{", "var", "index", "=", "0", "var", "passes", "=", "data", ".", "passes", "var", "newpasses", "=", "''", "if", "(", "passes", ".", "length", "===", "0", ")", "{", "newpasses", "+=", "':( No res...
Build up a string based on the astroViewer data @param {object} data Return the astroviewer object @param {Function} cb
[ "Build", "up", "a", "string", "based", "on", "the", "astroViewer", "data" ]
15103c9e491e417406ae99a09e098d87fa02251f
https://github.com/ljcl/hubot-iss/blob/15103c9e491e417406ae99a09e098d87fa02251f/src/index.js#L58-L79
52,266
konstantin24121/grunt-font-loader
tasks/font_loader.js
closeConnection
function closeConnection(errMsg) { if (ftp) { ftp.raw.quit(function(err, res) { if (err) { grunt.log.error(err); done(false); } ftp.destroy(); grunt.log.ok("FTP connection closed!"); done(); }); } else if (errMsg) { grunt.log.warn(errMsg); done(false); } else { done();...
javascript
function closeConnection(errMsg) { if (ftp) { ftp.raw.quit(function(err, res) { if (err) { grunt.log.error(err); done(false); } ftp.destroy(); grunt.log.ok("FTP connection closed!"); done(); }); } else if (errMsg) { grunt.log.warn(errMsg); done(false); } else { done();...
[ "function", "closeConnection", "(", "errMsg", ")", "{", "if", "(", "ftp", ")", "{", "ftp", ".", "raw", ".", "quit", "(", "function", "(", "err", ",", "res", ")", "{", "if", "(", "err", ")", "{", "grunt", ".", "log", ".", "error", "(", "err", ")...
Close the connection and end the asynchronous task
[ "Close", "the", "connection", "and", "end", "the", "asynchronous", "task" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L71-L88
52,267
konstantin24121/grunt-font-loader
tasks/font_loader.js
getNextClar
function getNextClar(params, string, files) { if (params === 'all') { files.push(string); return true; } if (Array.isArray(params)){ params.forEach(function(item, i, array) { files.push(string + '.' + item + '$'); return true; }); }else if (typeof params === 'object'){ var param; for (...
javascript
function getNextClar(params, string, files) { if (params === 'all') { files.push(string); return true; } if (Array.isArray(params)){ params.forEach(function(item, i, array) { files.push(string + '.' + item + '$'); return true; }); }else if (typeof params === 'object'){ var param; for (...
[ "function", "getNextClar", "(", "params", ",", "string", ",", "files", ")", "{", "if", "(", "params", "===", "'all'", ")", "{", "files", ".", "push", "(", "string", ")", ";", "return", "true", ";", "}", "if", "(", "Array", ".", "isArray", "(", "par...
Create regexp massive @param {array} params massive @param {string} string regexp @param {array} files creating massive @return {boolean}
[ "Create", "regexp", "massive" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L97-L125
52,268
konstantin24121/grunt-font-loader
tasks/font_loader.js
createDownloadList
function createDownloadList() { uploadFiles = []; files.forEach(function(item, i, arr) { var preg = new RegExp(item); var check = false; serverFonts.forEach(function(item, i, arr) { if (preg.test(item)) { uploadFiles.push(item); check = true; // serverFonts.remove(item); } ...
javascript
function createDownloadList() { uploadFiles = []; files.forEach(function(item, i, arr) { var preg = new RegExp(item); var check = false; serverFonts.forEach(function(item, i, arr) { if (preg.test(item)) { uploadFiles.push(item); check = true; // serverFonts.remove(item); } ...
[ "function", "createDownloadList", "(", ")", "{", "uploadFiles", "=", "[", "]", ";", "files", ".", "forEach", "(", "function", "(", "item", ",", "i", ",", "arr", ")", "{", "var", "preg", "=", "new", "RegExp", "(", "item", ")", ";", "var", "check", "...
Create list for downloading
[ "Create", "list", "for", "downloading" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L130-L150
52,269
konstantin24121/grunt-font-loader
tasks/font_loader.js
removeFonts
function removeFonts(files){ var dest = normalizeDir(options.dest); files.forEach(function(item, i, arr){ grunt.file.delete(dest + item); grunt.log.warn('File ' + item + ' remove.'); }); }
javascript
function removeFonts(files){ var dest = normalizeDir(options.dest); files.forEach(function(item, i, arr){ grunt.file.delete(dest + item); grunt.log.warn('File ' + item + ' remove.'); }); }
[ "function", "removeFonts", "(", "files", ")", "{", "var", "dest", "=", "normalizeDir", "(", "options", ".", "dest", ")", ";", "files", ".", "forEach", "(", "function", "(", "item", ",", "i", ",", "arr", ")", "{", "grunt", ".", "file", ".", "delete", ...
Remove unused files @param {array} files files need to remove
[ "Remove", "unused", "files" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L156-L162
52,270
konstantin24121/grunt-font-loader
tasks/font_loader.js
getFilesList
function getFilesList(pattern) { //If pattern empty return all avaliable fonts if (pattern === undefined || pattern === '') { formatingFontsArray(serverFonts); closeConnection(); return; // We are completed, close connection and end the program } var serverFiles = [], preg = new RegExp('[\\w\\-\\.]...
javascript
function getFilesList(pattern) { //If pattern empty return all avaliable fonts if (pattern === undefined || pattern === '') { formatingFontsArray(serverFonts); closeConnection(); return; // We are completed, close connection and end the program } var serverFiles = [], preg = new RegExp('[\\w\\-\\.]...
[ "function", "getFilesList", "(", "pattern", ")", "{", "//If pattern empty return all avaliable fonts", "if", "(", "pattern", "===", "undefined", "||", "pattern", "===", "''", ")", "{", "formatingFontsArray", "(", "serverFonts", ")", ";", "closeConnection", "(", ")",...
Get list from server @param {String} pattern pattern for search
[ "Get", "list", "from", "server" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L214-L243
52,271
konstantin24121/grunt-font-loader
tasks/font_loader.js
formatingFontsArray
function formatingFontsArray(array) { var fileContent = '', file = [], buffer = array[0].split('.')[0], exp = []; function writeResult() { var str = buffer + ' [' + exp.join(', ') + ']'; fileContent += str + '\n'; grunt.log.ok(str); } array.forEach(function(item, i, arr) { file = item.spl...
javascript
function formatingFontsArray(array) { var fileContent = '', file = [], buffer = array[0].split('.')[0], exp = []; function writeResult() { var str = buffer + ' [' + exp.join(', ') + ']'; fileContent += str + '\n'; grunt.log.ok(str); } array.forEach(function(item, i, arr) { file = item.spl...
[ "function", "formatingFontsArray", "(", "array", ")", "{", "var", "fileContent", "=", "''", ",", "file", "=", "[", "]", ",", "buffer", "=", "array", "[", "0", "]", ".", "split", "(", "'.'", ")", "[", "0", "]", ",", "exp", "=", "[", "]", ";", "f...
Formating array with font into better readding @param {Array} array
[ "Formating", "array", "with", "font", "into", "better", "readding" ]
624d93efd6bdd6b52bfe24b28db715d065600661
https://github.com/konstantin24121/grunt-font-loader/blob/624d93efd6bdd6b52bfe24b28db715d065600661/tasks/font_loader.js#L249-L277
52,272
bholloway/browserify-anonymous-labeler
lib/source-replacer.js
sourceReplacer
function sourceReplacer(source, replacements) { // shared var getBefore = getField('before'); var getAfter = getField('after'); // split source code into lines, include the delimiter var lines = source.split(/(\r?\n)/g); // split each line further by the replacements for (var i = 0; i < lines.length; ...
javascript
function sourceReplacer(source, replacements) { // shared var getBefore = getField('before'); var getAfter = getField('after'); // split source code into lines, include the delimiter var lines = source.split(/(\r?\n)/g); // split each line further by the replacements for (var i = 0; i < lines.length; ...
[ "function", "sourceReplacer", "(", "source", ",", "replacements", ")", "{", "// shared", "var", "getBefore", "=", "getField", "(", "'before'", ")", ";", "var", "getAfter", "=", "getField", "(", "'after'", ")", ";", "// split source code into lines, include the delim...
Make replacements to the given source code and return a set of methods to utilise it. @param {string} source Source code text without source-map comment @param {object} replacements A hash of replacements to make @returns {{toStringBefore:function, toStringAfter:function, getColumnAfter:function}} A set of methods
[ "Make", "replacements", "to", "the", "given", "source", "code", "and", "return", "a", "set", "of", "methods", "to", "utilise", "it", "." ]
651b124eefe8d1a567b2a03a0b8a3dfea87c2703
https://github.com/bholloway/browserify-anonymous-labeler/blob/651b124eefe8d1a567b2a03a0b8a3dfea87c2703/lib/source-replacer.js#L12-L80
52,273
bholloway/browserify-anonymous-labeler
lib/source-replacer.js
getColumnAfter
function getColumnAfter(lineIndex, columnIndex) { if (lineIndex in lines) { var line = lines[lineIndex]; var count = 0; var offset = 0; for (var i = 0; i < line.length; i++) { var widthBefore = getBefore(line[i]).length; var widthAfter = getAfter(line[i]).length; ...
javascript
function getColumnAfter(lineIndex, columnIndex) { if (lineIndex in lines) { var line = lines[lineIndex]; var count = 0; var offset = 0; for (var i = 0; i < line.length; i++) { var widthBefore = getBefore(line[i]).length; var widthAfter = getAfter(line[i]).length; ...
[ "function", "getColumnAfter", "(", "lineIndex", ",", "columnIndex", ")", "{", "if", "(", "lineIndex", "in", "lines", ")", "{", "var", "line", "=", "lines", "[", "lineIndex", "]", ";", "var", "count", "=", "0", ";", "var", "offset", "=", "0", ";", "fo...
Get a column position delta as at the given line and column that has occured as a result of replacement. @param {number} lineIndex The line in the original source at which to evaluate the offset @param {number} columnIndex The column in the original source at which to evaluate the offset @returns {number} A column offs...
[ "Get", "a", "column", "position", "delta", "as", "at", "the", "given", "line", "and", "column", "that", "has", "occured", "as", "a", "result", "of", "replacement", "." ]
651b124eefe8d1a567b2a03a0b8a3dfea87c2703
https://github.com/bholloway/browserify-anonymous-labeler/blob/651b124eefe8d1a567b2a03a0b8a3dfea87c2703/lib/source-replacer.js#L59-L79
52,274
vamship/wysknd-test
lib/utils.js
function(args) { if (!args) { return []; } if (args[0] instanceof Array) { return args[0]; } return Array.prototype.slice.call(args, 0); }
javascript
function(args) { if (!args) { return []; } if (args[0] instanceof Array) { return args[0]; } return Array.prototype.slice.call(args, 0); }
[ "function", "(", "args", ")", "{", "if", "(", "!", "args", ")", "{", "return", "[", "]", ";", "}", "if", "(", "args", "[", "0", "]", "instanceof", "Array", ")", "{", "return", "args", "[", "0", "]", ";", "}", "return", "Array", ".", "prototype"...
Converts input arguments into an addy of args. If the first arg is an array, it is used as is. If not, all input args are converted into a single array. @param {Object} args The arguments object to be converted into an array. @return {Array} An array representing the parsed arguments.
[ "Converts", "input", "arguments", "into", "an", "addy", "of", "args", ".", "If", "the", "first", "arg", "is", "an", "array", "it", "is", "used", "as", "is", ".", "If", "not", "all", "input", "args", "are", "converted", "into", "a", "single", "array", ...
b7791c42f1c1b36be7738e2c6d24748360634003
https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/utils.js#L13-L22
52,275
dalekjs/dalek-reporter-json
index.js
Reporter
function Reporter (opts) { this.events = opts.events; this.config = opts.config; this.data = {}; this.actionQueue = []; this.data.tests = []; this.browser = null; var defaultReportFolder = 'report'; this.dest = this.config.get('json-reporter') && this.config.get('json-reporter').dest ? this.config.get(...
javascript
function Reporter (opts) { this.events = opts.events; this.config = opts.config; this.data = {}; this.actionQueue = []; this.data.tests = []; this.browser = null; var defaultReportFolder = 'report'; this.dest = this.config.get('json-reporter') && this.config.get('json-reporter').dest ? this.config.get(...
[ "function", "Reporter", "(", "opts", ")", "{", "this", ".", "events", "=", "opts", ".", "events", ";", "this", ".", "config", "=", "opts", ".", "config", ";", "this", ".", "data", "=", "{", "}", ";", "this", ".", "actionQueue", "=", "[", "]", ";"...
The JSON reporter can produce a file with the results of your testrun. The reporter can be installed with the following command: ``` $ npm install dalek-reporter-json --save-dev ``` The file will follow the following format. This is a first draft and will definitly change in future versions. ```javascript { "tests":...
[ "The", "JSON", "reporter", "can", "produce", "a", "file", "with", "the", "results", "of", "your", "testrun", "." ]
05c538813fd8e32d45c0aa480a7059df90f8c2c8
https://github.com/dalekjs/dalek-reporter-json/blob/05c538813fd8e32d45c0aa480a7059df90f8c2c8/index.js#L101-L113
52,276
dalekjs/dalek-reporter-json
index.js
function (data) { this.data.tests.push({ id: data.id, name: data.name, browser: this.browser, status: data.status, passedAssertions: data.passedAssertions, failedAssertions: data.failedAssertions, actions: this.actionQueue }); return this; }
javascript
function (data) { this.data.tests.push({ id: data.id, name: data.name, browser: this.browser, status: data.status, passedAssertions: data.passedAssertions, failedAssertions: data.failedAssertions, actions: this.actionQueue }); return this; }
[ "function", "(", "data", ")", "{", "this", ".", "data", ".", "tests", ".", "push", "(", "{", "id", ":", "data", ".", "id", ",", "name", ":", "data", ".", "name", ",", "browser", ":", "this", ".", "browser", ",", "status", ":", "data", ".", "sta...
Writes data for a finished testcase @method testFinished @param {object} data Event data @chainable
[ "Writes", "data", "for", "a", "finished", "testcase" ]
05c538813fd8e32d45c0aa480a7059df90f8c2c8
https://github.com/dalekjs/dalek-reporter-json/blob/05c538813fd8e32d45c0aa480a7059df90f8c2c8/index.js#L211-L222
52,277
dalekjs/dalek-reporter-json
index.js
function (data) { this.data.elapsedTime = data.elapsedTime; this.data.status = data.status; this.data.assertions = data.assertions; this.data.assertionsFailed = data.assertionsFailed; this.data.assertionsPassed = data.assertionsPassed; var contents = JSON.stringify(this.data, false, 4); if...
javascript
function (data) { this.data.elapsedTime = data.elapsedTime; this.data.status = data.status; this.data.assertions = data.assertions; this.data.assertionsFailed = data.assertionsFailed; this.data.assertionsPassed = data.assertionsPassed; var contents = JSON.stringify(this.data, false, 4); if...
[ "function", "(", "data", ")", "{", "this", ".", "data", ".", "elapsedTime", "=", "data", ".", "elapsedTime", ";", "this", ".", "data", ".", "status", "=", "data", ".", "status", ";", "this", ".", "data", ".", "assertions", "=", "data", ".", "assertio...
Serializes JSON and writes file to the file system @method runnerFinished @param {object} data Event data @chainable
[ "Serializes", "JSON", "and", "writes", "file", "to", "the", "file", "system" ]
05c538813fd8e32d45c0aa480a7059df90f8c2c8
https://github.com/dalekjs/dalek-reporter-json/blob/05c538813fd8e32d45c0aa480a7059df90f8c2c8/index.js#L232-L249
52,278
schwarzkopfb/hand-over
index.js
cloneArray
function cloneArray(a) { var b = [], i = a.length while (i--) b[ i ] = a[ i ] return b }
javascript
function cloneArray(a) { var b = [], i = a.length while (i--) b[ i ] = a[ i ] return b }
[ "function", "cloneArray", "(", "a", ")", "{", "var", "b", "=", "[", "]", ",", "i", "=", "a", ".", "length", "while", "(", "i", "--", ")", "b", "[", "i", "]", "=", "a", "[", "i", "]", "return", "b", "}" ]
Utility that clones an array. @param {Array} a @return {Array}
[ "Utility", "that", "clones", "an", "array", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L162-L166
52,279
schwarzkopfb/hand-over
index.js
installPlugin
function installPlugin(nameOrPlugin, options) { assert(nameOrPlugin, 'name or plugin is required') var plugin, ctor, self = this, parent = module.parent if (typeof nameOrPlugin === 'string') try { // local plugin if (nameOrPlugin.substring(0, 2) ==...
javascript
function installPlugin(nameOrPlugin, options) { assert(nameOrPlugin, 'name or plugin is required') var plugin, ctor, self = this, parent = module.parent if (typeof nameOrPlugin === 'string') try { // local plugin if (nameOrPlugin.substring(0, 2) ==...
[ "function", "installPlugin", "(", "nameOrPlugin", ",", "options", ")", "{", "assert", "(", "nameOrPlugin", ",", "'name or plugin is required'", ")", "var", "plugin", ",", "ctor", ",", "self", "=", "this", ",", "parent", "=", "module", ".", "parent", "if", "(...
Include and initialize a plugin that handles a notification channel. @param {string|function|object} nameOrPlugin - Plugin name, constructor or instance to install. @param {*} [options] - Initialization settings for the plugin. @returns {Handover}
[ "Include", "and", "initialize", "a", "plugin", "that", "handles", "a", "notification", "channel", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L175-L227
52,280
schwarzkopfb/hand-over
index.js
failed
function failed(err, userId, channel, target) { if (err && typeof err === 'object') { err.userId = userId err.channel = channel err.target = target } errors.push(err) done() }
javascript
function failed(err, userId, channel, target) { if (err && typeof err === 'object') { err.userId = userId err.channel = channel err.target = target } errors.push(err) done() }
[ "function", "failed", "(", "err", ",", "userId", ",", "channel", ",", "target", ")", "{", "if", "(", "err", "&&", "typeof", "err", "===", "'object'", ")", "{", "err", ".", "userId", "=", "userId", "err", ".", "channel", "=", "channel", "err", ".", ...
helper for decorating error objects with debug info when possible and storing them to pass back to the caller when we're done
[ "helper", "for", "decorating", "error", "objects", "with", "debug", "info", "when", "possible", "and", "storing", "them", "to", "pass", "back", "to", "the", "caller", "when", "we", "re", "done" ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L250-L259
52,281
schwarzkopfb/hand-over
index.js
done
function done() { var arg = errors.length ? errors : null --pending || process.nextTick(callback, arg) }
javascript
function done() { var arg = errors.length ? errors : null --pending || process.nextTick(callback, arg) }
[ "function", "done", "(", ")", "{", "var", "arg", "=", "errors", ".", "length", "?", "errors", ":", "null", "--", "pending", "||", "process", ".", "nextTick", "(", "callback", ",", "arg", ")", "}" ]
helper for counting finished operations and call back when we're done
[ "helper", "for", "counting", "finished", "operations", "and", "call", "back", "when", "we", "re", "done" ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L262-L265
52,282
schwarzkopfb/hand-over
index.js
registerTarget
function registerTarget(userId, channel, target, callback) { this.save(userId, channel, target, function (err) { // ensure that we're firing the callback asynchronously process.nextTick(callback, err) }) // make it chainable return this }
javascript
function registerTarget(userId, channel, target, callback) { this.save(userId, channel, target, function (err) { // ensure that we're firing the callback asynchronously process.nextTick(callback, err) }) // make it chainable return this }
[ "function", "registerTarget", "(", "userId", ",", "channel", ",", "target", ",", "callback", ")", "{", "this", ".", "save", "(", "userId", ",", "channel", ",", "target", ",", "function", "(", "err", ")", "{", "// ensure that we're firing the callback asynchronou...
Register a new target of a channel. @param {*} userId - User identifier. Type is mostly string or number but depends on the consumer. @param {string} channel - Channel name. @param {*} target - An address to send notifications to. Eg. phone number, email address, push notification token, etc. @param {function} callbac...
[ "Register", "a", "new", "target", "of", "a", "channel", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L334-L342
52,283
schwarzkopfb/hand-over
index.js
unregisterTargets
function unregisterTargets(userId, channel, targets, callback) { var self = this // no target list specified, so we need to load all the targets // of the supplied channel if (arguments.length < 4) { // probably we've got the callback as the third arg callback = targets this.lo...
javascript
function unregisterTargets(userId, channel, targets, callback) { var self = this // no target list specified, so we need to load all the targets // of the supplied channel if (arguments.length < 4) { // probably we've got the callback as the third arg callback = targets this.lo...
[ "function", "unregisterTargets", "(", "userId", ",", "channel", ",", "targets", ",", "callback", ")", "{", "var", "self", "=", "this", "// no target list specified, so we need to load all the targets", "// of the supplied channel", "if", "(", "arguments", ".", "length", ...
Remove a previously saved channel or target. @param {*} userId - User identifier. Type is mostly string or number but depends on the consumer. @param {string} channel - Channel name. @param {*|*[]} [targets] - The target or list of targets to remove. If not supplied, then all the targets of the given channel will be r...
[ "Remove", "a", "previously", "saved", "channel", "or", "target", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L353-L394
52,284
schwarzkopfb/hand-over
index.js
removeTargets
function removeTargets(self, userId, channel, targets, callback) { // dereference the original array, // because that may not be trustworthy targets = cloneArray(targets) var pending = targets.length, errors = [] if (pending) targets.forEach(function (target) { self.re...
javascript
function removeTargets(self, userId, channel, targets, callback) { // dereference the original array, // because that may not be trustworthy targets = cloneArray(targets) var pending = targets.length, errors = [] if (pending) targets.forEach(function (target) { self.re...
[ "function", "removeTargets", "(", "self", ",", "userId", ",", "channel", ",", "targets", ",", "callback", ")", "{", "// dereference the original array,", "// because that may not be trustworthy", "targets", "=", "cloneArray", "(", "targets", ")", "var", "pending", "="...
Internal func to remove the provided targets. Same as `unregisterTargets` but it assumes that `targets` is an array. @param {Handover} self - Handover instance to work on. @param {*} userId @param {string} channel @param {*[]} targets @param {function} callback
[ "Internal", "func", "to", "remove", "the", "provided", "targets", ".", "Same", "as", "unregisterTargets", "but", "it", "assumes", "that", "targets", "is", "an", "array", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L405-L438
52,285
schwarzkopfb/hand-over
index.js
unreference
function unreference() { var plugins = this._plugins Object.keys(plugins).forEach(function (name) { var plugin = plugins[ name ] // `unref()` is preferred if (typeof plugin.unref === 'function') plugin.unref() // if we cannot stop gracefully then destroy open ...
javascript
function unreference() { var plugins = this._plugins Object.keys(plugins).forEach(function (name) { var plugin = plugins[ name ] // `unref()` is preferred if (typeof plugin.unref === 'function') plugin.unref() // if we cannot stop gracefully then destroy open ...
[ "function", "unreference", "(", ")", "{", "var", "plugins", "=", "this", ".", "_plugins", "Object", ".", "keys", "(", "plugins", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "plugin", "=", "plugins", "[", "name", "]", "// `unref(...
Unreference all the included plugins to let the process exit gracefully. @returns {Handover}
[ "Unreference", "all", "the", "included", "plugins", "to", "let", "the", "process", "exit", "gracefully", "." ]
d09b97e3da8f323df93ad00f10bff32ee8cf8acc
https://github.com/schwarzkopfb/hand-over/blob/d09b97e3da8f323df93ad00f10bff32ee8cf8acc/index.js#L445-L465
52,286
xhochy/node-tomahawkjs
lib/cli/commands.js
function (path, callback) { fs.stat(path, function (err, stats) { failOn(err, "Error while reading the resolver path:", err); if (stats.isFile()) { TomahawkJS.loadAxe(path, _.partial(statResolver, callback)); } else if (stats.isDirectory()) { // Load the resolver from...
javascript
function (path, callback) { fs.stat(path, function (err, stats) { failOn(err, "Error while reading the resolver path:", err); if (stats.isFile()) { TomahawkJS.loadAxe(path, _.partial(statResolver, callback)); } else if (stats.isDirectory()) { // Load the resolver from...
[ "function", "(", "path", ",", "callback", ")", "{", "fs", ".", "stat", "(", "path", ",", "function", "(", "err", ",", "stats", ")", "{", "failOn", "(", "err", ",", "\"Error while reading the resolver path:\"", ",", "err", ")", ";", "if", "(", "stats", ...
Load an AXE bundle and terminate on errors.
[ "Load", "an", "AXE", "bundle", "and", "terminate", "on", "errors", "." ]
5f3e71a361dcb7a8517807826668332ed5b30303
https://github.com/xhochy/node-tomahawkjs/blob/5f3e71a361dcb7a8517807826668332ed5b30303/lib/cli/commands.js#L29-L43
52,287
mnichols/node-event-store
storage/redis/redis-stream.js
concat
function concat (target, data) { target = target || [] if(Object.prototype.toString.call(data)!=='[object Array]') { data = [data] } Array.prototype.push.apply(target, data) return target }
javascript
function concat (target, data) { target = target || [] if(Object.prototype.toString.call(data)!=='[object Array]') { data = [data] } Array.prototype.push.apply(target, data) return target }
[ "function", "concat", "(", "target", ",", "data", ")", "{", "target", "=", "target", "||", "[", "]", "if", "(", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "data", ")", "!==", "'[object Array]'", ")", "{", "data", "=", "[", "data",...
presumably faster than Array.concat
[ "presumably", "faster", "than", "Array", ".", "concat" ]
1b03fc39604b100acf4404484a35e3042efddc4a
https://github.com/mnichols/node-event-store/blob/1b03fc39604b100acf4404484a35e3042efddc4a/storage/redis/redis-stream.js#L118-L125
52,288
vkiding/judpack-common
src/util/xml-helpers.js
function(doc, nodes, selector, after) { var parent = module.exports.resolveParent(doc, selector); if (!parent) { //Try to create the parent recursively if necessary try { var parentToCreate = et.XML('<' + path.basename(selector) + '>'), parentS...
javascript
function(doc, nodes, selector, after) { var parent = module.exports.resolveParent(doc, selector); if (!parent) { //Try to create the parent recursively if necessary try { var parentToCreate = et.XML('<' + path.basename(selector) + '>'), parentS...
[ "function", "(", "doc", ",", "nodes", ",", "selector", ",", "after", ")", "{", "var", "parent", "=", "module", ".", "exports", ".", "resolveParent", "(", "doc", ",", "selector", ")", ";", "if", "(", "!", "parent", ")", "{", "//Try to create the parent re...
adds node to doc at selector, creating parent if it doesn't exist
[ "adds", "node", "to", "doc", "at", "selector", "creating", "parent", "if", "it", "doesn", "t", "exist" ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/util/xml-helpers.js#L59-L87
52,289
vkiding/judpack-common
src/util/xml-helpers.js
function(doc, nodes, selector) { var parent = module.exports.resolveParent(doc, selector); if (!parent) return false; nodes.forEach(function (node) { var matchingKid = null; if ((matchingKid = findChild(node, parent)) !== null) { // stupid elementtree tak...
javascript
function(doc, nodes, selector) { var parent = module.exports.resolveParent(doc, selector); if (!parent) return false; nodes.forEach(function (node) { var matchingKid = null; if ((matchingKid = findChild(node, parent)) !== null) { // stupid elementtree tak...
[ "function", "(", "doc", ",", "nodes", ",", "selector", ")", "{", "var", "parent", "=", "module", ".", "exports", ".", "resolveParent", "(", "doc", ",", "selector", ")", ";", "if", "(", "!", "parent", ")", "return", "false", ";", "nodes", ".", "forEac...
removes node from doc at selector
[ "removes", "node", "from", "doc", "at", "selector" ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/util/xml-helpers.js#L135-L149
52,290
vkiding/judpack-common
src/util/xml-helpers.js
function(doc, selector, xml) { var target = module.exports.resolveParent(doc, selector); if (!target) return false; if (xml.oldAttrib) { target.attrib = _.extend({}, xml.oldAttrib); } return true; }
javascript
function(doc, selector, xml) { var target = module.exports.resolveParent(doc, selector); if (!target) return false; if (xml.oldAttrib) { target.attrib = _.extend({}, xml.oldAttrib); } return true; }
[ "function", "(", "doc", ",", "selector", ",", "xml", ")", "{", "var", "target", "=", "module", ".", "exports", ".", "resolveParent", "(", "doc", ",", "selector", ")", ";", "if", "(", "!", "target", ")", "return", "false", ";", "if", "(", "xml", "."...
restores attributes from doc at selector
[ "restores", "attributes", "from", "doc", "at", "selector" ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/util/xml-helpers.js#L152-L161
52,291
vkiding/judpack-common
src/util/xml-helpers.js
findInsertIdx
function findInsertIdx(children, after) { var childrenTags = children.map(function(child) { return child.tag; }); var afters = after.split(';'); var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); }); var foundIndex = _.find(afterIndexes, function(index) { return ...
javascript
function findInsertIdx(children, after) { var childrenTags = children.map(function(child) { return child.tag; }); var afters = after.split(';'); var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); }); var foundIndex = _.find(afterIndexes, function(index) { return ...
[ "function", "findInsertIdx", "(", "children", ",", "after", ")", "{", "var", "childrenTags", "=", "children", ".", "map", "(", "function", "(", "child", ")", "{", "return", "child", ".", "tag", ";", "}", ")", ";", "var", "afters", "=", "after", ".", ...
Find the index at which to insert an entry. After is a ;-separated priority list of tags after which the insertion should be made. E.g. If we need to insert an element C, and the rule is that the order of children has to be As, Bs, Cs. After will be equal to "C;B;A".
[ "Find", "the", "index", "at", "which", "to", "insert", "an", "entry", ".", "After", "is", "a", ";", "-", "separated", "priority", "list", "of", "tags", "after", "which", "the", "insertion", "should", "be", "made", ".", "E", ".", "g", ".", "If", "we",...
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/util/xml-helpers.js#L247-L255
52,292
gethuman/pancakes-angular
lib/middleware/jng.utils.js
attachToScope
function attachToScope(model, itemsToAttach) { var me = this; _.each(itemsToAttach, function (item) { if (me.pancakes.exists(item, null)) { model[item] = me.pancakes.cook(item, null); } }); }
javascript
function attachToScope(model, itemsToAttach) { var me = this; _.each(itemsToAttach, function (item) { if (me.pancakes.exists(item, null)) { model[item] = me.pancakes.cook(item, null); } }); }
[ "function", "attachToScope", "(", "model", ",", "itemsToAttach", ")", "{", "var", "me", "=", "this", ";", "_", ".", "each", "(", "itemsToAttach", ",", "function", "(", "item", ")", "{", "if", "(", "me", ".", "pancakes", ".", "exists", "(", "item", ",...
Given an array of items, load them and add them to the model @param model @param itemsToAttach
[ "Given", "an", "array", "of", "items", "load", "them", "and", "add", "them", "to", "the", "model" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L222-L230
52,293
gethuman/pancakes-angular
lib/middleware/jng.utils.js
getAppFileNames
function getAppFileNames(appName, dir) { var partialsDir = this.pancakes.getRootDir() + delim + 'app' + delim + appName + delim + dir; return fs.existsSync(partialsDir) ? fs.readdirSync(partialsDir) : []; }
javascript
function getAppFileNames(appName, dir) { var partialsDir = this.pancakes.getRootDir() + delim + 'app' + delim + appName + delim + dir; return fs.existsSync(partialsDir) ? fs.readdirSync(partialsDir) : []; }
[ "function", "getAppFileNames", "(", "appName", ",", "dir", ")", "{", "var", "partialsDir", "=", "this", ".", "pancakes", ".", "getRootDir", "(", ")", "+", "delim", "+", "'app'", "+", "delim", "+", "appName", "+", "delim", "+", "dir", ";", "return", "fs...
Get all file names in a given app's directory @param appName @param dir @returns {*}
[ "Get", "all", "file", "names", "in", "a", "given", "app", "s", "directory" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L238-L241
52,294
gethuman/pancakes-angular
lib/middleware/jng.utils.js
dotToCamelCase
function dotToCamelCase(name) { if (!name) { return name; } if (name.substring(name.length - 3) === '.js') { name = name.substring(0, name.length - 3); } name = name.toLowerCase(); var parts = name.split('.'); name = parts[0]; for (var i = 1; i < parts.length; i++) { name ...
javascript
function dotToCamelCase(name) { if (!name) { return name; } if (name.substring(name.length - 3) === '.js') { name = name.substring(0, name.length - 3); } name = name.toLowerCase(); var parts = name.split('.'); name = parts[0]; for (var i = 1; i < parts.length; i++) { name ...
[ "function", "dotToCamelCase", "(", "name", ")", "{", "if", "(", "!", "name", ")", "{", "return", "name", ";", "}", "if", "(", "name", ".", "substring", "(", "name", ".", "length", "-", "3", ")", "===", "'.js'", ")", "{", "name", "=", "name", ".",...
Convert a name with dot delim to camel case and remove any .js @param name
[ "Convert", "a", "name", "with", "dot", "delim", "to", "camel", "case", "and", "remove", "any", ".", "js" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L260-L276
52,295
gethuman/pancakes-angular
lib/middleware/jng.utils.js
registerJytPlugins
function registerJytPlugins() { var rootDir = this.pancakes.getRootDir(); var pluginDir = path.normalize(rootDir + '/app/common/jyt.plugins'); var me = this; // if plugin dir doesn't exist, just return if (!fs.existsSync(pluginDir)) { return; } // else get all plugin files from the jyt.plugin...
javascript
function registerJytPlugins() { var rootDir = this.pancakes.getRootDir(); var pluginDir = path.normalize(rootDir + '/app/common/jyt.plugins'); var me = this; // if plugin dir doesn't exist, just return if (!fs.existsSync(pluginDir)) { return; } // else get all plugin files from the jyt.plugin...
[ "function", "registerJytPlugins", "(", ")", "{", "var", "rootDir", "=", "this", ".", "pancakes", ".", "getRootDir", "(", ")", ";", "var", "pluginDir", "=", "path", ".", "normalize", "(", "rootDir", "+", "'/app/common/jyt.plugins'", ")", ";", "var", "me", "...
Register plugins from the jyt.plugins dir
[ "Register", "plugins", "from", "the", "jyt", ".", "plugins", "dir" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L281-L299
52,296
gethuman/pancakes-angular
lib/middleware/jng.utils.js
isMobileApp
function isMobileApp() { var isMobile = false; var appConfigs = this.pancakes.cook('appConfigs', null); _.each(appConfigs, function (appConfig) { if (appConfig.isMobile) { isMobile = true; } }); return isMobile; }
javascript
function isMobileApp() { var isMobile = false; var appConfigs = this.pancakes.cook('appConfigs', null); _.each(appConfigs, function (appConfig) { if (appConfig.isMobile) { isMobile = true; } }); return isMobile; }
[ "function", "isMobileApp", "(", ")", "{", "var", "isMobile", "=", "false", ";", "var", "appConfigs", "=", "this", ".", "pancakes", ".", "cook", "(", "'appConfigs'", ",", "null", ")", ";", "_", ".", "each", "(", "appConfigs", ",", "function", "(", "appC...
Find out if there is a mobile app in the current project @returns {boolean}
[ "Find", "out", "if", "there", "is", "a", "mobile", "app", "in", "the", "current", "project" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L305-L316
52,297
gethuman/pancakes-angular
lib/middleware/jng.utils.js
doesFileExist
function doesFileExist(filePath) { if (!fileExistsCache.hasOwnProperty(filePath)) { fileExistsCache[filePath] = fs.existsSync(filePath); } return fileExistsCache[filePath]; }
javascript
function doesFileExist(filePath) { if (!fileExistsCache.hasOwnProperty(filePath)) { fileExistsCache[filePath] = fs.existsSync(filePath); } return fileExistsCache[filePath]; }
[ "function", "doesFileExist", "(", "filePath", ")", "{", "if", "(", "!", "fileExistsCache", ".", "hasOwnProperty", "(", "filePath", ")", ")", "{", "fileExistsCache", "[", "filePath", "]", "=", "fs", ".", "existsSync", "(", "filePath", ")", ";", "}", "return...
Check to see if a particular file exists; cache results @param filePath @returns {*}
[ "Check", "to", "see", "if", "a", "particular", "file", "exists", ";", "cache", "results" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.utils.js#L342-L348
52,298
beeblebrox3/super-helpers
src/object/isCyclic.js
isCyclic
function isCyclic(obj) { let seenObjects = []; const detect = obj => { if (obj && typeof obj === "object") { if (seenObjects.includes(obj)) { return true; } seenObjects.push(obj); for (const key in obj) { if (obj.hasOwnPro...
javascript
function isCyclic(obj) { let seenObjects = []; const detect = obj => { if (obj && typeof obj === "object") { if (seenObjects.includes(obj)) { return true; } seenObjects.push(obj); for (const key in obj) { if (obj.hasOwnPro...
[ "function", "isCyclic", "(", "obj", ")", "{", "let", "seenObjects", "=", "[", "]", ";", "const", "detect", "=", "obj", "=>", "{", "if", "(", "obj", "&&", "typeof", "obj", "===", "\"object\"", ")", "{", "if", "(", "seenObjects", ".", "includes", "(", ...
Check if any given object has some kind of cyclic reference. @param {Object} obj the source to be checked @return {boolean} @memberof object
[ "Check", "if", "any", "given", "object", "has", "some", "kind", "of", "cyclic", "reference", "." ]
15deaf3509bfe47817e6dd3ecd3e6879743b7dd9
https://github.com/beeblebrox3/super-helpers/blob/15deaf3509bfe47817e6dd3ecd3e6879743b7dd9/src/object/isCyclic.js#L8-L29
52,299
copress/copress-component-oauth2
lib/oauth2.js
function (req, res, next) { if (options.forceAuthorize) { return next(); } var userId = req.oauth2.user.id; var clientId = req.oauth2.client.id; var scope = req.oauth2.req.scope; models.Permissions.isAuthorized(clientId, userId, sco...
javascript
function (req, res, next) { if (options.forceAuthorize) { return next(); } var userId = req.oauth2.user.id; var clientId = req.oauth2.client.id; var scope = req.oauth2.req.scope; models.Permissions.isAuthorized(clientId, userId, sco...
[ "function", "(", "req", ",", "res", ",", "next", ")", "{", "if", "(", "options", ".", "forceAuthorize", ")", "{", "return", "next", "(", ")", ";", "}", "var", "userId", "=", "req", ".", "oauth2", ".", "user", ".", "id", ";", "var", "clientId", "=...
Check if the user has granted permissions to the client app
[ "Check", "if", "the", "user", "has", "granted", "permissions", "to", "the", "client", "app" ]
4819f379a0d42753bfd51e237c5c3aaddee37544
https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/oauth2.js#L601-L626