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
tmorin/ceb
dist/systemjs/builder/template.js
findContentNode
function findContentNode(el) { if (!el) { return; } var oldCebContentId = el.getAttribute(OLD_CONTENT_ID_ATTR_NAME); if (oldCebContentId) { return findContentNode(el.querySelector('[' + oldCebContentId + ']')) || el; } return el; }
javascript
function findContentNode(el) { if (!el) { return; } var oldCebContentId = el.getAttribute(OLD_CONTENT_ID_ATTR_NAME); if (oldCebContentId) { return findContentNode(el.querySelector('[' + oldCebContentId + ']')) || el; } return el; }
[ "function", "findContentNode", "(", "el", ")", "{", "if", "(", "!", "el", ")", "{", "return", ";", "}", "var", "oldCebContentId", "=", "el", ".", "getAttribute", "(", "OLD_CONTENT_ID_ATTR_NAME", ")", ";", "if", "(", "oldCebContentId", ")", "{", "return", ...
Try to find a light DOM node @param {!HTMLElement} el the custom element @returns {HTMLElement} the light DOM node if found otherwise it's the given HTML Element
[ "Try", "to", "find", "a", "light", "DOM", "node" ]
7cc0904b482aa99e5123302c5de4401f7a80af02
https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L61-L70
train
tmorin/ceb
dist/systemjs/builder/template.js
cleanOldContentNode
function cleanOldContentNode(el) { var oldContentNode = el.lightDOM, lightFrag = document.createDocumentFragment(); while (oldContentNode.childNodes.length > 0) { lightFrag.appendChild(oldContentNode.removeChild(oldContentNode.childNodes[0])); } return lightFrag; ...
javascript
function cleanOldContentNode(el) { var oldContentNode = el.lightDOM, lightFrag = document.createDocumentFragment(); while (oldContentNode.childNodes.length > 0) { lightFrag.appendChild(oldContentNode.removeChild(oldContentNode.childNodes[0])); } return lightFrag; ...
[ "function", "cleanOldContentNode", "(", "el", ")", "{", "var", "oldContentNode", "=", "el", ".", "lightDOM", ",", "lightFrag", "=", "document", ".", "createDocumentFragment", "(", ")", ";", "while", "(", "oldContentNode", ".", "childNodes", ".", "length", ">",...
Remove and return the children of the light DOM node. @param {!HTMLElement} el the custom element @returns {DocumentFragment} the light DOM fragment
[ "Remove", "and", "return", "the", "children", "of", "the", "light", "DOM", "node", "." ]
7cc0904b482aa99e5123302c5de4401f7a80af02
https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L77-L84
train
tmorin/ceb
dist/systemjs/builder/template.js
applyTemplate
function applyTemplate(el, tpl) { var lightFrag = void 0, handleContentNode = hasContent(tpl); if (handleContentNode) { var newCebContentId = 'ceb-content-' + counter++; lightFrag = cleanOldContentNode(el); tpl = replaceContent(tpl, newCebContentId); ...
javascript
function applyTemplate(el, tpl) { var lightFrag = void 0, handleContentNode = hasContent(tpl); if (handleContentNode) { var newCebContentId = 'ceb-content-' + counter++; lightFrag = cleanOldContentNode(el); tpl = replaceContent(tpl, newCebContentId); ...
[ "function", "applyTemplate", "(", "el", ",", "tpl", ")", "{", "var", "lightFrag", "=", "void", "0", ",", "handleContentNode", "=", "hasContent", "(", "tpl", ")", ";", "if", "(", "handleContentNode", ")", "{", "var", "newCebContentId", "=", "'ceb-content-'", ...
Apply the template to the element. @param {!HTMLElement} el the custom element @param {!string} tpl the template
[ "Apply", "the", "template", "to", "the", "element", "." ]
7cc0904b482aa99e5123302c5de4401f7a80af02
https://github.com/tmorin/ceb/blob/7cc0904b482aa99e5123302c5de4401f7a80af02/dist/systemjs/builder/template.js#L91-L109
train
ngenerio/smsghjs
lib/message.js
isAnImportantParamMissing
function isAnImportantParamMissing (obj) { var i = 0 var l = Message._importantParams.length for (; i < l; i++) { var value = obj[Message._importantParams[i]] if (value === null || value === undefined) { return true } } }
javascript
function isAnImportantParamMissing (obj) { var i = 0 var l = Message._importantParams.length for (; i < l; i++) { var value = obj[Message._importantParams[i]] if (value === null || value === undefined) { return true } } }
[ "function", "isAnImportantParamMissing", "(", "obj", ")", "{", "var", "i", "=", "0", "var", "l", "=", "Message", ".", "_importantParams", ".", "length", "for", "(", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "value", "=", "obj", "[", "Mes...
To check whether the given object contains the necssary params to send a message @param {Object} obj @return {Boolean}
[ "To", "check", "whether", "the", "given", "object", "contains", "the", "necssary", "params", "to", "send", "a", "message" ]
cfb33bb6b5b02d54125bed67365a5b174a1ad562
https://github.com/ngenerio/smsghjs/blob/cfb33bb6b5b02d54125bed67365a5b174a1ad562/lib/message.js#L8-L18
train
ngenerio/smsghjs
lib/message.js
Message
function Message (opts) { if (!(this instanceof Message)) return new Message(opts) this.type = opts.type || 0 this.clientReference = opts.clientReference || null this.direction = opts.direction || 'out' this.flashMessage = opts.flash || null this.messageId = opts.messageId || null this.networkId = opts.n...
javascript
function Message (opts) { if (!(this instanceof Message)) return new Message(opts) this.type = opts.type || 0 this.clientReference = opts.clientReference || null this.direction = opts.direction || 'out' this.flashMessage = opts.flash || null this.messageId = opts.messageId || null this.networkId = opts.n...
[ "function", "Message", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Message", ")", ")", "return", "new", "Message", "(", "opts", ")", "this", ".", "type", "=", "opts", ".", "type", "||", "0", "this", ".", "clientReference", "=",...
The message object used in the send message api @param {Object} opts Contains the params to be sent using the message api
[ "The", "message", "object", "used", "in", "the", "send", "message", "api" ]
cfb33bb6b5b02d54125bed67365a5b174a1ad562
https://github.com/ngenerio/smsghjs/blob/cfb33bb6b5b02d54125bed67365a5b174a1ad562/lib/message.js#L24-L50
train
socialally/air
lib/air/val.js
val
function val(value) { var first = this.get(0); function getValue(el) { var nm = el.tagName.toLowerCase() , type = el.getAttribute('type'); if(nm === SELECT) { return getSelectValues(el).join( el.getAttribute('data-delimiter') || ','); }else if(type === CHECKBOX) { return Boole...
javascript
function val(value) { var first = this.get(0); function getValue(el) { var nm = el.tagName.toLowerCase() , type = el.getAttribute('type'); if(nm === SELECT) { return getSelectValues(el).join( el.getAttribute('data-delimiter') || ','); }else if(type === CHECKBOX) { return Boole...
[ "function", "val", "(", "value", ")", "{", "var", "first", "=", "this", ".", "get", "(", "0", ")", ";", "function", "getValue", "(", "el", ")", "{", "var", "nm", "=", "el", ".", "tagName", ".", "toLowerCase", "(", ")", ",", "type", "=", "el", "...
Get the current value of the first element in the set of matched elements or set the value of every matched element.
[ "Get", "the", "current", "value", "of", "the", "first", "element", "in", "the", "set", "of", "matched", "elements", "or", "set", "the", "value", "of", "every", "matched", "element", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/val.js#L36-L78
train
goliatone/core.io-express-server
lib/getView.js
getView
function getView(app, viewName, defaultView='error'){ /* * views could be an array... */ let views = app.get('views'); const ext = app.get('view engine'); if(!Array.isArray(views)) views = [views]; let view; for(var i = 0; i < views.length; i++){ view = path.join(views[i], vi...
javascript
function getView(app, viewName, defaultView='error'){ /* * views could be an array... */ let views = app.get('views'); const ext = app.get('view engine'); if(!Array.isArray(views)) views = [views]; let view; for(var i = 0; i < views.length; i++){ view = path.join(views[i], vi...
[ "function", "getView", "(", "app", ",", "viewName", ",", "defaultView", "=", "'error'", ")", "{", "/*\n * views could be an array...\n */", "let", "views", "=", "app", ".", "get", "(", "'views'", ")", ";", "const", "ext", "=", "app", ".", "get", "(",...
This function will try to return a valid path to a view. It will recursively call itself while the provided express instance has a `parent` attribute. @TODO: Move to it's own package. @param {Object} app Express instance @param {String} viewName View name without ext @param {String}...
[ "This", "function", "will", "try", "to", "return", "a", "valid", "path", "to", "a", "view", "." ]
920225b923eaf1f142cd0ee1db78a208f8ecdbe2
https://github.com/goliatone/core.io-express-server/blob/920225b923eaf1f142cd0ee1db78a208f8ecdbe2/lib/getView.js#L19-L37
train
SME-FE/sme-log
src/index.js
logSome
function logSome(env = 'dev', level = 'none') { let levelNum = 3 const theme = { normal: '#92e6e6', error: '#ff5335', info: '#2994b2', warn: '#ffb400' } const setLevel = level => { switch (level) { case 'error': levelNum = 1 break case 'warn': levelNum = 2...
javascript
function logSome(env = 'dev', level = 'none') { let levelNum = 3 const theme = { normal: '#92e6e6', error: '#ff5335', info: '#2994b2', warn: '#ffb400' } const setLevel = level => { switch (level) { case 'error': levelNum = 1 break case 'warn': levelNum = 2...
[ "function", "logSome", "(", "env", "=", "'dev'", ",", "level", "=", "'none'", ")", "{", "let", "levelNum", "=", "3", "const", "theme", "=", "{", "normal", ":", "'#92e6e6'", ",", "error", ":", "'#ff5335'", ",", "info", ":", "'#2994b2'", ",", "warn", "...
more pretty log for console.log and only log on dev mode always log if force is true
[ "more", "pretty", "log", "for", "console", ".", "log", "and", "only", "log", "on", "dev", "mode", "always", "log", "if", "force", "is", "true" ]
02f5cdbffae01a29761856c47fc528430260b8e0
https://github.com/SME-FE/sme-log/blob/02f5cdbffae01a29761856c47fc528430260b8e0/src/index.js#L7-L67
train
nodecraft/spawnpoint-express
spawnpoint-express.js
function(err){ if(!err){ var address = app[serverNS].address(); if(config.port){ app.info('Server online at %s:%s', address.address, address.port); }else if(config.file){ app.info('Server online via %s', config.file); }else{ app.info('Server online!'); } } app.emit('app.regi...
javascript
function(err){ if(!err){ var address = app[serverNS].address(); if(config.port){ app.info('Server online at %s:%s', address.address, address.port); }else if(config.file){ app.info('Server online via %s', config.file); }else{ app.info('Server online!'); } } app.emit('app.regi...
[ "function", "(", "err", ")", "{", "if", "(", "!", "err", ")", "{", "var", "address", "=", "app", "[", "serverNS", "]", ".", "address", "(", ")", ";", "if", "(", "config", ".", "port", ")", "{", "app", ".", "info", "(", "'Server online at %s:%s'", ...
register express with spawnpoint
[ "register", "express", "with", "spawnpoint" ]
82ebf14f9d8490f2581032ff79dcb40eeffdadd6
https://github.com/nodecraft/spawnpoint-express/blob/82ebf14f9d8490f2581032ff79dcb40eeffdadd6/spawnpoint-express.js#L78-L92
train
rat-nest/big-rat
lib/ctz.js
ctzNumber
function ctzNumber(x) { var l = ctz(db.lo(x)) if(l < 32) { return l } var h = ctz(db.hi(x)) if(h > 20) { return 52 } return h + 32 }
javascript
function ctzNumber(x) { var l = ctz(db.lo(x)) if(l < 32) { return l } var h = ctz(db.hi(x)) if(h > 20) { return 52 } return h + 32 }
[ "function", "ctzNumber", "(", "x", ")", "{", "var", "l", "=", "ctz", "(", "db", ".", "lo", "(", "x", ")", ")", "if", "(", "l", "<", "32", ")", "{", "return", "l", "}", "var", "h", "=", "ctz", "(", "db", ".", "hi", "(", "x", ")", ")", "i...
Counts the number of trailing zeros
[ "Counts", "the", "number", "of", "trailing", "zeros" ]
09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa
https://github.com/rat-nest/big-rat/blob/09aabcf6d51a326dce0e4bdeedb159c9ce6b0efa/lib/ctz.js#L9-L19
train
jaredhanson/passport-familysearch
lib/passport-familysearch/legacy-strategy.js
Strategy
function Strategy(options, verify) { options = options || {}; options.requestTokenURL = options.requestTokenURL || 'https://api.familysearch.org/identity/v2/request_token'; options.accessTokenURL = options.accessTokenURL || 'https://api.familysearch.org/identity/v2/access_token'; options.userAuthorizationURL = ...
javascript
function Strategy(options, verify) { options = options || {}; options.requestTokenURL = options.requestTokenURL || 'https://api.familysearch.org/identity/v2/request_token'; options.accessTokenURL = options.accessTokenURL || 'https://api.familysearch.org/identity/v2/access_token'; options.userAuthorizationURL = ...
[ "function", "Strategy", "(", "options", ",", "verify", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "requestTokenURL", "=", "options", ".", "requestTokenURL", "||", "'https://api.familysearch.org/identity/v2/request_token'", ";", "option...
Legacy `Strategy` constructor. The FamilySearch legacy authentication strategy authenticates requests by delegating to FamilySearch using the OAuth 1.0 protocol. Applications must supply a `verify` callback which accepts a `token`, `tokenSecret` and service-specific `profile`, and then calls the `done` callback suppl...
[ "Legacy", "Strategy", "constructor", "." ]
eeb7588ee21b9523c49622aaaffb3a45570dd40f
https://github.com/jaredhanson/passport-familysearch/blob/eeb7588ee21b9523c49622aaaffb3a45570dd40f/lib/passport-familysearch/legacy-strategy.js#L43-L97
train
ex-machine/ng-classified
src/ng-classified.js
injectorInjectInvokers
function injectorInjectInvokers(injector) { var invoke_ = injector.invoke; injector.instantiate = instantiate; injector.invoke = invoke; return injector; // pasted method that picks up patched 'invoke' function instantiate(Type, locals, serviceName) { var instance = Object.create((Array.isArray(Typ...
javascript
function injectorInjectInvokers(injector) { var invoke_ = injector.invoke; injector.instantiate = instantiate; injector.invoke = invoke; return injector; // pasted method that picks up patched 'invoke' function instantiate(Type, locals, serviceName) { var instance = Object.create((Array.isArray(Typ...
[ "function", "injectorInjectInvokers", "(", "injector", ")", "{", "var", "invoke_", "=", "injector", ".", "invoke", ";", "injector", ".", "instantiate", "=", "instantiate", ";", "injector", ".", "invoke", "=", "invoke", ";", "return", "injector", ";", "// paste...
Invoker injects invokee, Injector invokes injectee, Morrow instantiates.
[ "Invoker", "injects", "invokee", "Injector", "invokes", "injectee", "Morrow", "instantiates", "." ]
039eb956582ea10d64574bc1d3f047a0abcbd343
https://github.com/ex-machine/ng-classified/blob/039eb956582ea10d64574bc1d3f047a0abcbd343/src/ng-classified.js#L26-L94
train
Whitebolt/require-extra
src/fs.js
_addReadCallback
function _addReadCallback(filename) { return new Promise((resolve, reject)=> { readFileCallbacks.get(filename).add((err, data)=> { if (err) return reject(err); return resolve(data); }); }); }
javascript
function _addReadCallback(filename) { return new Promise((resolve, reject)=> { readFileCallbacks.get(filename).add((err, data)=> { if (err) return reject(err); return resolve(data); }); }); }
[ "function", "_addReadCallback", "(", "filename", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "readFileCallbacks", ".", "get", "(", "filename", ")", ".", "add", "(", "(", "err", ",", "data", ")", "=>", "{", ...
Add a callback for reading of given file. @private @param {string} filename File to set callback for. @returns {Promise.<Buffer|*>} The file contents, once loaded.
[ "Add", "a", "callback", "for", "reading", "of", "given", "file", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L176-L183
train
Whitebolt/require-extra
src/fs.js
_addReadCallbacks
function _addReadCallbacks(filename, cache) { const callbacks = new Set(); cache.set(filename, true); readFileCallbacks.set(filename, callbacks); return callbacks; }
javascript
function _addReadCallbacks(filename, cache) { const callbacks = new Set(); cache.set(filename, true); readFileCallbacks.set(filename, callbacks); return callbacks; }
[ "function", "_addReadCallbacks", "(", "filename", ",", "cache", ")", "{", "const", "callbacks", "=", "new", "Set", "(", ")", ";", "cache", ".", "set", "(", "filename", ",", "true", ")", ";", "readFileCallbacks", ".", "set", "(", "filename", ",", "callbac...
Add callbacks set for given file @private @param {string} filename File to add for. @param {Map} cache Cache to use. @returns {Set} The callbacks.
[ "Add", "callbacks", "set", "for", "given", "file" ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L193-L198
train
Whitebolt/require-extra
src/fs.js
_fireReadFileCallbacks
function _fireReadFileCallbacks(filename, data, error=false) { const callbacks = readFileCallbacks.get(filename); if (callbacks) { if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data)); callbacks.clear(); readFileCallbacks.delete(filename); } }
javascript
function _fireReadFileCallbacks(filename, data, error=false) { const callbacks = readFileCallbacks.get(filename); if (callbacks) { if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data)); callbacks.clear(); readFileCallbacks.delete(filename); } }
[ "function", "_fireReadFileCallbacks", "(", "filename", ",", "data", ",", "error", "=", "false", ")", "{", "const", "callbacks", "=", "readFileCallbacks", ".", "get", "(", "filename", ")", ";", "if", "(", "callbacks", ")", "{", "if", "(", "callbacks", ".", ...
Fire any awaiting callbacks for given file data. @private @param {string} filename The filename to fire callbacks on. @param {Buffer|Error} data The received data. @param {boolean} [error=false] Is this an error or file data?
[ "Fire", "any", "awaiting", "callbacks", "for", "given", "file", "data", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L221-L228
train
Whitebolt/require-extra
src/fs.js
_runFileQueue
function _runFileQueue() { if (!settings) settings = require('./settings'); const simultaneous = settings.get('load-simultaneously') || 10; if ((loading < simultaneous) && (fileQueue.length)) { loading++; fileQueue.shift()(); } }
javascript
function _runFileQueue() { if (!settings) settings = require('./settings'); const simultaneous = settings.get('load-simultaneously') || 10; if ((loading < simultaneous) && (fileQueue.length)) { loading++; fileQueue.shift()(); } }
[ "function", "_runFileQueue", "(", ")", "{", "if", "(", "!", "settings", ")", "settings", "=", "require", "(", "'./settings'", ")", ";", "const", "simultaneous", "=", "settings", ".", "get", "(", "'load-simultaneously'", ")", "||", "10", ";", "if", "(", "...
File queue handler. @private
[ "File", "queue", "handler", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L235-L243
train
Whitebolt/require-extra
src/fs.js
_readFileOnEnd
function _readFileOnEnd(filename, contents, cache) { loading--; const data = Buffer.concat(contents); cache.set(filename, data); _fireReadFileCallbacks(filename, data); _runFileQueue(); }
javascript
function _readFileOnEnd(filename, contents, cache) { loading--; const data = Buffer.concat(contents); cache.set(filename, data); _fireReadFileCallbacks(filename, data); _runFileQueue(); }
[ "function", "_readFileOnEnd", "(", "filename", ",", "contents", ",", "cache", ")", "{", "loading", "--", ";", "const", "data", "=", "Buffer", ".", "concat", "(", "contents", ")", ";", "cache", ".", "set", "(", "filename", ",", "data", ")", ";", "_fireR...
On end listener for readFile. @private @param {string} filename The filename. @param {Array.<Buffer>} contents The file contents as a series of buffers. @param {Map} cache The file cache.
[ "On", "end", "listener", "for", "readFile", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L253-L259
train
Whitebolt/require-extra
src/fs.js
readFile
function readFile(filename, cache, encoding=null) { if (cache.has(filename)) return _handleFileInCache(filename, cache); _addReadCallbacks(filename, cache); fileQueue.push(()=>{ const contents = []; fs.createReadStream(filename, {encoding}) .on('data', chunk=>contents.push(chunk)) .on('end', (...
javascript
function readFile(filename, cache, encoding=null) { if (cache.has(filename)) return _handleFileInCache(filename, cache); _addReadCallbacks(filename, cache); fileQueue.push(()=>{ const contents = []; fs.createReadStream(filename, {encoding}) .on('data', chunk=>contents.push(chunk)) .on('end', (...
[ "function", "readFile", "(", "filename", ",", "cache", ",", "encoding", "=", "null", ")", "{", "if", "(", "cache", ".", "has", "(", "filename", ")", ")", "return", "_handleFileInCache", "(", "filename", ",", "cache", ")", ";", "_addReadCallbacks", "(", "...
Load a file synchronously using a cache. @public @param {string} filename The file to load. @param {Map} cache The cache to use. @param {null|string} [encoding=null] The encoding to load as. @returns {Promise.<Buffer|*>} The load results.
[ "Load", "a", "file", "synchronously", "using", "a", "cache", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L283-L295
train
Whitebolt/require-extra
src/fs.js
readFileSync
function readFileSync(filename, cache, encoding=null) { if (cache.has(filename) && (cache.get(filename) !== true)) return cache.get(filename); const data = fs.readFileSync(filename, encoding); cache.set(filename, data); return data; }
javascript
function readFileSync(filename, cache, encoding=null) { if (cache.has(filename) && (cache.get(filename) !== true)) return cache.get(filename); const data = fs.readFileSync(filename, encoding); cache.set(filename, data); return data; }
[ "function", "readFileSync", "(", "filename", ",", "cache", ",", "encoding", "=", "null", ")", "{", "if", "(", "cache", ".", "has", "(", "filename", ")", "&&", "(", "cache", ".", "get", "(", "filename", ")", "!==", "true", ")", ")", "return", "cache",...
Read a file synchronously using file cache. @param {string} filename The filename to load. @param {Map} cache The cache to use. @param {null|strin} [encoding=null] The encoding to use. @returns {Buffer\*} The file contents as a buffer.
[ "Read", "a", "file", "synchronously", "using", "file", "cache", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/fs.js#L319-L324
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input) { debug('booleanFilter(%s)', input); if (_.isBoolean(input)) return input; if (_.isString(input)) { var lc = input.toLocaleLowerCase(); var pos = ['false', 'true'].indexOf(lc); if (pos > -1) return (pos > 0); } return undefined; }
javascript
function (input) { debug('booleanFilter(%s)', input); if (_.isBoolean(input)) return input; if (_.isString(input)) { var lc = input.toLocaleLowerCase(); var pos = ['false', 'true'].indexOf(lc); if (pos > -1) return (pos > 0); } return undefined; }
[ "function", "(", "input", ")", "{", "debug", "(", "'booleanFilter(%s)'", ",", "input", ")", ";", "if", "(", "_", ".", "isBoolean", "(", "input", ")", ")", "return", "input", ";", "if", "(", "_", ".", "isString", "(", "input", ")", ")", "{", "var", ...
If we are given a boolean value return it. If we are given a string with the value 'false' return false If we are given a string with the value 'true' return true Otherwise return undefined @param {(boolean|string|undefined|null)} input @returns {(true|false|undefined)}
[ "If", "we", "are", "given", "a", "boolean", "value", "return", "it", ".", "If", "we", "are", "given", "a", "string", "with", "the", "value", "false", "return", "false", "If", "we", "are", "given", "a", "string", "with", "the", "value", "true", "return"...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L28-L37
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input) { debug('booleanTextFilter(%s)', input); var retv = module.exports.booleanFilter(input); return (retv === undefined ? undefined : (retv === false ? 'false' : 'true')); }
javascript
function (input) { debug('booleanTextFilter(%s)', input); var retv = module.exports.booleanFilter(input); return (retv === undefined ? undefined : (retv === false ? 'false' : 'true')); }
[ "function", "(", "input", ")", "{", "debug", "(", "'booleanTextFilter(%s)'", ",", "input", ")", ";", "var", "retv", "=", "module", ".", "exports", ".", "booleanFilter", "(", "input", ")", ";", "return", "(", "retv", "===", "undefined", "?", "undefined", ...
Same as booleanFilter but but return 'true' and 'false' in place of true and false respectively. @param {(boolean|string|undefined|null)} input @returns {('true'|'false'|undefined)}
[ "Same", "as", "booleanFilter", "but", "but", "return", "true", "and", "false", "in", "place", "of", "true", "and", "false", "respectively", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L46-L54
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input, list) { debug('chooseOneFilter(%s, %s)', input, JSON.stringify(list)); if (input === true) return undefined; if (_.isString(input)) { if (_.isEmpty(input)) return undefined; var ilc = input.toLocaleLowerCase(); for (var idx = 0; idx < list.length; idx++) { var item...
javascript
function (input, list) { debug('chooseOneFilter(%s, %s)', input, JSON.stringify(list)); if (input === true) return undefined; if (_.isString(input)) { if (_.isEmpty(input)) return undefined; var ilc = input.toLocaleLowerCase(); for (var idx = 0; idx < list.length; idx++) { var item...
[ "function", "(", "input", ",", "list", ")", "{", "debug", "(", "'chooseOneFilter(%s, %s)'", ",", "input", ",", "JSON", ".", "stringify", "(", "list", ")", ")", ";", "if", "(", "input", "===", "true", ")", "return", "undefined", ";", "if", "(", "_", "...
Check if input exists in list in a case insensitive manner. Will return the value from the list rather than the user input so the list can control the final case. NOTE 1: The list may not contain, undefined, null or the empty string. NOTE 2: If there are multiple matches, the first one wins. @param {(string|boolean|u...
[ "Check", "if", "input", "exists", "in", "list", "in", "a", "case", "insensitive", "manner", ".", "Will", "return", "the", "value", "from", "the", "list", "rather", "than", "the", "user", "input", "so", "the", "list", "can", "control", "the", "final", "ca...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L68-L80
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input, list) { debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list)); if (input === true) return undefined; var retv; if (_.isString(input)) { if (input === '') return undefined; var ilc = input.toLocaleLowerCase(); _.forEach(list, function (item) { ...
javascript
function (input, list) { debug('chooseOneStartsWithFilter(%s, %s)', input, JSON.stringify(list)); if (input === true) return undefined; var retv; if (_.isString(input)) { if (input === '') return undefined; var ilc = input.toLocaleLowerCase(); _.forEach(list, function (item) { ...
[ "function", "(", "input", ",", "list", ")", "{", "debug", "(", "'chooseOneStartsWithFilter(%s, %s)'", ",", "input", ",", "JSON", ".", "stringify", "(", "list", ")", ")", ";", "if", "(", "input", "===", "true", ")", "return", "undefined", ";", "var", "ret...
Check if any items in the list start with the input in a case insensitive manner. Will return the value from the list rather than the user input so the list can control the final case. NOTE 1: The list may not contain, undefined, null or the empty string. NOTE 2: If there are multiple partial matches, the first one wi...
[ "Check", "if", "any", "items", "in", "the", "list", "start", "with", "the", "input", "in", "a", "case", "insensitive", "manner", ".", "Will", "return", "the", "value", "from", "the", "list", "rather", "than", "the", "user", "input", "so", "the", "list", ...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L101-L115
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input, map) { // TODO(bwavell): write tests debug('chooseOneMapStartsWithFilter(%s, %s)', input, JSON.stringify(map)); if (input === true) return undefined; var retv; if (_.isString(input)) { if (input === '') return undefined; var ilc = input.toLocaleLowerCase(); _.forOw...
javascript
function (input, map) { // TODO(bwavell): write tests debug('chooseOneMapStartsWithFilter(%s, %s)', input, JSON.stringify(map)); if (input === true) return undefined; var retv; if (_.isString(input)) { if (input === '') return undefined; var ilc = input.toLocaleLowerCase(); _.forOw...
[ "function", "(", "input", ",", "map", ")", "{", "// TODO(bwavell): write tests", "debug", "(", "'chooseOneMapStartsWithFilter(%s, %s)'", ",", "input", ",", "JSON", ".", "stringify", "(", "map", ")", ")", ";", "if", "(", "input", "===", "true", ")", "return", ...
Check if any keys in the map start with the input in a case insensitive manner. Will return the value from the map rather than the user input so the map can control the final case. If there is an exact case insensitive match to a value, the value will be returned. NOTE 1: The map may not contain, undefined, null or th...
[ "Check", "if", "any", "keys", "in", "the", "map", "start", "with", "the", "input", "in", "a", "case", "insensitive", "manner", ".", "Will", "return", "the", "value", "from", "the", "map", "rather", "than", "the", "user", "input", "so", "the", "map", "c...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L174-L191
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input) { debug('optionalTextFilter(%s)', input); if (_.isString(input)) return input; if (_.isBoolean(input)) return (input ? '' : undefined); if (_.isNumber(input)) return '' + input; return undefined; }
javascript
function (input) { debug('optionalTextFilter(%s)', input); if (_.isString(input)) return input; if (_.isBoolean(input)) return (input ? '' : undefined); if (_.isNumber(input)) return '' + input; return undefined; }
[ "function", "(", "input", ")", "{", "debug", "(", "'optionalTextFilter(%s)'", ",", "input", ")", ";", "if", "(", "_", ".", "isString", "(", "input", ")", ")", "return", "input", ";", "if", "(", "_", ".", "isBoolean", "(", "input", ")", ")", "return",...
Given some text or the empty string return it. If we receive true return empty string. If we receive a number convert it to a string and return it. Otherwise return undefined. @param {(string|boolean|number|undefined|null)} input @returns {(string|undefined)}
[ "Given", "some", "text", "or", "the", "empty", "string", "return", "it", ".", "If", "we", "receive", "true", "return", "empty", "string", ".", "If", "we", "receive", "a", "number", "convert", "it", "to", "a", "string", "and", "return", "it", ".", "Othe...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L208-L214
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input) { debug('requiredTextFilter(%s)', input); if (_.isString(input) && !_.isEmpty(input)) return input; if (_.isNumber(input)) return '' + input; return undefined; }
javascript
function (input) { debug('requiredTextFilter(%s)', input); if (_.isString(input) && !_.isEmpty(input)) return input; if (_.isNumber(input)) return '' + input; return undefined; }
[ "function", "(", "input", ")", "{", "debug", "(", "'requiredTextFilter(%s)'", ",", "input", ")", ";", "if", "(", "_", ".", "isString", "(", "input", ")", "&&", "!", "_", ".", "isEmpty", "(", "input", ")", ")", "return", "input", ";", "if", "(", "_"...
Given some none empty text return it. If we receive a number convert it to a string and return it. Otherwise return undefined. @param {(string|boolean|undefined|null)} input @returns {(string|undefined)}
[ "Given", "some", "none", "empty", "text", "return", "it", ".", "If", "we", "receive", "a", "number", "convert", "it", "to", "a", "string", "and", "return", "it", ".", "Otherwise", "return", "undefined", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L224-L229
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input, sep, choices) { debug('requiredTextListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined')); // if we already have a list, just return it. We may // want to add validation that the items are in the // choices list if (_.isArray(input) && input.length >...
javascript
function (input, sep, choices) { debug('requiredTextListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined')); // if we already have a list, just return it. We may // want to add validation that the items are in the // choices list if (_.isArray(input) && input.length >...
[ "function", "(", "input", ",", "sep", ",", "choices", ")", "{", "debug", "(", "'requiredTextListFilter(%s, %s, %s)'", ",", "input", ",", "sep", ",", "(", "choices", "?", "JSON", ".", "stringify", "(", "choices", ")", ":", "'undefined'", ")", ")", ";", "/...
Given some input text, a separator and an optional list of choices, we split the input using the separator. We remove any empty items from the list. If choices are provided then we only provide values that match the choices in a case insensitive way and we return in the order provided in the choices list and using the...
[ "Given", "some", "input", "text", "a", "separator", "and", "an", "optional", "list", "of", "choices", "we", "split", "the", "input", "using", "the", "separator", ".", "We", "remove", "any", "empty", "items", "from", "the", "list", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L248-L273
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input, sep, choices) { debug('requiredTextStartsWithListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined')); // if we already have a list, just return it. We may // want to add validation that the items are in the // choices list if (_.isArray(input) && inpu...
javascript
function (input, sep, choices) { debug('requiredTextStartsWithListFilter(%s, %s, %s)', input, sep, (choices ? JSON.stringify(choices) : 'undefined')); // if we already have a list, just return it. We may // want to add validation that the items are in the // choices list if (_.isArray(input) && inpu...
[ "function", "(", "input", ",", "sep", ",", "choices", ")", "{", "debug", "(", "'requiredTextStartsWithListFilter(%s, %s, %s)'", ",", "input", ",", "sep", ",", "(", "choices", "?", "JSON", ".", "stringify", "(", "choices", ")", ":", "'undefined'", ")", ")", ...
Given some input text, a separator and a list of choices, we split the input using the separator. We remove any empty items from the list. We provide all choices that start-with in a case-insensitive manner one of the inputs. We return in the order provided in the choices list and using the case provided in the choice...
[ "Given", "some", "input", "text", "a", "separator", "and", "a", "list", "of", "choices", "we", "split", "the", "input", "using", "the", "separator", ".", "We", "remove", "any", "empty", "items", "from", "the", "list", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L296-L320
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (input) { debug('requiredTextFilter(%s)', input); if (_.isString(input) && !_.isEmpty(input)) { if (_.startsWith(input, 'VERSION-')) { return input.substr(8); } return input; } if (_.isNumber(input)) return '' + input; return undefined; }
javascript
function (input) { debug('requiredTextFilter(%s)', input); if (_.isString(input) && !_.isEmpty(input)) { if (_.startsWith(input, 'VERSION-')) { return input.substr(8); } return input; } if (_.isNumber(input)) return '' + input; return undefined; }
[ "function", "(", "input", ")", "{", "debug", "(", "'requiredTextFilter(%s)'", ",", "input", ")", ";", "if", "(", "_", ".", "isString", "(", "input", ")", "&&", "!", "_", ".", "isEmpty", "(", "input", ")", ")", "{", "if", "(", "_", ".", "startsWith"...
Given some none empty text return it. If the text starts with "VERSION-", remove that text This is a stupid hack because Yeoman is messing with our numeric options. If we receive a number convert it to a string and return it. Otherwise return undefined. @param {(string|boolean|undefined|null)} input @returns {(string|...
[ "Given", "some", "none", "empty", "text", "return", "it", ".", "If", "the", "text", "starts", "with", "VERSION", "-", "remove", "that", "text", "This", "is", "a", "stupid", "hack", "because", "Yeoman", "is", "messing", "with", "our", "numeric", "options", ...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L338-L348
train
binduwavell/generator-alfresco-common
lib/prompt-filters.js
function (filterArray) { return function (input) { return filterArray.reduce(function (previousValue, filter) { return filter.call(this, previousValue); }.bind(this), input); }; }
javascript
function (filterArray) { return function (input) { return filterArray.reduce(function (previousValue, filter) { return filter.call(this, previousValue); }.bind(this), input); }; }
[ "function", "(", "filterArray", ")", "{", "return", "function", "(", "input", ")", "{", "return", "filterArray", ".", "reduce", "(", "function", "(", "previousValue", ",", "filter", ")", "{", "return", "filter", ".", "call", "(", "this", ",", "previousValu...
Given some input text and a array of filters, we sequentially apply the filters to get the final value @param filterArray @returns function
[ "Given", "some", "input", "text", "and", "a", "array", "of", "filters", "we", "sequentially", "apply", "the", "filters", "to", "get", "the", "final", "value" ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/prompt-filters.js#L406-L412
train
Sobesednik/wrote
es5/src/read-dir.js
filterFiles
function filterFiles(files, recursive) { var fileOrDir = function fileOrDir(lstat) { return lstat.isFile() || lstat.isDirectory(); }; return files.filter(function (_ref) { var lstat = _ref.lstat; return recursive ? fileOrDir(lstat) : lstat.isFile(); }); }
javascript
function filterFiles(files, recursive) { var fileOrDir = function fileOrDir(lstat) { return lstat.isFile() || lstat.isDirectory(); }; return files.filter(function (_ref) { var lstat = _ref.lstat; return recursive ? fileOrDir(lstat) : lstat.isFile(); }); }
[ "function", "filterFiles", "(", "files", ",", "recursive", ")", "{", "var", "fileOrDir", "=", "function", "fileOrDir", "(", "lstat", ")", "{", "return", "lstat", ".", "isFile", "(", ")", "||", "lstat", ".", "isDirectory", "(", ")", ";", "}", ";", "retu...
Filter lstat results, taking only files if recursive is false. @param {lstat[]} files An array with lstat results @param {boolean} [recursive = false] Whether recursive mode is on @returns {lstat[]} Filtered array.
[ "Filter", "lstat", "results", "taking", "only", "files", "if", "recursive", "is", "false", "." ]
24992ad3bba4e5959dfb617b6c1f22d9a1306ab9
https://github.com/Sobesednik/wrote/blob/24992ad3bba4e5959dfb617b6c1f22d9a1306ab9/es5/src/read-dir.js#L16-L25
train
plum-css/plum-fixture
lib/generator.js
extractFolders
function extractFolders( files ) { return files.data.files.map( function extractPath( file ) { return path.parse( file ).dir; }).filter( function extractUnique( path, index, array ) { return array.indexOf( path ) === index; }); }
javascript
function extractFolders( files ) { return files.data.files.map( function extractPath( file ) { return path.parse( file ).dir; }).filter( function extractUnique( path, index, array ) { return array.indexOf( path ) === index; }); }
[ "function", "extractFolders", "(", "files", ")", "{", "return", "files", ".", "data", ".", "files", ".", "map", "(", "function", "extractPath", "(", "file", ")", "{", "return", "path", ".", "parse", "(", "file", ")", ".", "dir", ";", "}", ")", ".", ...
Parses retrieved KSS meta data and extracts a list of folders to create fixtures for. @param {array} files - a list of all the files retrieved from the KSS meta data. @returns {array} a list of all the folders to create fixtures for.
[ "Parses", "retrieved", "KSS", "meta", "data", "and", "extracts", "a", "list", "of", "folders", "to", "create", "fixtures", "for", "." ]
2cd69772c7888f2c787641e2ef65d54cb1af839f
https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L71-L77
train
plum-css/plum-fixture
lib/generator.js
createFixtures
function createFixtures( path ) { return parseKSS( path ) .then( extractFixturesData ) .then( function( data ) { return saveFixture( data[0].name, data, path ); }) }
javascript
function createFixtures( path ) { return parseKSS( path ) .then( extractFixturesData ) .then( function( data ) { return saveFixture( data[0].name, data, path ); }) }
[ "function", "createFixtures", "(", "path", ")", "{", "return", "parseKSS", "(", "path", ")", ".", "then", "(", "extractFixturesData", ")", ".", "then", "(", "function", "(", "data", ")", "{", "return", "saveFixture", "(", "data", "[", "0", "]", ".", "n...
Parses a folder of stylesheets containing KSS meta data and creates and saves a fixture. @param {string} path - build and save a fixture for this path.
[ "Parses", "a", "folder", "of", "stylesheets", "containing", "KSS", "meta", "data", "and", "creates", "and", "saves", "a", "fixture", "." ]
2cd69772c7888f2c787641e2ef65d54cb1af839f
https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L84-L90
train
plum-css/plum-fixture
lib/generator.js
extractFixturesData
function extractFixturesData( data ) { return Promise.map( data.section(), function( section ) { var markup = section.markup(); var ext = path.extname( markup ); var testDir = data.data.files[0].split("/") .filter(function(dir, i) { return i <= 2; }) ...
javascript
function extractFixturesData( data ) { return Promise.map( data.section(), function( section ) { var markup = section.markup(); var ext = path.extname( markup ); var testDir = data.data.files[0].split("/") .filter(function(dir, i) { return i <= 2; }) ...
[ "function", "extractFixturesData", "(", "data", ")", "{", "return", "Promise", ".", "map", "(", "data", ".", "section", "(", ")", ",", "function", "(", "section", ")", "{", "var", "markup", "=", "section", ".", "markup", "(", ")", ";", "var", "ext", ...
Builds an object out of KSS meta data that can be used to populate a template. @param {object} - kss meta data object @returns {Promise.array} array of fixture data that can be used to populate a template.
[ "Builds", "an", "object", "out", "of", "KSS", "meta", "data", "that", "can", "be", "used", "to", "populate", "a", "template", "." ]
2cd69772c7888f2c787641e2ef65d54cb1af839f
https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L98-L116
train
plum-css/plum-fixture
lib/generator.js
saveFixture
function saveFixture( name, data, directory ) { return fs.readFileAsync( template, 'utf8' ) .then( function renderTemplate( template ) { return mustache.render( template, { stylesheets: stylesheets, sections: data } ); }).then( function saveTemplate( templateData ) { return fs.outputFile...
javascript
function saveFixture( name, data, directory ) { return fs.readFileAsync( template, 'utf8' ) .then( function renderTemplate( template ) { return mustache.render( template, { stylesheets: stylesheets, sections: data } ); }).then( function saveTemplate( templateData ) { return fs.outputFile...
[ "function", "saveFixture", "(", "name", ",", "data", ",", "directory", ")", "{", "return", "fs", ".", "readFileAsync", "(", "template", ",", "'utf8'", ")", ".", "then", "(", "function", "renderTemplate", "(", "template", ")", "{", "return", "mustache", "."...
Populates a template and saves it as a fixture file. @param {object} name - the name of the data sections. @param {array} data - template data array. @param {string} directory - parent directory to save the fixture to. @returns {Promise}
[ "Populates", "a", "template", "and", "saves", "it", "as", "a", "fixture", "file", "." ]
2cd69772c7888f2c787641e2ef65d54cb1af839f
https://github.com/plum-css/plum-fixture/blob/2cd69772c7888f2c787641e2ef65d54cb1af839f/lib/generator.js#L126-L133
train
syntax-tree/hast-util-to-dom
src/index.js
root
function root(node, options = {}) { const { fragment, namespace: optionsNamespace, } = options; const { children = [] } = node; const { length: childrenLength } = children; let namespace = optionsNamespace; let rootIsDocument = childrenLength === 0; for (let i = 0; i < childrenLength; i += 1) { ...
javascript
function root(node, options = {}) { const { fragment, namespace: optionsNamespace, } = options; const { children = [] } = node; const { length: childrenLength } = children; let namespace = optionsNamespace; let rootIsDocument = childrenLength === 0; for (let i = 0; i < childrenLength; i += 1) { ...
[ "function", "root", "(", "node", ",", "options", "=", "{", "}", ")", "{", "const", "{", "fragment", ",", "namespace", ":", "optionsNamespace", ",", "}", "=", "options", ";", "const", "{", "children", "=", "[", "]", "}", "=", "node", ";", "const", "...
Transform a document
[ "Transform", "a", "document" ]
f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62
https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L29-L81
train
syntax-tree/hast-util-to-dom
src/index.js
doctype
function doctype(node) { return document.implementation.createDocumentType( node.name || 'html', node.public || '', node.system || '', ); }
javascript
function doctype(node) { return document.implementation.createDocumentType( node.name || 'html', node.public || '', node.system || '', ); }
[ "function", "doctype", "(", "node", ")", "{", "return", "document", ".", "implementation", ".", "createDocumentType", "(", "node", ".", "name", "||", "'html'", ",", "node", ".", "public", "||", "''", ",", "node", ".", "system", "||", "''", ",", ")", ";...
Transform a DOCTYPE
[ "Transform", "a", "DOCTYPE" ]
f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62
https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L86-L92
train
syntax-tree/hast-util-to-dom
src/index.js
element
function element(node, options = {}) { const { namespace } = options; const { tagName, properties, children = [] } = node; const el = typeof namespace !== 'undefined' ? document.createElementNS(namespace, tagName) : document.createElement(tagName); // Add HTML attributes const props = Object.keys(pro...
javascript
function element(node, options = {}) { const { namespace } = options; const { tagName, properties, children = [] } = node; const el = typeof namespace !== 'undefined' ? document.createElementNS(namespace, tagName) : document.createElement(tagName); // Add HTML attributes const props = Object.keys(pro...
[ "function", "element", "(", "node", ",", "options", "=", "{", "}", ")", "{", "const", "{", "namespace", "}", "=", "options", ";", "const", "{", "tagName", ",", "properties", ",", "children", "=", "[", "]", "}", "=", "node", ";", "const", "el", "=",...
Transform an element
[ "Transform", "an", "element" ]
f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62
https://github.com/syntax-tree/hast-util-to-dom/blob/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62/src/index.js#L111-L187
train
CollinEstes/astro-cli
src/processCommands.js
processCommand
function processCommand (cmd, options) { var module = checkForModule(cmd); // execute module if exists if (module) { return executeModule(module, options); } else { processInstallCommands(['install', cmd], options, function (err) { if (err) { noModuleFound(cmd); } module = checkForModule(cmd); ...
javascript
function processCommand (cmd, options) { var module = checkForModule(cmd); // execute module if exists if (module) { return executeModule(module, options); } else { processInstallCommands(['install', cmd], options, function (err) { if (err) { noModuleFound(cmd); } module = checkForModule(cmd); ...
[ "function", "processCommand", "(", "cmd", ",", "options", ")", "{", "var", "module", "=", "checkForModule", "(", "cmd", ")", ";", "// execute module if exists", "if", "(", "module", ")", "{", "return", "executeModule", "(", "module", ",", "options", ")", ";"...
process the command
[ "process", "the", "command" ]
261cdecade954f9b4277ccf968b577513edda587
https://github.com/CollinEstes/astro-cli/blob/261cdecade954f9b4277ccf968b577513edda587/src/processCommands.js#L38-L57
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
Phaser
function Phaser(element) { check(element, 'element').is.anInstanceOf(Element)(); var priv = {}; priv.elem = element; priv.phase = null; priv.listeners = []; priv.phaseTriggers = new MultiMap(); priv.started = false; var pub = {}; var methods = [ getPhase, nextPhase, addPhaseListener, ...
javascript
function Phaser(element) { check(element, 'element').is.anInstanceOf(Element)(); var priv = {}; priv.elem = element; priv.phase = null; priv.listeners = []; priv.phaseTriggers = new MultiMap(); priv.started = false; var pub = {}; var methods = [ getPhase, nextPhase, addPhaseListener, ...
[ "function", "Phaser", "(", "element", ")", "{", "check", "(", "element", ",", "'element'", ")", ".", "is", ".", "anInstanceOf", "(", "Element", ")", "(", ")", ";", "var", "priv", "=", "{", "}", ";", "priv", ".", "elem", "=", "element", ";", "priv",...
Creates Phaser. This constructor has no side-effects. This means that no ${link Phase phase class name} is set on given **element** and no eventlistener is set after calling it. For phaser to start doing some work, ${link Phaser.prototype.setPhase}, ${link Phaser.prototype.startTransition} or ${link Phaser.prototype.a...
[ "Creates", "Phaser", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L81-L109
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
nextPhase
function nextPhase(priv) { setPhase(priv, PHASE_VALUES[(PHASE_VALUES.indexOf(priv.phase) + 1) % PHASE_VALUES.length]); }
javascript
function nextPhase(priv) { setPhase(priv, PHASE_VALUES[(PHASE_VALUES.indexOf(priv.phase) + 1) % PHASE_VALUES.length]); }
[ "function", "nextPhase", "(", "priv", ")", "{", "setPhase", "(", "priv", ",", "PHASE_VALUES", "[", "(", "PHASE_VALUES", ".", "indexOf", "(", "priv", ".", "phase", ")", "+", "1", ")", "%", "PHASE_VALUES", ".", "length", "]", ")", ";", "}" ]
Switches phase to next one. This method is automatically invoked each time a transition ends on DOM element added as phase trigger. @fqn Phaser.prototype.nextPhase
[ "Switches", "phase", "to", "next", "one", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L133-L135
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
setPhase
function setPhase(priv, phase) { check(phase, 'phase').is.oneOf(PHASE_VALUES)(); if (priv.phase !== null) { priv.elem.classList.remove(priv.phase); } priv.phase = phase; if (phase !== null) { priv.elem.classList.add(phase); } priv.listeners.forEach(function(listener) { listener(phase); }); ...
javascript
function setPhase(priv, phase) { check(phase, 'phase').is.oneOf(PHASE_VALUES)(); if (priv.phase !== null) { priv.elem.classList.remove(priv.phase); } priv.phase = phase; if (phase !== null) { priv.elem.classList.add(phase); } priv.listeners.forEach(function(listener) { listener(phase); }); ...
[ "function", "setPhase", "(", "priv", ",", "phase", ")", "{", "check", "(", "phase", ",", "'phase'", ")", ".", "is", ".", "oneOf", "(", "PHASE_VALUES", ")", "(", ")", ";", "if", "(", "priv", ".", "phase", "!==", "null", ")", "{", "priv", ".", "ele...
Changes current phase. Invoking this method will result in setting CSS class name of requested phase on container element. @param {String} phase desired phase @fqn Phaser.prototype.setPhase
[ "Changes", "current", "phase", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L146-L160
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
addPhaseTrigger
function addPhaseTrigger(priv, target, propertyName) { check(target, 'target').is.anEventTarget(); var property = propertyName || 'transform'; check(property, 'property').is.aString(); if (property === 'transform') { property = feature.transformPropertyName; } priv.phaseTriggers.put(property, target); ...
javascript
function addPhaseTrigger(priv, target, propertyName) { check(target, 'target').is.anEventTarget(); var property = propertyName || 'transform'; check(property, 'property').is.aString(); if (property === 'transform') { property = feature.transformPropertyName; } priv.phaseTriggers.put(property, target); ...
[ "function", "addPhaseTrigger", "(", "priv", ",", "target", ",", "propertyName", ")", "{", "check", "(", "target", ",", "'target'", ")", ".", "is", ".", "anEventTarget", "(", ")", ";", "var", "property", "=", "propertyName", "||", "'transform'", ";", "check...
Adds passed target to phase triggers. Phase will be automatically set to next each time a `transitionend` event of matching **target** and **propertyName** bubbles up to Phaser's container element. @param {Node} target (typically DOM Element) that will trigger next phase when matched @param {String} propertyName will...
[ "Adds", "passed", "target", "to", "phase", "triggers", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L175-L185
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
addPhaseListener
function addPhaseListener(priv, listener) { priv.listeners.push(check(listener, 'listener').is.aFunction()); }
javascript
function addPhaseListener(priv, listener) { priv.listeners.push(check(listener, 'listener').is.aFunction()); }
[ "function", "addPhaseListener", "(", "priv", ",", "listener", ")", "{", "priv", ".", "listeners", ".", "push", "(", "check", "(", "listener", ",", "'listener'", ")", ".", "is", ".", "aFunction", "(", ")", ")", ";", "}" ]
Adds a listener that will be notified on phase changes. It is used by the ${link Slider} to change styles of dots representing slides. @param {Function} listener listener to be added @fqn Phaser.prototype.addPhaseListener
[ "Adds", "a", "listener", "that", "will", "be", "notified", "on", "phase", "changes", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L196-L198
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
removePhaseTrigger
function removePhaseTrigger(priv, target, propertyName) { var property = propertyName || 'transform'; check(property, 'property').is.aString(); var triggerElements = priv.phaseTriggers.get(property); check(target, 'target').is.instanceOf(EventTarget).and.is.oneOf(triggerElements, 'phase triggers')(); trigger...
javascript
function removePhaseTrigger(priv, target, propertyName) { var property = propertyName || 'transform'; check(property, 'property').is.aString(); var triggerElements = priv.phaseTriggers.get(property); check(target, 'target').is.instanceOf(EventTarget).and.is.oneOf(triggerElements, 'phase triggers')(); trigger...
[ "function", "removePhaseTrigger", "(", "priv", ",", "target", ",", "propertyName", ")", "{", "var", "property", "=", "propertyName", "||", "'transform'", ";", "check", "(", "property", ",", "'property'", ")", ".", "is", ".", "aString", "(", ")", ";", "var"...
Removes passed target from phase triggers. @param {Node} target that will no longer be used as a phase trigger @param {String} transitionProperty that will no longer be a trigger (optional, defaults to 'transform') @precondition given pair of **target** and **propertyName** is registered as phase trigger @fqn Phaser....
[ "Removes", "passed", "target", "from", "phase", "triggers", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L209-L216
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
removePhaseListener
function removePhaseListener(priv, listener) { check(listener, 'listener').is.aFunction.and.is.oneOf(priv.listeners, 'registered listeners')(); priv.listeners.splice(priv.listeners.indexOf(listener), 1); }
javascript
function removePhaseListener(priv, listener) { check(listener, 'listener').is.aFunction.and.is.oneOf(priv.listeners, 'registered listeners')(); priv.listeners.splice(priv.listeners.indexOf(listener), 1); }
[ "function", "removePhaseListener", "(", "priv", ",", "listener", ")", "{", "check", "(", "listener", ",", "'listener'", ")", ".", "is", ".", "aFunction", ".", "and", ".", "is", ".", "oneOf", "(", "priv", ".", "listeners", ",", "'registered listeners'", ")"...
Removes passed listener from the phaser. @param {Function} listener listener to be removed @fqn Phaser.prototype.removePhaseListener
[ "Removes", "passed", "listener", "from", "the", "phaser", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L224-L227
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
maybeStart
function maybeStart(priv) { if (priv.started) { return; } priv.elem.addEventListener(feature.transitionEventName, handleTransitionEnd.bind(null, priv)); priv.started = true; }
javascript
function maybeStart(priv) { if (priv.started) { return; } priv.elem.addEventListener(feature.transitionEventName, handleTransitionEnd.bind(null, priv)); priv.started = true; }
[ "function", "maybeStart", "(", "priv", ")", "{", "if", "(", "priv", ".", "started", ")", "{", "return", ";", "}", "priv", ".", "elem", ".", "addEventListener", "(", "feature", ".", "transitionEventName", ",", "handleTransitionEnd", ".", "bind", "(", "null"...
Attaches event listener to phasers DOM element, if phaser was not previously started.
[ "Attaches", "event", "listener", "to", "phasers", "DOM", "element", "if", "phaser", "was", "not", "previously", "started", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L241-L247
train
mchalapuk/hyper-text-slider
lib/core/phaser.js
handleTransitionEnd
function handleTransitionEnd(priv, evt) { if (evt.propertyName in priv.phaseTriggers && priv.phaseTriggers[evt.propertyName].indexOf(evt.target) !== -1) { nextPhase(priv); } }
javascript
function handleTransitionEnd(priv, evt) { if (evt.propertyName in priv.phaseTriggers && priv.phaseTriggers[evt.propertyName].indexOf(evt.target) !== -1) { nextPhase(priv); } }
[ "function", "handleTransitionEnd", "(", "priv", ",", "evt", ")", "{", "if", "(", "evt", ".", "propertyName", "in", "priv", ".", "phaseTriggers", "&&", "priv", ".", "phaseTriggers", "[", "evt", ".", "propertyName", "]", ".", "indexOf", "(", "evt", ".", "t...
Moves to next phase if transition that ended matches one of phase triggers.
[ "Moves", "to", "next", "phase", "if", "transition", "that", "ended", "matches", "one", "of", "phase", "triggers", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/core/phaser.js#L250-L255
train
haraldrudell/nodegod
lib/master/streamlabeller.js
logChild
function logChild(child, slogan, write) { if (child) { logSocket(child.stdout, slogan, write) logSocket(child.stderr, slogan, write) } }
javascript
function logChild(child, slogan, write) { if (child) { logSocket(child.stdout, slogan, write) logSocket(child.stderr, slogan, write) } }
[ "function", "logChild", "(", "child", ",", "slogan", ",", "write", ")", "{", "if", "(", "child", ")", "{", "logSocket", "(", "child", ".", "stdout", ",", "slogan", ",", "write", ")", "logSocket", "(", "child", ".", "stderr", ",", "slogan", ",", "writ...
log joint output for a child process
[ "log", "joint", "output", "for", "a", "child", "process" ]
3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21
https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/master/streamlabeller.js#L10-L15
train
Whitebolt/require-extra
tasks/jsdoc-json.js
parseJsDoc
function parseJsDoc(filePath, jsdoc) { return jsdoc.explain({files:[filePath]}).then(items=>{ const data = {}; items.forEach(item=>{ if (!item.undocumented && !data.hasOwnProperty(item.longname)) { data[item.longname] = { name: item.name, description: item.classdesc || item....
javascript
function parseJsDoc(filePath, jsdoc) { return jsdoc.explain({files:[filePath]}).then(items=>{ const data = {}; items.forEach(item=>{ if (!item.undocumented && !data.hasOwnProperty(item.longname)) { data[item.longname] = { name: item.name, description: item.classdesc || item....
[ "function", "parseJsDoc", "(", "filePath", ",", "jsdoc", ")", "{", "return", "jsdoc", ".", "explain", "(", "{", "files", ":", "[", "filePath", "]", "}", ")", ".", "then", "(", "items", "=>", "{", "const", "data", "=", "{", "}", ";", "items", ".", ...
Parse an input file for jsDoc and put json results in give output file. @param {string} filePath File path to parse jsDoc from. @param {Object} jsdoc The jsdoc class. @returns {Promise.<Object>} Parsed jsDoc data.
[ "Parse", "an", "input", "file", "for", "jsDoc", "and", "put", "json", "results", "in", "give", "output", "file", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/tasks/jsdoc-json.js#L12-L26
train
pierrec/node-ekam
lib/js-ast.js
build
function build (data, cache, scope) { scope = scope || { var: '' } return data .map(function (item) { return typeof item === 'string' ? item : Buffer.isBuffer(item) ? item.toString() : item.run(cache, scope) }) .join('') }
javascript
function build (data, cache, scope) { scope = scope || { var: '' } return data .map(function (item) { return typeof item === 'string' ? item : Buffer.isBuffer(item) ? item.toString() : item.run(cache, scope) }) .join('') }
[ "function", "build", "(", "data", ",", "cache", ",", "scope", ")", "{", "scope", "=", "scope", "||", "{", "var", ":", "''", "}", "return", "data", ".", "map", "(", "function", "(", "item", ")", "{", "return", "typeof", "item", "===", "'string'", "?...
Walk the AST and evaluate the nodes
[ "Walk", "the", "AST", "and", "evaluate", "the", "nodes" ]
fd36038231c4f49ecae36e25352138cba0ac11aa
https://github.com/pierrec/node-ekam/blob/fd36038231c4f49ecae36e25352138cba0ac11aa/lib/js-ast.js#L16-L28
train
redgeoff/sporks
scripts/promise-sporks.js
function (err) { if (err) { reject(err); } else if (arguments.length === 2) { // single param? resolve(arguments[1]); } else { // multiple params? var cbArgsArray = self.toArgsArray(arguments); resolve(cbArgsArray.slice(1)); // remove err arg } ...
javascript
function (err) { if (err) { reject(err); } else if (arguments.length === 2) { // single param? resolve(arguments[1]); } else { // multiple params? var cbArgsArray = self.toArgsArray(arguments); resolve(cbArgsArray.slice(1)); // remove err arg } ...
[ "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "reject", "(", "err", ")", ";", "}", "else", "if", "(", "arguments", ".", "length", "===", "2", ")", "{", "// single param?", "resolve", "(", "arguments", "[", "1", "]", ")", ";", "}",...
Define a callback and add it to the arguments
[ "Define", "a", "callback", "and", "add", "it", "to", "the", "arguments" ]
de1f0b603f2bc82c973d76fb662da8a0d295da90
https://github.com/redgeoff/sporks/blob/de1f0b603f2bc82c973d76fb662da8a0d295da90/scripts/promise-sporks.js#L57-L66
train
feedhenry/fh-mbaas-client
lib/admin/stats/stats.js
history
function history(params, cb) { params.resourcePath = config.addURIParams(constants.STATS_BASE_PATH + "/history", params); params.method = 'POST'; params.data = params.data || {}; mbaasRequest.admin(params, cb); }
javascript
function history(params, cb) { params.resourcePath = config.addURIParams(constants.STATS_BASE_PATH + "/history", params); params.method = 'POST'; params.data = params.data || {}; mbaasRequest.admin(params, cb); }
[ "function", "history", "(", "params", ",", "cb", ")", "{", "params", ".", "resourcePath", "=", "config", ".", "addURIParams", "(", "constants", ".", "STATS_BASE_PATH", "+", "\"/history\"", ",", "params", ")", ";", "params", ".", "method", "=", "'POST'", ";...
Stats history post request to an MBaaS @param params @param cb
[ "Stats", "history", "post", "request", "to", "an", "MBaaS" ]
2d5a9cbb32e1b2464d71ffa18513358fea388859
https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/stats/stats.js#L11-L16
train
baskerville/ciebase
src/matrix.js
transpose
function transpose (M) { return ( [[M[0][0], M[1][0], M[2][0]], [M[0][1], M[1][1], M[2][1]], [M[0][2], M[1][2], M[2][2]]] ); }
javascript
function transpose (M) { return ( [[M[0][0], M[1][0], M[2][0]], [M[0][1], M[1][1], M[2][1]], [M[0][2], M[1][2], M[2][2]]] ); }
[ "function", "transpose", "(", "M", ")", "{", "return", "(", "[", "[", "M", "[", "0", "]", "[", "0", "]", ",", "M", "[", "1", "]", "[", "0", "]", ",", "M", "[", "2", "]", "[", "0", "]", "]", ",", "[", "M", "[", "0", "]", "[", "1", "]...
3x3 matrices operations
[ "3x3", "matrices", "operations" ]
11508fc4857f114c91a94a12173fcdaf42db52bf
https://github.com/baskerville/ciebase/blob/11508fc4857f114c91a94a12173fcdaf42db52bf/src/matrix.js#L3-L9
train
nodecg/bundle-manager
index.js
handleChange
function handleChange(bundleName) { const bundle = module.exports.find(bundleName); /* istanbul ignore if: It's rare for `bundle` to be undefined here, but it can happen when using black/whitelisting. */ if (!bundle) { return; } if (backoffTimer) { log.debug('Backoff active, delaying processing of change det...
javascript
function handleChange(bundleName) { const bundle = module.exports.find(bundleName); /* istanbul ignore if: It's rare for `bundle` to be undefined here, but it can happen when using black/whitelisting. */ if (!bundle) { return; } if (backoffTimer) { log.debug('Backoff active, delaying processing of change det...
[ "function", "handleChange", "(", "bundleName", ")", "{", "const", "bundle", "=", "module", ".", "exports", ".", "find", "(", "bundleName", ")", ";", "/* istanbul ignore if: It's rare for `bundle` to be undefined here, but it can happen when using black/whitelisting. */", "if", ...
Emits a `bundleChanged` event for the given bundle. @param bundleName {String}
[ "Emits", "a", "bundleChanged", "event", "for", "the", "given", "bundle", "." ]
11eedf320480ca318da7ad455f31771fb8f44d13
https://github.com/nodecg/bundle-manager/blob/11eedf320480ca318da7ad455f31771fb8f44d13/index.js#L257-L284
train
nodecg/bundle-manager
index.js
extractBundleName
function extractBundleName(filePath) { const parts = filePath.replace(bundlesPath, '').split(path.sep); return parts[1]; }
javascript
function extractBundleName(filePath) { const parts = filePath.replace(bundlesPath, '').split(path.sep); return parts[1]; }
[ "function", "extractBundleName", "(", "filePath", ")", "{", "const", "parts", "=", "filePath", ".", "replace", "(", "bundlesPath", ",", "''", ")", ".", "split", "(", "path", ".", "sep", ")", ";", "return", "parts", "[", "1", "]", ";", "}" ]
Returns the name of a bundle that owns a given path. @param filePath {String} - The path of the file to extract a bundle name from. @returns {String} - The name of the bundle that owns this path. @private
[ "Returns", "the", "name", "of", "a", "bundle", "that", "owns", "a", "given", "path", "." ]
11eedf320480ca318da7ad455f31771fb8f44d13
https://github.com/nodecg/bundle-manager/blob/11eedf320480ca318da7ad455f31771fb8f44d13/index.js#L312-L315
train
jwhitmarsh/gulp-npm-check
lib/index.js
handleMismatch
function handleMismatch(results, config) { if (results.length) { var message = 'Out of date packages: \n' + results.map(function (p) { return moduleInfo(p); }).join('\n'); if (config.throw === undefined || config.throw !== undefined && config.throw) { throw new _gulpUtil.PluginError('gulp-npm-...
javascript
function handleMismatch(results, config) { if (results.length) { var message = 'Out of date packages: \n' + results.map(function (p) { return moduleInfo(p); }).join('\n'); if (config.throw === undefined || config.throw !== undefined && config.throw) { throw new _gulpUtil.PluginError('gulp-npm-...
[ "function", "handleMismatch", "(", "results", ",", "config", ")", "{", "if", "(", "results", ".", "length", ")", "{", "var", "message", "=", "'Out of date packages: \\n'", "+", "results", ".", "map", "(", "function", "(", "p", ")", "{", "return", "moduleIn...
do things with results @param {array} results results from npm-check @param {config} config object Default method @param {!config} config object @param {Function} cb callback
[ "do", "things", "with", "results" ]
be399d571c4b795fcd9aa0c1495aa1e34781557f
https://github.com/jwhitmarsh/gulp-npm-check/blob/be399d571c4b795fcd9aa0c1495aa1e34781557f/lib/index.js#L95-L111
train
vladaspasic/ember-cli-data-validation
addon/validator.js
format
function format(str, formats) { let cachedFormats = formats; if (!Ember.isArray(cachedFormats) || arguments.length > 2) { cachedFormats = new Array(arguments.length - 1); for (let i = 1, l = arguments.length; i < l; i++) { cachedFormats[i - 1] = arguments[i]; } } let idx = 0; return str.replace(/%@([0-...
javascript
function format(str, formats) { let cachedFormats = formats; if (!Ember.isArray(cachedFormats) || arguments.length > 2) { cachedFormats = new Array(arguments.length - 1); for (let i = 1, l = arguments.length; i < l; i++) { cachedFormats[i - 1] = arguments[i]; } } let idx = 0; return str.replace(/%@([0-...
[ "function", "format", "(", "str", ",", "formats", ")", "{", "let", "cachedFormats", "=", "formats", ";", "if", "(", "!", "Ember", ".", "isArray", "(", "cachedFormats", ")", "||", "arguments", ".", "length", ">", "2", ")", "{", "cachedFormats", "=", "ne...
Implement Ember.String.fmt function, to avoid depreciation warnings
[ "Implement", "Ember", ".", "String", ".", "fmt", "function", "to", "avoid", "depreciation", "warnings" ]
08ee8694b9276bf7cbb40e8bc69c52592bb512d3
https://github.com/vladaspasic/ember-cli-data-validation/blob/08ee8694b9276bf7cbb40e8bc69c52592bb512d3/addon/validator.js#L4-L21
train
vladaspasic/ember-cli-data-validation
addon/validator.js
function() { const message = this.get('message'); const label = this.get('attributeLabel'); Ember.assert('Message must be defined for this Validator', Ember.isPresent(message)); const args = Array.prototype.slice.call(arguments); args.unshift(label); args.unshift(message); return format.apply(null, ar...
javascript
function() { const message = this.get('message'); const label = this.get('attributeLabel'); Ember.assert('Message must be defined for this Validator', Ember.isPresent(message)); const args = Array.prototype.slice.call(arguments); args.unshift(label); args.unshift(message); return format.apply(null, ar...
[ "function", "(", ")", "{", "const", "message", "=", "this", ".", "get", "(", "'message'", ")", ";", "const", "label", "=", "this", ".", "get", "(", "'attributeLabel'", ")", ";", "Ember", ".", "assert", "(", "'Message must be defined for this Validator'", ","...
Formats the validation error message. All arguments passed to this function would be used by the `Ember.String.fmt` method to format the message. @method format @return {String}
[ "Formats", "the", "validation", "error", "message", "." ]
08ee8694b9276bf7cbb40e8bc69c52592bb512d3
https://github.com/vladaspasic/ember-cli-data-validation/blob/08ee8694b9276bf7cbb40e8bc69c52592bb512d3/addon/validator.js#L94-L106
train
theboyWhoCriedWoolf/transition-manager
src/utils/unique.js
unique
function unique( target, arrays ) { target = target || []; var combined = target.concat( arrays ); target = []; var len = combined.length, i = -1, ObjRef; while(++i < len) { ObjRef = combined[ i ]; if( target.indexOf( ObjRef ) === -1 && ObjRef !== '' & ObjRef !== (null || undefined) ) { target...
javascript
function unique( target, arrays ) { target = target || []; var combined = target.concat( arrays ); target = []; var len = combined.length, i = -1, ObjRef; while(++i < len) { ObjRef = combined[ i ]; if( target.indexOf( ObjRef ) === -1 && ObjRef !== '' & ObjRef !== (null || undefined) ) { target...
[ "function", "unique", "(", "target", ",", "arrays", ")", "{", "target", "=", "target", "||", "[", "]", ";", "var", "combined", "=", "target", ".", "concat", "(", "arrays", ")", ";", "target", "=", "[", "]", ";", "var", "len", "=", "combined", ".", ...
join two arrays and prevent duplication @param {array} target @param {array} arrays @return {array}
[ "join", "two", "arrays", "and", "prevent", "duplication" ]
a20fda0bb07c0098bf709ea03770b1ee2a855655
https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/utils/unique.js#L10-L27
train
ecliptic/webpack-blocks-html
lib/index.js
html
function html(options) { return Object.assign(function (context) { var defaultOpts = { filename: 'index.html', template: 'templates/index.html', showErrors: false }; // Merge the provided html config into the context var html = context.html || defaultOpts; /* Warning: Thar be m...
javascript
function html(options) { return Object.assign(function (context) { var defaultOpts = { filename: 'index.html', template: 'templates/index.html', showErrors: false }; // Merge the provided html config into the context var html = context.html || defaultOpts; /* Warning: Thar be m...
[ "function", "html", "(", "options", ")", "{", "return", "Object", ".", "assign", "(", "function", "(", "context", ")", "{", "var", "defaultOpts", "=", "{", "filename", ":", "'index.html'", ",", "template", ":", "'templates/index.html'", ",", "showErrors", ":...
Webpack block for html-webpack-plugin @see https://github.com/ampedandwired/html-webpack-plugin
[ "Webpack", "block", "for", "html", "-", "webpack", "-", "plugin" ]
6bb540916730177c88b4cfc922eee5d446da7646
https://github.com/ecliptic/webpack-blocks-html/blob/6bb540916730177c88b4cfc922eee5d446da7646/lib/index.js#L22-L41
train
ZeroNetJS/zeronet-swarm
src/zero/index.js
ZNV2Swarm
function ZNV2Swarm (opt, protocol, zeronet, lp2p) { const self = this self.proto = self.protocol = new ZProtocol({ crypto: opt.crypto, id: opt.id }, zeronet) log('creating zeronet swarm') const tr = self.transport = {} self.multiaddrs = (opt.listen || []).map(m => multiaddr(m)); (opt.transports...
javascript
function ZNV2Swarm (opt, protocol, zeronet, lp2p) { const self = this self.proto = self.protocol = new ZProtocol({ crypto: opt.crypto, id: opt.id }, zeronet) log('creating zeronet swarm') const tr = self.transport = {} self.multiaddrs = (opt.listen || []).map(m => multiaddr(m)); (opt.transports...
[ "function", "ZNV2Swarm", "(", "opt", ",", "protocol", ",", "zeronet", ",", "lp2p", ")", "{", "const", "self", "=", "this", "self", ".", "proto", "=", "self", ".", "protocol", "=", "new", "ZProtocol", "(", "{", "crypto", ":", "opt", ".", "crypto", ","...
ZNv2 swarm using libp2p transports
[ "ZNv2", "swarm", "using", "libp2p", "transports" ]
015deb84d4e8a63518eda71d0e6c986f460a28b2
https://github.com/ZeroNetJS/zeronet-swarm/blob/015deb84d4e8a63518eda71d0e6c986f460a28b2/src/zero/index.js#L17-L56
train
OpenSmartEnvironment/ose
lib/ws/read.js
init
function init(cb) { // {{{2 if (typeof cb !== 'function') { throw O.log.error(this, 'Callback must be a function', cb); } this.stream = new Readable(); this.stream._read = O._.noop; this.stream.on('error', onError.bind(this)); cb(null, this.stream); }
javascript
function init(cb) { // {{{2 if (typeof cb !== 'function') { throw O.log.error(this, 'Callback must be a function', cb); } this.stream = new Readable(); this.stream._read = O._.noop; this.stream.on('error', onError.bind(this)); cb(null, this.stream); }
[ "function", "init", "(", "cb", ")", "{", "// {{{2", "if", "(", "typeof", "cb", "!==", "'function'", ")", "{", "throw", "O", ".", "log", ".", "error", "(", "this", ",", "'Callback must be a function'", ",", "cb", ")", ";", "}", "this", ".", "stream", ...
Public {{{1
[ "Public", "{{{", "1" ]
2ab051d9db6e77341c40abb9cbdae6ce586917e0
https://github.com/OpenSmartEnvironment/ose/blob/2ab051d9db6e77341c40abb9cbdae6ce586917e0/lib/ws/read.js#L10-L20
train
IonicaBizau/node-fwatcher
lib/index.js
Watcher
function Watcher(path, handler) { this._ = Fs.watch(path, handler); this.a_path = Abs(path); this.handler = handler; }
javascript
function Watcher(path, handler) { this._ = Fs.watch(path, handler); this.a_path = Abs(path); this.handler = handler; }
[ "function", "Watcher", "(", "path", ",", "handler", ")", "{", "this", ".", "_", "=", "Fs", ".", "watch", "(", "path", ",", "handler", ")", ";", "this", ".", "a_path", "=", "Abs", "(", "path", ")", ";", "this", ".", "handler", "=", "handler", ";",...
Watcher Creates a new instance of the internal `Watcher`. @name Watcher @function @param {String} path The path to the file. @param {Function} handler A function called when the file changes.
[ "Watcher", "Creates", "a", "new", "instance", "of", "the", "internal", "Watcher", "." ]
44487b1645215aae340df8dafb220d47a36c19ca
https://github.com/IonicaBizau/node-fwatcher/blob/44487b1645215aae340df8dafb220d47a36c19ca/lib/index.js#L17-L21
train
IonicaBizau/node-fwatcher
lib/index.js
FileWatcher
function FileWatcher(path, options, callback) { if (typeof options === "function") { callback = options; } if (typeof options === "boolean") { options = { once: options }; } options = Ul.merge(options, { once: false }); var watcher = null , newWatcher = fals...
javascript
function FileWatcher(path, options, callback) { if (typeof options === "function") { callback = options; } if (typeof options === "boolean") { options = { once: options }; } options = Ul.merge(options, { once: false }); var watcher = null , newWatcher = fals...
[ "function", "FileWatcher", "(", "path", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "\"function\"", ")", "{", "callback", "=", "options", ";", "}", "if", "(", "typeof", "options", "===", "\"boolean\"", ")", "{", "opt...
FileWatcher Creates a new file watcher. @name FileWatcher @function @param {String} path The path to the file. @param {Boolean|Options} options A boolean value representing the `once` value or an object containing the following fields: - `once` (Boolean): If `true`, the handler is deleted after first event. @param {...
[ "FileWatcher", "Creates", "a", "new", "file", "watcher", "." ]
44487b1645215aae340df8dafb220d47a36c19ca
https://github.com/IonicaBizau/node-fwatcher/blob/44487b1645215aae340df8dafb220d47a36c19ca/lib/index.js#L51-L110
train
thirdcoder/cpu3502
instr_decode.js
disasm1
function disasm1(machine_code, offset=0) { let di = decode_instruction(machine_code[offset]); let opcode, operand; let consumed = 1; // 1-tryte opcode, incremented later if operands if (di.family === 0) { opcode = invertKv(OP)[di.operation]; // inefficient lookup, but probably doesn't matter // note:...
javascript
function disasm1(machine_code, offset=0) { let di = decode_instruction(machine_code[offset]); let opcode, operand; let consumed = 1; // 1-tryte opcode, incremented later if operands if (di.family === 0) { opcode = invertKv(OP)[di.operation]; // inefficient lookup, but probably doesn't matter // note:...
[ "function", "disasm1", "(", "machine_code", ",", "offset", "=", "0", ")", "{", "let", "di", "=", "decode_instruction", "(", "machine_code", "[", "offset", "]", ")", ";", "let", "opcode", ",", "operand", ";", "let", "consumed", "=", "1", ";", "// 1-tryte ...
Disassemble one instruction in machine_code
[ "Disassemble", "one", "instruction", "in", "machine_code" ]
af1c0c01f75d03443af572e08f14c994585a277b
https://github.com/thirdcoder/cpu3502/blob/af1c0c01f75d03443af572e08f14c994585a277b/instr_decode.js#L140-L202
train
DynoSRC/dynosrc
lib/sources/asset/index.js
function(files, next) { var i = files.indexOf(id); if (i < 0) { return next({ error: 'NOT_FOUND', description: 'Asset not available: ' + searchDir + id }); } next(null, files[i]); }
javascript
function(files, next) { var i = files.indexOf(id); if (i < 0) { return next({ error: 'NOT_FOUND', description: 'Asset not available: ' + searchDir + id }); } next(null, files[i]); }
[ "function", "(", "files", ",", "next", ")", "{", "var", "i", "=", "files", ".", "indexOf", "(", "id", ")", ";", "if", "(", "i", "<", "0", ")", "{", "return", "next", "(", "{", "error", ":", "'NOT_FOUND'", ",", "description", ":", "'Asset not availa...
find Asset for id
[ "find", "Asset", "for", "id" ]
1a763c9310b719a51b0df56387970ecd3f08c438
https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/sources/asset/index.js#L24-L35
train
DynoSRC/dynosrc
lib/sources/asset/index.js
function(dirname, next) { // could be something searchDir += dirname + '/'; var revPath = version && (searchDir + version + '.js'); return next(null, revPath || ''); }
javascript
function(dirname, next) { // could be something searchDir += dirname + '/'; var revPath = version && (searchDir + version + '.js'); return next(null, revPath || ''); }
[ "function", "(", "dirname", ",", "next", ")", "{", "// could be something", "searchDir", "+=", "dirname", "+", "'/'", ";", "var", "revPath", "=", "version", "&&", "(", "searchDir", "+", "version", "+", "'.js'", ")", ";", "return", "next", "(", "null", ",...
look up requested tag
[ "look", "up", "requested", "tag" ]
1a763c9310b719a51b0df56387970ecd3f08c438
https://github.com/DynoSRC/dynosrc/blob/1a763c9310b719a51b0df56387970ecd3f08c438/lib/sources/asset/index.js#L37-L43
train
Rafflecopter/deetoo
lib/Q.js
function(filename, msg, $done) { var __open = _.bind(fs.open, fs, filename, 'a') , __write = util.partial.call(fs, fs.write, undefined, msg) , __close = util.partial.call(fs, fs.close) async.waterfall([__open, __write, __close], $done) }
javascript
function(filename, msg, $done) { var __open = _.bind(fs.open, fs, filename, 'a') , __write = util.partial.call(fs, fs.write, undefined, msg) , __close = util.partial.call(fs, fs.close) async.waterfall([__open, __write, __close], $done) }
[ "function", "(", "filename", ",", "msg", ",", "$done", ")", "{", "var", "__open", "=", "_", ".", "bind", "(", "fs", ".", "open", ",", "fs", ",", "filename", ",", "'a'", ")", ",", "__write", "=", "util", ".", "partial", ".", "call", "(", "fs", "...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ Optional Garbage Collection
[ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "~~", "Optional", "Garbage", "Collection" ]
4d7932efeab35e01fa3a584b6c1253b21f0c4515
https://github.com/Rafflecopter/deetoo/blob/4d7932efeab35e01fa3a584b6c1253b21f0c4515/lib/Q.js#L44-L49
train
iainvdw/gulp-tasker
index.js
function (opts) { var options = extend(true, defaults, opts); requireDir(process.cwd() + options.path, {recurse: options.recurse}); }
javascript
function (opts) { var options = extend(true, defaults, opts); requireDir(process.cwd() + options.path, {recurse: options.recurse}); }
[ "function", "(", "opts", ")", "{", "var", "options", "=", "extend", "(", "true", ",", "defaults", ",", "opts", ")", ";", "requireDir", "(", "process", ".", "cwd", "(", ")", "+", "options", ".", "path", ",", "{", "recurse", ":", "options", ".", "rec...
Load all tasks from the `path` option
[ "Load", "all", "tasks", "from", "the", "path", "option" ]
42e48fa62576bd0a91e06407d11aae09053e558a
https://github.com/iainvdw/gulp-tasker/blob/42e48fa62576bd0a91e06407d11aae09053e558a/index.js#L18-L22
train
iainvdw/gulp-tasker
index.js
function (type, tasks, folder) { if ( !type ) { throw Error('Error registering task: Please specify a task type'); } if ( !tasks ) { throw Error('Error registering task: Please specify at least one task.'); } allTasks[type] = allTasks[type] || {tasks: [], requireFolders: !!folder}; if ( !fo...
javascript
function (type, tasks, folder) { if ( !type ) { throw Error('Error registering task: Please specify a task type'); } if ( !tasks ) { throw Error('Error registering task: Please specify at least one task.'); } allTasks[type] = allTasks[type] || {tasks: [], requireFolders: !!folder}; if ( !fo...
[ "function", "(", "type", ",", "tasks", ",", "folder", ")", "{", "if", "(", "!", "type", ")", "{", "throw", "Error", "(", "'Error registering task: Please specify a task type'", ")", ";", "}", "if", "(", "!", "tasks", ")", "{", "throw", "Error", "(", "'Er...
Register helper to let subtasks register themselves in the 'default' gulp task @param {String} type Type of task to register @param {String|Array} tasks Task name to register in 'default' task @param {String|Array} folder Folder(s) to watch when registering a watch task
[ "Register", "helper", "to", "let", "subtasks", "register", "themselves", "in", "the", "default", "gulp", "task" ]
42e48fa62576bd0a91e06407d11aae09053e558a
https://github.com/iainvdw/gulp-tasker/blob/42e48fa62576bd0a91e06407d11aae09053e558a/index.js#L31-L61
train
eps1lon/poe-i18n
scripts/api/util.js
mergeMessages
async function mergeMessages(locale, messages) { const data_path = path.join(LOCALE_DATA_DIR, `${locale}/api_messages.json`); let old_messages = {}; try { old_messages = require(data_path); } catch (err) { console.log(`creating new messages for locale ${locale}`); } const merged_messages = { ...old_...
javascript
async function mergeMessages(locale, messages) { const data_path = path.join(LOCALE_DATA_DIR, `${locale}/api_messages.json`); let old_messages = {}; try { old_messages = require(data_path); } catch (err) { console.log(`creating new messages for locale ${locale}`); } const merged_messages = { ...old_...
[ "async", "function", "mergeMessages", "(", "locale", ",", "messages", ")", "{", "const", "data_path", "=", "path", ".", "join", "(", "LOCALE_DATA_DIR", ",", "`", "${", "locale", "}", "`", ")", ";", "let", "old_messages", "=", "{", "}", ";", "try", "{",...
merges the messages into the api_messages.json under the specified locale while sorting the resulting json object by keys @param {*} locale @param {*} messages
[ "merges", "the", "messages", "into", "the", "api_messages", ".", "json", "under", "the", "specified", "locale", "while", "sorting", "the", "resulting", "json", "object", "by", "keys" ]
fa92cc4a2be7f321f07a5dba28135db03dc0bc38
https://github.com/eps1lon/poe-i18n/blob/fa92cc4a2be7f321f07a5dba28135db03dc0bc38/scripts/api/util.js#L22-L39
train
emmetio/math-expression
lib/number.js
consumeForward
function consumeForward(stream) { const start = stream.pos; if (stream.eat(DOT) && stream.eatWhile(isNumber)) { // short decimal notation: .025 return true; } if (stream.eatWhile(isNumber) && (!stream.eat(DOT) || stream.eatWhile(isNumber))) { // either integer or decimal: 10, 10.25 return true; } stream...
javascript
function consumeForward(stream) { const start = stream.pos; if (stream.eat(DOT) && stream.eatWhile(isNumber)) { // short decimal notation: .025 return true; } if (stream.eatWhile(isNumber) && (!stream.eat(DOT) || stream.eatWhile(isNumber))) { // either integer or decimal: 10, 10.25 return true; } stream...
[ "function", "consumeForward", "(", "stream", ")", "{", "const", "start", "=", "stream", ".", "pos", ";", "if", "(", "stream", ".", "eat", "(", "DOT", ")", "&&", "stream", ".", "eatWhile", "(", "isNumber", ")", ")", "{", "// short decimal notation: .025", ...
Consumes number in forward stream direction @param {StreamReader} stream @return {Boolean} Returns true if number was consumed
[ "Consumes", "number", "in", "forward", "stream", "direction" ]
31dc028f80c27b5b00be9395e35ebd07c9cd8862
https://github.com/emmetio/math-expression/blob/31dc028f80c27b5b00be9395e35ebd07c9cd8862/lib/number.js#L22-L36
train
emmetio/math-expression
lib/number.js
consumeBackward
function consumeBackward(stream) { const start = stream.pos; let ch, hadDot = false, hadNumber = false; // NB a StreamReader insance can be editor-specific and contain objects // as a position marker. Since we don’t know for sure how to compare editor // position markers, use consumed length instead to detect if n...
javascript
function consumeBackward(stream) { const start = stream.pos; let ch, hadDot = false, hadNumber = false; // NB a StreamReader insance can be editor-specific and contain objects // as a position marker. Since we don’t know for sure how to compare editor // position markers, use consumed length instead to detect if n...
[ "function", "consumeBackward", "(", "stream", ")", "{", "const", "start", "=", "stream", ".", "pos", ";", "let", "ch", ",", "hadDot", "=", "false", ",", "hadNumber", "=", "false", ";", "// NB a StreamReader insance can be editor-specific and contain objects", "// as...
Consumes number in backward stream direction @param {StreamReader} stream @return {Boolean} Returns true if number was consumed
[ "Consumes", "number", "in", "backward", "stream", "direction" ]
31dc028f80c27b5b00be9395e35ebd07c9cd8862
https://github.com/emmetio/math-expression/blob/31dc028f80c27b5b00be9395e35ebd07c9cd8862/lib/number.js#L43-L75
train
k3erg/marantz-denon-upnpdiscovery
index.js
MarantzDenonUPnPDiscovery
function MarantzDenonUPnPDiscovery(callback) { var that = this; var foundDevices = {}; // only report a device once // create socket var socket = dgram.createSocket({type: 'udp4', reuseAddr: true}); socket.unref(); const search = new Buffer([...
javascript
function MarantzDenonUPnPDiscovery(callback) { var that = this; var foundDevices = {}; // only report a device once // create socket var socket = dgram.createSocket({type: 'udp4', reuseAddr: true}); socket.unref(); const search = new Buffer([...
[ "function", "MarantzDenonUPnPDiscovery", "(", "callback", ")", "{", "var", "that", "=", "this", ";", "var", "foundDevices", "=", "{", "}", ";", "// only report a device once", "// create socket", "var", "socket", "=", "dgram", ".", "createSocket", "(", "{", "typ...
Find Denon and marantz devices advertising their services by upnp. @param {function} callback . @constructor
[ "Find", "Denon", "and", "marantz", "devices", "advertising", "their", "services", "by", "upnp", "." ]
5613b4d1c77deea0ec04512c29286b14e0b96676
https://github.com/k3erg/marantz-denon-upnpdiscovery/blob/5613b4d1c77deea0ec04512c29286b14e0b96676/index.js#L22-L87
train
jirwin/node-zither
lib/statsd.js
function(options) { options = options || {}; this.host = options.host || 'localhost'; this.port = options.port || 8125; if (!statsdClients[this.host + ':' + this.port]) { statsdClients[this.host + ':' + this.port] = new StatsD(options); } this.client = statsdClients[this.host + ':' + this.port]; thi...
javascript
function(options) { options = options || {}; this.host = options.host || 'localhost'; this.port = options.port || 8125; if (!statsdClients[this.host + ':' + this.port]) { statsdClients[this.host + ':' + this.port] = new StatsD(options); } this.client = statsdClients[this.host + ':' + this.port]; thi...
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "host", "=", "options", ".", "host", "||", "'localhost'", ";", "this", ".", "port", "=", "options", ".", "port", "||", "8125", ";", "if", "(", "!", ...
A writable stream that acts as a statsd sink for the zither instrument input sources. @param {Obj} options Statsd client options. See https://github.com/sivy/node-statsd for options. Additionally you can include sampleRate to control how Statsd samples data. sampleRate defaults to 1.
[ "A", "writable", "stream", "that", "acts", "as", "a", "statsd", "sink", "for", "the", "zither", "instrument", "input", "sources", "." ]
c8ab7f1cdfd2fdf25bf31d7d6231f2f7977387aa
https://github.com/jirwin/node-zither/blob/c8ab7f1cdfd2fdf25bf31d7d6231f2f7977387aa/lib/statsd.js#L14-L27
train
thirdcoder/cpu3502
arithmetic.js
add
function add(a, b, carryIn=0) { let result = a + b + carryIn; let fullResult = result; let carryOut = 0; // carryOut is 6th trit, truncate result to 5 trits if (result > MAX_TRYTE) { carryOut = 1; result -= MAX_TRYTE * 2 + 1; } else if (result < MIN_TRYTE) { carryOut = -1; // underflow res...
javascript
function add(a, b, carryIn=0) { let result = a + b + carryIn; let fullResult = result; let carryOut = 0; // carryOut is 6th trit, truncate result to 5 trits if (result > MAX_TRYTE) { carryOut = 1; result -= MAX_TRYTE * 2 + 1; } else if (result < MIN_TRYTE) { carryOut = -1; // underflow res...
[ "function", "add", "(", "a", ",", "b", ",", "carryIn", "=", "0", ")", "{", "let", "result", "=", "a", "+", "b", "+", "carryIn", ";", "let", "fullResult", "=", "result", ";", "let", "carryOut", "=", "0", ";", "// carryOut is 6th trit, truncate result to 5...
Add two trytes with optional carry, returning result and overflow
[ "Add", "two", "trytes", "with", "optional", "carry", "returning", "result", "and", "overflow" ]
af1c0c01f75d03443af572e08f14c994585a277b
https://github.com/thirdcoder/cpu3502/blob/af1c0c01f75d03443af572e08f14c994585a277b/arithmetic.js#L6-L31
train
socialally/air
lib/air/html.js
html
function html(markup, outer) { if(!this.length) { return this; } if(typeof markup === 'boolean') { outer = markup; markup = undefined; } var prop = outer ? 'outerHTML' : 'innerHTML'; if(markup === undefined) { return this.dom[0][prop]; } markup = markup || ''; this.each(function(el) { ...
javascript
function html(markup, outer) { if(!this.length) { return this; } if(typeof markup === 'boolean') { outer = markup; markup = undefined; } var prop = outer ? 'outerHTML' : 'innerHTML'; if(markup === undefined) { return this.dom[0][prop]; } markup = markup || ''; this.each(function(el) { ...
[ "function", "html", "(", "markup", ",", "outer", ")", "{", "if", "(", "!", "this", ".", "length", ")", "{", "return", "this", ";", "}", "if", "(", "typeof", "markup", "===", "'boolean'", ")", "{", "outer", "=", "markup", ";", "markup", "=", "undefi...
Get the HTML of the first matched element or set the HTML content of all matched elements. Note that when using `outer` to set `outerHTML` you will likely invalidate the current encapsulated elements and need to re-run the selector to update the matched elements.
[ "Get", "the", "HTML", "of", "the", "first", "matched", "element", "or", "set", "the", "HTML", "content", "of", "all", "matched", "elements", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/html.js#L9-L29
train
feedhenry/fh-mbaas-client
lib/admin/events/events.js
createEvent
function createEvent(params, cb) { params.resourcePath = config.addURIParams(constants.EVENTS_BASE_PATH, params); params.method = 'POST'; params.data = params.data || {}; mbaasRequest.admin(params, cb); }
javascript
function createEvent(params, cb) { params.resourcePath = config.addURIParams(constants.EVENTS_BASE_PATH, params); params.method = 'POST'; params.data = params.data || {}; mbaasRequest.admin(params, cb); }
[ "function", "createEvent", "(", "params", ",", "cb", ")", "{", "params", ".", "resourcePath", "=", "config", ".", "addURIParams", "(", "constants", ".", "EVENTS_BASE_PATH", ",", "params", ")", ";", "params", ".", "method", "=", "'POST'", ";", "params", "."...
Creating an Event on an MBaaS @param params @param cb
[ "Creating", "an", "Event", "on", "an", "MBaaS" ]
2d5a9cbb32e1b2464d71ffa18513358fea388859
https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/admin/events/events.js#L10-L15
train
vid/SenseBase
web/lib/browse-facet.js
augment
function augment(el) { // FIXME should always have a type el.type = el.type || 'category'; el.icon = (typesIcons[el.type] || typesIcons.default).icon; el.data = { value: el.text, type: el.type }; // branch if (el.children && el.children.length > 0) { el.state = { opened: el.children.length > 50 ? false ...
javascript
function augment(el) { // FIXME should always have a type el.type = el.type || 'category'; el.icon = (typesIcons[el.type] || typesIcons.default).icon; el.data = { value: el.text, type: el.type }; // branch if (el.children && el.children.length > 0) { el.state = { opened: el.children.length > 50 ? false ...
[ "function", "augment", "(", "el", ")", "{", "// FIXME should always have a type", "el", ".", "type", "=", "el", ".", "type", "||", "'category'", ";", "el", ".", "icon", "=", "(", "typesIcons", "[", "el", ".", "type", "]", "||", "typesIcons", ".", "defaul...
add facet counts &c
[ "add", "facet", "counts", "&c" ]
d60bcf28239e7dde437d8a6bdae41a6921dcd05b
https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/lib/browse-facet.js#L58-L79
train
cfpb/objectified
index.js
_tokenize
function _tokenize( prop ) { var tokens = [], patterns, src = prop.source; src = typeof src !== 'string' ? src : src.split(' '); patterns = { operator: /^[+\-\*\/\%]$/, // +-*/% // @TODO Improve this regex to cover numbers like 1,000,000 number: /^\$?\d+[\.,]?\d+$/ }; function _pus...
javascript
function _tokenize( prop ) { var tokens = [], patterns, src = prop.source; src = typeof src !== 'string' ? src : src.split(' '); patterns = { operator: /^[+\-\*\/\%]$/, // +-*/% // @TODO Improve this regex to cover numbers like 1,000,000 number: /^\$?\d+[\.,]?\d+$/ }; function _pus...
[ "function", "_tokenize", "(", "prop", ")", "{", "var", "tokens", "=", "[", "]", ",", "patterns", ",", "src", "=", "prop", ".", "source", ";", "src", "=", "typeof", "src", "!==", "'string'", "?", "src", ":", "src", ".", "split", "(", "' '", ")", "...
Split source strings and taxonimize language. @param {string|function} src String to tokenize. If it's a function, leave it. @return {array} Array of objects, each a token.
[ "Split", "source", "strings", "and", "taxonimize", "language", "." ]
252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d
https://github.com/cfpb/objectified/blob/252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d/index.js#L19-L59
train
cfpb/objectified
index.js
_getDOMElement
function _getDOMElement( container, str ) { var el = container.querySelector( '[name=' + str + ']' ); return el ? el : null; }
javascript
function _getDOMElement( container, str ) { var el = container.querySelector( '[name=' + str + ']' ); return el ? el : null; }
[ "function", "_getDOMElement", "(", "container", ",", "str", ")", "{", "var", "el", "=", "container", ".", "querySelector", "(", "'[name='", "+", "str", "+", "']'", ")", ";", "return", "el", "?", "el", ":", "null", ";", "}" ]
Returns the first element matching the provided string. @param {object} container DOM element node of parent container. @param {string} str Value to be provided to the selector. @return {object} Element object.
[ "Returns", "the", "first", "element", "matching", "the", "provided", "string", "." ]
252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d
https://github.com/cfpb/objectified/blob/252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d/index.js#L67-L70
train
cfpb/objectified
index.js
_deTokenize
function _deTokenize( container, arr ) { var val, tokens = []; function _parseFloat( str ) { return parseFloat( unFormatUSD(str) ); } for ( var i = 0, len = arr.length; i < len; i++ ) { var token = arr[i]; // @TODO DRY this up. if ( token.type === 'function' ) { tokens.push( token....
javascript
function _deTokenize( container, arr ) { var val, tokens = []; function _parseFloat( str ) { return parseFloat( unFormatUSD(str) ); } for ( var i = 0, len = arr.length; i < len; i++ ) { var token = arr[i]; // @TODO DRY this up. if ( token.type === 'function' ) { tokens.push( token....
[ "function", "_deTokenize", "(", "container", ",", "arr", ")", "{", "var", "val", ",", "tokens", "=", "[", "]", ";", "function", "_parseFloat", "(", "str", ")", "{", "return", "parseFloat", "(", "unFormatUSD", "(", "str", ")", ")", ";", "}", "for", "(...
Process an array of tokens, returning a single value. @param {object} container DOM element node of parent container. @param {array} arr Array of tokens created from _tokenize. @return {string|number} The value of the processed tokens.
[ "Process", "an", "array", "of", "tokens", "returning", "a", "single", "value", "." ]
252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d
https://github.com/cfpb/objectified/blob/252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d/index.js#L78-L111
train
cfpb/objectified
index.js
update
function update( container, src, dest ) { for ( var key in src ) { // @TODO Better handle safe defaults. dest[ key ] = _deTokenize( container, src[key] ); } }
javascript
function update( container, src, dest ) { for ( var key in src ) { // @TODO Better handle safe defaults. dest[ key ] = _deTokenize( container, src[key] ); } }
[ "function", "update", "(", "container", ",", "src", ",", "dest", ")", "{", "for", "(", "var", "key", "in", "src", ")", "{", "// @TODO Better handle safe defaults.", "dest", "[", "key", "]", "=", "_deTokenize", "(", "container", ",", "src", "[", "key", "]...
Update the exported object @param {object} container DOM element node of parent container. @param {object} src Tokenize source object. @param {object} dest Object to be updated. @return {undefined}
[ "Update", "the", "exported", "object" ]
252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d
https://github.com/cfpb/objectified/blob/252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d/index.js#L120-L125
train
cfpb/objectified
index.js
objectify
function objectify( id, props ) { // Stores references to elements that will be monitored. var objectifier = {}, // Stores final values that are sent to user. objectified = {}, container = document.querySelector( id ); for ( var i = 0, len = props.length; i < len; i++ ) { if ( props[i]...
javascript
function objectify( id, props ) { // Stores references to elements that will be monitored. var objectifier = {}, // Stores final values that are sent to user. objectified = {}, container = document.querySelector( id ); for ( var i = 0, len = props.length; i < len; i++ ) { if ( props[i]...
[ "function", "objectify", "(", "id", ",", "props", ")", "{", "// Stores references to elements that will be monitored.", "var", "objectifier", "=", "{", "}", ",", "// Stores final values that are sent to user.", "objectified", "=", "{", "}", ",", "container", "=", "docum...
Constructor that processes the provided sources. @param {array} props Array of objects @return {object} Returns a reference to the object that is periodically updated.
[ "Constructor", "that", "processes", "the", "provided", "sources", "." ]
252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d
https://github.com/cfpb/objectified/blob/252d811d2f4900ad35ad22ad7cb4d4b4e0f4e83d/index.js#L132-L157
train
writetome51/array-has
dist/privy/arrayHas.js
arrayHas
function arrayHas(value, array) { error_if_not_array_1.errorIfNotArray(array); return (array.length > 0 && (array_get_indexes_1.getFirstIndexOf(value, array) > -1)); }
javascript
function arrayHas(value, array) { error_if_not_array_1.errorIfNotArray(array); return (array.length > 0 && (array_get_indexes_1.getFirstIndexOf(value, array) > -1)); }
[ "function", "arrayHas", "(", "value", ",", "array", ")", "{", "error_if_not_array_1", ".", "errorIfNotArray", "(", "array", ")", ";", "return", "(", "array", ".", "length", ">", "0", "&&", "(", "array_get_indexes_1", ".", "getFirstIndexOf", "(", "value", ","...
value cannot be object.
[ "value", "cannot", "be", "object", "." ]
8ced3fda5818940b814bbcdc37e03c65f285a965
https://github.com/writetome51/array-has/blob/8ced3fda5818940b814bbcdc37e03c65f285a965/dist/privy/arrayHas.js#L6-L9
train
NerdDiffer/all-your-base
index.js
local_parseInt
function local_parseInt(str, from, to) { var fn = assignFn(from, to); return convert[fn](str + ''); }
javascript
function local_parseInt(str, from, to) { var fn = assignFn(from, to); return convert[fn](str + ''); }
[ "function", "local_parseInt", "(", "str", ",", "from", ",", "to", ")", "{", "var", "fn", "=", "assignFn", "(", "from", ",", "to", ")", ";", "return", "convert", "[", "fn", "]", "(", "str", "+", "''", ")", ";", "}" ]
A buffed-up version of the standard `parseInt` function @param str, the value to convert. Is coerced into a String. @param from, [Number], a base to convert from @param to, [Number] a base to convert to @return, the result of a call to a base conversion function
[ "A", "buffed", "-", "up", "version", "of", "the", "standard", "parseInt", "function" ]
ce258b2ca1430dd506b2a9e326f00219e8f8673c
https://github.com/NerdDiffer/all-your-base/blob/ce258b2ca1430dd506b2a9e326f00219e8f8673c/index.js#L26-L29
train
NerdDiffer/all-your-base
index.js
assignFn
function assignFn(from, to) { from = setDefault(10, from); to = setDefault(10, to); from = numToWord(from); to = capitalize(numToWord(to)); return from + 'To' + to; // return a copy of a string with its first letter capitalized function capitalize(str) { return str[0].toUpperCase() + str.slice(...
javascript
function assignFn(from, to) { from = setDefault(10, from); to = setDefault(10, to); from = numToWord(from); to = capitalize(numToWord(to)); return from + 'To' + to; // return a copy of a string with its first letter capitalized function capitalize(str) { return str[0].toUpperCase() + str.slice(...
[ "function", "assignFn", "(", "from", ",", "to", ")", "{", "from", "=", "setDefault", "(", "10", ",", "from", ")", ";", "to", "=", "setDefault", "(", "10", ",", "to", ")", ";", "from", "=", "numToWord", "(", "from", ")", ";", "to", "=", "capitaliz...
Return a property to pass to the 'convert' object @param from, [Number], a base to convert from @param to, [Number] a base to convert to @return, [String] a generated property name @throws, an error if the base is not supported by this module
[ "Return", "a", "property", "to", "pass", "to", "the", "convert", "object" ]
ce258b2ca1430dd506b2a9e326f00219e8f8673c
https://github.com/NerdDiffer/all-your-base/blob/ce258b2ca1430dd506b2a9e326f00219e8f8673c/index.js#L38-L73
train
vid/SenseBase
lib/site-requests.js
processXML
function processXML(name, uri, processor, resp, callback) { var parser = new xml2js.Parser(); parser.parseString(resp, function (err, xml) { if (err) { GLOBAL.error(name, err); return; } else { processor.getAnnotations(name, uri, xml, function(err, annoRows) { callback(err, {name:...
javascript
function processXML(name, uri, processor, resp, callback) { var parser = new xml2js.Parser(); parser.parseString(resp, function (err, xml) { if (err) { GLOBAL.error(name, err); return; } else { processor.getAnnotations(name, uri, xml, function(err, annoRows) { callback(err, {name:...
[ "function", "processXML", "(", "name", ",", "uri", ",", "processor", ",", "resp", ",", "callback", ")", "{", "var", "parser", "=", "new", "xml2js", ".", "Parser", "(", ")", ";", "parser", ".", "parseString", "(", "resp", ",", "function", "(", "err", ...
process retrieved content as XML
[ "process", "retrieved", "content", "as", "XML" ]
d60bcf28239e7dde437d8a6bdae41a6921dcd05b
https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/site-requests.js#L64-L77
train
DScheglov/merest
lib/controllers/error.js
error
function error(err, req, res, next) { if (err instanceof ModelAPIError) { toSend = extend({error: true}, err); res.status(err.code); res.json(toSend); } else { toSend = { error: true, message: err.message, stack: err.stack }; res.status(500); res.json(toSend...
javascript
function error(err, req, res, next) { if (err instanceof ModelAPIError) { toSend = extend({error: true}, err); res.status(err.code); res.json(toSend); } else { toSend = { error: true, message: err.message, stack: err.stack }; res.status(500); res.json(toSend...
[ "function", "error", "(", "err", ",", "req", ",", "res", ",", "next", ")", "{", "if", "(", "err", "instanceof", "ModelAPIError", ")", "{", "toSend", "=", "extend", "(", "{", "error", ":", "true", "}", ",", "err", ")", ";", "res", ".", "status", "...
error - description @param {Error} err the error that should be processed to client side @param {express.Request} req the http(s) request @param {express.Response} res the http(s) response @param {Function} next the callback should be called if controller fails @memb...
[ "error", "-", "description" ]
d39e7ef0d56236247773467e9bfe83cb128ebc01
https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/controllers/error.js#L14-L28
train
nodejitsu/contour
pagelets/carousel.js
controls
function controls(data, options) { return data.reduce(function reduce(controls, item, n) { return controls + options.fn({ panel: 'panel' + n, checked: !n ? ' checked' : '' }); }, ''); }
javascript
function controls(data, options) { return data.reduce(function reduce(controls, item, n) { return controls + options.fn({ panel: 'panel' + n, checked: !n ? ' checked' : '' }); }, ''); }
[ "function", "controls", "(", "data", ",", "options", ")", "{", "return", "data", ".", "reduce", "(", "function", "reduce", "(", "controls", ",", "item", ",", "n", ")", "{", "return", "controls", "+", "options", ".", "fn", "(", "{", "panel", ":", "'pa...
Handblebar helper to generate the panel controls, both the radio buttons as well as the arrow labels. @param {Object} data Provided to the iterator. @param {Object} options Optional. @return {String} Generated template @api private
[ "Handblebar", "helper", "to", "generate", "the", "panel", "controls", "both", "the", "radio", "buttons", "as", "well", "as", "the", "arrow", "labels", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/carousel.js#L37-L44
train
mkdecisiondev/reshape-component
lib/index.js
copyAttributes
function copyAttributes (templateAst, componentNode, preserveType) { for (let attributeName in componentNode.attrs) { if (!(attributeName in skippedAttributes)) { templateAst[0].attrs = templateAst[0].attrs || {}; if (templateAst[0].attrs[attributeName] && attributeName === 'class') { templateAst[0].attrs...
javascript
function copyAttributes (templateAst, componentNode, preserveType) { for (let attributeName in componentNode.attrs) { if (!(attributeName in skippedAttributes)) { templateAst[0].attrs = templateAst[0].attrs || {}; if (templateAst[0].attrs[attributeName] && attributeName === 'class') { templateAst[0].attrs...
[ "function", "copyAttributes", "(", "templateAst", ",", "componentNode", ",", "preserveType", ")", "{", "for", "(", "let", "attributeName", "in", "componentNode", ".", "attrs", ")", "{", "if", "(", "!", "(", "attributeName", "in", "skippedAttributes", ")", ")",...
Copy attributes from 'node' to the first node in 'componentAst' @param {ReshapeAst} templateAst - AST from the component source template @param {ReshapeAstNode} componentNode - '<component>' node @param {boolean|string} preserveType - If 'true', the 'type' attributed will preserved; if a string value the 'type' attribu...
[ "Copy", "attributes", "from", "node", "to", "the", "first", "node", "in", "componentAst" ]
a2e8580d6789258b0c46989d804fe5cb3aec87f2
https://github.com/mkdecisiondev/reshape-component/blob/a2e8580d6789258b0c46989d804fe5cb3aec87f2/lib/index.js#L19-L42
train
mkdecisiondev/reshape-component
lib/index.js
replaceTokens
function replaceTokens (templateAst, componentNode) { let promise; if (componentNode.content) { const tokenDefinitions = {}; componentNode.content.forEach(function (tokenDefinition) { if (tokenDefinition.name) { let tokenValue = ''; if (tokenDefinition.content) { if (tokenDefinition.content.len...
javascript
function replaceTokens (templateAst, componentNode) { let promise; if (componentNode.content) { const tokenDefinitions = {}; componentNode.content.forEach(function (tokenDefinition) { if (tokenDefinition.name) { let tokenValue = ''; if (tokenDefinition.content) { if (tokenDefinition.content.len...
[ "function", "replaceTokens", "(", "templateAst", ",", "componentNode", ")", "{", "let", "promise", ";", "if", "(", "componentNode", ".", "content", ")", "{", "const", "tokenDefinitions", "=", "{", "}", ";", "componentNode", ".", "content", ".", "forEach", "(...
Replace tokens in 'componentAst' with content defined in child elements of 'node' @param {ReshapeAst} templateAst - AST from the component source template @param {ReshapeAstNode} componentNode - '<component>' node @returns {Thenable|undefined} If no substitution was performed then returns undefined
[ "Replace", "tokens", "in", "componentAst", "with", "content", "defined", "in", "child", "elements", "of", "node" ]
a2e8580d6789258b0c46989d804fe5cb3aec87f2
https://github.com/mkdecisiondev/reshape-component/blob/a2e8580d6789258b0c46989d804fe5cb3aec87f2/lib/index.js#L79-L165
train
Whitebolt/require-extra
src/versionLoader.js
getMyVersion
function getMyVersion(buildDir) { var builds = getBuildFiles(buildDir); var chosen = builds[0]; for (var n=0; n<builds.length; n++) { if (semvar.satisfies(getVersion(builds[n]), '<=' + process.versions.node)) chosen = builds[n]; } return require(buildDir + '/' + chosen); }
javascript
function getMyVersion(buildDir) { var builds = getBuildFiles(buildDir); var chosen = builds[0]; for (var n=0; n<builds.length; n++) { if (semvar.satisfies(getVersion(builds[n]), '<=' + process.versions.node)) chosen = builds[n]; } return require(buildDir + '/' + chosen); }
[ "function", "getMyVersion", "(", "buildDir", ")", "{", "var", "builds", "=", "getBuildFiles", "(", "buildDir", ")", ";", "var", "chosen", "=", "builds", "[", "0", "]", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "builds", ".", "length", "...
Get current node version a retrieve built file for that version. @param {string} buildDir Where build files are located. @returns {string} The build file to use.
[ "Get", "current", "node", "version", "a", "retrieve", "built", "file", "for", "that", "version", "." ]
2a8f737aab67305c9fda3ee56aa7953e97cee859
https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/versionLoader.js#L48-L57
train
nodejitsu/contour
pagelets/nodejitsu/pills/base.js
swap
function swap(e, to) { if ('preventDefault' in e) e.preventDefault(); var item = $(e.element || '[data-id="' + to + '"]'); if (!!~item.get('className').indexOf('active')) return; var parent = item.parent() , effect = item.get('effect').split(',') , change = item.get('swap').split('@') ...
javascript
function swap(e, to) { if ('preventDefault' in e) e.preventDefault(); var item = $(e.element || '[data-id="' + to + '"]'); if (!!~item.get('className').indexOf('active')) return; var parent = item.parent() , effect = item.get('effect').split(',') , change = item.get('swap').split('@') ...
[ "function", "swap", "(", "e", ",", "to", ")", "{", "if", "(", "'preventDefault'", "in", "e", ")", "e", ".", "preventDefault", "(", ")", ";", "var", "item", "=", "$", "(", "e", ".", "element", "||", "'[data-id=\"'", "+", "to", "+", "'\"]'", ")", "...
Swap the different views @param {Event} e @param {String} to force tab by hash @api private
[ "Swap", "the", "different", "views" ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/pills/base.js#L55-L91
train
synder/xpress
demo/body-parser/lib/types/urlencoded.js
urlencoded
function urlencoded (options) { var opts = options || {} // notice because option default will flip in next major if (opts.extended === undefined) { deprecate('undefined extended: provide extended option') } var extended = opts.extended !== false var inflate = opts.inflate !== false var limit = type...
javascript
function urlencoded (options) { var opts = options || {} // notice because option default will flip in next major if (opts.extended === undefined) { deprecate('undefined extended: provide extended option') } var extended = opts.extended !== false var inflate = opts.inflate !== false var limit = type...
[ "function", "urlencoded", "(", "options", ")", "{", "var", "opts", "=", "options", "||", "{", "}", "// notice because option default will flip in next major", "if", "(", "opts", ".", "extended", "===", "undefined", ")", "{", "deprecate", "(", "'undefined extended: p...
Create a middleware to parse urlencoded bodies. @param {object} [options] @return {function} @public
[ "Create", "a", "middleware", "to", "parse", "urlencoded", "bodies", "." ]
4b1e89208b6f34cd78ce90b8a858592115b6ccb5
https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/types/urlencoded.js#L43-L123
train
synder/xpress
demo/body-parser/lib/types/urlencoded.js
extendedparser
function extendedparser (options) { var parameterLimit = options.parameterLimit !== undefined ? options.parameterLimit : 1000 var parse = parser('qs') if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError('option parameterLimit must be a positive number') } if (isFinite(paramete...
javascript
function extendedparser (options) { var parameterLimit = options.parameterLimit !== undefined ? options.parameterLimit : 1000 var parse = parser('qs') if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError('option parameterLimit must be a positive number') } if (isFinite(paramete...
[ "function", "extendedparser", "(", "options", ")", "{", "var", "parameterLimit", "=", "options", ".", "parameterLimit", "!==", "undefined", "?", "options", ".", "parameterLimit", ":", "1000", "var", "parse", "=", "parser", "(", "'qs'", ")", "if", "(", "isNaN...
Get the extended query parser. @param {object} options
[ "Get", "the", "extended", "query", "parser", "." ]
4b1e89208b6f34cd78ce90b8a858592115b6ccb5
https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/types/urlencoded.js#L131-L163
train
synder/xpress
demo/body-parser/lib/types/urlencoded.js
parameterCount
function parameterCount (body, limit) { var count = 0 var index = 0 while ((index = body.indexOf('&', index)) !== -1) { count++ index++ if (count === limit) { return undefined } } return count }
javascript
function parameterCount (body, limit) { var count = 0 var index = 0 while ((index = body.indexOf('&', index)) !== -1) { count++ index++ if (count === limit) { return undefined } } return count }
[ "function", "parameterCount", "(", "body", ",", "limit", ")", "{", "var", "count", "=", "0", "var", "index", "=", "0", "while", "(", "(", "index", "=", "body", ".", "indexOf", "(", "'&'", ",", "index", ")", ")", "!==", "-", "1", ")", "{", "count"...
Count the number of parameters, stopping once limit reached @param {string} body @param {number} limit @api private
[ "Count", "the", "number", "of", "parameters", "stopping", "once", "limit", "reached" ]
4b1e89208b6f34cd78ce90b8a858592115b6ccb5
https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/types/urlencoded.js#L188-L202
train
synder/xpress
demo/body-parser/lib/types/urlencoded.js
parser
function parser (name) { var mod = parsers[name] if (mod !== undefined) { return mod.parse } // this uses a switch for static require analysis switch (name) { case 'qs': mod = require('qs') break case 'querystring': mod = require('querystring') break } // store to pr...
javascript
function parser (name) { var mod = parsers[name] if (mod !== undefined) { return mod.parse } // this uses a switch for static require analysis switch (name) { case 'qs': mod = require('qs') break case 'querystring': mod = require('querystring') break } // store to pr...
[ "function", "parser", "(", "name", ")", "{", "var", "mod", "=", "parsers", "[", "name", "]", "if", "(", "mod", "!==", "undefined", ")", "{", "return", "mod", ".", "parse", "}", "// this uses a switch for static require analysis", "switch", "(", "name", ")", ...
Get parser for module name dynamically. @param {string} name @return {function} @api private
[ "Get", "parser", "for", "module", "name", "dynamically", "." ]
4b1e89208b6f34cd78ce90b8a858592115b6ccb5
https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/types/urlencoded.js#L212-L233
train
synder/xpress
demo/body-parser/lib/types/urlencoded.js
simpleparser
function simpleparser (options) { var parameterLimit = options.parameterLimit !== undefined ? options.parameterLimit : 1000 var parse = parser('querystring') if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError('option parameterLimit must be a positive number') } if (isFinite(p...
javascript
function simpleparser (options) { var parameterLimit = options.parameterLimit !== undefined ? options.parameterLimit : 1000 var parse = parser('querystring') if (isNaN(parameterLimit) || parameterLimit < 1) { throw new TypeError('option parameterLimit must be a positive number') } if (isFinite(p...
[ "function", "simpleparser", "(", "options", ")", "{", "var", "parameterLimit", "=", "options", ".", "parameterLimit", "!==", "undefined", "?", "options", ".", "parameterLimit", ":", "1000", "var", "parse", "=", "parser", "(", "'querystring'", ")", "if", "(", ...
Get the simple query parser. @param {object} options
[ "Get", "the", "simple", "query", "parser", "." ]
4b1e89208b6f34cd78ce90b8a858592115b6ccb5
https://github.com/synder/xpress/blob/4b1e89208b6f34cd78ce90b8a858592115b6ccb5/demo/body-parser/lib/types/urlencoded.js#L241-L266
train