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
bvalosek/grunt-infusionsoft
tasks/generator/Scraper.js
function(href) { var _this = this; return Q.nfcall(request, href).then(function(data) { var $ = cheerio.load(data); var serviceName = $('.collection') .first() .text() .trim() .replace(/\./g, ''); ...
javascript
function(href) { var _this = this; return Q.nfcall(request, href).then(function(data) { var $ = cheerio.load(data); var serviceName = $('.collection') .first() .text() .trim() .replace(/\./g, ''); ...
[ "function", "(", "href", ")", "{", "var", "_this", "=", "this", ";", "return", "Q", ".", "nfcall", "(", "request", ",", "href", ")", ".", "then", "(", "function", "(", "data", ")", "{", "var", "$", "=", "cheerio", ".", "load", "(", "data", ")", ...
Given a URL, parse all of the methods and corresponding parameter names for a Service API endpoint, return promise for node of information
[ "Given", "a", "URL", "parse", "all", "of", "the", "methods", "and", "corresponding", "parameter", "names", "for", "a", "Service", "API", "endpoint", "return", "promise", "for", "node", "of", "information" ]
847dfde26021cb228ea4004c6a6d148d56e95703
https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L166-L224
train
jurca/js-lock
Lock.js
generateLockName
function generateLockName() { let subMark = Math.floor(Math.random() * 1000).toString(36) return `Lock:${Date.now().toString(36)}:${subMark}` }
javascript
function generateLockName() { let subMark = Math.floor(Math.random() * 1000).toString(36) return `Lock:${Date.now().toString(36)}:${subMark}` }
[ "function", "generateLockName", "(", ")", "{", "let", "subMark", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "1000", ")", ".", "toString", "(", "36", ")", "return", "`", "${", "Date", ".", "now", "(", ")", ".", "toString",...
Generates a new, most likely unique, name for a freshly created lock that was not provided with a custom name. @return {string} The generated name for the lock.
[ "Generates", "a", "new", "most", "likely", "unique", "name", "for", "a", "freshly", "created", "lock", "that", "was", "not", "provided", "with", "a", "custom", "name", "." ]
096511400e91799529f1225550efec9ae2af84c8
https://github.com/jurca/js-lock/blob/096511400e91799529f1225550efec9ae2af84c8/Lock.js#L239-L242
train
vslinko/mystem-stream
lib/parseResponse.js
parseResponse
function parseResponse(mystemResponse) { var mystemResponseFacts = mystemResponse.slice(mystemResponse.indexOf("{") + 1, -1), factRegexp = /([^,]+\([^)]+\)|[^,]+)/g, facts = [], fact; while (fact = factRegexp.exec(mystemResponseFacts)) { facts.push(fact[0]); } var resul...
javascript
function parseResponse(mystemResponse) { var mystemResponseFacts = mystemResponse.slice(mystemResponse.indexOf("{") + 1, -1), factRegexp = /([^,]+\([^)]+\)|[^,]+)/g, facts = [], fact; while (fact = factRegexp.exec(mystemResponseFacts)) { facts.push(fact[0]); } var resul...
[ "function", "parseResponse", "(", "mystemResponse", ")", "{", "var", "mystemResponseFacts", "=", "mystemResponse", ".", "slice", "(", "mystemResponse", ".", "indexOf", "(", "\"{\"", ")", "+", "1", ",", "-", "1", ")", ",", "factRegexp", "=", "/", "([^,]+\\([^...
Node.js wrapper for `MyStem` morphology text analyzer. Copyright Vyacheslav Slinko <vyacheslav.slinko@gmail.com>
[ "Node", ".", "js", "wrapper", "for", "MyStem", "morphology", "text", "analyzer", ".", "Copyright", "Vyacheslav", "Slinko", "<vyacheslav", ".", "slinko" ]
7f98fac4dfdee2d031eba40f682907cb1f2fdce2
https://github.com/vslinko/mystem-stream/blob/7f98fac4dfdee2d031eba40f682907cb1f2fdce2/lib/parseResponse.js#L6-L25
train
gunins/stonewall
dist/es6/dev/widget/Constructor.js
applyEvents
function applyEvents(context, child, data) { var events = context.events[child.name]; if (events !== undefined && child.el !== undefined && child.data.type !== 'cp') { events.forEach((event)=> { context._events.push(child.on(event.name, event.action, context, data)); ...
javascript
function applyEvents(context, child, data) { var events = context.events[child.name]; if (events !== undefined && child.el !== undefined && child.data.type !== 'cp') { events.forEach((event)=> { context._events.push(child.on(event.name, event.action, context, data)); ...
[ "function", "applyEvents", "(", "context", ",", "child", ",", "data", ")", "{", "var", "events", "=", "context", ".", "events", "[", "child", ".", "name", "]", ";", "if", "(", "events", "!==", "undefined", "&&", "child", ".", "el", "!==", "undefined", ...
Aplying Events to elements @private applyEvents @param {dom.Element} element @param {Array} events @param {Object} data
[ "Aplying", "Events", "to", "elements" ]
eebc6376f83115b6e29d4539582830e917f0e80e
https://github.com/gunins/stonewall/blob/eebc6376f83115b6e29d4539582830e917f0e80e/dist/es6/dev/widget/Constructor.js#L504-L511
train
aigarsdz/metalsmith-mallet
lib/index.js
function (file) { var match = pattern.exec(basename(file)); return { date: match[1], url: match[2] }; }
javascript
function (file) { var match = pattern.exec(basename(file)); return { date: match[1], url: match[2] }; }
[ "function", "(", "file", ")", "{", "var", "match", "=", "pattern", ".", "exec", "(", "basename", "(", "file", ")", ")", ";", "return", "{", "date", ":", "match", "[", "1", "]", ",", "url", ":", "match", "[", "2", "]", "}", ";", "}" ]
Extracts date and permalink parts from a Jekyll style post. @example parseJekyllStylePost("2014-04-05-hello-world.md"); //=> { date: "2014-04-05", url: "hello-world" } @param {String} file @return {Object.<string, string>}
[ "Extracts", "date", "and", "permalink", "parts", "from", "a", "Jekyll", "style", "post", "." ]
6b2b7398d74aab3c07a80cee52b7b980381fe29a
https://github.com/aigarsdz/metalsmith-mallet/blob/6b2b7398d74aab3c07a80cee52b7b980381fe29a/lib/index.js#L39-L43
train
aigarsdz/metalsmith-mallet
lib/index.js
function (userOptions) { var defaultOptions = { ignore: [], collection: null, jekyllStyleLayout: true }; for (var opt in userOptions) defaultOptions[opt] = userOptions[opt]; return defaultOptions; }
javascript
function (userOptions) { var defaultOptions = { ignore: [], collection: null, jekyllStyleLayout: true }; for (var opt in userOptions) defaultOptions[opt] = userOptions[opt]; return defaultOptions; }
[ "function", "(", "userOptions", ")", "{", "var", "defaultOptions", "=", "{", "ignore", ":", "[", "]", ",", "collection", ":", "null", ",", "jekyllStyleLayout", ":", "true", "}", ";", "for", "(", "var", "opt", "in", "userOptions", ")", "defaultOptions", "...
Merges user provided options with the defaults. @param {Object} userOptions @return {Object} Default: { ignore: [] }
[ "Merges", "user", "provided", "options", "with", "the", "defaults", "." ]
6b2b7398d74aab3c07a80cee52b7b980381fe29a
https://github.com/aigarsdz/metalsmith-mallet/blob/6b2b7398d74aab3c07a80cee52b7b980381fe29a/lib/index.js#L62-L68
train
pagespace/pagespace
static/dashboard/app/forms/bs-has-error.js
getClosestFormName
function getClosestFormName(element) { var parent = element.parent(); if(parent[0].tagName.toLowerCase() === 'form') { return parent.attr('name') || null; } else { return getClosestFormName(parent); ...
javascript
function getClosestFormName(element) { var parent = element.parent(); if(parent[0].tagName.toLowerCase() === 'form') { return parent.attr('name') || null; } else { return getClosestFormName(parent); ...
[ "function", "getClosestFormName", "(", "element", ")", "{", "var", "parent", "=", "element", ".", "parent", "(", ")", ";", "if", "(", "parent", "[", "0", "]", ".", "tagName", ".", "toLowerCase", "(", ")", "===", "'form'", ")", "{", "return", "parent", ...
find parent form
[ "find", "parent", "form" ]
943c45ddd9aaa4f3136e1ba4c2593aa0289daf43
https://github.com/pagespace/pagespace/blob/943c45ddd9aaa4f3136e1ba4c2593aa0289daf43/static/dashboard/app/forms/bs-has-error.js#L8-L15
train
zkochan/frame-message
lib/subscriber.js
Subscriber
function Subscriber(opts) { opts = opts || {}; this._channel = opts.channel || 'default'; this._subscribers = []; /* for mocking */ var addEventListener = opts.addEventListener || window.addEventListener; var attachEvent = opts.attachEvent || window.attachEvent; var _this = this; function onMessage(e...
javascript
function Subscriber(opts) { opts = opts || {}; this._channel = opts.channel || 'default'; this._subscribers = []; /* for mocking */ var addEventListener = opts.addEventListener || window.addEventListener; var attachEvent = opts.attachEvent || window.attachEvent; var _this = this; function onMessage(e...
[ "function", "Subscriber", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "_channel", "=", "opts", ".", "channel", "||", "'default'", ";", "this", ".", "_subscribers", "=", "[", "]", ";", "/* for mocking */", "var", "addEv...
An object for subscribing to frame messages. @param {String} [opts.channel=default] - The name of the messaging channel to subscribe to.
[ "An", "object", "for", "subscribing", "to", "frame", "messages", "." ]
550c49694019f0c8f60fe31140eb93947b52c22a
https://github.com/zkochan/frame-message/blob/550c49694019f0c8f60fe31140eb93947b52c22a/lib/subscriber.js#L19-L44
train
joemccann/photopipe
database/redis-client.js
function(keys){ console.log('\nInitializing keys in Redis...\n') keys.forEach(function(el,i){ client.get(el.key, function(e,d){ if(e) { console.log("Error trying to get %s ", el.key) return console.error(e) } // checking for falsey values only is a bad idea if(typeof...
javascript
function(keys){ console.log('\nInitializing keys in Redis...\n') keys.forEach(function(el,i){ client.get(el.key, function(e,d){ if(e) { console.log("Error trying to get %s ", el.key) return console.error(e) } // checking for falsey values only is a bad idea if(typeof...
[ "function", "(", "keys", ")", "{", "console", ".", "log", "(", "'\\nInitializing keys in Redis...\\n'", ")", "keys", ".", "forEach", "(", "function", "(", "el", ",", "i", ")", "{", "client", ".", "get", "(", "el", ".", "key", ",", "function", "(", "e",...
Upon firing up, make sure these baseline keys are set
[ "Upon", "firing", "up", "make", "sure", "these", "baseline", "keys", "are", "set" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L15-L57
train
joemccann/photopipe
database/redis-client.js
function(userObj, setname, hashPrefix, cb){ console.log("\nCreating new user account %s", userObj.network.username) /* userObj = { network: { type : 'facebook', first_name: 'Joe', last_name: 'McCann', username: 'joemccann', full_n...
javascript
function(userObj, setname, hashPrefix, cb){ console.log("\nCreating new user account %s", userObj.network.username) /* userObj = { network: { type : 'facebook', first_name: 'Joe', last_name: 'McCann', username: 'joemccann', full_n...
[ "function", "(", "userObj", ",", "setname", ",", "hashPrefix", ",", "cb", ")", "{", "console", ".", "log", "(", "\"\\nCreating new user account %s\"", ",", "userObj", ".", "network", ".", "username", ")", "/*\n userObj = {\n network: {\n type : 'fac...
Create a new user account in Redis setname is the name of the set to add to hashPrefix is the prefix to identify the hash
[ "Create", "a", "new", "user", "account", "in", "Redis", "setname", "is", "the", "name", "of", "the", "set", "to", "add", "to", "hashPrefix", "is", "the", "prefix", "to", "identify", "the", "hash" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L138-L201
train
joemccann/photopipe
database/redis-client.js
function(userObj, setname, hashPrefix, cb){ // client.srem('users',userObj.uuid, redis.print) var _uuid = sha1('photopipe', userObj.email_address) client.srem(setname, _uuid, function(e,d){ if(cb){ return cb(e,d) } userSetRemoveHandler(e,d)...
javascript
function(userObj, setname, hashPrefix, cb){ // client.srem('users',userObj.uuid, redis.print) var _uuid = sha1('photopipe', userObj.email_address) client.srem(setname, _uuid, function(e,d){ if(cb){ return cb(e,d) } userSetRemoveHandler(e,d)...
[ "function", "(", "userObj", ",", "setname", ",", "hashPrefix", ",", "cb", ")", "{", "// client.srem('users',userObj.uuid, redis.print)", "var", "_uuid", "=", "sha1", "(", "'photopipe'", ",", "userObj", ".", "email_address", ")", "client", ".", "srem", "(", "setn...
Delete user's account from Redis.
[ "Delete", "user", "s", "account", "from", "Redis", "." ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L203-L222
train
joemccann/photopipe
database/redis-client.js
function(e,d){ if(e){ console.log("User set add data response: %s", d) e && console.error(e) return } console.log("User set add data response with no error: %s", d) }
javascript
function(e,d){ if(e){ console.log("User set add data response: %s", d) e && console.error(e) return } console.log("User set add data response with no error: %s", d) }
[ "function", "(", "e", ",", "d", ")", "{", "if", "(", "e", ")", "{", "console", ".", "log", "(", "\"User set add data response: %s\"", ",", "d", ")", "e", "&&", "console", ".", "error", "(", "e", ")", "return", "}", "console", ".", "log", "(", "\"Us...
Callback after setting user to the set of users
[ "Callback", "after", "setting", "user", "to", "the", "set", "of", "users" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/database/redis-client.js#L224-L231
train
MegrezZhu/SYSU-JWXT
index.js
decorate
function decorate (fn) { return async function (...args) { try { return fn.call(this, ...args); } catch (err) { this.logger && this.logger.error(err.message); throw err; } }; }
javascript
function decorate (fn) { return async function (...args) { try { return fn.call(this, ...args); } catch (err) { this.logger && this.logger.error(err.message); throw err; } }; }
[ "function", "decorate", "(", "fn", ")", "{", "return", "async", "function", "(", "...", "args", ")", "{", "try", "{", "return", "fn", ".", "call", "(", "this", ",", "...", "args", ")", ";", "}", "catch", "(", "err", ")", "{", "this", ".", "logger...
decorator-like function that wraps the methods
[ "decorator", "-", "like", "function", "that", "wraps", "the", "methods" ]
125c51328994d8c538463116758a5a710a185646
https://github.com/MegrezZhu/SYSU-JWXT/blob/125c51328994d8c538463116758a5a710a185646/index.js#L35-L44
train
maxcnunes/spawn-auto-restart
src/index.js
start
function start() { proc = spawn(procCommand, procArgs, procOptions); var onClose = function (code) { if (!restarting) { process.exit(code); } start(); restarting = false; }; proc.on('error', function () { debug('restarting due error'); restarting = true; ...
javascript
function start() { proc = spawn(procCommand, procArgs, procOptions); var onClose = function (code) { if (!restarting) { process.exit(code); } start(); restarting = false; }; proc.on('error', function () { debug('restarting due error'); restarting = true; ...
[ "function", "start", "(", ")", "{", "proc", "=", "spawn", "(", "procCommand", ",", "procArgs", ",", "procOptions", ")", ";", "var", "onClose", "=", "function", "(", "code", ")", "{", "if", "(", "!", "restarting", ")", "{", "process", ".", "exit", "("...
start the child process
[ "start", "the", "child", "process" ]
ba0b9cfd4a4b55abe6b65f4c77fc4fa56bff589b
https://github.com/maxcnunes/spawn-auto-restart/blob/ba0b9cfd4a4b55abe6b65f4c77fc4fa56bff589b/src/index.js#L42-L60
train
75lb/common-sequence
lib/common-sequence.js
commonSequence
function commonSequence(a, b){ var result = []; for (var i = 0; i < Math.min(a.length, b.length); i++){ if (a[i] === b[i]){ result.push(a[i]); } else { break; } } return result; }
javascript
function commonSequence(a, b){ var result = []; for (var i = 0; i < Math.min(a.length, b.length); i++){ if (a[i] === b[i]){ result.push(a[i]); } else { break; } } return result; }
[ "function", "commonSequence", "(", "a", ",", "b", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "Math", ".", "min", "(", "a", ".", "length", ",", "b", ".", "length", ")", ";", "i", "++", ")"...
Returns the initial elements which both input arrays have in common @param {Array} - first array to compare @param {Array} - second array to compare @returns {Array} @alias module:common-sequence
[ "Returns", "the", "initial", "elements", "which", "both", "input", "arrays", "have", "in", "common" ]
bdfd45b1358fd8fc8f90c90dde9960cc9555fb01
https://github.com/75lb/common-sequence/blob/bdfd45b1358fd8fc8f90c90dde9960cc9555fb01/lib/common-sequence.js#L34-L44
train
jmanero/simple-uid
index.js
generator
function generator(url) { var randomnesss = Crypto.randomBytes(24); randomnesss.writeDoubleBE(Date.now(), 0); randomnesss.writeUInt32BE(process.pid, 8); var output = randomnesss.toString('base64'); // URL safe if (url) { output = output.replace(/\//g, '_'); output = output.replace(/\+/g, '-'); } return o...
javascript
function generator(url) { var randomnesss = Crypto.randomBytes(24); randomnesss.writeDoubleBE(Date.now(), 0); randomnesss.writeUInt32BE(process.pid, 8); var output = randomnesss.toString('base64'); // URL safe if (url) { output = output.replace(/\//g, '_'); output = output.replace(/\+/g, '-'); } return o...
[ "function", "generator", "(", "url", ")", "{", "var", "randomnesss", "=", "Crypto", ".", "randomBytes", "(", "24", ")", ";", "randomnesss", ".", "writeDoubleBE", "(", "Date", ".", "now", "(", ")", ",", "0", ")", ";", "randomnesss", ".", "writeUInt32BE", ...
Generates a string composed of the millisecond date, the current PID, and some random bytes @returns String
[ "Generates", "a", "string", "composed", "of", "the", "millisecond", "date", "the", "current", "PID", "and", "some", "random", "bytes" ]
19e8a40bd800b7e31a41b7ca5cfec56e6f8507dd
https://github.com/jmanero/simple-uid/blob/19e8a40bd800b7e31a41b7ca5cfec56e6f8507dd/index.js#L9-L23
train
NumminorihSF/bramqp-wrapper
domain/confirm.js
Confirm
function Confirm(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
javascript
function Confirm(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
[ "function", "Confirm", "(", "client", ",", "channel", ")", "{", "EE", ".", "call", "(", "this", ")", ";", "this", ".", "client", "=", "client", ";", "this", ".", "channel", "=", "channel", ";", "this", ".", "id", "=", "channel", ".", "$getId", "(",...
Work with confirms. The Confirm class allows publishers to put the channel in confirm mode and susequently be notified when messages have been handled by the broker. The intention is that all messages published on a channel in confirm mode will be acknowledged at some point. By acknowledging a message the broker assum...
[ "Work", "with", "confirms", "." ]
3e2bd769a2828f7592eba79556c9ef1491177781
https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/confirm.js#L27-L34
train
reworkcss/rework-plugin-mixin
index.js
mixin
function mixin(rework, declarations, mixins) { for (var i = 0; i < declarations.length; ++i) { var decl = declarations[i]; if ('comment' == decl.type) continue; var key = decl.property; var val = decl.value; var fn = mixins[key]; if (!fn) continue; // invoke mixin var ret = fn.call(r...
javascript
function mixin(rework, declarations, mixins) { for (var i = 0; i < declarations.length; ++i) { var decl = declarations[i]; if ('comment' == decl.type) continue; var key = decl.property; var val = decl.value; var fn = mixins[key]; if (!fn) continue; // invoke mixin var ret = fn.call(r...
[ "function", "mixin", "(", "rework", ",", "declarations", ",", "mixins", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "declarations", ".", "length", ";", "++", "i", ")", "{", "var", "decl", "=", "declarations", "[", "i", "]", ";", "i...
Visit declarations and apply mixins. @param {Rework} rework @param {Array} declarations @param {Object} mixins @api private
[ "Visit", "declarations", "and", "apply", "mixins", "." ]
cd7c6edfad40cccff67cf764e90e9c4fd0c49f71
https://github.com/reworkcss/rework-plugin-mixin/blob/cd7c6edfad40cccff67cf764e90e9c4fd0c49f71/index.js#L30-L66
train
lamansky/cached-function
index.js
generateKey
function generateKey (args, strictArgMatch = true) { args = Array.from(args) if (strictArgMatch) return args return args.map(arg => maybeStringify(arg)) }
javascript
function generateKey (args, strictArgMatch = true) { args = Array.from(args) if (strictArgMatch) return args return args.map(arg => maybeStringify(arg)) }
[ "function", "generateKey", "(", "args", ",", "strictArgMatch", "=", "true", ")", "{", "args", "=", "Array", ".", "from", "(", "args", ")", "if", "(", "strictArgMatch", ")", "return", "args", "return", "args", ".", "map", "(", "arg", "=>", "maybeStringify...
Generates the representation of function arguments which will be used to store and retrieve return values in the cache. @param {array|object} args An array-like collection of the function's arguments. @param {bool} [strictArgMatch=true] Whether or not to match function arguments based on their serialized representati...
[ "Generates", "the", "representation", "of", "function", "arguments", "which", "will", "be", "used", "to", "store", "and", "retrieve", "return", "values", "in", "the", "cache", "." ]
794ade3f2bd93160d110ad776648e75716ea2500
https://github.com/lamansky/cached-function/blob/794ade3f2bd93160d110ad776648e75716ea2500/index.js#L29-L33
train
windmaomao/ng-admin-restify
src/ng-admin.js
function(model) { var fields = _.keys(model); var updated = {}; _.each(fields, function(field) { var updatedField = {}; var modelField = {}; if (!(field === Object(field))) { updatedField.field = field; if (!(model[field] === Object(model[field]))) {...
javascript
function(model) { var fields = _.keys(model); var updated = {}; _.each(fields, function(field) { var updatedField = {}; var modelField = {}; if (!(field === Object(field))) { updatedField.field = field; if (!(model[field] === Object(model[field]))) {...
[ "function", "(", "model", ")", "{", "var", "fields", "=", "_", ".", "keys", "(", "model", ")", ";", "var", "updated", "=", "{", "}", ";", "_", ".", "each", "(", "fields", ",", "function", "(", "field", ")", "{", "var", "updatedField", "=", "{", ...
convert model and merge with nga fields
[ "convert", "model", "and", "merge", "with", "nga", "fields" ]
d86d8c12eb07e1b23def2f5de0832aa357c2a731
https://github.com/windmaomao/ng-admin-restify/blob/d86d8c12eb07e1b23def2f5de0832aa357c2a731/src/ng-admin.js#L227-L249
train
supercrabtree/tie-dye
rgbToHex.js
rgbToHex
function rgbToHex(r, g, b) { var integer = ((Math.round(r) & 0xFF) << 16) + ((Math.round(g) & 0xFF) << 8) + (Math.round(b) & 0xFF); var string = integer.toString(16).toUpperCase(); return '#' + ('000000'.substring(string.length) + string); }
javascript
function rgbToHex(r, g, b) { var integer = ((Math.round(r) & 0xFF) << 16) + ((Math.round(g) & 0xFF) << 8) + (Math.round(b) & 0xFF); var string = integer.toString(16).toUpperCase(); return '#' + ('000000'.substring(string.length) + string); }
[ "function", "rgbToHex", "(", "r", ",", "g", ",", "b", ")", "{", "var", "integer", "=", "(", "(", "Math", ".", "round", "(", "r", ")", "&", "0xFF", ")", "<<", "16", ")", "+", "(", "(", "Math", ".", "round", "(", "g", ")", "&", "0xFF", ")", ...
Convert a color from RGB to hexidecimal @param {number} r - A value from 0 - 255 @param {number} g - A value from 0 - 255 @param {number} b - A value from 0 - 255 @returns {string} In the format #000000
[ "Convert", "a", "color", "from", "RGB", "to", "hexidecimal" ]
1bf045767ce1a3fcf88450fbf95f72b5646f63df
https://github.com/supercrabtree/tie-dye/blob/1bf045767ce1a3fcf88450fbf95f72b5646f63df/rgbToHex.js#L9-L16
train
espadrine/queread
src/tokenizer/time.js
nthWeekDay
function nthWeekDay(countDays, weekDay, year, month, day) { let countedDays = 0 if (countDays >= 0) { month = month || 1 let monthStr = String(month) if (monthStr.length === 1) { monthStr = "0" + monthStr } day = day || 1 let dayStr = String(day) if (dayStr.length === 1) { dayStr = "0" + day...
javascript
function nthWeekDay(countDays, weekDay, year, month, day) { let countedDays = 0 if (countDays >= 0) { month = month || 1 let monthStr = String(month) if (monthStr.length === 1) { monthStr = "0" + monthStr } day = day || 1 let dayStr = String(day) if (dayStr.length === 1) { dayStr = "0" + day...
[ "function", "nthWeekDay", "(", "countDays", ",", "weekDay", ",", "year", ",", "month", ",", "day", ")", "{", "let", "countedDays", "=", "0", "if", "(", "countDays", ">=", "0", ")", "{", "month", "=", "month", "||", "1", "let", "monthStr", "=", "Strin...
eg. second friday of 2015
[ "eg", ".", "second", "friday", "of", "2015" ]
5a0d5017ee1d1911983cc5252a27e160438837f7
https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/src/tokenizer/time.js#L507-L545
train
espadrine/queread
src/tokenizer/time.js
lastDayOfMonth
function lastDayOfMonth(time) { let year = time.getUTCFullYear() let nextMonth = time.getUTCMonth() + 2 if (nextMonth > 12) { year++ nextMonth = 1 } let nextMonthStr = String(nextMonth) if (nextMonthStr.length === 1) { nextMonthStr = '0' + nextMonthStr } let date = new Date(`${year}-${nextMonthStr...
javascript
function lastDayOfMonth(time) { let year = time.getUTCFullYear() let nextMonth = time.getUTCMonth() + 2 if (nextMonth > 12) { year++ nextMonth = 1 } let nextMonthStr = String(nextMonth) if (nextMonthStr.length === 1) { nextMonthStr = '0' + nextMonthStr } let date = new Date(`${year}-${nextMonthStr...
[ "function", "lastDayOfMonth", "(", "time", ")", "{", "let", "year", "=", "time", ".", "getUTCFullYear", "(", ")", "let", "nextMonth", "=", "time", ".", "getUTCMonth", "(", ")", "+", "2", "if", "(", "nextMonth", ">", "12", ")", "{", "year", "++", "nex...
Takes a Date, returns the date of the last day of the corresponding month. eg, 31.
[ "Takes", "a", "Date", "returns", "the", "date", "of", "the", "last", "day", "of", "the", "corresponding", "month", ".", "eg", "31", "." ]
5a0d5017ee1d1911983cc5252a27e160438837f7
https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/src/tokenizer/time.js#L563-L574
train
boylesoftware/x2node-rsparser
index.js
processKeyProperty
function processKeyProperty(propDesc, keyPropContainer) { // get the key property descriptor const keyPropName = propDesc._keyPropertyName; if (!keyPropContainer.hasProperty(keyPropName)) throw invalidPropDef( propDesc, 'key property ' + keyPropName + ' not found among the target object properties.'); con...
javascript
function processKeyProperty(propDesc, keyPropContainer) { // get the key property descriptor const keyPropName = propDesc._keyPropertyName; if (!keyPropContainer.hasProperty(keyPropName)) throw invalidPropDef( propDesc, 'key property ' + keyPropName + ' not found among the target object properties.'); con...
[ "function", "processKeyProperty", "(", "propDesc", ",", "keyPropContainer", ")", "{", "// get the key property descriptor", "const", "keyPropName", "=", "propDesc", ".", "_keyPropertyName", ";", "if", "(", "!", "keyPropContainer", ".", "hasProperty", "(", "keyPropName",...
Process key property name definition attribute and set the property descriptor's key property value type and reference target accordingly. @private @param {module:x2node-records~PropertyDescriptor} propDesc Map property descriptor. @param {module:x2node-records~PropertiesContainer} keyPropContainer Key property contai...
[ "Process", "key", "property", "name", "definition", "attribute", "and", "set", "the", "property", "descriptor", "s", "key", "property", "value", "type", "and", "reference", "target", "accordingly", "." ]
716526a2f2653b22ee1455800dce1bd95f25ddfb
https://github.com/boylesoftware/x2node-rsparser/blob/716526a2f2653b22ee1455800dce1bd95f25ddfb/index.js#L187-L207
train
linyngfly/omelo
lib/connectors/commands/handshake.js
function(opts) { opts = opts || {}; this.userHandshake = opts.handshake; if(opts.heartbeat) { this.heartbeatSec = opts.heartbeat; this.heartbeat = opts.heartbeat * 1000; } this.checkClient = opts.checkClient; this.useDict = opts.useDict; this.useProtobuf = opts.useProtobuf; this.useCrypto = o...
javascript
function(opts) { opts = opts || {}; this.userHandshake = opts.handshake; if(opts.heartbeat) { this.heartbeatSec = opts.heartbeat; this.heartbeat = opts.heartbeat * 1000; } this.checkClient = opts.checkClient; this.useDict = opts.useDict; this.useProtobuf = opts.useProtobuf; this.useCrypto = o...
[ "function", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "userHandshake", "=", "opts", ".", "handshake", ";", "if", "(", "opts", ".", "heartbeat", ")", "{", "this", ".", "heartbeatSec", "=", "opts", ".", "heartbeat", ...
Process the handshake request. @param {Object} opts option parameters opts.handshake(msg, cb(err, resp)) handshake callback. msg is the handshake message from client. opts.hearbeat heartbeat interval (level?) opts.version required client level
[ "Process", "the", "handshake", "request", "." ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/connectors/commands/handshake.js#L16-L30
train
ariatemplates/noder-js
src/plugins/noderError/evalError.js
formatError
function formatError(err, input) { var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number var bm = ('' + input.slice(0, err.pos)).match(/.*$/i); var am = ('' + input.slice(err.pos)).match(/.*/i); var before = bm ? bm[0] : ''; var after = am ? am[0] : ''; ...
javascript
function formatError(err, input) { var msg = err.message.replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number var bm = ('' + input.slice(0, err.pos)).match(/.*$/i); var am = ('' + input.slice(err.pos)).match(/.*/i); var before = bm ? bm[0] : ''; var after = am ? am[0] : ''; ...
[ "function", "formatError", "(", "err", ",", "input", ")", "{", "var", "msg", "=", "err", ".", "message", ".", "replace", "(", "/", "\\s*\\(\\d*\\:\\d*\\)\\s*$", "/", "i", ",", "''", ")", ";", "// remove line number / col number", "var", "bm", "=", "(", "''...
Format the error as an error structure with line extract information
[ "Format", "the", "error", "as", "an", "error", "structure", "with", "line", "extract", "information" ]
c2db684299d907b2035fa427f030cf08da8ceb57
https://github.com/ariatemplates/noder-js/blob/c2db684299d907b2035fa427f030cf08da8ceb57/src/plugins/noderError/evalError.js#L22-L46
train
SolarNetwork/solarnetwork-d3
src/ui/pixelWidth.js
sn_ui_pixelWidth
function sn_ui_pixelWidth(selector) { if ( selector === undefined ) { return undefined; } var styleWidth = d3.select(selector).style('width'); if ( !styleWidth ) { return null; } var pixels = styleWidth.match(/([0-9.]+)px/); if ( pixels === null ) { return null; } var result = Math.floor(pixels[1]); if ...
javascript
function sn_ui_pixelWidth(selector) { if ( selector === undefined ) { return undefined; } var styleWidth = d3.select(selector).style('width'); if ( !styleWidth ) { return null; } var pixels = styleWidth.match(/([0-9.]+)px/); if ( pixels === null ) { return null; } var result = Math.floor(pixels[1]); if ...
[ "function", "sn_ui_pixelWidth", "(", "selector", ")", "{", "if", "(", "selector", "===", "undefined", ")", "{", "return", "undefined", ";", "}", "var", "styleWidth", "=", "d3", ".", "select", "(", "selector", ")", ".", "style", "(", "'width'", ")", ";", ...
Get the width of an element based on a selector, in pixels. @param {string} selector - a selector to an element to get the width of @returns {number} the width, or {@code undefined} if {@code selector} is undefined, or {@code null} if the width cannot be computed in pixels
[ "Get", "the", "width", "of", "an", "element", "based", "on", "a", "selector", "in", "pixels", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/ui/pixelWidth.js#L12-L29
train
moxystudio/react-redata
src/redata.js
create
function create(loader, shouldReload = defaultShouldReload, mapper = defaultMapper, initialCtx = defaultInitialCtx) { // Initialise context, which is passed around and holds the lastData. const ctx = initialCtx; // TODO: instead of providing a full initial context, the redata() function below should receive ...
javascript
function create(loader, shouldReload = defaultShouldReload, mapper = defaultMapper, initialCtx = defaultInitialCtx) { // Initialise context, which is passed around and holds the lastData. const ctx = initialCtx; // TODO: instead of providing a full initial context, the redata() function below should receive ...
[ "function", "create", "(", "loader", ",", "shouldReload", "=", "defaultShouldReload", ",", "mapper", "=", "defaultMapper", ",", "initialCtx", "=", "defaultInitialCtx", ")", "{", "// Initialise context, which is passed around and holds the lastData.", "const", "ctx", "=", ...
redata's data object definition @typedef {Object} Data @property {boolean} loading - true if the loader is still running, false otherwise. @property {error} error - instance of Error in case the loader failed, undefined otherwise. @property {*} result - result of the loader, or undefined if the loader is still running....
[ "redata", "s", "data", "object", "definition" ]
19f5c548b8dbc3f71fb14077e9740f9dd62bb10a
https://github.com/moxystudio/react-redata/blob/19f5c548b8dbc3f71fb14077e9740f9dd62bb10a/src/redata.js#L20-L57
train
molnarg/node-http2-protocol
example/client.js
onConnection
function onConnection() { var endpoint = new http2.Endpoint(log, 'CLIENT', {}); endpoint.pipe(socket).pipe(endpoint); // Sending request var stream = endpoint.createStream(); stream.headers({ ':method': 'GET', ':scheme': url.protocol.slice(0, url.protocol.length - 1), ':authority': url.hostname, ...
javascript
function onConnection() { var endpoint = new http2.Endpoint(log, 'CLIENT', {}); endpoint.pipe(socket).pipe(endpoint); // Sending request var stream = endpoint.createStream(); stream.headers({ ':method': 'GET', ':scheme': url.protocol.slice(0, url.protocol.length - 1), ':authority': url.hostname, ...
[ "function", "onConnection", "(", ")", "{", "var", "endpoint", "=", "new", "http2", ".", "Endpoint", "(", "log", ",", "'CLIENT'", ",", "{", "}", ")", ";", "endpoint", ".", "pipe", "(", "socket", ")", ".", "pipe", "(", "endpoint", ")", ";", "// Sending...
Handling the connection
[ "Handling", "the", "connection" ]
a03dff630a33771d045ac0362023afb84b441aa4
https://github.com/molnarg/node-http2-protocol/blob/a03dff630a33771d045ac0362023afb84b441aa4/example/client.js#L25-L49
train
thlorenz/node-traceur
demo/generators.js
iterateElements
function iterateElements(array) { return { __iterator__: function() { var index = 0; var current; return { get current() { return current; }, moveNext: function() { if (index < array.length) { current = array[index++]; return tr...
javascript
function iterateElements(array) { return { __iterator__: function() { var index = 0; var current; return { get current() { return current; }, moveNext: function() { if (index < array.length) { current = array[index++]; return tr...
[ "function", "iterateElements", "(", "array", ")", "{", "return", "{", "__iterator__", ":", "function", "(", ")", "{", "var", "index", "=", "0", ";", "var", "current", ";", "return", "{", "get", "current", "(", ")", "{", "return", "current", ";", "}", ...
Example 1. Writing an iterator over an array
[ "Example", "1", ".", "Writing", "an", "iterator", "over", "an", "array" ]
79a21ad03831ba36df504988b05022404ad8f9c3
https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/demo/generators.js#L4-L23
train
BetterCallSky/decorate-it
dist/decorator.js
validate
function validate(method) { var decorated = function validateDecorator() { var params = method.params; var schema = method.schema; for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var value = _combineObject(param...
javascript
function validate(method) { var decorated = function validateDecorator() { var params = method.params; var schema = method.schema; for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var value = _combineObject(param...
[ "function", "validate", "(", "method", ")", "{", "var", "decorated", "=", "function", "validateDecorator", "(", ")", "{", "var", "params", "=", "method", ".", "params", ";", "var", "schema", "=", "method", ".", "schema", ";", "for", "(", "var", "_len2", ...
Decorator for validating with Joi @param {Function} method the method to decorate @param {Array} method.params the method parameters @param {Object} method.schema the joi schema @param {Boolean} method.sync the flag if method is sync or async @returns {Function} the decorator
[ "Decorator", "for", "validating", "with", "Joi" ]
8807a65c80a88255227c4ce818d151b4dc979683
https://github.com/BetterCallSky/decorate-it/blob/8807a65c80a88255227c4ce818d151b4dc979683/dist/decorator.js#L218-L247
train
BetterCallSky/decorate-it
dist/decorator.js
decorate
function decorate(service, serviceName) { var logger = _config.loggerFactory(serviceName, _config); _lodash2.default.map(service, function (method, name) { method.methodName = name; if (!method.params) { method.params = (0, _getParameterNames2.default)(method); } service[name] = log(validate(m...
javascript
function decorate(service, serviceName) { var logger = _config.loggerFactory(serviceName, _config); _lodash2.default.map(service, function (method, name) { method.methodName = name; if (!method.params) { method.params = (0, _getParameterNames2.default)(method); } service[name] = log(validate(m...
[ "function", "decorate", "(", "service", ",", "serviceName", ")", "{", "var", "logger", "=", "_config", ".", "loggerFactory", "(", "serviceName", ",", "_config", ")", ";", "_lodash2", ".", "default", ".", "map", "(", "service", ",", "function", "(", "method...
Decorate all methods in the service @param {Object} service the service object @param {String} serviceName the service name
[ "Decorate", "all", "methods", "in", "the", "service" ]
8807a65c80a88255227c4ce818d151b4dc979683
https://github.com/BetterCallSky/decorate-it/blob/8807a65c80a88255227c4ce818d151b4dc979683/dist/decorator.js#L254-L263
train
zenozeng/interval.js
lib/interval.js
Interval
function Interval(func, options) { this.func = func; this.delay = options.delay || 16; this.lifetime = options.lifetime; this.useRequestAnimationFrame = options.useRequestAnimationFrame && window.requestAnimationFrame && window.cancelAnimationFrame; this.interval = null; this.gcTimeout = null; }
javascript
function Interval(func, options) { this.func = func; this.delay = options.delay || 16; this.lifetime = options.lifetime; this.useRequestAnimationFrame = options.useRequestAnimationFrame && window.requestAnimationFrame && window.cancelAnimationFrame; this.interval = null; this.gcTimeout = null; }
[ "function", "Interval", "(", "func", ",", "options", ")", "{", "this", ".", "func", "=", "func", ";", "this", ".", "delay", "=", "options", ".", "delay", "||", "16", ";", "this", ".", "lifetime", "=", "options", ".", "lifetime", ";", "this", ".", "...
Interval.js @constructor @param {function} func - The function you want to be called repeatly @param {int} delay - milliseconds that should wait before each call @param {int} lifetime - if set, clearInterval will be called after `lifetime` milliseconds
[ "Interval", ".", "js" ]
7a8d112378b44a0e2ae6f989c65d290200ea6485
https://github.com/zenozeng/interval.js/blob/7a8d112378b44a0e2ae6f989c65d290200ea6485/lib/interval.js#L9-L16
train
cirocosta/yaspm
src/Device.js
Device
function Device (device, sp) { if (!(device && sp)) throw new Error('a Device and a SerialPort must be passed'); for (var i in device) this[i] = device[i]; this._open = false; this._sp = sp; EventEmitter.call(this); }
javascript
function Device (device, sp) { if (!(device && sp)) throw new Error('a Device and a SerialPort must be passed'); for (var i in device) this[i] = device[i]; this._open = false; this._sp = sp; EventEmitter.call(this); }
[ "function", "Device", "(", "device", ",", "sp", ")", "{", "if", "(", "!", "(", "device", "&&", "sp", ")", ")", "throw", "new", "Error", "(", "'a Device and a SerialPort must be passed'", ")", ";", "for", "(", "var", "i", "in", "device", ")", "this", "[...
Represents a valid Device. emits: - connect - disconnect - error @param {obj} device the info about the device @param {obj} sp serialport object
[ "Represents", "a", "valid", "Device", "." ]
676524906425ba99b1e6f95a75ce4a82501a0ee9
https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/Device.js#L21-L32
train
NumminorihSF/bramqp-wrapper
domain/exchange.js
Exchange
function Exchange(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
javascript
function Exchange(client, channel){ EE.call(this); this.client = client; this.channel = channel; this.id = channel.$getId(); return this; }
[ "function", "Exchange", "(", "client", ",", "channel", ")", "{", "EE", ".", "call", "(", "this", ")", ";", "this", ".", "client", "=", "client", ";", "this", ".", "channel", "=", "channel", ";", "this", ".", "id", "=", "channel", ".", "$getId", "("...
Work with exchanges. Exchanges match and distribute messages across queues. Exchanges can be configured in the server or declared at runtime. @extends EventEmitter @param {BRAMQPClient} client Client object that returns from bramqp#openAMQPCommunication() method. @param {Channel} channel Channel object (should be open...
[ "Work", "with", "exchanges", "." ]
3e2bd769a2828f7592eba79556c9ef1491177781
https://github.com/NumminorihSF/bramqp-wrapper/blob/3e2bd769a2828f7592eba79556c9ef1491177781/domain/exchange.js#L26-L33
train
brandtabbott/spotify-server
public/js/spotify-client.js
sortByAttributeNameComparitor
function sortByAttributeNameComparitor(a,b) { if (a.attributes.name < b.attributes.name) return -1; if (a.attributes.name > b.attributes.name) return 1; return 0; }
javascript
function sortByAttributeNameComparitor(a,b) { if (a.attributes.name < b.attributes.name) return -1; if (a.attributes.name > b.attributes.name) return 1; return 0; }
[ "function", "sortByAttributeNameComparitor", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "attributes", ".", "name", "<", "b", ".", "attributes", ".", "name", ")", "return", "-", "1", ";", "if", "(", "a", ".", "attributes", ".", "name", ">", ...
Sort function for playlists
[ "Sort", "function", "for", "playlists" ]
d4451e64faaa201c620a118f4978f3c1b514386f
https://github.com/brandtabbott/spotify-server/blob/d4451e64faaa201c620a118f4978f3c1b514386f/public/js/spotify-client.js#L207-L214
train
ashpool/telldus-live-promise
lib/devices.js
turnOn
function turnOn(device) { return api.request('/device/turnOn?' + querystring.stringify({id: device.id || device})); }
javascript
function turnOn(device) { return api.request('/device/turnOn?' + querystring.stringify({id: device.id || device})); }
[ "function", "turnOn", "(", "device", ")", "{", "return", "api", ".", "request", "(", "'/device/turnOn?'", "+", "querystring", ".", "stringify", "(", "{", "id", ":", "device", ".", "id", "||", "device", "}", ")", ")", ";", "}" ]
Turns a device off @param device either {id: anId} or anId @returns {*} a Promise
[ "Turns", "a", "device", "off" ]
ee13365136da640d78907f468b19580bdd8545d8
https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L17-L19
train
ashpool/telldus-live-promise
lib/devices.js
turnOff
function turnOff(device) { return api.request('/device/turnOff?' + querystring.stringify({id: device.id || device})); }
javascript
function turnOff(device) { return api.request('/device/turnOff?' + querystring.stringify({id: device.id || device})); }
[ "function", "turnOff", "(", "device", ")", "{", "return", "api", ".", "request", "(", "'/device/turnOff?'", "+", "querystring", ".", "stringify", "(", "{", "id", ":", "device", ".", "id", "||", "device", "}", ")", ")", ";", "}" ]
Turns a device on @param device either {id: anId} or anId @returns {*} a Promise
[ "Turns", "a", "device", "on" ]
ee13365136da640d78907f468b19580bdd8545d8
https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L26-L28
train
ashpool/telldus-live-promise
lib/devices.js
history
function history(device, from, to) { return api.request('/device/history?' + querystring.stringify({id: device.id || device, from: from, to: to})); }
javascript
function history(device, from, to) { return api.request('/device/history?' + querystring.stringify({id: device.id || device, from: from, to: to})); }
[ "function", "history", "(", "device", ",", "from", ",", "to", ")", "{", "return", "api", ".", "request", "(", "'/device/history?'", "+", "querystring", ".", "stringify", "(", "{", "id", ":", "device", ".", "id", "||", "device", ",", "from", ":", "from"...
Returns device history @param device either {id: anId} or anId @param from timestamp in seconds @param to timestamp in seconds @returns {*} a Promise
[ "Returns", "device", "history" ]
ee13365136da640d78907f468b19580bdd8545d8
https://github.com/ashpool/telldus-live-promise/blob/ee13365136da640d78907f468b19580bdd8545d8/lib/devices.js#L37-L39
train
iolo/express-toybox
multipart.js
multipart
function multipart(options) { options = options || {}; DEBUG && debug('configure http multipart middleware', options); return function (req, res, next) { if (req._body || !req.is('multipart/form-data') || 'POST' !== req.method) { return next(); } DEBUG && debug('got mult...
javascript
function multipart(options) { options = options || {}; DEBUG && debug('configure http multipart middleware', options); return function (req, res, next) { if (req._body || !req.is('multipart/form-data') || 'POST' !== req.method) { return next(); } DEBUG && debug('got mult...
[ "function", "multipart", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "DEBUG", "&&", "debug", "(", "'configure http multipart middleware'", ",", "options", ")", ";", "return", "function", "(", "req", ",", "res", ",", "next", ")...
multipart middleware using "multiparty". @param {*} [options] @param {String} [encoding='utf8'] @param {String} [uploadDir=os.tmpdir()] @param {String} [keepExtensions=false] @param {Number} [maxFields=2*1024*1024] @param {Number} [maxFieldsSize=1000] @param {Number} [maxFilesSize=Infinity] @param {String} [hash=false...
[ "multipart", "middleware", "using", "multiparty", "." ]
c375a1388cfc167017e8dcd2325e71ca86ccb994
https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/multipart.js#L28-L51
train
aledbf/deis-api
lib/domains.js
add
function add(appName, domain, callback) { commons.post(format('/%s/apps/%s/domains/', deis.version, appName), { domain: domain.toString() }, callback); }
javascript
function add(appName, domain, callback) { commons.post(format('/%s/apps/%s/domains/', deis.version, appName), { domain: domain.toString() }, callback); }
[ "function", "add", "(", "appName", ",", "domain", ",", "callback", ")", "{", "commons", ".", "post", "(", "format", "(", "'/%s/apps/%s/domains/'", ",", "deis", ".", "version", ",", "appName", ")", ",", "{", "domain", ":", "domain", ".", "toString", "(", ...
Add a domain to an app registered with the Deis controller.
[ "Add", "a", "domain", "to", "an", "app", "registered", "with", "the", "Deis", "controller", "." ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/domains.js#L10-L14
train
aledbf/deis-api
lib/domains.js
remove
function remove(appName, domain, callback) { var url = format('/%s/apps/%s/domains/%s', deis.version, appName, domain); commons.del(url, callback); }
javascript
function remove(appName, domain, callback) { var url = format('/%s/apps/%s/domains/%s', deis.version, appName, domain); commons.del(url, callback); }
[ "function", "remove", "(", "appName", ",", "domain", ",", "callback", ")", "{", "var", "url", "=", "format", "(", "'/%s/apps/%s/domains/%s'", ",", "deis", ".", "version", ",", "appName", ",", "domain", ")", ";", "commons", ".", "del", "(", "url", ",", ...
Remove a domain registered on an application.
[ "Remove", "a", "domain", "registered", "on", "an", "application", "." ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/domains.js#L19-L22
train
aledbf/deis-api
lib/domains.js
getAll
function getAll(appName, callback) { var url = format('/%s/apps/%s/domains/', deis.version, appName); commons.get(endpoint, callback); }
javascript
function getAll(appName, callback) { var url = format('/%s/apps/%s/domains/', deis.version, appName); commons.get(endpoint, callback); }
[ "function", "getAll", "(", "appName", ",", "callback", ")", "{", "var", "url", "=", "format", "(", "'/%s/apps/%s/domains/'", ",", "deis", ".", "version", ",", "appName", ")", ";", "commons", ".", "get", "(", "endpoint", ",", "callback", ")", ";", "}" ]
Get all the domains for an application.
[ "Get", "all", "the", "domains", "for", "an", "application", "." ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/domains.js#L27-L30
train
aledbf/deis-api
lib/domains.js
getDomain
function getDomain(domain, callback) { getAll(function onGetAll(err, domains) { if (err) { return callback(err); } callback(null, domains.results.filter(function onGetDomain(domain_obj) { return domain_obj.domain == domain; })[0]); }); }
javascript
function getDomain(domain, callback) { getAll(function onGetAll(err, domains) { if (err) { return callback(err); } callback(null, domains.results.filter(function onGetDomain(domain_obj) { return domain_obj.domain == domain; })[0]); }); }
[ "function", "getDomain", "(", "domain", ",", "callback", ")", "{", "getAll", "(", "function", "onGetAll", "(", "err", ",", "domains", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", ";", "}", "callback", "(", "null", ",",...
Get a domain by it's name.
[ "Get", "a", "domain", "by", "it", "s", "name", "." ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/domains.js#L35-L45
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target) { var inst = this._getInst(target); if (!inst) { return FALSE; } $("#sbHolder_" + inst.uid).remove(); $.data(target, PROP_NAME, null); $(target).show(); }
javascript
function (target) { var inst = this._getInst(target); if (!inst) { return FALSE; } $("#sbHolder_" + inst.uid).remove(); $.data(target, PROP_NAME, null); $(target).show(); }
[ "function", "(", "target", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "if", "(", "!", "inst", ")", "{", "return", "FALSE", ";", "}", "$", "(", "\"#sbHolder_\"", "+", "inst", ".", "uid", ")", ".", "remove", "("...
Remove the selectbox functionality completely. This will return the element back to its pre-init state. @param {HTMLElement} target
[ "Remove", "the", "selectbox", "functionality", "completely", ".", "This", "will", "return", "the", "element", "back", "to", "its", "pre", "-", "init", "state", "." ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L231-L239
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target, value, text) { var inst = this._getInst(target), onChange = this._get(inst, 'onChange'); $("#sbSelector_" + inst.uid).text(text); $(target).find("option[value='" + value + "']").attr("selected", TRUE); if (onChange) { onChange.apply((inst.input ? inst.input[0] : null), [value...
javascript
function (target, value, text) { var inst = this._getInst(target), onChange = this._get(inst, 'onChange'); $("#sbSelector_" + inst.uid).text(text); $(target).find("option[value='" + value + "']").attr("selected", TRUE); if (onChange) { onChange.apply((inst.input ? inst.input[0] : null), [value...
[ "function", "(", "target", ",", "value", ",", "text", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ",", "onChange", "=", "this", ".", "_get", "(", "inst", ",", "'onChange'", ")", ";", "$", "(", "\"#sbSelector_\"", "+", ...
Change selected attribute of the selectbox. @param {HTMLElement} target @param {String} value @param {String} text
[ "Change", "selected", "attribute", "of", "the", "selectbox", "." ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L247-L257
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target) { var inst = this._getInst(target); if (!inst || !inst.isDisabled) { return FALSE; } $("#sbHolder_" + inst.uid).removeClass(inst.settings.classHolderDisabled); inst.isDisabled = FALSE; $.data(target, PROP_NAME, inst); }
javascript
function (target) { var inst = this._getInst(target); if (!inst || !inst.isDisabled) { return FALSE; } $("#sbHolder_" + inst.uid).removeClass(inst.settings.classHolderDisabled); inst.isDisabled = FALSE; $.data(target, PROP_NAME, inst); }
[ "function", "(", "target", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "if", "(", "!", "inst", "||", "!", "inst", ".", "isDisabled", ")", "{", "return", "FALSE", ";", "}", "$", "(", "\"#sbHolder_\"", "+", "inst",...
Enable the selectbox. @param {HTMLElement} target
[ "Enable", "the", "selectbox", "." ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L263-L271
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target) { var inst = this._getInst(target); if (!inst || inst.isDisabled) { return FALSE; } $("#sbHolder_" + inst.uid).addClass(inst.settings.classHolderDisabled); inst.isDisabled = TRUE; $.data(target, PROP_NAME, inst); }
javascript
function (target) { var inst = this._getInst(target); if (!inst || inst.isDisabled) { return FALSE; } $("#sbHolder_" + inst.uid).addClass(inst.settings.classHolderDisabled); inst.isDisabled = TRUE; $.data(target, PROP_NAME, inst); }
[ "function", "(", "target", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "if", "(", "!", "inst", "||", "inst", ".", "isDisabled", ")", "{", "return", "FALSE", ";", "}", "$", "(", "\"#sbHolder_\"", "+", "inst", ".",...
Disable the selectbox. @param {HTMLElement} target
[ "Disable", "the", "selectbox", "." ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L277-L285
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target, name, value) { var inst = this._getInst(target); if (!inst) { return FALSE; } //TODO check name inst[name] = value; $.data(target, PROP_NAME, inst); }
javascript
function (target, name, value) { var inst = this._getInst(target); if (!inst) { return FALSE; } //TODO check name inst[name] = value; $.data(target, PROP_NAME, inst); }
[ "function", "(", "target", ",", "name", ",", "value", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "if", "(", "!", "inst", ")", "{", "return", "FALSE", ";", "}", "//TODO check name\r", "inst", "[", "name", "]", "=...
Get or set any selectbox option. If no value is specified, will act as a getter. @param {HTMLElement} target @param {String} name @param {Object} value
[ "Get", "or", "set", "any", "selectbox", "option", ".", "If", "no", "value", "is", "specified", "will", "act", "as", "a", "getter", "." ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L293-L301
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target) { var inst = this._getInst(target); //if (!inst || this._state[inst.uid] || inst.isDisabled) { if (!inst || inst.isOpen || inst.isDisabled) { return; } var el = $("#sbHolder_" + inst.uid), viewportHeight = parseInt($(window).height(), 10), offset = $("#sbHolder_" + i...
javascript
function (target) { var inst = this._getInst(target); //if (!inst || this._state[inst.uid] || inst.isDisabled) { if (!inst || inst.isOpen || inst.isDisabled) { return; } var el = $("#sbHolder_" + inst.uid), viewportHeight = parseInt($(window).height(), 10), offset = $("#sbHolder_" + i...
[ "function", "(", "target", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "//if (!inst || this._state[inst.uid] || inst.isDisabled) {\r", "if", "(", "!", "inst", "||", "inst", ".", "isOpen", "||", "inst", ".", "isDisabled", ")"...
Call up attached selectbox @param {HTMLElement} target
[ "Call", "up", "attached", "selectbox" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L307-L335
train
robgietema/twist
public/libs/jquery.selectbox.js
function (target) { var inst = this._getInst(target); //if (!inst || !this._state[inst.uid]) { if (!inst || !inst.isOpen) { return; } var onClose = this._get(inst, 'onClose'); inst.settings.effect === "fade" ? $("#sbOptions_" + inst.uid).fadeOut(inst.settings.speed) : $("#sbOptions_" + inst...
javascript
function (target) { var inst = this._getInst(target); //if (!inst || !this._state[inst.uid]) { if (!inst || !inst.isOpen) { return; } var onClose = this._get(inst, 'onClose'); inst.settings.effect === "fade" ? $("#sbOptions_" + inst.uid).fadeOut(inst.settings.speed) : $("#sbOptions_" + inst...
[ "function", "(", "target", ")", "{", "var", "inst", "=", "this", ".", "_getInst", "(", "target", ")", ";", "//if (!inst || !this._state[inst.uid]) {\r", "if", "(", "!", "inst", "||", "!", "inst", ".", "isOpen", ")", "{", "return", ";", "}", "var", "onClo...
Close opened selectbox @param {HTMLElement} target
[ "Close", "opened", "selectbox" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L341-L359
train
robgietema/twist
public/libs/jquery.selectbox.js
function(target) { var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); return { id: id, input: target, uid: Math.floor(Math.random() * 99999999), isOpen: FALSE, isDisabled: FALSE, settings: {} }; }
javascript
function(target) { var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); return { id: id, input: target, uid: Math.floor(Math.random() * 99999999), isOpen: FALSE, isDisabled: FALSE, settings: {} }; }
[ "function", "(", "target", ")", "{", "var", "id", "=", "target", "[", "0", "]", ".", "id", ".", "replace", "(", "/", "([^A-Za-z0-9_-])", "/", "g", ",", "'\\\\\\\\$1'", ")", ";", "return", "{", "id", ":", "id", ",", "input", ":", "target", ",", "u...
Create a new instance object @param {HTMLElement} target @return {Object}
[ "Create", "a", "new", "instance", "object" ]
7dc81080c6c28f34ad8e2334118ff416d2a004a0
https://github.com/robgietema/twist/blob/7dc81080c6c28f34ad8e2334118ff416d2a004a0/public/libs/jquery.selectbox.js#L366-L376
train
aledbf/deis-api
lib/commons.js
checkHttpCode
function checkHttpCode(expected, res, body, callback) { if (res.statusCode !== expected) { if (!body) { return callback(new Error(format('Unexpected deis response (expected %s but %s was returned)', expected, res.statusCode))); } var error = body.hasOwnProperty('detail') ? body.detail : JSO...
javascript
function checkHttpCode(expected, res, body, callback) { if (res.statusCode !== expected) { if (!body) { return callback(new Error(format('Unexpected deis response (expected %s but %s was returned)', expected, res.statusCode))); } var error = body.hasOwnProperty('detail') ? body.detail : JSO...
[ "function", "checkHttpCode", "(", "expected", ",", "res", ",", "body", ",", "callback", ")", "{", "if", "(", "res", ".", "statusCode", "!==", "expected", ")", "{", "if", "(", "!", "body", ")", "{", "return", "callback", "(", "new", "Error", "(", "for...
Check if the http response returns the expected http code and return an error with the detail if the check fails @param {Number} expected http @param {Response} res @param {Object} body @param {Function} callback
[ "Check", "if", "the", "http", "response", "returns", "the", "expected", "http", "code", "and", "return", "an", "error", "with", "the", "detail", "if", "the", "check", "fails" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/commons.js#L14-L27
train
m59peacemaker/browser-disable-chrome-ptr
docs/docs.js
compareVersions
function compareVersions(versions) { // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2 var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1])); var chunks = map(versions, function (version) { var delta = precision - getVers...
javascript
function compareVersions(versions) { // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2 var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1])); var chunks = map(versions, function (version) { var delta = precision - getVers...
[ "function", "compareVersions", "(", "versions", ")", "{", "// 1) get common precision for both versions, for example for \"10.0\" and \"9\" it should be 2", "var", "precision", "=", "Math", ".", "max", "(", "getVersionPrecision", "(", "versions", "[", "0", "]", ")", ",", ...
Calculate browser version weight @example compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1 compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1 compareVersions(['1.10.2.1', '1.10.2.1']); // 0 compareVersions(['1.10.2.1', '1.0800.2']); // -1 @param {Array<String>} versions versions to compare @return {N...
[ "Calculate", "browser", "version", "weight" ]
8170384999f0f4da5817c07b4d44347455b6de15
https://github.com/m59peacemaker/browser-disable-chrome-ptr/blob/8170384999f0f4da5817c07b4d44347455b6de15/docs/docs.js#L507-L538
train
m59peacemaker/browser-disable-chrome-ptr
docs/docs.js
isUnsupportedBrowser
function isUnsupportedBrowser(minVersions, strictMode, ua) { var _bowser = bowser; // make strictMode param optional with ua param usage if (typeof strictMode === 'string') { ua = strictMode; strictMode = void(0); } if (strictMode === void(0)) { strictMode = false; } if (...
javascript
function isUnsupportedBrowser(minVersions, strictMode, ua) { var _bowser = bowser; // make strictMode param optional with ua param usage if (typeof strictMode === 'string') { ua = strictMode; strictMode = void(0); } if (strictMode === void(0)) { strictMode = false; } if (...
[ "function", "isUnsupportedBrowser", "(", "minVersions", ",", "strictMode", ",", "ua", ")", "{", "var", "_bowser", "=", "bowser", ";", "// make strictMode param optional with ua param usage", "if", "(", "typeof", "strictMode", "===", "'string'", ")", "{", "ua", "=", ...
Check if browser is unsupported @example bowser.isUnsupportedBrowser({ msie: "10", firefox: "23", chrome: "29", safari: "5.1", opera: "16", phantom: "534" }); @param {Object} minVersions map of minimal version to browser @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map @par...
[ "Check", "if", "browser", "is", "unsupported" ]
8170384999f0f4da5817c07b4d44347455b6de15
https://github.com/m59peacemaker/browser-disable-chrome-ptr/blob/8170384999f0f4da5817c07b4d44347455b6de15/docs/docs.js#L558-L589
train
spacemaus/postvox
vox-common/connection-manager.js
sendCommand
function sendCommand(method, url, payload, skipQueue) { if (!self.connected) { debug('Queueing %s %s', method, url); return new P(function(resolve, reject) { var p = P.method(function() { debug('Dequeueing %s %s', method, url); return _sendCommand(method, url, payload) ...
javascript
function sendCommand(method, url, payload, skipQueue) { if (!self.connected) { debug('Queueing %s %s', method, url); return new P(function(resolve, reject) { var p = P.method(function() { debug('Dequeueing %s %s', method, url); return _sendCommand(method, url, payload) ...
[ "function", "sendCommand", "(", "method", ",", "url", ",", "payload", ",", "skipQueue", ")", "{", "if", "(", "!", "self", ".", "connected", ")", "{", "debug", "(", "'Queueing %s %s'", ",", "method", ",", "url", ")", ";", "return", "new", "P", "(", "f...
Helper function to send a command to the server. Returns a Promise for the server's response. Rejects the Promise if the reply's status is not 200. If this connection is not ready to receive commands, the command is queued for later execution.
[ "Helper", "function", "to", "send", "a", "command", "to", "the", "server", "." ]
de98e5ed37edaee1b1edadf93e15eb8f8d21f457
https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-common/connection-manager.js#L288-L306
train
danigb/step-seq
index.js
sequencer
function sequencer (ctx, callback) { var timer, iterable, iterator, nextTick, tempo, tickInterval, lookahead function emit (event, data, time, duration) { setTimeout(function () { callback(event, data, time, duration) }, 0) } function sequence (data) { if (!data) iterator = rangeIterator(0, Infinity) ...
javascript
function sequencer (ctx, callback) { var timer, iterable, iterator, nextTick, tempo, tickInterval, lookahead function emit (event, data, time, duration) { setTimeout(function () { callback(event, data, time, duration) }, 0) } function sequence (data) { if (!data) iterator = rangeIterator(0, Infinity) ...
[ "function", "sequencer", "(", "ctx", ",", "callback", ")", "{", "var", "timer", ",", "iterable", ",", "iterator", ",", "nextTick", ",", "tempo", ",", "tickInterval", ",", "lookahead", "function", "emit", "(", "event", ",", "data", ",", "time", ",", "dura...
Create a sequence A sequence is an object with two methods: start and stop @param {AudioContext} ctx - the audio context @param {Function} player - the function that plays the song @param {Integer} tempo - the tempo @param {Array|Integer} data - the data source
[ "Create", "a", "sequence" ]
4014eecff5728fe07adc36071276d94e277bf437
https://github.com/danigb/step-seq/blob/4014eecff5728fe07adc36071276d94e277bf437/index.js#L13-L72
train
cliffano/cmdt
lib/checker.js
_checkExitCode
function _checkExitCode(result, test) { var actual = result.exitcode; var expect = test.exitcode; var error; if (typeof expect === 'string') { expect = parseInt(expect, 10); } if (expect !== undefined && expect !== actual) { error = util.format('Exit code %d does not match expected %d', actual, e...
javascript
function _checkExitCode(result, test) { var actual = result.exitcode; var expect = test.exitcode; var error; if (typeof expect === 'string') { expect = parseInt(expect, 10); } if (expect !== undefined && expect !== actual) { error = util.format('Exit code %d does not match expected %d', actual, e...
[ "function", "_checkExitCode", "(", "result", ",", "test", ")", "{", "var", "actual", "=", "result", ".", "exitcode", ";", "var", "expect", "=", "test", ".", "exitcode", ";", "var", "error", ";", "if", "(", "typeof", "expect", "===", "'string'", ")", "{...
Check result exit code against expectated exit code. @param {Object} result: command execution result @param {Object} test: test expectation @return {Object} error if actual exit code doesn't equal expected exit code
[ "Check", "result", "exit", "code", "against", "expectated", "exit", "code", "." ]
8b8de56a23994a02117069c9c6da5fa1a3176fe5
https://github.com/cliffano/cmdt/blob/8b8de56a23994a02117069c9c6da5fa1a3176fe5/lib/checker.js#L10-L25
train
cliffano/cmdt
lib/checker.js
check
function check(result, test) { const CHECKERS = [ _checkExitCode, _checkOutput, _checkStdout, _checkStderr ]; var errors = []; CHECKERS.forEach(function (checker) { var error = checker(result, test); if (error) { errors.push(error); } }); return errors; }
javascript
function check(result, test) { const CHECKERS = [ _checkExitCode, _checkOutput, _checkStdout, _checkStderr ]; var errors = []; CHECKERS.forEach(function (checker) { var error = checker(result, test); if (error) { errors.push(error); } }); return errors; }
[ "function", "check", "(", "result", ",", "test", ")", "{", "const", "CHECKERS", "=", "[", "_checkExitCode", ",", "_checkOutput", ",", "_checkStdout", ",", "_checkStderr", "]", ";", "var", "errors", "=", "[", "]", ";", "CHECKERS", ".", "forEach", "(", "fu...
Check command execution result with test expectation against a set of check functions. @param {Object} result: command execution result @param {Object} test: test expectation @return {Array} check errors
[ "Check", "command", "execution", "result", "with", "test", "expectation", "against", "a", "set", "of", "check", "functions", "." ]
8b8de56a23994a02117069c9c6da5fa1a3176fe5
https://github.com/cliffano/cmdt/blob/8b8de56a23994a02117069c9c6da5fa1a3176fe5/lib/checker.js#L80-L93
train
yeptlabs/wns
src/core/base/wnComponent.js
function (obj) { if (typeof obj === 'undefined') { obj = this.getConfig(); delete obj.class; } if (typeof obj == 'object') { delete obj.autoInit; delete obj.id; delete obj.serverID; delete obj.modulePath; for (o in obj) { this.exportConfig(obj[o]); } } ...
javascript
function (obj) { if (typeof obj === 'undefined') { obj = this.getConfig(); delete obj.class; } if (typeof obj == 'object') { delete obj.autoInit; delete obj.id; delete obj.serverID; delete obj.modulePath; for (o in obj) { this.exportConfig(obj[o]); } } ...
[ "function", "(", "obj", ")", "{", "if", "(", "typeof", "obj", "===", "'undefined'", ")", "{", "obj", "=", "this", ".", "getConfig", "(", ")", ";", "delete", "obj", ".", "class", ";", "}", "if", "(", "typeof", "obj", "==", "'object'", ")", "{", "d...
Export to JSON the components's config. @param object $obj @return object
[ "Export", "to", "JSON", "the", "components", "s", "config", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L195-L218
train
yeptlabs/wns
src/core/base/wnComponent.js
function (filePath) { if (typeof arguments[1]=='function') var cb = arguments[1]; if (typeof arguments[2]=='function') var cb = arguments[2]; var binary = typeof arguments[1]=='boolean' ? arguments[1] : false, realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath, cmd = !...
javascript
function (filePath) { if (typeof arguments[1]=='function') var cb = arguments[1]; if (typeof arguments[2]=='function') var cb = arguments[2]; var binary = typeof arguments[1]=='boolean' ? arguments[1] : false, realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath, cmd = !...
[ "function", "(", "filePath", ")", "{", "if", "(", "typeof", "arguments", "[", "1", "]", "==", "'function'", ")", "var", "cb", "=", "arguments", "[", "1", "]", ";", "if", "(", "typeof", "arguments", "[", "2", "]", "==", "'function'", ")", "var", "cb...
Get a file. The file's path is relative to the module's path. @param string $filePath file's path @param boolean $binary is it binary? @param function $cb async callback function @return boolean|string
[ "Get", "a", "file", ".", "The", "file", "s", "path", "is", "relative", "to", "the", "module", "s", "path", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L228-L253
train
yeptlabs/wns
src/core/base/wnComponent.js
function (filePath,cb) { var realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath, cmd = !cb ? 'statSync' : 'stat'; if (!fs.existsSync(realPath)) return (cb&&cb(false) == true); var _cb = cb ? function (err,stat) { cb&&cb(!err ? stat : false); } : null, stat = fs[cmd]...
javascript
function (filePath,cb) { var realPath = this.instanceOf('wnModule')?this.modulePath+filePath:filePath, cmd = !cb ? 'statSync' : 'stat'; if (!fs.existsSync(realPath)) return (cb&&cb(false) == true); var _cb = cb ? function (err,stat) { cb&&cb(!err ? stat : false); } : null, stat = fs[cmd]...
[ "function", "(", "filePath", ",", "cb", ")", "{", "var", "realPath", "=", "this", ".", "instanceOf", "(", "'wnModule'", ")", "?", "this", ".", "modulePath", "+", "filePath", ":", "filePath", ",", "cmd", "=", "!", "cb", "?", "'statSync'", ":", "'stat'",...
Get a file statistic. The file's path is relative to the module's path. @param string $filePath file's path @param function $cb callback
[ "Get", "a", "file", "statistic", ".", "The", "file", "s", "path", "is", "relative", "to", "the", "module", "s", "path", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L291-L302
train
yeptlabs/wns
src/core/base/wnComponent.js
function () { this.e.log&&this.e.log('Preloading events...','system'); var preload = {}; _.merge(preload,this.defaultEvents); _.merge(preload,this.getConfig().events); if (preload != undefined) this.setEvents(preload); for (e in preload) { this.getEvent(e); } this.attachEventsHandle...
javascript
function () { this.e.log&&this.e.log('Preloading events...','system'); var preload = {}; _.merge(preload,this.defaultEvents); _.merge(preload,this.getConfig().events); if (preload != undefined) this.setEvents(preload); for (e in preload) { this.getEvent(e); } this.attachEventsHandle...
[ "function", "(", ")", "{", "this", ".", "e", ".", "log", "&&", "this", ".", "e", ".", "log", "(", "'Preloading events...'", ",", "'system'", ")", ";", "var", "preload", "=", "{", "}", ";", "_", ".", "merge", "(", "preload", ",", "this", ".", "def...
Preload all required events @return this
[ "Preload", "all", "required", "events" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L308-L322
train
yeptlabs/wns
src/core/base/wnComponent.js
function (className,config,path,npmPath) { var source = this.c || process.wns; var instance; var builder = this.getComponent&&this.getComponent('classBuilder'); if (!source || !source[className]) { return false; } if (config.id) source[className].build.id = config.id; if (source[className...
javascript
function (className,config,path,npmPath) { var source = this.c || process.wns; var instance; var builder = this.getComponent&&this.getComponent('classBuilder'); if (!source || !source[className]) { return false; } if (config.id) source[className].build.id = config.id; if (source[className...
[ "function", "(", "className", ",", "config", ",", "path", ",", "npmPath", ")", "{", "var", "source", "=", "this", ".", "c", "||", "process", ".", "wns", ";", "var", "instance", ";", "var", "builder", "=", "this", ".", "getComponent", "&&", "this", "....
Create an class from the classSources. @param string $className name of the class @param object $config class configuration @param component $boolean is it component format? @return boolean|object
[ "Create", "an", "class", "from", "the", "classSources", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L331-L361
train
yeptlabs/wns
src/core/base/wnComponent.js
function () { this.e.log&&this.e.log("Attaching default event's handlers...",'system'); var events = this.getEvents(); for (e in events) { var eventName = e.split('-').pop(), event = this.getEvent(eventName), evtConfig = event.getConfig(); if (evtConfig.handler != null && this[evtConfig.h...
javascript
function () { this.e.log&&this.e.log("Attaching default event's handlers...",'system'); var events = this.getEvents(); for (e in events) { var eventName = e.split('-').pop(), event = this.getEvent(eventName), evtConfig = event.getConfig(); if (evtConfig.handler != null && this[evtConfig.h...
[ "function", "(", ")", "{", "this", ".", "e", ".", "log", "&&", "this", ".", "e", ".", "log", "(", "\"Attaching default event's handlers...\"", ",", "'system'", ")", ";", "var", "events", "=", "this", ".", "getEvents", "(", ")", ";", "for", "(", "e", ...
Search for handlers and eventlisteners of all events of this component.
[ "Search", "for", "handlers", "and", "eventlisteners", "of", "all", "events", "of", "this", "component", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L367-L395
train
yeptlabs/wns
src/core/base/wnComponent.js
function (events) { var event = {}; for (e in events) { var ref=events[e], e = 'event-'+e.replace('-','.'); event[e]=ref; event[e].class=ref.class || 'wnEvent'; event[e].eventName = e.split('-').pop(); if (this.hasEvent(e)) { _.merge(event[e],this.getEvent(e)); } _ev...
javascript
function (events) { var event = {}; for (e in events) { var ref=events[e], e = 'event-'+e.replace('-','.'); event[e]=ref; event[e].class=ref.class || 'wnEvent'; event[e].eventName = e.split('-').pop(); if (this.hasEvent(e)) { _.merge(event[e],this.getEvent(e)); } _ev...
[ "function", "(", "events", ")", "{", "var", "event", "=", "{", "}", ";", "for", "(", "e", "in", "events", ")", "{", "var", "ref", "=", "events", "[", "e", "]", ",", "e", "=", "'event-'", "+", "e", ".", "replace", "(", "'-'", ",", "'.'", ")", ...
Set new properties to the respective events @param object $events events configurations @return this
[ "Set", "new", "properties", "to", "the", "respective", "events" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L402-L420
train
yeptlabs/wns
src/core/base/wnComponent.js
function (name,hidden) { var eventName = 'event-'+name; if (_events[eventName] != undefined) return _events[eventName]; else { if (!_eventsConfig[eventName] || !this.c) return false; var config = _eventsConfig[eventName] || {}, _class = config.class; config.id = eventName; c...
javascript
function (name,hidden) { var eventName = 'event-'+name; if (_events[eventName] != undefined) return _events[eventName]; else { if (!_eventsConfig[eventName] || !this.c) return false; var config = _eventsConfig[eventName] || {}, _class = config.class; config.id = eventName; c...
[ "function", "(", "name", ",", "hidden", ")", "{", "var", "eventName", "=", "'event-'", "+", "name", ";", "if", "(", "_events", "[", "eventName", "]", "!=", "undefined", ")", "return", "_events", "[", "eventName", "]", ";", "else", "{", "if", "(", "!"...
Get an event and create an alias to the push function. @param string $name eventName @param boolean $hidden ? @return wnEvent
[ "Get", "an", "event", "and", "create", "an", "alias", "to", "the", "push", "function", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L428-L458
train
yeptlabs/wns
src/core/base/wnComponent.js
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.addListener(handler)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig('id'...
javascript
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.addListener(handler)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig('id'...
[ "function", "(", "eventName", ",", "handler", ")", "{", "var", "event", ";", "if", "(", "event", "=", "this", ".", "getEvent", "(", "eventName", ")", ")", "{", "if", "(", "!", "event", ".", "addListener", "(", "handler", ")", ")", "this", ".", "e",...
Add a new listener to the event, if it exists @param string $eventName event name @param function $handler event handler @return this
[ "Add", "a", "new", "listener", "to", "the", "event", "if", "it", "exists" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L510-L519
train
yeptlabs/wns
src/core/base/wnComponent.js
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.prependListener(handler)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig(...
javascript
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.prependListener(handler)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig(...
[ "function", "(", "eventName", ",", "handler", ")", "{", "var", "event", ";", "if", "(", "event", "=", "this", ".", "getEvent", "(", "eventName", ")", ")", "{", "if", "(", "!", "event", ".", "prependListener", "(", "handler", ")", ")", "this", ".", ...
Prepend a new listener to the event, if it exists @param string $eventName event name @param function $handler event handler @return this
[ "Prepend", "a", "new", "listener", "to", "the", "event", "if", "it", "exists" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L527-L536
train
yeptlabs/wns
src/core/base/wnComponent.js
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.once(handler,true)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig('id')+...
javascript
function (eventName,handler) { var event; if (event = this.getEvent(eventName)) { if (!event.once(handler,true)) this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning'); } else this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig('id')+...
[ "function", "(", "eventName", ",", "handler", ")", "{", "var", "event", ";", "if", "(", "event", "=", "this", ".", "getEvent", "(", "eventName", ")", ")", "{", "if", "(", "!", "event", ".", "once", "(", "handler", ",", "true", ")", ")", "this", "...
Prepend a new one-time-listener to the event, if it exists @param string $eventName event name @param function $handler event handler @return this
[ "Prepend", "a", "new", "one", "-", "time", "-", "listener", "to", "the", "event", "if", "it", "exists" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L544-L553
train
yeptlabs/wns
src/core/base/wnComponent.js
function () { var _export = {}, merge = {}; _.merge(merge,this.getConfig()); _.merge(merge,this); var proto = this._proto.public; for (p in proto) if (!((typeof proto[p] == 'object' || typeof proto[p] == 'function') && proto[p] != null && proto[p].instanceOf!=undefined)) _export[p] = proto...
javascript
function () { var _export = {}, merge = {}; _.merge(merge,this.getConfig()); _.merge(merge,this); var proto = this._proto.public; for (p in proto) if (!((typeof proto[p] == 'object' || typeof proto[p] == 'function') && proto[p] != null && proto[p].instanceOf!=undefined)) _export[p] = proto...
[ "function", "(", ")", "{", "var", "_export", "=", "{", "}", ",", "merge", "=", "{", "}", ";", "_", ".", "merge", "(", "merge", ",", "this", ".", "getConfig", "(", ")", ")", ";", "_", ".", "merge", "(", "merge", ",", "this", ")", ";", "var", ...
Return an object with all attributes and configuration of this component @return object
[ "Return", "an", "object", "with", "all", "attributes", "and", "configuration", "of", "this", "component" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L559-L575
train
yeptlabs/wns
src/core/base/wnComponent.js
function (msg,verbosity) { if (!_debug || verbosity>_verbosity) return false; this.e.log.apply(this,[msg||'','debug',verbosity||0]); return self; }
javascript
function (msg,verbosity) { if (!_debug || verbosity>_verbosity) return false; this.e.log.apply(this,[msg||'','debug',verbosity||0]); return self; }
[ "function", "(", "msg", ",", "verbosity", ")", "{", "if", "(", "!", "_debug", "||", "verbosity", ">", "_verbosity", ")", "return", "false", ";", "this", ".", "e", ".", "log", ".", "apply", "(", "this", ",", "[", "msg", "||", "''", ",", "'debug'", ...
Component's debug log function @return self
[ "Component", "s", "debug", "log", "function" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L590-L596
train
yeptlabs/wns
src/core/base/wnComponent.js
function () { arguments[arguments.length+'']='info'; arguments.length++; this.e.log.apply(this,arguments); return self; }
javascript
function () { arguments[arguments.length+'']='info'; arguments.length++; this.e.log.apply(this,arguments); return self; }
[ "function", "(", ")", "{", "arguments", "[", "arguments", ".", "length", "+", "''", "]", "=", "'info'", ";", "arguments", ".", "length", "++", ";", "this", ".", "e", ".", "log", ".", "apply", "(", "this", ",", "arguments", ")", ";", "return", "self...
Component's info log function @return self
[ "Component", "s", "info", "log", "function" ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L602-L608
train
yeptlabs/wns
src/core/base/wnComponent.js
function (cmd,context,silent) { var ctx = (context!=undefined?context:this); try { return (function () { var result = eval(cmd); if (!silent) self.e.log&&self.e.log(util.inspect(result),'result'); return result; }.bind(ctx))(); } catch (e) { this.e.exception&&this.e.exc...
javascript
function (cmd,context,silent) { var ctx = (context!=undefined?context:this); try { return (function () { var result = eval(cmd); if (!silent) self.e.log&&self.e.log(util.inspect(result),'result'); return result; }.bind(ctx))(); } catch (e) { this.e.exception&&this.e.exc...
[ "function", "(", "cmd", ",", "context", ",", "silent", ")", "{", "var", "ctx", "=", "(", "context", "!=", "undefined", "?", "context", ":", "this", ")", ";", "try", "{", "return", "(", "function", "(", ")", "{", "var", "result", "=", "eval", "(", ...
Execute an expression in this component's context. @param string $cmd expression @param object $context forced context @param boolean $silent do not print result? @return this
[ "Execute", "an", "expression", "in", "this", "component", "s", "context", "." ]
c42602b062dcf6bbffc22e4365bba2cbf363fe2f
https://github.com/yeptlabs/wns/blob/c42602b062dcf6bbffc22e4365bba2cbf363fe2f/src/core/base/wnComponent.js#L673-L689
train
rkaw92/esdf
utils/loadAggregate.js
rehydrateAggregate
function rehydrateAggregate(ARObject){ return when.try(eventSink.rehydrate.bind(eventSink), ARObject, ARID, ARObject.getNextSequenceNumber()); }
javascript
function rehydrateAggregate(ARObject){ return when.try(eventSink.rehydrate.bind(eventSink), ARObject, ARID, ARObject.getNextSequenceNumber()); }
[ "function", "rehydrateAggregate", "(", "ARObject", ")", "{", "return", "when", ".", "try", "(", "eventSink", ".", "rehydrate", ".", "bind", "(", "eventSink", ")", ",", "ARObject", ",", "ARID", ",", "ARObject", ".", "getNextSequenceNumber", "(", ")", ")", "...
Rehydration. It will resolve the top-level promise for us, so that there is no need to call anything else to finish the loading.
[ "Rehydration", ".", "It", "will", "resolve", "the", "top", "-", "level", "promise", "for", "us", "so", "that", "there", "is", "no", "need", "to", "call", "anything", "else", "to", "finish", "the", "loading", "." ]
9c6bd2c278428096cb8c1ceeca62a5493d19613e
https://github.com/rkaw92/esdf/blob/9c6bd2c278428096cb8c1ceeca62a5493d19613e/utils/loadAggregate.js#L76-L78
train
karfcz/kff
src/CollectionBinder.js
function() { this.anchor = this.view.env.document.createTextNode(''); var el = this.view.element; if(el.parentNode) { el.parentNode.insertBefore(this.anchor, el.nextSibling); el.parentNode.removeChild(el); } this.boundViews = []; // Boundview options: this.boundViewName = this.view.element.get...
javascript
function() { this.anchor = this.view.env.document.createTextNode(''); var el = this.view.element; if(el.parentNode) { el.parentNode.insertBefore(this.anchor, el.nextSibling); el.parentNode.removeChild(el); } this.boundViews = []; // Boundview options: this.boundViewName = this.view.element.get...
[ "function", "(", ")", "{", "this", ".", "anchor", "=", "this", ".", "view", ".", "env", ".", "document", ".", "createTextNode", "(", "''", ")", ";", "var", "el", "=", "this", ".", "view", ".", "element", ";", "if", "(", "el", ".", "parentNode", "...
Renders "bound" views. This method generates DOM elements corresponding to each item in the bound collection and creates the bindingView for each element. If the collection changes, it reflects those changes automatically in real time. @private
[ "Renders", "bound", "views", ".", "This", "method", "generates", "DOM", "elements", "corresponding", "to", "each", "item", "in", "the", "bound", "collection", "and", "creates", "the", "bindingView", "for", "each", "element", ".", "If", "the", "collection", "ch...
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/CollectionBinder.js#L37-L60
train
karfcz/kff
src/CollectionBinder.js
function() { var boundView, i, l; // Destroy boundviews if(this.boundViews !== null) { for(i = 0, l = this.boundViews.length; i < l; i++) { boundView = this.boundViews[i]; boundView.destroyAll(); if(boundView.element && boundView.element.parentNode) boundView.element.parentNode.removeChild(b...
javascript
function() { var boundView, i, l; // Destroy boundviews if(this.boundViews !== null) { for(i = 0, l = this.boundViews.length; i < l; i++) { boundView = this.boundViews[i]; boundView.destroyAll(); if(boundView.element && boundView.element.parentNode) boundView.element.parentNode.removeChild(b...
[ "function", "(", ")", "{", "var", "boundView", ",", "i", ",", "l", ";", "// Destroy boundviews", "if", "(", "this", ".", "boundViews", "!==", "null", ")", "{", "for", "(", "i", "=", "0", ",", "l", "=", "this", ".", "boundViews", ".", "length", ";",...
Destroys previously bound views. @private
[ "Destroys", "previously", "bound", "views", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/CollectionBinder.js#L67-L102
train
karfcz/kff
src/CollectionBinder.js
function(from, to) { if(!from) from = 0; if(!to || to > this.boundViews.length) to = this.boundViews.length; // Reindex subsequent boundviews: for(var i = from; i < to; i++) { this.boundViews[i].setBindingIndex(i); this.boundViews[i].refreshBinders(true); } }
javascript
function(from, to) { if(!from) from = 0; if(!to || to > this.boundViews.length) to = this.boundViews.length; // Reindex subsequent boundviews: for(var i = from; i < to; i++) { this.boundViews[i].setBindingIndex(i); this.boundViews[i].refreshBinders(true); } }
[ "function", "(", "from", ",", "to", ")", "{", "if", "(", "!", "from", ")", "from", "=", "0", ";", "if", "(", "!", "to", "||", "to", ">", "this", ".", "boundViews", ".", "length", ")", "to", "=", "this", ".", "boundViews", ".", "length", ";", ...
Refreshes view indices when the collection changes @private @param {nubmer} from Render index at which reindexing starts @param {number} to Render index at which reindexing ends
[ "Refreshes", "view", "indices", "when", "the", "collection", "changes" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/CollectionBinder.js#L330-L341
train
karfcz/kff
src/CollectionBinder.js
function(item) { var boundView, element, i; if(!this.viewTemplate) { element = this.view.element.cloneNode(true); this.boundViewOptions.element = element; boundView = new this.view.constructor(this.boundViewOptions); boundView._collectionBinder = null; boundView._modelBindersMap = this.view._m...
javascript
function(item) { var boundView, element, i; if(!this.viewTemplate) { element = this.view.element.cloneNode(true); this.boundViewOptions.element = element; boundView = new this.view.constructor(this.boundViewOptions); boundView._collectionBinder = null; boundView._modelBindersMap = this.view._m...
[ "function", "(", "item", ")", "{", "var", "boundView", ",", "element", ",", "i", ";", "if", "(", "!", "this", ".", "viewTemplate", ")", "{", "element", "=", "this", ".", "view", ".", "element", ".", "cloneNode", "(", "true", ")", ";", "this", ".", ...
Creates a new bound view for item in collection @private @param {Object} item Item for data-binding @param {number} i Binding index @return {View} created view
[ "Creates", "a", "new", "bound", "view", "for", "item", "in", "collection" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/CollectionBinder.js#L351-L401
train
zerkalica/hyper-config
lib/hyper-config.js
normalize
function normalize(acc, val) { if (typeof val === 'string') { var value = val.trim().replace(acc.refIgnoreRegExp, REF_MAGIC); if (value.indexOf(acc.refLabel) === 0 && value.indexOf(acc.refLabel + acc.macroBegin) === -1) { value = value.substring(acc.refLabel.length); this.update(acc.get(value)); } else if ...
javascript
function normalize(acc, val) { if (typeof val === 'string') { var value = val.trim().replace(acc.refIgnoreRegExp, REF_MAGIC); if (value.indexOf(acc.refLabel) === 0 && value.indexOf(acc.refLabel + acc.macroBegin) === -1) { value = value.substring(acc.refLabel.length); this.update(acc.get(value)); } else if ...
[ "function", "normalize", "(", "acc", ",", "val", ")", "{", "if", "(", "typeof", "val", "===", "'string'", ")", "{", "var", "value", "=", "val", ".", "trim", "(", ")", ".", "replace", "(", "acc", ".", "refIgnoreRegExp", ",", "REF_MAGIC", ")", ";", "...
Normalize config value @param {object} acc reduce acc @param {any} val config value @return {object} reduce acc
[ "Normalize", "config", "value" ]
ae21220ece60b644b720c3469c63ab144576f1f6
https://github.com/zerkalica/hyper-config/blob/ae21220ece60b644b720c3469c63ab144576f1f6/lib/hyper-config.js#L47-L71
train
zerkalica/hyper-config
lib/hyper-config.js
HyperConfig
function HyperConfig(options) { this.name = 'HyperConfig'; if (!(this instanceof HyperConfig)) { return new HyperConfig(options); } options = options || {}; this._refLabel = options.refLabel || '~'; this._annotationLabel = options.annotationLabel || '@'; this._macroBegin = options.macroBegin || '{'; this._mac...
javascript
function HyperConfig(options) { this.name = 'HyperConfig'; if (!(this instanceof HyperConfig)) { return new HyperConfig(options); } options = options || {}; this._refLabel = options.refLabel || '~'; this._annotationLabel = options.annotationLabel || '@'; this._macroBegin = options.macroBegin || '{'; this._mac...
[ "function", "HyperConfig", "(", "options", ")", "{", "this", ".", "name", "=", "'HyperConfig'", ";", "if", "(", "!", "(", "this", "instanceof", "HyperConfig", ")", ")", "{", "return", "new", "HyperConfig", "(", "options", ")", ";", "}", "options", "=", ...
Hyper config builder @param {object} options Options @param {string} options.refLabel '~' @param {string} options.annotationLabel & @param {string} options.macroBegin { @param {string} options.macroEnd }
[ "Hyper", "config", "builder" ]
ae21220ece60b644b720c3469c63ab144576f1f6
https://github.com/zerkalica/hyper-config/blob/ae21220ece60b644b720c3469c63ab144576f1f6/lib/hyper-config.js#L106-L121
train
boylesoftware/x2node-validators
lib/standard.js
isEmpty
function isEmpty(ptr, propDesc, value) { if ((value === undefined) || (value === null)) return true; if (propDesc.isArray() && !ptr.collectionElement && Array.isArray(value)) { if (value.length === 0) return true; } else if (propDesc.isMap() && !ptr.collectionElement && ((typeof value) === 'object')) { ...
javascript
function isEmpty(ptr, propDesc, value) { if ((value === undefined) || (value === null)) return true; if (propDesc.isArray() && !ptr.collectionElement && Array.isArray(value)) { if (value.length === 0) return true; } else if (propDesc.isMap() && !ptr.collectionElement && ((typeof value) === 'object')) { ...
[ "function", "isEmpty", "(", "ptr", ",", "propDesc", ",", "value", ")", "{", "if", "(", "(", "value", "===", "undefined", ")", "||", "(", "value", "===", "null", ")", ")", "return", "true", ";", "if", "(", "propDesc", ".", "isArray", "(", ")", "&&",...
Tell if the specified property value can be considered empty. @private @param {module:x2node-pointers~RecordElementPointer} ptr Property pointer. @param {module:x2node-records~PropertyDescriptor} propDesc Property descriptor. @param {*} value Property value to test. @returns {boolean} <code>true</code> if empty.
[ "Tell", "if", "the", "specified", "property", "value", "can", "be", "considered", "empty", "." ]
e98a65c13a4092f80e96517c8e8c9523f8e84c63
https://github.com/boylesoftware/x2node-validators/blob/e98a65c13a4092f80e96517c8e8c9523f8e84c63/lib/standard.js#L156-L176
train
boylesoftware/x2node-validators
lib/standard.js
hasMatchingSibling
function hasMatchingSibling(ctx, propName, testValue, whenErrors) { const containerDesc = ctx.currentPropDesc.container; const propDesc = containerDesc.getPropertyDesc(propName); let propPtr; if (containerDesc.parentContainer && containerDesc.parentContainer.isPolymorphObject()) { const pathParts = containerD...
javascript
function hasMatchingSibling(ctx, propName, testValue, whenErrors) { const containerDesc = ctx.currentPropDesc.container; const propDesc = containerDesc.getPropertyDesc(propName); let propPtr; if (containerDesc.parentContainer && containerDesc.parentContainer.isPolymorphObject()) { const pathParts = containerD...
[ "function", "hasMatchingSibling", "(", "ctx", ",", "propName", ",", "testValue", ",", "whenErrors", ")", "{", "const", "containerDesc", "=", "ctx", ".", "currentPropDesc", ".", "container", ";", "const", "propDesc", "=", "containerDesc", ".", "getPropertyDesc", ...
Tell if the specified context container has specified property and it optionally matches the specified test value. @private @param {module:x2node-validators~ValidationContext} ctx Current validation context. @param {string} propName Sibling property name. @param {(*|RegExp)} [testValue] Test value. @param {boolean} wh...
[ "Tell", "if", "the", "specified", "context", "container", "has", "specified", "property", "and", "it", "optionally", "matches", "the", "specified", "test", "value", "." ]
e98a65c13a4092f80e96517c8e8c9523f8e84c63
https://github.com/boylesoftware/x2node-validators/blob/e98a65c13a4092f80e96517c8e8c9523f8e84c63/lib/standard.js#L191-L221
train
boylesoftware/x2node-validators
lib/standard.js
addDepsError
function addDepsError(ctx, type, propName, testValue) { let depsErrors = ctx[DEPS_ERRORS]; if (!depsErrors) depsErrors = ctx[DEPS_ERRORS] = {}; const curPtrStr = ctx.currentPointer.toString(); if (depsErrors[curPtrStr]) return; depsErrors[curPtrStr] = true; const hasTestValue = (testValue !== undefined); ...
javascript
function addDepsError(ctx, type, propName, testValue) { let depsErrors = ctx[DEPS_ERRORS]; if (!depsErrors) depsErrors = ctx[DEPS_ERRORS] = {}; const curPtrStr = ctx.currentPointer.toString(); if (depsErrors[curPtrStr]) return; depsErrors[curPtrStr] = true; const hasTestValue = (testValue !== undefined); ...
[ "function", "addDepsError", "(", "ctx", ",", "type", ",", "propName", ",", "testValue", ")", "{", "let", "depsErrors", "=", "ctx", "[", "DEPS_ERRORS", "]", ";", "if", "(", "!", "depsErrors", ")", "depsErrors", "=", "ctx", "[", "DEPS_ERRORS", "]", "=", ...
Add dependecy validator error to the context if no dependency validator errors already added for the current property. @private @param {module:x2node-validators~ValidationContext} ctx Current validation context. @param {string} type Validator type. @param {string} propName Dependency property name. @param {(*|RegExp)}...
[ "Add", "dependecy", "validator", "error", "to", "the", "context", "if", "no", "dependency", "validator", "errors", "already", "added", "for", "the", "current", "property", "." ]
e98a65c13a4092f80e96517c8e8c9523f8e84c63
https://github.com/boylesoftware/x2node-validators/blob/e98a65c13a4092f80e96517c8e8c9523f8e84c63/lib/standard.js#L242-L267
train
glennschler/spotspec
lib/credentials.js
Credentials
function Credentials (options) { EventEmitter.call(this) options.keys.apiVersion = 'latest' options.keys.sslEnabled = true if (options.hasOwnProperty('upgrade')) { // Update with the MFA token passed in with the credentials this.upgrade(options) return } let awsConfig = Object.assign({}, opti...
javascript
function Credentials (options) { EventEmitter.call(this) options.keys.apiVersion = 'latest' options.keys.sslEnabled = true if (options.hasOwnProperty('upgrade')) { // Update with the MFA token passed in with the credentials this.upgrade(options) return } let awsConfig = Object.assign({}, opti...
[ "function", "Credentials", "(", "options", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", "options", ".", "keys", ".", "apiVersion", "=", "'latest'", "options", ".", "keys", ".", "sslEnabled", "=", "true", "if", "(", "options", ".", "hasOwnProper...
Credentials - Create MFA short term credentials @constructor @arg {object} options - The AWS service IAM credentials @arg {object} options.keys - Credentials for the service API authentication. See [aws docs]{@link http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Credentials.html} @arg {string} options.keys.acces...
[ "Credentials", "-", "Create", "MFA", "short", "term", "credentials" ]
ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727
https://github.com/glennschler/spotspec/blob/ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727/lib/credentials.js#L53-L72
train
dpjanes/iotdb-upnp
upnp/upnp-device.js
function (controlPoint, uuid, location, desc, localAddress) { EventEmitter.call(this); if (TRACE) { logger.info({ method: "UpnpDevice", uuid: uuid, }, "new device object"); } this.controlPoint = controlPoint; this.uuid = uuid; this.udn = desc.UDN[0]; ...
javascript
function (controlPoint, uuid, location, desc, localAddress) { EventEmitter.call(this); if (TRACE) { logger.info({ method: "UpnpDevice", uuid: uuid, }, "new device object"); } this.controlPoint = controlPoint; this.uuid = uuid; this.udn = desc.UDN[0]; ...
[ "function", "(", "controlPoint", ",", "uuid", ",", "location", ",", "desc", ",", "localAddress", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "if", "(", "TRACE", ")", "{", "logger", ".", "info", "(", "{", "method", ":", "\"UpnpDevice\"...
A UPnP WeMo Controllee. Includes socket switch.
[ "A", "UPnP", "WeMo", "Controllee", ".", "Includes", "socket", "switch", "." ]
514d6253eca4c6440105e48aa940a07778187e43
https://github.com/dpjanes/iotdb-upnp/blob/514d6253eca4c6440105e48aa940a07778187e43/upnp/upnp-device.js#L25-L91
train
iolo/express-toybox
utils.js
extendHttpRequest
function extendHttpRequest(req) { req = req || express.request; /** * get param value from path-variable or query or body or headers. * @param {string} paramName * @param {*} [fallback] * @returns {*} */ req.anyParam = function (paramName, fallback) { return (this.params &&...
javascript
function extendHttpRequest(req) { req = req || express.request; /** * get param value from path-variable or query or body or headers. * @param {string} paramName * @param {*} [fallback] * @returns {*} */ req.anyParam = function (paramName, fallback) { return (this.params &&...
[ "function", "extendHttpRequest", "(", "req", ")", "{", "req", "=", "req", "||", "express", ".", "request", ";", "/**\n * get param value from path-variable or query or body or headers.\n * @param {string} paramName\n * @param {*} [fallback]\n * @returns {*}\n */", "...
add some utility methods to http request. @param {*} [req]
[ "add", "some", "utility", "methods", "to", "http", "request", "." ]
c375a1388cfc167017e8dcd2325e71ca86ccb994
https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/utils.js#L151-L284
train
iolo/express-toybox
utils.js
extendHttpResponse
function extendHttpResponse(res) { res = res || express.response; function callbackFnFn(verbFunc) { return function (next, status) { var res = this; return function (err, result) { if (err) { return next(err); } ...
javascript
function extendHttpResponse(res) { res = res || express.response; function callbackFnFn(verbFunc) { return function (next, status) { var res = this; return function (err, result) { if (err) { return next(err); } ...
[ "function", "extendHttpResponse", "(", "res", ")", "{", "res", "=", "res", "||", "express", ".", "response", ";", "function", "callbackFnFn", "(", "verbFunc", ")", "{", "return", "function", "(", "next", ",", "status", ")", "{", "var", "res", "=", "this"...
add some utility methods to http response. @param {*} [res]
[ "add", "some", "utility", "methods", "to", "http", "response", "." ]
c375a1388cfc167017e8dcd2325e71ca86ccb994
https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/utils.js#L291-L502
train
karfcz/kff
src/functions/delegatedEventHandler.js
matches
function matches(el, target, selector) { var elements = el.querySelectorAll(selector); return arrayIndexOf(elements, target) !== -1; }
javascript
function matches(el, target, selector) { var elements = el.querySelectorAll(selector); return arrayIndexOf(elements, target) !== -1; }
[ "function", "matches", "(", "el", ",", "target", ",", "selector", ")", "{", "var", "elements", "=", "el", ".", "querySelectorAll", "(", "selector", ")", ";", "return", "arrayIndexOf", "(", "elements", ",", "target", ")", "!==", "-", "1", ";", "}" ]
Matches target element against CSS selector starting from element el @param {DOMElement} el Root DOM element @param {DOMElement} target Target DOM element @param {string} selector CSS selector @return {boolean} True if target element matches CSS selector, false otherwise
[ "Matches", "target", "element", "against", "CSS", "selector", "starting", "from", "element", "el" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/functions/delegatedEventHandler.js#L21-L25
train
mvrilo/tumblrrr
lib/tumblrrr.js
tumblr
function tumblr(hostname, key, secret, access_key, access_secret) { if (!(this instanceof tumblr)) return new tumblr(hostname, key, secret, access_key, access_secret); var obj = (typeof hostname !== 'object') ? { hostname : hostname, secret : secret, key : key, access_secret : access_secret, ac...
javascript
function tumblr(hostname, key, secret, access_key, access_secret) { if (!(this instanceof tumblr)) return new tumblr(hostname, key, secret, access_key, access_secret); var obj = (typeof hostname !== 'object') ? { hostname : hostname, secret : secret, key : key, access_secret : access_secret, ac...
[ "function", "tumblr", "(", "hostname", ",", "key", ",", "secret", ",", "access_key", ",", "access_secret", ")", "{", "if", "(", "!", "(", "this", "instanceof", "tumblr", ")", ")", "return", "new", "tumblr", "(", "hostname", ",", "key", ",", "secret", "...
first argument can be string or object
[ "first", "argument", "can", "be", "string", "or", "object" ]
509690be73555cd232861e82506cd8bf6f9e9a91
https://github.com/mvrilo/tumblrrr/blob/509690be73555cd232861e82506cd8bf6f9e9a91/lib/tumblrrr.js#L25-L80
train
azendal/argon
argon/storage/local.js
create
function create(requestObj, callback) { var storage = this; callback = callback || function defaultPostCallback() { //setup Error Notification here }; if ((typeof requestObj) === 'undefined' || requestObj === null) { ...
javascript
function create(requestObj, callback) { var storage = this; callback = callback || function defaultPostCallback() { //setup Error Notification here }; if ((typeof requestObj) === 'undefined' || requestObj === null) { ...
[ "function", "create", "(", "requestObj", ",", "callback", ")", "{", "var", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "defaultPostCallback", "(", ")", "{", "//setup Error Notification here", "}", ";", "if", "(", "(", "typeof", ...
Creates new data on the storage instance @method post <public> @argument data <required> [Object] the data to create on the storage instance @argument callback [Function] The function that will be executed when the process ends @return [Array]
[ "Creates", "new", "data", "on", "the", "storage", "instance" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/local.js#L127-L155
train
azendal/argon
argon/storage/local.js
find
function find(requestObj, callback) { var found, storedData, property; var storage = this; callback = callback || function defaultGetCallback() { //nothing here maybe put error notification }; for (i = 0; i < storage.preproces...
javascript
function find(requestObj, callback) { var found, storedData, property; var storage = this; callback = callback || function defaultGetCallback() { //nothing here maybe put error notification }; for (i = 0; i < storage.preproces...
[ "function", "find", "(", "requestObj", ",", "callback", ")", "{", "var", "found", ",", "storedData", ",", "property", ";", "var", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "defaultGetCallback", "(", ")", "{", "//nothing here...
Retrieves a set of data on the storage instance @method get <public> @argument query <required> [Object] the query to the elements that must be updated @argument callback [Function] The function that will be executed when the process ends @return [Array]
[ "Retrieves", "a", "set", "of", "data", "on", "the", "storage", "instance" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/local.js#L164-L197
train
azendal/argon
argon/storage/local.js
update
function update(requestObj, callback) { var storage = this; callback = callback || function defaultPutCallBack() { //setup Error notification }; if ((typeof requestObj) === 'undefined' || requestObj === null) { callb...
javascript
function update(requestObj, callback) { var storage = this; callback = callback || function defaultPutCallBack() { //setup Error notification }; if ((typeof requestObj) === 'undefined' || requestObj === null) { callb...
[ "function", "update", "(", "requestObj", ",", "callback", ")", "{", "var", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "defaultPutCallBack", "(", ")", "{", "//setup Error notification", "}", ";", "if", "(", "(", "typeof", "req...
Updates a set of data on the storage instance @method put <public> @argument query <required> [Object] the query to the elements that must be updated @argument callback [Function] The function that will be executed when the process ends @return [Object] this
[ "Updates", "a", "set", "of", "data", "on", "the", "storage", "instance" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/local.js#L234-L259
train
azendal/argon
argon/storage/local.js
remove
function remove(requestObj, callback) { var storageInstance = this; var storage = this; callback = callback || function defaultRemoveCallBack() { //setup Error Notification }; if ((typeof requestObj) === 'undefined' ||...
javascript
function remove(requestObj, callback) { var storageInstance = this; var storage = this; callback = callback || function defaultRemoveCallBack() { //setup Error Notification }; if ((typeof requestObj) === 'undefined' ||...
[ "function", "remove", "(", "requestObj", ",", "callback", ")", "{", "var", "storageInstance", "=", "this", ";", "var", "storage", "=", "this", ";", "callback", "=", "callback", "||", "function", "defaultRemoveCallBack", "(", ")", "{", "//setup Error Notification...
Removes a set of elements from the storage @method remove <public> @argument query <required> [Object] the query to the elements that must be removed @argument callback [Function] The function that will be executed when the process ends @return [Object] this
[ "Removes", "a", "set", "of", "elements", "from", "the", "storage" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/storage/local.js#L268-L294
train
jetiny/rollup-standalone
lib/rollup-cli.js
log
function log ( object, symbol ) { var message = (object.plugin ? ("(" + (object.plugin) + " plugin) " + (object.message)) : object.message) || object; stderr( ("" + symbol + (index$3.bold( message ))) ); if ( object.url ) { stderr( index$3.cyan( object.url ) ); } if ( object.loc ) { stderr( ((relativeId( ob...
javascript
function log ( object, symbol ) { var message = (object.plugin ? ("(" + (object.plugin) + " plugin) " + (object.message)) : object.message) || object; stderr( ("" + symbol + (index$3.bold( message ))) ); if ( object.url ) { stderr( index$3.cyan( object.url ) ); } if ( object.loc ) { stderr( ((relativeId( ob...
[ "function", "log", "(", "object", ",", "symbol", ")", "{", "var", "message", "=", "(", "object", ".", "plugin", "?", "(", "\"(\"", "+", "(", "object", ".", "plugin", ")", "+", "\" plugin) \"", "+", "(", "object", ".", "message", ")", ")", ":", "obj...
eslint-disable-line no-console
[ "eslint", "-", "disable", "-", "line", "no", "-", "console" ]
949d30c702b666a1a6b92e353b3a70c2e8290a66
https://github.com/jetiny/rollup-standalone/blob/949d30c702b666a1a6b92e353b3a70c2e8290a66/lib/rollup-cli.js#L568-L588
train
carrascoMDD/protractor-relaunchable
lib/configParser.js
function(into, from) { for (var key in from) { if (into[key] instanceof Object && !(into[key] instanceof Array) && !(into[key] instanceof Function)) { merge_(into[key], from[key]); } else { into[key] = from[key]; } } return into; }
javascript
function(into, from) { for (var key in from) { if (into[key] instanceof Object && !(into[key] instanceof Array) && !(into[key] instanceof Function)) { merge_(into[key], from[key]); } else { into[key] = from[key]; } } return into; }
[ "function", "(", "into", ",", "from", ")", "{", "for", "(", "var", "key", "in", "from", ")", "{", "if", "(", "into", "[", "key", "]", "instanceof", "Object", "&&", "!", "(", "into", "[", "key", "]", "instanceof", "Array", ")", "&&", "!", "(", "...
Merge config objects together. @private @param {Object} into @param {Object} from @return {Object} The 'into' config.
[ "Merge", "config", "objects", "together", "." ]
c18e17ecd8b5b036217f87680800c6e14b47361f
https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/configParser.js#L58-L69
train
thiagodp/split-cmd
index.js
split
function split( command ) { if ( typeof command !== 'string' ) { throw new Error( 'Command must be a string' ); } var r = command.match( /[^"\s]+|"(?:\\"|[^"])*"/g ); if ( ! r ) { return []; } return r.map( function ( expr ) { var isQuoted = expr.charAt( 0 ) === '"' && ...
javascript
function split( command ) { if ( typeof command !== 'string' ) { throw new Error( 'Command must be a string' ); } var r = command.match( /[^"\s]+|"(?:\\"|[^"])*"/g ); if ( ! r ) { return []; } return r.map( function ( expr ) { var isQuoted = expr.charAt( 0 ) === '"' && ...
[ "function", "split", "(", "command", ")", "{", "if", "(", "typeof", "command", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Command must be a string'", ")", ";", "}", "var", "r", "=", "command", ".", "match", "(", "/", "[^\"\\s]+|\"(?:\\\\\...
Split a command into an array. @example ```js var arr = split( 'git commit -m "some message with spaces"' ); console.log( arr ); // [ "git", "commit", "-m", "some message with spaces" ] ``` @param {string} command Command to split. @returns {Array}
[ "Split", "a", "command", "into", "an", "array", "." ]
6574da1c7d0f4d216d9d5897794fc14397ae41be
https://github.com/thiagodp/split-cmd/blob/6574da1c7d0f4d216d9d5897794fc14397ae41be/index.js#L13-L27
train
thiagodp/split-cmd
index.js
splitToObject
function splitToObject( command ) { var cmds = split( command ); switch( cmds.length ) { case 0: return {}; case 1: return { command: cmds[ 0 ] }; default: { var first = cmds[ 0 ]; cmds.shift(); return { command: first, args: cmds }; } } }
javascript
function splitToObject( command ) { var cmds = split( command ); switch( cmds.length ) { case 0: return {}; case 1: return { command: cmds[ 0 ] }; default: { var first = cmds[ 0 ]; cmds.shift(); return { command: first, args: cmds }; } } }
[ "function", "splitToObject", "(", "command", ")", "{", "var", "cmds", "=", "split", "(", "command", ")", ";", "switch", "(", "cmds", ".", "length", ")", "{", "case", "0", ":", "return", "{", "}", ";", "case", "1", ":", "return", "{", "command", ":"...
Split a command into an object with the attributes `command` and `args`. @example ```js var obj = splitToObject( 'git commit -m "some message with spaces"' ); console.log( obj.command ); // git console.log( obj.args ); // [ "commit", "-m", "some message with spaces" ] ``` @param {string} command Command to split. @re...
[ "Split", "a", "command", "into", "an", "object", "with", "the", "attributes", "command", "and", "args", "." ]
6574da1c7d0f4d216d9d5897794fc14397ae41be
https://github.com/thiagodp/split-cmd/blob/6574da1c7d0f4d216d9d5897794fc14397ae41be/index.js#L42-L53
train
layerhq/node-layer-webhooks
lib/webhooks.js
function(params, callback) { if (!params.url) return (callback || function() {})(new Error(utils.i18n.webhooks.url)); if (!params.events || !params.events.length) return (callback || function() {})(new Error(utils.i18n.webhooks.events)); if (!params.secret) return (callback || function() {})(new Err...
javascript
function(params, callback) { if (!params.url) return (callback || function() {})(new Error(utils.i18n.webhooks.url)); if (!params.events || !params.events.length) return (callback || function() {})(new Error(utils.i18n.webhooks.events)); if (!params.secret) return (callback || function() {})(new Err...
[ "function", "(", "params", ",", "callback", ")", "{", "if", "(", "!", "params", ".", "url", ")", "return", "(", "callback", "||", "function", "(", ")", "{", "}", ")", "(", "new", "Error", "(", "utils", ".", "i18n", ".", "webhooks", ".", "url", ")...
Register a Webhook @param {Object} params @param {String[]} params.events Array of event names to subscribe to @param {String} params.url URL for webhook events to go to @param {String} params.secret Unique string known only to your server for validating webhook events @param {Obje...
[ "Register", "a", "Webhook" ]
9bfbee048c03d3ba4474a3490085626cd8a7a0df
https://github.com/layerhq/node-layer-webhooks/blob/9bfbee048c03d3ba4474a3490085626cd8a7a0df/lib/webhooks.js#L22-L41
train
layerhq/node-layer-webhooks
lib/webhooks.js
function(webhookId, callback) { utils.debug('Webhooks disable: ' + webhookId); request.post({ path: '/webhooks/' + utils.toUUID(webhookId) + '/deactivate', }, callback || utils.nop); }
javascript
function(webhookId, callback) { utils.debug('Webhooks disable: ' + webhookId); request.post({ path: '/webhooks/' + utils.toUUID(webhookId) + '/deactivate', }, callback || utils.nop); }
[ "function", "(", "webhookId", ",", "callback", ")", "{", "utils", ".", "debug", "(", "'Webhooks disable: '", "+", "webhookId", ")", ";", "request", ".", "post", "(", "{", "path", ":", "'/webhooks/'", "+", "utils", ".", "toUUID", "(", "webhookId", ")", "+...
Disable a webhook @param {String} webhookId @param {Function} callback Callback function
[ "Disable", "a", "webhook" ]
9bfbee048c03d3ba4474a3490085626cd8a7a0df
https://github.com/layerhq/node-layer-webhooks/blob/9bfbee048c03d3ba4474a3490085626cd8a7a0df/lib/webhooks.js#L49-L54
train