repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
owstack/ows-common
lib/buffer.js
reverse
function reverse(param) { var ret = new buffer.Buffer(param.length); for (var i = 0; i < param.length; i++) { ret[i] = param[param.length - i - 1]; } return ret; }
javascript
function reverse(param) { var ret = new buffer.Buffer(param.length); for (var i = 0; i < param.length; i++) { ret[i] = param[param.length - i - 1]; } return ret; }
[ "function", "reverse", "(", "param", ")", "{", "var", "ret", "=", "new", "buffer", ".", "Buffer", "(", "param", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "param", ".", "length", ";", "i", "++", ")", "{", "ret", ...
Reverse a buffer @param {Buffer} param @return {Buffer}
[ "Reverse", "a", "buffer" ]
aa2a7970547cf451c06e528472ee965d3b4cac36
https://github.com/owstack/ows-common/blob/aa2a7970547cf451c06e528472ee965d3b4cac36/lib/buffer.js#L154-L160
train
solidusjs/gulp-filerev-replace
index.js
transformAllFiles
function transformAllFiles(transform, flush) { var files = []; return through.obj( function(file, enc, cb) { if (file.isStream()) { this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streams are not supported!')); return cb(); } if (file.isBuffer()) { if (transfor...
javascript
function transformAllFiles(transform, flush) { var files = []; return through.obj( function(file, enc, cb) { if (file.isStream()) { this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streams are not supported!')); return cb(); } if (file.isBuffer()) { if (transfor...
[ "function", "transformAllFiles", "(", "transform", ",", "flush", ")", "{", "var", "files", "=", "[", "]", ";", "return", "through", ".", "obj", "(", "function", "(", "file", ",", "enc", ",", "cb", ")", "{", "if", "(", "file", ".", "isStream", "(", ...
Transform all files in the stream but wait until all files are handled before emitting events
[ "Transform", "all", "files", "in", "the", "stream", "but", "wait", "until", "all", "files", "are", "handled", "before", "emitting", "events" ]
9e64bd70b7993776943312fd03ef7a32546d50a7
https://github.com/solidusjs/gulp-filerev-replace/blob/9e64bd70b7993776943312fd03ef7a32546d50a7/index.js#L151-L176
train
ThatDevCompany/that-build-library
src/utils/exec.js
exec
function exec(cmd, args = [], silent = false) { return __awaiter(this, void 0, void 0, function* () { const response = []; return new Promise((resolve, reject) => { const exe = child_process_1.spawn(cmd, args, { env: process.env }); exe.stdout.on('...
javascript
function exec(cmd, args = [], silent = false) { return __awaiter(this, void 0, void 0, function* () { const response = []; return new Promise((resolve, reject) => { const exe = child_process_1.spawn(cmd, args, { env: process.env }); exe.stdout.on('...
[ "function", "exec", "(", "cmd", ",", "args", "=", "[", "]", ",", "silent", "=", "false", ")", "{", "return", "__awaiter", "(", "this", ",", "void", "0", ",", "void", "0", ",", "function", "*", "(", ")", "{", "const", "response", "=", "[", "]", ...
Execute a CMD line process
[ "Execute", "a", "CMD", "line", "process" ]
865aaac49531fa9793a055a4df8e9b1b41e71753
https://github.com/ThatDevCompany/that-build-library/blob/865aaac49531fa9793a055a4df8e9b1b41e71753/src/utils/exec.js#L15-L46
train
apigrate/mysqlutils
index.js
DbEntity
function DbEntity(table, entity, opts, pool, logger){ LOGGER = logger; this.pool = pool; this.table = table; this.entity = entity; if(_.isNil(opts)||_.isNil(opts.plural)){ if(_.endsWith(entity,'y')){ this.plural = entity.substr(0, entity.lastIndexOf('y')) + 'ies'; } else if (_.endsWith(entity,'...
javascript
function DbEntity(table, entity, opts, pool, logger){ LOGGER = logger; this.pool = pool; this.table = table; this.entity = entity; if(_.isNil(opts)||_.isNil(opts.plural)){ if(_.endsWith(entity,'y')){ this.plural = entity.substr(0, entity.lastIndexOf('y')) + 'ies'; } else if (_.endsWith(entity,'...
[ "function", "DbEntity", "(", "table", ",", "entity", ",", "opts", ",", "pool", ",", "logger", ")", "{", "LOGGER", "=", "logger", ";", "this", ".", "pool", "=", "pool", ";", "this", ".", "table", "=", "table", ";", "this", ".", "entity", "=", "entit...
Class to provide basic SQL persistence operations. @version 2.2.0 @param {string} table required db table name @param {string} entity required logical entity name (singular form) @param {object} opts optional options settings to override defaults, shown below @example <caption>Default options</caption> { plural: 'strin...
[ "Class", "to", "provide", "basic", "SQL", "persistence", "operations", "." ]
1245cd4610585795f07d22290424c57b35fad7ca
https://github.com/apigrate/mysqlutils/blob/1245cd4610585795f07d22290424c57b35fad7ca/index.js#L47-L80
train
apigrate/mysqlutils
index.js
_transformToSafeValue
function _transformToSafeValue(input, column){ var out = input; var datatype = column.sql_type; var nullable = column.nullable; if( input === '' ){ //empty string. if(datatype==='datetime'|| datatype==='timestamp' ||_.startsWith(datatype, 'int') || _.startsWith(datatype, 'num') || _.startsWith(datatype,...
javascript
function _transformToSafeValue(input, column){ var out = input; var datatype = column.sql_type; var nullable = column.nullable; if( input === '' ){ //empty string. if(datatype==='datetime'|| datatype==='timestamp' ||_.startsWith(datatype, 'int') || _.startsWith(datatype, 'num') || _.startsWith(datatype,...
[ "function", "_transformToSafeValue", "(", "input", ",", "column", ")", "{", "var", "out", "=", "input", ";", "var", "datatype", "=", "column", ".", "sql_type", ";", "var", "nullable", "=", "column", ".", "nullable", ";", "if", "(", "input", "===", "''", ...
Helper that transforms input values to acceptable defaults for database columns.
[ "Helper", "that", "transforms", "input", "values", "to", "acceptable", "defaults", "for", "database", "columns", "." ]
1245cd4610585795f07d22290424c57b35fad7ca
https://github.com/apigrate/mysqlutils/blob/1245cd4610585795f07d22290424c57b35fad7ca/index.js#L961-L982
train
satchmorun/promeso
promeso.js
fulfill
function fulfill(promise, value) { if (promise.state !== PENDING) return; promise.value = value; promise.state = FULFILLED; return resolve(promise); }
javascript
function fulfill(promise, value) { if (promise.state !== PENDING) return; promise.value = value; promise.state = FULFILLED; return resolve(promise); }
[ "function", "fulfill", "(", "promise", ",", "value", ")", "{", "if", "(", "promise", ".", "state", "!==", "PENDING", ")", "return", ";", "promise", ".", "value", "=", "value", ";", "promise", ".", "state", "=", "FULFILLED", ";", "return", "resolve", "(...
Fulfill a promise with the given `value`. Returns the promise.
[ "Fulfill", "a", "promise", "with", "the", "given", "value", ".", "Returns", "the", "promise", "." ]
c79156c8e103bed9f709a19e55be94824589433a
https://github.com/satchmorun/promeso/blob/c79156c8e103bed9f709a19e55be94824589433a/promeso.js#L47-L54
train
satchmorun/promeso
promeso.js
reject
function reject(promise, reason) { if (promise.state !== PENDING) return; promise.reason = reason; promise.state = REJECTED; return resolve(promise); }
javascript
function reject(promise, reason) { if (promise.state !== PENDING) return; promise.reason = reason; promise.state = REJECTED; return resolve(promise); }
[ "function", "reject", "(", "promise", ",", "reason", ")", "{", "if", "(", "promise", ".", "state", "!==", "PENDING", ")", "return", ";", "promise", ".", "reason", "=", "reason", ";", "promise", ".", "state", "=", "REJECTED", ";", "return", "resolve", "...
Reject a promise for the given `reason`. Returns the promise.
[ "Reject", "a", "promise", "for", "the", "given", "reason", ".", "Returns", "the", "promise", "." ]
c79156c8e103bed9f709a19e55be94824589433a
https://github.com/satchmorun/promeso/blob/c79156c8e103bed9f709a19e55be94824589433a/promeso.js#L57-L64
train
alexindigo/executioner
lib/execute.js
execute
function execute(collector, cmd, options, callback) { collector._process = exec(cmd, options, function(err, stdout, stderr) { var cmdPrefix = '' , child = collector._process ; // normalize stdout = (stdout || '').trim(); stderr = (stderr || '').trim(); // clean up finished proc...
javascript
function execute(collector, cmd, options, callback) { collector._process = exec(cmd, options, function(err, stdout, stderr) { var cmdPrefix = '' , child = collector._process ; // normalize stdout = (stdout || '').trim(); stderr = (stderr || '').trim(); // clean up finished proc...
[ "function", "execute", "(", "collector", ",", "cmd", ",", "options", ",", "callback", ")", "{", "collector", ".", "_process", "=", "exec", "(", "cmd", ",", "options", ",", "function", "(", "err", ",", "stdout", ",", "stderr", ")", "{", "var", "cmdPrefi...
Executes provided command and store process reference in the state object @param {array} collector - outputs storage @param {string} cmd - command itself @param {object} options - list of options for the command @param {function} callback - invoked when done @returns {void}
[ "Executes", "provided", "command", "and", "store", "process", "reference", "in", "the", "state", "object" ]
582f92897f47c13f4531e0b692aebb4a9f134eec
https://github.com/alexindigo/executioner/blob/582f92897f47c13f4531e0b692aebb4a9f134eec/lib/execute.js#L15-L64
train
Ivshti/node-subtitles-grouping
lib/heatmap.js
getHeatmap
function getHeatmap(tracks) { var heatmap = []; _.each(tracks, function(track) { var idxStart = Math.floor(track.startTime / HEATMAP_SEGMENT), idxEnd = Math.ceil(track.endTime / HEATMAP_SEGMENT); idxEnd = Math.min(MAX_HEATMAP_LEN, idxEnd); /* Protection - sometimes we have buggy tracks which end...
javascript
function getHeatmap(tracks) { var heatmap = []; _.each(tracks, function(track) { var idxStart = Math.floor(track.startTime / HEATMAP_SEGMENT), idxEnd = Math.ceil(track.endTime / HEATMAP_SEGMENT); idxEnd = Math.min(MAX_HEATMAP_LEN, idxEnd); /* Protection - sometimes we have buggy tracks which end...
[ "function", "getHeatmap", "(", "tracks", ")", "{", "var", "heatmap", "=", "[", "]", ";", "_", ".", "each", "(", "tracks", ",", "function", "(", "track", ")", "{", "var", "idxStart", "=", "Math", ".", "floor", "(", "track", ".", "startTime", "/", "H...
assume max is 5 hours
[ "assume", "max", "is", "5", "hours" ]
26284201817d1d200c1da28e4cf22f60a72ff0f0
https://github.com/Ivshti/node-subtitles-grouping/blob/26284201817d1d200c1da28e4cf22f60a72ff0f0/lib/heatmap.js#L7-L25
train
therror/therror
lib/therror.js
WithName
function WithName(name, Base) { let BaseClass = Base || Therror; return class extends BaseClass { constructor(err, msg, prop) { super(err, msg, prop); this.name = name; } }; }
javascript
function WithName(name, Base) { let BaseClass = Base || Therror; return class extends BaseClass { constructor(err, msg, prop) { super(err, msg, prop); this.name = name; } }; }
[ "function", "WithName", "(", "name", ",", "Base", ")", "{", "let", "BaseClass", "=", "Base", "||", "Therror", ";", "return", "class", "extends", "BaseClass", "{", "constructor", "(", "err", ",", "msg", ",", "prop", ")", "{", "super", "(", "err", ",", ...
Hack to deal with Node8 BreakingChange about Error class name
[ "Hack", "to", "deal", "with", "Node8", "BreakingChange", "about", "Error", "class", "name" ]
de2460b68d82fed13b2b4a2daf01c6f451db17d5
https://github.com/therror/therror/blob/de2460b68d82fed13b2b4a2daf01c6f451db17d5/lib/therror.js#L480-L488
train
fmcarvalho/express-sitemap-html
lib/expressSitemapHtml.js
sitemap
function sitemap(app) { let html return (req, res) => { if(!html) html = view(parseRoutes(app)) res.set({ 'Content-Type': 'text/html', 'Content-Length': html.length }) res.send(html) } }
javascript
function sitemap(app) { let html return (req, res) => { if(!html) html = view(parseRoutes(app)) res.set({ 'Content-Type': 'text/html', 'Content-Length': html.length }) res.send(html) } }
[ "function", "sitemap", "(", "app", ")", "{", "let", "html", "return", "(", "req", ",", "res", ")", "=>", "{", "if", "(", "!", "html", ")", "html", "=", "view", "(", "parseRoutes", "(", "app", ")", ")", "res", ".", "set", "(", "{", "'Content-Type'...
Builds an express middleware that renders an HTML sitemap based on the routes of app parameter. @param {Express} app An express instance
[ "Builds", "an", "express", "middleware", "that", "renders", "an", "HTML", "sitemap", "based", "on", "the", "routes", "of", "app", "parameter", "." ]
6d60721e825882d47369f93020703f2f2e0e0693
https://github.com/fmcarvalho/express-sitemap-html/blob/6d60721e825882d47369f93020703f2f2e0e0693/lib/expressSitemapHtml.js#L25-L35
train
anseki/pointer-event
pointer-event.esm.js
getTouchById
function getTouchById(touches, id) { if (touches != null && id != null) { for (var i = 0; i < touches.length; i++) { if (touches[i].identifier === id) { return touches[i]; } } } return null; }
javascript
function getTouchById(touches, id) { if (touches != null && id != null) { for (var i = 0; i < touches.length; i++) { if (touches[i].identifier === id) { return touches[i]; } } } return null; }
[ "function", "getTouchById", "(", "touches", ",", "id", ")", "{", "if", "(", "touches", "!=", "null", "&&", "id", "!=", "null", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "touches", ".", "length", ";", "i", "++", ")", "{", "if", ...
Get Touch instance in list. @param {Touch[]} touches - An Array or TouchList instance. @param {number} id - Touch#identifier @returns {(Touch|null)} - A found Touch instance.
[ "Get", "Touch", "instance", "in", "list", "." ]
3caf9ca58c338bb42105a2504dfa9806185a2fee
https://github.com/anseki/pointer-event/blob/3caf9ca58c338bb42105a2504dfa9806185a2fee/pointer-event.esm.js#L52-L61
train
anseki/pointer-event
pointer-event.esm.js
PointerEvent
function PointerEvent(options) { var _this = this; _classCallCheck(this, PointerEvent); this.startHandlers = {}; this.lastHandlerId = 0; this.curPointerClass = null; this.curTouchId = null; this.lastPointerXY = { clientX: 0, clientY: 0 }; this.lastTouchTime = 0; // Options thi...
javascript
function PointerEvent(options) { var _this = this; _classCallCheck(this, PointerEvent); this.startHandlers = {}; this.lastHandlerId = 0; this.curPointerClass = null; this.curTouchId = null; this.lastPointerXY = { clientX: 0, clientY: 0 }; this.lastTouchTime = 0; // Options thi...
[ "function", "PointerEvent", "(", "options", ")", "{", "var", "_this", "=", "this", ";", "_classCallCheck", "(", "this", ",", "PointerEvent", ")", ";", "this", ".", "startHandlers", "=", "{", "}", ";", "this", ".", "lastHandlerId", "=", "0", ";", "this", ...
Create a `PointerEvent` instance. @param {Object} [options] - Options
[ "Create", "a", "PointerEvent", "instance", "." ]
3caf9ca58c338bb42105a2504dfa9806185a2fee
https://github.com/anseki/pointer-event/blob/3caf9ca58c338bb42105a2504dfa9806185a2fee/pointer-event.esm.js#L81-L105
train
kuno/neco
deps/npm/lib/install.js
findSatisfying
function findSatisfying (pkg, name, range, mustHave, reg) { if (mustHave) return null return semver.maxSatisfying ( Object.keys(reg[name] || {}) .concat(Object.keys(Object.getPrototypeOf(reg[name] || {}))) , range ) }
javascript
function findSatisfying (pkg, name, range, mustHave, reg) { if (mustHave) return null return semver.maxSatisfying ( Object.keys(reg[name] || {}) .concat(Object.keys(Object.getPrototypeOf(reg[name] || {}))) , range ) }
[ "function", "findSatisfying", "(", "pkg", ",", "name", ",", "range", ",", "mustHave", ",", "reg", ")", "{", "if", "(", "mustHave", ")", "return", "null", "return", "semver", ".", "maxSatisfying", "(", "Object", ".", "keys", "(", "reg", "[", "name", "]"...
see if there is a satisfying version already
[ "see", "if", "there", "is", "a", "satisfying", "version", "already" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/install.js#L182-L189
train
halfbakedsneed/chowdown
src/retrieve.js
withConfig
function withConfig(fn) { return (source, options={}) => { options.type = 'dom'; options.client = options.client || rp; return fn(source, options); } }
javascript
function withConfig(fn) { return (source, options={}) => { options.type = 'dom'; options.client = options.client || rp; return fn(source, options); } }
[ "function", "withConfig", "(", "fn", ")", "{", "return", "(", "source", ",", "options", "=", "{", "}", ")", "=>", "{", "options", ".", "type", "=", "'dom'", ";", "options", ".", "client", "=", "options", ".", "client", "||", "rp", ";", "return", "f...
Wraps the given function such that its called with a configured options object. @param {function} fn The function to wrap. @return {function} The wrapped function.
[ "Wraps", "the", "given", "function", "such", "that", "its", "called", "with", "a", "configured", "options", "object", "." ]
b0e322c6070f82d557886afec9217b41f5214543
https://github.com/halfbakedsneed/chowdown/blob/b0e322c6070f82d557886afec9217b41f5214543/src/retrieve.js#L53-L60
train
confuser/save-json
json-engine.js
getNextId
function getNextId() { var dataIds = Object.keys(idIndexData) dataIds.sort(function (a, b) { return b - a }) if (dataIds && dataIds[0]) { var id = _.parseInt(dataIds[0]) + 1 return id } else { return 1 } }
javascript
function getNextId() { var dataIds = Object.keys(idIndexData) dataIds.sort(function (a, b) { return b - a }) if (dataIds && dataIds[0]) { var id = _.parseInt(dataIds[0]) + 1 return id } else { return 1 } }
[ "function", "getNextId", "(", ")", "{", "var", "dataIds", "=", "Object", ".", "keys", "(", "idIndexData", ")", "dataIds", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "b", "-", "a", "}", ")", "if", "(", "dataIds", "&&", "...
Handle id increment
[ "Handle", "id", "increment" ]
5e4c22a1a17151d60ffda1c30c68fbe0686e4e37
https://github.com/confuser/save-json/blob/5e4c22a1a17151d60ffda1c30c68fbe0686e4e37/json-engine.js#L34-L47
train
confuser/save-json
json-engine.js
del
function del(id, callback) { callback = callback || emptyFn if (typeof callback !== 'function') { throw new TypeError('callback must be a function or empty') } if (!idIndexData[id]) { return callback(new Error('No object found with \'' + options.idProperty + '\' = \'' + id + '\'...
javascript
function del(id, callback) { callback = callback || emptyFn if (typeof callback !== 'function') { throw new TypeError('callback must be a function or empty') } if (!idIndexData[id]) { return callback(new Error('No object found with \'' + options.idProperty + '\' = \'' + id + '\'...
[ "function", "del", "(", "id", ",", "callback", ")", "{", "callback", "=", "callback", "||", "emptyFn", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "TypeError", "(", "'callback must be a function or empty'", ")", "}", "if", ...
Deletes one object. Returns an error if the object can not be found or if the ID property is not present. @param {Object} object to delete @param {Function} callback @api public
[ "Deletes", "one", "object", ".", "Returns", "an", "error", "if", "the", "object", "can", "not", "be", "found", "or", "if", "the", "ID", "property", "is", "not", "present", "." ]
5e4c22a1a17151d60ffda1c30c68fbe0686e4e37
https://github.com/confuser/save-json/blob/5e4c22a1a17151d60ffda1c30c68fbe0686e4e37/json-engine.js#L165-L189
train
ev3-js/devices
lib/index.js
devices
function devices (port, paths) { paths = paths || {} var actualPath = defaults(paths, defaultPaths) var device = isNaN(port) ? motor() : sensor() if (device.prefix === motor().prefix) { port = port.toUpperCase() } if (device.available[device.prefix + port]) { return path.join(device.path, device.av...
javascript
function devices (port, paths) { paths = paths || {} var actualPath = defaults(paths, defaultPaths) var device = isNaN(port) ? motor() : sensor() if (device.prefix === motor().prefix) { port = port.toUpperCase() } if (device.available[device.prefix + port]) { return path.join(device.path, device.av...
[ "function", "devices", "(", "port", ",", "paths", ")", "{", "paths", "=", "paths", "||", "{", "}", "var", "actualPath", "=", "defaults", "(", "paths", ",", "defaultPaths", ")", "var", "device", "=", "isNaN", "(", "port", ")", "?", "motor", "(", ")", ...
Get a device @param {String} port @return {String} path
[ "Get", "a", "device" ]
d4d16ae74d1add6e1bda08f6251422b67384ff5f
https://github.com/ev3-js/devices/blob/d4d16ae74d1add6e1bda08f6251422b67384ff5f/lib/index.js#L44-L75
train
timoxley/ordered-set
ordered-set.js
SetArr
function SetArr() { let arr = {} let set = { size: 0, clear() { set.size = 0 }, add(item) { let index = arr.indexOf(item) if (index !== -1) return arr arr.push(item) set.size = arr.length return set }, delete(item) { let index = arr.indexOf(item) ...
javascript
function SetArr() { let arr = {} let set = { size: 0, clear() { set.size = 0 }, add(item) { let index = arr.indexOf(item) if (index !== -1) return arr arr.push(item) set.size = arr.length return set }, delete(item) { let index = arr.indexOf(item) ...
[ "function", "SetArr", "(", ")", "{", "let", "arr", "=", "{", "}", "let", "set", "=", "{", "size", ":", "0", ",", "clear", "(", ")", "{", "set", ".", "size", "=", "0", "}", ",", "add", "(", "item", ")", "{", "let", "index", "=", "arr", ".", ...
Set defining iteration ordering.
[ "Set", "defining", "iteration", "ordering", "." ]
8068335dbbaee823dc6aec2f3467fb0f490d7cdc
https://github.com/timoxley/ordered-set/blob/8068335dbbaee823dc6aec2f3467fb0f490d7cdc/ordered-set.js#L11-L35
train
AutocratJS/autocrat
autocrat.js
Autocrat
function Autocrat(options) { this.options = parseOptions(this, options); /** * A namespace to host members related to observing state/Autocrat activity * * @name surveillance * @namespace */ surveillance.serveAutocrat(this); this.surveillance = surveillance; /** * Has a dual nature as both...
javascript
function Autocrat(options) { this.options = parseOptions(this, options); /** * A namespace to host members related to observing state/Autocrat activity * * @name surveillance * @namespace */ surveillance.serveAutocrat(this); this.surveillance = surveillance; /** * Has a dual nature as both...
[ "function", "Autocrat", "(", "options", ")", "{", "this", ".", "options", "=", "parseOptions", "(", "this", ",", "options", ")", ";", "/**\n * A namespace to host members related to observing state/Autocrat activity\n *\n * @name surveillance\n * @namespace\n */", "surv...
Constructs a singleton and namespace. All Autocrat plugins attach their functionality to the returned instance before the below listed aspects of the singleton are initialized. Plugins therefore have an early opportunity to augment the singleton. * [surveillance](https://github.com/AutocratJS/autocrat/wiki/Surveillanc...
[ "Constructs", "a", "singleton", "and", "namespace", ".", "All", "Autocrat", "plugins", "attach", "their", "functionality", "to", "the", "returned", "instance", "before", "the", "below", "listed", "aspects", "of", "the", "singleton", "are", "initialized", ".", "P...
ca1466f851c4dbc5237fbbb2ee7caa1cff964f51
https://github.com/AutocratJS/autocrat/blob/ca1466f851c4dbc5237fbbb2ee7caa1cff964f51/autocrat.js#L52-L89
train
joy-web/perfect-css
_gh_pages/components/navigation/util.js
getTransformPropertyName
function getTransformPropertyName(globalObj, forceRefresh = false) { if (storedTransformPropertyName_ === undefined || forceRefresh) { const el = globalObj.document.createElement('div'); const transformPropertyName = ('transform' in el.style ? 'transform' : 'webkitTransform'); storedTransformPropertyName_...
javascript
function getTransformPropertyName(globalObj, forceRefresh = false) { if (storedTransformPropertyName_ === undefined || forceRefresh) { const el = globalObj.document.createElement('div'); const transformPropertyName = ('transform' in el.style ? 'transform' : 'webkitTransform'); storedTransformPropertyName_...
[ "function", "getTransformPropertyName", "(", "globalObj", ",", "forceRefresh", "=", "false", ")", "{", "if", "(", "storedTransformPropertyName_", "===", "undefined", "||", "forceRefresh", ")", "{", "const", "el", "=", "globalObj", ".", "document", ".", "createElem...
Returns the name of the correct transform property to use on the current browser. @param {!Window} globalObj @param {boolean=} forceRefresh @return {string}
[ "Returns", "the", "name", "of", "the", "correct", "transform", "property", "to", "use", "on", "the", "current", "browser", "." ]
d2e209a270d2abd9830627e5bd0267454562c82c
https://github.com/joy-web/perfect-css/blob/d2e209a270d2abd9830627e5bd0267454562c82c/_gh_pages/components/navigation/util.js#L26-L34
train
kuno/neco
deps/npm/lib/update-dependents.js
updateDepsTo
function updateDepsTo (arg, cb) { asyncMap(arg._others, function (o, cb) { updateOtherVersionDeps(o, arg, cb) }, cb) }
javascript
function updateDepsTo (arg, cb) { asyncMap(arg._others, function (o, cb) { updateOtherVersionDeps(o, arg, cb) }, cb) }
[ "function", "updateDepsTo", "(", "arg", ",", "cb", ")", "{", "asyncMap", "(", "arg", ".", "_others", ",", "function", "(", "o", ",", "cb", ")", "{", "updateOtherVersionDeps", "(", "o", ",", "arg", ",", "cb", ")", "}", ",", "cb", ")", "}" ]
update the _others to this one.
[ "update", "the", "_others", "to", "this", "one", "." ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/update-dependents.js#L81-L85
train
kuno/neco
deps/npm/lib/update-dependents.js
createDependencyLinks
function createDependencyLinks (dep, pkg, cb) { var depdir = path.join(npm.dir, dep.name, dep.version) , depsOn = path.join( depdir , "dependson" , pkg.name+"@"+pkg.version ) , deps = path.join(depdir, "node_modules", pkg.name) , targ...
javascript
function createDependencyLinks (dep, pkg, cb) { var depdir = path.join(npm.dir, dep.name, dep.version) , depsOn = path.join( depdir , "dependson" , pkg.name+"@"+pkg.version ) , deps = path.join(depdir, "node_modules", pkg.name) , targ...
[ "function", "createDependencyLinks", "(", "dep", ",", "pkg", ",", "cb", ")", "{", "var", "depdir", "=", "path", ".", "join", "(", "npm", ".", "dir", ",", "dep", ".", "name", ",", "dep", ".", "version", ")", ",", "depsOn", "=", "path", ".", "join", ...
dep depends on pkg
[ "dep", "depends", "on", "pkg" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/update-dependents.js#L193-L218
train
richardzyx/node-microservice
index.js
defer
function defer(timeout) { var resolve, reject; var promise = new Promise(function() { resolve = arguments[0]; reject = arguments[1]; setTimeout(reject, timeout, "Timeout"); }); return { resolve: resolve, reject: reject, promise: promise, timestamp:...
javascript
function defer(timeout) { var resolve, reject; var promise = new Promise(function() { resolve = arguments[0]; reject = arguments[1]; setTimeout(reject, timeout, "Timeout"); }); return { resolve: resolve, reject: reject, promise: promise, timestamp:...
[ "function", "defer", "(", "timeout", ")", "{", "var", "resolve", ",", "reject", ";", "var", "promise", "=", "new", "Promise", "(", "function", "(", ")", "{", "resolve", "=", "arguments", "[", "0", "]", ";", "reject", "=", "arguments", "[", "1", "]", ...
defer is discourage in most promise library so we define one for this particular situation
[ "defer", "is", "discourage", "in", "most", "promise", "library", "so", "we", "define", "one", "for", "this", "particular", "situation" ]
3390659fec06621ba05bd7e6716ace3223d52aa3
https://github.com/richardzyx/node-microservice/blob/3390659fec06621ba05bd7e6716ace3223d52aa3/index.js#L9-L22
train
creationix/repo-farm
one-shot.js
oneShot
function oneShot(callback) { var done = false; return function (err) { if (!done) { done = true; return callback.apply(this, arguments); } if (err) console.error(err.stack); } }
javascript
function oneShot(callback) { var done = false; return function (err) { if (!done) { done = true; return callback.apply(this, arguments); } if (err) console.error(err.stack); } }
[ "function", "oneShot", "(", "callback", ")", "{", "var", "done", "=", "false", ";", "return", "function", "(", "err", ")", "{", "if", "(", "!", "done", ")", "{", "done", "=", "true", ";", "return", "callback", ".", "apply", "(", "this", ",", "argum...
Makes sure a callback is only called once.
[ "Makes", "sure", "a", "callback", "is", "only", "called", "once", "." ]
31d24a77070c6f8bc1e669149aecfa15f954c264
https://github.com/creationix/repo-farm/blob/31d24a77070c6f8bc1e669149aecfa15f954c264/one-shot.js#L5-L14
train
doowb/gulp-collection
examples/example.js
makeFile
function makeFile(idx) { var file = new Vinyl({ path: `source-file-${idx}.hbs`, contents: new Buffer(`this is source-file-${idx}`) }); file.data = { categories: pickCategories(), tags: pickTags() }; return file; }
javascript
function makeFile(idx) { var file = new Vinyl({ path: `source-file-${idx}.hbs`, contents: new Buffer(`this is source-file-${idx}`) }); file.data = { categories: pickCategories(), tags: pickTags() }; return file; }
[ "function", "makeFile", "(", "idx", ")", "{", "var", "file", "=", "new", "Vinyl", "(", "{", "path", ":", "`", "${", "idx", "}", "`", ",", "contents", ":", "new", "Buffer", "(", "`", "${", "idx", "}", "`", ")", "}", ")", ";", "file", ".", "dat...
make a new file with randomly selected categories and tags
[ "make", "a", "new", "file", "with", "randomly", "selected", "categories", "and", "tags" ]
8469ee2e8e5f112f3fe11aab5a8565d653c65c85
https://github.com/doowb/gulp-collection/blob/8469ee2e8e5f112f3fe11aab5a8565d653c65c85/examples/example.js#L56-L66
train
doowb/gulp-collection
examples/example.js
pickTags
function pickTags() { var picked = []; var max = Math.floor(Math.random() * maxTags); while(picked.length < max) { var tag = pickTag(); if (picked.indexOf(tag) === -1) { picked.push(tag); } } return picked; }
javascript
function pickTags() { var picked = []; var max = Math.floor(Math.random() * maxTags); while(picked.length < max) { var tag = pickTag(); if (picked.indexOf(tag) === -1) { picked.push(tag); } } return picked; }
[ "function", "pickTags", "(", ")", "{", "var", "picked", "=", "[", "]", ";", "var", "max", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "maxTags", ")", ";", "while", "(", "picked", ".", "length", "<", "max", ")", "{", "v...
pick random tags up to the `maxTags`
[ "pick", "random", "tags", "up", "to", "the", "maxTags" ]
8469ee2e8e5f112f3fe11aab5a8565d653c65c85
https://github.com/doowb/gulp-collection/blob/8469ee2e8e5f112f3fe11aab5a8565d653c65c85/examples/example.js#L74-L84
train
doowb/gulp-collection
examples/example.js
pickCategories
function pickCategories() { var picked = []; var max = Math.floor(Math.random() * maxCategories); while(picked.length < max) { var category = pickCategory(); if (picked.indexOf(category) === -1) { picked.push(category); } } return picked; }
javascript
function pickCategories() { var picked = []; var max = Math.floor(Math.random() * maxCategories); while(picked.length < max) { var category = pickCategory(); if (picked.indexOf(category) === -1) { picked.push(category); } } return picked; }
[ "function", "pickCategories", "(", ")", "{", "var", "picked", "=", "[", "]", ";", "var", "max", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "maxCategories", ")", ";", "while", "(", "picked", ".", "length", "<", "max", ")",...
pick random categories up to the `maxCategories`
[ "pick", "random", "categories", "up", "to", "the", "maxCategories" ]
8469ee2e8e5f112f3fe11aab5a8565d653c65c85
https://github.com/doowb/gulp-collection/blob/8469ee2e8e5f112f3fe11aab5a8565d653c65c85/examples/example.js#L92-L102
train
meetings/gearsloth
lib/daemon/injector.js
Injector
function Injector(conf) { component.Component.call(this, 'injector', conf); var that = this; this._default_controller = defaults.controllerfuncname(conf); this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { worker: { func_name: 'submitJobDelayed', func: function(payload, worker) {...
javascript
function Injector(conf) { component.Component.call(this, 'injector', conf); var that = this; this._default_controller = defaults.controllerfuncname(conf); this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { worker: { func_name: 'submitJobDelayed', func: function(payload, worker) {...
[ "function", "Injector", "(", "conf", ")", "{", "component", ".", "Component", ".", "call", "(", "this", ",", "'injector'", ",", "conf", ")", ";", "var", "that", "=", "this", ";", "this", ".", "_default_controller", "=", "defaults", ".", "controllerfuncname...
Injector component. Emits 'connect' when at least one server is connected.
[ "Injector", "component", ".", "Emits", "connect", "when", "at", "least", "one", "server", "is", "connected", "." ]
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/daemon/injector.js#L9-L52
train
jackspaniel/yukon
plugins/parallel-api/api.js
getData
function getData(callArgs, req, res, next) { debug("getData called"); if (callArgs.useStub) readStub(callArgs, req, res, next); else callApi(callArgs, req, res, next); }
javascript
function getData(callArgs, req, res, next) { debug("getData called"); if (callArgs.useStub) readStub(callArgs, req, res, next); else callApi(callArgs, req, res, next); }
[ "function", "getData", "(", "callArgs", ",", "req", ",", "res", ",", "next", ")", "{", "debug", "(", "\"getData called\"", ")", ";", "if", "(", "callArgs", ".", "useStub", ")", "readStub", "(", "callArgs", ",", "req", ",", "res", ",", "next", ")", ";...
route call to get stub or use live API
[ "route", "call", "to", "get", "stub", "or", "use", "live", "API" ]
7e5259126751dc5b604c6156d470f0a9ca9e3966
https://github.com/jackspaniel/yukon/blob/7e5259126751dc5b604c6156d470f0a9ca9e3966/plugins/parallel-api/api.js#L17-L24
train
alexindigo/node-global-define
index.js
GlobalDefine
function GlobalDefine(options) { var globalDefine; if (!(this instanceof GlobalDefine)) { globalDefine = new GlobalDefine(options); return globalDefine.amdefineWorkaround(globalDefine.getCallerModule()); } this.basePath = options.basePath || process.cwd(); this.paths = options.paths || ...
javascript
function GlobalDefine(options) { var globalDefine; if (!(this instanceof GlobalDefine)) { globalDefine = new GlobalDefine(options); return globalDefine.amdefineWorkaround(globalDefine.getCallerModule()); } this.basePath = options.basePath || process.cwd(); this.paths = options.paths || ...
[ "function", "GlobalDefine", "(", "options", ")", "{", "var", "globalDefine", ";", "if", "(", "!", "(", "this", "instanceof", "GlobalDefine", ")", ")", "{", "globalDefine", "=", "new", "GlobalDefine", "(", "options", ")", ";", "return", "globalDefine", ".", ...
export API function to update basePath
[ "export", "API", "function", "to", "update", "basePath" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L48-L86
train
alexindigo/node-global-define
index.js
propagateUpstream
function propagateUpstream(parentModule, shouldPropagate) { // do not step on another global-define instance if (parentModule._globalDefine) return; // keep reference to the define instance parentModule._globalDefine = this; if (shouldPropagate && parentModule.parent) { this.propagateUpstream(parentMo...
javascript
function propagateUpstream(parentModule, shouldPropagate) { // do not step on another global-define instance if (parentModule._globalDefine) return; // keep reference to the define instance parentModule._globalDefine = this; if (shouldPropagate && parentModule.parent) { this.propagateUpstream(parentMo...
[ "function", "propagateUpstream", "(", "parentModule", ",", "shouldPropagate", ")", "{", "// do not step on another global-define instance", "if", "(", "parentModule", ".", "_globalDefine", ")", "return", ";", "// keep reference to the define instance", "parentModule", ".", "_...
propagates global-define instance upstream until it bumps into another globalDefine instance
[ "propagates", "global", "-", "define", "instance", "upstream", "until", "it", "bumps", "into", "another", "globalDefine", "instance" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L96-L108
train
alexindigo/node-global-define
index.js
checkPath
function checkPath(id) { var i; for (i = 0; i < this.pathsKeys.length; i++) { if (id.indexOf(this.pathsKeys[i]) == 0) { if (this.paths[this.pathsKeys[i]] == 'empty:') { id = 'empty:'; } else { id = id.replace(this.pathsKeys[i], this.paths[this.pathsKeys[i]]);...
javascript
function checkPath(id) { var i; for (i = 0; i < this.pathsKeys.length; i++) { if (id.indexOf(this.pathsKeys[i]) == 0) { if (this.paths[this.pathsKeys[i]] == 'empty:') { id = 'empty:'; } else { id = id.replace(this.pathsKeys[i], this.paths[this.pathsKeys[i]]);...
[ "function", "checkPath", "(", "id", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "pathsKeys", ".", "length", ";", "i", "++", ")", "{", "if", "(", "id", ".", "indexOf", "(", "this", ".", "pathsKeys", "[", "...
check path aliases
[ "check", "path", "aliases" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L202-L223
train
alexindigo/node-global-define
index.js
isBlacklisted
function isBlacklisted(moduleId) { var i; // strip basePath moduleId = moduleId.replace(this.basePathRegexp, ''); for (i = 0; i < this.blackList.length; i++) { if (minimatch(moduleId, this.blackList[i])) { return true; } } return false; }
javascript
function isBlacklisted(moduleId) { var i; // strip basePath moduleId = moduleId.replace(this.basePathRegexp, ''); for (i = 0; i < this.blackList.length; i++) { if (minimatch(moduleId, this.blackList[i])) { return true; } } return false; }
[ "function", "isBlacklisted", "(", "moduleId", ")", "{", "var", "i", ";", "// strip basePath", "moduleId", "=", "moduleId", ".", "replace", "(", "this", ".", "basePathRegexp", ",", "''", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", ...
checks blackList, using glob-like patterns
[ "checks", "blackList", "using", "glob", "-", "like", "patterns" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L226-L242
train
alexindigo/node-global-define
index.js
isWhitelisted
function isWhitelisted(moduleId) { var i; // check if its empty if (!this.whiteList.length) { return true; } // strip basePath moduleId = moduleId.replace(this.basePathRegexp, ''); for (i = 0; i < this.whiteList.length; i++) { if (minimatch(moduleId, this.whiteList[i])) { return t...
javascript
function isWhitelisted(moduleId) { var i; // check if its empty if (!this.whiteList.length) { return true; } // strip basePath moduleId = moduleId.replace(this.basePathRegexp, ''); for (i = 0; i < this.whiteList.length; i++) { if (minimatch(moduleId, this.whiteList[i])) { return t...
[ "function", "isWhitelisted", "(", "moduleId", ")", "{", "var", "i", ";", "// check if its empty", "if", "(", "!", "this", ".", "whiteList", ".", "length", ")", "{", "return", "true", ";", "}", "// strip basePath", "moduleId", "=", "moduleId", ".", "replace",...
checks whiteList, using glob-like patterns if white list is empty treat it as everything in white list
[ "checks", "whiteList", "using", "glob", "-", "like", "patterns", "if", "white", "list", "is", "empty", "treat", "it", "as", "everything", "in", "white", "list" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L246-L268
train
alexindigo/node-global-define
index.js
customModuleCompile
function customModuleCompile(content, filename) { var moduleExceptions, parentDefine = global.define; if (!this._globalDefine) { setGlobalDefine(this); } moduleExceptions = originalModuleCompile.call(this, content, filename); global.define = parentDefine; return moduleExceptions; }
javascript
function customModuleCompile(content, filename) { var moduleExceptions, parentDefine = global.define; if (!this._globalDefine) { setGlobalDefine(this); } moduleExceptions = originalModuleCompile.call(this, content, filename); global.define = parentDefine; return moduleExceptions; }
[ "function", "customModuleCompile", "(", "content", ",", "filename", ")", "{", "var", "moduleExceptions", ",", "parentDefine", "=", "global", ".", "define", ";", "if", "(", "!", "this", ".", "_globalDefine", ")", "{", "setGlobalDefine", "(", "this", ")", ";",...
replaces original `module._compile` for invasive mode but if this._globalDefine is present means our work here is done and reset global define back to the previous value
[ "replaces", "original", "module", ".", "_compile", "for", "invasive", "mode", "but", "if", "this", ".", "_globalDefine", "is", "present", "means", "our", "work", "here", "is", "done", "and", "reset", "global", "define", "back", "to", "the", "previous", "valu...
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L275-L289
train
alexindigo/node-global-define
index.js
setGlobalDefine
function setGlobalDefine(requiredModule) { // pass globalDefine instance from parent to child module if (requiredModule.parent && requiredModule.parent._globalDefine) { // inherited instance requiredModule._globalDefine = requiredModule.parent._globalDefine; } // create global define specific to the ...
javascript
function setGlobalDefine(requiredModule) { // pass globalDefine instance from parent to child module if (requiredModule.parent && requiredModule.parent._globalDefine) { // inherited instance requiredModule._globalDefine = requiredModule.parent._globalDefine; } // create global define specific to the ...
[ "function", "setGlobalDefine", "(", "requiredModule", ")", "{", "// pass globalDefine instance from parent to child module", "if", "(", "requiredModule", ".", "parent", "&&", "requiredModule", ".", "parent", ".", "_globalDefine", ")", "{", "// inherited instance", "required...
sets _globalDefine and global.define if needed
[ "sets", "_globalDefine", "and", "global", ".", "define", "if", "needed" ]
2dba825053918d61d272aa31225d3a13a4088f75
https://github.com/alexindigo/node-global-define/blob/2dba825053918d61d272aa31225d3a13a4088f75/index.js#L309-L339
train
zertosh/pollen
BundlesModule.js
filesToPacks
function filesToPacks(files) { return files.map(function(id) { return { id: id, source: readFile(id), mtime: readMTime(id) }; }); }
javascript
function filesToPacks(files) { return files.map(function(id) { return { id: id, source: readFile(id), mtime: readMTime(id) }; }); }
[ "function", "filesToPacks", "(", "files", ")", "{", "return", "files", ".", "map", "(", "function", "(", "id", ")", "{", "return", "{", "id", ":", "id", ",", "source", ":", "readFile", "(", "id", ")", ",", "mtime", ":", "readMTime", "(", "id", ")",...
Build the "packs" from an array of filenames
[ "Build", "the", "packs", "from", "an", "array", "of", "filenames" ]
c97b6168a56fc4a52f77242526dcd6a6cba3d6e5
https://github.com/zertosh/pollen/blob/c97b6168a56fc4a52f77242526dcd6a6cba3d6e5/BundlesModule.js#L130-L138
train
zertosh/pollen
BundlesModule.js
updatePacks
function updatePacks(packs) { var didUpdate = false; var updated = packs.map(function(pack) { var mtime_ = readMTime(pack.id); if (pack.mtime !== mtime_) { didUpdate = true; return { id: pack.id, source: readFile(pack.id), mtime: mtime_ }; } else { return ...
javascript
function updatePacks(packs) { var didUpdate = false; var updated = packs.map(function(pack) { var mtime_ = readMTime(pack.id); if (pack.mtime !== mtime_) { didUpdate = true; return { id: pack.id, source: readFile(pack.id), mtime: mtime_ }; } else { return ...
[ "function", "updatePacks", "(", "packs", ")", "{", "var", "didUpdate", "=", "false", ";", "var", "updated", "=", "packs", ".", "map", "(", "function", "(", "pack", ")", "{", "var", "mtime_", "=", "readMTime", "(", "pack", ".", "id", ")", ";", "if", ...
Updated the "packs" if the mtime has changed
[ "Updated", "the", "packs", "if", "the", "mtime", "has", "changed" ]
c97b6168a56fc4a52f77242526dcd6a6cba3d6e5
https://github.com/zertosh/pollen/blob/c97b6168a56fc4a52f77242526dcd6a6cba3d6e5/BundlesModule.js#L143-L159
train
zertosh/pollen
BundlesModule.js
stitch
function stitch(name, packs) { var content = ';(function(require){\n'; packs.forEach(function(pack) { content += removeSourceMaps(pack.source); if (content[content.length-1] !== '\n') content += '\n'; }); content += '\nreturn require;}());\n'; return content; }
javascript
function stitch(name, packs) { var content = ';(function(require){\n'; packs.forEach(function(pack) { content += removeSourceMaps(pack.source); if (content[content.length-1] !== '\n') content += '\n'; }); content += '\nreturn require;}());\n'; return content; }
[ "function", "stitch", "(", "name", ",", "packs", ")", "{", "var", "content", "=", "';(function(require){\\n'", ";", "packs", ".", "forEach", "(", "function", "(", "pack", ")", "{", "content", "+=", "removeSourceMaps", "(", "pack", ".", "source", ")", ";", ...
Turn the source from the "packs" into a single module to be run, while preserving the source maps. This assumes that the Browserify bundles included all expose whatever they need to via a `require` function. The bundle sources are wrapped in a function with it's own `require` variable so the Browserify one doesn't lea...
[ "Turn", "the", "source", "from", "the", "packs", "into", "a", "single", "module", "to", "be", "run", "while", "preserving", "the", "source", "maps", "." ]
c97b6168a56fc4a52f77242526dcd6a6cba3d6e5
https://github.com/zertosh/pollen/blob/c97b6168a56fc4a52f77242526dcd6a6cba3d6e5/BundlesModule.js#L176-L184
train
westtrade/waterlock-vkontakte-auth
lib/vkoauth2.js
VKOAuth2
function VKOAuth2(appId, appSecret, redirectURL, fullSettings) { this._appId = appId; this._appSecret = appSecret; this._redirectURL = redirectURL; fullSettings = fullSettings || {}; this._vkOpts = fullSettings.settings || {}; this._apiVersion = this._vkOpts.version || '5.41'; this._dialo...
javascript
function VKOAuth2(appId, appSecret, redirectURL, fullSettings) { this._appId = appId; this._appSecret = appSecret; this._redirectURL = redirectURL; fullSettings = fullSettings || {}; this._vkOpts = fullSettings.settings || {}; this._apiVersion = this._vkOpts.version || '5.41'; this._dialo...
[ "function", "VKOAuth2", "(", "appId", ",", "appSecret", ",", "redirectURL", ",", "fullSettings", ")", "{", "this", ".", "_appId", "=", "appId", ";", "this", ".", "_appSecret", "=", "appSecret", ";", "this", ".", "_redirectURL", "=", "redirectURL", ";", "fu...
vkontakte OAuth2 object, make various requests the graphAPI @param {string} appId the vkontakte app id @param {string} appSecret the vkontakte app secret @param {string} redirectURL the url vkontakte should use as a callback
[ "vkontakte", "OAuth2", "object", "make", "various", "requests", "the", "graphAPI" ]
7723740bf9d6df369918d9a9a17953b10e17fd01
https://github.com/westtrade/waterlock-vkontakte-auth/blob/7723740bf9d6df369918d9a9a17953b10e17fd01/lib/vkoauth2.js#L17-L37
train
amida-tech/blue-button-pim
lib/scorer.js
score
function score(data, candidate) { var result = 0; /* Scoring calculations here */ //Last Name if (!data.name.last || !candidate.name.last) { result = result + 0; } else if (data.name.last.toUpperCase() === candidate.name.last.toUpperCase()) { result = result + 9.58; ...
javascript
function score(data, candidate) { var result = 0; /* Scoring calculations here */ //Last Name if (!data.name.last || !candidate.name.last) { result = result + 0; } else if (data.name.last.toUpperCase() === candidate.name.last.toUpperCase()) { result = result + 9.58; ...
[ "function", "score", "(", "data", ",", "candidate", ")", "{", "var", "result", "=", "0", ";", "/*\n Scoring calculations here\n */", "//Last Name", "if", "(", "!", "data", ".", "name", ".", "last", "||", "!", "candidate", ".", "name", ".", "last", ...
scores match between candidate vs patient data
[ "scores", "match", "between", "candidate", "vs", "patient", "data" ]
329dcc5fa5f3d877c2b675e8e0d689a8ef25a895
https://github.com/amida-tech/blue-button-pim/blob/329dcc5fa5f3d877c2b675e8e0d689a8ef25a895/lib/scorer.js#L4-L50
train
davidtucker/node-shutdown-manager
examples/example.js
function() { var deferred = q.defer(); setTimeout(function() { console.log("Async Action 1 Completed"); deferred.resolve(); }, 1000); return deferred.promise; }
javascript
function() { var deferred = q.defer(); setTimeout(function() { console.log("Async Action 1 Completed"); deferred.resolve(); }, 1000); return deferred.promise; }
[ "function", "(", ")", "{", "var", "deferred", "=", "q", ".", "defer", "(", ")", ";", "setTimeout", "(", "function", "(", ")", "{", "console", ".", "log", "(", "\"Async Action 1 Completed\"", ")", ";", "deferred", ".", "resolve", "(", ")", ";", "}", "...
Adding Async Named Function
[ "Adding", "Async", "Named", "Function" ]
5106ba004f7351c4281d9f736de176126077e75a
https://github.com/davidtucker/node-shutdown-manager/blob/5106ba004f7351c4281d9f736de176126077e75a/examples/example.js#L22-L29
train
Fullstop000/redux-sirius
src/index.js
createRootReducer
function createRootReducer (model, name) { const handlers = {} const initialState = model.state // auto-generated reducers if (isNotNullObject(initialState)) { for (const key of Object.keys(initialState)) { handlers[addSetPrefix(name)(key)] = (state, action) => includeKey(action, 'payload') ? { ...sta...
javascript
function createRootReducer (model, name) { const handlers = {} const initialState = model.state // auto-generated reducers if (isNotNullObject(initialState)) { for (const key of Object.keys(initialState)) { handlers[addSetPrefix(name)(key)] = (state, action) => includeKey(action, 'payload') ? { ...sta...
[ "function", "createRootReducer", "(", "model", ",", "name", ")", "{", "const", "handlers", "=", "{", "}", "const", "initialState", "=", "model", ".", "state", "// auto-generated reducers", "if", "(", "isNotNullObject", "(", "initialState", ")", ")", "{", "for"...
Create a root reducer based on model state and model reducers If you have a model like the below { namespace: 'form', state: { loading: false, password: '' } } then sirius will generate a reducer for each state field following a preset rule: for state loading : form/setLoading for state password : form/setPassword ...
[ "Create", "a", "root", "reducer", "based", "on", "model", "state", "and", "model", "reducers" ]
1337e7d3414879d5d5364db89d0e08f18f9ef984
https://github.com/Fullstop000/redux-sirius/blob/1337e7d3414879d5d5364db89d0e08f18f9ef984/src/index.js#L241-L281
train
Fullstop000/redux-sirius
src/index.js
getNamespace
function getNamespace (path, relative) { // ignore parent path let final = '' if (relative) { const s = path.split('/') final = s[s.length - 1] } else { final = path.startsWith('./') ? path.slice(2) : path } // remove '.js' return final.slice(0, final.length - 3) }
javascript
function getNamespace (path, relative) { // ignore parent path let final = '' if (relative) { const s = path.split('/') final = s[s.length - 1] } else { final = path.startsWith('./') ? path.slice(2) : path } // remove '.js' return final.slice(0, final.length - 3) }
[ "function", "getNamespace", "(", "path", ",", "relative", ")", "{", "// ignore parent path", "let", "final", "=", "''", "if", "(", "relative", ")", "{", "const", "s", "=", "path", ".", "split", "(", "'/'", ")", "final", "=", "s", "[", "s", ".", "leng...
Get namespace from file path @param {String} path model file path such as 'test/sub/model.js' @param {Boolean} relative use relative namespace or not
[ "Get", "namespace", "from", "file", "path" ]
1337e7d3414879d5d5364db89d0e08f18f9ef984
https://github.com/Fullstop000/redux-sirius/blob/1337e7d3414879d5d5364db89d0e08f18f9ef984/src/index.js#L293-L304
train
Fullstop000/redux-sirius
src/index.js
readModels
function readModels (dir, relative) { const fs = require('fs') const path = require('path') // eslint-disable-next-line no-eval const evalRequire = eval('require') const list = [] function readRecursively (dir, root, list) { fs.readdirSync(dir).forEach(file => { const filePath = path.join(dir, fil...
javascript
function readModels (dir, relative) { const fs = require('fs') const path = require('path') // eslint-disable-next-line no-eval const evalRequire = eval('require') const list = [] function readRecursively (dir, root, list) { fs.readdirSync(dir).forEach(file => { const filePath = path.join(dir, fil...
[ "function", "readModels", "(", "dir", ",", "relative", ")", "{", "const", "fs", "=", "require", "(", "'fs'", ")", "const", "path", "=", "require", "(", "'path'", ")", "// eslint-disable-next-line no-eval", "const", "evalRequire", "=", "eval", "(", "'require'",...
Read all models recursively in a path. This just works in Node project @param {String} dir @param {String} root @param {Array} list
[ "Read", "all", "models", "recursively", "in", "a", "path", ".", "This", "just", "works", "in", "Node", "project" ]
1337e7d3414879d5d5364db89d0e08f18f9ef984
https://github.com/Fullstop000/redux-sirius/blob/1337e7d3414879d5d5364db89d0e08f18f9ef984/src/index.js#L313-L346
train
francois2metz/node-intervals
intervals.js
transformHtmlEntities
function transformHtmlEntities() { return function(method, request, next) { next(function(response, next) { response.body = utils.deHtmlEntities(response.body); next(); }) }; }
javascript
function transformHtmlEntities() { return function(method, request, next) { next(function(response, next) { response.body = utils.deHtmlEntities(response.body); next(); }) }; }
[ "function", "transformHtmlEntities", "(", ")", "{", "return", "function", "(", "method", ",", "request", ",", "next", ")", "{", "next", "(", "function", "(", "response", ",", "next", ")", "{", "response", ".", "body", "=", "utils", ".", "deHtmlEntities", ...
Replace all html entities from api response to real utf8 characters
[ "Replace", "all", "html", "entities", "from", "api", "response", "to", "real", "utf8", "characters" ]
0633747156f02938ce4d8063e1fed8a33beab365
https://github.com/francois2metz/node-intervals/blob/0633747156f02938ce4d8063e1fed8a33beab365/intervals.js#L56-L63
train
olaurendeau/grunt-contrib-mongo-migrate
tasks/mongo-migrate.js
run
function run(cmd){ var proc = require('child_process'), done = grunt.task.current.async(); // Tells Grunt that an async task is complete proc.exec(cmd, function(error, stdout, stderr){ if(stderr){ grunt.log.writeln('ERROR: ' + stderr).error()...
javascript
function run(cmd){ var proc = require('child_process'), done = grunt.task.current.async(); // Tells Grunt that an async task is complete proc.exec(cmd, function(error, stdout, stderr){ if(stderr){ grunt.log.writeln('ERROR: ' + stderr).error()...
[ "function", "run", "(", "cmd", ")", "{", "var", "proc", "=", "require", "(", "'child_process'", ")", ",", "done", "=", "grunt", ".", "task", ".", "current", ".", "async", "(", ")", ";", "// Tells Grunt that an async task is complete", "proc", ".", "exec", ...
Helper method to interface with the migrate bin file. @param cmd Command that is going to be executed.
[ "Helper", "method", "to", "interface", "with", "the", "migrate", "bin", "file", "." ]
2b9f20d60df877c6e850887f6f69a5e9769b0854
https://github.com/olaurendeau/grunt-contrib-mongo-migrate/blob/2b9f20d60df877c6e850887f6f69a5e9769b0854/tasks/mongo-migrate.js#L22-L36
train
olaurendeau/grunt-contrib-mongo-migrate
tasks/mongo-migrate.js
up
function up(){ console.log(grunt.target); var key = (grunt.option('name') || ""), label = ( key || "EMPTY"), cmd = (migrateBinPath + " up " + key).trim(); grunt.log.write('Running migration "UP" [' + label + ']...').ok(); run(cmd); }
javascript
function up(){ console.log(grunt.target); var key = (grunt.option('name') || ""), label = ( key || "EMPTY"), cmd = (migrateBinPath + " up " + key).trim(); grunt.log.write('Running migration "UP" [' + label + ']...').ok(); run(cmd); }
[ "function", "up", "(", ")", "{", "console", ".", "log", "(", "grunt", ".", "target", ")", ";", "var", "key", "=", "(", "grunt", ".", "option", "(", "'name'", ")", "||", "\"\"", ")", ",", "label", "=", "(", "key", "||", "\"EMPTY\"", ")", ",", "c...
Migrate UP to either the latest migration file or to a migration name passed in as an argument.
[ "Migrate", "UP", "to", "either", "the", "latest", "migration", "file", "or", "to", "a", "migration", "name", "passed", "in", "as", "an", "argument", "." ]
2b9f20d60df877c6e850887f6f69a5e9769b0854
https://github.com/olaurendeau/grunt-contrib-mongo-migrate/blob/2b9f20d60df877c6e850887f6f69a5e9769b0854/tasks/mongo-migrate.js#L41-L49
train
olaurendeau/grunt-contrib-mongo-migrate
tasks/mongo-migrate.js
down
function down(){ var key = (grunt.option('name') || ""), label = ( key || "EMPTY"), cmd = (migrateBinPath + " down " + key).trim(); grunt.log.write('Running migration "DOWN" [' + label + ']...').ok(); run(cmd); }
javascript
function down(){ var key = (grunt.option('name') || ""), label = ( key || "EMPTY"), cmd = (migrateBinPath + " down " + key).trim(); grunt.log.write('Running migration "DOWN" [' + label + ']...').ok(); run(cmd); }
[ "function", "down", "(", ")", "{", "var", "key", "=", "(", "grunt", ".", "option", "(", "'name'", ")", "||", "\"\"", ")", ",", "label", "=", "(", "key", "||", "\"EMPTY\"", ")", ",", "cmd", "=", "(", "migrateBinPath", "+", "\" down \"", "+", "key", ...
Migrate DOWN to either the latest migration file or to a migration name passed in as an argument.
[ "Migrate", "DOWN", "to", "either", "the", "latest", "migration", "file", "or", "to", "a", "migration", "name", "passed", "in", "as", "an", "argument", "." ]
2b9f20d60df877c6e850887f6f69a5e9769b0854
https://github.com/olaurendeau/grunt-contrib-mongo-migrate/blob/2b9f20d60df877c6e850887f6f69a5e9769b0854/tasks/mongo-migrate.js#L54-L61
train
olaurendeau/grunt-contrib-mongo-migrate
tasks/mongo-migrate.js
create
function create(){ var cmd = (migrateBinPath + " create " + grunt.option('name')).trim(); grunt.log.write('Creating a new migration named "' + grunt.option('name') + '"...').ok(); run(cmd); }
javascript
function create(){ var cmd = (migrateBinPath + " create " + grunt.option('name')).trim(); grunt.log.write('Creating a new migration named "' + grunt.option('name') + '"...').ok(); run(cmd); }
[ "function", "create", "(", ")", "{", "var", "cmd", "=", "(", "migrateBinPath", "+", "\" create \"", "+", "grunt", ".", "option", "(", "'name'", ")", ")", ".", "trim", "(", ")", ";", "grunt", ".", "log", ".", "write", "(", "'Creating a new migration named...
Migrate CREATE will create a new migration file.
[ "Migrate", "CREATE", "will", "create", "a", "new", "migration", "file", "." ]
2b9f20d60df877c6e850887f6f69a5e9769b0854
https://github.com/olaurendeau/grunt-contrib-mongo-migrate/blob/2b9f20d60df877c6e850887f6f69a5e9769b0854/tasks/mongo-migrate.js#L66-L71
train
lokijs/loki-core
lib/game.js
function(entity) { // Bind to start event right away. var boundStart = entity.start.bind(entity); this.on('start', boundStart); // Bind to preloadComplete, but only once. var boundPreloadComplete = entity.preloadComplete.bind(entity); this.once('preloadComplete', boundPreloadComplete); // Only bind to upd...
javascript
function(entity) { // Bind to start event right away. var boundStart = entity.start.bind(entity); this.on('start', boundStart); // Bind to preloadComplete, but only once. var boundPreloadComplete = entity.preloadComplete.bind(entity); this.once('preloadComplete', boundPreloadComplete); // Only bind to upd...
[ "function", "(", "entity", ")", "{", "// Bind to start event right away.", "var", "boundStart", "=", "entity", ".", "start", ".", "bind", "(", "entity", ")", ";", "this", ".", "on", "(", "'start'", ",", "boundStart", ")", ";", "// Bind to preloadComplete, but on...
Bound to a game instance, will add a single entity.
[ "Bound", "to", "a", "game", "instance", "will", "add", "a", "single", "entity", "." ]
ee17222ca8ce52faefd8d0874feda80364b8dd13
https://github.com/lokijs/loki-core/blob/ee17222ca8ce52faefd8d0874feda80364b8dd13/lib/game.js#L73-L91
train
gethuman/pancakes-angular
lib/ngapp/ajax.js
saveOpts
function saveOpts(apiOpts) { if (apiOpts.url && apiOpts.url.toLowerCase().indexOf('password') >= 0) { var idx = apiOpts.url.indexOf('?'); apiOpts.url = apiOpts.url.substring(0, idx); } storage.set('lastApiCall', (JSON.stringify(apiOpts) || '').substri...
javascript
function saveOpts(apiOpts) { if (apiOpts.url && apiOpts.url.toLowerCase().indexOf('password') >= 0) { var idx = apiOpts.url.indexOf('?'); apiOpts.url = apiOpts.url.substring(0, idx); } storage.set('lastApiCall', (JSON.stringify(apiOpts) || '').substri...
[ "function", "saveOpts", "(", "apiOpts", ")", "{", "if", "(", "apiOpts", ".", "url", "&&", "apiOpts", ".", "url", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "'password'", ")", ">=", "0", ")", "{", "var", "idx", "=", "apiOpts", ".", "url", "....
Save the options to storage for later debugging
[ "Save", "the", "options", "to", "storage", "for", "later", "debugging" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/ajax.js#L68-L75
train
gethuman/pancakes-angular
lib/ngapp/ajax.js
send
function send(url, method, options, resourceName) { var deferred = $q.defer(); var key, val, paramArray = []; url = config.apiBase + url; options = options || {}; // separate out data if it exists var data = options.data; delete optio...
javascript
function send(url, method, options, resourceName) { var deferred = $q.defer(); var key, val, paramArray = []; url = config.apiBase + url; options = options || {}; // separate out data if it exists var data = options.data; delete optio...
[ "function", "send", "(", "url", ",", "method", ",", "options", ",", "resourceName", ")", "{", "var", "deferred", "=", "$q", ".", "defer", "(", ")", ";", "var", "key", ",", "val", ",", "paramArray", "=", "[", "]", ";", "url", "=", "config", ".", "...
Send call to the server and get a response @param url @param method @param options @param resourceName
[ "Send", "call", "to", "the", "server", "and", "get", "a", "response" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/ajax.js#L85-L195
train
nyteshade/ne-types
dist/types.js
extendsFrom
function extendsFrom(TestedClass, RootClass, enforceClasses = false) { if (!TestedClass || !RootClass) { return false; } if (TestedClass === RootClass) { return true; } TestedClass = TestedClass.constructor && typeof TestedClass !== 'function' ? TestedClass.constructor : TestedClass; RootClass = ...
javascript
function extendsFrom(TestedClass, RootClass, enforceClasses = false) { if (!TestedClass || !RootClass) { return false; } if (TestedClass === RootClass) { return true; } TestedClass = TestedClass.constructor && typeof TestedClass !== 'function' ? TestedClass.constructor : TestedClass; RootClass = ...
[ "function", "extendsFrom", "(", "TestedClass", ",", "RootClass", ",", "enforceClasses", "=", "false", ")", "{", "if", "(", "!", "TestedClass", "||", "!", "RootClass", ")", "{", "return", "false", ";", "}", "if", "(", "TestedClass", "===", "RootClass", ")",...
NOTE This function will not work on nodejs versions less than 6 as Reflect is needed natively. The instanceof keyword only works on instances of an object and not on the class objects the instances are created from. ```js class A {} class B extends A {} let a = new A(); let b = new B(); b instanceof A; // true a in...
[ "NOTE", "This", "function", "will", "not", "work", "on", "nodejs", "versions", "less", "than", "6", "as", "Reflect", "is", "needed", "natively", "." ]
46656c6b53e9b773e85dd7c24e6814d4717305ec
https://github.com/nyteshade/ne-types/blob/46656c6b53e9b773e85dd7c24e6814d4717305ec/dist/types.js#L324-L373
train
PanthR/panthrMath
panthrMath/distributions/geom.js
rgeom
function rgeom(prob) { var scale; if (prob <= 0 || prob > 1) { return function() { return NaN; }; } scale = prob / (1 - prob); return function() { return rpois(rexp(scale)())(); }; }
javascript
function rgeom(prob) { var scale; if (prob <= 0 || prob > 1) { return function() { return NaN; }; } scale = prob / (1 - prob); return function() { return rpois(rexp(scale)())(); }; }
[ "function", "rgeom", "(", "prob", ")", "{", "var", "scale", ";", "if", "(", "prob", "<=", "0", "||", "prob", ">", "1", ")", "{", "return", "function", "(", ")", "{", "return", "NaN", ";", "}", ";", "}", "scale", "=", "prob", "/", "(", "1", "-...
Returns a random variate from the geometric distribution. Expects the probability parameter $0 < p \leq 1$. Following R's code (rgeom.c) @fullName rgeom(prob)() @memberof geometric
[ "Returns", "a", "random", "variate", "from", "the", "geometric", "distribution", "." ]
54d249ca9903a9535f963da711bd3a87fb229c0b
https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/distributions/geom.js#L173-L183
train
Nazariglez/perenquen
lib/pixi/src/core/graphics/webgl/GraphicsRenderer.js
GraphicsRenderer
function GraphicsRenderer(renderer) { ObjectRenderer.call(this, renderer); this.graphicsDataPool = []; this.primitiveShader = null; this.complexPrimitiveShader = null; }
javascript
function GraphicsRenderer(renderer) { ObjectRenderer.call(this, renderer); this.graphicsDataPool = []; this.primitiveShader = null; this.complexPrimitiveShader = null; }
[ "function", "GraphicsRenderer", "(", "renderer", ")", "{", "ObjectRenderer", ".", "call", "(", "this", ",", "renderer", ")", ";", "this", ".", "graphicsDataPool", "=", "[", "]", ";", "this", ".", "primitiveShader", "=", "null", ";", "this", ".", "complexPr...
Renders the graphics object. @class @private @memberof PIXI @extends ObjectRenderer @param renderer {WebGLRenderer} The renderer this object renderer works for.
[ "Renders", "the", "graphics", "object", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/graphics/webgl/GraphicsRenderer.js#L17-L25
train
tolokoban/ToloFrameWork
ker/mod/tfw.view.js
ensureCodeBehind
function ensureCodeBehind(code_behind) { if (typeof code_behind === 'undefined') throw "Missing mandatory global variable CODE_BEHIND!"; var i, funcName; for (i = 1; i < arguments.length; i++) { funcName = arguments[i]; if (typeof code_behind[funcName] !== 'function') th...
javascript
function ensureCodeBehind(code_behind) { if (typeof code_behind === 'undefined') throw "Missing mandatory global variable CODE_BEHIND!"; var i, funcName; for (i = 1; i < arguments.length; i++) { funcName = arguments[i]; if (typeof code_behind[funcName] !== 'function') th...
[ "function", "ensureCodeBehind", "(", "code_behind", ")", "{", "if", "(", "typeof", "code_behind", "===", "'undefined'", ")", "throw", "\"Missing mandatory global variable CODE_BEHIND!\"", ";", "var", "i", ",", "funcName", ";", "for", "(", "i", "=", "1", ";", "i"...
Check if all needed function from code behind are defined.
[ "Check", "if", "all", "needed", "function", "from", "code", "behind", "are", "defined", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.js#L191-L201
train
tolokoban/ToloFrameWork
ker/mod/tfw.view.js
defVal
function defVal(target, args, defaultValues) { var key, val; for (key in defaultValues) { val = defaultValues[key]; if (typeof args[key] === 'undefined') { target[key] = val; } else { target[key] = args[key]; } } }
javascript
function defVal(target, args, defaultValues) { var key, val; for (key in defaultValues) { val = defaultValues[key]; if (typeof args[key] === 'undefined') { target[key] = val; } else { target[key] = args[key]; } } }
[ "function", "defVal", "(", "target", ",", "args", ",", "defaultValues", ")", "{", "var", "key", ",", "val", ";", "for", "(", "key", "in", "defaultValues", ")", "{", "val", "=", "defaultValues", "[", "key", "]", ";", "if", "(", "typeof", "args", "[", ...
Assign default values.
[ "Assign", "default", "values", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.view.js#L259-L269
train
FinalDevStudio/fi-auth
lib/index.js
generate
function generate(allows) { return function (req, res, next) { req.route.allows = allows; next(); }; }
javascript
function generate(allows) { return function (req, res, next) { req.route.allows = allows; next(); }; }
[ "function", "generate", "(", "allows", ")", "{", "return", "function", "(", "req", ",", "res", ",", "next", ")", "{", "req", ".", "route", ".", "allows", "=", "allows", ";", "next", "(", ")", ";", "}", ";", "}" ]
Generates the Express middleware to associate the allowed values to the route.
[ "Generates", "the", "Express", "middleware", "to", "associate", "the", "allowed", "values", "to", "the", "route", "." ]
0067e31af94b6f4c5cf0d6a630f37d710034faff
https://github.com/FinalDevStudio/fi-auth/blob/0067e31af94b6f4c5cf0d6a630f37d710034faff/lib/index.js#L81-L86
train
reptilbud/hapi-swagger
lib/index.js
function (plugin, settings) { plugin.ext('onPostHandler', (request, reply) => { let response = request.response; // if the reply is a view add settings data into template system if (response.variety === 'view') { // Added to fix bug that cannot yet be reproduced in test - REVI...
javascript
function (plugin, settings) { plugin.ext('onPostHandler', (request, reply) => { let response = request.response; // if the reply is a view add settings data into template system if (response.variety === 'view') { // Added to fix bug that cannot yet be reproduced in test - REVI...
[ "function", "(", "plugin", ",", "settings", ")", "{", "plugin", ".", "ext", "(", "'onPostHandler'", ",", "(", "request", ",", "reply", ")", "=>", "{", "let", "response", "=", "request", ".", "response", ";", "// if the reply is a view add settings data into temp...
appends settings data in template context @param {Object} plugin @param {Object} settings @return {Object}
[ "appends", "settings", "data", "in", "template", "context" ]
8a4a1059f060a7100270e837d2759c6a2b9c7e74
https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/lib/index.js#L253-L291
train
reptilbud/hapi-swagger
lib/index.js
function (url, qsName, qsValue) { let urlObj = Url.parse(url); if (qsName && qsValue) { urlObj.query = Querystring.parse(qsName + '=' + qsValue); urlObj.search = '?' + encodeURIComponent(qsName) + '=' + encodeURIComponent(qsValue); } else { urlObj.search = ''; } return urlOb...
javascript
function (url, qsName, qsValue) { let urlObj = Url.parse(url); if (qsName && qsValue) { urlObj.query = Querystring.parse(qsName + '=' + qsValue); urlObj.search = '?' + encodeURIComponent(qsName) + '=' + encodeURIComponent(qsValue); } else { urlObj.search = ''; } return urlOb...
[ "function", "(", "url", ",", "qsName", ",", "qsValue", ")", "{", "let", "urlObj", "=", "Url", ".", "parse", "(", "url", ")", ";", "if", "(", "qsName", "&&", "qsValue", ")", "{", "urlObj", ".", "query", "=", "Querystring", ".", "parse", "(", "qsName...
appends a querystring to a url path - will overwrite existings values @param {String} url @param {String} qsName @param {String} qsValue @return {String}
[ "appends", "a", "querystring", "to", "a", "url", "path", "-", "will", "overwrite", "existings", "values" ]
8a4a1059f060a7100270e837d2759c6a2b9c7e74
https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/lib/index.js#L302-L312
train
reptilbud/hapi-swagger
lib/index.js
function (settings) { let out = ''; if (settings.securityDefinitions) { Object.keys(settings.securityDefinitions).forEach((key) => { if (settings.securityDefinitions[key]['x-keyPrefix']) { out = settings.securityDefinitions[key]['x-keyPrefix']; } }); ...
javascript
function (settings) { let out = ''; if (settings.securityDefinitions) { Object.keys(settings.securityDefinitions).forEach((key) => { if (settings.securityDefinitions[key]['x-keyPrefix']) { out = settings.securityDefinitions[key]['x-keyPrefix']; } }); ...
[ "function", "(", "settings", ")", "{", "let", "out", "=", "''", ";", "if", "(", "settings", ".", "securityDefinitions", ")", "{", "Object", ".", "keys", "(", "settings", ".", "securityDefinitions", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", ...
finds any keyPrefix in securityDefinitions - also add x- to name @param {Object} settings @return {String}
[ "finds", "any", "keyPrefix", "in", "securityDefinitions", "-", "also", "add", "x", "-", "to", "name" ]
8a4a1059f060a7100270e837d2759c6a2b9c7e74
https://github.com/reptilbud/hapi-swagger/blob/8a4a1059f060a7100270e837d2759c6a2b9c7e74/lib/index.js#L321-L333
train
sendanor/nor-nopg
src/ResourceView.js
render_path
function render_path(path, params) { params = params || {}; return ARRAY( is.array(path) ? path : [path] ).map(function(p) { return p.replace(/:([a-z0-9A-Z\_]+)/g, function(match, key) { if(params[key] === undefined) { return ':'+key; } return ''+fix_object_ids(params[key]); }); }).valueOf(); }
javascript
function render_path(path, params) { params = params || {}; return ARRAY( is.array(path) ? path : [path] ).map(function(p) { return p.replace(/:([a-z0-9A-Z\_]+)/g, function(match, key) { if(params[key] === undefined) { return ':'+key; } return ''+fix_object_ids(params[key]); }); }).valueOf(); }
[ "function", "render_path", "(", "path", ",", "params", ")", "{", "params", "=", "params", "||", "{", "}", ";", "return", "ARRAY", "(", "is", ".", "array", "(", "path", ")", "?", "path", ":", "[", "path", "]", ")", ".", "map", "(", "function", "("...
Render `path` with optional `params`
[ "Render", "path", "with", "optional", "params" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/ResourceView.js#L42-L52
train
sendanor/nor-nopg
src/ResourceView.js
ResourceView
function ResourceView(opts) { var view = this; var compute_keys; if(opts && opts.compute_keys) { compute_keys = opts.compute_keys; } var element_keys; if(opts && opts.element_keys) { element_keys = opts.element_keys; } var collection_keys; if(opts && opts.collection_keys) { collection_keys = opts.coll...
javascript
function ResourceView(opts) { var view = this; var compute_keys; if(opts && opts.compute_keys) { compute_keys = opts.compute_keys; } var element_keys; if(opts && opts.element_keys) { element_keys = opts.element_keys; } var collection_keys; if(opts && opts.collection_keys) { collection_keys = opts.coll...
[ "function", "ResourceView", "(", "opts", ")", "{", "var", "view", "=", "this", ";", "var", "compute_keys", ";", "if", "(", "opts", "&&", "opts", ".", "compute_keys", ")", "{", "compute_keys", "=", "opts", ".", "compute_keys", ";", "}", "var", "element_ke...
Builds a builder for REST data views
[ "Builds", "a", "builder", "for", "REST", "data", "views" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/ResourceView.js#L55-L116
train
thelonious/kld-array-iterators
examples/flatten.js
flatten
function flatten(list) { return list.reduce(function (acc, item) { if (Array.isArray(item)) { return acc.concat(flatten(item)); } else { return acc.concat(item); } }, []); }
javascript
function flatten(list) { return list.reduce(function (acc, item) { if (Array.isArray(item)) { return acc.concat(flatten(item)); } else { return acc.concat(item); } }, []); }
[ "function", "flatten", "(", "list", ")", "{", "return", "list", ".", "reduce", "(", "function", "(", "acc", ",", "item", ")", "{", "if", "(", "Array", ".", "isArray", "(", "item", ")", ")", "{", "return", "acc", ".", "concat", "(", "flatten", "(", ...
export utility to flatten nested arrays
[ "export", "utility", "to", "flatten", "nested", "arrays" ]
20fa2ae9ce5f72d9e0b09945365cf44052057dc2
https://github.com/thelonious/kld-array-iterators/blob/20fa2ae9ce5f72d9e0b09945365cf44052057dc2/examples/flatten.js#L3-L12
train
aleclarson/testpass
src/context.js
getFile
function getFile(group) { while (group) { if (group.file) return group.file group = group.parent } }
javascript
function getFile(group) { while (group) { if (group.file) return group.file group = group.parent } }
[ "function", "getFile", "(", "group", ")", "{", "while", "(", "group", ")", "{", "if", "(", "group", ".", "file", ")", "return", "group", ".", "file", "group", "=", "group", ".", "parent", "}", "}" ]
Find which file the given group is in.
[ "Find", "which", "file", "the", "given", "group", "is", "in", "." ]
023f4d1a9ea525fd3abd3b456e9b604037282326
https://github.com/aleclarson/testpass/blob/023f4d1a9ea525fd3abd3b456e9b604037282326/src/context.js#L43-L48
train
aleclarson/testpass
src/context.js
getContext
function getContext(i) { if (context) { return context } else { const path = getCallsite(i || 2).getFileName() const file = files[path] if (file) return file.group throw Error(`Test module was not loaded properly: "${path}"`) } }
javascript
function getContext(i) { if (context) { return context } else { const path = getCallsite(i || 2).getFileName() const file = files[path] if (file) return file.group throw Error(`Test module was not loaded properly: "${path}"`) } }
[ "function", "getContext", "(", "i", ")", "{", "if", "(", "context", ")", "{", "return", "context", "}", "else", "{", "const", "path", "=", "getCallsite", "(", "i", "||", "2", ")", ".", "getFileName", "(", ")", "const", "file", "=", "files", "[", "p...
Create a file if no context exists.
[ "Create", "a", "file", "if", "no", "context", "exists", "." ]
023f4d1a9ea525fd3abd3b456e9b604037282326
https://github.com/aleclarson/testpass/blob/023f4d1a9ea525fd3abd3b456e9b604037282326/src/context.js#L56-L65
train
humanise-ai/botmaster-humanise-ware
lib/makeHumaniseWare.js
makeHumaniseWare
function makeHumaniseWare ({ apiKey, incomingWebhookUrl, logger, getHandoffFromUpdate }) { if (!apiKey || !incomingWebhookUrl) { throw new Error('botmaster-humanise-ware requires at least both of apiKey and incomingWebhookUrl parameters to be defined') } const HUMANISE_URL = incomingWebhookUrl if (!...
javascript
function makeHumaniseWare ({ apiKey, incomingWebhookUrl, logger, getHandoffFromUpdate }) { if (!apiKey || !incomingWebhookUrl) { throw new Error('botmaster-humanise-ware requires at least both of apiKey and incomingWebhookUrl parameters to be defined') } const HUMANISE_URL = incomingWebhookUrl if (!...
[ "function", "makeHumaniseWare", "(", "{", "apiKey", ",", "incomingWebhookUrl", ",", "logger", ",", "getHandoffFromUpdate", "}", ")", "{", "if", "(", "!", "apiKey", "||", "!", "incomingWebhookUrl", ")", "{", "throw", "new", "Error", "(", "'botmaster-humanise-ware...
Make botmaster middleware @param {$0.apiKey} ApiKey Humanise.AI API Key @param {$0.incomingWebhookUrl} incomingWebhookUrl Humanise.AI full webhook url that identifies your channel. It ends with your Webhook Id to humanise should go to. This package will then make calls to: https://alpha.humanise.ai/webhooks/{WebhookId}...
[ "Make", "botmaster", "middleware" ]
a94af55ace6a4c90f7f795d84d08ac7f2a920f82
https://github.com/humanise-ai/botmaster-humanise-ware/blob/a94af55ace6a4c90f7f795d84d08ac7f2a920f82/lib/makeHumaniseWare.js#L15-L136
train
ryanlabouve/ember-cli-randoport
lib/randoport.js
checkPort
function checkPort(basePort, callback){ return deasync(function(basePort, callback) { portfinder.basePort = basePort; portfinder.getPort(function (err, port) { callback(null, port); }); })(basePort); }
javascript
function checkPort(basePort, callback){ return deasync(function(basePort, callback) { portfinder.basePort = basePort; portfinder.getPort(function (err, port) { callback(null, port); }); })(basePort); }
[ "function", "checkPort", "(", "basePort", ",", "callback", ")", "{", "return", "deasync", "(", "function", "(", "basePort", ",", "callback", ")", "{", "portfinder", ".", "basePort", "=", "basePort", ";", "portfinder", ".", "getPort", "(", "function", "(", ...
Returns the next open port @method checkPort @param {Number} port to start checking from @return {Number} closest open port to one provided
[ "Returns", "the", "next", "open", "port" ]
628b3a5fefab6e9228b517648aa1bae2989bd54c
https://github.com/ryanlabouve/ember-cli-randoport/blob/628b3a5fefab6e9228b517648aa1bae2989bd54c/lib/randoport.js#L13-L20
train
ryanlabouve/ember-cli-randoport
lib/randoport.js
inBlackList
function inBlackList(port, additionalPorts) { const blacklist = [4200].concat(additionalPorts || []); return blacklist.indexOf(port) === -1 ? false : true; }
javascript
function inBlackList(port, additionalPorts) { const blacklist = [4200].concat(additionalPorts || []); return blacklist.indexOf(port) === -1 ? false : true; }
[ "function", "inBlackList", "(", "port", ",", "additionalPorts", ")", "{", "const", "blacklist", "=", "[", "4200", "]", ".", "concat", "(", "additionalPorts", "||", "[", "]", ")", ";", "return", "blacklist", ".", "indexOf", "(", "port", ")", "===", "-", ...
Checks if port is in blacklist @method inBlackList @param {Number} port we are checking @return {Number} additional array of blocked ports
[ "Checks", "if", "port", "is", "in", "blacklist" ]
628b3a5fefab6e9228b517648aa1bae2989bd54c
https://github.com/ryanlabouve/ember-cli-randoport/blob/628b3a5fefab6e9228b517648aa1bae2989bd54c/lib/randoport.js#L28-L31
train
blixt/js-starbound-files
lib/btreedb.js
Index
function Index(keySize, block) { var reader = new SbonReader(block.buffer); this.level = reader.readUint8(); // Number of keys in this index. this.keyCount = reader.readInt32(); // The blocks that the keys point to. There will be one extra block in the // beginning of this list that points to the block t...
javascript
function Index(keySize, block) { var reader = new SbonReader(block.buffer); this.level = reader.readUint8(); // Number of keys in this index. this.keyCount = reader.readInt32(); // The blocks that the keys point to. There will be one extra block in the // beginning of this list that points to the block t...
[ "function", "Index", "(", "keySize", ",", "block", ")", "{", "var", "reader", "=", "new", "SbonReader", "(", "block", ".", "buffer", ")", ";", "this", ".", "level", "=", "reader", ".", "readUint8", "(", ")", ";", "// Number of keys in this index.", "this",...
Wraps a block object to provide functionality for parsing and scanning an index.
[ "Wraps", "a", "block", "object", "to", "provide", "functionality", "for", "parsing", "and", "scanning", "an", "index", "." ]
f20f18e4caee87f940b3d9cbe92cacccee3f8d17
https://github.com/blixt/js-starbound-files/blob/f20f18e4caee87f940b3d9cbe92cacccee3f8d17/lib/btreedb.js#L107-L128
train
BartoszPiwek/FrontBox-Grunt
tasks/autoclass.js
function(className, array) { var len = array.length; for (var i = 0; i < len; i++) { if (array[i].indexOf(className) > -1) { return i; } } return -1; }
javascript
function(className, array) { var len = array.length; for (var i = 0; i < len; i++) { if (array[i].indexOf(className) > -1) { return i; } } return -1; }
[ "function", "(", "className", ",", "array", ")", "{", "var", "len", "=", "array", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", ".", "indexOf", "(", ...
Return number of usage array
[ "Return", "number", "of", "usage", "array" ]
2943638c3ac55b0c6b372bf8238c037858be6d4b
https://github.com/BartoszPiwek/FrontBox-Grunt/blob/2943638c3ac55b0c6b372bf8238c037858be6d4b/tasks/autoclass.js#L49-L57
train
BartoszPiwek/FrontBox-Grunt
tasks/autoclass.js
function(className) { for (var i = 0; i < databaseLen; i++) { if (database["field" + i].regExp.test(className)) { return i; } } return -1; }
javascript
function(className) { for (var i = 0; i < databaseLen; i++) { if (database["field" + i].regExp.test(className)) { return i; } } return -1; }
[ "function", "(", "className", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "databaseLen", ";", "i", "++", ")", "{", "if", "(", "database", "[", "\"field\"", "+", "i", "]", ".", "regExp", ".", "test", "(", "className", ")", ")", "{...
Return database type number
[ "Return", "database", "type", "number" ]
2943638c3ac55b0c6b372bf8238c037858be6d4b
https://github.com/BartoszPiwek/FrontBox-Grunt/blob/2943638c3ac55b0c6b372bf8238c037858be6d4b/tasks/autoclass.js#L79-L86
train
BartoszPiwek/FrontBox-Grunt
tasks/autoclass.js
function(array) { // Run Functions regLoop(); // Functions var addOutputValue = function(objectField, value, property, addon) { var index = objectField.unit.indexOf(property), indexInDatabase, unit; if (addon === "responsive") { indexInDatabase = ...
javascript
function(array) { // Run Functions regLoop(); // Functions var addOutputValue = function(objectField, value, property, addon) { var index = objectField.unit.indexOf(property), indexInDatabase, unit; if (addon === "responsive") { indexInDatabase = ...
[ "function", "(", "array", ")", "{", "// Run Functions", "regLoop", "(", ")", ";", "// Functions", "var", "addOutputValue", "=", "function", "(", "objectField", ",", "value", ",", "property", ",", "addon", ")", "{", "var", "index", "=", "objectField", ".", ...
Return full array with class
[ "Return", "full", "array", "with", "class" ]
2943638c3ac55b0c6b372bf8238c037858be6d4b
https://github.com/BartoszPiwek/FrontBox-Grunt/blob/2943638c3ac55b0c6b372bf8238c037858be6d4b/tasks/autoclass.js#L89-L191
train
pzlr/build-core
lib/resolve.js
entry
function entry(name = '') { return path.normalize(path.join(sourceDir, config.entriesDir, name ? `${name}.js` : '')); }
javascript
function entry(name = '') { return path.normalize(path.join(sourceDir, config.entriesDir, name ? `${name}.js` : '')); }
[ "function", "entry", "(", "name", "=", "''", ")", "{", "return", "path", ".", "normalize", "(", "path", ".", "join", "(", "sourceDir", ",", "config", ".", "entriesDir", ",", "name", "?", "`", "${", "name", "}", "`", ":", "''", ")", ")", ";", "}" ...
Returns an absolute path to an entry by the specified name @param {string=} [name] - entry name (if empty, returns path to the entries folder)
[ "Returns", "an", "absolute", "path", "to", "an", "entry", "by", "the", "specified", "name" ]
11e20eda500682b9fa62c7804c66be1714df0df4
https://github.com/pzlr/build-core/blob/11e20eda500682b9fa62c7804c66be1714df0df4/lib/resolve.js#L254-L256
train
alexpods/InjectorJS
dist/InjectorJS.js
function(name, factory, object) { var that = this; var objects = this._resolveObjects(name, factory, object); _.each(objects, function(factoryObjects, factory) { _.each(factoryObjects, function(object, name) { ...
javascript
function(name, factory, object) { var that = this; var objects = this._resolveObjects(name, factory, object); _.each(objects, function(factoryObjects, factory) { _.each(factoryObjects, function(object, name) { ...
[ "function", "(", "name", ",", "factory", ",", "object", ")", "{", "var", "that", "=", "this", ";", "var", "objects", "=", "this", ".", "_resolveObjects", "(", "name", ",", "factory", ",", "object", ")", ";", "_", ".", "each", "(", "objects", ",", "...
Sets new object to the container @param {string|object} name Object name or hash of the objects @param {string} factory Factory name @param {*} object Object or its factory method @returns {Injector} this @this {Injector}
[ "Sets", "new", "object", "to", "the", "container" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L124-L136
train
alexpods/InjectorJS
dist/InjectorJS.js
function(name) { this._checkObject(name); if (!this._hasObject([name])) { this._setObject([name], this._getObjectCreator([name]).call())._removeObjectCreator([name]); } return this._getObject([na...
javascript
function(name) { this._checkObject(name); if (!this._hasObject([name])) { this._setObject([name], this._getObjectCreator([name]).call())._removeObjectCreator([name]); } return this._getObject([na...
[ "function", "(", "name", ")", "{", "this", ".", "_checkObject", "(", "name", ")", ";", "if", "(", "!", "this", ".", "_hasObject", "(", "[", "name", "]", ")", ")", "{", "this", ".", "_setObject", "(", "[", "name", "]", ",", "this", ".", "_getObjec...
Gets specified object @param {string} name Object name @returns {*} Specified object @throws {Error} if specified object does not exist @this {Injector}
[ "Gets", "specified", "object" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L160-L167
train
alexpods/InjectorJS
dist/InjectorJS.js
function(name) { this._checkObject(name); return (this._hasObject([name]) && this._removeObject([name])) || (this._hasObjectCreator([name]) && this._removeObjectCreator([name])); }
javascript
function(name) { this._checkObject(name); return (this._hasObject([name]) && this._removeObject([name])) || (this._hasObjectCreator([name]) && this._removeObjectCreator([name])); }
[ "function", "(", "name", ")", "{", "this", ".", "_checkObject", "(", "name", ")", ";", "return", "(", "this", ".", "_hasObject", "(", "[", "name", "]", ")", "&&", "this", ".", "_removeObject", "(", "[", "name", "]", ")", ")", "||", "(", "this", "...
Removes specified object @param {string} name Object name @returns {Injector} this @throws {Error} if specified object does not exist @this {Injector}
[ "Removes", "specified", "object" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L179-L183
train
alexpods/InjectorJS
dist/InjectorJS.js
function(name, factory) { if (_.isUndefined(factory)) { factory = name; name = undefined; } if (factory && factory.__clazz && factory.__clazz.__isSubclazzOf('/InjectorJS/Factories/Abstract'))...
javascript
function(name, factory) { if (_.isUndefined(factory)) { factory = name; name = undefined; } if (factory && factory.__clazz && factory.__clazz.__isSubclazzOf('/InjectorJS/Factories/Abstract'))...
[ "function", "(", "name", ",", "factory", ")", "{", "if", "(", "_", ".", "isUndefined", "(", "factory", ")", ")", "{", "factory", "=", "name", ";", "name", "=", "undefined", ";", "}", "if", "(", "factory", "&&", "factory", ".", "__clazz", "&&", "fac...
Sets object factory @param {string,Factory} name Factory name of factory instance @param {function|Factory} factory Object factory @returns {Injector} this @this {Injector}
[ "Sets", "object", "factory" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L194-L207
train
alexpods/InjectorJS
dist/InjectorJS.js
function(factory) { var factoryName = _.isString(factory) ? factory : factory.getName(); return this.__hasPropertyValue(['factory', factoryName]); }
javascript
function(factory) { var factoryName = _.isString(factory) ? factory : factory.getName(); return this.__hasPropertyValue(['factory', factoryName]); }
[ "function", "(", "factory", ")", "{", "var", "factoryName", "=", "_", ".", "isString", "(", "factory", ")", "?", "factory", ":", "factory", ".", "getName", "(", ")", ";", "return", "this", ".", "__hasPropertyValue", "(", "[", "'factory'", ",", "factoryNa...
Checks whether specified factory exist @param {string|Factory} factory Object factory or its name @returns {boolean} true if object factory exist @this {Injector}
[ "Checks", "whether", "specified", "factory", "exist" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L217-L220
train
alexpods/InjectorJS
dist/InjectorJS.js
function(name, factory, object) { var that = this; var objects = {}; var defaultFactory = this.getDefaultFactory().getName(); if (_.isObject(name)) { objects = name; } el...
javascript
function(name, factory, object) { var that = this; var objects = {}; var defaultFactory = this.getDefaultFactory().getName(); if (_.isObject(name)) { objects = name; } el...
[ "function", "(", "name", ",", "factory", ",", "object", ")", "{", "var", "that", "=", "this", ";", "var", "objects", "=", "{", "}", ";", "var", "defaultFactory", "=", "this", ".", "getDefaultFactory", "(", ")", ".", "getName", "(", ")", ";", "if", ...
Resolves specified objects @see set() method @param {string|object} name Object name or hash of the objects @param {string} factory Factory name @param {*} object Object or its factory method @returns {object} Resolved objects @this {Injector} @private
[ "Resolves", "specified", "objects" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L265-L299
train
alexpods/InjectorJS
dist/InjectorJS.js
function(factoryName, object) { if (_.isUndefined(object)) { object = factoryName; factoryName = undefined; } var that = this; return function() { ...
javascript
function(factoryName, object) { if (_.isUndefined(object)) { object = factoryName; factoryName = undefined; } var that = this; return function() { ...
[ "function", "(", "factoryName", ",", "object", ")", "{", "if", "(", "_", ".", "isUndefined", "(", "object", ")", ")", "{", "object", "=", "factoryName", ";", "factoryName", "=", "undefined", ";", "}", "var", "that", "=", "this", ";", "return", "functio...
Creates object creator @param {string} factoryName Factory name @param {*|factory} object Object or its factory function @returns {Function} Object creator @this {Injector} @private
[ "Creates", "object", "creator" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L311-L327
train
alexpods/InjectorJS
dist/InjectorJS.js
function(value, metaData, name, object) { name = name || 'unknown'; object = object || this; var that = this; var processors = this.getProcessor(); _.each(metaData, function(data, option) { ...
javascript
function(value, metaData, name, object) { name = name || 'unknown'; object = object || this; var that = this; var processors = this.getProcessor(); _.each(metaData, function(data, option) { ...
[ "function", "(", "value", ",", "metaData", ",", "name", ",", "object", ")", "{", "name", "=", "name", "||", "'unknown'", ";", "object", "=", "object", "||", "this", ";", "var", "that", "=", "this", ";", "var", "processors", "=", "this", ".", "getProc...
Process parameter value @param {*} value Parameter value @param {object} metaData Meta data for parameter @param {string} name Parameter name @param {object} object Object of specified parameter @returns {*} Processed parameter value @this {ParameterProcessor}
[ "Process", "parameter", "value" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L385-L402
train
alexpods/InjectorJS
dist/InjectorJS.js
function(params) { var that = this; var paramsDefinition = this.getParamsDefinition(); var parameterProcessor = this.getParameterProcessor(); _.each(params, function(value, param) { ...
javascript
function(params) { var that = this; var paramsDefinition = this.getParamsDefinition(); var parameterProcessor = this.getParameterProcessor(); _.each(params, function(value, param) { ...
[ "function", "(", "params", ")", "{", "var", "that", "=", "this", ";", "var", "paramsDefinition", "=", "this", ".", "getParamsDefinition", "(", ")", ";", "var", "parameterProcessor", "=", "this", ".", "getParameterProcessor", "(", ")", ";", "_", ".", "each"...
Process parameters for object creation @param {object} params Raw object parameters for object creation @returns {object} Processed object parameters @this {AbstractFactory}
[ "Process", "parameters", "for", "object", "creation" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L495-L509
train
alexpods/InjectorJS
dist/InjectorJS.js
function(params) { var clazz = this.getClazz(); return clazz(params.name, params.parent, params.deps) }
javascript
function(params) { var clazz = this.getClazz(); return clazz(params.name, params.parent, params.deps) }
[ "function", "(", "params", ")", "{", "var", "clazz", "=", "this", ".", "getClazz", "(", ")", ";", "return", "clazz", "(", "params", ".", "name", ",", "params", ".", "parent", ",", "params", ".", "deps", ")", "}" ]
Creates clazz using specified processed parameters @param {object} params Parameters for clazz creation @returns {*} Created clazz @this {ClazzFactory}
[ "Creates", "clazz", "using", "specified", "processed", "parameters" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L578-L581
train
alexpods/InjectorJS
dist/InjectorJS.js
function(params) { // Create '_createService' function for this purpose for parameters applying to clazz constructor. var service = this._createService(params.class, params.init); _.each(params.call, function(params, method) { ...
javascript
function(params) { // Create '_createService' function for this purpose for parameters applying to clazz constructor. var service = this._createService(params.class, params.init); _.each(params.call, function(params, method) { ...
[ "function", "(", "params", ")", "{", "// Create '_createService' function for this purpose for parameters applying to clazz constructor.", "var", "service", "=", "this", ".", "_createService", "(", "params", ".", "class", ",", "params", ".", "init", ")", ";", "_", ".", ...
Creates object using specified processed parameters @param {object} params Parameters for object creation @returns {*} Created object @this {ServiceFactory}
[ "Creates", "object", "using", "specified", "processed", "parameters" ]
e808ed504768a7b65b5a3710bd028502ebdedaf0
https://github.com/alexpods/InjectorJS/blob/e808ed504768a7b65b5a3710bd028502ebdedaf0/dist/InjectorJS.js#L677-L687
train
Everyplay/backbone-db-indexing-adapter
lib/indexing_db_local.js
function(collection, options, cb) { this.store().setItem( options.indexKey, JSON.stringify([]), function(err, res) { cb(err, [], res); } ); }
javascript
function(collection, options, cb) { this.store().setItem( options.indexKey, JSON.stringify([]), function(err, res) { cb(err, [], res); } ); }
[ "function", "(", "collection", ",", "options", ",", "cb", ")", "{", "this", ".", "store", "(", ")", ".", "setItem", "(", "options", ".", "indexKey", ",", "JSON", ".", "stringify", "(", "[", "]", ")", ",", "function", "(", "err", ",", "res", ")", ...
removes everything from index
[ "removes", "everything", "from", "index" ]
9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112
https://github.com/Everyplay/backbone-db-indexing-adapter/blob/9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112/lib/indexing_db_local.js#L131-L139
train
Everyplay/backbone-db-indexing-adapter
lib/indexing_db_local.js
function(collection, options, cb) { var ids = []; var keys = _.isFunction(collection.url) ? collection.url() : collection.url; keys += options.keys; debug('findKeys', keys); this.store().getItem(keys, function(err, data) { if (data) ids.push(keys); cb(null, ids); }); }
javascript
function(collection, options, cb) { var ids = []; var keys = _.isFunction(collection.url) ? collection.url() : collection.url; keys += options.keys; debug('findKeys', keys); this.store().getItem(keys, function(err, data) { if (data) ids.push(keys); cb(null, ids); }); }
[ "function", "(", "collection", ",", "options", ",", "cb", ")", "{", "var", "ids", "=", "[", "]", ";", "var", "keys", "=", "_", ".", "isFunction", "(", "collection", ".", "url", ")", "?", "collection", ".", "url", "(", ")", ":", "collection", ".", ...
mock adapter only supports exact match
[ "mock", "adapter", "only", "supports", "exact", "match" ]
9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112
https://github.com/Everyplay/backbone-db-indexing-adapter/blob/9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112/lib/indexing_db_local.js#L156-L165
train
sbj42/maze-generator-core
src/Maze.js
Cell
function Cell(north, east, south, west) { this._north = north; this._east = east; this._south = south; this._west = west; }
javascript
function Cell(north, east, south, west) { this._north = north; this._east = east; this._south = south; this._west = west; }
[ "function", "Cell", "(", "north", ",", "east", ",", "south", ",", "west", ")", "{", "this", ".", "_north", "=", "north", ";", "this", ".", "_east", "=", "east", ";", "this", ".", "_south", "=", "south", ";", "this", ".", "_west", "=", "west", ";"...
A Cell is a wrapper object that makes it easier to ask for passage information by name. @constructor @private @param {integer} width @param {integer} height
[ "A", "Cell", "is", "a", "wrapper", "object", "that", "makes", "it", "easier", "to", "ask", "for", "passage", "information", "by", "name", "." ]
0ea4825344ca0e0292edaa77d7ea493ba1eaa1e9
https://github.com/sbj42/maze-generator-core/blob/0ea4825344ca0e0292edaa77d7ea493ba1eaa1e9/src/Maze.js#L12-L17
train
sbj42/maze-generator-core
src/Maze.js
Maze
function Maze(width, height) { if (width < 0 || height < 0) throw new Error('invalid size: ' + width + 'x' + height); this._width = width; this._height = height; this._blockWidth = ((width+1)+15) >> 4; this._grid = new Array(this._blockWidth * (height + 1)); for (var i = 0; i < this._blo...
javascript
function Maze(width, height) { if (width < 0 || height < 0) throw new Error('invalid size: ' + width + 'x' + height); this._width = width; this._height = height; this._blockWidth = ((width+1)+15) >> 4; this._grid = new Array(this._blockWidth * (height + 1)); for (var i = 0; i < this._blo...
[ "function", "Maze", "(", "width", ",", "height", ")", "{", "if", "(", "width", "<", "0", "||", "height", "<", "0", ")", "throw", "new", "Error", "(", "'invalid size: '", "+", "width", "+", "'x'", "+", "height", ")", ";", "this", ".", "_width", "=",...
A Maze is a rectangular grid of cells, where each cell may have passages in each of the cardinal directions. The maze is initialized with each cell having no passages. @constructor @param {integer} width @param {integer} height
[ "A", "Maze", "is", "a", "rectangular", "grid", "of", "cells", "where", "each", "cell", "may", "have", "passages", "in", "each", "of", "the", "cardinal", "directions", ".", "The", "maze", "is", "initialized", "with", "each", "cell", "having", "no", "passage...
0ea4825344ca0e0292edaa77d7ea493ba1eaa1e9
https://github.com/sbj42/maze-generator-core/blob/0ea4825344ca0e0292edaa77d7ea493ba1eaa1e9/src/Maze.js#L44-L53
train
feedhenry/fh-mbaas-middleware
lib/middleware/envMongoDb.js
dropEnvironmentDatabase
function dropEnvironmentDatabase(domain, env, next) { _getEnvironmentDatabase({ domain: domain, environment: env }, function (err, found) { if (err) { return next(common.buildErrorObject({ err: err, msg: 'Failed to get environment', httpCode: 500 })); } if (!f...
javascript
function dropEnvironmentDatabase(domain, env, next) { _getEnvironmentDatabase({ domain: domain, environment: env }, function (err, found) { if (err) { return next(common.buildErrorObject({ err: err, msg: 'Failed to get environment', httpCode: 500 })); } if (!f...
[ "function", "dropEnvironmentDatabase", "(", "domain", ",", "env", ",", "next", ")", "{", "_getEnvironmentDatabase", "(", "{", "domain", ":", "domain", ",", "environment", ":", "env", "}", ",", "function", "(", "err", ",", "found", ")", "{", "if", "(", "e...
DropEnvironmentDatabase removes the database for specific environment completely
[ "DropEnvironmentDatabase", "removes", "the", "database", "for", "specific", "environment", "completely" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/envMongoDb.js#L14-L42
train
feedhenry/fh-mbaas-middleware
lib/middleware/envMongoDb.js
getOrCreateEnvironmentDatabase
function getOrCreateEnvironmentDatabase(req, res, next){ var models = mbaas.getModels(); log.logger.debug('process getOrCreateEnvironmentDatabase request', req.originalUrl , req.body, req.method, req.params); var domain = req.params.domain; var env = req.params.environment; log.logger.debug('process db cre...
javascript
function getOrCreateEnvironmentDatabase(req, res, next){ var models = mbaas.getModels(); log.logger.debug('process getOrCreateEnvironmentDatabase request', req.originalUrl , req.body, req.method, req.params); var domain = req.params.domain; var env = req.params.environment; log.logger.debug('process db cre...
[ "function", "getOrCreateEnvironmentDatabase", "(", "req", ",", "res", ",", "next", ")", "{", "var", "models", "=", "mbaas", ".", "getModels", "(", ")", ";", "log", ".", "logger", ".", "debug", "(", "'process getOrCreateEnvironmentDatabase request'", ",", "req", ...
Function that will return a mongo @param req @param res @param next
[ "Function", "that", "will", "return", "a", "mongo" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/envMongoDb.js#L50-L111
train
feedhenry/fh-mbaas-middleware
lib/middleware/envMongoDb.js
getEnvironmentDatabase
function getEnvironmentDatabase(req, res, next){ log.logger.debug('process getEnvironmentDatabase request', req.originalUrl ); _getEnvironmentDatabase({ domain: req.params.domain, environment: req.params.environment }, function(err, envDb){ if(err){ log.logger.error('Failed to get mbaas instanc...
javascript
function getEnvironmentDatabase(req, res, next){ log.logger.debug('process getEnvironmentDatabase request', req.originalUrl ); _getEnvironmentDatabase({ domain: req.params.domain, environment: req.params.environment }, function(err, envDb){ if(err){ log.logger.error('Failed to get mbaas instanc...
[ "function", "getEnvironmentDatabase", "(", "req", ",", "res", ",", "next", ")", "{", "log", ".", "logger", ".", "debug", "(", "'process getEnvironmentDatabase request'", ",", "req", ".", "originalUrl", ")", ";", "_getEnvironmentDatabase", "(", "{", "domain", ":"...
Middleware To Get An Environment Database
[ "Middleware", "To", "Get", "An", "Environment", "Database" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/middleware/envMongoDb.js#L120-L150
train
crishernandezmaps/liqen-scrapper
src/downloadArticle.js
getMedia
function getMedia (hostname) { const patterns = { abc: /abc\.es/, ara: /ara\.cat/, elconfidencial: /elconfidencial\.com/, eldiario: /eldiario\.es/, elespanol: /elespanol\.com/, elmundo: /elmundo\.es/, elpais: /elpais\.com/, elperiodico: /elperiodico\.com/, esdiario: /esdiario\.com/...
javascript
function getMedia (hostname) { const patterns = { abc: /abc\.es/, ara: /ara\.cat/, elconfidencial: /elconfidencial\.com/, eldiario: /eldiario\.es/, elespanol: /elespanol\.com/, elmundo: /elmundo\.es/, elpais: /elpais\.com/, elperiodico: /elperiodico\.com/, esdiario: /esdiario\.com/...
[ "function", "getMedia", "(", "hostname", ")", "{", "const", "patterns", "=", "{", "abc", ":", "/", "abc\\.es", "/", ",", "ara", ":", "/", "ara\\.cat", "/", ",", "elconfidencial", ":", "/", "elconfidencial\\.com", "/", ",", "eldiario", ":", "/", "eldiario...
A full article object @typedef {Object} Article @property {string} title - The title of the article @property {string} html - The content of the article in HTML @property {string} image - The heading image URI of the article @property {Date} publishedDate - The publishing date of the article...
[ "A", "full", "article", "object" ]
0462d25359ed13fc8321e85cb6a0d87abece7218
https://github.com/crishernandezmaps/liqen-scrapper/blob/0462d25359ed13fc8321e85cb6a0d87abece7218/src/downloadArticle.js#L20-L48
train
PanthR/panthrMath
panthrMath/basicFunc/gratio.js
delta
function delta(a) { return lgamma(a) - (a - 0.5) * Math.log(a) + a - 0.5 * Math.log(2 * Math.PI); }
javascript
function delta(a) { return lgamma(a) - (a - 0.5) * Math.log(a) + a - 0.5 * Math.log(2 * Math.PI); }
[ "function", "delta", "(", "a", ")", "{", "return", "lgamma", "(", "a", ")", "-", "(", "a", "-", "0.5", ")", "*", "Math", ".", "log", "(", "a", ")", "+", "a", "-", "0.5", "*", "Math", ".", "log", "(", "2", "*", "Math", ".", "PI", ")", ";",...
From equation 3
[ "From", "equation", "3" ]
54d249ca9903a9535f963da711bd3a87fb229c0b
https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/basicFunc/gratio.js#L156-L158
train
PanthR/panthrMath
panthrMath/basicFunc/gratio.js
findx0SmallA
function findx0SmallA(a, p, q) { var B, u, temp; B = q * gamma(a); if (B > 0.6 || B >= 0.45 && a >= 0.3) { // use 21 u = B * q > 1e-8 ? Math.pow(p * gamma(a + 1), 1 / a) : Math.exp(-q / a - eulerGamma); return u / (1 - u / (a + 1)); } i...
javascript
function findx0SmallA(a, p, q) { var B, u, temp; B = q * gamma(a); if (B > 0.6 || B >= 0.45 && a >= 0.3) { // use 21 u = B * q > 1e-8 ? Math.pow(p * gamma(a + 1), 1 / a) : Math.exp(-q / a - eulerGamma); return u / (1 - u / (a + 1)); } i...
[ "function", "findx0SmallA", "(", "a", ",", "p", ",", "q", ")", "{", "var", "B", ",", "u", ",", "temp", ";", "B", "=", "q", "*", "gamma", "(", "a", ")", ";", "if", "(", "B", ">", "0.6", "||", "B", ">=", "0.45", "&&", "a", ">=", "0.3", ")",...
Use formulas 21 through 25 from DiDonato to get initial estimate for x when a < 1.
[ "Use", "formulas", "21", "through", "25", "from", "DiDonato", "to", "get", "initial", "estimate", "for", "x", "when", "a", "<", "1", "." ]
54d249ca9903a9535f963da711bd3a87fb229c0b
https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/basicFunc/gratio.js#L395-L427
train
PanthR/panthrMath
panthrMath/basicFunc/gratio.js
f
function f(x, n) { return Math.exp((logpg + x - Math.log(series(snTerm(x), n + 1))) / a); }
javascript
function f(x, n) { return Math.exp((logpg + x - Math.log(series(snTerm(x), n + 1))) / a); }
[ "function", "f", "(", "x", ",", "n", ")", "{", "return", "Math", ".", "exp", "(", "(", "logpg", "+", "x", "-", "Math", ".", "log", "(", "series", "(", "snTerm", "(", "x", ")", ",", "n", "+", "1", ")", ")", ")", "/", "a", ")", ";", "}" ]
See formula 34, where `n` is off by 1
[ "See", "formula", "34", "where", "n", "is", "off", "by", "1" ]
54d249ca9903a9535f963da711bd3a87fb229c0b
https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/basicFunc/gratio.js#L469-L471
train
PanthR/panthrMath
panthrMath/basicFunc/gratio.js
step
function step(x, a, p, q) { var temp, w; temp = p <= 0.5 ? gratio(a)(x) - p : q - gratioc(a)(x); temp /= r(a, x); w = (a - 1 - x) / 2; if (Math.max(Math.abs(temp), Math.abs(w * temp)) <= 0.1) { return x * (1 - (temp + w * temp * temp)); } return x * (1 - temp); }
javascript
function step(x, a, p, q) { var temp, w; temp = p <= 0.5 ? gratio(a)(x) - p : q - gratioc(a)(x); temp /= r(a, x); w = (a - 1 - x) / 2; if (Math.max(Math.abs(temp), Math.abs(w * temp)) <= 0.1) { return x * (1 - (temp + w * temp * temp)); } return x * (1 - temp); }
[ "function", "step", "(", "x", ",", "a", ",", "p", ",", "q", ")", "{", "var", "temp", ",", "w", ";", "temp", "=", "p", "<=", "0.5", "?", "gratio", "(", "a", ")", "(", "x", ")", "-", "p", ":", "q", "-", "gratioc", "(", "a", ")", "(", "x",...
Use Schroeder or Newton-Raphson to do one step of the iteration, formulas 37 and 38.
[ "Use", "Schroeder", "or", "Newton", "-", "Raphson", "to", "do", "one", "step", "of", "the", "iteration", "formulas", "37", "and", "38", "." ]
54d249ca9903a9535f963da711bd3a87fb229c0b
https://github.com/PanthR/panthrMath/blob/54d249ca9903a9535f963da711bd3a87fb229c0b/panthrMath/basicFunc/gratio.js#L514-L524
train
novadiscovery/nway
lib/decojs.js
decojs
function decojs(str) { var i , curChar, nextChar, lastNoSpaceChar , inString = false , inComment = false , inRegex = false , onlyComment = false , newStr = '' , curLine = '' , keepLineFeed = false // Keep a line feed after comment , stringOpenWith ;...
javascript
function decojs(str) { var i , curChar, nextChar, lastNoSpaceChar , inString = false , inComment = false , inRegex = false , onlyComment = false , newStr = '' , curLine = '' , keepLineFeed = false // Keep a line feed after comment , stringOpenWith ;...
[ "function", "decojs", "(", "str", ")", "{", "var", "i", ",", "curChar", ",", "nextChar", ",", "lastNoSpaceChar", ",", "inString", "=", "false", ",", "inComment", "=", "false", ",", "inRegex", "=", "false", ",", "onlyComment", "=", "false", ",", "newStr",...
Remove comment in a source code decojs() is remove javascript style single line and multiline comments (// and /*) @param {string} str The source to de-comment @return {string} Result string without comment
[ "Remove", "comment", "in", "a", "source", "code" ]
fa31c6fe56f2305721e581ac25e8ac9a87e15dda
https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/decojs.js#L38-L136
train