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
ianmcgregor/boid
src/boid.js
flock
function flock(boids) { const averageVelocity = velocity.clone(); const averagePosition = Vec2.get(); let inSightCount = 0; for (let i = 0; i < boids.length; i++) { const b = boids[i]; if (b !== boid && inSight(b)) { averageVelocity.add(b.velocity)...
javascript
function flock(boids) { const averageVelocity = velocity.clone(); const averagePosition = Vec2.get(); let inSightCount = 0; for (let i = 0; i < boids.length; i++) { const b = boids[i]; if (b !== boid && inSight(b)) { averageVelocity.add(b.velocity)...
[ "function", "flock", "(", "boids", ")", "{", "const", "averageVelocity", "=", "velocity", ".", "clone", "(", ")", ";", "const", "averagePosition", "=", "Vec2", ".", "get", "(", ")", ";", "let", "inSightCount", "=", "0", ";", "for", "(", "let", "i", "...
flock - group of boids loosely move together
[ "flock", "-", "group", "of", "boids", "loosely", "move", "together" ]
cef69760c5777898a389707905fc1ca387441bcd
https://github.com/ianmcgregor/boid/blob/cef69760c5777898a389707905fc1ca387441bcd/src/boid.js#L300-L326
train
tianjianchn/javascript-packages
packages/umc-managed-store/src/parse-structure.js
getEntityNameKeyMap
function getEntityNameKeyMap(structure) { const result = {}; for (const kk in structure) { const vv = structure[kk]; if (typeof vv === 'string') { if (types.isMap(vv)) { const info = types.getTypeInfo(vv); const entityName = info.entity; if (_entityNameType[ent...
javascript
function getEntityNameKeyMap(structure) { const result = {}; for (const kk in structure) { const vv = structure[kk]; if (typeof vv === 'string') { if (types.isMap(vv)) { const info = types.getTypeInfo(vv); const entityName = info.entity; if (_entityNameType[ent...
[ "function", "getEntityNameKeyMap", "(", "structure", ")", "{", "const", "result", "=", "{", "}", ";", "for", "(", "const", "kk", "in", "structure", ")", "{", "const", "vv", "=", "structure", "[", "kk", "]", ";", "if", "(", "typeof", "vv", "===", "'st...
currently only support top level key
[ "currently", "only", "support", "top", "level", "key" ]
3abe85edbfe323939c84c1d02128d74d6374bcde
https://github.com/tianjianchn/javascript-packages/blob/3abe85edbfe323939c84c1d02128d74d6374bcde/packages/umc-managed-store/src/parse-structure.js#L18-L36
train
nknapp/process-streams
src/process-streams.js
wrapProcess
function wrapProcess (tmpIn, tmpOut, processProvider) { return createStream(tmpIn, tmpOut, function (input, output, callback) { var _this = this var process = processProvider.call(this, tmpIn, tmpOut) process.on('error', function (error) { callback(error) }) if (!tmpIn) { input.pipe(pr...
javascript
function wrapProcess (tmpIn, tmpOut, processProvider) { return createStream(tmpIn, tmpOut, function (input, output, callback) { var _this = this var process = processProvider.call(this, tmpIn, tmpOut) process.on('error', function (error) { callback(error) }) if (!tmpIn) { input.pipe(pr...
[ "function", "wrapProcess", "(", "tmpIn", ",", "tmpOut", ",", "processProvider", ")", "{", "return", "createStream", "(", "tmpIn", ",", "tmpOut", ",", "function", "(", "input", ",", "output", ",", "callback", ")", "{", "var", "_this", "=", "this", "var", ...
Wraps a process provided by a function in a stream such that the stream input is piped to stdin and stdout is piped to the stream output. If tmpIn is provided, no pipe is set up to stdin. Instead, the data is piped into tmpIn which can than be provided to the process as command line argument. The same applies for stdou...
[ "Wraps", "a", "process", "provided", "by", "a", "function", "in", "a", "stream", "such", "that", "the", "stream", "input", "is", "piped", "to", "stdin", "and", "stdout", "is", "piped", "to", "the", "stream", "output", ".", "If", "tmpIn", "is", "provided"...
227747e73ea541a9eeca1a4bf21c6d85c3c78bb0
https://github.com/nknapp/process-streams/blob/227747e73ea541a9eeca1a4bf21c6d85c3c78bb0/src/process-streams.js#L105-L140
train
nknapp/process-streams
src/process-streams.js
parseString
function parseString (string, tmpIn, tmpOut) { var resultIn = null var resultOut = null var resultString = string.replace(placeHolderRegex, function (match) { switch (match) { case IN: resultIn = resultIn || tmpIn return resultIn case OUT: resultOut = resu...
javascript
function parseString (string, tmpIn, tmpOut) { var resultIn = null var resultOut = null var resultString = string.replace(placeHolderRegex, function (match) { switch (match) { case IN: resultIn = resultIn || tmpIn return resultIn case OUT: resultOut = resu...
[ "function", "parseString", "(", "string", ",", "tmpIn", ",", "tmpOut", ")", "{", "var", "resultIn", "=", "null", "var", "resultOut", "=", "null", "var", "resultString", "=", "string", ".", "replace", "(", "placeHolderRegex", ",", "function", "(", "match", ...
Replace placeholders in a string @param string @param tmpIn @param tmpOut @returns {{in: *, out: *, string: (XML|string|void|*)}}
[ "Replace", "placeholders", "in", "a", "string" ]
227747e73ea541a9eeca1a4bf21c6d85c3c78bb0
https://github.com/nknapp/process-streams/blob/227747e73ea541a9eeca1a4bf21c6d85c3c78bb0/src/process-streams.js#L189-L215
train
pollen5/ladybug-fetch
src/url.js
cleanJoin
function cleanJoin(req) { if(!isAbsoluteURL(req.url) && req.baseURL) { const parsedBase = url.parse(req.baseURL, true); const parsed = url.parse(req.url, true); return { protocol: parsedBase.protocol, host: parsedBase.hostname, port: parsedBase.port, path: URLJoin(parsedBase.pathna...
javascript
function cleanJoin(req) { if(!isAbsoluteURL(req.url) && req.baseURL) { const parsedBase = url.parse(req.baseURL, true); const parsed = url.parse(req.url, true); return { protocol: parsedBase.protocol, host: parsedBase.hostname, port: parsedBase.port, path: URLJoin(parsedBase.pathna...
[ "function", "cleanJoin", "(", "req", ")", "{", "if", "(", "!", "isAbsoluteURL", "(", "req", ".", "url", ")", "&&", "req", ".", "baseURL", ")", "{", "const", "parsedBase", "=", "url", ".", "parse", "(", "req", ".", "baseURL", ",", "true", ")", ";", ...
Joins two URLs Cleanly, respecting any queries that appears in both base url path and the request query object.
[ "Joins", "two", "URLs", "Cleanly", "respecting", "any", "queries", "that", "appears", "in", "both", "base", "url", "path", "and", "the", "request", "query", "object", "." ]
7787a245454ff04e0b67b1de40b119bc7caf251d
https://github.com/pollen5/ladybug-fetch/blob/7787a245454ff04e0b67b1de40b119bc7caf251d/src/url.js#L6-L27
train
davestewart/laravel-sketchpad-reload
index.js
load
function load () { const str = fs.readFileSync(settingsFile, 'utf8') if (str) { const settings = JSON.parse(str) this.settings = settings.livereload this.paths = getPaths(settings) .map(p => path.normalize(this.root + '/' + p)) .map(p => makeGlob(p)) } }
javascript
function load () { const str = fs.readFileSync(settingsFile, 'utf8') if (str) { const settings = JSON.parse(str) this.settings = settings.livereload this.paths = getPaths(settings) .map(p => path.normalize(this.root + '/' + p)) .map(p => makeGlob(p)) } }
[ "function", "load", "(", ")", "{", "const", "str", "=", "fs", ".", "readFileSync", "(", "settingsFile", ",", "'utf8'", ")", "if", "(", "str", ")", "{", "const", "settings", "=", "JSON", ".", "parse", "(", "str", ")", "this", ".", "settings", "=", "...
Load the settings file contents and assign to properties @returns {boolean}
[ "Load", "the", "settings", "file", "contents", "and", "assign", "to", "properties" ]
65b4bfdfdfb27b1dd4ba972aca897321b9a756b2
https://github.com/davestewart/laravel-sketchpad-reload/blob/65b4bfdfdfb27b1dd4ba972aca897321b9a756b2/index.js#L160-L169
train
davestewart/laravel-sketchpad-reload
index.js
init
function init (root, storage) { // calling path const calling = path.dirname(getCallingScript()) // root path root = !root || root === '.' || root === './' ? root = calling : path.isAbsolute(root) ? root : path.normalize(calling + root) sketchpad.root = root.replace(/\/*$/, '/') // set...
javascript
function init (root, storage) { // calling path const calling = path.dirname(getCallingScript()) // root path root = !root || root === '.' || root === './' ? root = calling : path.isAbsolute(root) ? root : path.normalize(calling + root) sketchpad.root = root.replace(/\/*$/, '/') // set...
[ "function", "init", "(", "root", ",", "storage", ")", "{", "// calling path", "const", "calling", "=", "path", ".", "dirname", "(", "getCallingScript", "(", ")", ")", "// root path", "root", "=", "!", "root", "||", "root", "===", "'.'", "||", "root", "==...
Initialize Sketchpad, optionally with non-standard paths @param {string} [root] Relative path to Laravel root folder @param {string} [storage] Relative path to storage folder from root @returns {boolean}
[ "Initialize", "Sketchpad", "optionally", "with", "non", "-", "standard", "paths" ]
65b4bfdfdfb27b1dd4ba972aca897321b9a756b2
https://github.com/davestewart/laravel-sketchpad-reload/blob/65b4bfdfdfb27b1dd4ba972aca897321b9a756b2/index.js#L178-L205
train
ssbc/ssb-names
util.js
getOwnNameFallBack
function getOwnNameFallBack(names, dest) { if (!names[dest]) return dest else return names[dest][dest] || dest }
javascript
function getOwnNameFallBack(names, dest) { if (!names[dest]) return dest else return names[dest][dest] || dest }
[ "function", "getOwnNameFallBack", "(", "names", ",", "dest", ")", "{", "if", "(", "!", "names", "[", "dest", "]", ")", "return", "dest", "else", "return", "names", "[", "dest", "]", "[", "dest", "]", "||", "dest", "}" ]
Falls back to a user's name for themselves
[ "Falls", "back", "to", "a", "user", "s", "name", "for", "themselves" ]
e288aa4494c4d00983437391f9df84ae77b2bb51
https://github.com/ssbc/ssb-names/blob/e288aa4494c4d00983437391f9df84ae77b2bb51/util.js#L41-L44
train
mavin/node-wordpress-shortcode
index.js
function (tag, text, index) { var re = wp.shortcode.regexp(tag) var match var result re.lastIndex = index || 0 match = re.exec(text) if (!match) { return } // If we matched an escaped shortcode, try again. if (match[1] === '[' && match[7] === ']') { return wp.shortcode...
javascript
function (tag, text, index) { var re = wp.shortcode.regexp(tag) var match var result re.lastIndex = index || 0 match = re.exec(text) if (!match) { return } // If we matched an escaped shortcode, try again. if (match[1] === '[' && match[7] === ']') { return wp.shortcode...
[ "function", "(", "tag", ",", "text", ",", "index", ")", "{", "var", "re", "=", "wp", ".", "shortcode", ".", "regexp", "(", "tag", ")", "var", "match", "var", "result", "re", ".", "lastIndex", "=", "index", "||", "0", "match", "=", "re", ".", "exe...
Find the next matching shortcode Given a shortcode `tag`, a block of `text`, and an optional starting `index`, returns the next matching shortcode or `undefined`. Shortcodes are formatted as an object that contains the match `content`, the matching `index`, and the parsed `shortcode` object. @param tag @param text @...
[ "Find", "the", "next", "matching", "shortcode" ]
2e7b967327e85685b3ba0aed1c7afec790b66b1c
https://github.com/mavin/node-wordpress-shortcode/blob/2e7b967327e85685b3ba0aed1c7afec790b66b1c/index.js#L31-L67
train
mavin/node-wordpress-shortcode
index.js
function (match) { var type if (match[4]) { type = 'self-closing' } else if (match[6]) { type = 'closed' } else { type = 'single' } return new Shortcode({ tag: match[2], attrs: match[3], type: type, content: match[5] }) }
javascript
function (match) { var type if (match[4]) { type = 'self-closing' } else if (match[6]) { type = 'closed' } else { type = 'single' } return new Shortcode({ tag: match[2], attrs: match[3], type: type, content: match[5] }) }
[ "function", "(", "match", ")", "{", "var", "type", "if", "(", "match", "[", "4", "]", ")", "{", "type", "=", "'self-closing'", "}", "else", "if", "(", "match", "[", "6", "]", ")", "{", "type", "=", "'closed'", "}", "else", "{", "type", "=", "'s...
Generate a Shortcode Object from a RegExp match Accepts a `match` object from calling `regexp.exec()` on a `RegExp` generated by `wp.shortcode.regexp()`. `match` can also be set to the `arguments` from a callback passed to `regexp.replace()`. @param match @return {Shortcode}
[ "Generate", "a", "Shortcode", "Object", "from", "a", "RegExp", "match" ]
2e7b967327e85685b3ba0aed1c7afec790b66b1c
https://github.com/mavin/node-wordpress-shortcode/blob/2e7b967327e85685b3ba0aed1c7afec790b66b1c/index.js#L212-L229
train
mavin/node-wordpress-shortcode
index.js
function () { var text = '[' + this.tag _.each(this.attrs.numeric, function (value) { if (/\s/.test(value)) { text += ' "' + value + '"' } else { text += ' ' + value } }) _.each(this.attrs.named, function (value, name) { text += ' ' + name + '="' + value + '"' ...
javascript
function () { var text = '[' + this.tag _.each(this.attrs.numeric, function (value) { if (/\s/.test(value)) { text += ' "' + value + '"' } else { text += ' ' + value } }) _.each(this.attrs.named, function (value, name) { text += ' ' + name + '="' + value + '"' ...
[ "function", "(", ")", "{", "var", "text", "=", "'['", "+", "this", ".", "tag", "_", ".", "each", "(", "this", ".", "attrs", ".", "numeric", ",", "function", "(", "value", ")", "{", "if", "(", "/", "\\s", "/", ".", "test", "(", "value", ")", "...
Transform the shortcode match into a string @return {string}
[ "Transform", "the", "shortcode", "match", "into", "a", "string" ]
2e7b967327e85685b3ba0aed1c7afec790b66b1c
https://github.com/mavin/node-wordpress-shortcode/blob/2e7b967327e85685b3ba0aed1c7afec790b66b1c/index.js#L312-L344
train
tunnckoCore/async-exec-cmd
index.js
checkArguments
function checkArguments (argz) { if (!argz.args.length) { return error('first argument cant be function') } if (isEmptyFunction(argz.cb.toString())) { return error('should have `callback` (non empty callback)') } if (typeOf(argz.args[0]) !== 'string') { return type('expect `cmd` be string', argz...
javascript
function checkArguments (argz) { if (!argz.args.length) { return error('first argument cant be function') } if (isEmptyFunction(argz.cb.toString())) { return error('should have `callback` (non empty callback)') } if (typeOf(argz.args[0]) !== 'string') { return type('expect `cmd` be string', argz...
[ "function", "checkArguments", "(", "argz", ")", "{", "if", "(", "!", "argz", ".", "args", ".", "length", ")", "{", "return", "error", "(", "'first argument cant be function'", ")", "}", "if", "(", "isEmptyFunction", "(", "argz", ".", "cb", ".", "toString",...
> Create flexible arguments - check types. @param {Object} `argz` @return {Object} @api private
[ ">", "Create", "flexible", "arguments", "-", "check", "types", "." ]
a9ab9ba7df404ccf29b3d008d3350775dcd62ed2
https://github.com/tunnckoCore/async-exec-cmd/blob/a9ab9ba7df404ccf29b3d008d3350775dcd62ed2/index.js#L66-L94
train
tunnckoCore/async-exec-cmd
index.js
buildSpawn
function buildSpawn (cmd, args, opts, callback) { var proc = spawn(cmd, args, opts) var buffer = new Buffer('') var cmdError = {} cmd = cmd + ' ' + args.join(' ') if (proc.stdout) { proc.stdout.on('data', function indexOnData (data) { buffer = Buffer.concat([buffer, data]) }) } proc ....
javascript
function buildSpawn (cmd, args, opts, callback) { var proc = spawn(cmd, args, opts) var buffer = new Buffer('') var cmdError = {} cmd = cmd + ' ' + args.join(' ') if (proc.stdout) { proc.stdout.on('data', function indexOnData (data) { buffer = Buffer.concat([buffer, data]) }) } proc ....
[ "function", "buildSpawn", "(", "cmd", ",", "args", ",", "opts", ",", "callback", ")", "{", "var", "proc", "=", "spawn", "(", "cmd", ",", "args", ",", "opts", ")", "var", "buffer", "=", "new", "Buffer", "(", "''", ")", "var", "cmdError", "=", "{", ...
> Handle cross-spawn. @param {String} `cmd` @param {Array} `args` @param {Object} `opts` @param {Function} `callback` @return {Stream} actually what `child_process.spawn` returns @api private
[ ">", "Handle", "cross", "-", "spawn", "." ]
a9ab9ba7df404ccf29b3d008d3350775dcd62ed2
https://github.com/tunnckoCore/async-exec-cmd/blob/a9ab9ba7df404ccf29b3d008d3350775dcd62ed2/index.js#L120-L160
train
tunnckoCore/async-exec-cmd
index.js
CommandError
function CommandError (err) { this.name = 'CommandError' this.command = err.command this.message = err.message this.stack = err.stack this.buffer = err.buffer this.status = err.status Error.captureStackTrace(this, CommandError) }
javascript
function CommandError (err) { this.name = 'CommandError' this.command = err.command this.message = err.message this.stack = err.stack this.buffer = err.buffer this.status = err.status Error.captureStackTrace(this, CommandError) }
[ "function", "CommandError", "(", "err", ")", "{", "this", ".", "name", "=", "'CommandError'", "this", ".", "command", "=", "err", ".", "command", "this", ".", "message", "=", "err", ".", "message", "this", ".", "stack", "=", "err", ".", "stack", "this"...
> Construct `CommandError`. @param {Object} `err` @api private
[ ">", "Construct", "CommandError", "." ]
a9ab9ba7df404ccf29b3d008d3350775dcd62ed2
https://github.com/tunnckoCore/async-exec-cmd/blob/a9ab9ba7df404ccf29b3d008d3350775dcd62ed2/index.js#L168-L176
train
tianjianchn/midd
packages/uni-router/src/router.js
router
function router(req, resp, next) { const routerPath = req.routePath || ''; const beforeRunMiddleware = (route) => { const match = matchRoute(routerPath, req, route); if (!match) return false; const { params, path: matchPath } = match; if (options.params) req.params = { ...options.para...
javascript
function router(req, resp, next) { const routerPath = req.routePath || ''; const beforeRunMiddleware = (route) => { const match = matchRoute(routerPath, req, route); if (!match) return false; const { params, path: matchPath } = match; if (options.params) req.params = { ...options.para...
[ "function", "router", "(", "req", ",", "resp", ",", "next", ")", "{", "const", "routerPath", "=", "req", ".", "routePath", "||", "''", ";", "const", "beforeRunMiddleware", "=", "(", "route", ")", "=>", "{", "const", "match", "=", "matchRoute", "(", "ro...
the router instance
[ "the", "router", "instance" ]
849f07f68c30335a68be5e1e2b709eb930a560d7
https://github.com/tianjianchn/midd/blob/849f07f68c30335a68be5e1e2b709eb930a560d7/packages/uni-router/src/router.js#L19-L41
train
heroqu/node-content-store
lib/event-promise.js
eventPromise
function eventPromise (emitter, eventName) { return new Promise((resolve, reject) => { emitter.on(eventName, (...args) => { return resolve(args) }) }) }
javascript
function eventPromise (emitter, eventName) { return new Promise((resolve, reject) => { emitter.on(eventName, (...args) => { return resolve(args) }) }) }
[ "function", "eventPromise", "(", "emitter", ",", "eventName", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "emitter", ".", "on", "(", "eventName", ",", "(", "...", "args", ")", "=>", "{", "return", "resolve"...
Wrap an event emmiting object event handler in such a way, that when the event is detected, the promise get resolved.
[ "Wrap", "an", "event", "emmiting", "object", "event", "handler", "in", "such", "a", "way", "that", "when", "the", "event", "is", "detected", "the", "promise", "get", "resolved", "." ]
0100814bfd988d60ad94cdf5a441eff328208a6a
https://github.com/heroqu/node-content-store/blob/0100814bfd988d60ad94cdf5a441eff328208a6a/lib/event-promise.js#L5-L11
train
cpsubrian/mgit
lib/index.js
status
function status() { var tasks = [], cwd = process.cwd(); findRepos(function(err, repos) { if (err) return console.log(err); repos.forEach(function(repo) { tasks.push(function(done) { repo.status(function(err, status) { if (err) return done(err); if (argv.b) { ...
javascript
function status() { var tasks = [], cwd = process.cwd(); findRepos(function(err, repos) { if (err) return console.log(err); repos.forEach(function(repo) { tasks.push(function(done) { repo.status(function(err, status) { if (err) return done(err); if (argv.b) { ...
[ "function", "status", "(", ")", "{", "var", "tasks", "=", "[", "]", ",", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "findRepos", "(", "function", "(", "err", ",", "repos", ")", "{", "if", "(", "err", ")", "return", "console", ".", "log", ...
Output the status of found git repositories.
[ "Output", "the", "status", "of", "found", "git", "repositories", "." ]
a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7
https://github.com/cpsubrian/mgit/blob/a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7/lib/index.js#L24-L109
train
cpsubrian/mgit
lib/index.js
pull
function pull() { var tasks = [], cwd = process.cwd(); findRepos(function(err, repos) { if (err) return console.log(err); repos.forEach(function(repo) { tasks.push(function(done) { repo.status(function(err, status) { var name = status.repo.path.replace(cwd + '/', ''); ...
javascript
function pull() { var tasks = [], cwd = process.cwd(); findRepos(function(err, repos) { if (err) return console.log(err); repos.forEach(function(repo) { tasks.push(function(done) { repo.status(function(err, status) { var name = status.repo.path.replace(cwd + '/', ''); ...
[ "function", "pull", "(", ")", "{", "var", "tasks", "=", "[", "]", ",", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "findRepos", "(", "function", "(", "err", ",", "repos", ")", "{", "if", "(", "err", ")", "return", "console", ".", "log", "...
Pull and rebase all CLEAN git repos in the CWD.
[ "Pull", "and", "rebase", "all", "CLEAN", "git", "repos", "in", "the", "CWD", "." ]
a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7
https://github.com/cpsubrian/mgit/blob/a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7/lib/index.js#L112-L153
train
cpsubrian/mgit
lib/index.js
indent
function indent(str, prefix) { prefix = prefix || ' '; var lines = str.split("\n"); lines.forEach(function(line, i) { lines[i] = prefix + line; }); return lines.join("\n"); }
javascript
function indent(str, prefix) { prefix = prefix || ' '; var lines = str.split("\n"); lines.forEach(function(line, i) { lines[i] = prefix + line; }); return lines.join("\n"); }
[ "function", "indent", "(", "str", ",", "prefix", ")", "{", "prefix", "=", "prefix", "||", "' '", ";", "var", "lines", "=", "str", ".", "split", "(", "\"\\n\"", ")", ";", "lines", ".", "forEach", "(", "function", "(", "line", ",", "i", ")", "{", ...
Indent a block of text.
[ "Indent", "a", "block", "of", "text", "." ]
a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7
https://github.com/cpsubrian/mgit/blob/a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7/lib/index.js#L156-L163
train
cpsubrian/mgit
lib/index.js
findRepos
function findRepos(callback) { var cwd = process.cwd(), tasks = []; fs.readdir(cwd, function(err, files) { if (err) return callback(err); var repos = []; files.forEach(function(file) { if (fs.existsSync(path.join(cwd, file, '.git'))) { repos.push(path.join(cwd, file)); } ...
javascript
function findRepos(callback) { var cwd = process.cwd(), tasks = []; fs.readdir(cwd, function(err, files) { if (err) return callback(err); var repos = []; files.forEach(function(file) { if (fs.existsSync(path.join(cwd, file, '.git'))) { repos.push(path.join(cwd, file)); } ...
[ "function", "findRepos", "(", "callback", ")", "{", "var", "cwd", "=", "process", ".", "cwd", "(", ")", ",", "tasks", "=", "[", "]", ";", "fs", ".", "readdir", "(", "cwd", ",", "function", "(", "err", ",", "files", ")", "{", "if", "(", "err", "...
Find and open all git repositories in the CWD.
[ "Find", "and", "open", "all", "git", "repositories", "in", "the", "CWD", "." ]
a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7
https://github.com/cpsubrian/mgit/blob/a938dbeb833c3e0c19efa9ca47ee2ebfe77aeed7/lib/index.js#L166-L194
train
kriskowal/iterator
iterator.js
Iterator
function Iterator(iterator) { if (Array.isArray(iterator) || typeof iterator == "string") return Iterator.iterate(iterator); iterator = Object(iterator); if (!(this instanceof Iterator)) return new Iterator(iterator); this.next = this.send = iterator.send || iterator.next || ...
javascript
function Iterator(iterator) { if (Array.isArray(iterator) || typeof iterator == "string") return Iterator.iterate(iterator); iterator = Object(iterator); if (!(this instanceof Iterator)) return new Iterator(iterator); this.next = this.send = iterator.send || iterator.next || ...
[ "function", "Iterator", "(", "iterator", ")", "{", "if", "(", "Array", ".", "isArray", "(", "iterator", ")", "||", "typeof", "iterator", "==", "\"string\"", ")", "return", "Iterator", ".", "iterate", "(", "iterator", ")", ";", "iterator", "=", "Object", ...
upgrades an iterator to a Iterator
[ "upgrades", "an", "iterator", "to", "a", "Iterator" ]
00a41500ad73ff14aee347fdf27872198e0991c3
https://github.com/kriskowal/iterator/blob/00a41500ad73ff14aee347fdf27872198e0991c3/iterator.js#L5-L24
train
kaerus-component/uP
index.js
traverse
function traverse(_promise){ var c = _promise._chain, s = _promise._state, v = _promise._value, o = _promise._opaque, t, p, h, r; while((t = c.shift())){ p = t[0]; h = t[s]; if(typeof h === 'function') { try { r = h(v,o); ...
javascript
function traverse(_promise){ var c = _promise._chain, s = _promise._state, v = _promise._value, o = _promise._opaque, t, p, h, r; while((t = c.shift())){ p = t[0]; h = t[s]; if(typeof h === 'function') { try { r = h(v,o); ...
[ "function", "traverse", "(", "_promise", ")", "{", "var", "c", "=", "_promise", ".", "_chain", ",", "s", "=", "_promise", ".", "_state", ",", "v", "=", "_promise", ".", "_value", ",", "o", "=", "_promise", ".", "_opaque", ",", "t", ",", "p", ",", ...
Resolver function, yields a promised value to handlers
[ "Resolver", "function", "yields", "a", "promised", "value", "to", "handlers" ]
2c70cf5c539f4fc8e660a1f4f8d376d17dc4532e
https://github.com/kaerus-component/uP/blob/2c70cf5c539f4fc8e660a1f4f8d376d17dc4532e/index.js#L748-L774
train
graphmalizer/graphmalizer-core
utils/permutations.js
cart
function cart(xs, ys) { // nothing on the left if(!xs || xs.length === 0) return ys.map(function(y){ return [[],y] }); // nothing on the right if(!ys || ys.length === 0) return xs.map(function(x){ return [x,[]] }); return Combinatorics.cartesianProduct(x, y).toArray(); }
javascript
function cart(xs, ys) { // nothing on the left if(!xs || xs.length === 0) return ys.map(function(y){ return [[],y] }); // nothing on the right if(!ys || ys.length === 0) return xs.map(function(x){ return [x,[]] }); return Combinatorics.cartesianProduct(x, y).toArray(); }
[ "function", "cart", "(", "xs", ",", "ys", ")", "{", "// nothing on the left", "if", "(", "!", "xs", "||", "xs", ".", "length", "===", "0", ")", "return", "ys", ".", "map", "(", "function", "(", "y", ")", "{", "return", "[", "[", "]", ",", "y", ...
save version of Combinatorics.cartesianProduct
[ "save", "version", "of", "Combinatorics", ".", "cartesianProduct" ]
a17ff4ef958c245652288e24dc663f77ddb1e80e
https://github.com/graphmalizer/graphmalizer-core/blob/a17ff4ef958c245652288e24dc663f77ddb1e80e/utils/permutations.js#L9-L24
train
switer/chainjs
lib/utils.js
function(obj, iterator, context) { if (!obj) return else if (obj.forEach) obj.forEach(iterator) else if (obj.length == +obj.length) { for (var i = 0; i < obj.length; i++) iterator.call(context, obj[i], i) } else { for (var key in obj) iterator.call(context, obj[ke...
javascript
function(obj, iterator, context) { if (!obj) return else if (obj.forEach) obj.forEach(iterator) else if (obj.length == +obj.length) { for (var i = 0; i < obj.length; i++) iterator.call(context, obj[i], i) } else { for (var key in obj) iterator.call(context, obj[ke...
[ "function", "(", "obj", ",", "iterator", ",", "context", ")", "{", "if", "(", "!", "obj", ")", "return", "else", "if", "(", "obj", ".", "forEach", ")", "obj", ".", "forEach", "(", "iterator", ")", "else", "if", "(", "obj", ".", "length", "==", "+...
forEach I don't want to import underscore, it looks like so heavy if using in chain
[ "forEach", "I", "don", "t", "want", "to", "import", "underscore", "it", "looks", "like", "so", "heavy", "if", "using", "in", "chain" ]
7b5c0ceb55135df7b7a621a891cf59f49cc67d6c
https://github.com/switer/chainjs/blob/7b5c0ceb55135df7b7a621a891cf59f49cc67d6c/lib/utils.js#L11-L19
train
switer/chainjs
lib/utils.js
function(context, handlers/*, params*/ ) { var args = this.slice(arguments) args.shift() args.shift() this.each(handlers, function(handler) { if (handler) handler.apply(context, args) }) }
javascript
function(context, handlers/*, params*/ ) { var args = this.slice(arguments) args.shift() args.shift() this.each(handlers, function(handler) { if (handler) handler.apply(context, args) }) }
[ "function", "(", "context", ",", "handlers", "/*, params*/", ")", "{", "var", "args", "=", "this", ".", "slice", "(", "arguments", ")", "args", ".", "shift", "(", ")", "args", ".", "shift", "(", ")", "this", ".", "each", "(", "handlers", ",", "functi...
Invoke handlers in batch process
[ "Invoke", "handlers", "in", "batch", "process" ]
7b5c0ceb55135df7b7a621a891cf59f49cc67d6c
https://github.com/switer/chainjs/blob/7b5c0ceb55135df7b7a621a891cf59f49cc67d6c/lib/utils.js#L32-L39
train
switer/chainjs
lib/utils.js
function(array) { // return Array.prototype.slice.call(array) var i = array.length var a = new Array(i) while(i) { i -- a[i] = array[i] } return a }
javascript
function(array) { // return Array.prototype.slice.call(array) var i = array.length var a = new Array(i) while(i) { i -- a[i] = array[i] } return a }
[ "function", "(", "array", ")", "{", "// return Array.prototype.slice.call(array)", "var", "i", "=", "array", ".", "length", "var", "a", "=", "new", "Array", "(", "i", ")", "while", "(", "i", ")", "{", "i", "--", "a", "[", "i", "]", "=", "array", "[",...
Array.slice
[ "Array", ".", "slice" ]
7b5c0ceb55135df7b7a621a891cf59f49cc67d6c
https://github.com/switer/chainjs/blob/7b5c0ceb55135df7b7a621a891cf59f49cc67d6c/lib/utils.js#L53-L62
train
switer/chainjs
lib/utils.js
function(obj, extObj) { this.each(extObj, function(value, key) { if (extObj.hasOwnProperty(key)) obj[key] = value }) return obj }
javascript
function(obj, extObj) { this.each(extObj, function(value, key) { if (extObj.hasOwnProperty(key)) obj[key] = value }) return obj }
[ "function", "(", "obj", ",", "extObj", ")", "{", "this", ".", "each", "(", "extObj", ",", "function", "(", "value", ",", "key", ")", "{", "if", "(", "extObj", ".", "hasOwnProperty", "(", "key", ")", ")", "obj", "[", "key", "]", "=", "value", "}",...
Merge for extObj to obj
[ "Merge", "for", "extObj", "to", "obj" ]
7b5c0ceb55135df7b7a621a891cf59f49cc67d6c
https://github.com/switer/chainjs/blob/7b5c0ceb55135df7b7a621a891cf59f49cc67d6c/lib/utils.js#L66-L71
train
switer/chainjs
lib/utils.js
function (f, proto) { function Ctor() {} Ctor.prototype = proto f.prototype = new Ctor() f.prototype.constructor = Ctor return f }
javascript
function (f, proto) { function Ctor() {} Ctor.prototype = proto f.prototype = new Ctor() f.prototype.constructor = Ctor return f }
[ "function", "(", "f", ",", "proto", ")", "{", "function", "Ctor", "(", ")", "{", "}", "Ctor", ".", "prototype", "=", "proto", "f", ".", "prototype", "=", "new", "Ctor", "(", ")", "f", ".", "prototype", ".", "constructor", "=", "Ctor", "return", "f"...
Create a class with specified proto
[ "Create", "a", "class", "with", "specified", "proto" ]
7b5c0ceb55135df7b7a621a891cf59f49cc67d6c
https://github.com/switer/chainjs/blob/7b5c0ceb55135df7b7a621a891cf59f49cc67d6c/lib/utils.js#L84-L90
train
bholloway/browserify-debug-tools
lib/inspect.js
inspect
function inspect(callback) { return function (filename) { var chunks = []; function transform(chunk, encoding, done) { /* jshint validthis:true */ chunks.push(chunk); this.push(chunk); done(); } function flush(done) { callback(filename, chunks.join(''), done); if ...
javascript
function inspect(callback) { return function (filename) { var chunks = []; function transform(chunk, encoding, done) { /* jshint validthis:true */ chunks.push(chunk); this.push(chunk); done(); } function flush(done) { callback(filename, chunks.join(''), done); if ...
[ "function", "inspect", "(", "callback", ")", "{", "return", "function", "(", "filename", ")", "{", "var", "chunks", "=", "[", "]", ";", "function", "transform", "(", "chunk", ",", "encoding", ",", "done", ")", "{", "/* jshint validthis:true */", "chunks", ...
Call the given method for each file on its completion. @param {function(string,string,[function])} callback A method to call with name, contents, and optional async done
[ "Call", "the", "given", "method", "for", "each", "file", "on", "its", "completion", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/inspect.js#L7-L27
train
boylesoftware/x2node-dbos
lib/query-tree-builder.js
getKeyColumn
function getKeyColumn(propDesc, keyPropContainer) { if (propDesc.keyColumn) return propDesc.keyColumn; const keyPropDesc = keyPropContainer.getPropertyDesc( propDesc.keyPropertyName); return keyPropDesc.column; }
javascript
function getKeyColumn(propDesc, keyPropContainer) { if (propDesc.keyColumn) return propDesc.keyColumn; const keyPropDesc = keyPropContainer.getPropertyDesc( propDesc.keyPropertyName); return keyPropDesc.column; }
[ "function", "getKeyColumn", "(", "propDesc", ",", "keyPropContainer", ")", "{", "if", "(", "propDesc", ".", "keyColumn", ")", "return", "propDesc", ".", "keyColumn", ";", "const", "keyPropDesc", "=", "keyPropContainer", ".", "getPropertyDesc", "(", "propDesc", "...
Get map key column. @private @param {module:x2node-records~PropertyDescriptor} propDesc Map property descriptor. @param {module:x2node-records~PropertiesContainer} keyPropContainer Container where to look for the key property, if applicable. @returns {string} Column name.
[ "Get", "map", "key", "column", "." ]
d7b847d859b79dce0c46e04788201e05d5a70886
https://github.com/boylesoftware/x2node-dbos/blob/d7b847d859b79dce0c46e04788201e05d5a70886/lib/query-tree-builder.js#L30-L36
train
boylesoftware/x2node-dbos
lib/query-tree-builder.js
makeSelector
function makeSelector(sql, markup) { return { sql: (sql instanceof Translatable ? sql.translate.bind(sql) : sql), markup: markup }; }
javascript
function makeSelector(sql, markup) { return { sql: (sql instanceof Translatable ? sql.translate.bind(sql) : sql), markup: markup }; }
[ "function", "makeSelector", "(", "sql", ",", "markup", ")", "{", "return", "{", "sql", ":", "(", "sql", "instanceof", "Translatable", "?", "sql", ".", "translate", ".", "bind", "(", "sql", ")", ":", "sql", ")", ",", "markup", ":", "markup", "}", ";",...
Create and return an object for the select list element. @private @param {(string|module:x2node-dbos~Translatable|function)} sql The value, which can be a SQL expression, a value expression object or a SQL translation function. @param {string} markup Markup for the result set parser. @returns {Object} The select list ...
[ "Create", "and", "return", "an", "object", "for", "the", "select", "list", "element", "." ]
d7b847d859b79dce0c46e04788201e05d5a70886
https://github.com/boylesoftware/x2node-dbos/blob/d7b847d859b79dce0c46e04788201e05d5a70886/lib/query-tree-builder.js#L48-L53
train
boylesoftware/x2node-dbos
lib/query-tree-builder.js
makeOrderElement
function makeOrderElement(sql) { return { sql: (sql instanceof Translatable ? sql.translate.bind(sql) : sql) }; }
javascript
function makeOrderElement(sql) { return { sql: (sql instanceof Translatable ? sql.translate.bind(sql) : sql) }; }
[ "function", "makeOrderElement", "(", "sql", ")", "{", "return", "{", "sql", ":", "(", "sql", "instanceof", "Translatable", "?", "sql", ".", "translate", ".", "bind", "(", "sql", ")", ":", "sql", ")", "}", ";", "}" ]
Create and return an object for the order list element. @private @param {(string|module:x2node-dbos~Translatable|function)} sql The value, which can be a SQL expression, a value expression object or a SQL translation function. @returns {Object} The order list element descriptor.
[ "Create", "and", "return", "an", "object", "for", "the", "order", "list", "element", "." ]
d7b847d859b79dce0c46e04788201e05d5a70886
https://github.com/boylesoftware/x2node-dbos/blob/d7b847d859b79dce0c46e04788201e05d5a70886/lib/query-tree-builder.js#L64-L68
train
boylesoftware/x2node-dbos
lib/query-tree-builder.js
buildQueryTree
function buildQueryTree( dbDriver, recordTypes, propsTree, anchorNode, clauses, singleAxis) { // get and validate top records specification data const recordTypeDesc = recordTypes.getRecordTypeDesc( propsTree.desc.refTarget); const topIdPropName = recordTypeDesc.idPropertyName; const topIdColumn = recordTypeDes...
javascript
function buildQueryTree( dbDriver, recordTypes, propsTree, anchorNode, clauses, singleAxis) { // get and validate top records specification data const recordTypeDesc = recordTypes.getRecordTypeDesc( propsTree.desc.refTarget); const topIdPropName = recordTypeDesc.idPropertyName; const topIdColumn = recordTypeDes...
[ "function", "buildQueryTree", "(", "dbDriver", ",", "recordTypes", ",", "propsTree", ",", "anchorNode", ",", "clauses", ",", "singleAxis", ")", "{", "// get and validate top records specification data", "const", "recordTypeDesc", "=", "recordTypes", ".", "getRecordTypeDes...
Build query tree. @private @param {module:x2node-dbos.DBDriver} dbDriver The database driver. @param {module:x2node-records~RecordTypesLibrary} recordTypes Record types library. @param {module:x2node-dbos~PropertyTreeNode} propsTree Selected properties tree. @param {module:x2node-dbos~QueryTreeNode} [anchorNode] Ancho...
[ "Build", "query", "tree", "." ]
d7b847d859b79dce0c46e04788201e05d5a70886
https://github.com/boylesoftware/x2node-dbos/blob/d7b847d859b79dce0c46e04788201e05d5a70886/lib/query-tree-builder.js#L1662-L1705
train
aaronabramov/esfmt
package/list.js
long
function long(nodes, context, recur, wrap) { context.write(WRAPPERS[wrap].left); for (var i = 0; i < nodes.length; i++) { recur(nodes[i]); if (nodes[i + 1]) { context.write(', ');}} context.write(WRAPPERS[wrap].right);}
javascript
function long(nodes, context, recur, wrap) { context.write(WRAPPERS[wrap].left); for (var i = 0; i < nodes.length; i++) { recur(nodes[i]); if (nodes[i + 1]) { context.write(', ');}} context.write(WRAPPERS[wrap].right);}
[ "function", "long", "(", "nodes", ",", "context", ",", "recur", ",", "wrap", ")", "{", "context", ".", "write", "(", "WRAPPERS", "[", "wrap", "]", ".", "left", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", "...
Render the long version of the list @example [1, 2, 3, 4, 5]
[ "Render", "the", "long", "version", "of", "the", "list" ]
8e05fa01d777d504f965ba484c287139a00b5b00
https://github.com/aaronabramov/esfmt/blob/8e05fa01d777d504f965ba484c287139a00b5b00/package/list.js#L28-L39
train
aaronabramov/esfmt
package/list.js
short
function short(nodes, context, recur, wrap) { context.write(WRAPPERS[wrap].left); context.indentIn(); context.write('\n'); for (var i = 0; i < nodes.length; i++) { context.write(context.getIndent()); recur(nodes[i]); if (nodes[i + 1]) { context.write(',\n');}} ...
javascript
function short(nodes, context, recur, wrap) { context.write(WRAPPERS[wrap].left); context.indentIn(); context.write('\n'); for (var i = 0; i < nodes.length; i++) { context.write(context.getIndent()); recur(nodes[i]); if (nodes[i + 1]) { context.write(',\n');}} ...
[ "function", "short", "(", "nodes", ",", "context", ",", "recur", ",", "wrap", ")", "{", "context", ".", "write", "(", "WRAPPERS", "[", "wrap", "]", ".", "left", ")", ";", "context", ".", "indentIn", "(", ")", ";", "context", ".", "write", "(", "'\\...
Render the short or compact version of the list @example [ 1, 2, 3, 4 ]
[ "Render", "the", "short", "or", "compact", "version", "of", "the", "list" ]
8e05fa01d777d504f965ba484c287139a00b5b00
https://github.com/aaronabramov/esfmt/blob/8e05fa01d777d504f965ba484c287139a00b5b00/package/list.js#L53-L68
train
meetings/gearsloth
lib/gearman/multiserver-worker.js
MultiserverWorker
function MultiserverWorker(servers, func_name, callback, options) { var that = this; options = options || {}; Multiserver.call(this, servers, function(server, index) { return new gearman.Worker(func_name, function(payload, worker) { that._debug('received job from', that._serverString(index)); retu...
javascript
function MultiserverWorker(servers, func_name, callback, options) { var that = this; options = options || {}; Multiserver.call(this, servers, function(server, index) { return new gearman.Worker(func_name, function(payload, worker) { that._debug('received job from', that._serverString(index)); retu...
[ "function", "MultiserverWorker", "(", "servers", ",", "func_name", ",", "callback", ",", "options", ")", "{", "var", "that", "=", "this", ";", "options", "=", "options", "||", "{", "}", ";", "Multiserver", ".", "call", "(", "this", ",", "servers", ",", ...
A gearman worker that supports multiple servers. Contains multiple gearman-coffee workers that are each connected to a different server. The workers all run in the same thread Servers are provided in an array of json-objects, possible fields are: `.host`: a string that identifies a gearman job server host `.port`: ...
[ "A", "gearman", "worker", "that", "supports", "multiple", "servers", ".", "Contains", "multiple", "gearman", "-", "coffee", "workers", "that", "are", "each", "connected", "to", "a", "different", "server", ".", "The", "workers", "all", "run", "in", "the", "sa...
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/gearman/multiserver-worker.js#L25-L38
train
cliffano/ae86
lib/cli.js
exec
function exec() { var actions = { commands: { init: { action: _init }, gen: { action: _gen }, watch: { action: _watch }, drift: { action: _watch }, clean: { action: _clean } } }; bag.command(__dirname, actions); }
javascript
function exec() { var actions = { commands: { init: { action: _init }, gen: { action: _gen }, watch: { action: _watch }, drift: { action: _watch }, clean: { action: _clean } } }; bag.command(__dirname, actions); }
[ "function", "exec", "(", ")", "{", "var", "actions", "=", "{", "commands", ":", "{", "init", ":", "{", "action", ":", "_init", "}", ",", "gen", ":", "{", "action", ":", "_gen", "}", ",", "watch", ":", "{", "action", ":", "_watch", "}", ",", "dr...
Execute AE86 CLI.
[ "Execute", "AE86", "CLI", "." ]
7687e438a93638231bf7d2bebe1e8b062082a9a3
https://github.com/cliffano/ae86/blob/7687e438a93638231bf7d2bebe1e8b062082a9a3/lib/cli.js#L30-L43
train
observing/fossa
lib/predefine.js
pluck
function pluck(data) { // // Either map as array or return object through single map. // if (Array.isArray(data)) return data.map(map); return map(data); /** * Recursive mapping function. * * @param {Object} d Collection, Model or plain object. * @returns {Object} plucked ob...
javascript
function pluck(data) { // // Either map as array or return object through single map. // if (Array.isArray(data)) return data.map(map); return map(data); /** * Recursive mapping function. * * @param {Object} d Collection, Model or plain object. * @returns {Object} plucked ob...
[ "function", "pluck", "(", "data", ")", "{", "//", "// Either map as array or return object through single map.", "//", "if", "(", "Array", ".", "isArray", "(", "data", ")", ")", "return", "data", ".", "map", "(", "map", ")", ";", "return", "map", "(", "data"...
Recursively pluck attributes from either a Model or Collection. @param {Array|Object} data Array of Models or single Model @returns {Mixed} Object or Array of objects @api private
[ "Recursively", "pluck", "attributes", "from", "either", "a", "Model", "or", "Collection", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/predefine.js#L281-L317
train
observing/fossa
lib/predefine.js
map
function map(d) { if (isModel(d)) return pluck(d.attributes); for (var key in d) { if (isCollection(d[key])) { d[key] = pluck(d[key].models); } if (isModel(d[key])) { // // Delete MongoDB ObjectIDs. The stored state of the model is ambigious ...
javascript
function map(d) { if (isModel(d)) return pluck(d.attributes); for (var key in d) { if (isCollection(d[key])) { d[key] = pluck(d[key].models); } if (isModel(d[key])) { // // Delete MongoDB ObjectIDs. The stored state of the model is ambigious ...
[ "function", "map", "(", "d", ")", "{", "if", "(", "isModel", "(", "d", ")", ")", "return", "pluck", "(", "d", ".", "attributes", ")", ";", "for", "(", "var", "key", "in", "d", ")", "{", "if", "(", "isCollection", "(", "d", "[", "key", "]", ")...
Recursive mapping function. @param {Object} d Collection, Model or plain object. @returns {Object} plucked object @api private
[ "Recursive", "mapping", "function", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/predefine.js#L295-L316
train
observing/fossa
lib/predefine.js
persist
function persist(client, next) { var single = isModel(item) , data; switch (method) { case 'create': data = single ? [ item.clone() ] : item.clone().models; client.insert(pluck(data), config, function inserted(error, results) { if (error) return next(error); // ...
javascript
function persist(client, next) { var single = isModel(item) , data; switch (method) { case 'create': data = single ? [ item.clone() ] : item.clone().models; client.insert(pluck(data), config, function inserted(error, results) { if (error) return next(error); // ...
[ "function", "persist", "(", "client", ",", "next", ")", "{", "var", "single", "=", "isModel", "(", "item", ")", ",", "data", ";", "switch", "(", "method", ")", "{", "case", "'create'", ":", "data", "=", "single", "?", "[", "item", ".", "clone", "("...
Persist item data to MongoDB. @param {Object} client Fossa MongoDB client @param {Function} next callback @api private
[ "Persist", "item", "data", "to", "MongoDB", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/predefine.js#L326-L413
train
observing/fossa
lib/predefine.js
after
function after(results, next) { item.trigger('after:' + method, function done(error) { next(error, results); }); }
javascript
function after(results, next) { item.trigger('after:' + method, function done(error) { next(error, results); }); }
[ "function", "after", "(", "results", ",", "next", ")", "{", "item", ".", "trigger", "(", "'after:'", "+", "method", ",", "function", "done", "(", "error", ")", "{", "next", "(", "error", ",", "results", ")", ";", "}", ")", ";", "}" ]
Trigger execution of after hooks, pass results from the peristence to keep it consistent with the callback of persistance if no after hooks are provided. @param {Object} results of persistence @param {Function} next callback @api private
[ "Trigger", "execution", "of", "after", "hooks", "pass", "results", "from", "the", "peristence", "to", "keep", "it", "consistent", "with", "the", "callback", "of", "persistance", "if", "no", "after", "hooks", "are", "provided", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/predefine.js#L423-L427
train
tianjianchn/javascript-packages
packages/frm/src/record/create.js
createRecord
function createRecord(fvs, options) { options || (options = {}); const model = this; const row = {}; if (fvs) { for (const kk in fvs) { row[kk] = fvs[kk]; } } const r = constructRecord(model, row, Object.keys(model.def.fields), true); getDefaultOnCreate(r, null, options.createdBy); return...
javascript
function createRecord(fvs, options) { options || (options = {}); const model = this; const row = {}; if (fvs) { for (const kk in fvs) { row[kk] = fvs[kk]; } } const r = constructRecord(model, row, Object.keys(model.def.fields), true); getDefaultOnCreate(r, null, options.createdBy); return...
[ "function", "createRecord", "(", "fvs", ",", "options", ")", "{", "options", "||", "(", "options", "=", "{", "}", ")", ";", "const", "model", "=", "this", ";", "const", "row", "=", "{", "}", ";", "if", "(", "fvs", ")", "{", "for", "(", "const", ...
this = model
[ "this", "=", "model" ]
3abe85edbfe323939c84c1d02128d74d6374bcde
https://github.com/tianjianchn/javascript-packages/blob/3abe85edbfe323939c84c1d02128d74d6374bcde/packages/frm/src/record/create.js#L11-L24
train
bernardodiasc/filestojson
src/index.js
readDirSync
function readDirSync (dir, allFiles = []) { const files = fs.readdirSync(dir).map(f => join(dir, f)) allFiles.push(...files) files.forEach(f => { fs.statSync(f).isDirectory() && readDirSync(f, allFiles) }) return allFiles }
javascript
function readDirSync (dir, allFiles = []) { const files = fs.readdirSync(dir).map(f => join(dir, f)) allFiles.push(...files) files.forEach(f => { fs.statSync(f).isDirectory() && readDirSync(f, allFiles) }) return allFiles }
[ "function", "readDirSync", "(", "dir", ",", "allFiles", "=", "[", "]", ")", "{", "const", "files", "=", "fs", ".", "readdirSync", "(", "dir", ")", ".", "map", "(", "f", "=>", "join", "(", "dir", ",", "f", ")", ")", "allFiles", ".", "push", "(", ...
Reads content directory and return all files @param {String} dir Content path @param {Array} allFiles Partial list of files and directories @return {Array} List of files and directories
[ "Reads", "content", "directory", "and", "return", "all", "files" ]
4ccd4454d1fe0408001b1f9f57ed89d19e38256e
https://github.com/bernardodiasc/filestojson/blob/4ccd4454d1fe0408001b1f9f57ed89d19e38256e/src/index.js#L29-L36
train
bernardodiasc/filestojson
src/index.js
getData
function getData (allFiles = [], config) { const files = allFiles.reduce((memo, iteratee) => { const filePath = path.parse(iteratee) if (config.include.includes(filePath.ext) && !config.exclude.includes(filePath.base)) { const newFile = { file: iteratee.replace(config.content, ''), dir: ...
javascript
function getData (allFiles = [], config) { const files = allFiles.reduce((memo, iteratee) => { const filePath = path.parse(iteratee) if (config.include.includes(filePath.ext) && !config.exclude.includes(filePath.base)) { const newFile = { file: iteratee.replace(config.content, ''), dir: ...
[ "function", "getData", "(", "allFiles", "=", "[", "]", ",", "config", ")", "{", "const", "files", "=", "allFiles", ".", "reduce", "(", "(", "memo", ",", "iteratee", ")", "=>", "{", "const", "filePath", "=", "path", ".", "parse", "(", "iteratee", ")",...
Get data from list of files filtered based on options @param {Array} allFiles List of files and directories @return {Array} Updated list of files with content
[ "Get", "data", "from", "list", "of", "files", "filtered", "based", "on", "options" ]
4ccd4454d1fe0408001b1f9f57ed89d19e38256e
https://github.com/bernardodiasc/filestojson/blob/4ccd4454d1fe0408001b1f9f57ed89d19e38256e/src/index.js#L43-L69
train
bernardodiasc/filestojson
src/index.js
translate
function translate (content, contentTypes) { let output = {} content.forEach(each => { const base = path.parse(each.file).base if (base === 'index.md') { const type = each.dir.split('/').pop() const contentTypeTranslation = contentTypes.find(contentType => contentType[type]) if (contentTyp...
javascript
function translate (content, contentTypes) { let output = {} content.forEach(each => { const base = path.parse(each.file).base if (base === 'index.md') { const type = each.dir.split('/').pop() const contentTypeTranslation = contentTypes.find(contentType => contentType[type]) if (contentTyp...
[ "function", "translate", "(", "content", ",", "contentTypes", ")", "{", "let", "output", "=", "{", "}", "content", ".", "forEach", "(", "each", "=>", "{", "const", "base", "=", "path", ".", "parse", "(", "each", ".", "file", ")", ".", "base", "if", ...
Translate data based on content types @param {Array} file List of contents @return {Array} Updated list of contents
[ "Translate", "data", "based", "on", "content", "types" ]
4ccd4454d1fe0408001b1f9f57ed89d19e38256e
https://github.com/bernardodiasc/filestojson/blob/4ccd4454d1fe0408001b1f9f57ed89d19e38256e/src/index.js#L76-L89
train
bernardodiasc/filestojson
src/index.js
write
function write (filename, content) { const json = JSON.stringify(content, (key, value) => value === undefined ? null : value) fs.writeFileSync(filename, json) return json }
javascript
function write (filename, content) { const json = JSON.stringify(content, (key, value) => value === undefined ? null : value) fs.writeFileSync(filename, json) return json }
[ "function", "write", "(", "filename", ",", "content", ")", "{", "const", "json", "=", "JSON", ".", "stringify", "(", "content", ",", "(", "key", ",", "value", ")", "=>", "value", "===", "undefined", "?", "null", ":", "value", ")", "fs", ".", "writeFi...
Write output data in file system @param {String} filename Output file name @param {Array} content List of contents @return {String} Stringified list of contents
[ "Write", "output", "data", "in", "file", "system" ]
4ccd4454d1fe0408001b1f9f57ed89d19e38256e
https://github.com/bernardodiasc/filestojson/blob/4ccd4454d1fe0408001b1f9f57ed89d19e38256e/src/index.js#L97-L101
train
tianjianchn/javascript-packages
packages/jstr/index.js
parse
function parse(html, script, filePath){ var m, index = 0;//the index in the html string while(m = reDelim.exec(html)) { addLiteral(script, html.slice(index, m.index));//string addCode(script, m, filePath); index = m.index + m[0].length; } addLiteral(script, html.slice(index)); script.push(...
javascript
function parse(html, script, filePath){ var m, index = 0;//the index in the html string while(m = reDelim.exec(html)) { addLiteral(script, html.slice(index, m.index));//string addCode(script, m, filePath); index = m.index + m[0].length; } addLiteral(script, html.slice(index)); script.push(...
[ "function", "parse", "(", "html", ",", "script", ",", "filePath", ")", "{", "var", "m", ",", "index", "=", "0", ";", "//the index in the html string\r", "while", "(", "m", "=", "reDelim", ".", "exec", "(", "html", ")", ")", "{", "addLiteral", "(", "scr...
parse the html string to js script
[ "parse", "the", "html", "string", "to", "js", "script" ]
3abe85edbfe323939c84c1d02128d74d6374bcde
https://github.com/tianjianchn/javascript-packages/blob/3abe85edbfe323939c84c1d02128d74d6374bcde/packages/jstr/index.js#L112-L123
train
tianjianchn/javascript-packages
packages/jstr/index.js
addLiteral
function addLiteral(script, str){ if(!str) return; str = str.replace(/\\|'/g, '\\$&');// escape ' var m, index = 0; while(m = reNewline.exec(str)){ var nl = m[0]; var es = nl==='\r\n'? '\\r\\n':'\\n'; script.push("__p('" + str.slice(index, m.index) + es + "');\n"); index = m.index + nl...
javascript
function addLiteral(script, str){ if(!str) return; str = str.replace(/\\|'/g, '\\$&');// escape ' var m, index = 0; while(m = reNewline.exec(str)){ var nl = m[0]; var es = nl==='\r\n'? '\\r\\n':'\\n'; script.push("__p('" + str.slice(index, m.index) + es + "');\n"); index = m.index + nl...
[ "function", "addLiteral", "(", "script", ",", "str", ")", "{", "if", "(", "!", "str", ")", "return", ";", "str", "=", "str", ".", "replace", "(", "/", "\\\\|'", "/", "g", ",", "'\\\\$&'", ")", ";", "// escape '\r", "var", "m", ",", "index", "=", ...
the literal, which is out of delimiters, like @>literal here<@
[ "the", "literal", "which", "is", "out", "of", "delimiters", "like" ]
3abe85edbfe323939c84c1d02128d74d6374bcde
https://github.com/tianjianchn/javascript-packages/blob/3abe85edbfe323939c84c1d02128d74d6374bcde/packages/jstr/index.js#L126-L139
train
tianjianchn/javascript-packages
packages/jstr/index.js
addCode
function addCode(script, match, filePath) { var leftDeli = match[1], code = match[2]; if(leftDeli==='<@' || leftDeli==='<!--@='){ script.push('__p(escape(' + code + '));'); } else if(leftDeli==='<@|' || leftDeli==='<!--@|'){//no escape script.push('__p(' + code + ');'); } else{//<!--@ --> ...
javascript
function addCode(script, match, filePath) { var leftDeli = match[1], code = match[2]; if(leftDeli==='<@' || leftDeli==='<!--@='){ script.push('__p(escape(' + code + '));'); } else if(leftDeli==='<@|' || leftDeli==='<!--@|'){//no escape script.push('__p(' + code + ');'); } else{//<!--@ --> ...
[ "function", "addCode", "(", "script", ",", "match", ",", "filePath", ")", "{", "var", "leftDeli", "=", "match", "[", "1", "]", ",", "code", "=", "match", "[", "2", "]", ";", "if", "(", "leftDeli", "===", "'<@'", "||", "leftDeli", "===", "'<!--@='", ...
the code, which is in the delimiters
[ "the", "code", "which", "is", "in", "the", "delimiters" ]
3abe85edbfe323939c84c1d02128d74d6374bcde
https://github.com/tianjianchn/javascript-packages/blob/3abe85edbfe323939c84c1d02128d74d6374bcde/packages/jstr/index.js#L142-L163
train
kuno/neco
deps/npm/lib/init.js
defaultName
function defaultName (folder, data) { if (data.name) return data.name return path.basename(folder).replace(/^node[_-]?|[-\.]?js$/g, '') }
javascript
function defaultName (folder, data) { if (data.name) return data.name return path.basename(folder).replace(/^node[_-]?|[-\.]?js$/g, '') }
[ "function", "defaultName", "(", "folder", ",", "data", ")", "{", "if", "(", "data", ".", "name", ")", "return", "data", ".", "name", "return", "path", ".", "basename", "(", "folder", ")", ".", "replace", "(", "/", "^node[_-]?|[-\\.]?js$", "/", "g", ","...
sync - no io
[ "sync", "-", "no", "io" ]
cf6361c1fcb9466c6b2ab3b127b5d0160ca50735
https://github.com/kuno/neco/blob/cf6361c1fcb9466c6b2ab3b127b5d0160ca50735/deps/npm/lib/init.js#L209-L212
train
chrisJohn404/LabJack-nodejs
lib/driver.js
DriverOperationError
function DriverOperationError(code,description) { this.code = code; this.description = description; console.log('in DriverOperationError',code,description); }
javascript
function DriverOperationError(code,description) { this.code = code; this.description = description; console.log('in DriverOperationError',code,description); }
[ "function", "DriverOperationError", "(", "code", ",", "description", ")", "{", "this", ".", "code", "=", "code", ";", "this", ".", "description", "=", "description", ";", "console", ".", "log", "(", "'in DriverOperationError'", ",", "code", ",", "description",...
For problems encountered while in driver DLL
[ "For", "problems", "encountered", "while", "in", "driver", "DLL" ]
6f638eb039f3e1619e46ba5aac20d827fecafc29
https://github.com/chrisJohn404/LabJack-nodejs/blob/6f638eb039f3e1619e46ba5aac20d827fecafc29/lib/driver.js#L23-L27
train
chrisJohn404/LabJack-nodejs
lib/driver.js
function(me, deviceType, connectionType) { if (!self.hasOpenAll) { throw new DriverInterfaceError( 'openAll is not loaded. Use ListAll and Open functions instead.' ); } if (deviceType === undefined || connectionType === undefined) { throw 'Ins...
javascript
function(me, deviceType, connectionType) { if (!self.hasOpenAll) { throw new DriverInterfaceError( 'openAll is not loaded. Use ListAll and Open functions instead.' ); } if (deviceType === undefined || connectionType === undefined) { throw 'Ins...
[ "function", "(", "me", ",", "deviceType", ",", "connectionType", ")", "{", "if", "(", "!", "self", ".", "hasOpenAll", ")", "{", "throw", "new", "DriverInterfaceError", "(", "'openAll is not loaded. Use ListAll and Open functions instead.'", ")", ";", "}", "if", "(...
Internal helper function to prepare the arguments for an OpenAll call.
[ "Internal", "helper", "function", "to", "prepare", "the", "arguments", "for", "an", "OpenAll", "call", "." ]
6f638eb039f3e1619e46ba5aac20d827fecafc29
https://github.com/chrisJohn404/LabJack-nodejs/blob/6f638eb039f3e1619e46ba5aac20d827fecafc29/lib/driver.js#L674-L697
train
rkusa/swac
lib/routing.js
done
function done() { // get the next route from the stack route = stack.pop() var callback // if the stack is not empty yet, i.e., if this is not // the last route part, the callback standard callback is provided if (stack.length) { callback = done } // otherwise a slightly modified ...
javascript
function done() { // get the next route from the stack route = stack.pop() var callback // if the stack is not empty yet, i.e., if this is not // the last route part, the callback standard callback is provided if (stack.length) { callback = done } // otherwise a slightly modified ...
[ "function", "done", "(", ")", "{", "// get the next route from the stack", "route", "=", "stack", ".", "pop", "(", ")", "var", "callback", "// if the stack is not empty yet, i.e., if this is not", "// the last route part, the callback standard callback is provided", "if", "(", ...
the callback method that is provided to each route node
[ "the", "callback", "method", "that", "is", "provided", "to", "each", "route", "node" ]
930c5618bc257fd8bceade6875f126a742b45828
https://github.com/rkusa/swac/blob/930c5618bc257fd8bceade6875f126a742b45828/lib/routing.js#L214-L237
train
meetings/gearsloth
lib/daemon/ejector.js
Ejector
function Ejector(conf) { component.Component.call(this, 'ejector', conf); var that = this; this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { worker: { func_name: 'delayedJobDone', func: function(payload, worker) { var task = JSON.parse(payload.toString()); that._in...
javascript
function Ejector(conf) { component.Component.call(this, 'ejector', conf); var that = this; this._dbconn = conf.dbconn; this.registerGearman(conf.servers, { worker: { func_name: 'delayedJobDone', func: function(payload, worker) { var task = JSON.parse(payload.toString()); that._in...
[ "function", "Ejector", "(", "conf", ")", "{", "component", ".", "Component", ".", "call", "(", "this", ",", "'ejector'", ",", "conf", ")", ";", "var", "that", "=", "this", ";", "this", ".", "_dbconn", "=", "conf", ".", "dbconn", ";", "this", ".", "...
Ejector component. Emits 'connect' when at least one server is connected.
[ "Ejector", "component", ".", "Emits", "connect", "when", "at", "least", "one", "server", "is", "connected", "." ]
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/daemon/ejector.js#L8-L22
train
angeloocana/ptz-math
dist-esnext/index.js
getRandomItem
function getRandomItem(list) { if (!list) return null; if (list.length === 0) return list[0]; const randomIndex = random(1, list.length) - 1; return list[randomIndex]; }
javascript
function getRandomItem(list) { if (!list) return null; if (list.length === 0) return list[0]; const randomIndex = random(1, list.length) - 1; return list[randomIndex]; }
[ "function", "getRandomItem", "(", "list", ")", "{", "if", "(", "!", "list", ")", "return", "null", ";", "if", "(", "list", ".", "length", "===", "0", ")", "return", "list", "[", "0", "]", ";", "const", "randomIndex", "=", "random", "(", "1", ",", ...
Gets some random item from the given array. @param list
[ "Gets", "some", "random", "item", "from", "the", "given", "array", "." ]
25f17ec0fb9b62b4459d6bc43074c349811f682d
https://github.com/angeloocana/ptz-math/blob/25f17ec0fb9b62b4459d6bc43074c349811f682d/dist-esnext/index.js#L10-L17
train
cludden/app-container
lib/container.js
_loadRecursive
function _loadRecursive(container, map, accum = {}) { return Bluebird.reduce(Object.keys(map), (memo, key) => { const path = map[key]; if (typeof path === 'string') { return container._load(path) .then((mod) => { set(memo, key, mod); return memo; }); } return ...
javascript
function _loadRecursive(container, map, accum = {}) { return Bluebird.reduce(Object.keys(map), (memo, key) => { const path = map[key]; if (typeof path === 'string') { return container._load(path) .then((mod) => { set(memo, key, mod); return memo; }); } return ...
[ "function", "_loadRecursive", "(", "container", ",", "map", ",", "accum", "=", "{", "}", ")", "{", "return", "Bluebird", ".", "reduce", "(", "Object", ".", "keys", "(", "map", ")", ",", "(", "memo", ",", "key", ")", "=>", "{", "const", "path", "=",...
Recursively load a component map @param {Container} container @param {Object} map @param {Object} [accum={}] @return {Bluebird} @private
[ "Recursively", "load", "a", "component", "map" ]
cdae445179eaf240f414a004f1b28653b49f8549
https://github.com/cludden/app-container/blob/cdae445179eaf240f414a004f1b28653b49f8549/lib/container.js#L296-L312
train
cludden/app-container
lib/container.js
_recursiveDeps
function _recursiveDeps(graph, name, deps) { return Object.keys(deps).forEach((key) => { const dep = deps[key]; if (PLUGIN.test(dep)) { return; } if (typeof dep === 'string') { if (!graph.hasNode(dep)) { graph.addNode(dep); } graph.addDependency(name, dep); } else i...
javascript
function _recursiveDeps(graph, name, deps) { return Object.keys(deps).forEach((key) => { const dep = deps[key]; if (PLUGIN.test(dep)) { return; } if (typeof dep === 'string') { if (!graph.hasNode(dep)) { graph.addNode(dep); } graph.addDependency(name, dep); } else i...
[ "function", "_recursiveDeps", "(", "graph", ",", "name", ",", "deps", ")", "{", "return", "Object", ".", "keys", "(", "deps", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", "const", "dep", "=", "deps", "[", "key", "]", ";", "if", "(", "PLU...
Add recursive dependencies to dependency graph @param {DepGraph} graph @param {String} name - current node name @param {Object} deps - dependency map @private
[ "Add", "recursive", "dependencies", "to", "dependency", "graph" ]
cdae445179eaf240f414a004f1b28653b49f8549
https://github.com/cludden/app-container/blob/cdae445179eaf240f414a004f1b28653b49f8549/lib/container.js#L321-L336
train
bholloway/browserify-debug-tools
lib/profile.js
profile
function profile(excludeRegex) { var categories = []; return { forCategory: forCategory, toArray : toArray, toString : toString }; function toArray() { return categories; } function toString() { return categories .map(String) .filter(Boolean) .join('\n'); } ...
javascript
function profile(excludeRegex) { var categories = []; return { forCategory: forCategory, toArray : toArray, toString : toString }; function toArray() { return categories; } function toString() { return categories .map(String) .filter(Boolean) .join('\n'); } ...
[ "function", "profile", "(", "excludeRegex", ")", "{", "var", "categories", "=", "[", "]", ";", "return", "{", "forCategory", ":", "forCategory", ",", "toArray", ":", "toArray", ",", "toString", ":", "toString", "}", ";", "function", "toArray", "(", ")", ...
Analyse one or more transforms which perform a bulk action on stream flush. @param {RegExp} [excludeRegex] Optionally exclude files @returns {{forCategory:function, toArray:function, toString:function}} A new instance
[ "Analyse", "one", "or", "more", "transforms", "which", "perform", "a", "bulk", "action", "on", "stream", "flush", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/profile.js#L12-L236
train
bholloway/browserify-debug-tools
lib/profile.js
createEventTransform
function createEventTransform(data) { return inspect(onComplete); function onComplete(filename) { isUsed = true; var now = Date.now(); var events = eventsByFilename[filename] = eventsByFilename[filename] || []; events.push(now, data); } }
javascript
function createEventTransform(data) { return inspect(onComplete); function onComplete(filename) { isUsed = true; var now = Date.now(); var events = eventsByFilename[filename] = eventsByFilename[filename] || []; events.push(now, data); } }
[ "function", "createEventTransform", "(", "data", ")", "{", "return", "inspect", "(", "onComplete", ")", ";", "function", "onComplete", "(", "filename", ")", "{", "isUsed", "=", "true", ";", "var", "now", "=", "Date", ".", "now", "(", ")", ";", "var", "...
Create a transform that pushes time-stamped events data to the current filename. @param {*} data The event data @returns {function} A browserify transform that captures events on file contents complete
[ "Create", "a", "transform", "that", "pushes", "time", "-", "stamped", "events", "data", "to", "the", "current", "filename", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/profile.js#L73-L82
train
bholloway/browserify-debug-tools
lib/profile.js
report
function report() { return Object.keys(eventsByFilename) .filter(testIncluded) .reduce(reduceFilenames, {}); function testIncluded(filename) { return !excludeRegex || !excludeRegex.test(filename); } function reduceFilenames(reduced, filename) { var totalsByKey =...
javascript
function report() { return Object.keys(eventsByFilename) .filter(testIncluded) .reduce(reduceFilenames, {}); function testIncluded(filename) { return !excludeRegex || !excludeRegex.test(filename); } function reduceFilenames(reduced, filename) { var totalsByKey =...
[ "function", "report", "(", ")", "{", "return", "Object", ".", "keys", "(", "eventsByFilename", ")", ".", "filter", "(", "testIncluded", ")", ".", "reduce", "(", "reduceFilenames", ",", "{", "}", ")", ";", "function", "testIncluded", "(", "filename", ")", ...
Create a json report of time verses key verses filename.
[ "Create", "a", "json", "report", "of", "time", "verses", "key", "verses", "filename", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/profile.js#L87-L127
train
bholloway/browserify-debug-tools
lib/profile.js
rows
function rows() { var fileTotals = filenames.reduce(reducePropToLength.bind(json), {}), fileOrder = sort(fileTotals); return fileOrder.map(rowForFile); function rowForFile(filename) { var data = json[filename]; // console.log(JSON.stringify(data, null, 2)); ...
javascript
function rows() { var fileTotals = filenames.reduce(reducePropToLength.bind(json), {}), fileOrder = sort(fileTotals); return fileOrder.map(rowForFile); function rowForFile(filename) { var data = json[filename]; // console.log(JSON.stringify(data, null, 2)); ...
[ "function", "rows", "(", ")", "{", "var", "fileTotals", "=", "filenames", ".", "reduce", "(", "reducePropToLength", ".", "bind", "(", "json", ")", ",", "{", "}", ")", ",", "fileOrder", "=", "sort", "(", "fileTotals", ")", ";", "return", "fileOrder", "....
Map each filename to a data row, in decreasing time order.
[ "Map", "each", "filename", "to", "a", "data", "row", "in", "decreasing", "time", "order", "." ]
47aa05164d73ec7512bdd4a18db0e12fa6b96209
https://github.com/bholloway/browserify-debug-tools/blob/47aa05164d73ec7512bdd4a18db0e12fa6b96209/lib/profile.js#L167-L194
train
tdukai/bimo
dist/bimo.js
function (data) { // Add property to hold internal values Object.defineProperty(this, '_', { enumerable: false, configurable: false, writable: false, value: { dt: this._clone(data), ev: {}, df: {}, sp: false, ct: 0 ...
javascript
function (data) { // Add property to hold internal values Object.defineProperty(this, '_', { enumerable: false, configurable: false, writable: false, value: { dt: this._clone(data), ev: {}, df: {}, sp: false, ct: 0 ...
[ "function", "(", "data", ")", "{", "// Add property to hold internal values", "Object", ".", "defineProperty", "(", "this", ",", "'_'", ",", "{", "enumerable", ":", "false", ",", "configurable", ":", "false", ",", "writable", ":", "false", ",", "value", ":", ...
Model base class @class Model @param {object} content in simple javascript object format @constructor
[ "Model", "base", "class" ]
55c1ae3cabdd6ef0b0a710240692e30e81ec83c9
https://github.com/tdukai/bimo/blob/55c1ae3cabdd6ef0b0a710240692e30e81ec83c9/dist/bimo.js#L10-L28
train
opendxl/opendxl-bootstrap-javascript
lib/application.js
Application
function Application (configDir, appConfigFileName) { /** * The DXL client to use for communication with the fabric. * @private * @type {external.DxlClient} * @name Application#_dxlClient */ this._dxlClient = null /** * The directory containing the application configuration files. * @private ...
javascript
function Application (configDir, appConfigFileName) { /** * The DXL client to use for communication with the fabric. * @private * @type {external.DxlClient} * @name Application#_dxlClient */ this._dxlClient = null /** * The directory containing the application configuration files. * @private ...
[ "function", "Application", "(", "configDir", ",", "appConfigFileName", ")", "{", "/**\n * The DXL client to use for communication with the fabric.\n * @private\n * @type {external.DxlClient}\n * @name Application#_dxlClient\n */", "this", ".", "_dxlClient", "=", "null", "/**\n ...
Service registration instances are used to register and expose services onto a DXL fabric. @external ServiceRegistrationInfo @see {@link https://opendxl.github.io/opendxl-client-javascript/jsdoc/ServiceRegistrationInfo.html} @classdesc Base class used for DXL applications. @param {String} configDir - The directory co...
[ "Service", "registration", "instances", "are", "used", "to", "register", "and", "expose", "services", "onto", "a", "DXL", "fabric", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/application.js#L34-L113
train
nodys/polymerize
lib/transform.js
transform
function transform(filepath, options) { // Normalize options options = extend({ match: /bower_components.*\.html$/ }, options || {}) if(!(options.match instanceof RegExp)) { options.match = RegExp.apply(null, Array.isArray(options.match) ? options.match : [options.match]) } // Shim polymer.js ...
javascript
function transform(filepath, options) { // Normalize options options = extend({ match: /bower_components.*\.html$/ }, options || {}) if(!(options.match instanceof RegExp)) { options.match = RegExp.apply(null, Array.isArray(options.match) ? options.match : [options.match]) } // Shim polymer.js ...
[ "function", "transform", "(", "filepath", ",", "options", ")", "{", "// Normalize options", "options", "=", "extend", "(", "{", "match", ":", "/", "bower_components.*\\.html$", "/", "}", ",", "options", "||", "{", "}", ")", "if", "(", "!", "(", "options", ...
Browserify's transform function for polymerize @param {String} filepath @param {Object} [options] @return {Stream}
[ "Browserify", "s", "transform", "function", "for", "polymerize" ]
3f525ff5144c084ba4d501ab174828844f5a53dd
https://github.com/nodys/polymerize/blob/3f525ff5144c084ba4d501ab174828844f5a53dd/lib/transform.js#L14-L44
train
cliffano/ae86
lib/functions.js
include
function include(partial, cb) { cb((params.partials && params.partials[partial]) ? params.partials[partial] : '[error] partial ' + partial + ' does not exist'); }
javascript
function include(partial, cb) { cb((params.partials && params.partials[partial]) ? params.partials[partial] : '[error] partial ' + partial + ' does not exist'); }
[ "function", "include", "(", "partial", ",", "cb", ")", "{", "cb", "(", "(", "params", ".", "partials", "&&", "params", ".", "partials", "[", "partial", "]", ")", "?", "params", ".", "partials", "[", "partial", "]", ":", "'[error] partial '", "+", "part...
Include a partial template in the current page. An error message will be included when partial does not exist. @param {String} partial: partial template file to include @param {Function} cb: jazz cb(data) callback
[ "Include", "a", "partial", "template", "in", "the", "current", "page", ".", "An", "error", "message", "will", "be", "included", "when", "partial", "does", "not", "exist", "." ]
7687e438a93638231bf7d2bebe1e8b062082a9a3
https://github.com/cliffano/ae86/blob/7687e438a93638231bf7d2bebe1e8b062082a9a3/lib/functions.js#L32-L36
train
cliffano/ae86
lib/functions.js
title
function title(cb) { cb((params.sitemap && params.sitemap[page]) ? params.sitemap[page].title : '[error] page ' + page + ' does not have any sitemap title'); }
javascript
function title(cb) { cb((params.sitemap && params.sitemap[page]) ? params.sitemap[page].title : '[error] page ' + page + ' does not have any sitemap title'); }
[ "function", "title", "(", "cb", ")", "{", "cb", "(", "(", "params", ".", "sitemap", "&&", "params", ".", "sitemap", "[", "page", "]", ")", "?", "params", ".", "sitemap", "[", "page", "]", ".", "title", ":", "'[error] page '", "+", "page", "+", "' d...
Display current page's sitemap title. @param {Function} cb: jazz cb(data) callback
[ "Display", "current", "page", "s", "sitemap", "title", "." ]
7687e438a93638231bf7d2bebe1e8b062082a9a3
https://github.com/cliffano/ae86/blob/7687e438a93638231bf7d2bebe1e8b062082a9a3/lib/functions.js#L60-L64
train
opendxl/opendxl-bootstrap-javascript
lib/message-utils.js
function (value, encoding) { encoding = (typeof encoding === 'undefined') ? 'utf8' : encoding if (Buffer.isBuffer(value)) { value = value.toString(encoding) } return value }
javascript
function (value, encoding) { encoding = (typeof encoding === 'undefined') ? 'utf8' : encoding if (Buffer.isBuffer(value)) { value = value.toString(encoding) } return value }
[ "function", "(", "value", ",", "encoding", ")", "{", "encoding", "=", "(", "typeof", "encoding", "===", "'undefined'", ")", "?", "'utf8'", ":", "encoding", "if", "(", "Buffer", ".", "isBuffer", "(", "value", ")", ")", "{", "value", "=", "value", ".", ...
Decodes the specified value and returns it. @param {Buffer|String} value - The value. @param {String} encoding - The encoding. @returns {String} The decoded value
[ "Decodes", "the", "specified", "value", "and", "returns", "it", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/message-utils.js#L58-L64
train
opendxl/opendxl-bootstrap-javascript
lib/message-utils.js
function (message, encoding) { return module.exports.jsonToObject( module.exports.decodePayload(message, encoding)) }
javascript
function (message, encoding) { return module.exports.jsonToObject( module.exports.decodePayload(message, encoding)) }
[ "function", "(", "message", ",", "encoding", ")", "{", "return", "module", ".", "exports", ".", "jsonToObject", "(", "module", ".", "exports", ".", "decodePayload", "(", "message", ",", "encoding", ")", ")", "}" ]
Converts the specified message's payload from JSON to an object and returns it. @param {external:Message} message - The DXL message. @param {String} [encoding=utf8] - The encoding of the payload. @returns {Object} The object.
[ "Converts", "the", "specified", "message", "s", "payload", "from", "JSON", "to", "an", "object", "and", "returns", "it", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/message-utils.js#L91-L94
train
opendxl/opendxl-bootstrap-javascript
lib/message-utils.js
function (value, encoding) { encoding = (typeof encoding === 'undefined') ? 'utf8' : encoding var returnValue = value if (!Buffer.isBuffer(returnValue)) { if (value === null) { returnValue = '' } else if (typeof value === 'object') { returnValue = module.exports.objectToJson(valu...
javascript
function (value, encoding) { encoding = (typeof encoding === 'undefined') ? 'utf8' : encoding var returnValue = value if (!Buffer.isBuffer(returnValue)) { if (value === null) { returnValue = '' } else if (typeof value === 'object') { returnValue = module.exports.objectToJson(valu...
[ "function", "(", "value", ",", "encoding", ")", "{", "encoding", "=", "(", "typeof", "encoding", "===", "'undefined'", ")", "?", "'utf8'", ":", "encoding", "var", "returnValue", "=", "value", "if", "(", "!", "Buffer", ".", "isBuffer", "(", "returnValue", ...
Encodes the specified value and returns it. @param value - The value. @param {String} [encoding=utf8] - The encoding of the payload. @returns {Buffer} The encoded value.
[ "Encodes", "the", "specified", "value", "and", "returns", "it", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/message-utils.js#L101-L115
train
opendxl/opendxl-bootstrap-javascript
lib/message-utils.js
function (message, value, encoding) { message.payload = module.exports.encode(value, encoding) }
javascript
function (message, value, encoding) { message.payload = module.exports.encode(value, encoding) }
[ "function", "(", "message", ",", "value", ",", "encoding", ")", "{", "message", ".", "payload", "=", "module", ".", "exports", ".", "encode", "(", "value", ",", "encoding", ")", "}" ]
Encodes the specified value and places it in the DXL message's payload. @param {external:Message} message - The DXL message. @param value - The value. @param {String} [encoding=utf8] - The encoding of the payload.
[ "Encodes", "the", "specified", "value", "and", "places", "it", "in", "the", "DXL", "message", "s", "payload", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/message-utils.js#L122-L124
train
opendxl/opendxl-bootstrap-javascript
lib/message-utils.js
function (obj, prettyPrint) { return prettyPrint ? JSON.stringify(obj, Object.keys(findUniqueKeys( obj, {}, [])).sort(), 4) : JSON.stringify(obj) }
javascript
function (obj, prettyPrint) { return prettyPrint ? JSON.stringify(obj, Object.keys(findUniqueKeys( obj, {}, [])).sort(), 4) : JSON.stringify(obj) }
[ "function", "(", "obj", ",", "prettyPrint", ")", "{", "return", "prettyPrint", "?", "JSON", ".", "stringify", "(", "obj", ",", "Object", ".", "keys", "(", "findUniqueKeys", "(", "obj", ",", "{", "}", ",", "[", "]", ")", ")", ".", "sort", "(", ")", ...
Converts the specified object to a JSON string and returns it. @param {Object} obj - The object. @param {Boolean} [prettyPrint=false] - Whether to pretty print the JSON. @returns {String} The JSON string.
[ "Converts", "the", "specified", "object", "to", "a", "JSON", "string", "and", "returns", "it", "." ]
f369077f059b0da12c2f918de5ce41331e1d9b28
https://github.com/opendxl/opendxl-bootstrap-javascript/blob/f369077f059b0da12c2f918de5ce41331e1d9b28/lib/message-utils.js#L131-L135
train
BBWeb/derby-ar
lib/rpc.js
plugin
function plugin(derby) { // Wrap createBackend in order to be able to listen to derby-ar RPC calls // But only do it once (e.g. if we have many apps, we need to ensure we only wrap it once since otherwise we'll destroy the wrapping) if(derby.__createBackend) return; derby.__createBackend = derby.createBackend;...
javascript
function plugin(derby) { // Wrap createBackend in order to be able to listen to derby-ar RPC calls // But only do it once (e.g. if we have many apps, we need to ensure we only wrap it once since otherwise we'll destroy the wrapping) if(derby.__createBackend) return; derby.__createBackend = derby.createBackend;...
[ "function", "plugin", "(", "derby", ")", "{", "// Wrap createBackend in order to be able to listen to derby-ar RPC calls", "// But only do it once (e.g. if we have many apps, we need to ensure we only wrap it once since otherwise we'll destroy the wrapping)", "if", "(", "derby", ".", "__crea...
Add RPC support
[ "Add", "RPC", "support" ]
18a1a732481683427501e768fb1de3b4f995e7ca
https://github.com/BBWeb/derby-ar/blob/18a1a732481683427501e768fb1de3b4f995e7ca/lib/rpc.js#L37-L62
train
ThatDevCompany/that-build-library
src/utils/removeModuleAlias.js
removeModuleAlias
function removeModuleAlias(moduleName, folder, replacement = './') { return __awaiter(this, void 0, void 0, function* () { fs.readdirSync(folder).forEach(child => { if (fs.statSync(folder + '/' + child).isDirectory()) { removeModuleAlias(moduleName, folder + '/' + child, './.' + ...
javascript
function removeModuleAlias(moduleName, folder, replacement = './') { return __awaiter(this, void 0, void 0, function* () { fs.readdirSync(folder).forEach(child => { if (fs.statSync(folder + '/' + child).isDirectory()) { removeModuleAlias(moduleName, folder + '/' + child, './.' + ...
[ "function", "removeModuleAlias", "(", "moduleName", ",", "folder", ",", "replacement", "=", "'./'", ")", "{", "return", "__awaiter", "(", "this", ",", "void", "0", ",", "void", "0", ",", "function", "*", "(", ")", "{", "fs", ".", "readdirSync", "(", "f...
Remove Module Alias
[ "Remove", "Module", "Alias" ]
865aaac49531fa9793a055a4df8e9b1b41e71753
https://github.com/ThatDevCompany/that-build-library/blob/865aaac49531fa9793a055a4df8e9b1b41e71753/src/utils/removeModuleAlias.js#L15-L44
train
hughsk/glsl-resolve
index.js
packageFilter
function packageFilter(pkg, root) { pkg.main = pkg.glslify || ( path.extname(pkg.main || '') !== '.js' && pkg.main ) || 'index.glsl' return pkg }
javascript
function packageFilter(pkg, root) { pkg.main = pkg.glslify || ( path.extname(pkg.main || '') !== '.js' && pkg.main ) || 'index.glsl' return pkg }
[ "function", "packageFilter", "(", "pkg", ",", "root", ")", "{", "pkg", ".", "main", "=", "pkg", ".", "glslify", "||", "(", "path", ".", "extname", "(", "pkg", ".", "main", "||", "''", ")", "!==", "'.js'", "&&", "pkg", ".", "main", ")", "||", "'in...
find the "glslify", "main", or assume main == "index.glsl" if main is a .js file then ignore it.
[ "find", "the", "glslify", "main", "or", "assume", "main", "==", "index", ".", "glsl", "if", "main", "is", "a", ".", "js", "file", "then", "ignore", "it", "." ]
2f94e44bf25c51a8bf1c0897b6cb159779ab0586
https://github.com/hughsk/glsl-resolve/blob/2f94e44bf25c51a8bf1c0897b6cb159779ab0586/index.js#L48-L55
train
jacoborus/curlymail
curlymail.js
function (obj) { var fns = {}, i; for (i in obj) { fns[i] = hogan.compile( obj[i] ); } return fns; }
javascript
function (obj) { var fns = {}, i; for (i in obj) { fns[i] = hogan.compile( obj[i] ); } return fns; }
[ "function", "(", "obj", ")", "{", "var", "fns", "=", "{", "}", ",", "i", ";", "for", "(", "i", "in", "obj", ")", "{", "fns", "[", "i", "]", "=", "hogan", ".", "compile", "(", "obj", "[", "i", "]", ")", ";", "}", "return", "fns", ";", "}" ...
compile templates in a object
[ "compile", "templates", "in", "a", "object" ]
05a01aa76a3716a6c9cb51d9e8d4ef4bee63d8fc
https://github.com/jacoborus/curlymail/blob/05a01aa76a3716a6c9cb51d9e8d4ef4bee63d8fc/curlymail.js#L19-L26
train
boylesoftware/x2node-patches
lib/differ.js
diffObjects
function diffObjects(container, pathPrefix, objOld, objNew, patchSpec) { // keep track of processed properties const unrecognizedPropNames = new Set(Object.keys(objNew)); // diff main properties diffObjectProps( container, pathPrefix, objOld, objNew, unrecognizedPropNames, patchSpec); // check if polymor...
javascript
function diffObjects(container, pathPrefix, objOld, objNew, patchSpec) { // keep track of processed properties const unrecognizedPropNames = new Set(Object.keys(objNew)); // diff main properties diffObjectProps( container, pathPrefix, objOld, objNew, unrecognizedPropNames, patchSpec); // check if polymor...
[ "function", "diffObjects", "(", "container", ",", "pathPrefix", ",", "objOld", ",", "objNew", ",", "patchSpec", ")", "{", "// keep track of processed properties", "const", "unrecognizedPropNames", "=", "new", "Set", "(", "Object", ".", "keys", "(", "objNew", ")", ...
Recursively diff two objects and generate corresponding patch operations. @private @param {module:x2node-records~PropertiesContainer} container The container that describes the object (record or nested object property). @param {string} pathPrefix Prefix to add to contained property names to form corresponding JSON poi...
[ "Recursively", "diff", "two", "objects", "and", "generate", "corresponding", "patch", "operations", "." ]
59debdb270c899bcca3f330217b68e2f746d9646
https://github.com/boylesoftware/x2node-patches/blob/59debdb270c899bcca3f330217b68e2f746d9646/lib/differ.js#L74-L110
train
boylesoftware/x2node-patches
lib/differ.js
diffMaps
function diffMaps(propDesc, propPath, mapOld, mapNew, patchSpec) { const objects = (propDesc.scalarValueType === 'object'); const keysToRemove = new Set(Object.keys(mapOld)); for (let key of Object.keys(mapNew)) { const valOld = mapOld[key]; const valNew = mapNew[key]; if ((valNew === undefined) || (valNew...
javascript
function diffMaps(propDesc, propPath, mapOld, mapNew, patchSpec) { const objects = (propDesc.scalarValueType === 'object'); const keysToRemove = new Set(Object.keys(mapOld)); for (let key of Object.keys(mapNew)) { const valOld = mapOld[key]; const valNew = mapNew[key]; if ((valNew === undefined) || (valNew...
[ "function", "diffMaps", "(", "propDesc", ",", "propPath", ",", "mapOld", ",", "mapNew", ",", "patchSpec", ")", "{", "const", "objects", "=", "(", "propDesc", ".", "scalarValueType", "===", "'object'", ")", ";", "const", "keysToRemove", "=", "new", "Set", "...
Recursively diff two maps and generate corresponding patch operations. @private @param {module:x2node-records~PropertyDescriptor} propDesc Descriptor of the map property. @param {string} propPath JSON pointer path of the map property. @param {Object.<string,*>} mapOld Original map. @param {Object.<string,*>} mapNew Ne...
[ "Recursively", "diff", "two", "maps", "and", "generate", "corresponding", "patch", "operations", "." ]
59debdb270c899bcca3f330217b68e2f746d9646
https://github.com/boylesoftware/x2node-patches/blob/59debdb270c899bcca3f330217b68e2f746d9646/lib/differ.js#L497-L540
train
weexteam/weex-transformer
bin/transformer.js
deserializeValue
function deserializeValue(value) { var num try { return value ? value == 'true' || value == true || (value == 'false' || value == false ? false : value == 'null' ? null : !/^0/.test(value) && !isNaN(num = Number(value)) ? num : /^[\[\{]/.test(value) ? JSON.parse(value) : ...
javascript
function deserializeValue(value) { var num try { return value ? value == 'true' || value == true || (value == 'false' || value == false ? false : value == 'null' ? null : !/^0/.test(value) && !isNaN(num = Number(value)) ? num : /^[\[\{]/.test(value) ? JSON.parse(value) : ...
[ "function", "deserializeValue", "(", "value", ")", "{", "var", "num", "try", "{", "return", "value", "?", "value", "==", "'true'", "||", "value", "==", "true", "||", "(", "value", "==", "'false'", "||", "value", "==", "false", "?", "false", ":", "value...
string to variables of proper type
[ "string", "to", "variables", "of", "proper", "type" ]
4c0dcc5450c58713647bd2665dbf937d86161ae0
https://github.com/weexteam/weex-transformer/blob/4c0dcc5450c58713647bd2665dbf937d86161ae0/bin/transformer.js#L12-L26
train
ftlabs/fruitmachine-fastdom
lib/helper.js
remove
function remove(item, list) { var i = list.indexOf(item); if (~i) list.splice(i, 1); }
javascript
function remove(item, list) { var i = list.indexOf(item); if (~i) list.splice(i, 1); }
[ "function", "remove", "(", "item", ",", "list", ")", "{", "var", "i", "=", "list", ".", "indexOf", "(", "item", ")", ";", "if", "(", "~", "i", ")", "list", ".", "splice", "(", "i", ",", "1", ")", ";", "}" ]
Removes an item from a list. @param {*} item @param {Array} list
[ "Removes", "an", "item", "from", "a", "list", "." ]
a90f33ea61e6196b0ff1aaf454f35fda0c063589
https://github.com/ftlabs/fruitmachine-fastdom/blob/a90f33ea61e6196b0ff1aaf454f35fda0c063589/lib/helper.js#L153-L156
train
wetfish/basic
src/transform.js
function(element, options) { // Make sure the transform property is an object if(typeof element.transform != "object") { element.transform = {}; } // If we have an object of options if(typeof options[0] == "object") { // Loop through o...
javascript
function(element, options) { // Make sure the transform property is an object if(typeof element.transform != "object") { element.transform = {}; } // If we have an object of options if(typeof options[0] == "object") { // Loop through o...
[ "function", "(", "element", ",", "options", ")", "{", "// Make sure the transform property is an object", "if", "(", "typeof", "element", ".", "transform", "!=", "\"object\"", ")", "{", "element", ".", "transform", "=", "{", "}", ";", "}", "// If we have an object...
Private function for saving new transform properties
[ "Private", "function", "for", "saving", "new", "transform", "properties" ]
cea1ad269ea9cd32b4cc73f6602aeab45bba9efa
https://github.com/wetfish/basic/blob/cea1ad269ea9cd32b4cc73f6602aeab45bba9efa/src/transform.js#L11-L44
train
wetfish/basic
src/transform.js
function(element) { // Loop through all saved transform functions to generate the style text var funcs = Object.keys(element.transform); var style = []; funcs.forEach(function(func) { var args = element.transform[func]; // If we have an array of argu...
javascript
function(element) { // Loop through all saved transform functions to generate the style text var funcs = Object.keys(element.transform); var style = []; funcs.forEach(function(func) { var args = element.transform[func]; // If we have an array of argu...
[ "function", "(", "element", ")", "{", "// Loop through all saved transform functions to generate the style text", "var", "funcs", "=", "Object", ".", "keys", "(", "element", ".", "transform", ")", ";", "var", "style", "=", "[", "]", ";", "funcs", ".", "forEach", ...
Private function for updating an element on the page
[ "Private", "function", "for", "updating", "an", "element", "on", "the", "page" ]
cea1ad269ea9cd32b4cc73f6602aeab45bba9efa
https://github.com/wetfish/basic/blob/cea1ad269ea9cd32b4cc73f6602aeab45bba9efa/src/transform.js#L47-L69
train
QuietWind/find-imports
lib/file.js
findModulePath
function findModulePath(filename_rootfile, filename, options = DEFAULT_OPTIONS) { /** * . 相对路径 * . 绝对路径 */ const ext = path.extname(filename); if (ext && exports.extensions.indexOf(ext) === -1) { return null; } if (path.dirname(filename_rootfile) !== filename_rootfile) { ...
javascript
function findModulePath(filename_rootfile, filename, options = DEFAULT_OPTIONS) { /** * . 相对路径 * . 绝对路径 */ const ext = path.extname(filename); if (ext && exports.extensions.indexOf(ext) === -1) { return null; } if (path.dirname(filename_rootfile) !== filename_rootfile) { ...
[ "function", "findModulePath", "(", "filename_rootfile", ",", "filename", ",", "options", "=", "DEFAULT_OPTIONS", ")", "{", "/**\n * . 相对路径\n * . 绝对路径\n */", "const", "ext", "=", "path", ".", "extname", "(", "filename", ")", ";", "if", "(", "ext", "&&",...
node_modules do not thinks @param filename_rootfile @param filename @param options
[ "node_modules", "do", "not", "thinks" ]
f0ecef2ff8025abfe59fcb19539965717ecd08ab
https://github.com/QuietWind/find-imports/blob/f0ecef2ff8025abfe59fcb19539965717ecd08ab/lib/file.js#L38-L84
train
meetings/gearsloth
lib/gearman/multiserver-client.js
MultiserverClient
function MultiserverClient(servers, options) { options = options || {}; Multiserver.call(this, servers, function(server) { return new gearman.Client({ host: server.host, port: server.port, debug: options.debug || false }); }, Multiserver.component_prefix(options.component_name) + 'client...
javascript
function MultiserverClient(servers, options) { options = options || {}; Multiserver.call(this, servers, function(server) { return new gearman.Client({ host: server.host, port: server.port, debug: options.debug || false }); }, Multiserver.component_prefix(options.component_name) + 'client...
[ "function", "MultiserverClient", "(", "servers", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "Multiserver", ".", "call", "(", "this", ",", "servers", ",", "function", "(", "server", ")", "{", "return", "new", "gearman", ".",...
A gearman client that supports multiple servers. Contains multiple gearman-coffee clients that are each connected to a different server. The client which submits a job is selected with round robin. Servers are provided in an array of json-objects, possible fields are: `.host`: a string that identifies a gearman job...
[ "A", "gearman", "client", "that", "supports", "multiple", "servers", ".", "Contains", "multiple", "gearman", "-", "coffee", "clients", "that", "are", "each", "connected", "to", "a", "different", "server", ".", "The", "client", "which", "submits", "a", "job", ...
21d07729d6197bdbea515f32922896e3ae485d46
https://github.com/meetings/gearsloth/blob/21d07729d6197bdbea515f32922896e3ae485d46/lib/gearman/multiserver-client.js#L23-L33
train
kuzzleio/dumpme
index.js
dump
function dump(gcore, coredump) { gcore = gcore || 'gcore'; coredump = coredump || `${process.cwd()}/core.${process.pid}`; return DumpProcess.dumpProcess(gcore, coredump); }
javascript
function dump(gcore, coredump) { gcore = gcore || 'gcore'; coredump = coredump || `${process.cwd()}/core.${process.pid}`; return DumpProcess.dumpProcess(gcore, coredump); }
[ "function", "dump", "(", "gcore", ",", "coredump", ")", "{", "gcore", "=", "gcore", "||", "'gcore'", ";", "coredump", "=", "coredump", "||", "`", "${", "process", ".", "cwd", "(", ")", "}", "${", "process", ".", "pid", "}", "`", ";", "return", "Dum...
Dumps the current process @param {string} [gcore] - path and filename of the gcore binary @param {string} [coredump] - path and filename of the target coredump file @return {Boolean}
[ "Dumps", "the", "current", "process" ]
1b70a9f91e82345bf50d0b36c85dffd61ca857bf
https://github.com/kuzzleio/dumpme/blob/1b70a9f91e82345bf50d0b36c85dffd61ca857bf/index.js#L12-L17
train
Flaque/react-mutate
packages/mutate-loader/src/index.js
installMutations
function installMutations(modules, enclosingFolder) { makeFolderLibraryIfNotExist(enclosingFolder); if (modules.length === 0) { return new Promise(resolve => resolve({})); } return npm.install(modules, { cwd: pathToMutations(enclosingFolder), save: true }); }
javascript
function installMutations(modules, enclosingFolder) { makeFolderLibraryIfNotExist(enclosingFolder); if (modules.length === 0) { return new Promise(resolve => resolve({})); } return npm.install(modules, { cwd: pathToMutations(enclosingFolder), save: true }); }
[ "function", "installMutations", "(", "modules", ",", "enclosingFolder", ")", "{", "makeFolderLibraryIfNotExist", "(", "enclosingFolder", ")", ";", "if", "(", "modules", ".", "length", "===", "0", ")", "{", "return", "new", "Promise", "(", "resolve", "=>", "res...
Installs a list of npm modules as "mutations" in a folder called "mutations" using `npm`. @param {Array} modules @param {String} enclosingFolder @return {Promise}
[ "Installs", "a", "list", "of", "npm", "modules", "as", "mutations", "in", "a", "folder", "called", "mutations", "using", "npm", "." ]
c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3
https://github.com/Flaque/react-mutate/blob/c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3/packages/mutate-loader/src/index.js#L25-L35
train
Flaque/react-mutate
packages/mutate-loader/src/index.js
loadMutations
function loadMutations(enclosingFolder) { const here = jetpack.cwd(pathToMutations(enclosingFolder)); const pkg = here.read(PACKAGE_JSON, "json"); errorIf( !pkg, `There doesn't seem to be a package.json file. Did you create one at the enclosing folder? FYI: installMutations creates one for you if you d...
javascript
function loadMutations(enclosingFolder) { const here = jetpack.cwd(pathToMutations(enclosingFolder)); const pkg = here.read(PACKAGE_JSON, "json"); errorIf( !pkg, `There doesn't seem to be a package.json file. Did you create one at the enclosing folder? FYI: installMutations creates one for you if you d...
[ "function", "loadMutations", "(", "enclosingFolder", ")", "{", "const", "here", "=", "jetpack", ".", "cwd", "(", "pathToMutations", "(", "enclosingFolder", ")", ")", ";", "const", "pkg", "=", "here", ".", "read", "(", "PACKAGE_JSON", ",", "\"json\"", ")", ...
Loads mutations from a folder inside the `enclosingFolder` called "mutations". @param {String} enclosingFolder @return {JSON} a map of the mutation name to the mutation's export.
[ "Loads", "mutations", "from", "a", "folder", "inside", "the", "enclosingFolder", "called", "mutations", "." ]
c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3
https://github.com/Flaque/react-mutate/blob/c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3/packages/mutate-loader/src/index.js#L42-L63
train
mrdaniellewis/node-promise-utilities
lib/promise-queue.js
next
function next() { var fns = activeQueue.shift(); if ( !fns ) { return; } ret = ret.then( typeof fns[0] === 'function' ? fns[0].bind(self) : fns[0], typeof fns[1] === 'function' ? fns[1].bind(self) : fns[1] ); next(); }
javascript
function next() { var fns = activeQueue.shift(); if ( !fns ) { return; } ret = ret.then( typeof fns[0] === 'function' ? fns[0].bind(self) : fns[0], typeof fns[1] === 'function' ? fns[1].bind(self) : fns[1] ); next(); }
[ "function", "next", "(", ")", "{", "var", "fns", "=", "activeQueue", ".", "shift", "(", ")", ";", "if", "(", "!", "fns", ")", "{", "return", ";", "}", "ret", "=", "ret", ".", "then", "(", "typeof", "fns", "[", "0", "]", "===", "'function'", "?"...
Recursive function adds promise actions
[ "Recursive", "function", "adds", "promise", "actions" ]
53188b6b52e8807cfd8f446ae034626f9a2aecf4
https://github.com/mrdaniellewis/node-promise-utilities/blob/53188b6b52e8807cfd8f446ae034626f9a2aecf4/lib/promise-queue.js#L53-L67
train
sudo-suhas/eslint-config-chatur
lib/util.js
isInstalled
function isInstalled(dep) { if (_.has(exceptions, dep)) return exceptions[dep]; return installedDeps.has(dep); }
javascript
function isInstalled(dep) { if (_.has(exceptions, dep)) return exceptions[dep]; return installedDeps.has(dep); }
[ "function", "isInstalled", "(", "dep", ")", "{", "if", "(", "_", ".", "has", "(", "exceptions", ",", "dep", ")", ")", "return", "exceptions", "[", "dep", "]", ";", "return", "installedDeps", ".", "has", "(", "dep", ")", ";", "}" ]
Check if the given dependency is installed. Checks against `dependencies`, `devDependencies` in project `package.json`. @param {string} dep Name of the dependency @returns {boolean} `true` if installed, `false` if not
[ "Check", "if", "the", "given", "dependency", "is", "installed", ".", "Checks", "against", "dependencies", "devDependencies", "in", "project", "package", ".", "json", "." ]
fc3d6ece77512d9651da4e9ec29d641a9279519b
https://github.com/sudo-suhas/eslint-config-chatur/blob/fc3d6ece77512d9651da4e9ec29d641a9279519b/lib/util.js#L36-L39
train
sudo-suhas/eslint-config-chatur
lib/util.js
resolveDependencyPlugins
function resolveDependencyPlugins(deps) { return deps .filter(dep => isInstalled(dep) && isInstalled(`eslint-plugin-${dep}`)) .map(dep => `./lib/plugin-conf/${dep}.js`); }
javascript
function resolveDependencyPlugins(deps) { return deps .filter(dep => isInstalled(dep) && isInstalled(`eslint-plugin-${dep}`)) .map(dep => `./lib/plugin-conf/${dep}.js`); }
[ "function", "resolveDependencyPlugins", "(", "deps", ")", "{", "return", "deps", ".", "filter", "(", "dep", "=>", "isInstalled", "(", "dep", ")", "&&", "isInstalled", "(", "`", "${", "dep", "}", "`", ")", ")", ".", "map", "(", "dep", "=>", "`", "${",...
Resolve installed dependencies and return the eslint config paths which can be used for extending an eslint config. @param {Array<string>} deps Dependencies list @returns {Array<string>} Array of eslint config file paths for plugins
[ "Resolve", "installed", "dependencies", "and", "return", "the", "eslint", "config", "paths", "which", "can", "be", "used", "for", "extending", "an", "eslint", "config", "." ]
fc3d6ece77512d9651da4e9ec29d641a9279519b
https://github.com/sudo-suhas/eslint-config-chatur/blob/fc3d6ece77512d9651da4e9ec29d641a9279519b/lib/util.js#L59-L63
train
Flaque/react-mutate
packages/mutate-core/src/mutate.js
mutate
function mutate(Component, title, api = {}) { class Mutated extends React.Component { constructor(props, context) { super(props); this.ToRender = Component; const mutations = context.mutations; if (!mutations || !mutations[title]) { return; } // Convert old style mut...
javascript
function mutate(Component, title, api = {}) { class Mutated extends React.Component { constructor(props, context) { super(props); this.ToRender = Component; const mutations = context.mutations; if (!mutations || !mutations[title]) { return; } // Convert old style mut...
[ "function", "mutate", "(", "Component", ",", "title", ",", "api", "=", "{", "}", ")", "{", "class", "Mutated", "extends", "React", ".", "Component", "{", "constructor", "(", "props", ",", "context", ")", "{", "super", "(", "props", ")", ";", "this", ...
A React HOC that returns a component that the user can mutate. @param {React} Component is the component we will mutate @param {String} title is the name you want to associate with the mutation
[ "A", "React", "HOC", "that", "returns", "a", "component", "that", "the", "user", "can", "mutate", "." ]
c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3
https://github.com/Flaque/react-mutate/blob/c2a1f6f9bf8af72f812000dc96f80b55d6ceaaa3/packages/mutate-core/src/mutate.js#L11-L45
train
alexindigo/executioner
lib/run.js
run
function run(collector, commands, keys, params, options, callback) { // either keys is array or commands var prefix, key, cmd = (keys || commands).shift(); // done here if (!cmd) { return callback(null, collector); } // transform object into a command if (keys) { key = cmd; cmd = command...
javascript
function run(collector, commands, keys, params, options, callback) { // either keys is array or commands var prefix, key, cmd = (keys || commands).shift(); // done here if (!cmd) { return callback(null, collector); } // transform object into a command if (keys) { key = cmd; cmd = command...
[ "function", "run", "(", "collector", ",", "commands", ",", "keys", ",", "params", ",", "options", ",", "callback", ")", "{", "// either keys is array or commands", "var", "prefix", ",", "key", ",", "cmd", "=", "(", "keys", "||", "commands", ")", ".", "shif...
Runs specified command, replaces parameter placeholders. @param {array} collector - job control object, contains list of results @param {object|array} commands - list of commands to execute @param {array} keys - list of commands keys @param {object} params - parameters for each command @param {object} option...
[ "Runs", "specified", "command", "replaces", "parameter", "placeholders", "." ]
582f92897f47c13f4531e0b692aebb4a9f134eec
https://github.com/alexindigo/executioner/blob/582f92897f47c13f4531e0b692aebb4a9f134eec/lib/run.js#L19-L75
train
observing/fossa
lib/model.js
constructor
function constructor(attributes, options) { var hooks = [] , local = {}; options = options || {}; // // Set the database name and/or urlRoot if provided in the options. // if (options.database) this.database = options.database; if (options.urlRoot) this.urlRoot = opti...
javascript
function constructor(attributes, options) { var hooks = [] , local = {}; options = options || {}; // // Set the database name and/or urlRoot if provided in the options. // if (options.database) this.database = options.database; if (options.urlRoot) this.urlRoot = opti...
[ "function", "constructor", "(", "attributes", ",", "options", ")", "{", "var", "hooks", "=", "[", "]", ",", "local", "=", "{", "}", ";", "options", "=", "options", "||", "{", "}", ";", "//", "// Set the database name and/or urlRoot if provided in the options.", ...
Override default Model Constructor. @Constructor @param {Object} attributes @param {Object} options @api public
[ "Override", "default", "Model", "Constructor", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/model.js#L33-L76
train
observing/fossa
lib/model.js
save
function save() { var defer = new Defer , xhr = backbone.Model.prototype.save.apply(this, arguments); if (xhr) return xhr; defer.next(new Error('Could not validate model')); return defer; }
javascript
function save() { var defer = new Defer , xhr = backbone.Model.prototype.save.apply(this, arguments); if (xhr) return xhr; defer.next(new Error('Could not validate model')); return defer; }
[ "function", "save", "(", ")", "{", "var", "defer", "=", "new", "Defer", ",", "xhr", "=", "backbone", ".", "Model", ".", "prototype", ".", "save", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "xhr", ")", "return", "xhr", ";", ...
Overrule the default save. Normally `save` returns `false` when validation fails. However this does not match the Node.JS callback pattern. @return {Defer} Promise XHR object @api public
[ "Overrule", "the", "default", "save", ".", "Normally", "save", "returns", "false", "when", "validation", "fails", ".", "However", "this", "does", "not", "match", "the", "Node", ".", "JS", "callback", "pattern", "." ]
29b3717ee10a13fb607f5bbddcb8b003faf008c6
https://github.com/observing/fossa/blob/29b3717ee10a13fb607f5bbddcb8b003faf008c6/lib/model.js#L153-L161
train
PixieEngine/Cornerstone
game.js
function(namespacedEvent, callback) { var event, namespace, _ref; _ref = namespacedEvent.split("."), event = _ref[0], namespace = _ref[1]; if (namespace) { callback.__PIXIE || (callback.__PIXIE = {}); callback.__PIXIE[namespace] = true; } eventCallbacks[event] || (eventCall...
javascript
function(namespacedEvent, callback) { var event, namespace, _ref; _ref = namespacedEvent.split("."), event = _ref[0], namespace = _ref[1]; if (namespace) { callback.__PIXIE || (callback.__PIXIE = {}); callback.__PIXIE[namespace] = true; } eventCallbacks[event] || (eventCall...
[ "function", "(", "namespacedEvent", ",", "callback", ")", "{", "var", "event", ",", "namespace", ",", "_ref", ";", "_ref", "=", "namespacedEvent", ".", "split", "(", "\".\"", ")", ",", "event", "=", "_ref", "[", "0", "]", ",", "namespace", "=", "_ref",...
Adds a function as an event listener. # this will call coolEventHandler after # yourObject.trigger "someCustomEvent" is called. yourObject.on "someCustomEvent", coolEventHandler #or yourObject.on "anotherCustomEvent", -> doSomething() @name on @methodOf Bindable# @param {String} event The event to listen to. @param ...
[ "Adds", "a", "function", "as", "an", "event", "listener", "." ]
4fd1e28e71db89385876efe46ca634a90d51672e
https://github.com/PixieEngine/Cornerstone/blob/4fd1e28e71db89385876efe46ca634a90d51672e/game.js#L877-L887
train
PixieEngine/Cornerstone
game.js
function(namespacedEvent, callback) { var callbacks, event, key, namespace, _ref; _ref = namespacedEvent.split("."), event = _ref[0], namespace = _ref[1]; if (event) { eventCallbacks[event] || (eventCallbacks[event] = []); if (namespace) { eventCallbacks[event] = eventCallbac...
javascript
function(namespacedEvent, callback) { var callbacks, event, key, namespace, _ref; _ref = namespacedEvent.split("."), event = _ref[0], namespace = _ref[1]; if (event) { eventCallbacks[event] || (eventCallbacks[event] = []); if (namespace) { eventCallbacks[event] = eventCallbac...
[ "function", "(", "namespacedEvent", ",", "callback", ")", "{", "var", "callbacks", ",", "event", ",", "key", ",", "namespace", ",", "_ref", ";", "_ref", "=", "namespacedEvent", ".", "split", "(", "\".\"", ")", ",", "event", "=", "_ref", "[", "0", "]", ...
Removes a specific event listener, or all event listeners if no specific listener is given. # removes the handler coolEventHandler from the event # "someCustomEvent" while leaving the other events intact. yourObject.off "someCustomEvent", coolEventHandler # removes all handlers attached to "anotherCustomEvent" yourO...
[ "Removes", "a", "specific", "event", "listener", "or", "all", "event", "listeners", "if", "no", "specific", "listener", "is", "given", "." ]
4fd1e28e71db89385876efe46ca634a90d51672e
https://github.com/PixieEngine/Cornerstone/blob/4fd1e28e71db89385876efe46ca634a90d51672e/game.js#L904-L931
train
PixieEngine/Cornerstone
game.js
function() { var callbacks, event, parameters; event = arguments[0], parameters = 2 <= arguments.length ? __slice.call(arguments, 1) : []; callbacks = eventCallbacks[event]; if (callbacks && callbacks.length) { self = this; return callbacks.each(function(callback) { ret...
javascript
function() { var callbacks, event, parameters; event = arguments[0], parameters = 2 <= arguments.length ? __slice.call(arguments, 1) : []; callbacks = eventCallbacks[event]; if (callbacks && callbacks.length) { self = this; return callbacks.each(function(callback) { ret...
[ "function", "(", ")", "{", "var", "callbacks", ",", "event", ",", "parameters", ";", "event", "=", "arguments", "[", "0", "]", ",", "parameters", "=", "2", "<=", "arguments", ".", "length", "?", "__slice", ".", "call", "(", "arguments", ",", "1", ")"...
Calls all listeners attached to the specified event. # calls each event handler bound to "someCustomEvent" yourObject.trigger "someCustomEvent" @name trigger @methodOf Bindable# @param {String} event The event to trigger. @param {Array} [parameters] Additional parameters to pass to the event listener.
[ "Calls", "all", "listeners", "attached", "to", "the", "specified", "event", "." ]
4fd1e28e71db89385876efe46ca634a90d51672e
https://github.com/PixieEngine/Cornerstone/blob/4fd1e28e71db89385876efe46ca634a90d51672e/game.js#L943-L953
train
PixieEngine/Cornerstone
game.js
function() { var attrNames; attrNames = 1 <= arguments.length ? __slice.call(arguments, 0) : []; return attrNames.each(function(attrName) { return self[attrName] = function() { return I[attrName]; }; }); }
javascript
function() { var attrNames; attrNames = 1 <= arguments.length ? __slice.call(arguments, 0) : []; return attrNames.each(function(attrName) { return self[attrName] = function() { return I[attrName]; }; }); }
[ "function", "(", ")", "{", "var", "attrNames", ";", "attrNames", "=", "1", "<=", "arguments", ".", "length", "?", "__slice", ".", "call", "(", "arguments", ",", "0", ")", ":", "[", "]", ";", "return", "attrNames", ".", "each", "(", "function", "(", ...
Generates a public jQuery style getter method for each String argument. myObject = Core r: 255 g: 0 b: 100 myObject.attrReader "r", "g", "b" myObject.r() => 255 myObject.g() => 0 myObject.b() => 100 @name attrReader @methodOf Core#
[ "Generates", "a", "public", "jQuery", "style", "getter", "method", "for", "each", "String", "argument", "." ]
4fd1e28e71db89385876efe46ca634a90d51672e
https://github.com/PixieEngine/Cornerstone/blob/4fd1e28e71db89385876efe46ca634a90d51672e/game.js#L1106-L1114
train
PixieEngine/Cornerstone
game.js
function() { var Module, key, moduleName, modules, value, _i, _len; modules = 1 <= arguments.length ? __slice.call(arguments, 0) : []; for (_i = 0, _len = modules.length; _i < _len; _i++) { Module = modules[_i]; if (typeof Module.isString === "function" ? Module.isString() : ...
javascript
function() { var Module, key, moduleName, modules, value, _i, _len; modules = 1 <= arguments.length ? __slice.call(arguments, 0) : []; for (_i = 0, _len = modules.length; _i < _len; _i++) { Module = modules[_i]; if (typeof Module.isString === "function" ? Module.isString() : ...
[ "function", "(", ")", "{", "var", "Module", ",", "key", ",", "moduleName", ",", "modules", ",", "value", ",", "_i", ",", "_len", ";", "modules", "=", "1", "<=", "arguments", ".", "length", "?", "__slice", ".", "call", "(", "arguments", ",", "0", ")...
Includes a module in this object. myObject = Core() myObject.include(Bindable) # now you can bind handlers to functions myObject.bind "someEvent", -> alert("wow. that was easy.") @name include @methodOf Core# @param {String} Module the module to include. A module is a constructor that takes two parameters, I and sel...
[ "Includes", "a", "module", "in", "this", "object", "." ]
4fd1e28e71db89385876efe46ca634a90d51672e
https://github.com/PixieEngine/Cornerstone/blob/4fd1e28e71db89385876efe46ca634a90d51672e/game.js#L1160-L1185
train
jacoborus/updox
updox.js
function (route, options) { var opts = options || {}; opts.dest = opts.dest || './docs'; opts.destname = opts.destname || false; route = route || './*.js'; mkdirp( opts.dest, function (err) { if (err) { console.error(err); } else { // options is optional glob( route, function (err, files) { var f;...
javascript
function (route, options) { var opts = options || {}; opts.dest = opts.dest || './docs'; opts.destname = opts.destname || false; route = route || './*.js'; mkdirp( opts.dest, function (err) { if (err) { console.error(err); } else { // options is optional glob( route, function (err, files) { var f;...
[ "function", "(", "route", ",", "options", ")", "{", "var", "opts", "=", "options", "||", "{", "}", ";", "opts", ".", "dest", "=", "opts", ".", "dest", "||", "'./docs'", ";", "opts", ".", "destname", "=", "opts", ".", "destname", "||", "false", ";",...
Document files in glob route path Options: - `dest`: documentation folder ('./docs' by default) - `destname`: name of docfile (only when one file is documented) @param {String} route glob path of javascript files @param {Object} options destiny and out name file @return {Array} list of documented files
[ "Document", "files", "in", "glob", "route", "path" ]
a3886637baf3afb2a15732ad9230f8e553577560
https://github.com/jacoborus/updox/blob/a3886637baf3afb2a15732ad9230f8e553577560/updox.js#L66-L87
train
AndiDittrich/Node.Crypto-Toolkit
lib/Hash.js
hash
function hash(input, algo, type){ // string or buffer input ? => keep it if (typeof input !== 'string' && !(input instanceof Buffer)){ input = JSON.stringify(input); } // create hash algo var sum = _crypto.createHash(algo); // set content sum.update(input); // binary output ? ...
javascript
function hash(input, algo, type){ // string or buffer input ? => keep it if (typeof input !== 'string' && !(input instanceof Buffer)){ input = JSON.stringify(input); } // create hash algo var sum = _crypto.createHash(algo); // set content sum.update(input); // binary output ? ...
[ "function", "hash", "(", "input", ",", "algo", ",", "type", ")", "{", "// string or buffer input ? => keep it", "if", "(", "typeof", "input", "!==", "'string'", "&&", "!", "(", "input", "instanceof", "Buffer", ")", ")", "{", "input", "=", "JSON", ".", "str...
generic string hashing
[ "generic", "string", "hashing" ]
cb3cd64bc69460bdc761f36b0dd4665727bf6bd4
https://github.com/AndiDittrich/Node.Crypto-Toolkit/blob/cb3cd64bc69460bdc761f36b0dd4665727bf6bd4/lib/Hash.js#L4-L30
train