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
chatphrase/caress
lib/routes/uuidGet.js
getNew
function getNew(body) { // If we haven't already cleared the callback (we got the body, then the // message on the subscriber) if (timer) { // If the new body is present (say, if it wasn't deleted) if (body) { // Calculate the new Etag ourEtag = '"' + sha1hex(body) ...
javascript
function getNew(body) { // If we haven't already cleared the callback (we got the body, then the // message on the subscriber) if (timer) { // If the new body is present (say, if it wasn't deleted) if (body) { // Calculate the new Etag ourEtag = '"' + sha1hex(body) ...
[ "function", "getNew", "(", "body", ")", "{", "// If we haven't already cleared the callback (we got the body, then the", "// message on the subscriber)", "if", "(", "timer", ")", "{", "// If the new body is present (say, if it wasn't deleted)", "if", "(", "body", ")", "{", "// ...
Callback for when we get a mesage that there's a new body.
[ "Callback", "for", "when", "we", "get", "a", "mesage", "that", "there", "s", "a", "new", "body", "." ]
1634c127e90c8140baf5e2803a2938ffaf0414c4
https://github.com/chatphrase/caress/blob/1634c127e90c8140baf5e2803a2938ffaf0414c4/lib/routes/uuidGet.js#L76-L97
train
hex7c0/setheaders
index.js
setOverrideHeader
function setOverrideHeader(res, name, value) { if (res._headers && res._headers[name] !== undefined) { return true; } res.setHeader(name, value); return true; }
javascript
function setOverrideHeader(res, name, value) { if (res._headers && res._headers[name] !== undefined) { return true; } res.setHeader(name, value); return true; }
[ "function", "setOverrideHeader", "(", "res", ",", "name", ",", "value", ")", "{", "if", "(", "res", ".", "_headers", "&&", "res", ".", "_headers", "[", "name", "]", "!==", "undefined", ")", "{", "return", "true", ";", "}", "res", ".", "setHeader", "(...
set override header on response @function setOverrideHeader @param {Object} res - response to client @param {String} name - header's name @param {String} value - header's value @return {Boolean}
[ "set", "override", "header", "on", "response" ]
e2d92bc8f03ec1938036e15ffc2a01b286137f9e
https://github.com/hex7c0/setheaders/blob/e2d92bc8f03ec1938036e15ffc2a01b286137f9e/index.js#L118-L126
train
hex7c0/setheaders
index.js
setWritableHeader
function setWritableHeader(res, name, value) { if (res._headerSent && res.finished) { return false; } res.setHeader(name, value); return true; }
javascript
function setWritableHeader(res, name, value) { if (res._headerSent && res.finished) { return false; } res.setHeader(name, value); return true; }
[ "function", "setWritableHeader", "(", "res", ",", "name", ",", "value", ")", "{", "if", "(", "res", ".", "_headerSent", "&&", "res", ".", "finished", ")", "{", "return", "false", ";", "}", "res", ".", "setHeader", "(", "name", ",", "value", ")", ";",...
set writable header on response @function setWritableHeader @param {Object} res - response to client @param {String} name - header's name @param {String} value - header's value @return {Boolean}
[ "set", "writable", "header", "on", "response" ]
e2d92bc8f03ec1938036e15ffc2a01b286137f9e
https://github.com/hex7c0/setheaders/blob/e2d92bc8f03ec1938036e15ffc2a01b286137f9e/index.js#L138-L146
train
repetere/component.collection-linotype
lib/linotype.js
function (options) { /** call event emitter */ events.EventEmitter.call(this); /** module default configuration */ var defaults = { idSelector: 'linotype', start: 0, currentSection: 0, delay: 300, easingdelay: 700, easing: false, isMoving: false, keyboardScrolling: true, touchevents: true, mous...
javascript
function (options) { /** call event emitter */ events.EventEmitter.call(this); /** module default configuration */ var defaults = { idSelector: 'linotype', start: 0, currentSection: 0, delay: 300, easingdelay: 700, easing: false, isMoving: false, keyboardScrolling: true, touchevents: true, mous...
[ "function", "(", "options", ")", "{", "/** call event emitter */", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "/** module default configuration */", "var", "defaults", "=", "{", "idSelector", ":", "'linotype'", ",", "start", ":", "0", ","...
A module that represents a Linotype object, a Linotyper is a page composition tool. @{@link https://github.com/typesettin/linotype} @author Yaw Joseph Etse @copyright Copyright (c) 2014 Typesettin. All rights reserved. @license MIT @constructor Linotype @requires module:classie @requires module:util-extent @requires mo...
[ "A", "module", "that", "represents", "a", "Linotype", "object", "a", "Linotyper", "is", "a", "page", "composition", "tool", "." ]
c3ddbd4a10ee58171602ec0747bac60064c15403
https://github.com/repetere/component.collection-linotype/blob/c3ddbd4a10ee58171602ec0747bac60064c15403/lib/linotype.js#L34-L64
train
repetere/component.collection-linotype
lib/linotype.js
function (e) { var touchEvents = getEventsPage(e); touchStartY = touchEvents.y; touchStartX = touchEvents.x; if (e.touches) { touchMoveStartY = e.touches[0].screenY; touchMoveStartX = e.touches[0].screenX; } }
javascript
function (e) { var touchEvents = getEventsPage(e); touchStartY = touchEvents.y; touchStartX = touchEvents.x; if (e.touches) { touchMoveStartY = e.touches[0].screenY; touchMoveStartX = e.touches[0].screenX; } }
[ "function", "(", "e", ")", "{", "var", "touchEvents", "=", "getEventsPage", "(", "e", ")", ";", "touchStartY", "=", "touchEvents", ".", "y", ";", "touchStartX", "=", "touchEvents", ".", "x", ";", "if", "(", "e", ".", "touches", ")", "{", "touchMoveStar...
handle touch start events @event touchStartHandler @param {object} e touch event object
[ "handle", "touch", "start", "events" ]
c3ddbd4a10ee58171602ec0747bac60064c15403
https://github.com/repetere/component.collection-linotype/blob/c3ddbd4a10ee58171602ec0747bac60064c15403/lib/linotype.js#L184-L192
train
robotlolita/specify-reporter-tap
index.js
describeFailure
function describeFailure(ex) { return ex.stack? [' ---' ,' type: ' + ex.name ,' message: >' , pad(6, ex.message) ,' stack: | ' , pad(6, ex.stack) ...
javascript
function describeFailure(ex) { return ex.stack? [' ---' ,' type: ' + ex.name ,' message: >' , pad(6, ex.message) ,' stack: | ' , pad(6, ex.stack) ...
[ "function", "describeFailure", "(", "ex", ")", "{", "return", "ex", ".", "stack", "?", "[", "' ---'", ",", "' type: '", "+", "ex", ".", "name", ",", "' message: >'", ",", "pad", "(", "6", ",", "ex", ".", "message", ")", ",", "' stack: | '", "...
Returns a YAML serialisation of an exception. @summary Error → String
[ "Returns", "a", "YAML", "serialisation", "of", "an", "exception", "." ]
809a4cf783907c58873e2a329c7e40a9ee25e5e1
https://github.com/robotlolita/specify-reporter-tap/blob/809a4cf783907c58873e2a329c7e40a9ee25e5e1/index.js#L32-L46
train
Nazariglez/perenquen
lib/pixi/src/filters/twist/TwistFilter.js
TwistFilter
function TwistFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/twist.frag', 'utf8'), // custom uniforms { radius: { type: '1f', value: 0.5 }, angle: { type: '1f', value: ...
javascript
function TwistFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/twist.frag', 'utf8'), // custom uniforms { radius: { type: '1f', value: 0.5 }, angle: { type: '1f', value: ...
[ "function", "TwistFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ",", "// vertex shader", "null", ",", "// fragment shader", "fs", ".", "readFileSync", "(", "__dirname", "+", "'/twist.frag'", ",", "'utf8'", ")", ",", "// custo...
This filter applies a twist effect making display objects appear twisted in the given direction. @class @extends AbstractFilter @memberof PIXI.filters
[ "This", "filter", "applies", "a", "twist", "effect", "making", "display", "objects", "appear", "twisted", "in", "the", "given", "direction", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/twist/TwistFilter.js#L12-L26
train
inviqa/deck-task-registry
src/scripts/lintScripts.js
lintScripts
function lintScripts(conf, undertaker) { const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.js'); // Lint theme scripts with ESLint. This won't touch any TypeScript files. return undertaker.src(jsSrc) .pipe(eslint()) .pipe(eslint.format()) .pipe(gulpIf(conf.productionMo...
javascript
function lintScripts(conf, undertaker) { const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.js'); // Lint theme scripts with ESLint. This won't touch any TypeScript files. return undertaker.src(jsSrc) .pipe(eslint()) .pipe(eslint.format()) .pipe(gulpIf(conf.productionMo...
[ "function", "lintScripts", "(", "conf", ",", "undertaker", ")", "{", "const", "jsSrc", "=", "path", ".", "join", "(", "conf", ".", "themeConfig", ".", "root", ",", "conf", ".", "themeConfig", ".", "js", ".", "src", ",", "'**'", ",", "'*.js'", ")", ";...
Lint project scripts. @param {ConfigParser} conf A configuration parser object. @param {Undertaker} undertaker An Undertaker instance. @returns {Stream} A stream of files.
[ "Lint", "project", "scripts", "." ]
4c31787b978e9d99a47052e090d4589a50cd3015
https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/scripts/lintScripts.js#L15-L25
train
grownseed/haibu-ishiki
lib/ishiki.js
switchState
function switchState(started, pkg) { pkg.started = started; //add available port back into port range if (!started && pkg.env && pkg.env.PORT) ports.push(pkg.env.PORT); console.log((started ? 'Started' : 'Stopped') + ' application ' + pkg.user + '/' + pkg.name); logInfo('info', 'Application...
javascript
function switchState(started, pkg) { pkg.started = started; //add available port back into port range if (!started && pkg.env && pkg.env.PORT) ports.push(pkg.env.PORT); console.log((started ? 'Started' : 'Stopped') + ' application ' + pkg.user + '/' + pkg.name); logInfo('info', 'Application...
[ "function", "switchState", "(", "started", ",", "pkg", ")", "{", "pkg", ".", "started", "=", "started", ";", "//add available port back into port range", "if", "(", "!", "started", "&&", "pkg", ".", "env", "&&", "pkg", ".", "env", ".", "PORT", ")", "ports"...
update drone state
[ "update", "drone", "state" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L47-L58
train
grownseed/haibu-ishiki
lib/ishiki.js
switchAndClear
function switchAndClear(pkg) { switchState(false, pkg); //unload proxy routes proxy.deleteBy(app.config.get('public-port'), {user: pkg.user, appid: pkg.name}); }
javascript
function switchAndClear(pkg) { switchState(false, pkg); //unload proxy routes proxy.deleteBy(app.config.get('public-port'), {user: pkg.user, appid: pkg.name}); }
[ "function", "switchAndClear", "(", "pkg", ")", "{", "switchState", "(", "false", ",", "pkg", ")", ";", "//unload proxy routes", "proxy", ".", "deleteBy", "(", "app", ".", "config", ".", "get", "(", "'public-port'", ")", ",", "{", "user", ":", "pkg", ".",...
update drone state and clear proxy routes
[ "update", "drone", "state", "and", "clear", "proxy", "routes" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L61-L66
train
grownseed/haibu-ishiki
lib/ishiki.js
findSwitchAndClear
function findSwitchAndClear(uid) { if (uid) { droneModel.getProcessed({uid: uid}, function(err, result) { if (!err && result && result.length == 1) { switchAndClear(result[0]); } }); } }
javascript
function findSwitchAndClear(uid) { if (uid) { droneModel.getProcessed({uid: uid}, function(err, result) { if (!err && result && result.length == 1) { switchAndClear(result[0]); } }); } }
[ "function", "findSwitchAndClear", "(", "uid", ")", "{", "if", "(", "uid", ")", "{", "droneModel", ".", "getProcessed", "(", "{", "uid", ":", "uid", "}", ",", "function", "(", "err", ",", "result", ")", "{", "if", "(", "!", "err", "&&", "result", "&...
find drone by uid, update drone state and clear proxy routes
[ "find", "drone", "by", "uid", "update", "drone", "state", "and", "clear", "proxy", "routes" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L69-L77
train
grownseed/haibu-ishiki
lib/ishiki.js
startDrone
function startDrone(pkg, userid, appid, callback) { var drone_port = getPort(); if (drone_port) { pkg.env = pkg.env || {}; pkg.env['PORT'] = drone_port; //ensure package user and name match internally pkg.user = userid; pkg.name = appid; drone.start(pkg, function(err, resu...
javascript
function startDrone(pkg, userid, appid, callback) { var drone_port = getPort(); if (drone_port) { pkg.env = pkg.env || {}; pkg.env['PORT'] = drone_port; //ensure package user and name match internally pkg.user = userid; pkg.name = appid; drone.start(pkg, function(err, resu...
[ "function", "startDrone", "(", "pkg", ",", "userid", ",", "appid", ",", "callback", ")", "{", "var", "drone_port", "=", "getPort", "(", ")", ";", "if", "(", "drone_port", ")", "{", "pkg", ".", "env", "=", "pkg", ".", "env", "||", "{", "}", ";", "...
starts a drone and sets up proxy routes for it
[ "starts", "a", "drone", "and", "sets", "up", "proxy", "routes", "for", "it" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L111-L141
train
grownseed/haibu-ishiki
lib/ishiki.js
stopDrone
function stopDrone(userid, appid, callback) { droneModel.getProcessed({user: userid, name: appid}, function(err, result) { if (err) return callback(err); if (result.length == 1) { if (!result[0].started) { callback({message: 'Drone is already stopped'}); }else{ ...
javascript
function stopDrone(userid, appid, callback) { droneModel.getProcessed({user: userid, name: appid}, function(err, result) { if (err) return callback(err); if (result.length == 1) { if (!result[0].started) { callback({message: 'Drone is already stopped'}); }else{ ...
[ "function", "stopDrone", "(", "userid", ",", "appid", ",", "callback", ")", "{", "droneModel", ".", "getProcessed", "(", "{", "user", ":", "userid", ",", "name", ":", "appid", "}", ",", "function", "(", "err", ",", "result", ")", "{", "if", "(", "err...
stops a drone
[ "stops", "a", "drone" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L144-L166
train
grownseed/haibu-ishiki
lib/ishiki.js
sendDrones
function sendDrones(filter, res) { droneModel.getProcessed(filter, function(err, result) { if (err) return haibu.sendResponse(res, 500, err); haibu.sendResponse(res, 200, {drones: result}); }); }
javascript
function sendDrones(filter, res) { droneModel.getProcessed(filter, function(err, result) { if (err) return haibu.sendResponse(res, 500, err); haibu.sendResponse(res, 200, {drones: result}); }); }
[ "function", "sendDrones", "(", "filter", ",", "res", ")", "{", "droneModel", ".", "getProcessed", "(", "filter", ",", "function", "(", "err", ",", "result", ")", "{", "if", "(", "err", ")", "return", "haibu", ".", "sendResponse", "(", "res", ",", "500"...
find drones for given filter and sends response
[ "find", "drones", "for", "given", "filter", "and", "sends", "response" ]
697e7d5fbc8405654b6cfc30bd5979f76c135421
https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L169-L176
train
cp2017/sign
index.js
function(ethereumAddress, ethereumDataDir, ethereumAccountPassword, cb = null){ if(isFunction(cb)){ try { keythereum.importFromFile(ethereumAddress, ethereumDataDir, function(keyObject){ keythereum.recover(ethereumAccountPassword, keyObject, function(privateKey){ ...
javascript
function(ethereumAddress, ethereumDataDir, ethereumAccountPassword, cb = null){ if(isFunction(cb)){ try { keythereum.importFromFile(ethereumAddress, ethereumDataDir, function(keyObject){ keythereum.recover(ethereumAccountPassword, keyObject, function(privateKey){ ...
[ "function", "(", "ethereumAddress", ",", "ethereumDataDir", ",", "ethereumAccountPassword", ",", "cb", "=", "null", ")", "{", "if", "(", "isFunction", "(", "cb", ")", ")", "{", "try", "{", "keythereum", ".", "importFromFile", "(", "ethereumAddress", ",", "et...
get the ethereum private key for the specified ethereum account, throws exception in case of any error @param {String} ethereumAddress address of the ethereum account or empty if default account @param {String} ethereumDataDir absolute path of the ethereum data, defaults to ~/.ethereum @param {String...
[ "get", "the", "ethereum", "private", "key", "for", "the", "specified", "ethereum", "account", "throws", "exception", "in", "case", "of", "any", "error" ]
9a838d454f862e674a505a09dd31cef93f727b4f
https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L82-L101
train
cp2017/sign
index.js
function(privateKey, cb = null){ if(isFunction(cb)){ try { return cb(null, ethUtils.privateToPublic(privateKey)) } catch(err){ return cb(err) } } else { try { return ethUtils.privateToPublic(priva...
javascript
function(privateKey, cb = null){ if(isFunction(cb)){ try { return cb(null, ethUtils.privateToPublic(privateKey)) } catch(err){ return cb(err) } } else { try { return ethUtils.privateToPublic(priva...
[ "function", "(", "privateKey", ",", "cb", "=", "null", ")", "{", "if", "(", "isFunction", "(", "cb", ")", ")", "{", "try", "{", "return", "cb", "(", "null", ",", "ethUtils", ".", "privateToPublic", "(", "privateKey", ")", ")", "}", "catch", "(", "e...
get public key for a given ethereum private key @param {Buffer} privateKey ethereum private key @return {Buffer} the associated public key
[ "get", "public", "key", "for", "a", "given", "ethereum", "private", "key" ]
9a838d454f862e674a505a09dd31cef93f727b4f
https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L107-L123
train
cp2017/sign
index.js
function(message, signatureObject, cb = null){ var result = false var ethSig = toEthUtilsSignature(signatureObject) try { var isSigValid = ethUtils.isValidSignature(ethSig.v, ethSig.r, ethSig.s) var isPubKeyValid = ethUtils.isValidPublic(signatureObject.publicKey) ...
javascript
function(message, signatureObject, cb = null){ var result = false var ethSig = toEthUtilsSignature(signatureObject) try { var isSigValid = ethUtils.isValidSignature(ethSig.v, ethSig.r, ethSig.s) var isPubKeyValid = ethUtils.isValidPublic(signatureObject.publicKey) ...
[ "function", "(", "message", ",", "signatureObject", ",", "cb", "=", "null", ")", "{", "var", "result", "=", "false", "var", "ethSig", "=", "toEthUtilsSignature", "(", "signatureObject", ")", "try", "{", "var", "isSigValid", "=", "ethUtils", ".", "isValidSign...
verify signature easier handing over the complete signature object containing the signature, recovery and the public key in one object @param {String} message message to verify @param {Object} signatureObject Signature object. must contain recovery (Number), signature and publicKey (both buffers) @param ...
[ "verify", "signature", "easier", "handing", "over", "the", "complete", "signature", "object", "containing", "the", "signature", "recovery", "and", "the", "public", "key", "in", "one", "object" ]
9a838d454f862e674a505a09dd31cef93f727b4f
https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L157-L181
train
cp2017/sign
index.js
function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){ var clonedSignatureObj = { signature: signatureObject.signature, recovery: signatureObject.recovery, publicKey: publicKey } bufferEncoding = getEncodingOrDefault(bufferEncoding...
javascript
function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){ var clonedSignatureObj = { signature: signatureObject.signature, recovery: signatureObject.recovery, publicKey: publicKey } bufferEncoding = getEncodingOrDefault(bufferEncoding...
[ "function", "(", "signatureObject", ",", "publicKey", ",", "bufferEncoding", "=", "DEFAULT_ENCODING", ",", "cb", "=", "null", ")", "{", "var", "clonedSignatureObj", "=", "{", "signature", ":", "signatureObject", ".", "signature", ",", "recovery", ":", "signature...
creates a new object containing the values of the signature object plus the public key, encoded as a base64 string @param {Object} signatureObject the signature object containing signature and recovery @param {Buffer} publicKey the ethereum public key for later signature verification @param {String} buff...
[ "creates", "a", "new", "object", "containing", "the", "values", "of", "the", "signature", "object", "plus", "the", "public", "key", "encoded", "as", "a", "base64", "string" ]
9a838d454f862e674a505a09dd31cef93f727b4f
https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L190-L207
train
cp2017/sign
index.js
function(base64String, bufferEncoding = DEFAULT_ENCODING, cb = null){ bufferEncoding = getEncodingOrDefault(bufferEncoding) var decodedObj = JSON.parse(Buffer.from(base64String, 'base64').toString()) var result = {} if('signature' in decodedObj && 'recovery' in decodedObj){ r...
javascript
function(base64String, bufferEncoding = DEFAULT_ENCODING, cb = null){ bufferEncoding = getEncodingOrDefault(bufferEncoding) var decodedObj = JSON.parse(Buffer.from(base64String, 'base64').toString()) var result = {} if('signature' in decodedObj && 'recovery' in decodedObj){ r...
[ "function", "(", "base64String", ",", "bufferEncoding", "=", "DEFAULT_ENCODING", ",", "cb", "=", "null", ")", "{", "bufferEncoding", "=", "getEncodingOrDefault", "(", "bufferEncoding", ")", "var", "decodedObj", "=", "JSON", ".", "parse", "(", "Buffer", ".", "f...
recover signature object from base64-encoded string @param {String} base64String String to decode @param {String} bufferEncoding encoding for recovering the buffers inside the object @param {Function} cb callback function @return {Object} Signature object recovered from the input s...
[ "recover", "signature", "object", "from", "base64", "-", "encoded", "string" ]
9a838d454f862e674a505a09dd31cef93f727b4f
https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L215-L238
train
webcredits/wc_db
lib/db.js
getConnection
function getConnection (config) { var sequelize var defaultStorage = 'store.db' var logging = config.logging || false if (config.dialect === 'sqlite') { if (!config.storage) { config.storage = defaultStorage } sequelize = new Sequelize(config.database, config.username, config.password, { ...
javascript
function getConnection (config) { var sequelize var defaultStorage = 'store.db' var logging = config.logging || false if (config.dialect === 'sqlite') { if (!config.storage) { config.storage = defaultStorage } sequelize = new Sequelize(config.database, config.username, config.password, { ...
[ "function", "getConnection", "(", "config", ")", "{", "var", "sequelize", "var", "defaultStorage", "=", "'store.db'", "var", "logging", "=", "config", ".", "logging", "||", "false", "if", "(", "config", ".", "dialect", "===", "'sqlite'", ")", "{", "if", "(...
Setup database. @param {Object} config The config object. @param {string} config.dialect The db dialect sqlite | mysql. @param {string} config.host The db host. @param {string} config.database The db database name. @param {string} config.username The db username. @param {string} config.password The ...
[ "Setup", "database", "." ]
a3232a69d31f03da071f6f8a26169ce386b1c231
https://github.com/webcredits/wc_db/blob/a3232a69d31f03da071f6f8a26169ce386b1c231/lib/db.js#L19-L43
train
webcredits/wc_db
lib/db.js
runSQL
function runSQL (sql, config, conn, replacements) { return new Promise(function (resolve, reject) { if (!config && !conn) { reject('Must set config or connection') } if (!sql) { reject('Need some sql') } if (!conn) { conn = getConnection(config) } replacements = replac...
javascript
function runSQL (sql, config, conn, replacements) { return new Promise(function (resolve, reject) { if (!config && !conn) { reject('Must set config or connection') } if (!sql) { reject('Need some sql') } if (!conn) { conn = getConnection(config) } replacements = replac...
[ "function", "runSQL", "(", "sql", ",", "config", ",", "conn", ",", "replacements", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "if", "(", "!", "config", "&&", "!", "conn", ")", "{", "reject", "(", ...
Run SQL as promise @param {string} sql The SQL to run @param {Object} config The config object. @param {string} config.dialect The db dialect sqlite | mysql. @param {string} config.host The db host. @param {string} config.database The db database name. @param {string} config.username The db...
[ "Run", "SQL", "as", "promise" ]
a3232a69d31f03da071f6f8a26169ce386b1c231
https://github.com/webcredits/wc_db/blob/a3232a69d31f03da071f6f8a26169ce386b1c231/lib/db.js#L58-L80
train
commenthol/mergee
index.js
_checkCircular
function _checkCircular (opts, obj) { var key if (util.isObject(obj)) { if (~opts._visited.indexOf(obj)) { return true } opts._visited.push(obj) for (key in obj) { if (obj.hasOwnProperty(key) && _checkCircular(opts, obj[key])) { return true } } } return false }
javascript
function _checkCircular (opts, obj) { var key if (util.isObject(obj)) { if (~opts._visited.indexOf(obj)) { return true } opts._visited.push(obj) for (key in obj) { if (obj.hasOwnProperty(key) && _checkCircular(opts, obj[key])) { return true } } } return false }
[ "function", "_checkCircular", "(", "opts", ",", "obj", ")", "{", "var", "key", "if", "(", "util", ".", "isObject", "(", "obj", ")", ")", "{", "if", "(", "~", "opts", ".", "_visited", ".", "indexOf", "(", "obj", ")", ")", "{", "return", "true", "}...
recursive helper function @api private
[ "recursive", "helper", "function" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L54-L68
train
commenthol/mergee
index.js
merge
function merge () { var args = [].slice.call(arguments) args.unshift({}) return mergeExt.apply(null, args) }
javascript
function merge () { var args = [].slice.call(arguments) args.unshift({}) return mergeExt.apply(null, args) }
[ "function", "merge", "(", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", "args", ".", "unshift", "(", "{", "}", ")", "return", "mergeExt", ".", "apply", "(", "null", ",", "args", ")", "}" ]
merge multiple objects into `target` #### Example ````js var merge = require('mergee').merge, target = { t: 1, x: { y: 'z' } }, source1 = { t: { s1: /source1/ } }, source2 = { t: { s2: new Date(100), x: null } }; merge(target, source1, source2); // target === { t: { s1: /source1/, s2: Wed Dec 31 1969 17:00:00 GMT-07...
[ "merge", "multiple", "objects", "into", "target" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L124-L128
train
commenthol/mergee
index.js
_segment
function _segment (char) { var tmp char = char || '.' return function (k) { if (tmp) { tmp += char + k if (CLOSE.test(k)) { k = tmp tmp = '' } else { return } } else if (OPEN.test(k)) { tmp = k if (CLOSE.test(k)) { tmp = '' } else {...
javascript
function _segment (char) { var tmp char = char || '.' return function (k) { if (tmp) { tmp += char + k if (CLOSE.test(k)) { k = tmp tmp = '' } else { return } } else if (OPEN.test(k)) { tmp = k if (CLOSE.test(k)) { tmp = '' } else {...
[ "function", "_segment", "(", "char", ")", "{", "var", "tmp", "char", "=", "char", "||", "'.'", "return", "function", "(", "k", ")", "{", "if", "(", "tmp", ")", "{", "tmp", "+=", "char", "+", "k", "if", "(", "CLOSE", ".", "test", "(", "k", ")", ...
segment path or properties string @api private @param {String} char - separator char @return {Function}
[ "segment", "path", "or", "properties", "string" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L322-L344
train
commenthol/mergee
index.js
_splitPath
function _splitPath (keys) { var out if (util.isString(keys)) { out = [] keys .split('.') .map(_segment('.')) .forEach(function (k) { k = (k || ' ').trim() .replace(/^([^[]+)\[(["']?)(.+)\2\]$/, function (m, m1, m2, m3) { if (m1 && m3) { out.pus...
javascript
function _splitPath (keys) { var out if (util.isString(keys)) { out = [] keys .split('.') .map(_segment('.')) .forEach(function (k) { k = (k || ' ').trim() .replace(/^([^[]+)\[(["']?)(.+)\2\]$/, function (m, m1, m2, m3) { if (m1 && m3) { out.pus...
[ "function", "_splitPath", "(", "keys", ")", "{", "var", "out", "if", "(", "util", ".", "isString", "(", "keys", ")", ")", "{", "out", "=", "[", "]", "keys", ".", "split", "(", "'.'", ")", ".", "map", "(", "_segment", "(", "'.'", ")", ")", ".", ...
split dot separated String or Array into a property path @private @param {Array|String} keys @return {Object} obj for comparison
[ "split", "dot", "separated", "String", "or", "Array", "into", "a", "property", "path" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L352-L375
train
commenthol/mergee
index.js
_splitProps
function _splitProps (props) { var test = {} if (util.isString(props)) { props = props .split(',') .map(_segment(',')) .filter(function (k) { return k }) } if (util.isArray(props)) { props.forEach(function (key) { test[key] = 1 }) return test } return {...
javascript
function _splitProps (props) { var test = {} if (util.isString(props)) { props = props .split(',') .map(_segment(',')) .filter(function (k) { return k }) } if (util.isArray(props)) { props.forEach(function (key) { test[key] = 1 }) return test } return {...
[ "function", "_splitProps", "(", "props", ")", "{", "var", "test", "=", "{", "}", "if", "(", "util", ".", "isString", "(", "props", ")", ")", "{", "props", "=", "props", ".", "split", "(", "','", ")", ".", "map", "(", "_segment", "(", "','", ")", ...
split comma separated String or Array into a test hash @private @param {Array|String} keys @return {Object} obj for comparison
[ "split", "comma", "separated", "String", "or", "Array", "into", "a", "test", "hash" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L384-L402
train
commenthol/mergee
index.js
pick
function pick (obj, props) { var key var val var out var test = _splitProps(props) if (util.isObject(obj)) { out = {} for (key in test) { val = get(obj, key) if (val !== undefined && val !== null) { set(out, key, val) } } } return out }
javascript
function pick (obj, props) { var key var val var out var test = _splitProps(props) if (util.isObject(obj)) { out = {} for (key in test) { val = get(obj, key) if (val !== undefined && val !== null) { set(out, key, val) } } } return out }
[ "function", "pick", "(", "obj", ",", "props", ")", "{", "var", "key", "var", "val", "var", "out", "var", "test", "=", "_splitProps", "(", "props", ")", "if", "(", "util", ".", "isObject", "(", "obj", ")", ")", "{", "out", "=", "{", "}", "for", ...
pick properties from `obj` into a new object #### Example ```js var r, pick = require('mergee').pick, obj = { a: 1, b: [ 1, 2 ], c: { cc:3, 'c-d':4 }, '0d': { '0d0': 5 } }; r = pick(obj, ['a', 'b[1]', 'c["c-d"]', '0d.0d0']); //> r = { a: 1, b: { '1': 2 }, c: { 'c-d': 4 }, '0d': { '0d0': 5 } } r = pick(obj, 'a, b[1], ...
[ "pick", "properties", "from", "obj", "into", "a", "new", "object" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L424-L440
train
commenthol/mergee
index.js
omit
function omit (obj, props) { var key var out var test = _splitProps(props) if (util.isObject(obj)) { out = clone(obj) for (key in test) { if ((get(obj, key))) { set(out, key, null) } } } return out }
javascript
function omit (obj, props) { var key var out var test = _splitProps(props) if (util.isObject(obj)) { out = clone(obj) for (key in test) { if ((get(obj, key))) { set(out, key, null) } } } return out }
[ "function", "omit", "(", "obj", ",", "props", ")", "{", "var", "key", "var", "out", "var", "test", "=", "_splitProps", "(", "props", ")", "if", "(", "util", ".", "isObject", "(", "obj", ")", ")", "{", "out", "=", "clone", "(", "obj", ")", "for", ...
omit properties from `obj` into a new object #### Example ```js var r, omit = require('mergee').omit, obj = { a: 1, b: [ 1, 2 ], c: { cc:3, 'c-d':4 }, '0d': { '0d0': 5 } }; r = omit(obj, ['a', 'b[1]', 'c["c-d"]', '0d.0d0']); // r = { b: [ 1, ], c: { cc: 3 }, '0d': {} } r = omit(obj, 'a, b[1], c["c-d"], 0d.0d0'); // ...
[ "omit", "properties", "from", "obj", "into", "a", "new", "object" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L462-L476
train
commenthol/mergee
index.js
get
function get (obj, keys, _default) { var i var key var tmp = obj || {} keys = _splitPath(keys) if (!keys || keys.length === 0) { return _default } for (i = 0; i < keys.length; i++) { key = keys[i] if (tmp && tmp.hasOwnProperty(key)) { tmp = tmp[key] } else { return _default ...
javascript
function get (obj, keys, _default) { var i var key var tmp = obj || {} keys = _splitPath(keys) if (!keys || keys.length === 0) { return _default } for (i = 0; i < keys.length; i++) { key = keys[i] if (tmp && tmp.hasOwnProperty(key)) { tmp = tmp[key] } else { return _default ...
[ "function", "get", "(", "obj", ",", "keys", ",", "_default", ")", "{", "var", "i", "var", "key", "var", "tmp", "=", "obj", "||", "{", "}", "keys", "=", "_splitPath", "(", "keys", ")", "if", "(", "!", "keys", "||", "keys", ".", "length", "===", ...
get properties from `obj` #### Example ```js var r, get = require('mergee').get, obj = { a: { b: { c: 1 } } }; r = get(obj, ['a', 'b', 'c']); // r = 1 r = get(obj, 'a.b'); // r = { c: 1 } r = get(obj, 'there.is.no.such.property'); // this will not throw! // r = undefined ``` @param {Object} obj - object to select f...
[ "get", "properties", "from", "obj" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L501-L521
train
commenthol/mergee
index.js
set
function set (obj, keys, value) { var i var key var last var tmp = obj || {} keys = _splitPath(keys) if (!keys || keys.length === 0) { return } last = keys.pop() for (i = 0; i < keys.length; i++) { key = keys[i] if (!tmp[key]) { tmp[key] = {} } if (tmp.hasOwnProperty(key)...
javascript
function set (obj, keys, value) { var i var key var last var tmp = obj || {} keys = _splitPath(keys) if (!keys || keys.length === 0) { return } last = keys.pop() for (i = 0; i < keys.length; i++) { key = keys[i] if (!tmp[key]) { tmp[key] = {} } if (tmp.hasOwnProperty(key)...
[ "function", "set", "(", "obj", ",", "keys", ",", "value", ")", "{", "var", "i", "var", "key", "var", "last", "var", "tmp", "=", "obj", "||", "{", "}", "keys", "=", "_splitPath", "(", "keys", ")", "if", "(", "!", "keys", "||", "keys", ".", "leng...
set a property in `obj` #### Example ```js var r, set = require('mergee').set, obj = {}; r = set(obj, ['a', 'b'], { c:1 }); //> r = { a: { b: { c: 1 } } } r = set(obj, 'a.b.d', 2); //> r = { a: { b: { c:1, d:2 } } } ``` @param {Object} obj - object to select from @param {Array|String} keys - Array of properties or d...
[ "set", "a", "property", "in", "obj" ]
a4c42223b59b184c8a3034c0be49f0067634ac71
https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L550-L579
train
rowanmanning/chic-event
lib/chic-event.js
arrayIndexOf
function arrayIndexOf (array, val) { // Use native indexOf if (Array.prototype.indexOf) { return array.indexOf(val); } // Use loop/if for environments without native indexOf var i, len = array.length; for (i = 0; i < len; len += 1) { if (array[i]...
javascript
function arrayIndexOf (array, val) { // Use native indexOf if (Array.prototype.indexOf) { return array.indexOf(val); } // Use loop/if for environments without native indexOf var i, len = array.length; for (i = 0; i < len; len += 1) { if (array[i]...
[ "function", "arrayIndexOf", "(", "array", ",", "val", ")", "{", "// Use native indexOf", "if", "(", "Array", ".", "prototype", ".", "indexOf", ")", "{", "return", "array", ".", "indexOf", "(", "val", ")", ";", "}", "// Use loop/if for environments without native...
Utilities Get the index of the first instance of a value in an array
[ "Utilities", "Get", "the", "index", "of", "the", "first", "instance", "of", "a", "value", "in", "an", "array" ]
0911e4211be2615ddb06a797e0fe57480cf06972
https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L21-L37
train
rowanmanning/chic-event
lib/chic-event.js
function (type, handler) { // Validate arguments if (typeof type !== 'string') { throw new Error('Type must be a string'); } if (typeof handler !== 'function') { throw new Error('Handler must be a function'); } // ...
javascript
function (type, handler) { // Validate arguments if (typeof type !== 'string') { throw new Error('Type must be a string'); } if (typeof handler !== 'function') { throw new Error('Handler must be a function'); } // ...
[ "function", "(", "type", ",", "handler", ")", "{", "// Validate arguments", "if", "(", "typeof", "type", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Type must be a string'", ")", ";", "}", "if", "(", "typeof", "handler", "!==", "'function'",...
Bind a handler to an event
[ "Bind", "a", "handler", "to", "an", "event" ]
0911e4211be2615ddb06a797e0fe57480cf06972
https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L70-L91
train
rowanmanning/chic-event
lib/chic-event.js
function (type, handler) { // Validate arguments if (typeof type !== 'undefined' && typeof type !== 'string') { throw new Error('Type must be a string or undefined'); } if (typeof handler !== 'undefined' && typeof handler !== 'function') { ...
javascript
function (type, handler) { // Validate arguments if (typeof type !== 'undefined' && typeof type !== 'string') { throw new Error('Type must be a string or undefined'); } if (typeof handler !== 'undefined' && typeof handler !== 'function') { ...
[ "function", "(", "type", ",", "handler", ")", "{", "// Validate arguments", "if", "(", "typeof", "type", "!==", "'undefined'", "&&", "typeof", "type", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Type must be a string or undefined'", ")", ";", ...
Unbind handlers from events
[ "Unbind", "handlers", "from", "events" ]
0911e4211be2615ddb06a797e0fe57480cf06972
https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L94-L129
train
rowanmanning/chic-event
lib/chic-event.js
function (type, event) { // Validate arguments if (typeof type !== 'string') { throw new Error('Type must be a string'); } // Check for presence of event store if (!this._events || !this._events[type]) { return; } // Get handlers...
javascript
function (type, event) { // Validate arguments if (typeof type !== 'string') { throw new Error('Type must be a string'); } // Check for presence of event store if (!this._events || !this._events[type]) { return; } // Get handlers...
[ "function", "(", "type", ",", "event", ")", "{", "// Validate arguments", "if", "(", "typeof", "type", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Type must be a string'", ")", ";", "}", "// Check for presence of event store", "if", "(", "!", ...
Emit an event
[ "Emit", "an", "event" ]
0911e4211be2615ddb06a797e0fe57480cf06972
https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L132-L164
train
doowb/macro-store
lib/store.js
Store
function Store(options) { if (!(this instanceof Store)) { return new Store(options); } if (typeof options === 'string') { options = { name: options }; } options = options || {}; var name = options.name || 'macros'; this.store = options.store || new utils.Store(name); }
javascript
function Store(options) { if (!(this instanceof Store)) { return new Store(options); } if (typeof options === 'string') { options = { name: options }; } options = options || {}; var name = options.name || 'macros'; this.store = options.store || new utils.Store(name); }
[ "function", "Store", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Store", ")", ")", "{", "return", "new", "Store", "(", "options", ")", ";", "}", "if", "(", "typeof", "options", "===", "'string'", ")", "{", "options", "=", ...
Initialize a new `Store` with the given `options`. ```js var macroStore = new Store(); //=> '~/data-store/macros.json' var macroStore = new Store({name: 'abc'}); //=> '~/data-store/abc.json' ``` @param {Object} `options` @param {String} `options.name` Name of the json file to use for storing macros. Defaults to 'ma...
[ "Initialize", "a", "new", "Store", "with", "the", "given", "options", "." ]
29cb4f578e162aab5acedc72a313d97694d58a33
https://github.com/doowb/macro-store/blob/29cb4f578e162aab5acedc72a313d97694d58a33/lib/store.js#L30-L41
train
milojs/ml-mixin
lib/mixin.js
_createProxyMethod
function _createProxyMethod(proxyMethodName, mixinMethodName, hostObject) { hostObject = hostObject || this._hostObject; // Mixin class does not allow shadowing methods that exist on the host object if (hostObject[proxyMethodName]) throw new Error('method ' + proxyMethodName + ...
javascript
function _createProxyMethod(proxyMethodName, mixinMethodName, hostObject) { hostObject = hostObject || this._hostObject; // Mixin class does not allow shadowing methods that exist on the host object if (hostObject[proxyMethodName]) throw new Error('method ' + proxyMethodName + ...
[ "function", "_createProxyMethod", "(", "proxyMethodName", ",", "mixinMethodName", ",", "hostObject", ")", "{", "hostObject", "=", "hostObject", "||", "this", ".", "_hostObject", ";", "// Mixin class does not allow shadowing methods that exist on the host object", "if", "(", ...
Creates a proxied method of Mixin subclass on host object. @param {String} mixinMethodName name of method in Mixin subclass @param {String} proxyMethodName name of created proxy method on host object @param {Object} hostObject Optional reference to the host object; if not specified the host object passed to constructo...
[ "Creates", "a", "proxied", "method", "of", "Mixin", "subclass", "on", "host", "object", "." ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L69-L89
train
milojs/ml-mixin
lib/mixin.js
_createProxyMethods
function _createProxyMethods(proxyMethods, hostObject) { check(proxyMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String)))); // creating and binding proxy methods on the host object if (Array.isArray(proxyMethods)) proxyMethods.forEach(function(methodName) { // method ...
javascript
function _createProxyMethods(proxyMethods, hostObject) { check(proxyMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String)))); // creating and binding proxy methods on the host object if (Array.isArray(proxyMethods)) proxyMethods.forEach(function(methodName) { // method ...
[ "function", "_createProxyMethods", "(", "proxyMethods", ",", "hostObject", ")", "{", "check", "(", "proxyMethods", ",", "Match", ".", "Optional", "(", "Match", ".", "OneOf", "(", "[", "String", "]", ",", "Match", ".", "ObjectHash", "(", "String", ")", ")",...
Creates proxied methods of Mixin subclass on host object. @param {Hash[String]|Array[String]} proxyMethods map of names of methods, key - proxy method name, value - mixin method name. Can be array. @param {Object} hostObject an optional reference to the host object; if not specified the host object passed to construct...
[ "Creates", "proxied", "methods", "of", "Mixin", "subclass", "on", "host", "object", "." ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L98-L117
train
milojs/ml-mixin
lib/mixin.js
Mixin_setInstanceKey
function Mixin_setInstanceKey(hostClass, method, instanceKey) { check(hostClass, Function); check(instanceKey, Match.IdentifierString); var prop = INSTANCE_PROPERTIES_MAP, instanceKeys = hostClass[prop] = hostClass[prop] || {}; if (instanceKeys[method.name]) throw new Error('Mixin: ins...
javascript
function Mixin_setInstanceKey(hostClass, method, instanceKey) { check(hostClass, Function); check(instanceKey, Match.IdentifierString); var prop = INSTANCE_PROPERTIES_MAP, instanceKeys = hostClass[prop] = hostClass[prop] || {}; if (instanceKeys[method.name]) throw new Error('Mixin: ins...
[ "function", "Mixin_setInstanceKey", "(", "hostClass", ",", "method", ",", "instanceKey", ")", "{", "check", "(", "hostClass", ",", "Function", ")", ";", "check", "(", "instanceKey", ",", "Match", ".", "IdentifierString", ")", ";", "var", "prop", "=", "INSTAN...
Sets mixin instance property name on the host class Can be called only once @private @param {Function} this Mixin subclass (not instance) @param {Function} hostClass @param {String} instanceKey
[ "Sets", "mixin", "instance", "property", "name", "on", "the", "host", "class", "Can", "be", "called", "only", "once" ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L129-L141
train
milojs/ml-mixin
lib/mixin.js
Mixin_addMethod
function Mixin_addMethod(hostClass, instanceKey, mixinMethodName, hostMethodName) { var method = this.prototype[mixinMethodName]; check(method, Function); var wrappedMethod = _wrapMixinMethod.call(this, method); Object.defineProperty(hostClass.prototype, hostMethodName, { value: wrappedMethod,...
javascript
function Mixin_addMethod(hostClass, instanceKey, mixinMethodName, hostMethodName) { var method = this.prototype[mixinMethodName]; check(method, Function); var wrappedMethod = _wrapMixinMethod.call(this, method); Object.defineProperty(hostClass.prototype, hostMethodName, { value: wrappedMethod,...
[ "function", "Mixin_addMethod", "(", "hostClass", ",", "instanceKey", ",", "mixinMethodName", ",", "hostMethodName", ")", "{", "var", "method", "=", "this", ".", "prototype", "[", "mixinMethodName", "]", ";", "check", "(", "method", ",", "Function", ")", ";", ...
Adds method of Mixin subclass to host class prototype. @private @param {Function} this Mixin subclass (not instance) @param {String} mixinMethodName name of method in Mixin subclass @param {String} hostMethodName (optional) name of created proxy method on host object, same if not specified @param {Object} hostObject o...
[ "Adds", "method", "of", "Mixin", "subclass", "to", "host", "class", "prototype", "." ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L153-L167
train
milojs/ml-mixin
lib/mixin.js
_wrapMixinMethod
function _wrapMixinMethod(method) { return function() { // ,... arguments var mixinInstance = _getMixinInstance.call(this, method.name); return method.apply(mixinInstance || this, arguments); }; }
javascript
function _wrapMixinMethod(method) { return function() { // ,... arguments var mixinInstance = _getMixinInstance.call(this, method.name); return method.apply(mixinInstance || this, arguments); }; }
[ "function", "_wrapMixinMethod", "(", "method", ")", "{", "return", "function", "(", ")", "{", "// ,... arguments", "var", "mixinInstance", "=", "_getMixinInstance", ".", "call", "(", "this", ",", "method", ".", "name", ")", ";", "return", "method", ".", "app...
Returns method that will be exposed on the host class prototype @private @param {Function} this Mixin subclass (not instance) @return {Function}
[ "Returns", "method", "that", "will", "be", "exposed", "on", "the", "host", "class", "prototype" ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L177-L182
train
milojs/ml-mixin
lib/mixin.js
Mixin$$useWith
function Mixin$$useWith(hostClass, instanceKey, mixinMethods) { check(mixinMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String)))); if (Array.isArray(mixinMethods)) { mixinMethods.forEach(function(methodName) { Mixin_addMethod.call(this, hostClass, instanceKey, methodName,...
javascript
function Mixin$$useWith(hostClass, instanceKey, mixinMethods) { check(mixinMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String)))); if (Array.isArray(mixinMethods)) { mixinMethods.forEach(function(methodName) { Mixin_addMethod.call(this, hostClass, instanceKey, methodName,...
[ "function", "Mixin$$useWith", "(", "hostClass", ",", "instanceKey", ",", "mixinMethods", ")", "{", "check", "(", "mixinMethods", ",", "Match", ".", "Optional", "(", "Match", ".", "OneOf", "(", "[", "String", "]", ",", "Match", ".", "ObjectHash", "(", "Stri...
Adds methods of Mixin subclass to host class prototype. @param {Function} this Mixin subclass (not instance) @param {Object} hostClass host object class; must be specified. @param {String} instanceKey the name of the property the host class instance will store mixin instance on @param {Hash[String]|Array[String]} mixi...
[ "Adds", "methods", "of", "Mixin", "subclass", "to", "host", "class", "prototype", "." ]
7e6d220d8c8bdd598969edcbbc8886da644b7a24
https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L212-L227
train
mistyjae/nd-utils
src/lib/autobind.js
boundClass
function boundClass(target) { // (Using reflect to get all keys including symbols) let keys // Use Reflect if exists if (typeof Reflect !== 'undefined' && typeof Reflect.ownKeys === 'function') { keys = Reflect.ownKeys(target.prototype) } else { keys = Object.getOwnPropertyNames(targ...
javascript
function boundClass(target) { // (Using reflect to get all keys including symbols) let keys // Use Reflect if exists if (typeof Reflect !== 'undefined' && typeof Reflect.ownKeys === 'function') { keys = Reflect.ownKeys(target.prototype) } else { keys = Object.getOwnPropertyNames(targ...
[ "function", "boundClass", "(", "target", ")", "{", "// (Using reflect to get all keys including symbols)", "let", "keys", "// Use Reflect if exists", "if", "(", "typeof", "Reflect", "!==", "'undefined'", "&&", "typeof", "Reflect", ".", "ownKeys", "===", "'function'", ")...
Use boundMethod to bind all methods on the target.prototype
[ "Use", "boundMethod", "to", "bind", "all", "methods", "on", "the", "target", ".", "prototype" ]
43d7219ed3fe3b93cd6e01cb52afd28048fb8ea5
https://github.com/mistyjae/nd-utils/blob/43d7219ed3fe3b93cd6e01cb52afd28048fb8ea5/src/lib/autobind.js#L28-L56
train
mistyjae/nd-utils
src/lib/autobind.js
boundMethod
function boundMethod(target, key, descriptor) { // console.log('target, key, descriptor', target, key, descriptor) let fn = descriptor.value if (typeof fn !== 'function') { throw new Error(`@autobind decorator can only be applied to methods not: ${typeof fn}`) } // In IE11 calling Object.d...
javascript
function boundMethod(target, key, descriptor) { // console.log('target, key, descriptor', target, key, descriptor) let fn = descriptor.value if (typeof fn !== 'function') { throw new Error(`@autobind decorator can only be applied to methods not: ${typeof fn}`) } // In IE11 calling Object.d...
[ "function", "boundMethod", "(", "target", ",", "key", ",", "descriptor", ")", "{", "// console.log('target, key, descriptor', target, key, descriptor)", "let", "fn", "=", "descriptor", ".", "value", "if", "(", "typeof", "fn", "!==", "'function'", ")", "{", "throw", ...
Return a descriptor removing the value and returning a getter The getter will return a .bind version of the function and memoize the result against a symbol on the instance
[ "Return", "a", "descriptor", "removing", "the", "value", "and", "returning", "a", "getter", "The", "getter", "will", "return", "a", ".", "bind", "version", "of", "the", "function", "and", "memoize", "the", "result", "against", "a", "symbol", "on", "the", "...
43d7219ed3fe3b93cd6e01cb52afd28048fb8ea5
https://github.com/mistyjae/nd-utils/blob/43d7219ed3fe3b93cd6e01cb52afd28048fb8ea5/src/lib/autobind.js#L63-L103
train
byron-dupreez/aws-stream-consumer-core
stream-processing.js
configureStreamProcessingWithSettings
function configureStreamProcessingWithSettings(context, settings, standardSettings, standardOptions, event, awsContext, forceConfiguration, validateConfiguration) { // Configure all of the stream processing dependencies if not configured by configuring the given context as a // standard context with stage handli...
javascript
function configureStreamProcessingWithSettings(context, settings, standardSettings, standardOptions, event, awsContext, forceConfiguration, validateConfiguration) { // Configure all of the stream processing dependencies if not configured by configuring the given context as a // standard context with stage handli...
[ "function", "configureStreamProcessingWithSettings", "(", "context", ",", "settings", ",", "standardSettings", ",", "standardOptions", ",", "event", ",", "awsContext", ",", "forceConfiguration", ",", "validateConfiguration", ")", "{", "// Configure all of the stream processin...
Configures the given context with the given stream processing settings, but only if stream processing is not already configured on the given context OR if forceConfiguration is true, and with the given standard settings and options. Note that if either the given event or AWS context are undefined, then everything othe...
[ "Configures", "the", "given", "context", "with", "the", "given", "stream", "processing", "settings", "but", "only", "if", "stream", "processing", "is", "not", "already", "configured", "on", "the", "given", "context", "OR", "if", "forceConfiguration", "is", "true...
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/stream-processing.js#L118-L162
train
byron-dupreez/aws-stream-consumer-core
stream-processing.js
useStreamEventRecordAsMessage
function useStreamEventRecordAsMessage(record, batch, extractMessageFromRecord, context) { if (!record || typeof record !== 'object') { context.warn(`Adding invalid record (${record}) as an unusable record`); return Promise.resolve([{unusableRec: batch.addUnusableRecord(record, undefined, `invalid record (${r...
javascript
function useStreamEventRecordAsMessage(record, batch, extractMessageFromRecord, context) { if (!record || typeof record !== 'object') { context.warn(`Adding invalid record (${record}) as an unusable record`); return Promise.resolve([{unusableRec: batch.addUnusableRecord(record, undefined, `invalid record (${r...
[ "function", "useStreamEventRecordAsMessage", "(", "record", ",", "batch", ",", "extractMessageFromRecord", ",", "context", ")", "{", "if", "(", "!", "record", "||", "typeof", "record", "!==", "'object'", ")", "{", "context", ".", "warn", "(", "`", "${", "rec...
noinspection JSUnusedLocalSymbols A default `extractMessagesFromRecord` function that uses a copy of the given stream event record as the message object & adds the message, rejected message or unusable record to the given batch. @see ExtractMessagesFromRecord @param {StreamEventRecord} record - a stream event record @...
[ "noinspection", "JSUnusedLocalSymbols", "A", "default", "extractMessagesFromRecord", "function", "that", "uses", "a", "copy", "of", "the", "given", "stream", "event", "record", "as", "the", "message", "object", "&", "adds", "the", "message", "rejected", "message", ...
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/stream-processing.js#L275-L292
train
byron-dupreez/aws-stream-consumer-core
stream-processing.js
disableSourceStreamEventSourceMapping
function disableSourceStreamEventSourceMapping(batch, context) { const functionName = tracking.getInvokedFunctionNameWithAliasOrVersion(context); const batchKey = batch.key; const sourceStreamName = (batchKey && batchKey.components && batchKey.components.streamName) || (tracking.getSourceStreamNames(batch.re...
javascript
function disableSourceStreamEventSourceMapping(batch, context) { const functionName = tracking.getInvokedFunctionNameWithAliasOrVersion(context); const batchKey = batch.key; const sourceStreamName = (batchKey && batchKey.components && batchKey.components.streamName) || (tracking.getSourceStreamNames(batch.re...
[ "function", "disableSourceStreamEventSourceMapping", "(", "batch", ",", "context", ")", "{", "const", "functionName", "=", "tracking", ".", "getInvokedFunctionNameWithAliasOrVersion", "(", "context", ")", ";", "const", "batchKey", "=", "batch", ".", "key", ";", "con...
Attempts to disable this Lambda's event source mapping to its source stream, which will disable this Lambda's trigger and prevent it from processing any more messages until the issue is resolved and the trigger is manually re-enabled. @param {Batch} batch @param {LambdaAware|StreamConsumerContext} context @returns {Pro...
[ "Attempts", "to", "disable", "this", "Lambda", "s", "event", "source", "mapping", "to", "its", "source", "stream", "which", "will", "disable", "this", "Lambda", "s", "trigger", "and", "prevent", "it", "from", "processing", "any", "more", "messages", "until", ...
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/stream-processing.js#L416-L432
train
ibm-bluemix-mobile-services/bms-monitoring-sdk-node
event-buffer-factory.js
sendEvents
function sendEvents() { logger.logEnter('sendEvents with eventCount ' + eventCount); if (eventCount > 0) { // If there are fewer than 10 events, we wait for more to arrive // before sending them. Only delay sending them once so they // don't get too old. if (eventCount < 10 && canDel...
javascript
function sendEvents() { logger.logEnter('sendEvents with eventCount ' + eventCount); if (eventCount > 0) { // If there are fewer than 10 events, we wait for more to arrive // before sending them. Only delay sending them once so they // don't get too old. if (eventCount < 10 && canDel...
[ "function", "sendEvents", "(", ")", "{", "logger", ".", "logEnter", "(", "'sendEvents with eventCount '", "+", "eventCount", ")", ";", "if", "(", "eventCount", ">", "0", ")", "{", "// If there are fewer than 10 events, we wait for more to arrive", "// before sending them....
This function will run every so often to send the buffered events to Elasticsearch.
[ "This", "function", "will", "run", "every", "so", "often", "to", "send", "the", "buffered", "events", "to", "Elasticsearch", "." ]
5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9
https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/event-buffer-factory.js#L42-L195
train
ibm-bluemix-mobile-services/bms-monitoring-sdk-node
event-buffer-factory.js
validate
function validate() { logger.logEnter('validate'); for (var i = 0; i < buffer.length; i++) { var eventData = buffer[i], typeName = eventData[0], typeKeys = eventTypes[typeName]; if (!typeKeys) { emitter.emit('error', typeName + ' is not a known event type.'); //...
javascript
function validate() { logger.logEnter('validate'); for (var i = 0; i < buffer.length; i++) { var eventData = buffer[i], typeName = eventData[0], typeKeys = eventTypes[typeName]; if (!typeKeys) { emitter.emit('error', typeName + ' is not a known event type.'); //...
[ "function", "validate", "(", ")", "{", "logger", ".", "logEnter", "(", "'validate'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "buffer", ".", "length", ";", "i", "++", ")", "{", "var", "eventData", "=", "buffer", "[", "i", "]", ...
Verifies that every event's type exists and it has the proper fields. Any invalid events are not sent to Elasticsearch, and an error is emitted for each.
[ "Verifies", "that", "every", "event", "s", "type", "exists", "and", "it", "has", "the", "proper", "fields", ".", "Any", "invalid", "events", "are", "not", "sent", "to", "Elasticsearch", "and", "an", "error", "is", "emitted", "for", "each", "." ]
5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9
https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/event-buffer-factory.js#L265-L306
train
ibm-bluemix-mobile-services/bms-monitoring-sdk-node
event-buffer-factory.js
validEvent
function validEvent(eventKeys, typeKeys, emitter, typeName) { if (eventKeys.length > typeKeys.length) { emitter.emit('error', 'An event has more properties than its type, ' + typeName + '. Event properties: [' + eventKeys + ']. ' + typeName + ' properties: [' + typeKeys + '].'); return false; ...
javascript
function validEvent(eventKeys, typeKeys, emitter, typeName) { if (eventKeys.length > typeKeys.length) { emitter.emit('error', 'An event has more properties than its type, ' + typeName + '. Event properties: [' + eventKeys + ']. ' + typeName + ' properties: [' + typeKeys + '].'); return false; ...
[ "function", "validEvent", "(", "eventKeys", ",", "typeKeys", ",", "emitter", ",", "typeName", ")", "{", "if", "(", "eventKeys", ".", "length", ">", "typeKeys", ".", "length", ")", "{", "emitter", ".", "emit", "(", "'error'", ",", "'An event has more properti...
Returns true if every element of eventKeys is in typeKeys.
[ "Returns", "true", "if", "every", "element", "of", "eventKeys", "is", "in", "typeKeys", "." ]
5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9
https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/event-buffer-factory.js#L309-L326
train
ibm-bluemix-mobile-services/bms-monitoring-sdk-node
event-buffer-factory.js
createLogRequest
function createLogRequest(logger, utils, path, environment, emitter, failureCallback) { 'use strict'; logger.logEnter('createLogRequest ' + path); var options = environment.elasticsearchOptions('POST', path); var respConsumer = utils.responseConsumer(logger, 'after posting events', 200, failureCallback ? fa...
javascript
function createLogRequest(logger, utils, path, environment, emitter, failureCallback) { 'use strict'; logger.logEnter('createLogRequest ' + path); var options = environment.elasticsearchOptions('POST', path); var respConsumer = utils.responseConsumer(logger, 'after posting events', 200, failureCallback ? fa...
[ "function", "createLogRequest", "(", "logger", ",", "utils", ",", "path", ",", "environment", ",", "emitter", ",", "failureCallback", ")", "{", "'use strict'", ";", "logger", ".", "logEnter", "(", "'createLogRequest '", "+", "path", ")", ";", "var", "options",...
Creates and initializes a request object for POSTing to Elasticsearch.
[ "Creates", "and", "initializes", "a", "request", "object", "for", "POSTing", "to", "Elasticsearch", "." ]
5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9
https://github.com/ibm-bluemix-mobile-services/bms-monitoring-sdk-node/blob/5b26fbd3b8adacb3fa9f4a0cbd60c8eae1a44df9/event-buffer-factory.js#L334-L355
train
vkiding/judpack-lib
src/util/npm-helper.js
fetchPackage
function fetchPackage(packageName, packageVersion) { // Get the latest matching version from NPM if a version range is specified return JudMarket.info(packageName).then(function(data){ //todo Market-Injection return util.getLatestMatchingNpmVersion(data.fullname, packageVersion).then( functi...
javascript
function fetchPackage(packageName, packageVersion) { // Get the latest matching version from NPM if a version range is specified return JudMarket.info(packageName).then(function(data){ //todo Market-Injection return util.getLatestMatchingNpmVersion(data.fullname, packageVersion).then( functi...
[ "function", "fetchPackage", "(", "packageName", ",", "packageVersion", ")", "{", "// Get the latest matching version from NPM if a version range is specified", "return", "JudMarket", ".", "info", "(", "packageName", ")", ".", "then", "(", "function", "(", "data", ")", "...
Fetches the latest version of a package from NPM that matches the specified version. Returns a promise that resolves to the directory the NPM package is located in. @param packageName - name of an npm package @param packageVersion - requested version or version range
[ "Fetches", "the", "latest", "version", "of", "a", "package", "from", "NPM", "that", "matches", "the", "specified", "version", ".", "Returns", "a", "promise", "that", "resolves", "to", "the", "directory", "the", "NPM", "package", "is", "located", "in", "." ]
8657cecfec68221109279106adca8dbc81f430f4
https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/util/npm-helper.js#L84-L94
train
vkiding/judpack-lib
src/util/npm-helper.js
cachePackage
function cachePackage(packageName, packageVersion) { //todo Market-Injection // WEEK_HOOK if(packageName !== "judpack-android" && packageName !== "judpack-ios") { packageName = JudMarket.info(packageName) } else { packageName = { fullname: packageName} } return Q(packageName).then(function (d...
javascript
function cachePackage(packageName, packageVersion) { //todo Market-Injection // WEEK_HOOK if(packageName !== "judpack-android" && packageName !== "judpack-ios") { packageName = JudMarket.info(packageName) } else { packageName = { fullname: packageName} } return Q(packageName).then(function (d...
[ "function", "cachePackage", "(", "packageName", ",", "packageVersion", ")", "{", "//todo Market-Injection", "// WEEK_HOOK", "if", "(", "packageName", "!==", "\"judpack-android\"", "&&", "packageName", "!==", "\"judpack-ios\"", ")", "{", "packageName", "=", "JudMarket", ...
Invokes "npm cache add," and then returns a promise that resolves to a directory containing the downloaded, or cached package. @param packageName - name of an npm package @param packageVersion - requested version (not a version range)
[ "Invokes", "npm", "cache", "add", "and", "then", "returns", "a", "promise", "that", "resolves", "to", "a", "directory", "containing", "the", "downloaded", "or", "cached", "package", "." ]
8657cecfec68221109279106adca8dbc81f430f4
https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/util/npm-helper.js#L102-L146
train
arjunmehta/node-protogram
main.js
evalRequiredError
function evalRequiredError(condition, required, type, name) { if (condition) { return new Error('Required argument <' + required + '> missing for ' + type + ': \'' + name + '\''); } return null; }
javascript
function evalRequiredError(condition, required, type, name) { if (condition) { return new Error('Required argument <' + required + '> missing for ' + type + ': \'' + name + '\''); } return null; }
[ "function", "evalRequiredError", "(", "condition", ",", "required", ",", "type", ",", "name", ")", "{", "if", "(", "condition", ")", "{", "return", "new", "Error", "(", "'Required argument <'", "+", "required", "+", "'> missing for '", "+", "type", "+", "': ...
Core Helper Methods
[ "Core", "Helper", "Methods" ]
9769c735adb51b61dcb029bfdaf4b9bbe1c2d66a
https://github.com/arjunmehta/node-protogram/blob/9769c735adb51b61dcb029bfdaf4b9bbe1c2d66a/main.js#L230-L235
train
imrefazekas/socket-services
lib/SocketServices.js
SocketServices
function SocketServices( options ){ options = options || {}; var self = this; this.logger = Logger.createLogger( 'socket', {'socket-services': VERSION}, options.logger ); self.server = options.server || { }; this.messageValidator = options.messageValidator || isCommunication; this.channel = options.channel |...
javascript
function SocketServices( options ){ options = options || {}; var self = this; this.logger = Logger.createLogger( 'socket', {'socket-services': VERSION}, options.logger ); self.server = options.server || { }; this.messageValidator = options.messageValidator || isCommunication; this.channel = options.channel |...
[ "function", "SocketServices", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "self", "=", "this", ";", "this", ".", "logger", "=", "Logger", ".", "createLogger", "(", "'socket'", ",", "{", "'socket-services'", ":", "VERS...
Creates the SocketServices instance
[ "Creates", "the", "SocketServices", "instance" ]
cc81e87ed9fbc13836adac66009183390a90624c
https://github.com/imrefazekas/socket-services/blob/cc81e87ed9fbc13836adac66009183390a90624c/lib/SocketServices.js#L16-L35
train
hupe1980/firebase-sagas
src/sagas/authModule.js
createOnAuthStateChangedChannel
function createOnAuthStateChangedChannel() { const auth = this.app.auth(); const channel = eventChannel(emit => auth.onAuthStateChanged(user => emit({ user })), ); return channel; }
javascript
function createOnAuthStateChangedChannel() { const auth = this.app.auth(); const channel = eventChannel(emit => auth.onAuthStateChanged(user => emit({ user })), ); return channel; }
[ "function", "createOnAuthStateChangedChannel", "(", ")", "{", "const", "auth", "=", "this", ".", "app", ".", "auth", "(", ")", ";", "const", "channel", "=", "eventChannel", "(", "emit", "=>", "auth", ".", "onAuthStateChanged", "(", "user", "=>", "emit", "(...
Creates channel that will subscribe to changes to the user's sign-in state. @returns {eventChannel} onAuthStateChangedChannel
[ "Creates", "channel", "that", "will", "subscribe", "to", "changes", "to", "the", "user", "s", "sign", "-", "in", "state", "." ]
030321ee9ceff80edaa3ac0cb2444cff9c90489f
https://github.com/hupe1980/firebase-sagas/blob/030321ee9ceff80edaa3ac0cb2444cff9c90489f/src/sagas/authModule.js#L139-L145
train
Nazariglez/perenquen
lib/pixi/src/filters/dropshadow/DropShadowFilter.js
DropShadowFilter
function DropShadowFilter() { core.AbstractFilter.call(this); this.blurXFilter = new BlurXFilter(); this.blurYTintFilter = new BlurYTintFilter(); this.defaultFilter = new core.AbstractFilter(); this.padding = 30; this._dirtyPosition = true; this._angle = 45 * Math.PI / 180; this._dis...
javascript
function DropShadowFilter() { core.AbstractFilter.call(this); this.blurXFilter = new BlurXFilter(); this.blurYTintFilter = new BlurYTintFilter(); this.defaultFilter = new core.AbstractFilter(); this.padding = 30; this._dirtyPosition = true; this._angle = 45 * Math.PI / 180; this._dis...
[ "function", "DropShadowFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ")", ";", "this", ".", "blurXFilter", "=", "new", "BlurXFilter", "(", ")", ";", "this", ".", "blurYTintFilter", "=", "new", "BlurYTintFilter", "(", ")",...
The DropShadowFilter applies a Gaussian blur to an object. The strength of the blur can be set for x- and y-axis separately. @class @extends AbstractFilter @memberof PIXI.filters
[ "The", "DropShadowFilter", "applies", "a", "Gaussian", "blur", "to", "an", "object", ".", "The", "strength", "of", "the", "blur", "can", "be", "set", "for", "x", "-", "and", "y", "-", "axis", "separately", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/dropshadow/DropShadowFilter.js#L13-L30
train
redisjs/jsr-server
lib/command/database/string/set.js
validate
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); var offset = 2 , arg , expires; // need string args (except for key, value) args.forEach(function(a, i, arr) { if(i > 1) { arr[i] = '' + a; } }) if(args.length > 7) { throw new Command...
javascript
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); var offset = 2 , arg , expires; // need string args (except for key, value) args.forEach(function(a, i, arr) { if(i > 1) { arr[i] = '' + a; } }) if(args.length > 7) { throw new Command...
[ "function", "validate", "(", "cmd", ",", "args", ",", "info", ")", "{", "AbstractCommand", ".", "prototype", ".", "validate", ".", "apply", "(", "this", ",", "arguments", ")", ";", "var", "offset", "=", "2", ",", "arg", ",", "expires", ";", "// need st...
Validate the SET command.
[ "Validate", "the", "SET", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/string/set.js#L21-L57
train
taoyuan/sit
lib/facets/jsonrpc/server.js
ServerFacet
function ServerFacet($logs, $options, container) { if (!(this instanceof ServerFacet)) { return new ServerFacet($logs, $options, container); } this.name = ServerFacet.facetname; this.container = container; this.log = $logs.get('sit:jsonrpc:server#' + this.name); this.options = _.assign({...
javascript
function ServerFacet($logs, $options, container) { if (!(this instanceof ServerFacet)) { return new ServerFacet($logs, $options, container); } this.name = ServerFacet.facetname; this.container = container; this.log = $logs.get('sit:jsonrpc:server#' + this.name); this.options = _.assign({...
[ "function", "ServerFacet", "(", "$logs", ",", "$options", ",", "container", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ServerFacet", ")", ")", "{", "return", "new", "ServerFacet", "(", "$logs", ",", "$options", ",", "container", ")", ";", "}",...
owned app and server ?
[ "owned", "app", "and", "server", "?" ]
1ec54af9363d1a22264b3f25a3a1c9dd592aea66
https://github.com/taoyuan/sit/blob/1ec54af9363d1a22264b3f25a3a1c9dd592aea66/lib/facets/jsonrpc/server.js#L17-L29
train
xiamidaxia/xiami
meteor/livedata/common/livedata_connection.js
function () { var self = this; _.each(_.clone(self._subscriptions), function (sub, id) { // Avoid killing the autoupdate subscription so that developers // still get hot code pushes when writing tests. // // XXX it's a hack to encode knowledge about autoupdate here, // but it doesn...
javascript
function () { var self = this; _.each(_.clone(self._subscriptions), function (sub, id) { // Avoid killing the autoupdate subscription so that developers // still get hot code pushes when writing tests. // // XXX it's a hack to encode knowledge about autoupdate here, // but it doesn...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "_", ".", "each", "(", "_", ".", "clone", "(", "self", ".", "_subscriptions", ")", ",", "function", "(", "sub", ",", "id", ")", "{", "// Avoid killing the autoupdate subscription so that developers"...
This is very much a private function we use to make the tests take up fewer server resources after they complete.
[ "This", "is", "very", "much", "a", "private", "function", "we", "use", "to", "make", "the", "tests", "take", "up", "fewer", "server", "resources", "after", "they", "complete", "." ]
6fcee92c493c12bf8fd67c7068e67fa6a72a306b
https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/livedata/common/livedata_connection.js#L902-L916
train
kurttheviking/radial-index
index.js
_polarRadian
function _polarRadian(xyCenter, xyPointsArray) { // simplify the math by moving the computed circle center to [0, 0] var xAdj = 0 - xyCenter[0], yAdj = 0 - xyCenter[1]; return _.map(xyPointsArray, function(xy){ // reposition x and y relative to adjusted [0, 0] center var x = xy[0] + xAdj; var y...
javascript
function _polarRadian(xyCenter, xyPointsArray) { // simplify the math by moving the computed circle center to [0, 0] var xAdj = 0 - xyCenter[0], yAdj = 0 - xyCenter[1]; return _.map(xyPointsArray, function(xy){ // reposition x and y relative to adjusted [0, 0] center var x = xy[0] + xAdj; var y...
[ "function", "_polarRadian", "(", "xyCenter", ",", "xyPointsArray", ")", "{", "// simplify the math by moving the computed circle center to [0, 0]", "var", "xAdj", "=", "0", "-", "xyCenter", "[", "0", "]", ",", "yAdj", "=", "0", "-", "xyCenter", "[", "1", "]", ";...
_polarRadian compute radian component of polar coordinate relative to a center point @param {Array} xyCenter [x, y] center point to anchor radial sweep @param {Array} xyPointsArray Array of [x, y] arrays -- one for each point to index @return {Array} the radian position (between 0 and 2PI)...
[ "_polarRadian", "compute", "radian", "component", "of", "polar", "coordinate", "relative", "to", "a", "center", "point" ]
60713ba03ca5f027d7ea5e5a3f82589b87e67f44
https://github.com/kurttheviking/radial-index/blob/60713ba03ca5f027d7ea5e5a3f82589b87e67f44/index.js#L92-L111
train
kurttheviking/radial-index
index.js
_rotateRadian
function _rotateRadian(radiansRaw, radialAdj) { radialAdj %= TWOPI; return _.map(radiansRaw, function(r){ r += radialAdj; // for radial positions that cross the baseline, recompute if(r > TWOPI) { return r -= TWOPI; } if(r < 0) { return r += TWOPI; } return r; }); }
javascript
function _rotateRadian(radiansRaw, radialAdj) { radialAdj %= TWOPI; return _.map(radiansRaw, function(r){ r += radialAdj; // for radial positions that cross the baseline, recompute if(r > TWOPI) { return r -= TWOPI; } if(r < 0) { return r += TWOPI; } return r; }); }
[ "function", "_rotateRadian", "(", "radiansRaw", ",", "radialAdj", ")", "{", "radialAdj", "%=", "TWOPI", ";", "return", "_", ".", "map", "(", "radiansRaw", ",", "function", "(", "r", ")", "{", "r", "+=", "radialAdj", ";", "// for radial positions that cross the...
_rotateRadian rotates a list of radial positions by the desired radian amount @param {Array} radiansRaw List of radial positions to rotate @param {Float} radialAdj The radial rotation to apply -- max rotation is 2PI @return {Array} rotates a list of radial positions by the desired radian amount
[ "_rotateRadian", "rotates", "a", "list", "of", "radial", "positions", "by", "the", "desired", "radian", "amount" ]
60713ba03ca5f027d7ea5e5a3f82589b87e67f44
https://github.com/kurttheviking/radial-index/blob/60713ba03ca5f027d7ea5e5a3f82589b87e67f44/index.js#L119-L131
train
emeryrose/ipsee
lib/messenger.js
Messenger
function Messenger(namespace, options) { if (!(this instanceof Messenger)) { return new Messenger(namespace, options); } if (!namespace) { throw new Error('Cannot create Messenger without a namespace'); } events.EventEmitter.call(this); this.namespace = namespace; this.options = merge(Object.cr...
javascript
function Messenger(namespace, options) { if (!(this instanceof Messenger)) { return new Messenger(namespace, options); } if (!namespace) { throw new Error('Cannot create Messenger without a namespace'); } events.EventEmitter.call(this); this.namespace = namespace; this.options = merge(Object.cr...
[ "function", "Messenger", "(", "namespace", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Messenger", ")", ")", "{", "return", "new", "Messenger", "(", "namespace", ",", "options", ")", ";", "}", "if", "(", "!", "namespace", ")",...
Creates an IPC messenger @constructor @param {string} namespace - prefix for unix socket file descriptors @param {object} options - messenger configuration
[ "Creates", "an", "IPC", "messenger" ]
5d99bdf8bca6f03f7b112b23759d86acb6cd218b
https://github.com/emeryrose/ipsee/blob/5d99bdf8bca6f03f7b112b23759d86acb6cd218b/lib/messenger.js#L19-L35
train
alexpods/ClazzJS
src/components/meta/Property.js
function(object, propertyMeta, property) { var that = this; object['_' + property] = undefined; // Adjust property 'type' and 'default fields if (_.isArray(propertyMeta)) { propertyMeta = propertyMeta.length === 3 || !_.isSimpleObject(propertyMeta[1]) ? { ty...
javascript
function(object, propertyMeta, property) { var that = this; object['_' + property] = undefined; // Adjust property 'type' and 'default fields if (_.isArray(propertyMeta)) { propertyMeta = propertyMeta.length === 3 || !_.isSimpleObject(propertyMeta[1]) ? { ty...
[ "function", "(", "object", ",", "propertyMeta", ",", "property", ")", "{", "var", "that", "=", "this", ";", "object", "[", "'_'", "+", "property", "]", "=", "undefined", ";", "// Adjust property 'type' and 'default fields", "if", "(", "_", ".", "isArray", "(...
Process single property for clazz @param {clazz|object} object Clazz or its prototype @param {object} propertyMeta Property meta data @param {string} property Property name @this {metaProcessor}
[ "Process", "single", "property", "for", "clazz" ]
2f94496019669813c8246d48fcceb12a3e68a870
https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property.js#L32-L68
train
Psychopoulet/node-promfs
lib/extends/_writeJSONFile.js
_writeJSONFile
function _writeJSONFile (file, data, callback, replacer, space) { if ("undefined" === typeof file) { throw new ReferenceError("missing \"file\" argument"); } else if ("string" !== typeof file) { throw new TypeError("\"file\" argument is not a string"); } else if ("" === file.trim()) { t...
javascript
function _writeJSONFile (file, data, callback, replacer, space) { if ("undefined" === typeof file) { throw new ReferenceError("missing \"file\" argument"); } else if ("string" !== typeof file) { throw new TypeError("\"file\" argument is not a string"); } else if ("" === file.trim()) { t...
[ "function", "_writeJSONFile", "(", "file", ",", "data", ",", "callback", ",", "replacer", ",", "space", ")", "{", "if", "(", "\"undefined\"", "===", "typeof", "file", ")", "{", "throw", "new", "ReferenceError", "(", "\"missing \\\"file\\\" argument\"", ")", ";...
methods Async writeJSONFile @param {string} file : file to check @param {function} data : data to write @param {function} callback : operation's result @param {function|null} replacer : JSON.stringify argument @param {string|number|null} space : JSON.stringify argument @returns {void}
[ "methods", "Async", "writeJSONFile" ]
016e272fc58c6ef6eae5ea551a0e8873f0ac20cc
https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_writeJSONFile.js#L28-L78
train
postral/telegraphjs-context-mock
index.js
createContext
function createContext(params, onNext) { var context = function defaultCall(err) { return context.next(err); }; //additional parameters that are in effect beyond the object itself context.params = params || {}; //keep us from calling next after a failure context.failed = false; ...
javascript
function createContext(params, onNext) { var context = function defaultCall(err) { return context.next(err); }; //additional parameters that are in effect beyond the object itself context.params = params || {}; //keep us from calling next after a failure context.failed = false; ...
[ "function", "createContext", "(", "params", ",", "onNext", ")", "{", "var", "context", "=", "function", "defaultCall", "(", "err", ")", "{", "return", "context", ".", "next", "(", "err", ")", ";", "}", ";", "//additional parameters that are in effect beyond the ...
A mock Context object @constructor @this {Context}
[ "A", "mock", "Context", "object" ]
f45c12849137a1c22c8d894f95f44e2a9d6549ce
https://github.com/postral/telegraphjs-context-mock/blob/f45c12849137a1c22c8d894f95f44e2a9d6549ce/index.js#L8-L52
train
rajasekarm/git-check
index.js
hasGit
function hasGit(){ var checkGit; try { which.sync('git'); checkGit = true; } catch (ex) { checkGit = false; } return checkGit; }
javascript
function hasGit(){ var checkGit; try { which.sync('git'); checkGit = true; } catch (ex) { checkGit = false; } return checkGit; }
[ "function", "hasGit", "(", ")", "{", "var", "checkGit", ";", "try", "{", "which", ".", "sync", "(", "'git'", ")", ";", "checkGit", "=", "true", ";", "}", "catch", "(", "ex", ")", "{", "checkGit", "=", "false", ";", "}", "return", "checkGit", ";", ...
Check if git is installed
[ "Check", "if", "git", "is", "installed" ]
a3a762ea55f84b1a008a2640f55bc628b31fe735
https://github.com/rajasekarm/git-check/blob/a3a762ea55f84b1a008a2640f55bc628b31fe735/index.js#L4-L13
train
copress/copress-component-oauth2
lib/scope.js
loadScopes
function loadScopes(scopes) { var scopeMapping = {}; if (typeof scopes === 'object') { for (var s in scopes) { var routes = []; var entries = scopes[s]; debug('Scope: %s routes: %j', s, entries); if (Array.isArray(entries)) { for (var j = 0, k = entries.length; j < k; j++) { ...
javascript
function loadScopes(scopes) { var scopeMapping = {}; if (typeof scopes === 'object') { for (var s in scopes) { var routes = []; var entries = scopes[s]; debug('Scope: %s routes: %j', s, entries); if (Array.isArray(entries)) { for (var j = 0, k = entries.length; j < k; j++) { ...
[ "function", "loadScopes", "(", "scopes", ")", "{", "var", "scopeMapping", "=", "{", "}", ";", "if", "(", "typeof", "scopes", "===", "'object'", ")", "{", "for", "(", "var", "s", "in", "scopes", ")", "{", "var", "routes", "=", "[", "]", ";", "var", ...
Load the definition of scopes ```json { "scope1": [{"methods": "get", path: "/:user/profile"}, "/order"], "scope2": [{"methods": "post", path: "/:user/profile"}] } ``` @param {Object} scopes @returns {Object}
[ "Load", "the", "definition", "of", "scopes" ]
4819f379a0d42753bfd51e237c5c3aaddee37544
https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/scope.js#L22-L60
train
andrewscwei/requiem
src/dom/getChild.js
getChild
function getChild() { let element = undefined; let name = undefined; let recursive = undefined; let arg1 = arguments[0]; if ((arg1 === window) || (arg1 === document) || (arg1 instanceof Node) || (arg1 === null) || (arg1 === undefined)) element = arg1; else if (typeof arg1 === 'string') name = arg1;...
javascript
function getChild() { let element = undefined; let name = undefined; let recursive = undefined; let arg1 = arguments[0]; if ((arg1 === window) || (arg1 === document) || (arg1 instanceof Node) || (arg1 === null) || (arg1 === undefined)) element = arg1; else if (typeof arg1 === 'string') name = arg1;...
[ "function", "getChild", "(", ")", "{", "let", "element", "=", "undefined", ";", "let", "name", "=", "undefined", ";", "let", "recursive", "=", "undefined", ";", "let", "arg1", "=", "arguments", "[", "0", "]", ";", "if", "(", "(", "arg1", "===", "wind...
Gets the a child from the global display tree consisting of all sightread Element instances. @param {Node} [element] - Specifies the parent element instance to fetch the child from. @param {string} [name] - Name of the child, depth separated by '.' (i.e. 'foo.bar'). If unspecified, the entire child list of this Elemen...
[ "Gets", "the", "a", "child", "from", "the", "global", "display", "tree", "consisting", "of", "all", "sightread", "Element", "instances", "." ]
c4182bfffc9841c6de5718f689ad3c2060511777
https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/getChild.js#L25-L79
train
redisjs/jsr-server
lib/command/database/key/object.js
refcount
function refcount(req, res) { var obj = req.db.getKey(req.args[0], req); if(obj === undefined) return res.send(null, null); res.send(null, -1); }
javascript
function refcount(req, res) { var obj = req.db.getKey(req.args[0], req); if(obj === undefined) return res.send(null, null); res.send(null, -1); }
[ "function", "refcount", "(", "req", ",", "res", ")", "{", "var", "obj", "=", "req", ".", "db", ".", "getKey", "(", "req", ".", "args", "[", "0", "]", ",", "req", ")", ";", "if", "(", "obj", "===", "undefined", ")", "return", "res", ".", "send",...
Respond to the REFCOUNT subcommand.
[ "Respond", "to", "the", "REFCOUNT", "subcommand", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/object.js#L18-L22
train
redisjs/jsr-server
lib/command/database/key/object.js
idletime
function idletime(req, res) { var obj = req.db.getRawKey(req.args[0], req) , diff; if(obj === undefined) return res.send(null, null); diff = Date.now() - obj.t; diff = Math.round(diff / 1000); res.send(null, diff); }
javascript
function idletime(req, res) { var obj = req.db.getRawKey(req.args[0], req) , diff; if(obj === undefined) return res.send(null, null); diff = Date.now() - obj.t; diff = Math.round(diff / 1000); res.send(null, diff); }
[ "function", "idletime", "(", "req", ",", "res", ")", "{", "var", "obj", "=", "req", ".", "db", ".", "getRawKey", "(", "req", ".", "args", "[", "0", "]", ",", "req", ")", ",", "diff", ";", "if", "(", "obj", "===", "undefined", ")", "return", "re...
Respond to the IDLETIME subcommand.
[ "Respond", "to", "the", "IDLETIME", "subcommand", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/object.js#L27-L34
train
redisjs/jsr-server
lib/command/database/key/object.js
encoding
function encoding(req, res) { var obj = req.db.getRawKey(req.args[0], req); if(obj === undefined) return res.send(null, null); res.send(null, getEncoding( req.db.getType(req.args[0]), obj.v, this.state.conf)); }
javascript
function encoding(req, res) { var obj = req.db.getRawKey(req.args[0], req); if(obj === undefined) return res.send(null, null); res.send(null, getEncoding( req.db.getType(req.args[0]), obj.v, this.state.conf)); }
[ "function", "encoding", "(", "req", ",", "res", ")", "{", "var", "obj", "=", "req", ".", "db", ".", "getRawKey", "(", "req", ".", "args", "[", "0", "]", ",", "req", ")", ";", "if", "(", "obj", "===", "undefined", ")", "return", "res", ".", "sen...
Respond to the ENCODING subcommand.
[ "Respond", "to", "the", "ENCODING", "subcommand", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/object.js#L39-L44
train
Gnucki/gnucki-r
bin/r.js
function () { if (!this.enabled || this.enabling) { return; } var err, cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, factory = this.fa...
javascript
function () { if (!this.enabled || this.enabling) { return; } var err, cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, factory = this.fa...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "enabled", "||", "this", ".", "enabling", ")", "{", "return", ";", "}", "var", "err", ",", "cjsModule", ",", "id", "=", "this", ".", "map", ".", "id", ",", "depExports", "=", "this", ".", ...
Checks if the module is ready to define itself, and if so, define it.
[ "Checks", "if", "the", "module", "is", "ready", "to", "define", "itself", "and", "if", "so", "define", "it", "." ]
7d916f7858fa30565d100e051e319b74bb250308
https://github.com/Gnucki/gnucki-r/blob/7d916f7858fa30565d100e051e319b74bb250308/bin/r.js#L1087-L1181
train
Gnucki/gnucki-r
bin/r.js
parseGroupExpression
function parseGroupExpression() { var expr, expressions, startToken, isValidArrowParameter = true; expect('('); if (match(')')) { lex(); if (!match('=>')) { expect('=>'); } return { type: PlaceHolders.ArrowParamete...
javascript
function parseGroupExpression() { var expr, expressions, startToken, isValidArrowParameter = true; expect('('); if (match(')')) { lex(); if (!match('=>')) { expect('=>'); } return { type: PlaceHolders.ArrowParamete...
[ "function", "parseGroupExpression", "(", ")", "{", "var", "expr", ",", "expressions", ",", "startToken", ",", "isValidArrowParameter", "=", "true", ";", "expect", "(", "'('", ")", ";", "if", "(", "match", "(", "')'", ")", ")", "{", "lex", "(", ")", ";"...
11.1.6 The Grouping Operator
[ "11", ".", "1", ".", "6", "The", "Grouping", "Operator" ]
7d916f7858fa30565d100e051e319b74bb250308
https://github.com/Gnucki/gnucki-r/blob/7d916f7858fa30565d100e051e319b74bb250308/bin/r.js#L6993-L7068
train
Gnucki/gnucki-r
bin/r.js
parseStatementListItem
function parseStatementListItem() { if (lookahead.type === Token.Keyword) { switch (lookahead.value) { case 'const': case 'let': return parseLexicalDeclaration(); case 'function': return parseFunctionDeclaration(new Node()); ...
javascript
function parseStatementListItem() { if (lookahead.type === Token.Keyword) { switch (lookahead.value) { case 'const': case 'let': return parseLexicalDeclaration(); case 'function': return parseFunctionDeclaration(new Node()); ...
[ "function", "parseStatementListItem", "(", ")", "{", "if", "(", "lookahead", ".", "type", "===", "Token", ".", "Keyword", ")", "{", "switch", "(", "lookahead", ".", "value", ")", "{", "case", "'const'", ":", "case", "'let'", ":", "return", "parseLexicalDec...
12.1 Block
[ "12", ".", "1", "Block" ]
7d916f7858fa30565d100e051e319b74bb250308
https://github.com/Gnucki/gnucki-r/blob/7d916f7858fa30565d100e051e319b74bb250308/bin/r.js#L7622-L7636
train
Gnucki/gnucki-r
bin/r.js
includeFinished
function includeFinished(value) { //If a sync build environment, check for errors here, instead of //in the then callback below, since some errors, like two IDs pointed //to same URL but only one anon ID will leave the loader in an //unresolved state since a setTimeout ca...
javascript
function includeFinished(value) { //If a sync build environment, check for errors here, instead of //in the then callback below, since some errors, like two IDs pointed //to same URL but only one anon ID will leave the loader in an //unresolved state since a setTimeout ca...
[ "function", "includeFinished", "(", "value", ")", "{", "//If a sync build environment, check for errors here, instead of", "//in the then callback below, since some errors, like two IDs pointed", "//to same URL but only one anon ID will leave the loader in an", "//unresolved state since a setTimeo...
Use a wrapping function so can check for errors.
[ "Use", "a", "wrapping", "function", "so", "can", "check", "for", "errors", "." ]
7d916f7858fa30565d100e051e319b74bb250308
https://github.com/Gnucki/gnucki-r/blob/7d916f7858fa30565d100e051e319b74bb250308/bin/r.js#L28333-L28352
train
damsonjs/damson-core
index.js
registerDriver
function registerDriver(Driver, name, options) { if (this.drivers[name]) { log.error(new Error('Driver "' + name + '" is already registered.')); return; } if (!Driver || !Driver.prototype || typeof Driver.prototype.send !== 'function') { log.error(new Error('Driver "' + name + '" should implement "sen...
javascript
function registerDriver(Driver, name, options) { if (this.drivers[name]) { log.error(new Error('Driver "' + name + '" is already registered.')); return; } if (!Driver || !Driver.prototype || typeof Driver.prototype.send !== 'function') { log.error(new Error('Driver "' + name + '" should implement "sen...
[ "function", "registerDriver", "(", "Driver", ",", "name", ",", "options", ")", "{", "if", "(", "this", ".", "drivers", "[", "name", "]", ")", "{", "log", ".", "error", "(", "new", "Error", "(", "'Driver \"'", "+", "name", "+", "'\" is already registered....
Registers output driver @param {Function} Driver Damson driver constructor @param {string} name Damson driver name @param {object} options Damson driver options
[ "Registers", "output", "driver" ]
6caadc0e3c93f131d0f496b480ab69f758175e63
https://github.com/damsonjs/damson-core/blob/6caadc0e3c93f131d0f496b480ab69f758175e63/index.js#L11-L21
train
damsonjs/damson-core
index.js
getDriver
function getDriver(name) { if (!this.drivers[name]) { log.error(new Error('Driver "' + name + '" is not registered.')); return null; } return this.drivers[name]; }
javascript
function getDriver(name) { if (!this.drivers[name]) { log.error(new Error('Driver "' + name + '" is not registered.')); return null; } return this.drivers[name]; }
[ "function", "getDriver", "(", "name", ")", "{", "if", "(", "!", "this", ".", "drivers", "[", "name", "]", ")", "{", "log", ".", "error", "(", "new", "Error", "(", "'Driver \"'", "+", "name", "+", "'\" is not registered.'", ")", ")", ";", "return", "n...
Returns registered driver @param {string} name Registered driver name @return {object|null} Damson driver object
[ "Returns", "registered", "driver" ]
6caadc0e3c93f131d0f496b480ab69f758175e63
https://github.com/damsonjs/damson-core/blob/6caadc0e3c93f131d0f496b480ab69f758175e63/index.js#L28-L34
train
damsonjs/damson-core
index.js
registerTask
function registerTask(Task, name, options) { if (this.tasks[name]) { log.error(new Error('Task "' + name + '" is already registered.')); return; } if (!Task || !Task.prototype || typeof Task.prototype.run !== 'function') { log.error(new Error('Task "' + name + '" should implement "run" method.')); ...
javascript
function registerTask(Task, name, options) { if (this.tasks[name]) { log.error(new Error('Task "' + name + '" is already registered.')); return; } if (!Task || !Task.prototype || typeof Task.prototype.run !== 'function') { log.error(new Error('Task "' + name + '" should implement "run" method.')); ...
[ "function", "registerTask", "(", "Task", ",", "name", ",", "options", ")", "{", "if", "(", "this", ".", "tasks", "[", "name", "]", ")", "{", "log", ".", "error", "(", "new", "Error", "(", "'Task \"'", "+", "name", "+", "'\" is already registered.'", ")...
Registers damson Task @param {Function} Task Damson task constructor @param {string} name Damson task name @param {object} options Damson task options
[ "Registers", "damson", "Task" ]
6caadc0e3c93f131d0f496b480ab69f758175e63
https://github.com/damsonjs/damson-core/blob/6caadc0e3c93f131d0f496b480ab69f758175e63/index.js#L50-L60
train
damsonjs/damson-core
index.js
getTask
function getTask(name) { if (!this.tasks[name]) { log.error(new Error('Task "' + name + '" is not registered.')); return null; } return this.tasks[name]; }
javascript
function getTask(name) { if (!this.tasks[name]) { log.error(new Error('Task "' + name + '" is not registered.')); return null; } return this.tasks[name]; }
[ "function", "getTask", "(", "name", ")", "{", "if", "(", "!", "this", ".", "tasks", "[", "name", "]", ")", "{", "log", ".", "error", "(", "new", "Error", "(", "'Task \"'", "+", "name", "+", "'\" is not registered.'", ")", ")", ";", "return", "null", ...
Returns registered task @param {string} name Registered task name @return {object|null} Damson task object
[ "Returns", "registered", "task" ]
6caadc0e3c93f131d0f496b480ab69f758175e63
https://github.com/damsonjs/damson-core/blob/6caadc0e3c93f131d0f496b480ab69f758175e63/index.js#L67-L73
train
damsonjs/damson-core
index.js
run
function run(task_name, options, driver_name) { var task = this.tasks[task_name]; if (!task) { log.error(new Error('Task "' + task_name + '" is not registered.')); return; } var driver = this.drivers[driver_name]; if (!driver) { log.error(new Error('Driver "' + driver_name + '" is not registered.'...
javascript
function run(task_name, options, driver_name) { var task = this.tasks[task_name]; if (!task) { log.error(new Error('Task "' + task_name + '" is not registered.')); return; } var driver = this.drivers[driver_name]; if (!driver) { log.error(new Error('Driver "' + driver_name + '" is not registered.'...
[ "function", "run", "(", "task_name", ",", "options", ",", "driver_name", ")", "{", "var", "task", "=", "this", ".", "tasks", "[", "task_name", "]", ";", "if", "(", "!", "task", ")", "{", "log", ".", "error", "(", "new", "Error", "(", "'Task \"'", "...
Runs task through selected driver @param {string} task_name registered task name @param {object} options task options @param {string} driver_name registered driver name @return {Promise}
[ "Runs", "task", "through", "selected", "driver" ]
6caadc0e3c93f131d0f496b480ab69f758175e63
https://github.com/damsonjs/damson-core/blob/6caadc0e3c93f131d0f496b480ab69f758175e63/index.js#L90-L103
train
Pavel-vo/njs-compiler
index.js
nest
function nest(t, x, node, func, end) { x.stmtStack.push(node); var n = func(t, x); x.stmtStack.pop(); end && t.mustMatch(end); return n; }
javascript
function nest(t, x, node, func, end) { x.stmtStack.push(node); var n = func(t, x); x.stmtStack.pop(); end && t.mustMatch(end); return n; }
[ "function", "nest", "(", "t", ",", "x", ",", "node", ",", "func", ",", "end", ")", "{", "x", ".", "stmtStack", ".", "push", "(", "node", ")", ";", "var", "n", "=", "func", "(", "t", ",", "x", ")", ";", "x", ".", "stmtStack", ".", "pop", "("...
Statement stack and nested statement handler.
[ "Statement", "stack", "and", "nested", "statement", "handler", "." ]
96651ad892eb19dd4e0de6f376d36083a0a969e7
https://github.com/Pavel-vo/njs-compiler/blob/96651ad892eb19dd4e0de6f376d36083a0a969e7/index.js#L636-L642
train
Pavel-vo/njs-compiler
index.js
NjsCompiler
function NjsCompiler(options) { this.nodeSequence = 0; this.options = options || {}; if (!this.options.runtime) { this.options.runtime = 'njs'; } this.parseBooleanOptions("exceptions", true); }
javascript
function NjsCompiler(options) { this.nodeSequence = 0; this.options = options || {}; if (!this.options.runtime) { this.options.runtime = 'njs'; } this.parseBooleanOptions("exceptions", true); }
[ "function", "NjsCompiler", "(", "options", ")", "{", "this", ".", "nodeSequence", "=", "0", ";", "this", ".", "options", "=", "options", "||", "{", "}", ";", "if", "(", "!", "this", ".", "options", ".", "runtime", ")", "{", "this", ".", "options", ...
fake node type for njs code segment
[ "fake", "node", "type", "for", "njs", "code", "segment" ]
96651ad892eb19dd4e0de6f376d36083a0a969e7
https://github.com/Pavel-vo/njs-compiler/blob/96651ad892eb19dd4e0de6f376d36083a0a969e7/index.js#L1420-L1427
train
WebArtWork/derer
lib/lexer.js
reader
function reader(str) { var matched; utils.some(rules, function (rule) { return utils.some(rule.regex, function (regex) { var match = str.match(regex), normalized; if (!match) { return; } normalized = match[rule.idx || 0].replace(/\s*$/, ''); normalized = (rule.ha...
javascript
function reader(str) { var matched; utils.some(rules, function (rule) { return utils.some(rule.regex, function (regex) { var match = str.match(regex), normalized; if (!match) { return; } normalized = match[rule.idx || 0].replace(/\s*$/, ''); normalized = (rule.ha...
[ "function", "reader", "(", "str", ")", "{", "var", "matched", ";", "utils", ".", "some", "(", "rules", ",", "function", "(", "rule", ")", "{", "return", "utils", ".", "some", "(", "rule", ".", "regex", ",", "function", "(", "regex", ")", "{", "var"...
Return the token type object for a single chunk of a string. @param {string} str String chunk. @return {LexerToken} Defined type, potentially stripped or replaced with more suitable content. @private
[ "Return", "the", "token", "type", "object", "for", "a", "single", "chunk", "of", "a", "string", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/lexer.js#L253-L286
train
nearform/docker-container
lib/container.js
build
function build(mode, system, cdef, out, cb) { logger.info('building'); out.stdout('--> building'); builder.build(mode, system, cdef, out, function(err, specific) { if (err) { logger.error(err); return cb(err); } cb(err); }); }
javascript
function build(mode, system, cdef, out, cb) { logger.info('building'); out.stdout('--> building'); builder.build(mode, system, cdef, out, function(err, specific) { if (err) { logger.error(err); return cb(err); } cb(err); }); }
[ "function", "build", "(", "mode", ",", "system", ",", "cdef", ",", "out", ",", "cb", ")", "{", "logger", ".", "info", "(", "'building'", ")", ";", "out", ".", "stdout", "(", "'--> building'", ")", ";", "builder", ".", "build", "(", "mode", ",", "sy...
build the container system - the system definition cdef - contianer definition block out - ouput stream cb - complete callback
[ "build", "the", "container", "system", "-", "the", "system", "definition", "cdef", "-", "contianer", "definition", "block", "out", "-", "ouput", "stream", "cb", "-", "complete", "callback" ]
724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17
https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/container.js#L44-L52
train
nearform/docker-container
lib/container.js
needBuild
function needBuild(mode, system, cdef, out, cb) { // TODO handle authentication and HTTPS registries // also handle other registries than docker-registry-container var cmds = commands(os.platform()); var tag = cmds.generateTag(config, system, cdef); var baseUrl = 'http://' + config.registry + '/v1/...
javascript
function needBuild(mode, system, cdef, out, cb) { // TODO handle authentication and HTTPS registries // also handle other registries than docker-registry-container var cmds = commands(os.platform()); var tag = cmds.generateTag(config, system, cdef); var baseUrl = 'http://' + config.registry + '/v1/...
[ "function", "needBuild", "(", "mode", ",", "system", ",", "cdef", ",", "out", ",", "cb", ")", "{", "// TODO handle authentication and HTTPS registries", "// also handle other registries than docker-registry-container", "var", "cmds", "=", "commands", "(", "os", ".", "pl...
Check if the container needs a build system - the system definition cdef - contianer definition block out - ouput stream cb - complete callback
[ "Check", "if", "the", "container", "needs", "a", "build" ]
724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17
https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/container.js#L62-L78
train
nearform/docker-container
lib/container.js
prepareAndGetExecutor
function prepareAndGetExecutor(target, out, operation) { target.privateIpAddress = target.privateIpAddress || target.ipAddress || target.ipaddress; var executor = platform.executor(config, target.privateIpAddress, os.platform(), logger); logger.info(operation); out.stdout(operation); return executor...
javascript
function prepareAndGetExecutor(target, out, operation) { target.privateIpAddress = target.privateIpAddress || target.ipAddress || target.ipaddress; var executor = platform.executor(config, target.privateIpAddress, os.platform(), logger); logger.info(operation); out.stdout(operation); return executor...
[ "function", "prepareAndGetExecutor", "(", "target", ",", "out", ",", "operation", ")", "{", "target", ".", "privateIpAddress", "=", "target", ".", "privateIpAddress", "||", "target", ".", "ipAddress", "||", "target", ".", "ipaddress", ";", "var", "executor", "...
prepare the environment to execute the operation and return the executor target - target to deploy to out - output stream operation - the string to log to announce the beginning to the operation
[ "prepare", "the", "environment", "to", "execute", "the", "operation", "and", "return", "the", "executor" ]
724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17
https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/container.js#L88-L94
train
nearform/docker-container
lib/container.js
deploy
function deploy(mode, target, system, containerDef, container, out, cb) { var executor = prepareAndGetExecutor(target, out, 'deploying'); executor.deploy(mode, target, system, containerDef, container, out, function(err) { cb(err); }); }
javascript
function deploy(mode, target, system, containerDef, container, out, cb) { var executor = prepareAndGetExecutor(target, out, 'deploying'); executor.deploy(mode, target, system, containerDef, container, out, function(err) { cb(err); }); }
[ "function", "deploy", "(", "mode", ",", "target", ",", "system", ",", "containerDef", ",", "container", ",", "out", ",", "cb", ")", "{", "var", "executor", "=", "prepareAndGetExecutor", "(", "target", ",", "out", ",", "'deploying'", ")", ";", "executor", ...
deploy the container target - target to deploy to system - the target system defintinion cdef - the contianer definition container - the container as defined in the system topology out - ouput stream cb - complete callback
[ "deploy", "the", "container", "target", "-", "target", "to", "deploy", "to", "system", "-", "the", "target", "system", "defintinion", "cdef", "-", "the", "contianer", "definition", "container", "-", "the", "container", "as", "defined", "in", "the", "system", ...
724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17
https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/container.js#L107-L112
train
nearform/docker-container
lib/container.js
hup
function hup(mode, target, system, containerDef, container, newConfig, out, cb) { var executor = prepareAndGetExecutor(target, out, 'hup'); executor.hup(mode, target, system, containerDef, container, out, newConfig, function(err) { cb(err); }); }
javascript
function hup(mode, target, system, containerDef, container, newConfig, out, cb) { var executor = prepareAndGetExecutor(target, out, 'hup'); executor.hup(mode, target, system, containerDef, container, out, newConfig, function(err) { cb(err); }); }
[ "function", "hup", "(", "mode", ",", "target", ",", "system", ",", "containerDef", ",", "container", ",", "newConfig", ",", "out", ",", "cb", ")", "{", "var", "executor", "=", "prepareAndGetExecutor", "(", "target", ",", "out", ",", "'hup'", ")", ";", ...
send updated configurtaion information to a container and hup the internal daemon process
[ "send", "updated", "configurtaion", "information", "to", "a", "container", "and", "hup", "the", "internal", "daemon", "process" ]
724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17
https://github.com/nearform/docker-container/blob/724ff6a9d8d3c116f9a6b8239594c4b5cd5e8e17/lib/container.js#L209-L214
train
blakeembrey/node-trimmer
index.js
toFn
function toFn (value) { if (typeof value === 'function') return value var str = Array.isArray(value) ? value : String(value) var obj = Object.create(null) for (var i = 0; i < str.length; i++) { obj[str[i]] = true } return function (char) { return obj[char] } }
javascript
function toFn (value) { if (typeof value === 'function') return value var str = Array.isArray(value) ? value : String(value) var obj = Object.create(null) for (var i = 0; i < str.length; i++) { obj[str[i]] = true } return function (char) { return obj[char] } }
[ "function", "toFn", "(", "value", ")", "{", "if", "(", "typeof", "value", "===", "'function'", ")", "return", "value", "var", "str", "=", "Array", ".", "isArray", "(", "value", ")", "?", "value", ":", "String", "(", "value", ")", "var", "obj", "=", ...
Convert the input value to a function.
[ "Convert", "the", "input", "value", "to", "a", "function", "." ]
aa26b42b0e9e33dc0bb76d30b8f593d3bdcd8221
https://github.com/blakeembrey/node-trimmer/blob/aa26b42b0e9e33dc0bb76d30b8f593d3bdcd8221/index.js#L8-L21
train
blakeembrey/node-trimmer
index.js
trim
function trim (str, chars) { var fn = toFn(chars || WHITESPACE_CHARS) return trim.right(trim.left(str, fn), fn) }
javascript
function trim (str, chars) { var fn = toFn(chars || WHITESPACE_CHARS) return trim.right(trim.left(str, fn), fn) }
[ "function", "trim", "(", "str", ",", "chars", ")", "{", "var", "fn", "=", "toFn", "(", "chars", "||", "WHITESPACE_CHARS", ")", "return", "trim", ".", "right", "(", "trim", ".", "left", "(", "str", ",", "fn", ")", ",", "fn", ")", "}" ]
The default trim function executes both sides.
[ "The", "default", "trim", "function", "executes", "both", "sides", "." ]
aa26b42b0e9e33dc0bb76d30b8f593d3bdcd8221
https://github.com/blakeembrey/node-trimmer/blob/aa26b42b0e9e33dc0bb76d30b8f593d3bdcd8221/index.js#L26-L30
train
drfisher/csv-locales
lib/index.js
processCsv
function processCsv (csvContent) { UNSAFE_SYMBOLS.forEach(function (symbolParams) { csvContent = csvContent.replace(symbolParams.pattern, symbolParams.replace); }); return csvContent; }
javascript
function processCsv (csvContent) { UNSAFE_SYMBOLS.forEach(function (symbolParams) { csvContent = csvContent.replace(symbolParams.pattern, symbolParams.replace); }); return csvContent; }
[ "function", "processCsv", "(", "csvContent", ")", "{", "UNSAFE_SYMBOLS", ".", "forEach", "(", "function", "(", "symbolParams", ")", "{", "csvContent", "=", "csvContent", ".", "replace", "(", "symbolParams", ".", "pattern", ",", "symbolParams", ".", "replace", ...
Replaces some unsafe symbols to spaces @param {string} csvContent @returns {string}
[ "Replaces", "some", "unsafe", "symbols", "to", "spaces" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L18-L23
train
drfisher/csv-locales
lib/index.js
createLocales
function createLocales (json, params, callback) { var locales = registerLocales(json.shift()); var indexes = locales.indexes; var messageName; delete locales.indexes; json.forEach(function (messageLine) { var messageProp, lineValue, propPath; for (var i = 0, len = messageLine.length; i < len; i++) ...
javascript
function createLocales (json, params, callback) { var locales = registerLocales(json.shift()); var indexes = locales.indexes; var messageName; delete locales.indexes; json.forEach(function (messageLine) { var messageProp, lineValue, propPath; for (var i = 0, len = messageLine.length; i < len; i++) ...
[ "function", "createLocales", "(", "json", ",", "params", ",", "callback", ")", "{", "var", "locales", "=", "registerLocales", "(", "json", ".", "shift", "(", ")", ")", ";", "var", "indexes", "=", "locales", ".", "indexes", ";", "var", "messageName", ";",...
Creates all directories and files from json @param {Array} json @param {object} params @param {function} callback
[ "Creates", "all", "directories", "and", "files", "from", "json" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L31-L71
train
drfisher/csv-locales
lib/index.js
parsePlaceholders
function parsePlaceholders (source) { return source.match(/\([^\)]+\)/g).reduce(function (result, placeholder) { placeholder = placeholder.replace(/^\(([^\)]+)\)$/, '$1'); var keyValue = placeholder.split(':'); result[keyValue[0]] = { content: keyValue[1] }; return result; }, {}); }
javascript
function parsePlaceholders (source) { return source.match(/\([^\)]+\)/g).reduce(function (result, placeholder) { placeholder = placeholder.replace(/^\(([^\)]+)\)$/, '$1'); var keyValue = placeholder.split(':'); result[keyValue[0]] = { content: keyValue[1] }; return result; }, {}); }
[ "function", "parsePlaceholders", "(", "source", ")", "{", "return", "source", ".", "match", "(", "/", "\\([^\\)]+\\)", "/", "g", ")", ".", "reduce", "(", "function", "(", "result", ",", "placeholder", ")", "{", "placeholder", "=", "placeholder", ".", "repl...
Generates a placeholders object from a source string @param {string} source @returns {object}
[ "Generates", "a", "placeholders", "object", "from", "a", "source", "string" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L78-L87
train
drfisher/csv-locales
lib/index.js
writeLocales
function writeLocales (locales, params, callback) { try { var jsonPath, json; for (var key in locales) { if (locales.hasOwnProperty(key)) { json = locales[key]; jsonPath = path.join(params.dirPath, json.localeName, 'messages.json'); // remove empty messages for (var msg_...
javascript
function writeLocales (locales, params, callback) { try { var jsonPath, json; for (var key in locales) { if (locales.hasOwnProperty(key)) { json = locales[key]; jsonPath = path.join(params.dirPath, json.localeName, 'messages.json'); // remove empty messages for (var msg_...
[ "function", "writeLocales", "(", "locales", ",", "params", ",", "callback", ")", "{", "try", "{", "var", "jsonPath", ",", "json", ";", "for", "(", "var", "key", "in", "locales", ")", "{", "if", "(", "locales", ".", "hasOwnProperty", "(", "key", ")", ...
Writes locales to a file system @param {object} locales @param {object} params @param {function} callback
[ "Writes", "locales", "to", "a", "file", "system" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L95-L122
train
drfisher/csv-locales
lib/index.js
registerLocales
function registerLocales (headers) { var localesList = { indexes: {} }; var i = headers.length - 1; var localeName; while (i >= 2) { localeName = headers[i].trim().split(/[\s\(]/)[0]; localesList[localeName] = { localeName: localeName, messages: {} }; localesList.indexes[i] = ...
javascript
function registerLocales (headers) { var localesList = { indexes: {} }; var i = headers.length - 1; var localeName; while (i >= 2) { localeName = headers[i].trim().split(/[\s\(]/)[0]; localesList[localeName] = { localeName: localeName, messages: {} }; localesList.indexes[i] = ...
[ "function", "registerLocales", "(", "headers", ")", "{", "var", "localesList", "=", "{", "indexes", ":", "{", "}", "}", ";", "var", "i", "=", "headers", ".", "length", "-", "1", ";", "var", "localeName", ";", "while", "(", "i", ">=", "2", ")", "{",...
Returns an object with existed locales @param {Array} headers @returns {object}
[ "Returns", "an", "object", "with", "existed", "locales" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L129-L146
train
drfisher/csv-locales
lib/index.js
processPath
function processPath (sourcePath, errorMessage) { if (!sourcePath || typeof sourcePath !== 'string') { throw new Error(errorMessage); } if (!path.isAbsolute(sourcePath)) { sourcePath = path.join(process.cwd(), sourcePath); } return sourcePath; }
javascript
function processPath (sourcePath, errorMessage) { if (!sourcePath || typeof sourcePath !== 'string') { throw new Error(errorMessage); } if (!path.isAbsolute(sourcePath)) { sourcePath = path.join(process.cwd(), sourcePath); } return sourcePath; }
[ "function", "processPath", "(", "sourcePath", ",", "errorMessage", ")", "{", "if", "(", "!", "sourcePath", "||", "typeof", "sourcePath", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "errorMessage", ")", ";", "}", "if", "(", "!", "path", "."...
Checks if a path exists and transforms it to an absolute if it's relative @param {string} sourcePath @param {string} errorMessage @returns {string}
[ "Checks", "if", "a", "path", "exists", "and", "transforms", "it", "to", "an", "absolute", "if", "it", "s", "relative" ]
96f75f90ea3ecca2d206a91974ca5cc1b983c151
https://github.com/drfisher/csv-locales/blob/96f75f90ea3ecca2d206a91974ca5cc1b983c151/lib/index.js#L168-L176
train
Lindurion/closure-pro-build
lib/option-validator.js
assertBoolean
function assertBoolean(value, name, description) { if (!underscore.isBoolean(value)) { throw new Error( '<' + value + '> is not a boolean, ' + name + ': ' + description); } }
javascript
function assertBoolean(value, name, description) { if (!underscore.isBoolean(value)) { throw new Error( '<' + value + '> is not a boolean, ' + name + ': ' + description); } }
[ "function", "assertBoolean", "(", "value", ",", "name", ",", "description", ")", "{", "if", "(", "!", "underscore", ".", "isBoolean", "(", "value", ")", ")", "{", "throw", "new", "Error", "(", "'<'", "+", "value", "+", "'> is not a boolean, '", "+", "nam...
Throws an Error if value isn't a boolean. @param {*} value @param {string} name The option name. @param {string} description Description of the option.
[ "Throws", "an", "Error", "if", "value", "isn", "t", "a", "boolean", "." ]
c279d0fcc3a65969d2fe965f55e627b074792f1a
https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/option-validator.js#L43-L48
train
Lindurion/closure-pro-build
lib/option-validator.js
assertValidBuildType
function assertValidBuildType(value, name, description) { if ((value != common.DEBUG) && (value != common.RELEASE)) { throw new Error('Invalid build type: <' + value + '>, must be ' + 'closureProBuild.DEBUG or closureProBuild.RELEASE'); } }
javascript
function assertValidBuildType(value, name, description) { if ((value != common.DEBUG) && (value != common.RELEASE)) { throw new Error('Invalid build type: <' + value + '>, must be ' + 'closureProBuild.DEBUG or closureProBuild.RELEASE'); } }
[ "function", "assertValidBuildType", "(", "value", ",", "name", ",", "description", ")", "{", "if", "(", "(", "value", "!=", "common", ".", "DEBUG", ")", "&&", "(", "value", "!=", "common", ".", "RELEASE", ")", ")", "{", "throw", "new", "Error", "(", ...
Throws an Error if value isn't a valid build type. @param {*} value @param {string} name The option name. @param {string} description Description of the option.
[ "Throws", "an", "Error", "if", "value", "isn", "t", "a", "valid", "build", "type", "." ]
c279d0fcc3a65969d2fe965f55e627b074792f1a
https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/option-validator.js#L57-L62
train
Lindurion/closure-pro-build
lib/option-validator.js
assertObjectMapOf
function assertObjectMapOf(valueValidatorFn, value, name, description) { if (!underscore.isObject(value)) { throw new Error( '<' + value + '> is not an Object map, ' + name + ': ' + description); } // Check all values. for (var key in value) { valueValidatorFn(value[key], name + '[\'' + key + '...
javascript
function assertObjectMapOf(valueValidatorFn, value, name, description) { if (!underscore.isObject(value)) { throw new Error( '<' + value + '> is not an Object map, ' + name + ': ' + description); } // Check all values. for (var key in value) { valueValidatorFn(value[key], name + '[\'' + key + '...
[ "function", "assertObjectMapOf", "(", "valueValidatorFn", ",", "value", ",", "name", ",", "description", ")", "{", "if", "(", "!", "underscore", ".", "isObject", "(", "value", ")", ")", "{", "throw", "new", "Error", "(", "'<'", "+", "value", "+", "'> is ...
Throws an Error if value isn't an Object, and invokes elementValidatorFn for each value within the map. @param {function(*, string, string)} valueValidatorFn @param {*} value @param {string} name The option name. @param {string} description Description of the option.
[ "Throws", "an", "Error", "if", "value", "isn", "t", "an", "Object", "and", "invokes", "elementValidatorFn", "for", "each", "value", "within", "the", "map", "." ]
c279d0fcc3a65969d2fe965f55e627b074792f1a
https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/option-validator.js#L102-L112
train
singpath/example-app
packages/tools/index.js
loadJspmConfig
function loadJspmConfig(opts) { sh.echo('Loading jspm config...'); return new Promise(resolve => { const loader = new jspm.Loader(); opts.config(loader); resolve(loader); }); }
javascript
function loadJspmConfig(opts) { sh.echo('Loading jspm config...'); return new Promise(resolve => { const loader = new jspm.Loader(); opts.config(loader); resolve(loader); }); }
[ "function", "loadJspmConfig", "(", "opts", ")", "{", "sh", ".", "echo", "(", "'Loading jspm config...'", ")", ";", "return", "new", "Promise", "(", "resolve", "=>", "{", "const", "loader", "=", "new", "jspm", ".", "Loader", "(", ")", ";", "opts", ".", ...
Resolve with a module loader. @param {{config: function}} opts options @return {Promise<jspm.Loader, Error>}
[ "Resolve", "with", "a", "module", "loader", "." ]
50b8d54bf5b647cf68094c18d99b3c8785e1dee6
https://github.com/singpath/example-app/blob/50b8d54bf5b647cf68094c18d99b3c8785e1dee6/packages/tools/index.js#L141-L150
train