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
neyric/aws-swf
lib/workflow-execution.js
function (config, cb) { var o = {}, k; o.domain = this.baseConfig.domain; //o.execution = this.workflowId; for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; } } this.swfClient.getWorkflowExecutionHistory(o, cb...
javascript
function (config, cb) { var o = {}, k; o.domain = this.baseConfig.domain; //o.execution = this.workflowId; for (k in config) { if (config.hasOwnProperty(k)) { o[k] = config[k]; } } this.swfClient.getWorkflowExecutionHistory(o, cb...
[ "function", "(", "config", ",", "cb", ")", "{", "var", "o", "=", "{", "}", ",", "k", ";", "o", ".", "domain", "=", "this", ".", "baseConfig", ".", "domain", ";", "//o.execution = this.workflowId;", "for", "(", "k", "in", "config", ")", "{", "if", "...
Get the history for the workflow execution @param {Object} config @param {Function} cb
[ "Get", "the", "history", "for", "the", "workflow", "execution" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow-execution.js#L86-L99
train
origin1tech/sequelize-cmd
lib/migrator.js
Migrator
function Migrator(sequelize, options) { this.sequelize = sequelize; this.options = Utils._.extend({ path: __dirname + '/../migrations', from: null, to: null, logging: console.log, filesFilter: /\.js$/ }, opti...
javascript
function Migrator(sequelize, options) { this.sequelize = sequelize; this.options = Utils._.extend({ path: __dirname + '/../migrations', from: null, to: null, logging: console.log, filesFilter: /\.js$/ }, opti...
[ "function", "Migrator", "(", "sequelize", ",", "options", ")", "{", "this", ".", "sequelize", "=", "sequelize", ";", "this", ".", "options", "=", "Utils", ".", "_", ".", "extend", "(", "{", "path", ":", "__dirname", "+", "'/../migrations'", ",", "from", ...
Sequelize Migrator class. @class Migrator @param {object} sequelize - the sequelize instance. @param {object} [options] - the migration options. @constructor
[ "Sequelize", "Migrator", "class", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/migrator.js#L22-L43
train
jbielick/kona
lib/kona/watch.js
watch
function watch(path, cb) { debug('watching %s for changes', path); var options = {ignoreInitial: true, persistent: true}, watcher = chokidar.watch(path, options); watcher.on('change', function(path, stat) { /* istanbul ignore next */ debug(format("%s changed", path)); /* istanb...
javascript
function watch(path, cb) { debug('watching %s for changes', path); var options = {ignoreInitial: true, persistent: true}, watcher = chokidar.watch(path, options); watcher.on('change', function(path, stat) { /* istanbul ignore next */ debug(format("%s changed", path)); /* istanb...
[ "function", "watch", "(", "path", ",", "cb", ")", "{", "debug", "(", "'watching %s for changes'", ",", "path", ")", ";", "var", "options", "=", "{", "ignoreInitial", ":", "true", ",", "persistent", ":", "true", "}", ",", "watcher", "=", "chokidar", ".", ...
setup a chokidar persistent watcher on a dir or file and call the callback on `change` event @param {String} path directory (recursive) or file path to watch @param {Function} cb callback to call on `change` event @return {choikdar.watcher} the watcher instance created
[ "setup", "a", "chokidar", "persistent", "watcher", "on", "a", "dir", "or", "file", "and", "call", "the", "callback", "on", "change", "event" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona/watch.js#L30-L47
train
jbielick/kona
lib/kona/watch.js
watchModules
function watchModules(paths) { paths || (paths = []); if (!Array.isArray(paths)) { paths = [paths]; } // for all directories / files in `config.watch` array paths.forEach(function(watchPath) { // watch modules for changes this.watch(watchPath, function(eventPath, stat) { // dele...
javascript
function watchModules(paths) { paths || (paths = []); if (!Array.isArray(paths)) { paths = [paths]; } // for all directories / files in `config.watch` array paths.forEach(function(watchPath) { // watch modules for changes this.watch(watchPath, function(eventPath, stat) { // dele...
[ "function", "watchModules", "(", "paths", ")", "{", "paths", "||", "(", "paths", "=", "[", "]", ")", ";", "if", "(", "!", "Array", ".", "isArray", "(", "paths", ")", ")", "{", "paths", "=", "[", "paths", "]", ";", "}", "// for all directories / files...
watches routes, controllers, models for changes and clears require cache for those objects to be reloaded or clears routes and reloads them
[ "watches", "routes", "controllers", "models", "for", "changes", "and", "clears", "require", "cache", "for", "those", "objects", "to", "be", "reloaded", "or", "clears", "routes", "and", "reloads", "them" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona/watch.js#L54-L81
train
jbielick/kona
lib/kona.js
Kona
function Kona(options) { // call the koa constructor here Koa.call(this); options = options || {}; // setup kona root and application paths / helpers this.setupPaths(options); // setup env vars, logger, needed modules this.setupEnvironment(options); this.loadMixins(this.root.join('package.json')); ...
javascript
function Kona(options) { // call the koa constructor here Koa.call(this); options = options || {}; // setup kona root and application paths / helpers this.setupPaths(options); // setup env vars, logger, needed modules this.setupEnvironment(options); this.loadMixins(this.root.join('package.json')); ...
[ "function", "Kona", "(", "options", ")", "{", "// call the koa constructor here", "Koa", ".", "call", "(", "this", ")", ";", "options", "=", "options", "||", "{", "}", ";", "// setup kona root and application paths / helpers", "this", ".", "setupPaths", "(", "opti...
the application module that will house the koa app and provide an api layer to registering middleware, establishing db connections, loading application routes, controllers, models and helpers @param {Object} options options options from commander
[ "the", "application", "module", "that", "will", "house", "the", "koa", "app", "and", "provide", "an", "api", "layer", "to", "registering", "middleware", "establishing", "db", "connections", "loading", "application", "routes", "controllers", "models", "and", "helpe...
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L25-L39
train
jbielick/kona
lib/kona.js
function (options) { this.expose('kona', this); // livepath for the application root this.root = new LivePath(options.root || process.cwd()); // livepath for the kona module root this._root = new LivePath(path.resolve(__dirname, '..')); debug('Application CWD: ' + this.root.toString()); ...
javascript
function (options) { this.expose('kona', this); // livepath for the application root this.root = new LivePath(options.root || process.cwd()); // livepath for the kona module root this._root = new LivePath(path.resolve(__dirname, '..')); debug('Application CWD: ' + this.root.toString()); ...
[ "function", "(", "options", ")", "{", "this", ".", "expose", "(", "'kona'", ",", "this", ")", ";", "// livepath for the application root", "this", ".", "root", "=", "new", "LivePath", "(", "options", ".", "root", "||", "process", ".", "cwd", "(", ")", ")...
sets up root paths, application version @param {Object} options options or arguments passed in via constructor
[ "sets", "up", "root", "paths", "application", "version" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L158-L172
train
jbielick/kona
lib/kona.js
function(options) { dotenv.config({path: this.root.join('.env'), silent: true}); this.env = options.environment || process.env.NODE_ENV || 'development'; // detect if we're in an kona application cwd this.inApp = fs.existsSync(this.root.join('config', 'application.js')); // create a winston logg...
javascript
function(options) { dotenv.config({path: this.root.join('.env'), silent: true}); this.env = options.environment || process.env.NODE_ENV || 'development'; // detect if we're in an kona application cwd this.inApp = fs.existsSync(this.root.join('config', 'application.js')); // create a winston logg...
[ "function", "(", "options", ")", "{", "dotenv", ".", "config", "(", "{", "path", ":", "this", ".", "root", ".", "join", "(", "'.env'", ")", ",", "silent", ":", "true", "}", ")", ";", "this", ".", "env", "=", "options", ".", "environment", "||", "...
parse .env, global env vars, inApp check and setup middleware paths for readiness @param {Object} options kona construction options
[ "parse", ".", "env", "global", "env", "vars", "inApp", "check", "and", "setup", "middleware", "paths", "for", "readiness" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L180-L217
train
jbielick/kona
lib/kona.js
function () { this.middlewarePaths.forEach(function (mwPath) { require(mwPath)(this); debug(format('mounted middleware/%s', path.basename(mwPath))); }, this); }
javascript
function () { this.middlewarePaths.forEach(function (mwPath) { require(mwPath)(this); debug(format('mounted middleware/%s', path.basename(mwPath))); }, this); }
[ "function", "(", ")", "{", "this", ".", "middlewarePaths", ".", "forEach", "(", "function", "(", "mwPath", ")", "{", "require", "(", "mwPath", ")", "(", "this", ")", ";", "debug", "(", "format", "(", "'mounted middleware/%s'", ",", "path", ".", "basename...
requires barebones Kona middleware and pushes them to the koa middleware stack one by one
[ "requires", "barebones", "Kona", "middleware", "and", "pushes", "them", "to", "the", "koa", "middleware", "stack", "one", "by", "one" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L223-L233
train
jbielick/kona
lib/kona.js
function (name, object) { if (global[name] && this.env !== 'test') { debug(format('global "%s" already exists', name)); } return (global[name] = object); }
javascript
function (name, object) { if (global[name] && this.env !== 'test') { debug(format('global "%s" already exists', name)); } return (global[name] = object); }
[ "function", "(", "name", ",", "object", ")", "{", "if", "(", "global", "[", "name", "]", "&&", "this", ".", "env", "!==", "'test'", ")", "{", "debug", "(", "format", "(", "'global \"%s\" already exists'", ",", "name", ")", ")", ";", "}", "return", "(...
exposes objects globally @param {String} name name of the global @param {Mixed} object the value to assign to the global
[ "exposes", "objects", "globally" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L241-L246
train
jbielick/kona
lib/kona.js
function () { var writeStream = fs.createWriteStream('/dev/null'), readStream = fs.createReadStream('/dev/null'); return repl.start({ prompt: format('kona~%s > ', this.version), useColors: true, input: this.env === 'test' ? readStream : process.stdin, output: this.env === 'test...
javascript
function () { var writeStream = fs.createWriteStream('/dev/null'), readStream = fs.createReadStream('/dev/null'); return repl.start({ prompt: format('kona~%s > ', this.version), useColors: true, input: this.env === 'test' ? readStream : process.stdin, output: this.env === 'test...
[ "function", "(", ")", "{", "var", "writeStream", "=", "fs", ".", "createWriteStream", "(", "'/dev/null'", ")", ",", "readStream", "=", "fs", ".", "createReadStream", "(", "'/dev/null'", ")", ";", "return", "repl", ".", "start", "(", "{", "prompt", ":", "...
starts the kona repl
[ "starts", "the", "kona", "repl" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L252-L264
train
jbielick/kona
lib/kona.js
function () { var args = Array.prototype.slice.call(arguments), port = args.shift(), bean; if (!this._ready) { throw new Error('Cannot call #listen before Kona has been intialized'); } bean = require('./utilities/bean'); if (this.env === 'test') { delete this.port; ...
javascript
function () { var args = Array.prototype.slice.call(arguments), port = args.shift(), bean; if (!this._ready) { throw new Error('Cannot call #listen before Kona has been intialized'); } bean = require('./utilities/bean'); if (this.env === 'test') { delete this.port; ...
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ",", "port", "=", "args", ".", "shift", "(", ")", ",", "bean", ";", "if", "(", "!", "this", ".", "_ready", ")", "{", "th...
start the http server and listen @return {HttpServer} koa server instance
[ "start", "the", "http", "server", "and", "listen" ]
3a723c0b91157dec6b1b229e395de297fd725796
https://github.com/jbielick/kona/blob/3a723c0b91157dec6b1b229e395de297fd725796/lib/kona.js#L271-L304
train
bojand/grpc-create-error
index.js
applyCreate
function applyCreate (err, message, code, metadata) { if (err instanceof Error === false) { throw new Error('Source error must be an instance of Error') } if (message instanceof Error) { err.message = message.message.toString() if (typeof message.code === 'number') { err.code = message.code ...
javascript
function applyCreate (err, message, code, metadata) { if (err instanceof Error === false) { throw new Error('Source error must be an instance of Error') } if (message instanceof Error) { err.message = message.message.toString() if (typeof message.code === 'number') { err.code = message.code ...
[ "function", "applyCreate", "(", "err", ",", "message", ",", "code", ",", "metadata", ")", "{", "if", "(", "err", "instanceof", "Error", "===", "false", ")", "{", "throw", "new", "Error", "(", "'Source error must be an instance of Error'", ")", "}", "if", "("...
Actual function that does all the work. Same as createGRPCError but applies cretion to the existing error. @param {Error} err The error to apply creation to @param {String|Number|Error|Object} message See <code>createGRPCError</code> description @param {Number|Object} code See <code>createGRPCError</code> descriptio...
[ "Actual", "function", "that", "does", "all", "the", "work", ".", "Same", "as", "createGRPCError", "but", "applies", "cretion", "to", "the", "existing", "error", "." ]
01909b70c947ce2c28077ec2438e32561167e968
https://github.com/bojand/grpc-create-error/blob/01909b70c947ce2c28077ec2438e32561167e968/index.js#L67-L131
train
neyric/aws-swf
lib/workflow.js
function (config, cb) { var w = new WorkflowExecution(this.swfClient, this.config); w.start(config, cb); return w; }
javascript
function (config, cb) { var w = new WorkflowExecution(this.swfClient, this.config); w.start(config, cb); return w; }
[ "function", "(", "config", ",", "cb", ")", "{", "var", "w", "=", "new", "WorkflowExecution", "(", "this", ".", "swfClient", ",", "this", ".", "config", ")", ";", "w", ".", "start", "(", "config", ",", "cb", ")", ";", "return", "w", ";", "}" ]
Creates a new Workflow instance and start it @param {Object} config @param {Function} [cb] - called once the workflow execution started @returns {WorkflowExecution} workflowExecution - The new instance of the workflow execution
[ "Creates", "a", "new", "Workflow", "instance", "and", "start", "it" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow.js#L24-L28
train
neyric/aws-swf
lib/workflow.js
function (cb) { this.swfClient.registerWorkflowType({ "domain": this.config.domain, "name": this.config.workflowType.name, "version": this.config.workflowType.version }, cb); }
javascript
function (cb) { this.swfClient.registerWorkflowType({ "domain": this.config.domain, "name": this.config.workflowType.name, "version": this.config.workflowType.version }, cb); }
[ "function", "(", "cb", ")", "{", "this", ".", "swfClient", ".", "registerWorkflowType", "(", "{", "\"domain\"", ":", "this", ".", "config", ".", "domain", ",", "\"name\"", ":", "this", ".", "config", ".", "workflowType", ".", "name", ",", "\"version\"", ...
register the workflow @param {Function} [cb]
[ "register", "the", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/workflow.js#L49-L55
train
origin1tech/sequelize-cmd
lib/compare.js
upToString
function upToString() { var upStr = '', ctr = 0, items = getActions(build.up), tab, suffix; // build the output string for up. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
javascript
function upToString() { var upStr = '', ctr = 0, items = getActions(build.up), tab, suffix; // build the output string for up. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
[ "function", "upToString", "(", ")", "{", "var", "upStr", "=", "''", ",", "ctr", "=", "0", ",", "items", "=", "getActions", "(", "build", ".", "up", ")", ",", "tab", ",", "suffix", ";", "// build the output string for up.", "_", ".", "forEach", "(", "it...
Concats all up migration events to string. @private @memberof Compare @returns {string}
[ "Concats", "all", "up", "migration", "events", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L125-L141
train
origin1tech/sequelize-cmd
lib/compare.js
downToString
function downToString() { var dwnStr = '', ctr = 0, items = getActions(build.down), tab, suffix; // build the output string for down. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
javascript
function downToString() { var dwnStr = '', ctr = 0, items = getActions(build.down), tab, suffix; // build the output string for down. _.forEach(items, function (v,k) { _.forEach(v, function(item, key){ ...
[ "function", "downToString", "(", ")", "{", "var", "dwnStr", "=", "''", ",", "ctr", "=", "0", ",", "items", "=", "getActions", "(", "build", ".", "down", ")", ",", "tab", ",", "suffix", ";", "// build the output string for down.", "_", ".", "forEach", "("...
Concats all down migration events to string. @private @memberof Compare @returns {string}
[ "Concats", "all", "down", "migration", "events", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L149-L165
train
origin1tech/sequelize-cmd
lib/compare.js
recurseChildOptions
function recurseChildOptions(obj, level){ var child = '', len = Object.keys(obj).length, ctr = 0, prefix; level = level || 1; for(var prop in obj) { if(obj.hasOwnProperty(prop)){ var tab = getTabs(lev...
javascript
function recurseChildOptions(obj, level){ var child = '', len = Object.keys(obj).length, ctr = 0, prefix; level = level || 1; for(var prop in obj) { if(obj.hasOwnProperty(prop)){ var tab = getTabs(lev...
[ "function", "recurseChildOptions", "(", "obj", ",", "level", ")", "{", "var", "child", "=", "''", ",", "len", "=", "Object", ".", "keys", "(", "obj", ")", ".", "length", ",", "ctr", "=", "0", ",", "prefix", ";", "level", "=", "level", "||", "1", ...
Recurse child options concat to string. @private @memberof Compare @param {object} obj - the child object. @returns {string}
[ "Recurse", "child", "options", "concat", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L174-L216
train
origin1tech/sequelize-cmd
lib/compare.js
parseOptions
function parseOptions(obj) { var ctr = 0, tab = getTabs(1, true); for(var prop in obj) { if(obj.hasOwnProperty(prop)){ if(_.isPlainObject(obj[prop])){ if(!_.isEmpty(obj[prop])){ var child = re...
javascript
function parseOptions(obj) { var ctr = 0, tab = getTabs(1, true); for(var prop in obj) { if(obj.hasOwnProperty(prop)){ if(_.isPlainObject(obj[prop])){ if(!_.isEmpty(obj[prop])){ var child = re...
[ "function", "parseOptions", "(", "obj", ")", "{", "var", "ctr", "=", "0", ",", "tab", "=", "getTabs", "(", "1", ",", "true", ")", ";", "for", "(", "var", "prop", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "prop", ")", ...
Parse options for create model migrations. @private @memberof Compare @param {object} obj - the object of options.
[ "Parse", "options", "for", "create", "model", "migrations", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L224-L251
train
origin1tech/sequelize-cmd
lib/compare.js
attributesToString
function attributesToString(obj, prevObj, level) { var attrs = '', prefix, tab; level = level || 1; tab = getTabs(level, true); _.forEach(obj, function (v, k) { if(excludeAttrs.indexOf(k) === -1){ var pre...
javascript
function attributesToString(obj, prevObj, level) { var attrs = '', prefix, tab; level = level || 1; tab = getTabs(level, true); _.forEach(obj, function (v, k) { if(excludeAttrs.indexOf(k) === -1){ var pre...
[ "function", "attributesToString", "(", "obj", ",", "prevObj", ",", "level", ")", "{", "var", "attrs", "=", "''", ",", "prefix", ",", "tab", ";", "level", "=", "level", "||", "1", ";", "tab", "=", "getTabs", "(", "level", ",", "true", ")", ";", "_",...
Converts a property's atttributes to string. @private @memberof Compare @param {object} obj - the object of attributes. @param {object} prevObj - the previous object of attributes from last snapshot. @returns {string}
[ "Converts", "a", "property", "s", "atttributes", "to", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/compare.js#L261-L290
train
origin1tech/sequelize-cmd
lib/utils/helpers.js
strToCase
function strToCase(str, casing) { casing = casing === 'capitalize' ? 'first' : casing; if (!casing) return str; casing = casing || 'first'; if (casing === 'lower') return str.toLowerCase(); if (casing === 'upper') return str.t...
javascript
function strToCase(str, casing) { casing = casing === 'capitalize' ? 'first' : casing; if (!casing) return str; casing = casing || 'first'; if (casing === 'lower') return str.toLowerCase(); if (casing === 'upper') return str.t...
[ "function", "strToCase", "(", "str", ",", "casing", ")", "{", "casing", "=", "casing", "===", "'capitalize'", "?", "'first'", ":", "casing", ";", "if", "(", "!", "casing", ")", "return", "str", ";", "casing", "=", "casing", "||", "'first'", ";", "if", ...
Converts the case of a string. @memberof Helpers @param {string} str - the string to convert. @param {string} casing - case to convert to ex: 'first', 'upper', 'title', 'camel', 'pascal'
[ "Converts", "the", "case", "of", "a", "string", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L35-L61
train
origin1tech/sequelize-cmd
lib/utils/helpers.js
camelToUnderscore
function camelToUnderscore(str) { return s.split(/(?=[A-Z])/).map(function (p) { return p.charAt(0).toUpperCase() + p.slice(1); }).join('_'); }
javascript
function camelToUnderscore(str) { return s.split(/(?=[A-Z])/).map(function (p) { return p.charAt(0).toUpperCase() + p.slice(1); }).join('_'); }
[ "function", "camelToUnderscore", "(", "str", ")", "{", "return", "s", ".", "split", "(", "/", "(?=[A-Z])", "/", ")", ".", "map", "(", "function", "(", "p", ")", "{", "return", "p", ".", "charAt", "(", "0", ")", ".", "toUpperCase", "(", ")", "+", ...
Converts camel case string to underscore. @param {string} str - the string to convert. @returns {string}
[ "Converts", "camel", "case", "string", "to", "underscore", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L68-L72
train
origin1tech/sequelize-cmd
lib/utils/helpers.js
normalizeAttributes
function normalizeAttributes(attrs, strip) { // map for converting SQL types to Sequelize DataTypes. var map = { TINYINT: 'BOOLEAN', DATETIME: 'DATE', TIMESTAMP: 'DATE', 'VARCHAR BINARY': 'STRING.BINARY', ...
javascript
function normalizeAttributes(attrs, strip) { // map for converting SQL types to Sequelize DataTypes. var map = { TINYINT: 'BOOLEAN', DATETIME: 'DATE', TIMESTAMP: 'DATE', 'VARCHAR BINARY': 'STRING.BINARY', ...
[ "function", "normalizeAttributes", "(", "attrs", ",", "strip", ")", "{", "// map for converting SQL types to Sequelize DataTypes.", "var", "map", "=", "{", "TINYINT", ":", "'BOOLEAN'", ",", "DATETIME", ":", "'DATE'", ",", "TIMESTAMP", ":", "'DATE'", ",", "'VARCHAR B...
Normalize property attributes primarily the type. @memberof Helpers @param {object} attrs - the attributes to be parsed. @param {array} strip - an array of keys to strip/remove. @returns {object}
[ "Normalize", "property", "attributes", "primarily", "the", "type", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L146-L234
train
origin1tech/sequelize-cmd
lib/utils/helpers.js
getType
function getType(type, len, name) { if(!type) return undefined; type = type.split('(')[0]; if(map[type]){ var tmp = map[type]; if(len && !_.contains([255, 11], len)) len = '(' + len + ')'; else len = ''; ...
javascript
function getType(type, len, name) { if(!type) return undefined; type = type.split('(')[0]; if(map[type]){ var tmp = map[type]; if(len && !_.contains([255, 11], len)) len = '(' + len + ')'; else len = ''; ...
[ "function", "getType", "(", "type", ",", "len", ",", "name", ")", "{", "if", "(", "!", "type", ")", "return", "undefined", ";", "type", "=", "type", ".", "split", "(", "'('", ")", "[", "0", "]", ";", "if", "(", "map", "[", "type", "]", ")", "...
convert and format to Sequelize Model Type.
[ "convert", "and", "format", "to", "Sequelize", "Model", "Type", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L177-L190
train
origin1tech/sequelize-cmd
lib/utils/helpers.js
normalizeOptions
function normalizeOptions(options, include) { _.forEach(options, function (v,k) { if(!_.contains(include, k)) delete options[k]; }); return options; }
javascript
function normalizeOptions(options, include) { _.forEach(options, function (v,k) { if(!_.contains(include, k)) delete options[k]; }); return options; }
[ "function", "normalizeOptions", "(", "options", ",", "include", ")", "{", "_", ".", "forEach", "(", "options", ",", "function", "(", "v", ",", "k", ")", "{", "if", "(", "!", "_", ".", "contains", "(", "include", ",", "k", ")", ")", "delete", "optio...
Normalize options including only required. @memberof Helpers @param {object} options - the options object. @param {array} include - an array of keys to include. @returns {object}
[ "Normalize", "options", "including", "only", "required", "." ]
f9e1108997b484cd2d57504a7db9cee3220d46ef
https://github.com/origin1tech/sequelize-cmd/blob/f9e1108997b484cd2d57504a7db9cee3220d46ef/lib/utils/helpers.js#L243-L249
train
node-ffi-napi/ref-array-di
lib/array.js
ArrayType
function ArrayType (data, length) { if (!(this instanceof ArrayType)) { return new ArrayType(data, length) } debug('creating new array instance') ArrayIndex.call(this) var item_size = ArrayType.BYTES_PER_ELEMENT if (0 === arguments.length) { // new IntArray() // use the "fixedL...
javascript
function ArrayType (data, length) { if (!(this instanceof ArrayType)) { return new ArrayType(data, length) } debug('creating new array instance') ArrayIndex.call(this) var item_size = ArrayType.BYTES_PER_ELEMENT if (0 === arguments.length) { // new IntArray() // use the "fixedL...
[ "function", "ArrayType", "(", "data", ",", "length", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ArrayType", ")", ")", "{", "return", "new", "ArrayType", "(", "data", ",", "length", ")", "}", "debug", "(", "'creating new array instance'", ")", ...
This is the ArrayType "constructor" that gets returned.
[ "This", "is", "the", "ArrayType", "constructor", "that", "gets", "returned", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L28-L90
train
node-ffi-napi/ref-array-di
lib/array.js
set
function set (buffer, offset, value) { debug('Array "type" setter for buffer at offset', buffer, offset, value) var array = this.get(buffer, offset) var isInstance = value instanceof this if (isInstance || isArray(value)) { for (var i = 0; i < value.length; i++) { array[i] = value[i] } } else { ...
javascript
function set (buffer, offset, value) { debug('Array "type" setter for buffer at offset', buffer, offset, value) var array = this.get(buffer, offset) var isInstance = value instanceof this if (isInstance || isArray(value)) { for (var i = 0; i < value.length; i++) { array[i] = value[i] } } else { ...
[ "function", "set", "(", "buffer", ",", "offset", ",", "value", ")", "{", "debug", "(", "'Array \"type\" setter for buffer at offset'", ",", "buffer", ",", "offset", ",", "value", ")", "var", "array", "=", "this", ".", "get", "(", "buffer", ",", "offset", "...
The "set" function of the Array "type" interface. Most likely invoked when setting within a "ref-struct" type.
[ "The", "set", "function", "of", "the", "Array", "type", "interface", ".", "Most", "likely", "invoked", "when", "setting", "within", "a", "ref", "-", "struct", "type", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L180-L191
train
node-ffi-napi/ref-array-di
lib/array.js
setRef
function setRef (buffer, offset, value) { debug('Array reference "type" setter for buffer at offset', offset) var ptr if (value instanceof this) { ptr = value.buffer } else { ptr = new this(value).buffer } _ref.writePointer(buffer, offset, ptr) }
javascript
function setRef (buffer, offset, value) { debug('Array reference "type" setter for buffer at offset', offset) var ptr if (value instanceof this) { ptr = value.buffer } else { ptr = new this(value).buffer } _ref.writePointer(buffer, offset, ptr) }
[ "function", "setRef", "(", "buffer", ",", "offset", ",", "value", ")", "{", "debug", "(", "'Array reference \"type\" setter for buffer at offset'", ",", "offset", ")", "var", "ptr", "if", "(", "value", "instanceof", "this", ")", "{", "ptr", "=", "value", ".", ...
Most likely invoked when passing an array instance as an argument to an FFI'd function.
[ "Most", "likely", "invoked", "when", "passing", "an", "array", "instance", "as", "an", "argument", "to", "an", "FFI", "d", "function", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L210-L219
train
node-ffi-napi/ref-array-di
lib/array.js
ref
function ref () { debug('ref()') var type = this.constructor var origSize = this.buffer.length var r = _ref.ref(this.buffer) r.type = Object.create(_ref.types.CString) r.type.get = function (buf, offset) { return new type(_ref.readPointer(buf, offset | 0, origSize)) } r.type.set = function () { ...
javascript
function ref () { debug('ref()') var type = this.constructor var origSize = this.buffer.length var r = _ref.ref(this.buffer) r.type = Object.create(_ref.types.CString) r.type.get = function (buf, offset) { return new type(_ref.readPointer(buf, offset | 0, origSize)) } r.type.set = function () { ...
[ "function", "ref", "(", ")", "{", "debug", "(", "'ref()'", ")", "var", "type", "=", "this", ".", "constructor", "var", "origSize", "=", "this", ".", "buffer", ".", "length", "var", "r", "=", "_ref", ".", "ref", "(", "this", ".", "buffer", ")", "r",...
Returns a reference to the backing buffer of this Array instance. i.e. if the array represents `int[]` (a.k.a. `int *`), then the returned Buffer represents `int (*)[]` (a.k.a. `int **`)
[ "Returns", "a", "reference", "to", "the", "backing", "buffer", "of", "this", "Array", "instance", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L228-L241
train
node-ffi-napi/ref-array-di
lib/array.js
getter
function getter (index) { debug('getting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffer.lengt...
javascript
function getter (index) { debug('getting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffer.lengt...
[ "function", "getter", "(", "index", ")", "{", "debug", "(", "'getting array[%d]'", ",", "index", ")", "var", "size", "=", "this", ".", "constructor", ".", "BYTES_PER_ELEMENT", "var", "baseType", "=", "this", ".", "constructor", ".", "type", "var", "offset", ...
The "getter" implementation for the "array-index" interface.
[ "The", "getter", "implementation", "for", "the", "array", "-", "index", "interface", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L247-L259
train
node-ffi-napi/ref-array-di
lib/array.js
setter
function setter (index, value) { debug('setting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffe...
javascript
function setter (index, value) { debug('setting array[%d]', index) var size = this.constructor.BYTES_PER_ELEMENT var baseType = this.constructor.type var offset = size * index var end = offset + size var buffer = this.buffer if (buffer.length < end) { debug('reinterpreting buffer from %d to %d', buffe...
[ "function", "setter", "(", "index", ",", "value", ")", "{", "debug", "(", "'setting array[%d]'", ",", "index", ")", "var", "size", "=", "this", ".", "constructor", ".", "BYTES_PER_ELEMENT", "var", "baseType", "=", "this", ".", "constructor", ".", "type", "...
The "setter" implementation for the "array-index" interface.
[ "The", "setter", "implementation", "for", "the", "array", "-", "index", "interface", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L265-L280
train
node-ffi-napi/ref-array-di
lib/array.js
slice
function slice (start, end) { var data if (end) { debug('slicing array from %d to %d', start, end) data = this.buffer.slice(start*this.constructor.BYTES_PER_ELEMENT, end*this.constructor.BYTES_PER_ELEMENT) } else { debug('slicing array from %d', start) data = this.buffer.slice(start*this.construc...
javascript
function slice (start, end) { var data if (end) { debug('slicing array from %d to %d', start, end) data = this.buffer.slice(start*this.constructor.BYTES_PER_ELEMENT, end*this.constructor.BYTES_PER_ELEMENT) } else { debug('slicing array from %d', start) data = this.buffer.slice(start*this.construc...
[ "function", "slice", "(", "start", ",", "end", ")", "{", "var", "data", "if", "(", "end", ")", "{", "debug", "(", "'slicing array from %d to %d'", ",", "start", ",", "end", ")", "data", "=", "this", ".", "buffer", ".", "slice", "(", "start", "*", "th...
The "slice" implementation.
[ "The", "slice", "implementation", "." ]
a0699e21be2d2dab80fb356bb67cf2244c33ea52
https://github.com/node-ffi-napi/ref-array-di/blob/a0699e21be2d2dab80fb356bb67cf2244c33ea52/lib/array.js#L286-L298
train
simoami/mimik
lib/utils.js
function (message, config, cb) { if(typeof config === 'function') { cb = config; config = {}; } var stdin = config.stdin || process.stdin, stdout = config.stdout || process.stdout, prompt = config.prompt || '\u203A'; stdout.write(' ' + mes...
javascript
function (message, config, cb) { if(typeof config === 'function') { cb = config; config = {}; } var stdin = config.stdin || process.stdin, stdout = config.stdout || process.stdout, prompt = config.prompt || '\u203A'; stdout.write(' ' + mes...
[ "function", "(", "message", ",", "config", ",", "cb", ")", "{", "if", "(", "typeof", "config", "===", "'function'", ")", "{", "cb", "=", "config", ";", "config", "=", "{", "}", ";", "}", "var", "stdin", "=", "config", ".", "stdin", "||", "process",...
creates a console prompt and calls the passed callback with the anwser
[ "creates", "a", "console", "prompt", "and", "calls", "the", "passed", "callback", "with", "the", "anwser" ]
464a4679bba671d43aea6660485d8db9fa767b1b
https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/lib/utils.js#L259-L274
train
tgriesser/create-error
create-error.js
attachProps
function attachProps(context, target) { if (isObject(target)) { var keys = inheritedKeys(target); for (var i = 0, l = keys.length; i < l; ++i) { context[keys[i]] = clone(target[keys[i]]); } } }
javascript
function attachProps(context, target) { if (isObject(target)) { var keys = inheritedKeys(target); for (var i = 0, l = keys.length; i < l; ++i) { context[keys[i]] = clone(target[keys[i]]); } } }
[ "function", "attachProps", "(", "context", ",", "target", ")", "{", "if", "(", "isObject", "(", "target", ")", ")", "{", "var", "keys", "=", "inheritedKeys", "(", "target", ")", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "keys", ".", "...
Used to attach attributes to the error object in the constructor.
[ "Used", "to", "attach", "attributes", "to", "the", "error", "object", "in", "the", "constructor", "." ]
03e4a517a16a115cdf61d84168dac510c550a53c
https://github.com/tgriesser/create-error/blob/03e4a517a16a115cdf61d84168dac510c550a53c/create-error.js#L78-L85
train
neyric/aws-swf
lib/activity-task.js
function (result, cb) { var self = this; this.swfClient.respondActivityTaskCompleted({ result: stringify(result), taskToken: this.config.taskToken }, function (err) { if (self.onDone) { self.onDone(); } if (cb) { ...
javascript
function (result, cb) { var self = this; this.swfClient.respondActivityTaskCompleted({ result: stringify(result), taskToken: this.config.taskToken }, function (err) { if (self.onDone) { self.onDone(); } if (cb) { ...
[ "function", "(", "result", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "this", ".", "swfClient", ".", "respondActivityTaskCompleted", "(", "{", "result", ":", "stringify", "(", "result", ")", ",", "taskToken", ":", "this", ".", "config", ".", ...
Sends a "RespondActivityTaskCompleted" to AWS. @param {Mixed} result - Result of the activity (will get stringified in JSON if not a string) @param {Function} [cb] - callback
[ "Sends", "a", "RespondActivityTaskCompleted", "to", "AWS", "." ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L56-L71
train
neyric/aws-swf
lib/activity-task.js
function (reason, details, cb) { var self = this; var o = { "taskToken": this.config.taskToken }; if (reason) { o.reason = reason; } if (details) { o.details = stringify(details); } this.swfClient.respondActivityTaskFai...
javascript
function (reason, details, cb) { var self = this; var o = { "taskToken": this.config.taskToken }; if (reason) { o.reason = reason; } if (details) { o.details = stringify(details); } this.swfClient.respondActivityTaskFai...
[ "function", "(", "reason", ",", "details", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "var", "o", "=", "{", "\"taskToken\"", ":", "this", ".", "config", ".", "taskToken", "}", ";", "if", "(", "reason", ")", "{", "o", ".", "reason", "="...
Sends a "RespondActivityTaskFailed" to AWS. @param {String} reason @param {String} details @param {Function} [cb] - callback
[ "Sends", "a", "RespondActivityTaskFailed", "to", "AWS", "." ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L80-L102
train
neyric/aws-swf
lib/activity-task.js
function (heartbeat, cb) { var self = this; this.swfClient.recordActivityTaskHeartbeat({ taskToken: this.config.taskToken, details: stringify(heartbeat) }, function (err) { if (cb) { cb(err); } }); }
javascript
function (heartbeat, cb) { var self = this; this.swfClient.recordActivityTaskHeartbeat({ taskToken: this.config.taskToken, details: stringify(heartbeat) }, function (err) { if (cb) { cb(err); } }); }
[ "function", "(", "heartbeat", ",", "cb", ")", "{", "var", "self", "=", "this", ";", "this", ".", "swfClient", ".", "recordActivityTaskHeartbeat", "(", "{", "taskToken", ":", "this", ".", "config", ".", "taskToken", ",", "details", ":", "stringify", "(", ...
Sends a heartbeat to AWS. Needed for long run activity @param {Mixed} heartbeat - Details of the heartbeat (will get stringified in JSON if not a string) @param {Function} [cb] - callback
[ "Sends", "a", "heartbeat", "to", "AWS", ".", "Needed", "for", "long", "run", "activity" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/activity-task.js#L109-L120
train
quorrajs/Ouch
handler/PrettyPageHandler.js
PrettyPageHandler
function PrettyPageHandler(theme, pageTitle, editor, sendResponse, additionalScripts) { PrettyPageHandler.super_.call(this); /** * @var {String} * @protected */ this.__pageTitle = pageTitle || "Ouch! There was an error."; /** * @var {String} * @protected */ this.__th...
javascript
function PrettyPageHandler(theme, pageTitle, editor, sendResponse, additionalScripts) { PrettyPageHandler.super_.call(this); /** * @var {String} * @protected */ this.__pageTitle = pageTitle || "Ouch! There was an error."; /** * @var {String} * @protected */ this.__th...
[ "function", "PrettyPageHandler", "(", "theme", ",", "pageTitle", ",", "editor", ",", "sendResponse", ",", "additionalScripts", ")", "{", "PrettyPageHandler", ".", "super_", ".", "call", "(", "this", ")", ";", "/**\n * @var {String}\n * @protected\n */", "t...
Prettifies a javascript error stack. @param theme @param pageTitle @param editor @param sendResponse @param [additionalScripts] @class
[ "Prettifies", "a", "javascript", "error", "stack", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/PrettyPageHandler.js#L31-L90
train
quorrajs/Ouch
exception/frame.js
frame
function frame(frame) { frame.__comments = []; frame.__proto__ = { __proto__: frame.__proto__, /** * Returns the contents of the file for this frame as an * array of lines, and optionally as a clamped range of lines. * * NOTE: lines are 0-indexed * ...
javascript
function frame(frame) { frame.__comments = []; frame.__proto__ = { __proto__: frame.__proto__, /** * Returns the contents of the file for this frame as an * array of lines, and optionally as a clamped range of lines. * * NOTE: lines are 0-indexed * ...
[ "function", "frame", "(", "frame", ")", "{", "frame", ".", "__comments", "=", "[", "]", ";", "frame", ".", "__proto__", "=", "{", "__proto__", ":", "frame", ".", "__proto__", ",", "/**\n * Returns the contents of the file for this frame as an\n * array...
Adds additional prototypes to CallSite objects returned by stack-trace module. @param frame @returns frame
[ "Adds", "additional", "prototypes", "to", "CallSite", "objects", "returned", "by", "stack", "-", "trace", "module", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L18-L137
train
quorrajs/Ouch
exception/frame.js
function (start, length) { if (!start) { start = 0; } var contents = this.getFileContents(); if (null !== contents) { var lines = (contents).split("\n"); // Get a subset of lines from $start to $end if (leng...
javascript
function (start, length) { if (!start) { start = 0; } var contents = this.getFileContents(); if (null !== contents) { var lines = (contents).split("\n"); // Get a subset of lines from $start to $end if (leng...
[ "function", "(", "start", ",", "length", ")", "{", "if", "(", "!", "start", ")", "{", "start", "=", "0", ";", "}", "var", "contents", "=", "this", ".", "getFileContents", "(", ")", ";", "if", "(", "null", "!==", "contents", ")", "{", "var", "line...
Returns the contents of the file for this frame as an array of lines, and optionally as a clamped range of lines. NOTE: lines are 0-indexed @throws RangeError if length is less than or equal to 0 @param start @param length @returns {Array|undefined}
[ "Returns", "the", "contents", "of", "the", "file", "for", "this", "frame", "as", "an", "array", "of", "lines", "and", "optionally", "as", "a", "clamped", "range", "of", "lines", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L35-L62
train
quorrajs/Ouch
exception/frame.js
function () { var filePath = this.getFileName(); if (!this.__fileContentsCache && filePath) { // Leave the stage early when 'Unknown' is passed // this would otherwise raise an exception when // open_basedir is enabled. if (filePath...
javascript
function () { var filePath = this.getFileName(); if (!this.__fileContentsCache && filePath) { // Leave the stage early when 'Unknown' is passed // this would otherwise raise an exception when // open_basedir is enabled. if (filePath...
[ "function", "(", ")", "{", "var", "filePath", "=", "this", ".", "getFileName", "(", ")", ";", "if", "(", "!", "this", ".", "__fileContentsCache", "&&", "filePath", ")", "{", "// Leave the stage early when 'Unknown' is passed", "// this would otherwise raise an excepti...
Returns the full contents of the file for this frame, if it's known. @returns {*}
[ "Returns", "the", "full", "contents", "of", "the", "file", "for", "this", "frame", "if", "it", "s", "known", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L69-L95
train
quorrajs/Ouch
exception/frame.js
function (filter) { if (!filter) { filter = null; } var comments = this.__comments; if (filter !== null) { comments = comments.filter(function (c) { return c.context === filter; }); } ...
javascript
function (filter) { if (!filter) { filter = null; } var comments = this.__comments; if (filter !== null) { comments = comments.filter(function (c) { return c.context === filter; }); } ...
[ "function", "(", "filter", ")", "{", "if", "(", "!", "filter", ")", "{", "filter", "=", "null", ";", "}", "var", "comments", "=", "this", ".", "__comments", ";", "if", "(", "filter", "!==", "null", ")", "{", "comments", "=", "comments", ".", "filte...
Returns all comments for this frame. Optionally allows a filter to only retrieve comments from a specific context. @param {String} filter @returns {Array}
[ "Returns", "all", "comments", "for", "this", "frame", ".", "Optionally", "allows", "a", "filter", "to", "only", "retrieve", "comments", "from", "a", "specific", "context", "." ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/exception/frame.js#L120-L133
train
doggan/diablo-file-formats
lib/cel_decode.js
getPixelSetter
function getPixelSetter() { var offset = 0; return function(colors, c) { colors[offset] = c.r; colors[offset + 1] = c.g; colors[offset + 2] = c.b; colors[offset + 3] = c.a; offset += 4; }; }
javascript
function getPixelSetter() { var offset = 0; return function(colors, c) { colors[offset] = c.r; colors[offset + 1] = c.g; colors[offset + 2] = c.b; colors[offset + 3] = c.a; offset += 4; }; }
[ "function", "getPixelSetter", "(", ")", "{", "var", "offset", "=", "0", ";", "return", "function", "(", "colors", ",", "c", ")", "{", "colors", "[", "offset", "]", "=", "c", ".", "r", ";", "colors", "[", "offset", "+", "1", "]", "=", "c", ".", ...
Utility for setting pixels.
[ "Utility", "for", "setting", "pixels", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L9-L18
train
doggan/diablo-file-formats
lib/cel_decode.js
isType0
function isType0(celName, frameNum) { // These special frames are type 1. switch (celName) { case 'l1': switch (frameNum) { case 148: case 159: case 181: case 186: case 188: return false; } break; case 'l2': switch (frameNum) { case 47: case 13...
javascript
function isType0(celName, frameNum) { // These special frames are type 1. switch (celName) { case 'l1': switch (frameNum) { case 148: case 159: case 181: case 186: case 188: return false; } break; case 'l2': switch (frameNum) { case 47: case 13...
[ "function", "isType0", "(", "celName", ",", "frameNum", ")", "{", "// These special frames are type 1.", "switch", "(", "celName", ")", "{", "case", "'l1'", ":", "switch", "(", "frameNum", ")", "{", "case", "148", ":", "case", "159", ":", "case", "181", ":...
Returns true if the image is a plain 32x32.
[ "Returns", "true", "if", "the", "image", "is", "a", "plain", "32x32", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L23-L52
train
doggan/diablo-file-formats
lib/cel_decode.js
DecodeFrameType0
function DecodeFrameType0(frameData, width, height, palFile) { var colors = new Uint8Array(width * height * BYTES_PER_PIXEL); var setPixel = getPixelSetter(); for (var i = 0; i < frameData.length; i++) { setPixel(colors, palFile.colors[frameData[i]]); } return { width: width, ...
javascript
function DecodeFrameType0(frameData, width, height, palFile) { var colors = new Uint8Array(width * height * BYTES_PER_PIXEL); var setPixel = getPixelSetter(); for (var i = 0; i < frameData.length; i++) { setPixel(colors, palFile.colors[frameData[i]]); } return { width: width, ...
[ "function", "DecodeFrameType0", "(", "frameData", ",", "width", ",", "height", ",", "palFile", ")", "{", "var", "colors", "=", "new", "Uint8Array", "(", "width", "*", "height", "*", "BYTES_PER_PIXEL", ")", ";", "var", "setPixel", "=", "getPixelSetter", "(", ...
Type0 corresponds to plain 32x32 images with no transparency. 1) Range through the frame, one byte at the time. - Each byte corresponds to a color index of the palette. - Set one regular pixel per byte, using the color index to locate the color in the palette.
[ "Type0", "corresponds", "to", "plain", "32x32", "images", "with", "no", "transparency", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L90-L102
train
doggan/diablo-file-formats
lib/cel_decode.js
_getCelFrameDecoder
function _getCelFrameDecoder(celName, frameData, frameNum) { var frameSize = frameData.length; switch (celName) { case 'l1': case 'l2': case 'l3': case 'l4': case 'town': // Some regular (type 1) CEL images just happen to have a frame size of // exactly 0x220, 0x320 or 0x400. Therefore the isType...
javascript
function _getCelFrameDecoder(celName, frameData, frameNum) { var frameSize = frameData.length; switch (celName) { case 'l1': case 'l2': case 'l3': case 'l4': case 'town': // Some regular (type 1) CEL images just happen to have a frame size of // exactly 0x220, 0x320 or 0x400. Therefore the isType...
[ "function", "_getCelFrameDecoder", "(", "celName", ",", "frameData", ",", "frameNum", ")", "{", "var", "frameSize", "=", "frameData", ".", "length", ";", "switch", "(", "celName", ")", "{", "case", "'l1'", ":", "case", "'l2'", ":", "case", "'l3'", ":", "...
Gets the appropriate frame decoder for the particular frame.
[ "Gets", "the", "appropriate", "frame", "decoder", "for", "the", "particular", "frame", "." ]
1c468868361752b01a1164d6135939621e18dab5
https://github.com/doggan/diablo-file-formats/blob/1c468868361752b01a1164d6135939621e18dab5/lib/cel_decode.js#L546-L577
train
simoami/mimik
runner/Session.js
function(config) { var me = this; me.id = me.getId(); var Driver = DriverFactory.get(config.profile.driver); me.driver = new Driver({ session: me, options: config.options, profile: config.profile }); me.featureFile = config.featureFile; me.profile = config.profile; ...
javascript
function(config) { var me = this; me.id = me.getId(); var Driver = DriverFactory.get(config.profile.driver); me.driver = new Driver({ session: me, options: config.options, profile: config.profile }); me.featureFile = config.featureFile; me.profile = config.profile; ...
[ "function", "(", "config", ")", "{", "var", "me", "=", "this", ";", "me", ".", "id", "=", "me", ".", "getId", "(", ")", ";", "var", "Driver", "=", "DriverFactory", ".", "get", "(", "config", ".", "profile", ".", "driver", ")", ";", "me", ".", "...
Error.stackTraceLimit = Infinity;
[ "Error", ".", "stackTraceLimit", "=", "Infinity", ";" ]
464a4679bba671d43aea6660485d8db9fa767b1b
https://github.com/simoami/mimik/blob/464a4679bba671d43aea6660485d8db9fa767b1b/runner/Session.js#L16-L34
train
laxa1986/gulp-angular-embed-templates
index.js
transform
function transform(file, enc, cb) { // ignore empty files if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { throw new PluginError(PLUGIN_NAME, 'Streaming not supported. particular file: ' + file.path); } logger.deb...
javascript
function transform(file, enc, cb) { // ignore empty files if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { throw new PluginError(PLUGIN_NAME, 'Streaming not supported. particular file: ' + file.path); } logger.deb...
[ "function", "transform", "(", "file", ",", "enc", ",", "cb", ")", "{", "// ignore empty files", "if", "(", "file", ".", "isNull", "(", ")", ")", "{", "cb", "(", "null", ",", "file", ")", ";", "return", ";", "}", "if", "(", "file", ".", "isStream", ...
This function is 'through' callback, so it has predefined arguments @param {File} file file to analyse @param {String} enc encoding (unused) @param {Function} cb callback
[ "This", "function", "is", "through", "callback", "so", "it", "has", "predefined", "arguments" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/index.js#L62-L85
train
laxa1986/gulp-angular-embed-templates
lib/utils.js
recursiveCycle
function recursiveCycle(arr, onIteration, onEnd) { var i=0; function next() { if (i >= arr.length) { onEnd(); return; } var item = arr[i]; i++; onIteration(item, next, onEnd); } next(); }
javascript
function recursiveCycle(arr, onIteration, onEnd) { var i=0; function next() { if (i >= arr.length) { onEnd(); return; } var item = arr[i]; i++; onIteration(item, next, onEnd); } next(); }
[ "function", "recursiveCycle", "(", "arr", ",", "onIteration", ",", "onEnd", ")", "{", "var", "i", "=", "0", ";", "function", "next", "(", ")", "{", "if", "(", "i", ">=", "arr", ".", "length", ")", "{", "onEnd", "(", ")", ";", "return", ";", "}", ...
Helper function to walk recursively through arr @param arr @param onIteration @param onEnd
[ "Helper", "function", "to", "walk", "recursively", "through", "arr" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/lib/utils.js#L30-L42
train
laxa1986/gulp-angular-embed-templates
lib/utils.js
createLogger
function createLogger(logger) { var result = logger ? objectAssign({}, logger) : {}; if (!result.debug) result.debug = console.log; if (!result.info) result.info = console.info; if (!result.warn) result.warn = console.warn; if (!result.error) result.error = console.error; return result; }
javascript
function createLogger(logger) { var result = logger ? objectAssign({}, logger) : {}; if (!result.debug) result.debug = console.log; if (!result.info) result.info = console.info; if (!result.warn) result.warn = console.warn; if (!result.error) result.error = console.error; return result; }
[ "function", "createLogger", "(", "logger", ")", "{", "var", "result", "=", "logger", "?", "objectAssign", "(", "{", "}", ",", "logger", ")", ":", "{", "}", ";", "if", "(", "!", "result", ".", "debug", ")", "result", ".", "debug", "=", "console", "....
create a logger object based on passed logger. If passed logger has no some methods then add them @param {Object} [logger] object with methods .debug, .warn, .error. Can be @return {Object}
[ "create", "a", "logger", "object", "based", "on", "passed", "logger", ".", "If", "passed", "logger", "has", "no", "some", "methods", "then", "add", "them" ]
f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72
https://github.com/laxa1986/gulp-angular-embed-templates/blob/f82f03ba8a89d6a2df3aa4d59a5b9bc659258d72/lib/utils.js#L50-L57
train
burl/mock-env
index.js
delVars
function delVars(origEnv, deleteVars) { var i; if (!Array.isArray(deleteVars)) return; for (i = 0; i < deleteVars.length; i++) { if (!has(origEnv, deleteVars[i])) { origEnv[deleteVars[i]] = [ !!has(process.env, deleteVars[i]), process.env[deleteVars[i]] ]; } delete proc...
javascript
function delVars(origEnv, deleteVars) { var i; if (!Array.isArray(deleteVars)) return; for (i = 0; i < deleteVars.length; i++) { if (!has(origEnv, deleteVars[i])) { origEnv[deleteVars[i]] = [ !!has(process.env, deleteVars[i]), process.env[deleteVars[i]] ]; } delete proc...
[ "function", "delVars", "(", "origEnv", ",", "deleteVars", ")", "{", "var", "i", ";", "if", "(", "!", "Array", ".", "isArray", "(", "deleteVars", ")", ")", "return", ";", "for", "(", "i", "=", "0", ";", "i", "<", "deleteVars", ".", "length", ";", ...
remove vars from env @arg {Object} origEnv - place to save state of original env @arg {Array} deleteVars - names of env vars to remove from env @function
[ "remove", "vars", "from", "env" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L43-L57
train
burl/mock-env
index.js
restoreEnv
function restoreEnv(origEnv) { var key; for (key in origEnv) { if (origEnv[key][0]) { process.env[key] = origEnv[key][1]; } else { delete process.env[key]; } } return; }
javascript
function restoreEnv(origEnv) { var key; for (key in origEnv) { if (origEnv[key][0]) { process.env[key] = origEnv[key][1]; } else { delete process.env[key]; } } return; }
[ "function", "restoreEnv", "(", "origEnv", ")", "{", "var", "key", ";", "for", "(", "key", "in", "origEnv", ")", "{", "if", "(", "origEnv", "[", "key", "]", "[", "0", "]", ")", "{", "process", ".", "env", "[", "key", "]", "=", "origEnv", "[", "k...
restore environment to original state @arg {Object} origEnv - delta/state of process.env from prior morphing @function
[ "restore", "environment", "to", "original", "state" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L64-L74
train
burl/mock-env
index.js
callbackInModifiedEnv
function callbackInModifiedEnv(callback, setInEnv, removeFromEnv) { var origEnv = {}; var result; setVars(origEnv, setInEnv); delVars(origEnv, removeFromEnv); result = callback(); restoreEnv(origEnv); return result; }
javascript
function callbackInModifiedEnv(callback, setInEnv, removeFromEnv) { var origEnv = {}; var result; setVars(origEnv, setInEnv); delVars(origEnv, removeFromEnv); result = callback(); restoreEnv(origEnv); return result; }
[ "function", "callbackInModifiedEnv", "(", "callback", ",", "setInEnv", ",", "removeFromEnv", ")", "{", "var", "origEnv", "=", "{", "}", ";", "var", "result", ";", "setVars", "(", "origEnv", ",", "setInEnv", ")", ";", "delVars", "(", "origEnv", ",", "remove...
calls callback within context of modified environment @callback callback - function to be called while environment is modified @arg {Object} setInEnv - vars to set in current env @arg {Array} removeFromEnv - array of variable names to remove from env @function
[ "calls", "callback", "within", "context", "of", "modified", "environment" ]
90a2b585c957a08007c3f8e23a257aa416e8e6e1
https://github.com/burl/mock-env/blob/90a2b585c957a08007c3f8e23a257aa416e8e6e1/index.js#L83-L91
train
quorrajs/Ouch
handler/CallbackHandler.js
CallbackHandler
function CallbackHandler(callable) { CallbackHandler.super_.call(this); if (!_.isFunction(callable)) { throw new TypeError( 'Argument must be valid callable' ); } this.__callable = callable; }
javascript
function CallbackHandler(callable) { CallbackHandler.super_.call(this); if (!_.isFunction(callable)) { throw new TypeError( 'Argument must be valid callable' ); } this.__callable = callable; }
[ "function", "CallbackHandler", "(", "callable", ")", "{", "CallbackHandler", ".", "super_", ".", "call", "(", "this", ")", ";", "if", "(", "!", "_", ".", "isFunction", "(", "callable", ")", ")", "{", "throw", "new", "TypeError", "(", "'Argument must be va...
Wrapper for Closures passed as handlers. Can be used directly, or will be instantiated automagically by Ouch if passed to ouchInstance.pushHandler @param {function} callable @constructor @throws TypeError if argument is not callable
[ "Wrapper", "for", "Closures", "passed", "as", "handlers", ".", "Can", "be", "used", "directly", "or", "will", "be", "instantiated", "automagically", "by", "Ouch", "if", "passed", "to", "ouchInstance", ".", "pushHandler" ]
cbadf54eaa78633761e295c8566a36bb1567d130
https://github.com/quorrajs/Ouch/blob/cbadf54eaa78633761e295c8566a36bb1567d130/handler/CallbackHandler.js#L22-L32
train
Planeshifter/node-wordnet-magic
lib/rules_of_detachment.js
rulesOfDetachment
function rulesOfDetachment( word, pos, substitutions, dictionary ) { var newEnding; var recResult; var newWord; var result = []; var suffix; var elem; var i; for ( i = 0; i < dictionary.length; i++ ) { elem = dictionary[ i ]; if ( elem.lemma === word ) { if ( elem.pos === pos ) { var obj = new this...
javascript
function rulesOfDetachment( word, pos, substitutions, dictionary ) { var newEnding; var recResult; var newWord; var result = []; var suffix; var elem; var i; for ( i = 0; i < dictionary.length; i++ ) { elem = dictionary[ i ]; if ( elem.lemma === word ) { if ( elem.pos === pos ) { var obj = new this...
[ "function", "rulesOfDetachment", "(", "word", ",", "pos", ",", "substitutions", ",", "dictionary", ")", "{", "var", "newEnding", ";", "var", "recResult", ";", "var", "newWord", ";", "var", "result", "=", "[", "]", ";", "var", "suffix", ";", "var", "elem"...
Apply rules of detachment to obtain base forms for supplied word. @param {string} word - input word @param {string} pos - part of speech @param {Array} substitutions - Morphy substitutions @param {Array} dictionary - WordNet dictionary @returns {Array} base forms
[ "Apply", "rules", "of", "detachment", "to", "obtain", "base", "forms", "for", "supplied", "word", "." ]
a7c6000bd63c79562ebb1e9a85820809a9a17058
https://github.com/Planeshifter/node-wordnet-magic/blob/a7c6000bd63c79562ebb1e9a85820809a9a17058/lib/rules_of_detachment.js#L13-L55
train
pavben/WebIRC
static/js/statechanges.js
function(element, sortedList, sortFunction) { var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo <= hi) { mid = lo + Math.floor((hi - lo) / 2); result = sortFunction(element, sortedList[mid]); if (result < 0) { // mid is too high hi = mid - 1; } else if (resu...
javascript
function(element, sortedList, sortFunction) { var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo <= hi) { mid = lo + Math.floor((hi - lo) / 2); result = sortFunction(element, sortedList[mid]); if (result < 0) { // mid is too high hi = mid - 1; } else if (resu...
[ "function", "(", "element", ",", "sortedList", ",", "sortFunction", ")", "{", "var", "lo", "=", "0", ";", "var", "hi", "=", "sortedList", ".", "length", "-", "1", ";", "var", "mid", ",", "result", ";", "while", "(", "lo", "<=", "hi", ")", "{", "m...
returns the index of the element if found, or null otherwise
[ "returns", "the", "index", "of", "the", "element", "if", "found", "or", "null", "otherwise" ]
518e311f87a6190c620e9b405855b8557b672bd6
https://github.com/pavben/WebIRC/blob/518e311f87a6190c620e9b405855b8557b672bd6/static/js/statechanges.js#L565-L588
train
pavben/WebIRC
static/js/statechanges.js
function(element, sortedList, sortFunction) { // p(index) = val at index is same or larger than element function p(index) { return (sortFunction(element, sortedList[index]) <= 0); } var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo < hi) { mid = lo + Math.floor((hi - ...
javascript
function(element, sortedList, sortFunction) { // p(index) = val at index is same or larger than element function p(index) { return (sortFunction(element, sortedList[index]) <= 0); } var lo = 0; var hi = sortedList.length - 1; var mid, result; while (lo < hi) { mid = lo + Math.floor((hi - ...
[ "function", "(", "element", ",", "sortedList", ",", "sortFunction", ")", "{", "// p(index) = val at index is same or larger than element", "function", "p", "(", "index", ")", "{", "return", "(", "sortFunction", "(", "element", ",", "sortedList", "[", "index", "]", ...
returns the index at which the element should be inserted
[ "returns", "the", "index", "at", "which", "the", "element", "should", "be", "inserted" ]
518e311f87a6190c620e9b405855b8557b672bd6
https://github.com/pavben/WebIRC/blob/518e311f87a6190c620e9b405855b8557b672bd6/static/js/statechanges.js#L590-L620
train
Alhadis/Print
print.js
print
function print(input, opts = {}, /* …Internal:*/ name = "", refs = null){ // Handle options and defaults let { ampedSymbols, escapeChars, invokeGetters, maxArrayLength, showAll, showArrayIndices, showArrayLength, sortProps, } = opts; ampedSymbols = undefined === ampedSymbols ? true : ampedSy...
javascript
function print(input, opts = {}, /* …Internal:*/ name = "", refs = null){ // Handle options and defaults let { ampedSymbols, escapeChars, invokeGetters, maxArrayLength, showAll, showArrayIndices, showArrayLength, sortProps, } = opts; ampedSymbols = undefined === ampedSymbols ? true : ampedSy...
[ "function", "print", "(", "input", ",", "opts", "=", "{", "}", ",", "/* …Internal:*/ n", "me =", "\"", ", ", "r", "fs =", "n", "ll){", "", "", "// Handle options and defaults", "let", "{", "ampedSymbols", ",", "escapeChars", ",", "invokeGetters", ",", "maxAr...
Generate a human-readable representation of a value. @param {Mixed} input - Value to print @param {Object} opts - Optional parameters @param {Boolean} opts.ampedSymbols - Prefix Symbol-keyed properties with @@ @param {Mixed} opts.escapeChars - Which characters to escape i...
[ "Generate", "a", "human", "-", "readable", "representation", "of", "a", "value", "." ]
c289a04a25669370e7038ce3db8bc343d5e87347
https://github.com/Alhadis/Print/blob/c289a04a25669370e7038ce3db8bc343d5e87347/print.js#L18-L437
train
neyric/aws-swf
lib/event-list.js
function (scheduledEventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === scheduledEventId) { return evt.activityTaskScheduledEventAttributes.activityId; } } return false; }
javascript
function (scheduledEventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === scheduledEventId) { return evt.activityTaskScheduledEventAttributes.activityId; } } return false; }
[ "function", "(", "scheduledEventId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(...
Return the activityId given the scheduledEventId @param {String} scheduledEventId @returns {String} activityId - The activityId if found, false otherwise
[ "Return", "the", "activityId", "given", "the", "scheduledEventId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L19-L28
train
neyric/aws-swf
lib/event-list.js
function (eventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === eventId) { return evt; } } return false; }
javascript
function (eventId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventId === eventId) { return evt; } } return false; }
[ "function", "(", "eventId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt...
Return the activityId @param {Integer} eventId @returns {Object} evt - The event if found, false otherwise
[ "Return", "the", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L35-L44
train
neyric/aws-swf
lib/event-list.js
function(eventType, attributeKey, attributeValue) { var attrsKey = this._event_attributes_key(eventType); for(var i = 0; i < this._events.length ; i++) { var evt = this._events[i]; if ( (evt.eventType === eventType) && (evt[attrsKey][attributeKey] === attributeValue) ) { return evt; } ...
javascript
function(eventType, attributeKey, attributeValue) { var attrsKey = this._event_attributes_key(eventType); for(var i = 0; i < this._events.length ; i++) { var evt = this._events[i]; if ( (evt.eventType === eventType) && (evt[attrsKey][attributeKey] === attributeValue) ) { return evt; } ...
[ "function", "(", "eventType", ",", "attributeKey", ",", "attributeValue", ")", "{", "var", "attrsKey", "=", "this", ".", "_event_attributes_key", "(", "eventType", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", ...
Return the Event for the given type that has the given attribute value @param {String} eventType @param {String} attributeKey @param {String} attributeValue @returns {Object} evt - The event if found, null otherwise
[ "Return", "the", "Event", "for", "the", "given", "type", "that", "has", "the", "given", "attribute", "value" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L63-L72
train
neyric/aws-swf
lib/event-list.js
function(eventType, activityId) { var attrsKey = this._event_attributes_key(eventType); return this._events.some(function (evt) { if (evt.eventType === eventType) { if (this.activityIdFor(evt[attrsKey].scheduledEventId) === activityId) { return true; } ...
javascript
function(eventType, activityId) { var attrsKey = this._event_attributes_key(eventType); return this._events.some(function (evt) { if (evt.eventType === eventType) { if (this.activityIdFor(evt[attrsKey].scheduledEventId) === activityId) { return true; } ...
[ "function", "(", "eventType", ",", "activityId", ")", "{", "var", "attrsKey", "=", "this", ".", "_event_attributes_key", "(", "eventType", ")", ";", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ...
Search for an event with the corresponding type that matches the scheduled activityId @param {String} eventType @param {String} activityId @returns {Boolean}
[ "Search", "for", "an", "event", "with", "the", "corresponding", "type", "that", "matches", "the", "scheduled", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L102-L111
train
neyric/aws-swf
lib/event-list.js
function(control) { return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionInitiated") { if (evt.startChildWorkflowExecutionInitiatedEventAttributes.control === control) { return true; } } }); }
javascript
function(control) { return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionInitiated") { if (evt.startChildWorkflowExecutionInitiatedEventAttributes.control === control) { return true; } } }); }
[ "function", "(", "control", ")", "{", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"StartChildWorkflowExecutionInitiated\"", ")", "{", "if", "(", "evt", ".", "startChildW...
lookup for StartChildWorkflowExecutionInitiated @param {String} control @returns {Boolean}
[ "lookup", "for", "StartChildWorkflowExecutionInitiated" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L156-L164
train
neyric/aws-swf
lib/event-list.js
function(control) { return this._events.some(function (evt) { if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedEvent = this.eventById(initiatedEventId); ...
javascript
function(control) { return this._events.some(function (evt) { if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedEvent = this.eventById(initiatedEventId); ...
[ "function", "(", "control", ")", "{", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"ChildWorkflowExecutionCompleted\"", ")", "{", "var", "initiatedEventId", "=", "evt", "...
Return true if the child workflow is completed @param {String} control @returns {Boolean}
[ "Return", "true", "if", "the", "child", "workflow", "is", "completed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L171-L182
train
neyric/aws-swf
lib/event-list.js
function(control) { var initiatedEventId, initiatedEvent; return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionFailed") { initiatedEventId = evt.startChildWorkflowExecutionFailedEventAttributes.initiatedEventId; initiatedEvent = this.ev...
javascript
function(control) { var initiatedEventId, initiatedEvent; return this._events.some(function (evt) { if (evt.eventType === "StartChildWorkflowExecutionFailed") { initiatedEventId = evt.startChildWorkflowExecutionFailedEventAttributes.initiatedEventId; initiatedEvent = this.ev...
[ "function", "(", "control", ")", "{", "var", "initiatedEventId", ",", "initiatedEvent", ";", "return", "this", ".", "_events", ".", "some", "(", "function", "(", "evt", ")", "{", "if", "(", "evt", ".", "eventType", "===", "\"StartChildWorkflowExecutionFailed\"...
Return true if the child workflow has failed @param {String} control @returns {Boolean}
[ "Return", "true", "if", "the", "child", "workflow", "has", "failed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L189-L206
train
neyric/aws-swf
lib/event-list.js
function (signalName) { var evt = this._event_find('WorkflowExecutionSignaled', 'signalName', signalName); if(!evt) { return null; } var signalInput = evt.workflowExecutionSignaledEventAttributes.input; try { var d = JSON.parse(signalInput); return d; } catc...
javascript
function (signalName) { var evt = this._event_find('WorkflowExecutionSignaled', 'signalName', signalName); if(!evt) { return null; } var signalInput = evt.workflowExecutionSignaledEventAttributes.input; try { var d = JSON.parse(signalInput); return d; } catc...
[ "function", "(", "signalName", ")", "{", "var", "evt", "=", "this", ".", "_event_find", "(", "'WorkflowExecutionSignaled'", ",", "'signalName'", ",", "signalName", ")", ";", "if", "(", "!", "evt", ")", "{", "return", "null", ";", "}", "var", "signalInput",...
Returns the signal input or null if the signal is not found or doesn't have JSON input @param {String} signalName @returns {Mixed}
[ "Returns", "the", "signal", "input", "or", "null", "if", "the", "signal", "is", "not", "found", "or", "doesn", "t", "have", "JSON", "input" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L278-L292
train
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_activity_scheduled(arguments[i])) { return false; } } return true; }
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_activity_scheduled(arguments[i])) { return false; } } return true; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "is_activity_scheduled", "(", "arguments", "[", "i", "]", ")", ")", "{", ...
Return true if the arguments are all scheduled @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "the", "arguments", "are", "all", "scheduled" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L328-L336
train
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_lambda_scheduled(arguments[i])) { return false; } } return true; }
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if (!this.is_lambda_scheduled(arguments[i])) { return false; } } return true; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "is_lambda_scheduled", "(", "arguments", "[", "i", "]", ")", ")", "{", "r...
Return true if the arguments are all scheduled lambda functions @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "the", "arguments", "are", "all", "scheduled", "lambda", "functions" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L343-L351
train
neyric/aws-swf
lib/event-list.js
function () { var i; for (i = 0; i < arguments.length; i++) { if ( ! (this.has_activity_completed(arguments[i]) || this.has_lambda_completed(arguments[i]) || this.childworkflow_completed(arguments[i]) || this.timer_fired(arguments[i]) ) ) { return false; } } return...
javascript
function () { var i; for (i = 0; i < arguments.length; i++) { if ( ! (this.has_activity_completed(arguments[i]) || this.has_lambda_completed(arguments[i]) || this.childworkflow_completed(arguments[i]) || this.timer_fired(arguments[i]) ) ) { return false; } } return...
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "(", "this", ".", "has_activity_completed", "(", "arguments", "[", "i", "]", ")", "||", ...
Return true if all the arguments are completed @param {String} [...] @returns {Boolean}
[ "Return", "true", "if", "all", "the", "arguments", "are", "completed" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L424-L432
train
neyric/aws-swf
lib/event-list.js
function () { var wfInput = this._events[0].workflowExecutionStartedEventAttributes.input; try { var d = JSON.parse(wfInput); return d; } catch (ex) { return wfInput; } }
javascript
function () { var wfInput = this._events[0].workflowExecutionStartedEventAttributes.input; try { var d = JSON.parse(wfInput); return d; } catch (ex) { return wfInput; } }
[ "function", "(", ")", "{", "var", "wfInput", "=", "this", ".", "_events", "[", "0", "]", ".", "workflowExecutionStartedEventAttributes", ".", "input", ";", "try", "{", "var", "d", "=", "JSON", ".", "parse", "(", "wfInput", ")", ";", "return", "d", ";",...
Get the input parameters of the workflow @returns {Mixed}
[ "Get", "the", "input", "parameters", "of", "the", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L438-L448
train
neyric/aws-swf
lib/event-list.js
function (activityId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ActivityTaskCompleted") { if (this.activityIdFor(evt.activityTaskCompletedEventAttributes.scheduledEventId) === activityId) { var result...
javascript
function (activityId) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ActivityTaskCompleted") { if (this.activityIdFor(evt.activityTaskCompletedEventAttributes.scheduledEventId) === activityId) { var result...
[ "function", "(", "activityId", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "...
Get the results for the given activityId @param {String} activityId @returns {Mixed}
[ "Get", "the", "results", "for", "the", "given", "activityId" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L456-L478
train
neyric/aws-swf
lib/event-list.js
function(control) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedE...
javascript
function(control) { var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "ChildWorkflowExecutionCompleted") { var initiatedEventId = evt.childWorkflowExecutionCompletedEventAttributes.initiatedEventId; var initiatedE...
[ "function", "(", "control", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt...
Get the results of a completed child workflow @param {String} control @returns {Mixed}
[ "Get", "the", "results", "of", "a", "completed", "child", "workflow" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L486-L512
train
neyric/aws-swf
lib/event-list.js
function (markerName) { var i, finalDetail; var lastEventId = 0; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if ((evt.eventType === 'MarkerRecorded') && (evt.markerRecordedEventAttributes.markerName === markerName) && (parseInt(evt.eventId, 10) > lastEvent...
javascript
function (markerName) { var i, finalDetail; var lastEventId = 0; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if ((evt.eventType === 'MarkerRecorded') && (evt.markerRecordedEventAttributes.markerName === markerName) && (parseInt(evt.eventId, 10) > lastEvent...
[ "function", "(", "markerName", ")", "{", "var", "i", ",", "finalDetail", ";", "var", "lastEventId", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "th...
Get the details of the last marker with the given name @param {String} markerName @returns {Mixed}
[ "Get", "the", "details", "of", "the", "last", "marker", "with", "the", "given", "name" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L519-L531
train
neyric/aws-swf
lib/event-list.js
function(){ var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "WorkflowExecutionCancelRequested") { return true; } } return false; }
javascript
function(){ var i; for (i = 0; i < this._events.length; i++) { var evt = this._events[i]; if (evt.eventType === "WorkflowExecutionCancelRequested") { return true; } } return false; }
[ "function", "(", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "_events", ".", "length", ";", "i", "++", ")", "{", "var", "evt", "=", "this", ".", "_events", "[", "i", "]", ";", "if", "(", "evt", ".", "...
Return true if cancel request has arrived @returns {boolean}
[ "Return", "true", "if", "cancel", "request", "has", "arrived" ]
31b96c9eef313199465b40204a92909996a85c3d
https://github.com/neyric/aws-swf/blob/31b96c9eef313199465b40204a92909996a85c3d/lib/event-list.js#L545-L555
train
langholz/dtw
lib/dtw.js
function (options) { var state = { distanceCostMatrix: null }; if (typeof options === 'undefined') { state.distance = require('./distanceFunctions/squaredEuclidean').distance; } else { validateOptions(options); if (typeof options.distanceMetric === 'string') { state.dista...
javascript
function (options) { var state = { distanceCostMatrix: null }; if (typeof options === 'undefined') { state.distance = require('./distanceFunctions/squaredEuclidean').distance; } else { validateOptions(options); if (typeof options.distanceMetric === 'string') { state.dista...
[ "function", "(", "options", ")", "{", "var", "state", "=", "{", "distanceCostMatrix", ":", "null", "}", ";", "if", "(", "typeof", "options", "===", "'undefined'", ")", "{", "state", ".", "distance", "=", "require", "(", "'./distanceFunctions/squaredEuclidean'"...
Create a DTW object @class DTW Initializes a new instance of the `DTW`. If no options are provided the squared euclidean distance function is used. @function DTW @param {DTWOptions} [options] The options to initialize the dynamic time warping instance with. Computes the optimal match between two provided sequences....
[ "Create", "a", "DTW", "object" ]
fe0f3fdfa6dbbcfb0714056a744a9b9f633e74be
https://github.com/langholz/dtw/blob/fe0f3fdfa6dbbcfb0714056a744a9b9f633e74be/lib/dtw.js#L72-L106
train
lautr3k/lw.raster-to-gcode
dist/webworker_example/index.js
loadFile
function loadFile(file) { console.log('loadFile:', file); // <file> can be Image, File URL object or URL string (http://* or data:image/*) rasterToGcode.load(file).then(function(rtg) { console.log('rasterToGcode:', rtg); }) .catch(function(error) { console.error('error:', error); ...
javascript
function loadFile(file) { console.log('loadFile:', file); // <file> can be Image, File URL object or URL string (http://* or data:image/*) rasterToGcode.load(file).then(function(rtg) { console.log('rasterToGcode:', rtg); }) .catch(function(error) { console.error('error:', error); ...
[ "function", "loadFile", "(", "file", ")", "{", "console", ".", "log", "(", "'loadFile:'", ",", "file", ")", ";", "// <file> can be Image, File URL object or URL string (http://* or data:image/*)", "rasterToGcode", ".", "load", "(", "file", ")", ".", "then", "(", "fu...
Load the input file
[ "Load", "the", "input", "file" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/webworker_example/index.js#L39-L49
train
lautr3k/lw.raster-to-gcode
dist/webworker_example/index.js
createWorker
function createWorker() { var worker = new Worker('worker.js'); // On worker messsage worker.onmessage = function(event) { if (event.data.event === 'done') { console.log('done:', event.data.data); $('#start').show(); $('#abort').hide(); } else if ...
javascript
function createWorker() { var worker = new Worker('worker.js'); // On worker messsage worker.onmessage = function(event) { if (event.data.event === 'done') { console.log('done:', event.data.data); $('#start').show(); $('#abort').hide(); } else if ...
[ "function", "createWorker", "(", ")", "{", "var", "worker", "=", "new", "Worker", "(", "'worker.js'", ")", ";", "// On worker messsage", "worker", ".", "onmessage", "=", "function", "(", "event", ")", "{", "if", "(", "event", ".", "data", ".", "event", "...
Create and return the Worker object
[ "Create", "and", "return", "the", "Worker", "object" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/webworker_example/index.js#L52-L68
train
lautr3k/lw.raster-to-gcode
dist/example/index.js
toHeightMap
function toHeightMap() { if (rasterToGcode.running) { return rasterToGcode.abort(); } console.log('toHeightMap:', file.name); $toHeightMap.text('Abort').addClass('btn-danger'); $progressBar.removeClass('progress-bar-danger'); $progressBar.parent().show(); rasterToGcode.getHeightMap(...
javascript
function toHeightMap() { if (rasterToGcode.running) { return rasterToGcode.abort(); } console.log('toHeightMap:', file.name); $toHeightMap.text('Abort').addClass('btn-danger'); $progressBar.removeClass('progress-bar-danger'); $progressBar.parent().show(); rasterToGcode.getHeightMap(...
[ "function", "toHeightMap", "(", ")", "{", "if", "(", "rasterToGcode", ".", "running", ")", "{", "return", "rasterToGcode", ".", "abort", "(", ")", ";", "}", "console", ".", "log", "(", "'toHeightMap:'", ",", "file", ".", "name", ")", ";", "$toHeightMap",...
To height-map
[ "To", "height", "-", "map" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/example/index.js#L194-L204
train
lautr3k/lw.raster-to-gcode
dist/example/index.js
downloadHeightMap
function downloadHeightMap() { console.log('downloadHeightMap:', file.name); var heightMapFile = new Blob([heightMap], { type: 'text/plain;charset=utf-8' }); saveAs(heightMapFile, file.name + '.height-map.txt'); }
javascript
function downloadHeightMap() { console.log('downloadHeightMap:', file.name); var heightMapFile = new Blob([heightMap], { type: 'text/plain;charset=utf-8' }); saveAs(heightMapFile, file.name + '.height-map.txt'); }
[ "function", "downloadHeightMap", "(", ")", "{", "console", ".", "log", "(", "'downloadHeightMap:'", ",", "file", ".", "name", ")", ";", "var", "heightMapFile", "=", "new", "Blob", "(", "[", "heightMap", "]", ",", "{", "type", ":", "'text/plain;charset=utf-8'...
Download height-map
[ "Download", "height", "-", "map" ]
f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e
https://github.com/lautr3k/lw.raster-to-gcode/blob/f1f8f4d992b6f9450904ed560bc6d4ea1462fe2e/dist/example/index.js#L207-L211
train
strophe/strophejs-plugin-pubsub
src/strophe.pubsub.js
function(conn) { this._connection = conn; /* Function used to setup plugin. */ /* extend name space * NS.PUBSUB - XMPP Publish Subscribe namespace * from XEP 60. * * NS.PUBSUB_SUBSCRIBE_OPTIONS - XMPP pubsub * ...
javascript
function(conn) { this._connection = conn; /* Function used to setup plugin. */ /* extend name space * NS.PUBSUB - XMPP Publish Subscribe namespace * from XEP 60. * * NS.PUBSUB_SUBSCRIBE_OPTIONS - XMPP pubsub * ...
[ "function", "(", "conn", ")", "{", "this", ".", "_connection", "=", "conn", ";", "/*\n Function used to setup plugin.\n */", "/* extend name space\n * NS.PUBSUB - XMPP Publish Subscribe namespace\n * from XEP 60.\n *\n * NS.PUBSUB_SUBS...
The plugin must have the init function.
[ "The", "plugin", "must", "have", "the", "init", "function", "." ]
fc12f60570bdd2b73cc87077a884a102bc32f3be
https://github.com/strophe/strophejs-plugin-pubsub/blob/fc12f60570bdd2b73cc87077a884a102bc32f3be/src/strophe.pubsub.js#L98-L140
train
strophe/strophejs-plugin-pubsub
src/strophe.pubsub.js
function (status, condition) { var that = this._connection; if (this._autoService && status === Strophe.Status.CONNECTED) { this.service = 'pubsub.'+Strophe.getDomainFromJid(that.jid); this.jid = that.jid; } }
javascript
function (status, condition) { var that = this._connection; if (this._autoService && status === Strophe.Status.CONNECTED) { this.service = 'pubsub.'+Strophe.getDomainFromJid(that.jid); this.jid = that.jid; } }
[ "function", "(", "status", ",", "condition", ")", "{", "var", "that", "=", "this", ".", "_connection", ";", "if", "(", "this", ".", "_autoService", "&&", "status", "===", "Strophe", ".", "Status", ".", "CONNECTED", ")", "{", "this", ".", "service", "="...
Called by Strophe on connection event
[ "Called", "by", "Strophe", "on", "connection", "event" ]
fc12f60570bdd2b73cc87077a884a102bc32f3be
https://github.com/strophe/strophejs-plugin-pubsub/blob/fc12f60570bdd2b73cc87077a884a102bc32f3be/src/strophe.pubsub.js#L143-L149
train
ucscXena/static-interval-tree
js/index.js
toTree
function toTree(arr, low, high) { if (low >= high) { return undefined; } var mid = Math.floor((high + low) / 2); return { el: arr[mid], right: toTree(arr, mid + 1, high), left: toTree(arr, low, mid) }; }
javascript
function toTree(arr, low, high) { if (low >= high) { return undefined; } var mid = Math.floor((high + low) / 2); return { el: arr[mid], right: toTree(arr, mid + 1, high), left: toTree(arr, low, mid) }; }
[ "function", "toTree", "(", "arr", ",", "low", ",", "high", ")", "{", "if", "(", "low", ">=", "high", ")", "{", "return", "undefined", ";", "}", "var", "mid", "=", "Math", ".", "floor", "(", "(", "high", "+", "low", ")", "/", "2", ")", ";", "r...
Build a balanced binary tree from an ordered array.
[ "Build", "a", "balanced", "binary", "tree", "from", "an", "ordered", "array", "." ]
5cbe1e5b35a8b9fa27f1530a820def21d3ca037b
https://github.com/ucscXena/static-interval-tree/blob/5cbe1e5b35a8b9fa27f1530a820def21d3ca037b/js/index.js#L12-L22
train
ucscXena/static-interval-tree
js/index.js
findEnd
function findEnd(node) { if (!node) { return undefined; } var {left, right, el} = node; findEnd(left); findEnd(right); node.high = Math.max(getHigh(left), getHigh(right), el.end); return node; }
javascript
function findEnd(node) { if (!node) { return undefined; } var {left, right, el} = node; findEnd(left); findEnd(right); node.high = Math.max(getHigh(left), getHigh(right), el.end); return node; }
[ "function", "findEnd", "(", "node", ")", "{", "if", "(", "!", "node", ")", "{", "return", "undefined", ";", "}", "var", "{", "left", ",", "right", ",", "el", "}", "=", "node", ";", "findEnd", "(", "left", ")", ";", "findEnd", "(", "right", ")", ...
Find the highest end value of each node. Mutates its input.
[ "Find", "the", "highest", "end", "value", "of", "each", "node", ".", "Mutates", "its", "input", "." ]
5cbe1e5b35a8b9fa27f1530a820def21d3ca037b
https://github.com/ucscXena/static-interval-tree/blob/5cbe1e5b35a8b9fa27f1530a820def21d3ca037b/js/index.js#L27-L36
train
groupon/assertive
src/assertive.js
getNameOfType
function getNameOfType(x) { switch (false) { case !(x == null): return `${x}`; // null / undefined case !is.String(x): return x; case !is.Function(x): return x.name; case !is.NaN(x): return 'NaN'; default: return x; } }
javascript
function getNameOfType(x) { switch (false) { case !(x == null): return `${x}`; // null / undefined case !is.String(x): return x; case !is.Function(x): return x.name; case !is.NaN(x): return 'NaN'; default: return x; } }
[ "function", "getNameOfType", "(", "x", ")", "{", "switch", "(", "false", ")", "{", "case", "!", "(", "x", "==", "null", ")", ":", "return", "`", "${", "x", "}", "`", ";", "// null / undefined", "case", "!", "is", ".", "String", "(", "x", ")", ":"...
translates any argument we were meant to interpret as a type, into its name
[ "translates", "any", "argument", "we", "were", "meant", "to", "interpret", "as", "a", "type", "into", "its", "name" ]
4118ffca647260914494183d9ebbc5bde735a574
https://github.com/groupon/assertive/blob/4118ffca647260914494183d9ebbc5bde735a574/src/assertive.js#L223-L236
train
simonepri/phc-argon2
index.js
hash
function hash(password, options) { options = options || {}; let variant = options.variant || defaults.variant; const iterations = options.iterations || defaults.iterations; const memory = options.memory || defaults.memory; const parallelism = options.parallelism || defaults.parallelism; const saltSize = opt...
javascript
function hash(password, options) { options = options || {}; let variant = options.variant || defaults.variant; const iterations = options.iterations || defaults.iterations; const memory = options.memory || defaults.memory; const parallelism = options.parallelism || defaults.parallelism; const saltSize = opt...
[ "function", "hash", "(", "password", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "let", "variant", "=", "options", ".", "variant", "||", "defaults", ".", "variant", ";", "const", "iterations", "=", "options", ".", "iteration...
Computes the hash string of the given password in the PHC format using argon2 package. @public @param {string} password The password to hash. @param {Object} [options] Optional configurations related to the hashing function. @param {number} [options.variant=id] Optinal variant of argon2 to use. Can be one of [`'d'`,...
[ "Computes", "the", "hash", "string", "of", "the", "given", "password", "in", "the", "PHC", "format", "using", "argon2", "package", "." ]
900c5aea9185b69a677ce27ce06aa8a9526222fd
https://github.com/simonepri/phc-argon2/blob/900c5aea9185b69a677ce27ce06aa8a9526222fd/index.js#L81-L182
train
posthtml/posthtml-postcss-modules
index.js
processContentWithPostCSS
function processContentWithPostCSS(options, href) { /** * @param {String} content [css to process] * @return {Object} [object with css tokens and css itself] */ return function (content) { if (options.generateScopedName) { options.generateScopedName = typeof options.generateScopedName === 'functio...
javascript
function processContentWithPostCSS(options, href) { /** * @param {String} content [css to process] * @return {Object} [object with css tokens and css itself] */ return function (content) { if (options.generateScopedName) { options.generateScopedName = typeof options.generateScopedName === 'functio...
[ "function", "processContentWithPostCSS", "(", "options", ",", "href", ")", "{", "/**\n\t * @param {String} content [css to process]\n\t * @return {Object} [object with css tokens and css itself]\n\t */", "return", "function", "(", "content", ")", "{", "if", "(", "options",...
processes css with css-modules plugins @param {Object} options [plugin's options] @return {Function}
[ "processes", "css", "with", "css", "-", "modules", "plugins" ]
f524f87cb8e1a478cdc4ae35a0c150e91b855547
https://github.com/posthtml/posthtml-postcss-modules/blob/f524f87cb8e1a478cdc4ae35a0c150e91b855547/index.js#L50-L97
train
TomFrost/node-phonetic
lib/phonetic.js
getDerivative
function getDerivative(num) { var derivative = 1; while (num != 0) { derivative += num % 7; num = Math.floor(num / 7); } return derivative; }
javascript
function getDerivative(num) { var derivative = 1; while (num != 0) { derivative += num % 7; num = Math.floor(num / 7); } return derivative; }
[ "function", "getDerivative", "(", "num", ")", "{", "var", "derivative", "=", "1", ";", "while", "(", "num", "!=", "0", ")", "{", "derivative", "+=", "num", "%", "7", ";", "num", "=", "Math", ".", "floor", "(", "num", "/", "7", ")", ";", "}", "r...
Gets a derivative of a number by repeatedly dividing it by 7 and adding the remainders together. It's useful to base decisions on a derivative rather than the wordObj's current numeric, as it avoids making the same decisions around the same phonetics. @param {number} num A number from which a derivative should be cal...
[ "Gets", "a", "derivative", "of", "a", "number", "by", "repeatedly", "dividing", "it", "by", "7", "and", "adding", "the", "remainders", "together", ".", "It", "s", "useful", "to", "base", "decisions", "on", "a", "derivative", "rather", "than", "the", "wordO...
bd67e91664210b04087c536ebc3831e4cceafb0a
https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L146-L153
train
TomFrost/node-phonetic
lib/phonetic.js
getNextPhonetic
function getNextPhonetic(phoneticSet, simpleCap, wordObj, forceSimple) { var deriv = getDerivative(wordObj.numeric), simple = (wordObj.numeric + deriv) % wordObj.opts.phoneticSimplicity > 0, cap = simple || forceSimple ? simpleCap : phoneticSet.length, phonetic = phoneticSet[wordObj.numeric % cap]; wordObj.nume...
javascript
function getNextPhonetic(phoneticSet, simpleCap, wordObj, forceSimple) { var deriv = getDerivative(wordObj.numeric), simple = (wordObj.numeric + deriv) % wordObj.opts.phoneticSimplicity > 0, cap = simple || forceSimple ? simpleCap : phoneticSet.length, phonetic = phoneticSet[wordObj.numeric % cap]; wordObj.nume...
[ "function", "getNextPhonetic", "(", "phoneticSet", ",", "simpleCap", ",", "wordObj", ",", "forceSimple", ")", "{", "var", "deriv", "=", "getDerivative", "(", "wordObj", ".", "numeric", ")", ",", "simple", "=", "(", "wordObj", ".", "numeric", "+", "deriv", ...
Gets the next pseudo-random phonetic from a given phonetic set, intelligently determining whether to include "complex" phonetics in that set based on the options.phoneticSimplicity. @param {Array} phoneticSet The array of phonetics from which to choose @param {number} simpleCap The number of 'simple' phonetics at the ...
[ "Gets", "the", "next", "pseudo", "-", "random", "phonetic", "from", "a", "given", "phonetic", "set", "intelligently", "determining", "whether", "to", "include", "complex", "phonetics", "in", "that", "set", "based", "on", "the", "options", ".", "phoneticSimplicit...
bd67e91664210b04087c536ebc3831e4cceafb0a
https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L206-L213
train
TomFrost/node-phonetic
lib/phonetic.js
getNumericHash
function getNumericHash(data) { var hash = crypto.createHash('md5'), numeric = 0, buf; hash.update(data + '-Phonetic'); buf = hash.digest(); for (var i = 0; i <= 12; i += 4) numeric += buf.readUInt32LE(i); return numeric; }
javascript
function getNumericHash(data) { var hash = crypto.createHash('md5'), numeric = 0, buf; hash.update(data + '-Phonetic'); buf = hash.digest(); for (var i = 0; i <= 12; i += 4) numeric += buf.readUInt32LE(i); return numeric; }
[ "function", "getNumericHash", "(", "data", ")", "{", "var", "hash", "=", "crypto", ".", "createHash", "(", "'md5'", ")", ",", "numeric", "=", "0", ",", "buf", ";", "hash", ".", "update", "(", "data", "+", "'-Phonetic'", ")", ";", "buf", "=", "hash", ...
Generates a numeric hash based on the input data. The hash is an md5, with each block of 32 bits converted to an integer and added together. @param {string|number} data The string or number to be hashed. @returns {number}
[ "Generates", "a", "numeric", "hash", "based", "on", "the", "input", "data", ".", "The", "hash", "is", "an", "md5", "with", "each", "block", "of", "32", "bits", "converted", "to", "an", "integer", "and", "added", "together", "." ]
bd67e91664210b04087c536ebc3831e4cceafb0a
https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L222-L231
train
TomFrost/node-phonetic
lib/phonetic.js
postProcess
function postProcess(wordObj) { var regex; for (var i in REPLACEMENTS) { if (REPLACEMENTS.hasOwnProperty(i)) { regex = new RegExp(i); wordObj.word = wordObj.word.replace(regex, REPLACEMENTS[i]); } } if (wordObj.opts.capFirst) return capFirst(wordObj.word); return wordObj.word; }
javascript
function postProcess(wordObj) { var regex; for (var i in REPLACEMENTS) { if (REPLACEMENTS.hasOwnProperty(i)) { regex = new RegExp(i); wordObj.word = wordObj.word.replace(regex, REPLACEMENTS[i]); } } if (wordObj.opts.capFirst) return capFirst(wordObj.word); return wordObj.word; }
[ "function", "postProcess", "(", "wordObj", ")", "{", "var", "regex", ";", "for", "(", "var", "i", "in", "REPLACEMENTS", ")", "{", "if", "(", "REPLACEMENTS", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "regex", "=", "new", "RegExp", "(", "i", ")",...
Applies post-processing to a word after it has already been generated. In this phase, the REPLACEMENTS are executed, applying language intelligence that can make generated words more pronounceable. The first letter is also capitalized. @param {{word, numeric, lastSkippedPre, lastSkippedPost, opts}} wordObj The word ...
[ "Applies", "post", "-", "processing", "to", "a", "word", "after", "it", "has", "already", "been", "generated", ".", "In", "this", "phase", "the", "REPLACEMENTS", "are", "executed", "applying", "language", "intelligence", "that", "can", "make", "generated", "wo...
bd67e91664210b04087c536ebc3831e4cceafb0a
https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L243-L254
train
amida-tech/blue-button-generate
lib/sectionLevel2.js
function (input) { var value = bbuo.deepValue(input, 'product.product.name'); if (!bbuo.exists(value)) { value = bbuo.deepValue(input, 'product.unencoded_name'); } if (!bbuo.exists(value)) { return ""; } else { return value; } }
javascript
function (input) { var value = bbuo.deepValue(input, 'product.product.name'); if (!bbuo.exists(value)) { value = bbuo.deepValue(input, 'product.unencoded_name'); } if (!bbuo.exists(value)) { return ""; } else { return value; } }
[ "function", "(", "input", ")", "{", "var", "value", "=", "bbuo", ".", "deepValue", "(", "input", ",", "'product.product.name'", ")", ";", "if", "(", "!", "bbuo", ".", "exists", "(", "value", ")", ")", "{", "value", "=", "bbuo", ".", "deepValue", "(",...
Name, did not find class in the medication blue-button-data
[ "Name", "did", "not", "find", "class", "in", "the", "medication", "blue", "-", "button", "-", "data" ]
20515d9ac03384bac7197dca0df7d43523c8c3df
https://github.com/amida-tech/blue-button-generate/blob/20515d9ac03384bac7197dca0df7d43523c8c3df/lib/sectionLevel2.js#L113-L123
train
sheebz/phantom-proxy
lib/webpage.js
function (propertyName, callbackFn) { var self = this; request.post(this.options.hostAndPort + '/page/properties/get', {form:{ propertyName:propertyName}}, function (error, response, body) { error && console.error(error); ...
javascript
function (propertyName, callbackFn) { var self = this; request.post(this.options.hostAndPort + '/page/properties/get', {form:{ propertyName:propertyName}}, function (error, response, body) { error && console.error(error); ...
[ "function", "(", "propertyName", ",", "callbackFn", ")", "{", "var", "self", "=", "this", ";", "request", ".", "post", "(", "this", ".", "options", ".", "hostAndPort", "+", "'/page/properties/get'", ",", "{", "form", ":", "{", "propertyName", ":", "propert...
gets property value ex. version
[ "gets", "property", "value", "ex", ".", "version" ]
a4963662205400e542668938ce5cf1ab9a66fba0
https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L63-L77
train
sheebz/phantom-proxy
lib/webpage.js
function (expressionFn, callbackFn) { var self = this, url = self.options.hostAndPort + '/page/functions/evaluate'; self.options.debug && console.log('calling url: %s', url); request.post(url, { form:{expre...
javascript
function (expressionFn, callbackFn) { var self = this, url = self.options.hostAndPort + '/page/functions/evaluate'; self.options.debug && console.log('calling url: %s', url); request.post(url, { form:{expre...
[ "function", "(", "expressionFn", ",", "callbackFn", ")", "{", "var", "self", "=", "this", ",", "url", "=", "self", ".", "options", ".", "hostAndPort", "+", "'/page/functions/evaluate'", ";", "self", ".", "options", ".", "debug", "&&", "console", ".", "log"...
Evaluates the given function in the context of the web page. The execution is sandboxed, the web page has no access to the phantom object and it can't probe its own setting.
[ "Evaluates", "the", "given", "function", "in", "the", "context", "of", "the", "web", "page", ".", "The", "execution", "is", "sandboxed", "the", "web", "page", "has", "no", "access", "to", "the", "phantom", "object", "and", "it", "can", "t", "probe", "its...
a4963662205400e542668938ce5cf1ab9a66fba0
https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L177-L195
train
sheebz/phantom-proxy
lib/webpage.js
function (filename, callbackFn) { var self = this, url = self.options.hostAndPort + '/page/functions/render'; self.options.debug && console.log('calling url: %s', url); request.post(url, {form:{ args:JSON.stringify( ...
javascript
function (filename, callbackFn) { var self = this, url = self.options.hostAndPort + '/page/functions/render'; self.options.debug && console.log('calling url: %s', url); request.post(url, {form:{ args:JSON.stringify( ...
[ "function", "(", "filename", ",", "callbackFn", ")", "{", "var", "self", "=", "this", ",", "url", "=", "self", ".", "options", ".", "hostAndPort", "+", "'/page/functions/render'", ";", "self", ".", "options", ".", "debug", "&&", "console", ".", "log", "(...
Renders the web page to an image buffer and save it as the specified file. Currently the output format is automatically set based on the file extension. Supported formats are PNG, GIF, JPEG, and PDF.
[ "Renders", "the", "web", "page", "to", "an", "image", "buffer", "and", "save", "it", "as", "the", "specified", "file", ".", "Currently", "the", "output", "format", "is", "automatically", "set", "based", "on", "the", "file", "extension", ".", "Supported", "...
a4963662205400e542668938ce5cf1ab9a66fba0
https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L219-L239
train
sheebz/phantom-proxy
lib/webpage.js
function (format, callbackFn) { var self = this, args = [ format ], url = this.options.hostAndPort + '/page/functions/renderBase64'; this.option...
javascript
function (format, callbackFn) { var self = this, args = [ format ], url = this.options.hostAndPort + '/page/functions/renderBase64'; this.option...
[ "function", "(", "format", ",", "callbackFn", ")", "{", "var", "self", "=", "this", ",", "args", "=", "[", "format", "]", ",", "url", "=", "this", ".", "options", ".", "hostAndPort", "+", "'/page/functions/renderBase64'", ";", "this", ".", "options", "."...
Renders the web page to an image buffer and returns the result as a base64-encoded string representation of that image. Supported formats are PNG, GIF, and JPEG.
[ "Renders", "the", "web", "page", "to", "an", "image", "buffer", "and", "returns", "the", "result", "as", "a", "base64", "-", "encoded", "string", "representation", "of", "that", "image", ".", "Supported", "formats", "are", "PNG", "GIF", "and", "JPEG", "." ...
a4963662205400e542668938ce5cf1ab9a66fba0
https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L242-L263
train
sheebz/phantom-proxy
lib/webpage.js
function (selector, callbackFn, timeout) { var self = this, startTime = Date.now(), timeoutInterval = 150, testRunning = false, //if evaluate succeeds, invokes callback w/ true, if timeout, ...
javascript
function (selector, callbackFn, timeout) { var self = this, startTime = Date.now(), timeoutInterval = 150, testRunning = false, //if evaluate succeeds, invokes callback w/ true, if timeout, ...
[ "function", "(", "selector", ",", "callbackFn", ",", "timeout", ")", "{", "var", "self", "=", "this", ",", "startTime", "=", "Date", ".", "now", "(", ")", ",", "timeoutInterval", "=", "150", ",", "testRunning", "=", "false", ",", "//if evaluate succeeds, i...
additional methods not in phantomjs api waits for selector to appear, then executes callbackFn
[ "additional", "methods", "not", "in", "phantomjs", "api", "waits", "for", "selector", "to", "appear", "then", "executes", "callbackFn" ]
a4963662205400e542668938ce5cf1ab9a66fba0
https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L267-L299
train
addthis/fluxthis
src/Dispatcher.es6.js
dispatchToStores
function dispatchToStores(ids = new Set()) { ids.forEach((storeID) => { if (this[IS_PENDING][storeID]) { return true; } invokeCallback.call(this, storeID); }); }
javascript
function dispatchToStores(ids = new Set()) { ids.forEach((storeID) => { if (this[IS_PENDING][storeID]) { return true; } invokeCallback.call(this, storeID); }); }
[ "function", "dispatchToStores", "(", "ids", "=", "new", "Set", "(", ")", ")", "{", "ids", ".", "forEach", "(", "(", "storeID", ")", "=>", "{", "if", "(", "this", "[", "IS_PENDING", "]", "[", "storeID", "]", ")", "{", "return", "true", ";", "}", "...
This method takes an array of store id's and iterates over them to determine if we should invoke a dispatch of the action. @param {Set} ids
[ "This", "method", "takes", "an", "array", "of", "store", "id", "s", "and", "iterates", "over", "them", "to", "determine", "if", "we", "should", "invoke", "a", "dispatch", "of", "the", "action", "." ]
ccd399554ecac886d7389ffe9d6e72519d92c481
https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L293-L301
train
addthis/fluxthis
src/Dispatcher.es6.js
invokeCallback
function invokeCallback(id) { this[IS_PENDING][id] = true; this[CALLBACKS][id](this[PENDING_ACTION]); this[EMIT_CHANGE_CALLBACK].get(id)(); this[IS_HANDLED][id] = true; }
javascript
function invokeCallback(id) { this[IS_PENDING][id] = true; this[CALLBACKS][id](this[PENDING_ACTION]); this[EMIT_CHANGE_CALLBACK].get(id)(); this[IS_HANDLED][id] = true; }
[ "function", "invokeCallback", "(", "id", ")", "{", "this", "[", "IS_PENDING", "]", "[", "id", "]", "=", "true", ";", "this", "[", "CALLBACKS", "]", "[", "id", "]", "(", "this", "[", "PENDING_ACTION", "]", ")", ";", "this", "[", "EMIT_CHANGE_CALLBACK", ...
Call the callback stored with the given id. Also do some internal bookkeeping. @param {string} id @internal
[ "Call", "the", "callback", "stored", "with", "the", "given", "id", ".", "Also", "do", "some", "internal", "bookkeeping", "." ]
ccd399554ecac886d7389ffe9d6e72519d92c481
https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L310-L315
train
addthis/fluxthis
src/Dispatcher.es6.js
startDispatching
function startDispatching(action) { require('./debug.es6').logDispatch(action); Object.keys(this[CALLBACKS]).forEach((id) => { this[IS_PENDING][id] = false; this[IS_HANDLED][id] = false; }); this[PENDING_ACTION] = action; this[IS_DISPATCHING] = true; }
javascript
function startDispatching(action) { require('./debug.es6').logDispatch(action); Object.keys(this[CALLBACKS]).forEach((id) => { this[IS_PENDING][id] = false; this[IS_HANDLED][id] = false; }); this[PENDING_ACTION] = action; this[IS_DISPATCHING] = true; }
[ "function", "startDispatching", "(", "action", ")", "{", "require", "(", "'./debug.es6'", ")", ".", "logDispatch", "(", "action", ")", ";", "Object", ".", "keys", "(", "this", "[", "CALLBACKS", "]", ")", ".", "forEach", "(", "(", "id", ")", "=>", "{", ...
Set up bookkeeping needed when dispatching. @param {object} action @internal
[ "Set", "up", "bookkeeping", "needed", "when", "dispatching", "." ]
ccd399554ecac886d7389ffe9d6e72519d92c481
https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L323-L333
train
addthis/fluxthis
lib/implore.es6.js
makeQueryString
function makeQueryString(obj, prefix='') { const str = []; let prop; let key; let value; for (prop in obj) { if (obj.hasOwnProperty(prop)) { key = prefix ? prefix + '[' + prop + ']' : prop; value = obj[prop]; str.push(typeof value === 'object' ? makeQueryString(value, key) : encodeURICo...
javascript
function makeQueryString(obj, prefix='') { const str = []; let prop; let key; let value; for (prop in obj) { if (obj.hasOwnProperty(prop)) { key = prefix ? prefix + '[' + prop + ']' : prop; value = obj[prop]; str.push(typeof value === 'object' ? makeQueryString(value, key) : encodeURICo...
[ "function", "makeQueryString", "(", "obj", ",", "prefix", "=", "''", ")", "{", "const", "str", "=", "[", "]", ";", "let", "prop", ";", "let", "key", ";", "let", "value", ";", "for", "(", "prop", "in", "obj", ")", "{", "if", "(", "obj", ".", "ha...
Take a simple object and turn it into a queryString, recursively. @param {object} obj - query object @param {string} prefix - used in recursive calls to keep track of the parent @return {string} queryString without the '?''
[ "Take", "a", "simple", "object", "and", "turn", "it", "into", "a", "queryString", "recursively", "." ]
ccd399554ecac886d7389ffe9d6e72519d92c481
https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/lib/implore.es6.js#L246-L265
train
zynga/atom
atom.js
removeListener
function removeListener(listeners) { for (var i = listeners.length; --i >= 0;) { // There should only be ONE exhausted listener. if (!listeners[i].calls) { return listeners.splice(i, 1); } } }
javascript
function removeListener(listeners) { for (var i = listeners.length; --i >= 0;) { // There should only be ONE exhausted listener. if (!listeners[i].calls) { return listeners.splice(i, 1); } } }
[ "function", "removeListener", "(", "listeners", ")", "{", "for", "(", "var", "i", "=", "listeners", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "// There should only be ONE exhausted listener.", "if", "(", "!", "listeners", "[", "i", "]", ".",...
Helper to remove an exausted listener from the listeners array
[ "Helper", "to", "remove", "an", "exausted", "listener", "from", "the", "listeners", "array" ]
cf204967e9267df47d51c2b5b628261c7ed0cec7
https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L70-L77
train