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
gethuman/pancakes-angular
lib/middleware/jng.directives.js
getBehavioralDirectives
function getBehavioralDirectives(appName) { var directives = {}; var me = this; _.each(this.getAppFileNames(appName, 'jng.directives'), function (directiveName) { // if not a JavaScript file, ignore it if (!me.pancakes.utils.isJavaScript(directiveName)) { return; } // get the dire...
javascript
function getBehavioralDirectives(appName) { var directives = {}; var me = this; _.each(this.getAppFileNames(appName, 'jng.directives'), function (directiveName) { // if not a JavaScript file, ignore it if (!me.pancakes.utils.isJavaScript(directiveName)) { return; } // get the dire...
[ "function", "getBehavioralDirectives", "(", "appName", ")", "{", "var", "directives", "=", "{", "}", ";", "var", "me", "=", "this", ";", "_", ".", "each", "(", "this", ".", "getAppFileNames", "(", "appName", ",", "'jng.directives'", ")", ",", "function", ...
Add behavior directives from the jng.directives folder. @param appName
[ "Add", "behavior", "directives", "from", "the", "jng", ".", "directives", "folder", "." ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L245-L262
train
gethuman/pancakes-angular
lib/middleware/jng.directives.js
getClientDirectives
function getClientDirectives(appName) { var directives = []; var me = this; _.each(this.getAppFileNames(appName, 'ng.directives'), function (directiveName) { // if not a JavaScript file, ignore it if (!me.pancakes.utils.isJavaScript(directiveName)) { return; } directiveName = dire...
javascript
function getClientDirectives(appName) { var directives = []; var me = this; _.each(this.getAppFileNames(appName, 'ng.directives'), function (directiveName) { // if not a JavaScript file, ignore it if (!me.pancakes.utils.isJavaScript(directiveName)) { return; } directiveName = dire...
[ "function", "getClientDirectives", "(", "appName", ")", "{", "var", "directives", "=", "[", "]", ";", "var", "me", "=", "this", ";", "_", ".", "each", "(", "this", ".", "getAppFileNames", "(", "appName", ",", "'ng.directives'", ")", ",", "function", "(",...
Just because they are client-side directives, doesn't mean we don't need to do anything server-side. For example, if JNG_STRIP is true, we need to strip them. We do, however, need to make it so they don't actually do anything server-side (noop function0 @param appName
[ "Just", "because", "they", "are", "client", "-", "side", "directives", "doesn", "t", "mean", "we", "don", "t", "need", "to", "do", "anything", "server", "-", "side", ".", "For", "example", "if", "JNG_STRIP", "is", "true", "we", "need", "to", "strip", "...
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L271-L285
train
gethuman/pancakes-angular
lib/middleware/jng.directives.js
getGenericDirective
function getGenericDirective(prefix, attrName, filterType, isBind, isFilter) { var directiveName = prefix + attrName.substring(0, 1).toUpperCase() + attrName.substring(1); var config = this.pancakes.cook('config', null); var i18n = this.pancakes.cook('i18n', null); var eventBus = this.pancakes.cook('eve...
javascript
function getGenericDirective(prefix, attrName, filterType, isBind, isFilter) { var directiveName = prefix + attrName.substring(0, 1).toUpperCase() + attrName.substring(1); var config = this.pancakes.cook('config', null); var i18n = this.pancakes.cook('i18n', null); var eventBus = this.pancakes.cook('eve...
[ "function", "getGenericDirective", "(", "prefix", ",", "attrName", ",", "filterType", ",", "isBind", ",", "isFilter", ")", "{", "var", "directiveName", "=", "prefix", "+", "attrName", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")",...
Get a generic directive @param prefix @param attrName @param filterType @param isBind @param isFilter @returns {Function}
[ "Get", "a", "generic", "directive" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L308-L371
train
gethuman/pancakes-angular
lib/middleware/jng.directives.js
getGenericDirectives
function getGenericDirectives() { var directives = {}; var genericDirectives = { 'src': 'file', 'title': 'i18n', 'placeholder': 'i18n', 'popover': 'i18n', 'value': 'i18n', 'alt': 'i18n', 'text': 'i18n', ...
javascript
function getGenericDirectives() { var directives = {}; var genericDirectives = { 'src': 'file', 'title': 'i18n', 'placeholder': 'i18n', 'popover': 'i18n', 'value': 'i18n', 'alt': 'i18n', 'text': 'i18n', ...
[ "function", "getGenericDirectives", "(", ")", "{", "var", "directives", "=", "{", "}", ";", "var", "genericDirectives", "=", "{", "'src'", ":", "'file'", ",", "'title'", ":", "'i18n'", ",", "'placeholder'", ":", "'i18n'", ",", "'popover'", ":", "'i18n'", "...
Add generic directives. This functionality should match up to the generic.directives.js client side code.
[ "Add", "generic", "directives", ".", "This", "functionality", "should", "match", "up", "to", "the", "generic", ".", "directives", ".", "js", "client", "side", "code", "." ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L377-L411
train
gethuman/pancakes-angular
lib/middleware/jng.directives.js
addDirectivesToJangular
function addDirectivesToJangular(directives) { _.each(directives, function (directive, directiveName) { jangular.addDirective(directiveName, directive); }); }
javascript
function addDirectivesToJangular(directives) { _.each(directives, function (directive, directiveName) { jangular.addDirective(directiveName, directive); }); }
[ "function", "addDirectivesToJangular", "(", "directives", ")", "{", "_", ".", "each", "(", "directives", ",", "function", "(", "directive", ",", "directiveName", ")", "{", "jangular", ".", "addDirective", "(", "directiveName", ",", "directive", ")", ";", "}", ...
Add directives to jangular @param directives
[ "Add", "directives", "to", "jangular" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/middleware/jng.directives.js#L417-L421
train
cemtopkaya/kuark-db
src/db_rol.js
f_rol_tumu
function f_rol_tumu(_tahta_id) { return result.dbQ.smembers(result.kp.tahta.ssetOzelTahtaRolleri(_tahta_id, true)) .then(function (_rol_idler) { return f_rol_id(_rol_idler); }); }
javascript
function f_rol_tumu(_tahta_id) { return result.dbQ.smembers(result.kp.tahta.ssetOzelTahtaRolleri(_tahta_id, true)) .then(function (_rol_idler) { return f_rol_id(_rol_idler); }); }
[ "function", "f_rol_tumu", "(", "_tahta_id", ")", "{", "return", "result", ".", "dbQ", ".", "smembers", "(", "result", ".", "kp", ".", "tahta", ".", "ssetOzelTahtaRolleri", "(", "_tahta_id", ",", "true", ")", ")", ".", "then", "(", "function", "(", "_rol_...
endregion region ROLLER
[ "endregion", "region", "ROLLER" ]
d584aaf51f65a013bec79220a05007bd70767ac2
https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_rol.js#L63-L68
train
usenode/litmus.js
lib/commandline.js
getLitmusForModule
function getLitmusForModule (module) { if (isLitmus(module)) { return module; } if (module.test && isLitmus(module.test)) { return module.test; } throw new Error('litmus: expected module to export litmus.Test or litmus.Suite'); }
javascript
function getLitmusForModule (module) { if (isLitmus(module)) { return module; } if (module.test && isLitmus(module.test)) { return module.test; } throw new Error('litmus: expected module to export litmus.Test or litmus.Suite'); }
[ "function", "getLitmusForModule", "(", "module", ")", "{", "if", "(", "isLitmus", "(", "module", ")", ")", "{", "return", "module", ";", "}", "if", "(", "module", ".", "test", "&&", "isLitmus", "(", "module", ".", "test", ")", ")", "{", "return", "mo...
Find the litmus.Test or litmus.Suite for a module. Previous versions of litmus expected this to be exposed under a 'test' key.
[ "Find", "the", "litmus", ".", "Test", "or", "litmus", ".", "Suite", "for", "a", "module", ".", "Previous", "versions", "of", "litmus", "expected", "this", "to", "be", "exposed", "under", "a", "test", "key", "." ]
8bed2ea18a925f4590387556b6438f3a15ea82c0
https://github.com/usenode/litmus.js/blob/8bed2ea18a925f4590387556b6438f3a15ea82c0/lib/commandline.js#L113-L124
train
markhuge/aws-sdk-sugar
lib/elb.js
function (elbName, cb) { query(elbName, function (err, data) { if (err) return cb(err); var result = []; data.Instances.map(function (item) { result.push(item.InstanceId); }); cb(undefined, result); }); }
javascript
function (elbName, cb) { query(elbName, function (err, data) { if (err) return cb(err); var result = []; data.Instances.map(function (item) { result.push(item.InstanceId); }); cb(undefined, result); }); }
[ "function", "(", "elbName", ",", "cb", ")", "{", "query", "(", "elbName", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";", "var", "result", "=", "[", "]", ";", "data", ".", "Instan...
List instances in ELB
[ "List", "instances", "in", "ELB" ]
16f8c1275b3f730c57d06aece6ebb0a34e492163
https://github.com/markhuge/aws-sdk-sugar/blob/16f8c1275b3f730c57d06aece6ebb0a34e492163/lib/elb.js#L23-L30
train
vkiding/jud-vue-render
src/render/browser/base/component/index.js
isEventValid
function isEventValid (comp, type) { // if a component has aleary triggered 'appear' event, then // the 'appear' even† can't be triggered again utill the // 'disappear' event triggered. if (appearEvts.indexOf(type) <= -1) { return true } if (comp._appear === undefined && type === 'disappear') { retu...
javascript
function isEventValid (comp, type) { // if a component has aleary triggered 'appear' event, then // the 'appear' even† can't be triggered again utill the // 'disappear' event triggered. if (appearEvts.indexOf(type) <= -1) { return true } if (comp._appear === undefined && type === 'disappear') { retu...
[ "function", "isEventValid", "(", "comp", ",", "type", ")", "{", "// if a component has aleary triggered 'appear' event, then", "// the 'appear' even† can't be triggered again utill the", "// 'disappear' event triggered.", "if", "(", "appearEvts", ".", "indexOf", "(", "type", ")",...
check whether a event is valid to dispatch. @param {Component} comp the component that this event is to trigger on. @param {string} type the event type. @return {Boolean} is it valid to dispatch.
[ "check", "whether", "a", "event", "is", "valid", "to", "dispatch", "." ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/base/component/index.js#L19-L38
train
rm3web/textblocks
lib/textblock.js
splitIntoSlabs
function splitIntoSlabs(str) { var slabs = str.split('<!-- TEXTBLOCK -->'); return slabs.map(function(val, index, array) { if (index % 2 == 1) { var rawAttr = val.match(/<code>(.*)<\/code>/); var attrs = JSON.parse(decodeURI(rawAttr[1])); return attrs; } else { return val; } })...
javascript
function splitIntoSlabs(str) { var slabs = str.split('<!-- TEXTBLOCK -->'); return slabs.map(function(val, index, array) { if (index % 2 == 1) { var rawAttr = val.match(/<code>(.*)<\/code>/); var attrs = JSON.parse(decodeURI(rawAttr[1])); return attrs; } else { return val; } })...
[ "function", "splitIntoSlabs", "(", "str", ")", "{", "var", "slabs", "=", "str", ".", "split", "(", "'<!-- TEXTBLOCK -->'", ")", ";", "return", "slabs", ".", "map", "(", "function", "(", "val", ",", "index", ",", "array", ")", "{", "if", "(", "index", ...
Split into slabs, undoing the placeholders created in generatePlaceholder @param {String} str The string to convert back to slabs @return {Array} Slabs that have been broken out
[ "Split", "into", "slabs", "undoing", "the", "placeholders", "created", "in", "generatePlaceholder" ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L103-L114
train
rm3web/textblocks
lib/textblock.js
function(source, format, ctx) { if (inputFormats.hasOwnProperty(format)) { return inputFormats[format](source, ctx); } else { throw new Error('invalid format to make a text block from: ' + source.format); } }
javascript
function(source, format, ctx) { if (inputFormats.hasOwnProperty(format)) { return inputFormats[format](source, ctx); } else { throw new Error('invalid format to make a text block from: ' + source.format); } }
[ "function", "(", "source", ",", "format", ",", "ctx", ")", "{", "if", "(", "inputFormats", ".", "hasOwnProperty", "(", "format", ")", ")", "{", "return", "inputFormats", "[", "format", "]", "(", "source", ",", "ctx", ")", ";", "}", "else", "{", "thro...
Make a text block from source @param {String} source The source to make a text block from @param {String} format The format to use @param {Object} ctx An object to be passed to all of the rendering functions @return {Object} a new textblock
[ "Make", "a", "text", "block", "from", "source" ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L188-L194
train
rm3web/textblocks
lib/textblock.js
function(source, ctx) { if (source.hasOwnProperty('format')) { if (validateFormats.hasOwnProperty(source.format)) { return validateFormats[source.format](source, ctx); } else { throw new Error('invalid format for textblock: ' + source.format); } } throw new Error('invalid format for textbl...
javascript
function(source, ctx) { if (source.hasOwnProperty('format')) { if (validateFormats.hasOwnProperty(source.format)) { return validateFormats[source.format](source, ctx); } else { throw new Error('invalid format for textblock: ' + source.format); } } throw new Error('invalid format for textbl...
[ "function", "(", "source", ",", "ctx", ")", "{", "if", "(", "source", ".", "hasOwnProperty", "(", "'format'", ")", ")", "{", "if", "(", "validateFormats", ".", "hasOwnProperty", "(", "source", ".", "format", ")", ")", "{", "return", "validateFormats", "[...
Validate a text blocks @param {String} source The source untrusted text block @param {Object} ctx An object to be passed to all of the rendering functions @return {Object} a cleaned text block
[ "Validate", "a", "text", "blocks" ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L202-L211
train
rm3web/textblocks
lib/textblock.js
function(source, type) { if (source.hasOwnProperty('format')) { if (source.format !== type) { if (source.format === 'section') { var blocks = []; source.blocks.forEach(function(val, index, array) { var block = deleteTextBlockFormat(val, type); if (block) { blo...
javascript
function(source, type) { if (source.hasOwnProperty('format')) { if (source.format !== type) { if (source.format === 'section') { var blocks = []; source.blocks.forEach(function(val, index, array) { var block = deleteTextBlockFormat(val, type); if (block) { blo...
[ "function", "(", "source", ",", "type", ")", "{", "if", "(", "source", ".", "hasOwnProperty", "(", "'format'", ")", ")", "{", "if", "(", "source", ".", "format", "!==", "type", ")", "{", "if", "(", "source", ".", "format", "===", "'section'", ")", ...
Delete all blocks with a given format. @param {String} source The source untrusted text block @param {String} type The type of block to remove @return {Object} a cleaned text block
[ "Delete", "all", "blocks", "with", "a", "given", "format", "." ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L219-L243
train
rm3web/textblocks
lib/textblock.js
function(blocks) { var blockarr = blocks; if (!(blockarr instanceof Array)) { blockarr = [blockarr]; } return {format: 'section', blocks: blockarr}; }
javascript
function(blocks) { var blockarr = blocks; if (!(blockarr instanceof Array)) { blockarr = [blockarr]; } return {format: 'section', blocks: blockarr}; }
[ "function", "(", "blocks", ")", "{", "var", "blockarr", "=", "blocks", ";", "if", "(", "!", "(", "blockarr", "instanceof", "Array", ")", ")", "{", "blockarr", "=", "[", "blockarr", "]", ";", "}", "return", "{", "format", ":", "'section'", ",", "block...
Convert one or more blocks into a section @param {Object|Array} blocks A block or an array of blocks @return {Object} A text block
[ "Convert", "one", "or", "more", "blocks", "into", "a", "section" ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L250-L256
train
rm3web/textblocks
lib/textblock.js
function(block, pos, ctx, callback) { if (block.hasOwnProperty('htmlslabs')) { outputSlabs(block.htmlslabs, ctx, callback); } else { if (formats.hasOwnProperty(block.format)) { formats[block.format](block, pos, ctx, callback); } else { callback(new Error('unknown format: ' + block.format)); ...
javascript
function(block, pos, ctx, callback) { if (block.hasOwnProperty('htmlslabs')) { outputSlabs(block.htmlslabs, ctx, callback); } else { if (formats.hasOwnProperty(block.format)) { formats[block.format](block, pos, ctx, callback); } else { callback(new Error('unknown format: ' + block.format)); ...
[ "function", "(", "block", ",", "pos", ",", "ctx", ",", "callback", ")", "{", "if", "(", "block", ".", "hasOwnProperty", "(", "'htmlslabs'", ")", ")", "{", "outputSlabs", "(", "block", ".", "htmlslabs", ",", "ctx", ",", "callback", ")", ";", "}", "els...
Output a text block in HTML. Warning: This assumes that you have used validateTextBlock or makeTextBlock to ensure a valid XSS-free textblock. @param {Object} block The text block to be output @param {String} pos The position to start adding suffixes to (useful for generating links or pagination) @param {Object} ctx ...
[ "Output", "a", "text", "block", "in", "HTML", "." ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L295-L305
train
rm3web/textblocks
lib/textblock.js
function(block) { if (block.hasOwnProperty('htmlslabs')) { return outputSlabsAsText(block.htmlslabs); } else { if (block.format === 'section') { return block.blocks.reduce(function(previousValue, currentValue, currentIndex, array) { return previousValue + extractTextBlockText(currentValue); ...
javascript
function(block) { if (block.hasOwnProperty('htmlslabs')) { return outputSlabsAsText(block.htmlslabs); } else { if (block.format === 'section') { return block.blocks.reduce(function(previousValue, currentValue, currentIndex, array) { return previousValue + extractTextBlockText(currentValue); ...
[ "function", "(", "block", ")", "{", "if", "(", "block", ".", "hasOwnProperty", "(", "'htmlslabs'", ")", ")", "{", "return", "outputSlabsAsText", "(", "block", ".", "htmlslabs", ")", ";", "}", "else", "{", "if", "(", "block", ".", "format", "===", "'sec...
Output a text block as plain-text @param {Object} block The text block to be output @return {String} the textual content, sans enhancement and HTML
[ "Output", "a", "text", "block", "as", "plain", "-", "text" ]
5c3896a66339c6de64de691fc6bacd4f4626ce1b
https://github.com/rm3web/textblocks/blob/5c3896a66339c6de64de691fc6bacd4f4626ce1b/lib/textblock.js#L313-L325
train
redisjs/jsr-server
lib/command/database/key/scan.js
execute
function execute(req, res) { var scanner = new Scanner( req.db.getKeys(), req.info.cursor, req.info.pattern, req.info.count); scanner.scan(req, res); }
javascript
function execute(req, res) { var scanner = new Scanner( req.db.getKeys(), req.info.cursor, req.info.pattern, req.info.count); scanner.scan(req, res); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "var", "scanner", "=", "new", "Scanner", "(", "req", ".", "db", ".", "getKeys", "(", ")", ",", "req", ".", "info", ".", "cursor", ",", "req", ".", "info", ".", "pattern", ",", "req", ".", ...
Respond to the SCAN command.
[ "Respond", "to", "the", "SCAN", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/scan.js#L29-L33
train
redisjs/jsr-server
lib/command/database/key/scan.js
validate
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); var offset = info.exec.offset , arg = args[offset]; if(args.length > offset + 4) { throw new CommandArgLength(info.exec.definition.name); } // cursor already parsed to integer by numeric validation info...
javascript
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); var offset = info.exec.offset , arg = args[offset]; if(args.length > offset + 4) { throw new CommandArgLength(info.exec.definition.name); } // cursor already parsed to integer by numeric validation info...
[ "function", "validate", "(", "cmd", ",", "args", ",", "info", ")", "{", "AbstractCommand", ".", "prototype", ".", "validate", ".", "apply", "(", "this", ",", "arguments", ")", ";", "var", "offset", "=", "info", ".", "exec", ".", "offset", ",", "arg", ...
Validate the SCAN command.
[ "Validate", "the", "SCAN", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/scan.js#L38-L76
train
aureooms/js-selection
lib/quickselect/singletco.js
singletco
function singletco(partition) { var select = function select(compare, a, i, j, k) { while (true) { if (j - i < 2) return; var p = partition(compare, a, i, j); if (k < p) j = p;else if (k > p) i = p + 1;else return; } }; return select; }
javascript
function singletco(partition) { var select = function select(compare, a, i, j, k) { while (true) { if (j - i < 2) return; var p = partition(compare, a, i, j); if (k < p) j = p;else if (k > p) i = p + 1;else return; } }; return select; }
[ "function", "singletco", "(", "partition", ")", "{", "var", "select", "=", "function", "select", "(", "compare", ",", "a", ",", "i", ",", "j", ",", "k", ")", "{", "while", "(", "true", ")", "{", "if", "(", "j", "-", "i", "<", "2", ")", "return"...
Template for the recursive implementation of quickselect with explicit tail call optimization.
[ "Template", "for", "the", "recursive", "implementation", "of", "quickselect", "with", "explicit", "tail", "call", "optimization", "." ]
55d592614e55052ddebe204367a5ada0cddba547
https://github.com/aureooms/js-selection/blob/55d592614e55052ddebe204367a5ada0cddba547/lib/quickselect/singletco.js#L14-L29
train
Nazariglez/perenquen
lib/pixi/src/filters/blur/BlurXFilter.js
BlurXFilter
function BlurXFilter() { core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/blurX.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/blur.frag', 'utf8'), // set the uniforms { strength: { type: '1f', value: 1 } ...
javascript
function BlurXFilter() { core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/blurX.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/blur.frag', 'utf8'), // set the uniforms { strength: { type: '1f', value: 1 } ...
[ "function", "BlurXFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ",", "// vertex shader", "fs", ".", "readFileSync", "(", "__dirname", "+", "'/blurX.vert'", ",", "'utf8'", ")", ",", "// fragment shader", "fs", ".", "readFileSy...
The BlurXFilter applies a horizontal Gaussian blur to an object. @class @extends AbstractFilter @memberof PIXI.filters
[ "The", "BlurXFilter", "applies", "a", "horizontal", "Gaussian", "blur", "to", "an", "object", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/blur/BlurXFilter.js#L12-L35
train
meltmedia/node-usher
lib/activity/task.js
ActivityTask
function ActivityTask(task) { if (!(this instanceof ActivityTask)) { return new ActivityTask(task); } this.input = {}; if (task.config.input) { this.input = JSON.parse(task.config.input); } // Depending on the language of the Decider impl, this can be an Array or Object // This is a big assumpt...
javascript
function ActivityTask(task) { if (!(this instanceof ActivityTask)) { return new ActivityTask(task); } this.input = {}; if (task.config.input) { this.input = JSON.parse(task.config.input); } // Depending on the language of the Decider impl, this can be an Array or Object // This is a big assumpt...
[ "function", "ActivityTask", "(", "task", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ActivityTask", ")", ")", "{", "return", "new", "ActivityTask", "(", "task", ")", ";", "}", "this", ".", "input", "=", "{", "}", ";", "if", "(", "task", "...
The context for the execution of the activity @constructor @param {string} task - The raw `aws-swf` activity task
[ "The", "context", "for", "the", "execution", "of", "the", "activity" ]
fe6183bf7097f84bef935e8d9c19463accc08ad6
https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/activity/task.js#L19-L56
train
lemyskaman/kaman-core
kaman.functions.js
backboneOptsAsProps
function backboneOptsAsProps(subject, opts) { if (!opts) { opts = subject.options } subject.mergeOptions(subject.options, _.keys(opts)); //removing form view.options the options that ve been merged above //so if we use view.getOption("opt") will return the merged opt and not the opt in view...
javascript
function backboneOptsAsProps(subject, opts) { if (!opts) { opts = subject.options } subject.mergeOptions(subject.options, _.keys(opts)); //removing form view.options the options that ve been merged above //so if we use view.getOption("opt") will return the merged opt and not the opt in view...
[ "function", "backboneOptsAsProps", "(", "subject", ",", "opts", ")", "{", "if", "(", "!", "opts", ")", "{", "opts", "=", "subject", ".", "options", "}", "subject", ".", "mergeOptions", "(", "subject", ".", "options", ",", "_", ".", "keys", "(", "opts",...
It takes a Backbone Object as subject and merge all opt as subjet properties removing the opt from view options @param subject Backbone.Object, the object to operate over @param opts Object, the options to add @return void
[ "It", "takes", "a", "Backbone", "Object", "as", "subject", "and", "merge", "all", "opt", "as", "subjet", "properties", "removing", "the", "opt", "from", "view", "options" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L15-L29
train
lemyskaman/kaman-core
kaman.functions.js
omitBackboneOptsAsProps
function omitBackboneOptsAsProps(subject, omit) { console.log("omitBackboneOptsAsProps:") console.log(subject, subject.options, omit, _.omit(subject.options, omit)) backboneOptsAsProps(subject, _.omit(subject.options, omit)) }
javascript
function omitBackboneOptsAsProps(subject, omit) { console.log("omitBackboneOptsAsProps:") console.log(subject, subject.options, omit, _.omit(subject.options, omit)) backboneOptsAsProps(subject, _.omit(subject.options, omit)) }
[ "function", "omitBackboneOptsAsProps", "(", "subject", ",", "omit", ")", "{", "console", ".", "log", "(", "\"omitBackboneOptsAsProps:\"", ")", "console", ".", "log", "(", "subject", ",", "subject", ".", "options", ",", "omit", ",", "_", ".", "omit", "(", "...
It takes a Backbone Object as subject and return same object without omit @param subject Backbone.Object, the object to operate over @param omit Array, the keys from subjet.options to omit @return void
[ "It", "takes", "a", "Backbone", "Object", "as", "subject", "and", "return", "same", "object", "without", "omit" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L38-L42
train
lemyskaman/kaman-core
kaman.functions.js
kappInit
function kappInit(subject, callback) { //if expose option is added we expose this view console.log("kappInit:", subject) if (subject.getOption("expose_as")) { console.log("kappInit: found exposeAs option " + subject.getOption("expose_as")) subject.exposeAs(subject.getOption("expose_as")) ...
javascript
function kappInit(subject, callback) { //if expose option is added we expose this view console.log("kappInit:", subject) if (subject.getOption("expose_as")) { console.log("kappInit: found exposeAs option " + subject.getOption("expose_as")) subject.exposeAs(subject.getOption("expose_as")) ...
[ "function", "kappInit", "(", "subject", ",", "callback", ")", "{", "//if expose option is added we expose this view", "console", ".", "log", "(", "\"kappInit:\"", ",", "subject", ")", "if", "(", "subject", ".", "getOption", "(", "\"expose_as\"", ")", ")", "{", "...
you got to bind view object to this function @param {function} callback
[ "you", "got", "to", "bind", "view", "object", "to", "this", "function" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L48-L71
train
lemyskaman/kaman-core
kaman.functions.js
lang
function lang(key, source) { //first we retrive the lang value of the root of the DOM var LANG = document.documentElement.lang; //console.log(source) //console.log(LANG+' '+key+' - '+source[LANG][key]); if (_.isObject(source) && _.isObject(source[LANG]) && _.isString(source[LANG][key])) { re...
javascript
function lang(key, source) { //first we retrive the lang value of the root of the DOM var LANG = document.documentElement.lang; //console.log(source) //console.log(LANG+' '+key+' - '+source[LANG][key]); if (_.isObject(source) && _.isObject(source[LANG]) && _.isString(source[LANG][key])) { re...
[ "function", "lang", "(", "key", ",", "source", ")", "{", "//first we retrive the lang value of the root of the DOM", "var", "LANG", "=", "document", ".", "documentElement", ".", "lang", ";", "//console.log(source)", "//console.log(LANG+' '+key+' - '+source[LANG][key]);", "if"...
utility function to get the language value from keys on a languageSource object acording the specified language comming from the server and placed in the @param key String, the key to search of @param source Object, the list to search for the key @return string, the key value if it is in the source list, otherwise will...
[ "utility", "function", "to", "get", "the", "language", "value", "from", "keys", "on", "a", "languageSource", "object", "acording", "the", "specified", "language", "comming", "from", "the", "server", "and", "placed", "in", "the" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L82-L93
train
lemyskaman/kaman-core
kaman.functions.js
expose
function expose(subject, name) { //console.log(window[name]) if (subject.isRendered()) { exposer(subject, name); } else { subject.on("attach", function () { exposer(subject, name); }) } }
javascript
function expose(subject, name) { //console.log(window[name]) if (subject.isRendered()) { exposer(subject, name); } else { subject.on("attach", function () { exposer(subject, name); }) } }
[ "function", "expose", "(", "subject", ",", "name", ")", "{", "//console.log(window[name])", "if", "(", "subject", ".", "isRendered", "(", ")", ")", "{", "exposer", "(", "subject", ",", "name", ")", ";", "}", "else", "{", "subject", ".", "on", "(", "\"a...
a tool to let some object to be exposed to window on browsers avoiding overwrite existent objects
[ "a", "tool", "to", "let", "some", "object", "to", "be", "exposed", "to", "window", "on", "browsers", "avoiding", "overwrite", "existent", "objects" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L118-L127
train
lemyskaman/kaman-core
kaman.functions.js
commutate
function commutate(key, list) { _.each(list, function (v, k, l) { if (k === key) { l[key] = true } if (v === true && k !== key) { l[k] = false } }) }
javascript
function commutate(key, list) { _.each(list, function (v, k, l) { if (k === key) { l[key] = true } if (v === true && k !== key) { l[k] = false } }) }
[ "function", "commutate", "(", "key", ",", "list", ")", "{", "_", ".", "each", "(", "list", ",", "function", "(", "v", ",", "k", ",", "l", ")", "{", "if", "(", "k", "===", "key", ")", "{", "l", "[", "key", "]", "=", "true", "}", "if", "(", ...
this function will iterate over each list elements setting the one on key to true an all other on false @param key String, the key to set as true @param list Object, the object to search for the key to set to true @return void
[ "this", "function", "will", "iterate", "over", "each", "list", "elements", "setting", "the", "one", "on", "key", "to", "true", "an", "all", "other", "on", "false" ]
331340a01879ec636a31961a81db9a58484d1381
https://github.com/lemyskaman/kaman-core/blob/331340a01879ec636a31961a81db9a58484d1381/kaman.functions.js#L136-L145
train
GreenGremlin/karma-gzip-preprocessor
lib/Preprocessor.js
Preprocessor
function Preprocessor(config, logger) { const log = logger.create('preprocessor.gzip'); return (content, file, done) => { const originalSize = content.length; // const contentBuffer = Buffer.isBuffer(content) ? content : Buffer.from(content); zlib.gzip(content, (err, gzippedContent) => { if (err...
javascript
function Preprocessor(config, logger) { const log = logger.create('preprocessor.gzip'); return (content, file, done) => { const originalSize = content.length; // const contentBuffer = Buffer.isBuffer(content) ? content : Buffer.from(content); zlib.gzip(content, (err, gzippedContent) => { if (err...
[ "function", "Preprocessor", "(", "config", ",", "logger", ")", "{", "const", "log", "=", "logger", ".", "create", "(", "'preprocessor.gzip'", ")", ";", "return", "(", "content", ",", "file", ",", "done", ")", "=>", "{", "const", "originalSize", "=", "con...
Preprocess files to provide a gzip compressed alternative version
[ "Preprocess", "files", "to", "provide", "a", "gzip", "compressed", "alternative", "version" ]
2ceb15b0f4c58beb3e6a13d1a58c5140569a5877
https://github.com/GreenGremlin/karma-gzip-preprocessor/blob/2ceb15b0f4c58beb3e6a13d1a58c5140569a5877/lib/Preprocessor.js#L5-L26
train
apathetic/stickynav
dist/stickynav.es6.js
scrollPage
function scrollPage(to, offset, callback) { if ( offset === void 0 ) offset = 0; var startTime; var duration = 500; var startPos = window.pageYOffset; var endPos = ~~(to.getBoundingClientRect().top - offset); var scroll = function (timestamp) { var elapsed; startTime = startTime || timestamp; ...
javascript
function scrollPage(to, offset, callback) { if ( offset === void 0 ) offset = 0; var startTime; var duration = 500; var startPos = window.pageYOffset; var endPos = ~~(to.getBoundingClientRect().top - offset); var scroll = function (timestamp) { var elapsed; startTime = startTime || timestamp; ...
[ "function", "scrollPage", "(", "to", ",", "offset", ",", "callback", ")", "{", "if", "(", "offset", "===", "void", "0", ")", "offset", "=", "0", ";", "var", "startTime", ";", "var", "duration", "=", "500", ";", "var", "startPos", "=", "window", ".", ...
Scroll the page to a particular page anchor @param {HTMLElement} to The element to scroll to. @param {number} offset A scrolling offset. @param {function} callback Function to apply after scrolling @return {void}
[ "Scroll", "the", "page", "to", "a", "particular", "page", "anchor" ]
badde353ec6210d6b3759925d2308dc49aa2e65f
https://github.com/apathetic/stickynav/blob/badde353ec6210d6b3759925d2308dc49aa2e65f/dist/stickynav.es6.js#L136-L159
train
apathetic/stickynav
dist/stickynav.es6.js
$$
function $$(els) { return els instanceof NodeList ? Array.prototype.slice.call(els) : els instanceof HTMLElement ? [els] : typeof els === 'string' ? Array.prototype.slice.call(document.querySelectorAll(els)) : []; }
javascript
function $$(els) { return els instanceof NodeList ? Array.prototype.slice.call(els) : els instanceof HTMLElement ? [els] : typeof els === 'string' ? Array.prototype.slice.call(document.querySelectorAll(els)) : []; }
[ "function", "$$", "(", "els", ")", "{", "return", "els", "instanceof", "NodeList", "?", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "els", ")", ":", "els", "instanceof", "HTMLElement", "?", "[", "els", "]", ":", "typeof", "els", "===", ...
mini querySelectorAll helper fn
[ "mini", "querySelectorAll", "helper", "fn" ]
badde353ec6210d6b3759925d2308dc49aa2e65f
https://github.com/apathetic/stickynav/blob/badde353ec6210d6b3759925d2308dc49aa2e65f/dist/stickynav.es6.js#L162-L167
train
loggur-legacy/baucis-decorator-auth
index.js
requestHandler
function requestHandler (method) { return function (req, res, next) { method.call(this, req, responseHandler(res, next)); }.bind(this); }
javascript
function requestHandler (method) { return function (req, res, next) { method.call(this, req, responseHandler(res, next)); }.bind(this); }
[ "function", "requestHandler", "(", "method", ")", "{", "return", "function", "(", "req", ",", "res", ",", "next", ")", "{", "method", ".", "call", "(", "this", ",", "req", ",", "responseHandler", "(", "res", ",", "next", ")", ")", ";", "}", ".", "b...
Returns a request handler using some method. @param {Function} method @return {Function} @api private
[ "Returns", "a", "request", "handler", "using", "some", "method", "." ]
aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb
https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L51-L55
train
loggur-legacy/baucis-decorator-auth
index.js
responseHandler
function responseHandler (res, next) { return function (err, message) { if (err || !message) { next(err); } else { res.send(message); } } }
javascript
function responseHandler (res, next) { return function (err, message) { if (err || !message) { next(err); } else { res.send(message); } } }
[ "function", "responseHandler", "(", "res", ",", "next", ")", "{", "return", "function", "(", "err", ",", "message", ")", "{", "if", "(", "err", "||", "!", "message", ")", "{", "next", "(", "err", ")", ";", "}", "else", "{", "res", ".", "send", "(...
Returns a response handler using `res` and `next` from Express. @param {Object} res @param {Function} next @return {Function} @api private
[ "Returns", "a", "response", "handler", "using", "res", "and", "next", "from", "Express", "." ]
aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb
https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L65-L73
train
loggur-legacy/baucis-decorator-auth
index.js
getPasswordObj
function getPasswordObj (values, keys) { var passwordObj = {}; (keys || Object.keys(values)).forEach(function (key) { passwordObj[values[key].password] = key; }); return passwordObj; }
javascript
function getPasswordObj (values, keys) { var passwordObj = {}; (keys || Object.keys(values)).forEach(function (key) { passwordObj[values[key].password] = key; }); return passwordObj; }
[ "function", "getPasswordObj", "(", "values", ",", "keys", ")", "{", "var", "passwordObj", "=", "{", "}", ";", "(", "keys", "||", "Object", ".", "keys", "(", "values", ")", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "passwordObj", "["...
Gets the password keys from some set of values. @param {Object} values @param {Array} keys optional @return {Object} @api private
[ "Gets", "the", "password", "keys", "from", "some", "set", "of", "values", "." ]
aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb
https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L170-L178
train
loggur-legacy/baucis-decorator-auth
index.js
getResetterObj
function getResetterObj (values, keys) { var resetterObj = {}; (keys || Object.keys(values)).forEach(function (key) { if (values[key].resetter) { resetterObj[values[key].resetter] = key; } }); return resetterObj; }
javascript
function getResetterObj (values, keys) { var resetterObj = {}; (keys || Object.keys(values)).forEach(function (key) { if (values[key].resetter) { resetterObj[values[key].resetter] = key; } }); return resetterObj; }
[ "function", "getResetterObj", "(", "values", ",", "keys", ")", "{", "var", "resetterObj", "=", "{", "}", ";", "(", "keys", "||", "Object", ".", "keys", "(", "values", ")", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "valu...
Gets the resetter keys from some set of values. @param {Object} values @param {Array} keys optional @return {Object} @api private
[ "Gets", "the", "resetter", "keys", "from", "some", "set", "of", "values", "." ]
aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb
https://github.com/loggur-legacy/baucis-decorator-auth/blob/aa31cf625d3c7ba69d97e5d1c07e4dceffbb7dfb/index.js#L372-L382
train
berkeleybop/bbop-core
lib/core.js
_first_split
function _first_split(character, string){ var retlist = null; var eq_loc = string.indexOf(character); if( eq_loc == 0 ){ retlist = ['', string.substr(eq_loc +1, string.length)]; }else if( eq_loc > 0 ){ var before = string.substr(0, eq_loc); var after = string.substr(eq_loc +1, string.length); ...
javascript
function _first_split(character, string){ var retlist = null; var eq_loc = string.indexOf(character); if( eq_loc == 0 ){ retlist = ['', string.substr(eq_loc +1, string.length)]; }else if( eq_loc > 0 ){ var before = string.substr(0, eq_loc); var after = string.substr(eq_loc +1, string.length); ...
[ "function", "_first_split", "(", "character", ",", "string", ")", "{", "var", "retlist", "=", "null", ";", "var", "eq_loc", "=", "string", ".", "indexOf", "(", "character", ")", ";", "if", "(", "eq_loc", "==", "0", ")", "{", "retlist", "=", "[", "''"...
Attempt to return a two part split on the first occurrence of a character. Returns '' for parts not found. Unit tests make the edge cases clear. @function @name module:bbop-core#first_split @param {String} character - the character to split on @param {String} string - the string to split @returns {Array} list of fir...
[ "Attempt", "to", "return", "a", "two", "part", "split", "on", "the", "first", "occurrence", "of", "a", "character", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L189-L205
train
berkeleybop/bbop-core
lib/core.js
function(str, lim, suff){ var ret = str; var limit = 10; if( lim ){ limit = lim; } var suffix = ''; if( suff ){ suffix = suff; } if( str.length > limit ){ ret = str.substring(0, (limit - suffix.length)) + suffix; } return ret; }
javascript
function(str, lim, suff){ var ret = str; var limit = 10; if( lim ){ limit = lim; } var suffix = ''; if( suff ){ suffix = suff; } if( str.length > limit ){ ret = str.substring(0, (limit - suffix.length)) + suffix; } return ret; }
[ "function", "(", "str", ",", "lim", ",", "suff", ")", "{", "var", "ret", "=", "str", ";", "var", "limit", "=", "10", ";", "if", "(", "lim", ")", "{", "limit", "=", "lim", ";", "}", "var", "suffix", "=", "''", ";", "if", "(", "suff", ")", "{...
Crop a string nicely. Returns: Nothing. Side-effects: throws an error if the namespace defined by the strings is not currently found. @param {} str - the string to crop @param {} lim - the final length to crop to (optional, defaults to 10) @param {} suff - the string to add to the end (optional, defaults to '') @retu...
[ "Crop", "a", "string", "nicely", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L227-L240
train
berkeleybop/bbop-core
lib/core.js
function(older_hash, newer_hash){ if( ! older_hash ){ older_hash = {}; } if( ! newer_hash ){ newer_hash = {}; } var ret_hash = {}; function _add (val, key){ ret_hash[key] = val; } each(older_hash, _add); each(newer_hash, _add); return ret_hash; }
javascript
function(older_hash, newer_hash){ if( ! older_hash ){ older_hash = {}; } if( ! newer_hash ){ newer_hash = {}; } var ret_hash = {}; function _add (val, key){ ret_hash[key] = val; } each(older_hash, _add); each(newer_hash, _add); return ret_hash; }
[ "function", "(", "older_hash", ",", "newer_hash", ")", "{", "if", "(", "!", "older_hash", ")", "{", "older_hash", "=", "{", "}", ";", "}", "if", "(", "!", "newer_hash", ")", "{", "newer_hash", "=", "{", "}", ";", "}", "var", "ret_hash", "=", "{", ...
Merge a pair of hashes together, the second hash getting precedence. This is a superset of the keys both hashes. @see module:bbop-core.fold @param {} older_hash - first pass @param {} newer_hash - second pass @returns {object} a new hash
[ "Merge", "a", "pair", "of", "hashes", "together", "the", "second", "hash", "getting", "precedence", ".", "This", "is", "a", "superset", "of", "the", "keys", "both", "hashes", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L280-L292
train
berkeleybop/bbop-core
lib/core.js
function(in_thing, filter_function, sort_function){ var ret = []; // Probably an not array then. if( typeof(in_thing) === 'undefined' ){ // this is a nothing, to nothing.... }else if( typeof(in_thing) != 'object' ){ throw new Error('Unsupported type in bbop.core.pare: ' + typeof(in_thing) ); }e...
javascript
function(in_thing, filter_function, sort_function){ var ret = []; // Probably an not array then. if( typeof(in_thing) === 'undefined' ){ // this is a nothing, to nothing.... }else if( typeof(in_thing) != 'object' ){ throw new Error('Unsupported type in bbop.core.pare: ' + typeof(in_thing) ); }e...
[ "function", "(", "in_thing", ",", "filter_function", ",", "sort_function", ")", "{", "var", "ret", "=", "[", "]", ";", "// Probably an not array then.", "if", "(", "typeof", "(", "in_thing", ")", "===", "'undefined'", ")", "{", "// this is a nothing, to nothing......
Take an array or hash and pare it down using a couple of functions to what we want. Both parameters are optional in the sense that you can set them to null and they will have no function; i.e. a null filter will let everything through and a null sort will let things go in whatever order. @param {Array|Object} in_thin...
[ "Take", "an", "array", "or", "hash", "and", "pare", "it", "down", "using", "a", "couple", "of", "functions", "to", "what", "we", "want", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L487-L535
train
berkeleybop/bbop-core
lib/core.js
function(iobj, interface_list){ var retval = true; each(interface_list, function(iface){ //print('|' + typeof(in_key) + ' || ' + typeof(in_val)); //print('|' + in_key + ' || ' + in_val); if( typeof(iobj[iface]) == 'undefined' && typeof(iobj.prototype[iface]) == 'undefined' ){ retval = false; ...
javascript
function(iobj, interface_list){ var retval = true; each(interface_list, function(iface){ //print('|' + typeof(in_key) + ' || ' + typeof(in_val)); //print('|' + in_key + ' || ' + in_val); if( typeof(iobj[iface]) == 'undefined' && typeof(iobj.prototype[iface]) == 'undefined' ){ retval = false; ...
[ "function", "(", "iobj", ",", "interface_list", ")", "{", "var", "retval", "=", "true", ";", "each", "(", "interface_list", ",", "function", "(", "iface", ")", "{", "//print('|' + typeof(in_key) + ' || ' + typeof(in_val));", "//print('|' + in_key + ' || ' + in_val);", "...
Check to see if all top-level objects in a namespace supply an "interface". Mostly intended for use during unit testing. TODO: Unit test this to make sure it catches both prototype (okay I think) and uninstantiated objects (harder/impossible?). @param {} iobj - the object/constructor in question @param {} interface_...
[ "Check", "to", "see", "if", "all", "top", "-", "level", "objects", "in", "a", "namespace", "supply", "an", "interface", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L586-L599
train
berkeleybop/bbop-core
lib/core.js
function(qargs){ var mbuff = []; for( var qname in qargs ){ var qval = qargs[qname]; // null is technically an object, but we don't want to render // it. if( qval != null ){ if( typeof qval == 'string' || typeof qval == 'number' ){ // Is standard name/value pair. var nano_buffer = ...
javascript
function(qargs){ var mbuff = []; for( var qname in qargs ){ var qval = qargs[qname]; // null is technically an object, but we don't want to render // it. if( qval != null ){ if( typeof qval == 'string' || typeof qval == 'number' ){ // Is standard name/value pair. var nano_buffer = ...
[ "function", "(", "qargs", ")", "{", "var", "mbuff", "=", "[", "]", ";", "for", "(", "var", "qname", "in", "qargs", ")", "{", "var", "qval", "=", "qargs", "[", "qname", "]", ";", "// null is technically an object, but we don't want to render", "// it.", "if",...
Assemble an object into a GET-like query. You probably want to see the tests to get an idea of what this is doing. The last argument of double hashes gets quoted (Solr-esque), otherwise not. It will try and avoid adding additional sets of quotes to strings. This does nothing to make the produced "URL" in any way safe...
[ "Assemble", "an", "object", "into", "a", "GET", "-", "like", "query", ".", "You", "probably", "want", "to", "see", "the", "tests", "to", "get", "an", "idea", "of", "what", "this", "is", "doing", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L617-L707
train
berkeleybop/bbop-core
lib/core.js
function(len){ var random_base = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]; var length = len || 10; var cache = new Array(); for( var ii = 0; ii < length; ii+...
javascript
function(len){ var random_base = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]; var length = len || 10; var cache = new Array(); for( var ii = 0; ii < length; ii+...
[ "function", "(", "len", ")", "{", "var", "random_base", "=", "[", "'1'", ",", "'2'", ",", "'3'", ",", "'4'", ",", "'5'", ",", "'6'", ",", "'7'", ",", "'8'", ",", "'9'", ",", "'0'", ",", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", ",", "'e'", ...
Random number generator of fixed length. Return a random number string of length len. @param {} len - the number of random character to return. @returns {string} string
[ "Random", "number", "generator", "of", "fixed", "length", ".", "Return", "a", "random", "number", "string", "of", "length", "len", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L716-L730
train
berkeleybop/bbop-core
lib/core.js
function(url){ var retlist = []; // Pull parameters. var tmp = url.split('?'); var path = ''; var parms = []; if( ! tmp[1] ){ // catch bad url--nothing before '?' parms = tmp[0].split('&'); }else{ // normal structure path = tmp[0]; parms = tmp[1].split('&'); } // Decompose parameters. each(p...
javascript
function(url){ var retlist = []; // Pull parameters. var tmp = url.split('?'); var path = ''; var parms = []; if( ! tmp[1] ){ // catch bad url--nothing before '?' parms = tmp[0].split('&'); }else{ // normal structure path = tmp[0]; parms = tmp[1].split('&'); } // Decompose parameters. each(p...
[ "function", "(", "url", ")", "{", "var", "retlist", "=", "[", "]", ";", "// Pull parameters.", "var", "tmp", "=", "url", ".", "split", "(", "'?'", ")", ";", "var", "path", "=", "''", ";", "var", "parms", "=", "[", "]", ";", "if", "(", "!", "tmp...
Return the parameters part of a URL. Unit tests make the edge cases clear. @param {} url - url (or similar string) @returns {Array} list of part lists
[ "Return", "the", "parameters", "part", "of", "a", "URL", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L740-L766
train
berkeleybop/bbop-core
lib/core.js
function(str){ var retstr = str; if( ! us.isUndefined(str) && str.length > 2 ){ var end = str.length -1; if( str.charAt(0) == '"' && str.charAt(end) == '"' ){ retstr = str.substr(1, end -1); } } return retstr; }
javascript
function(str){ var retstr = str; if( ! us.isUndefined(str) && str.length > 2 ){ var end = str.length -1; if( str.charAt(0) == '"' && str.charAt(end) == '"' ){ retstr = str.substr(1, end -1); } } return retstr; }
[ "function", "(", "str", ")", "{", "var", "retstr", "=", "str", ";", "if", "(", "!", "us", ".", "isUndefined", "(", "str", ")", "&&", "str", ".", "length", ">", "2", ")", "{", "var", "end", "=", "str", ".", "length", "-", "1", ";", "if", "(", ...
Remove the quotes from a string. @param {string} str - the string to dequote @returns {string} the dequoted string (or the original string)
[ "Remove", "the", "quotes", "from", "a", "string", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L845-L856
train
berkeleybop/bbop-core
lib/core.js
function(str, delimiter){ var retlist = null; if( ! us.isUndefined(str) ){ if( us.isUndefined(delimiter) ){ delimiter = /\s+/; } retlist = str.split(delimiter); } return retlist; }
javascript
function(str, delimiter){ var retlist = null; if( ! us.isUndefined(str) ){ if( us.isUndefined(delimiter) ){ delimiter = /\s+/; } retlist = str.split(delimiter); } return retlist; }
[ "function", "(", "str", ",", "delimiter", ")", "{", "var", "retlist", "=", "null", ";", "if", "(", "!", "us", ".", "isUndefined", "(", "str", ")", ")", "{", "if", "(", "us", ".", "isUndefined", "(", "delimiter", ")", ")", "{", "delimiter", "=", "...
Break apart a string on certain delimiter. @param {} str - the string to ensure that has the property @param {} delimiter - *[optional]* either a string or a simple regexp; defaults to ws @returns {Array} a list of separated substrings
[ "Break", "apart", "a", "string", "on", "certain", "delimiter", "." ]
d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf
https://github.com/berkeleybop/bbop-core/blob/d9ce82a3a7d4f5e7300c0b637d8f7ff0e6969adf/lib/core.js#L936-L949
train
wshager/js-rrb-vector
lib/concat.js
insertRight
function insertRight(parent, node) { var index = parent.length - 1; parent[index] = node; parent.sizes[index] = (0, _util.length)(node) + (index > 0 ? parent.sizes[index - 1] : 0); }
javascript
function insertRight(parent, node) { var index = parent.length - 1; parent[index] = node; parent.sizes[index] = (0, _util.length)(node) + (index > 0 ? parent.sizes[index - 1] : 0); }
[ "function", "insertRight", "(", "parent", ",", "node", ")", "{", "var", "index", "=", "parent", ".", "length", "-", "1", ";", "parent", "[", "index", "]", "=", "node", ";", "parent", ".", "sizes", "[", "index", "]", "=", "(", "0", ",", "_util", "...
Helperfunctions for _concat. Replaces a child node at the side of the parent.
[ "Helperfunctions", "for", "_concat", ".", "Replaces", "a", "child", "node", "at", "the", "side", "of", "the", "parent", "." ]
766c3c12f658cc251dce028460c4eca4e33d5254
https://github.com/wshager/js-rrb-vector/blob/766c3c12f658cc251dce028460c4eca4e33d5254/lib/concat.js#L108-L112
train
integreat-io/great-uri-template
lib/utils/splitTemplate.js
splitTemplate
function splitTemplate (template) { if (!template) { return [] } return split(template).filter((seg) => seg !== '' && seg !== undefined) }
javascript
function splitTemplate (template) { if (!template) { return [] } return split(template).filter((seg) => seg !== '' && seg !== undefined) }
[ "function", "splitTemplate", "(", "template", ")", "{", "if", "(", "!", "template", ")", "{", "return", "[", "]", "}", "return", "split", "(", "template", ")", ".", "filter", "(", "(", "seg", ")", "=>", "seg", "!==", "''", "&&", "seg", "!==", "unde...
Split the given template into segments. @param {string} template - The template to split @returns {string[]} An array of string segments
[ "Split", "the", "given", "template", "into", "segments", "." ]
0e896ead0567737cf31a4a8b76a26cfa6ce60759
https://github.com/integreat-io/great-uri-template/blob/0e896ead0567737cf31a4a8b76a26cfa6ce60759/lib/utils/splitTemplate.js#L34-L39
train
tjmehta/docker-frame
index.js
createHeader
function createHeader (type, size) { var header = new Buffer(8); header.writeUInt8(type, 0); header.writeUInt32BE(size, 4); return header; }
javascript
function createHeader (type, size) { var header = new Buffer(8); header.writeUInt8(type, 0); header.writeUInt32BE(size, 4); return header; }
[ "function", "createHeader", "(", "type", ",", "size", ")", "{", "var", "header", "=", "new", "Buffer", "(", "8", ")", ";", "header", ".", "writeUInt8", "(", "type", ",", "0", ")", ";", "header", ".", "writeUInt32BE", "(", "size", ",", "4", ")", ";"...
create a docker frame header @param {number} ioConnectionType - 2=stderr, 1=stdout, 0=stdin @param {string|buffer} payloadData @returns {buffer} header - frame header (type, length) as buffer
[ "create", "a", "docker", "frame", "header" ]
8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b
https://github.com/tjmehta/docker-frame/blob/8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b/index.js#L30-L35
train
tjmehta/docker-frame
index.js
validateArgs
function validateArgs (type, payload) { if (!type) { return new Error('type is required'); } if (!payload) { return new Error('payload is required'); } if (!isNumber(type)) { return new Error('type must be a number'); } if (!isBuffer(payload) && !isString(payload)) { return new Error('payl...
javascript
function validateArgs (type, payload) { if (!type) { return new Error('type is required'); } if (!payload) { return new Error('payload is required'); } if (!isNumber(type)) { return new Error('type must be a number'); } if (!isBuffer(payload) && !isString(payload)) { return new Error('payl...
[ "function", "validateArgs", "(", "type", ",", "payload", ")", "{", "if", "(", "!", "type", ")", "{", "return", "new", "Error", "(", "'type is required'", ")", ";", "}", "if", "(", "!", "payload", ")", "{", "return", "new", "Error", "(", "'payload is re...
validates arguments for createFrame @param {number} ioConnectionType - 2=stderr, 1=stdout, 0=stdin @param {string|buffer} payloadData @return {undefined|error} error - returns error if an argument is invalid
[ "validates", "arguments", "for", "createFrame" ]
8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b
https://github.com/tjmehta/docker-frame/blob/8d22ed6a1ab5ad9ca3c5f82dca4efd92aa53b42b/index.js#L43-L59
train
hydrojs/co
index.js
sync
function sync(fn) { return function(done) { var res = isGenerator(fn) ? co(fn) : fn(done); if (isPromise(res)) { res.then(function(){ done(); }, done); } else { fn.length || done(); } }; }
javascript
function sync(fn) { return function(done) { var res = isGenerator(fn) ? co(fn) : fn(done); if (isPromise(res)) { res.then(function(){ done(); }, done); } else { fn.length || done(); } }; }
[ "function", "sync", "(", "fn", ")", "{", "return", "function", "(", "done", ")", "{", "var", "res", "=", "isGenerator", "(", "fn", ")", "?", "co", "(", "fn", ")", ":", "fn", "(", "done", ")", ";", "if", "(", "isPromise", "(", "res", ")", ")", ...
Wrap `fn` to handle any attempts at asynchrony @param {Function|GeneratorFunction} fn @return {Function}
[ "Wrap", "fn", "to", "handle", "any", "attempts", "at", "asynchrony" ]
8c429a795a27e6ebcae83adc69f73b06d9aca607
https://github.com/hydrojs/co/blob/8c429a795a27e6ebcae83adc69f73b06d9aca607/index.js#L36-L45
train
williamkapke/consumer
consumer.js
function(regex){ //if it isn't global, `exec()` will not start at `lastIndex` if(!regex.global) regex.compile(regex.source, flags(regex)); regex.lastIndex = this.position; var m = regex.exec(this.source); //all matches must start at the current position. if(m && m.index!=this.position){ return null; ...
javascript
function(regex){ //if it isn't global, `exec()` will not start at `lastIndex` if(!regex.global) regex.compile(regex.source, flags(regex)); regex.lastIndex = this.position; var m = regex.exec(this.source); //all matches must start at the current position. if(m && m.index!=this.position){ return null; ...
[ "function", "(", "regex", ")", "{", "//if it isn't global, `exec()` will not start at `lastIndex`", "if", "(", "!", "regex", ".", "global", ")", "regex", ".", "compile", "(", "regex", ".", "source", ",", "flags", "(", "regex", ")", ")", ";", "regex", ".", "l...
Consume the characters matched by the 'regex'. @param {RegExp} regex
[ "Consume", "the", "characters", "matched", "by", "the", "regex", "." ]
03ad06f555447ba5dd626e3e94066452a3bc3f3f
https://github.com/williamkapke/consumer/blob/03ad06f555447ba5dd626e3e94066452a3bc3f3f/consumer.js#L40-L54
train
wshager/js-rrb-vector
lib/transient.js
get
function get(tree, i) { if (i < 0 || i >= tree.size) { return undefined; } var offset = (0, _util.tailOffset)(tree); if (i >= offset) { return tree.tail[i - offset]; } return (0, _util.getRoot)(i, tree.root); }
javascript
function get(tree, i) { if (i < 0 || i >= tree.size) { return undefined; } var offset = (0, _util.tailOffset)(tree); if (i >= offset) { return tree.tail[i - offset]; } return (0, _util.getRoot)(i, tree.root); }
[ "function", "get", "(", "tree", ",", "i", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "tree", ".", "size", ")", "{", "return", "undefined", ";", "}", "var", "offset", "=", "(", "0", ",", "_util", ".", "tailOffset", ")", "(", "tree", ...
Gets the value at index i recursively.
[ "Gets", "the", "value", "at", "index", "i", "recursively", "." ]
766c3c12f658cc251dce028460c4eca4e33d5254
https://github.com/wshager/js-rrb-vector/blob/766c3c12f658cc251dce028460c4eca4e33d5254/lib/transient.js#L64-L73
train
wunderbyte/grunt-spiritual-edbml
tasks/things/assistant.js
formatjson
function formatjson(pis) { return pis.map(function(pi) { var newpi = {}; newpi[pi.tag] = pi.att; return newpi; }); }
javascript
function formatjson(pis) { return pis.map(function(pi) { var newpi = {}; newpi[pi.tag] = pi.att; return newpi; }); }
[ "function", "formatjson", "(", "pis", ")", "{", "return", "pis", ".", "map", "(", "function", "(", "pi", ")", "{", "var", "newpi", "=", "{", "}", ";", "newpi", "[", "pi", ".", "tag", "]", "=", "pi", ".", "att", ";", "return", "newpi", ";", "}",...
Format processing instructions for slight improved readability. @param {Array<Instruction>} pis @returns {Array<object>}
[ "Format", "processing", "instructions", "for", "slight", "improved", "readability", "." ]
2ba0aa8042eceee917f1ee48c7881345df3bce46
https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/assistant.js#L71-L77
train
LAJW/co-reduce-any
index.js
enumerate
function enumerate(collection) { if (isObject(collection)) { if (collection instanceof Map) { return enumerateMap(collection) } else if (isIterable(collection)) { return enumerateIterable(collection) } else { return enumerateObject(collection) } ...
javascript
function enumerate(collection) { if (isObject(collection)) { if (collection instanceof Map) { return enumerateMap(collection) } else if (isIterable(collection)) { return enumerateIterable(collection) } else { return enumerateObject(collection) } ...
[ "function", "enumerate", "(", "collection", ")", "{", "if", "(", "isObject", "(", "collection", ")", ")", "{", "if", "(", "collection", "instanceof", "Map", ")", "{", "return", "enumerateMap", "(", "collection", ")", "}", "else", "if", "(", "isIterable", ...
Inspired by Python's enumerate
[ "Inspired", "by", "Python", "s", "enumerate" ]
3b1b7c57c8f3f8fe0deb6aec40022022b1c62b4e
https://github.com/LAJW/co-reduce-any/blob/3b1b7c57c8f3f8fe0deb6aec40022022b1c62b4e/index.js#L48-L60
train
andrewscwei/requiem
src/dom/sightread.js
sightread
function sightread(element, childRegistry) { if (!element || element === document) element = window; if (!childRegistry && !getChildRegistry(element)) return; // Clear the child registry. if (!childRegistry) { element.__private__.childRegistry = {}; childRegistry = getChildRegistry(element); } ele...
javascript
function sightread(element, childRegistry) { if (!element || element === document) element = window; if (!childRegistry && !getChildRegistry(element)) return; // Clear the child registry. if (!childRegistry) { element.__private__.childRegistry = {}; childRegistry = getChildRegistry(element); } ele...
[ "function", "sightread", "(", "element", ",", "childRegistry", ")", "{", "if", "(", "!", "element", "||", "element", "===", "document", ")", "element", "=", "window", ";", "if", "(", "!", "childRegistry", "&&", "!", "getChildRegistry", "(", "element", ")",...
Crawls a DOM element, creates a child registry for the element and registers all of its children into the child registry, recursively. @param {Node} [element=document] - Target element for sightreading. By default this will be the document. @param {Object} [childRegistry] - Target child registry to register child elem...
[ "Crawls", "a", "DOM", "element", "creates", "a", "child", "registry", "for", "the", "element", "and", "registers", "all", "of", "its", "children", "into", "the", "child", "registry", "recursively", "." ]
c4182bfffc9841c6de5718f689ad3c2060511777
https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/sightread.js#L23-L53
train
inviqa/deck-task-registry
src/styles/lintStyles.js
lintStyles
function lintStyles(conf, undertaker) { const sassSrc = path.join(conf.themeConfig.root, conf.themeConfig.sass.src, '**', '*.scss'); let stylelintConf = { config: require('./stylelint.config'), reporters: [{ formatter: 'string', console: true }], failAfterError: conf.productionMode }...
javascript
function lintStyles(conf, undertaker) { const sassSrc = path.join(conf.themeConfig.root, conf.themeConfig.sass.src, '**', '*.scss'); let stylelintConf = { config: require('./stylelint.config'), reporters: [{ formatter: 'string', console: true }], failAfterError: conf.productionMode }...
[ "function", "lintStyles", "(", "conf", ",", "undertaker", ")", "{", "const", "sassSrc", "=", "path", ".", "join", "(", "conf", ".", "themeConfig", ".", "root", ",", "conf", ".", "themeConfig", ".", "sass", ".", "src", ",", "'**'", ",", "'*.scss'", ")",...
Lint project styles. @param {ConfigParser} conf A configuration parser object. @param {Undertaker} undertaker An Undertaker instance. @returns {Stream} A stream of files.
[ "Lint", "project", "styles", "." ]
4c31787b978e9d99a47052e090d4589a50cd3015
https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/styles/lintStyles.js#L15-L36
train
chanoch/simple-react-router
src/SimpleReactRouter.js
render
function render(history, routes, store) { const resolve = resolver(routes); return function(location) { resolve(location) .then(config => { renderPage(config.page(store, history), routes); const actionParams = config.matchRoute(location.pathname).params; c...
javascript
function render(history, routes, store) { const resolve = resolver(routes); return function(location) { resolve(location) .then(config => { renderPage(config.page(store, history), routes); const actionParams = config.matchRoute(location.pathname).params; c...
[ "function", "render", "(", "history", ",", "routes", ",", "store", ")", "{", "const", "resolve", "=", "resolver", "(", "routes", ")", ";", "return", "function", "(", "location", ")", "{", "resolve", "(", "location", ")", ".", "then", "(", "config", "=>...
Render the new 'page' given by the route. In order for this to work, each path or location in the application need to have the root component for it defined. The page component will be passed the store in the props to extract rendering data. 'page' here refers to the fact that the user will perceive the new applicati...
[ "Render", "the", "new", "page", "given", "by", "the", "route", "." ]
3c71feeeb039111f33c934257732e2ea6ddde9ff
https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/SimpleReactRouter.js#L75-L89
train
chanoch/simple-react-router
src/SimpleReactRouter.js
resolver
function resolver(routes) { return async function(context) { const uri = context.error ? '/error' : context.pathname; return routes.find(route => route.matchRoute(uri)); } }
javascript
function resolver(routes) { return async function(context) { const uri = context.error ? '/error' : context.pathname; return routes.find(route => route.matchRoute(uri)); } }
[ "function", "resolver", "(", "routes", ")", "{", "return", "async", "function", "(", "context", ")", "{", "const", "uri", "=", "context", ".", "error", "?", "'/error'", ":", "context", ".", "pathname", ";", "return", "routes", ".", "find", "(", "route", ...
Resolve the component to render based on the pathname given as the parameter's property. If the location cannot be resolved then throw an error. The resolver will resolve the component configured against /error to render an error page @param {Object} context - an object containing a pathname to resove or an error TO...
[ "Resolve", "the", "component", "to", "render", "based", "on", "the", "pathname", "given", "as", "the", "parameter", "s", "property", "." ]
3c71feeeb039111f33c934257732e2ea6ddde9ff
https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/SimpleReactRouter.js#L102-L107
train
sendanor/nor-db
lib/core/Connection.js
Connection
function Connection(conn) { if(!(this instanceof Connection)) { return new Connection(conn); } var self = this; if(!conn) { throw new TypeError("no connection set"); } self._connection = conn; }
javascript
function Connection(conn) { if(!(this instanceof Connection)) { return new Connection(conn); } var self = this; if(!conn) { throw new TypeError("no connection set"); } self._connection = conn; }
[ "function", "Connection", "(", "conn", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Connection", ")", ")", "{", "return", "new", "Connection", "(", "conn", ")", ";", "}", "var", "self", "=", "this", ";", "if", "(", "!", "conn", ")", "{", ...
Base class `Connection` constructor
[ "Base", "class", "Connection", "constructor" ]
db4b78691956a49370fc9d9a4eed27e7d3720aeb
https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/lib/core/Connection.js#L9-L16
train
linyngfly/omelo-admin
lib/modules/monitorLog.js
function(opts) { opts = opts || {}; this.root = opts.path; this.interval = opts.interval || DEFAULT_INTERVAL; }
javascript
function(opts) { opts = opts || {}; this.root = opts.path; this.interval = opts.interval || DEFAULT_INTERVAL; }
[ "function", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "this", ".", "root", "=", "opts", ".", "path", ";", "this", ".", "interval", "=", "opts", ".", "interval", "||", "DEFAULT_INTERVAL", ";", "}" ]
Initialize a new 'Module' with the given 'opts' @class Module @constructor @param {object} opts @api public
[ "Initialize", "a", "new", "Module", "with", "the", "given", "opts" ]
1cd692c16ab63b9c0d4009535f300f2ca584b691
https://github.com/linyngfly/omelo-admin/blob/1cd692c16ab63b9c0d4009535f300f2ca584b691/lib/modules/monitorLog.js#L26-L30
train
derdesign/protos
drivers/mysql.js
MySQL
function MySQL(config) { var self = this; config = config || {}; config.host = config.host || 'localhost'; config.port = config.port || 3306; this.className = this.constructor.name; this.config = config; // Set client this.client = mysql.createConnection(config); // Assign storage if...
javascript
function MySQL(config) { var self = this; config = config || {}; config.host = config.host || 'localhost'; config.port = config.port || 3306; this.className = this.constructor.name; this.config = config; // Set client this.client = mysql.createConnection(config); // Assign storage if...
[ "function", "MySQL", "(", "config", ")", "{", "var", "self", "=", "this", ";", "config", "=", "config", "||", "{", "}", ";", "config", ".", "host", "=", "config", ".", "host", "||", "'localhost'", ";", "config", ".", "port", "=", "config", ".", "po...
MySQL Driver class Driver configuration config: { host: 'localhost', port: 3306, user: 'db_user', password: 'db_password', database: 'db_name', debug: false, storage: 'redis' } @class MySQL @extends Driver @constructor @param {object} app Application instance @param {object} config Driver configuration
[ "MySQL", "Driver", "class" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/drivers/mysql.js#L32-L60
train
arjunmehta/node-ansi-state
main.js
ANSIState
function ANSIState(legacy) { var feed = '', last_match = '', stream_match = [], _this = this; PassThrough.call(this); this.attrs = {}; this.reset(); this.is_reset = false; this.setEncoding('utf8'); this.on('data', function(chunk) { feed += chunk; i...
javascript
function ANSIState(legacy) { var feed = '', last_match = '', stream_match = [], _this = this; PassThrough.call(this); this.attrs = {}; this.reset(); this.is_reset = false; this.setEncoding('utf8'); this.on('data', function(chunk) { feed += chunk; i...
[ "function", "ANSIState", "(", "legacy", ")", "{", "var", "feed", "=", "''", ",", "last_match", "=", "''", ",", "stream_match", "=", "[", "]", ",", "_this", "=", "this", ";", "PassThrough", ".", "call", "(", "this", ")", ";", "this", ".", "attrs", "...
ANSI state constructor
[ "ANSI", "state", "constructor" ]
f667315f5223717c25e4c13d4072c4a0b650e202
https://github.com/arjunmehta/node-ansi-state/blob/f667315f5223717c25e4c13d4072c4a0b650e202/main.js#L26-L57
train
vkiding/jud-vue-render
src/render/browser/extend/components/tabheader/index.js
initClickEvent
function initClickEvent (tabheader) { const box = tabheader.box box.addEventListener('click', function (evt) { let target = evt.target if (target.nodeName === 'UL') { return } if (target.parentNode.nodeName === 'LI') { target = target.parentNode } const floor = target.getAttri...
javascript
function initClickEvent (tabheader) { const box = tabheader.box box.addEventListener('click', function (evt) { let target = evt.target if (target.nodeName === 'UL') { return } if (target.parentNode.nodeName === 'LI') { target = target.parentNode } const floor = target.getAttri...
[ "function", "initClickEvent", "(", "tabheader", ")", "{", "const", "box", "=", "tabheader", ".", "box", "box", ".", "addEventListener", "(", "'click'", ",", "function", "(", "evt", ")", "{", "let", "target", "=", "evt", ".", "target", "if", "(", "target"...
init events.
[ "init", "events", "." ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L101-L124
train
vkiding/jud-vue-render
src/render/browser/extend/components/tabheader/index.js
doScroll
function doScroll (node, val, finish) { if (!val) { return } if (finish === undefined) { finish = Math.abs(val) } if (finish <= 0) { return } setTimeout(function () { if (val > 0) { node.scrollLeft += 2 } else { node.scrollLeft -= 2 } finish -= 2 doScroll...
javascript
function doScroll (node, val, finish) { if (!val) { return } if (finish === undefined) { finish = Math.abs(val) } if (finish <= 0) { return } setTimeout(function () { if (val > 0) { node.scrollLeft += 2 } else { node.scrollLeft -= 2 } finish -= 2 doScroll...
[ "function", "doScroll", "(", "node", ",", "val", ",", "finish", ")", "{", "if", "(", "!", "val", ")", "{", "return", "}", "if", "(", "finish", "===", "undefined", ")", "{", "finish", "=", "Math", ".", "abs", "(", "val", ")", "}", "if", "(", "fi...
scroll the tabheader. positive val means to scroll right. negative val means to scroll left.
[ "scroll", "the", "tabheader", ".", "positive", "val", "means", "to", "scroll", "right", ".", "negative", "val", "means", "to", "scroll", "left", "." ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L164-L187
train
vkiding/jud-vue-render
src/render/browser/extend/components/tabheader/index.js
getScrollVal
function getScrollVal (rect, node) { const left = node.previousSibling const right = node.nextSibling let scrollVal // process left-side element first. if (left) { const leftRect = left.getBoundingClientRect() // only need to compare the value of left. if (leftRect.left < rect.left) { scrol...
javascript
function getScrollVal (rect, node) { const left = node.previousSibling const right = node.nextSibling let scrollVal // process left-side element first. if (left) { const leftRect = left.getBoundingClientRect() // only need to compare the value of left. if (leftRect.left < rect.left) { scrol...
[ "function", "getScrollVal", "(", "rect", ",", "node", ")", "{", "const", "left", "=", "node", ".", "previousSibling", "const", "right", "=", "node", ".", "nextSibling", "let", "scrollVal", "// process left-side element first.", "if", "(", "left", ")", "{", "co...
get scroll distance.
[ "get", "scroll", "distance", "." ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L190-L224
train
vkiding/jud-vue-render
src/render/browser/extend/components/tabheader/index.js
fireEvent
function fireEvent (element, type, data) { const evt = document.createEvent('Event') evt.data = data for (const k in data) { if (data.hasOwnProperty(k)) { evt[k] = data[k] } } // need bubble. evt.initEvent(type, true, true) element.dispatchEvent(evt) }
javascript
function fireEvent (element, type, data) { const evt = document.createEvent('Event') evt.data = data for (const k in data) { if (data.hasOwnProperty(k)) { evt[k] = data[k] } } // need bubble. evt.initEvent(type, true, true) element.dispatchEvent(evt) }
[ "function", "fireEvent", "(", "element", ",", "type", ",", "data", ")", "{", "const", "evt", "=", "document", ".", "createEvent", "(", "'Event'", ")", "evt", ".", "data", "=", "data", "for", "(", "const", "k", "in", "data", ")", "{", "if", "(", "da...
trigger and broadcast events.
[ "trigger", "and", "broadcast", "events", "." ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/tabheader/index.js#L227-L239
train
gethuman/pancakes-angular
lib/transformers/ng.routing.transformer.js
getResolveHandlers
function getResolveHandlers(appName, routes, options) { var resolveHandlers = {}; var me = this; _.each(routes, function (route) { // if no route name, don't do anything if (!route.name) { return; } // else generate the UI part based on the name var uipart = me.getUIPart(a...
javascript
function getResolveHandlers(appName, routes, options) { var resolveHandlers = {}; var me = this; _.each(routes, function (route) { // if no route name, don't do anything if (!route.name) { return; } // else generate the UI part based on the name var uipart = me.getUIPart(a...
[ "function", "getResolveHandlers", "(", "appName", ",", "routes", ",", "options", ")", "{", "var", "resolveHandlers", "=", "{", "}", ";", "var", "me", "=", "this", ";", "_", ".", "each", "(", "routes", ",", "function", "(", "route", ")", "{", "// if no ...
Get resolve handlers for all the given routes @param appName @param routes @param options
[ "Get", "resolve", "handlers", "for", "all", "the", "given", "routes" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.routing.transformer.js#L54-L82
train
gethuman/pancakes-angular
lib/transformers/ng.routing.transformer.js
getUIPart
function getUIPart(appName, route) { var rootDir = this.pancakes.getRootDir(); var filePath = path.join(rootDir, 'app', appName, 'pages', route.name + '.page.js'); return this.loadUIPart(appName, filePath); }
javascript
function getUIPart(appName, route) { var rootDir = this.pancakes.getRootDir(); var filePath = path.join(rootDir, 'app', appName, 'pages', route.name + '.page.js'); return this.loadUIPart(appName, filePath); }
[ "function", "getUIPart", "(", "appName", ",", "route", ")", "{", "var", "rootDir", "=", "this", ".", "pancakes", ".", "getRootDir", "(", ")", ";", "var", "filePath", "=", "path", ".", "join", "(", "rootDir", ",", "'app'", ",", "appName", ",", "'pages'"...
Get the UI part module for a given app and route @param appName @param route @returns {injector.require|*|require}
[ "Get", "the", "UI", "part", "module", "for", "a", "given", "app", "and", "route" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.routing.transformer.js#L90-L94
train
redisjs/jsr-server
lib/command/transaction/multi.js
execute
function execute(req, res) { // setup the transaction req.conn.transaction = new Transaction(); res.send(null, Constants.OK); }
javascript
function execute(req, res) { // setup the transaction req.conn.transaction = new Transaction(); res.send(null, Constants.OK); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "// setup the transaction", "req", ".", "conn", ".", "transaction", "=", "new", "Transaction", "(", ")", ";", "res", ".", "send", "(", "null", ",", "Constants", ".", "OK", ")", ";", "}" ]
Respond to the MULTI command.
[ "Respond", "to", "the", "MULTI", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/transaction/multi.js#L20-L24
train
MakerCollider/node-red-contrib-smartnode-hook
html/scripts/RGraph/RGraph.pie.js
function () { obj.set('exploded', currentExplode + (step * frame) ); RGraph.clear(obj.canvas); RGraph.redrawCanvas(obj.canvas); if (frame++ < frames) { RGraph.Effects.updateCanvas(iterator); } else { ...
javascript
function () { obj.set('exploded', currentExplode + (step * frame) ); RGraph.clear(obj.canvas); RGraph.redrawCanvas(obj.canvas); if (frame++ < frames) { RGraph.Effects.updateCanvas(iterator); } else { ...
[ "function", "(", ")", "{", "obj", ".", "set", "(", "'exploded'", ",", "currentExplode", "+", "(", "step", "*", "frame", ")", ")", ";", "RGraph", ".", "clear", "(", "obj", ".", "canvas", ")", ";", "RGraph", ".", "redrawCanvas", "(", "obj", ".", "can...
chart.exploded
[ "chart", ".", "exploded" ]
245c267e832968bad880ca009929043e82c7bc25
https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.pie.js#L1540-L1552
train
Crafity/crafity-http
lib/Route.js
Route
function Route(path, options) { options = options || {}; this.path = path; this.method = 'GET'; this.regexp = pathtoRegexp(path , this.keys = [] , options.sensitive , options.strict); }
javascript
function Route(path, options) { options = options || {}; this.path = path; this.method = 'GET'; this.regexp = pathtoRegexp(path , this.keys = [] , options.sensitive , options.strict); }
[ "function", "Route", "(", "path", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "path", "=", "path", ";", "this", ".", "method", "=", "'GET'", ";", "this", ".", "regexp", "=", "pathtoRegexp", "(", "path", ",...
Initialize `Route` with the given HTTP `path`, and an array of `callbacks` and `options`. Options: - `sensitive` enable case-sensitive routes - `strict` enable strict matching for trailing slashes @param {String} path @param {Object} options. @api private
[ "Initialize", "Route", "with", "the", "given", "HTTP", "path", "and", "an", "array", "of", "callbacks", "and", "options", "." ]
f015eed86646e6b2ea82599c59b53a9f97fe92b4
https://github.com/Crafity/crafity-http/blob/f015eed86646e6b2ea82599c59b53a9f97fe92b4/lib/Route.js#L62-L70
train
RoboterHund/April1
modules/templates/build.js
insert
function insert (builder, node) { finishPending (builder); appendNode (builder, spec.insertNode (node [1])); }
javascript
function insert (builder, node) { finishPending (builder); appendNode (builder, spec.insertNode (node [1])); }
[ "function", "insert", "(", "builder", ",", "node", ")", "{", "finishPending", "(", "builder", ")", ";", "appendNode", "(", "builder", ",", "spec", ".", "insertNode", "(", "node", "[", "1", "]", ")", ")", ";", "}" ]
process 'insert' spec node append 'insert' template node @param builder template builder @param node the spec node should contain 1 item: the key of the 'insert' template node
[ "process", "insert", "spec", "node", "append", "insert", "template", "node" ]
f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b
https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/templates/build.js#L92-L96
train
RoboterHund/April1
modules/templates/build.js
list
function list (builder, node) { finishPending (builder); var key = node [1]; var sub = subBuilder (builder); dispatch.nodes (sub, builder.dispatch, node, 2, node.length); var template = getTemplate (sub); appendNode (builder, spec.listNode (key, template)); }
javascript
function list (builder, node) { finishPending (builder); var key = node [1]; var sub = subBuilder (builder); dispatch.nodes (sub, builder.dispatch, node, 2, node.length); var template = getTemplate (sub); appendNode (builder, spec.listNode (key, template)); }
[ "function", "list", "(", "builder", ",", "node", ")", "{", "finishPending", "(", "builder", ")", ";", "var", "key", "=", "node", "[", "1", "]", ";", "var", "sub", "=", "subBuilder", "(", "builder", ")", ";", "dispatch", ".", "nodes", "(", "sub", ",...
process 'list' spec node append 'list' template node @param builder template builder @param node the spec node should contain at least 2 items: key of the list items the spec nodes of the template used to render the list items
[ "process", "list", "spec", "node", "append", "list", "template", "node" ]
f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b
https://github.com/RoboterHund/April1/blob/f4fead4d8190d0b7bdc7b649f4c2c0e9728ef30b/modules/templates/build.js#L107-L117
train
ecs-jbariel/js-cfclient
lib/cfclient.js
CFClient
function CFClient(config) { if (!(config instanceof CFConfig)) { throw CFClientException( new Error('Given tokens must be an instance of CFConfig'), 'tokens must be an instance of CFConfig that contains: "protocol", "host", "username", "password", "skipSslValidation'); } ...
javascript
function CFClient(config) { if (!(config instanceof CFConfig)) { throw CFClientException( new Error('Given tokens must be an instance of CFConfig'), 'tokens must be an instance of CFConfig that contains: "protocol", "host", "username", "password", "skipSslValidation'); } ...
[ "function", "CFClient", "(", "config", ")", "{", "if", "(", "!", "(", "config", "instanceof", "CFConfig", ")", ")", "{", "throw", "CFClientException", "(", "new", "Error", "(", "'Given tokens must be an instance of CFConfig'", ")", ",", "'tokens must be an instance ...
Constructor for the CFClient. @param {CFConfig} config - configuration as defined in the README.md
[ "Constructor", "for", "the", "CFClient", "." ]
e912724e2b6320746b4b4297e604b54580068edd
https://github.com/ecs-jbariel/js-cfclient/blob/e912724e2b6320746b4b4297e604b54580068edd/lib/cfclient.js#L87-L97
train
ecs-jbariel/js-cfclient
lib/cfclient.js
CFConfig
function CFConfig(config) { const cf = this; extend(extend(cf, { protocol: 'http', host: 'api.bosh-lite.com', //port : null, // omitted to let it be based on config or protocol username: 'admin', password: 'admin', skipSslValidation: false }), config)...
javascript
function CFConfig(config) { const cf = this; extend(extend(cf, { protocol: 'http', host: 'api.bosh-lite.com', //port : null, // omitted to let it be based on config or protocol username: 'admin', password: 'admin', skipSslValidation: false }), config)...
[ "function", "CFConfig", "(", "config", ")", "{", "const", "cf", "=", "this", ";", "extend", "(", "extend", "(", "cf", ",", "{", "protocol", ":", "'http'", ",", "host", ":", "'api.bosh-lite.com'", ",", "//port : null, // omitted to let it be based on config or prot...
Object that helps to manage the configuration options. @param {Object} config values properties are: <ul> <li><b>protocol</b> 'http' or 'https'</li> <li><b>host</b> FQDN or IP (e.g. api.mydomain.com)</li> <li><b>username</b> username for the CF API</li> <li><b>password</b> password for the given username</li> <li><b>s...
[ "Object", "that", "helps", "to", "manage", "the", "configuration", "options", "." ]
e912724e2b6320746b4b4297e604b54580068edd
https://github.com/ecs-jbariel/js-cfclient/blob/e912724e2b6320746b4b4297e604b54580068edd/lib/cfclient.js#L267-L282
train
vidi-insights/vidi-metrics
srv/demo.js
demo_plugin
function demo_plugin (opts) { // adds an emit plugin. Emit plugins are called on regular intervals and have // the opertunity to add to the payload being sent to collectors. Data sent // from emit plugins should not require tagging, and should be map ready. this.add({role: 'metrics', hook: 'emit'}, emit) //...
javascript
function demo_plugin (opts) { // adds an emit plugin. Emit plugins are called on regular intervals and have // the opertunity to add to the payload being sent to collectors. Data sent // from emit plugins should not require tagging, and should be map ready. this.add({role: 'metrics', hook: 'emit'}, emit) //...
[ "function", "demo_plugin", "(", "opts", ")", "{", "// adds an emit plugin. Emit plugins are called on regular intervals and have", "// the opertunity to add to the payload being sent to collectors. Data sent", "// from emit plugins should not require tagging, and should be map ready.", "this", "...
Vidi plugins are simple seneca plugins.
[ "Vidi", "plugins", "are", "simple", "seneca", "plugins", "." ]
10737d1a2b12ca81affc5ea58e701040e1f59e77
https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L19-L91
train
vidi-insights/vidi-metrics
srv/demo.js
tag
function tag (msg, done) { var clean_data = { source: 'demo-plugin', payload: msg.payload } done(null, clean_data) }
javascript
function tag (msg, done) { var clean_data = { source: 'demo-plugin', payload: msg.payload } done(null, clean_data) }
[ "function", "tag", "(", "msg", ",", "done", ")", "{", "var", "clean_data", "=", "{", "source", ":", "'demo-plugin'", ",", "payload", ":", "msg", ".", "payload", "}", "done", "(", "null", ",", "clean_data", ")", "}" ]
Tagging just means returning a source and payload, it allows plugins that understand the data to tag it for themselves. This means inbound data does not need to be modified at source
[ "Tagging", "just", "means", "returning", "a", "source", "and", "payload", "it", "allows", "plugins", "that", "understand", "the", "data", "to", "tag", "it", "for", "themselves", ".", "This", "means", "inbound", "data", "does", "not", "need", "to", "be", "m...
10737d1a2b12ca81affc5ea58e701040e1f59e77
https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L44-L51
train
vidi-insights/vidi-metrics
srv/demo.js
map
function map (msg, done) { var metric = { source: msg.source, name: 'my-metric', values: {val: msg.payload.val}, tags: {tag: msg.payload.tag} } done(null, [metric]) }
javascript
function map (msg, done) { var metric = { source: msg.source, name: 'my-metric', values: {val: msg.payload.val}, tags: {tag: msg.payload.tag} } done(null, [metric]) }
[ "function", "map", "(", "msg", ",", "done", ")", "{", "var", "metric", "=", "{", "source", ":", "msg", ".", "source", ",", "name", ":", "'my-metric'", ",", "values", ":", "{", "val", ":", "msg", ".", "payload", ".", "val", "}", ",", "tags", ":", ...
Map plugins return arrays of metrics. The only required fields are source and name. All other fields depend on the sink you want to use. Note that the fields below represent our 'plugin' standard.
[ "Map", "plugins", "return", "arrays", "of", "metrics", ".", "The", "only", "required", "fields", "are", "source", "and", "name", ".", "All", "other", "fields", "depend", "on", "the", "sink", "you", "want", "to", "use", ".", "Note", "that", "the", "fields...
10737d1a2b12ca81affc5ea58e701040e1f59e77
https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L56-L65
train
vidi-insights/vidi-metrics
srv/demo.js
sink
function sink (msg, done) { var metric = msg.metric var as_text = JSON.stringify(metric, null, 1) console.log(as_text) done() }
javascript
function sink (msg, done) { var metric = msg.metric var as_text = JSON.stringify(metric, null, 1) console.log(as_text) done() }
[ "function", "sink", "(", "msg", ",", "done", ")", "{", "var", "metric", "=", "msg", ".", "metric", "var", "as_text", "=", "JSON", ".", "stringify", "(", "metric", ",", "null", ",", "1", ")", "console", ".", "log", "(", "as_text", ")", "done", "(", ...
A sink simply does something with each metric it gets. In our case we are logging to the console but you can do anything you like with it.
[ "A", "sink", "simply", "does", "something", "with", "each", "metric", "it", "gets", ".", "In", "our", "case", "we", "are", "logging", "to", "the", "console", "but", "you", "can", "do", "anything", "you", "like", "with", "it", "." ]
10737d1a2b12ca81affc5ea58e701040e1f59e77
https://github.com/vidi-insights/vidi-metrics/blob/10737d1a2b12ca81affc5ea58e701040e1f59e77/srv/demo.js#L80-L87
train
ottojs/otto-errors
lib/locked.error.js
ErrorLocked
function ErrorLocked (message) { Error.call(this); // Add Information this.name = 'ErrorLocked'; this.type = 'client'; this.status = 423; if (message) { this.message = message; } }
javascript
function ErrorLocked (message) { Error.call(this); // Add Information this.name = 'ErrorLocked'; this.type = 'client'; this.status = 423; if (message) { this.message = message; } }
[ "function", "ErrorLocked", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "// Add Information", "this", ".", "name", "=", "'ErrorLocked'", ";", "this", ".", "type", "=", "'client'", ";", "this", ".", "status", "=", "423", ";", "...
Error - ErrorLocked
[ "Error", "-", "ErrorLocked" ]
a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9
https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/locked.error.js#L8-L20
train
jonschlinkert/engines
index.js
cache
function cache(options, compiled) { // cachable if (compiled && options.filename && options.cache) { delete templates[options.filename]; cacheStore[options.filename] = compiled; return compiled; } // check cache if (options.filename && options.cache) { return cacheStore[options.filename]; } ...
javascript
function cache(options, compiled) { // cachable if (compiled && options.filename && options.cache) { delete templates[options.filename]; cacheStore[options.filename] = compiled; return compiled; } // check cache if (options.filename && options.cache) { return cacheStore[options.filename]; } ...
[ "function", "cache", "(", "options", ",", "compiled", ")", "{", "// cachable", "if", "(", "compiled", "&&", "options", ".", "filename", "&&", "options", ".", "cache", ")", "{", "delete", "templates", "[", "options", ".", "filename", "]", ";", "cacheStore",...
Conditionally cache `compiled` template based on the `options` filename and `.cache` boolean. @param {Object} options @param {Function} compiled @return {Function} @api private
[ "Conditionally", "cache", "compiled", "template", "based", "on", "the", "options", "filename", "and", ".", "cache", "boolean", "." ]
82c19e6013a3e6e77d8c8a8e976433bd322587fd
https://github.com/jonschlinkert/engines/blob/82c19e6013a3e6e77d8c8a8e976433bd322587fd/index.js#L68-L80
train
jonschlinkert/engines
index.js
store
function store(path, options) { var str = templates[path]; var cached = options.cache && str && typeof str === 'string'; // cached (only if cached is a string and not a compiled template function) if (cached) return str; // store str = options.str; // remove extraneous utf8 BOM marker str = str.repla...
javascript
function store(path, options) { var str = templates[path]; var cached = options.cache && str && typeof str === 'string'; // cached (only if cached is a string and not a compiled template function) if (cached) return str; // store str = options.str; // remove extraneous utf8 BOM marker str = str.repla...
[ "function", "store", "(", "path", ",", "options", ")", "{", "var", "str", "=", "templates", "[", "path", "]", ";", "var", "cached", "=", "options", ".", "cache", "&&", "str", "&&", "typeof", "str", "===", "'string'", ";", "// cached (only if cached is a st...
Read `path` with `options` When `options.cache` is true the template string will be cached. @param {String} path @param {String} options @api private
[ "Read", "path", "with", "options", "When", "options", ".", "cache", "is", "true", "the", "template", "string", "will", "be", "cached", "." ]
82c19e6013a3e6e77d8c8a8e976433bd322587fd
https://github.com/jonschlinkert/engines/blob/82c19e6013a3e6e77d8c8a8e976433bd322587fd/index.js#L93-L109
train
gethuman/pancakes-angular
lib/ngapp/storage.js
set
function set(name, value) { // if no value then remove if (!value) { remove(name); return; } if (localStorage) { try { localStorage.setItem(name, value); } catch (ex) {} } _.isFunction($cookies...
javascript
function set(name, value) { // if no value then remove if (!value) { remove(name); return; } if (localStorage) { try { localStorage.setItem(name, value); } catch (ex) {} } _.isFunction($cookies...
[ "function", "set", "(", "name", ",", "value", ")", "{", "// if no value then remove", "if", "(", "!", "value", ")", "{", "remove", "(", "name", ")", ";", "return", ";", "}", "if", "(", "localStorage", ")", "{", "try", "{", "localStorage", ".", "setItem...
Set a value in both localStorage and cookies @param name @param value
[ "Set", "a", "value", "in", "both", "localStorage", "and", "cookies" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/storage.js#L36-L55
train
gethuman/pancakes-angular
lib/ngapp/storage.js
get
function get(name) { var value = (_.isFunction($cookies.get) ? $cookies.get(name) : $cookies[name]); if (!value && localStorage) { try { value = localStorage.getItem(name); } catch (ex) {} if (value) { set(name, value); ...
javascript
function get(name) { var value = (_.isFunction($cookies.get) ? $cookies.get(name) : $cookies[name]); if (!value && localStorage) { try { value = localStorage.getItem(name); } catch (ex) {} if (value) { set(name, value); ...
[ "function", "get", "(", "name", ")", "{", "var", "value", "=", "(", "_", ".", "isFunction", "(", "$cookies", ".", "get", ")", "?", "$cookies", ".", "get", "(", "name", ")", ":", "$cookies", "[", "name", "]", ")", ";", "if", "(", "!", "value", "...
First check cookie; if not present, however, check local storage @param name
[ "First", "check", "cookie", ";", "if", "not", "present", "however", "check", "local", "storage" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/storage.js#L61-L77
train
origin1tech/chek
dist/modules/string.js
camelcase
function camelcase(val) { if (!is_1.isValue(val)) return null; var result = val.replace(/[^A-Za-z0-9]/g, ' ').replace(/^\w|[A-Z]|\b\w|\s+/g, function (m, i) { if (+m === 0 || /(\.|-|_)/.test(m)) return ''; return i === 0 ? m.toLowerCase() : m.toUpperCase(); }); return...
javascript
function camelcase(val) { if (!is_1.isValue(val)) return null; var result = val.replace(/[^A-Za-z0-9]/g, ' ').replace(/^\w|[A-Z]|\b\w|\s+/g, function (m, i) { if (+m === 0 || /(\.|-|_)/.test(m)) return ''; return i === 0 ? m.toLowerCase() : m.toUpperCase(); }); return...
[ "function", "camelcase", "(", "val", ")", "{", "if", "(", "!", "is_1", ".", "isValue", "(", "val", ")", ")", "return", "null", ";", "var", "result", "=", "val", ".", "replace", "(", "/", "[^A-Za-z0-9]", "/", "g", ",", "' '", ")", ".", "replace", ...
Camelcase Converts string to camelcase. @param val the value to be transformed.
[ "Camelcase", "Converts", "string", "to", "camelcase", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L11-L20
train
origin1tech/chek
dist/modules/string.js
capitalize
function capitalize(val) { if (!is_1.isValue(val)) return null; val = val.toLowerCase(); return "" + val.charAt(0).toUpperCase() + val.slice(1); }
javascript
function capitalize(val) { if (!is_1.isValue(val)) return null; val = val.toLowerCase(); return "" + val.charAt(0).toUpperCase() + val.slice(1); }
[ "function", "capitalize", "(", "val", ")", "{", "if", "(", "!", "is_1", ".", "isValue", "(", "val", ")", ")", "return", "null", ";", "val", "=", "val", ".", "toLowerCase", "(", ")", ";", "return", "\"\"", "+", "val", ".", "charAt", "(", "0", ")",...
Capitalize Converts string to capitalize. @param val the value to be transformed.
[ "Capitalize", "Converts", "string", "to", "capitalize", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L44-L49
train
origin1tech/chek
dist/modules/string.js
padLeft
function padLeft(val, len, offset, char) { /* istanbul ignore if */ if (!is_1.isValue(val) || !is_1.isString(val)) return null; // If offset is a string // count its length. if (is_1.isString(offset)) offset = offset.length; char = char || ' '; var pad = ''; while (len--)...
javascript
function padLeft(val, len, offset, char) { /* istanbul ignore if */ if (!is_1.isValue(val) || !is_1.isString(val)) return null; // If offset is a string // count its length. if (is_1.isString(offset)) offset = offset.length; char = char || ' '; var pad = ''; while (len--)...
[ "function", "padLeft", "(", "val", ",", "len", ",", "offset", ",", "char", ")", "{", "/* istanbul ignore if */", "if", "(", "!", "is_1", ".", "isValue", "(", "val", ")", "||", "!", "is_1", ".", "isString", "(", "val", ")", ")", "return", "null", ";",...
Pad Left Pads a string on the left. @param val the string to be padded. @param len the length to pad. @param offset an offset number or string to be counted. @param char the character to pad with.
[ "Pad", "Left", "Pads", "a", "string", "on", "the", "left", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L72-L88
train
origin1tech/chek
dist/modules/string.js
padRight
function padRight(val, len, offset, char) { /* istanbul ignore if */ if (!is_1.isValue(val) || !is_1.isString(val)) return null; // If offset is a string // count its length. if (is_1.isString(offset)) offset = offset.length; char = char || ' '; while (len--) { val +=...
javascript
function padRight(val, len, offset, char) { /* istanbul ignore if */ if (!is_1.isValue(val) || !is_1.isString(val)) return null; // If offset is a string // count its length. if (is_1.isString(offset)) offset = offset.length; char = char || ' '; while (len--) { val +=...
[ "function", "padRight", "(", "val", ",", "len", ",", "offset", ",", "char", ")", "{", "/* istanbul ignore if */", "if", "(", "!", "is_1", ".", "isValue", "(", "val", ")", "||", "!", "is_1", ".", "isString", "(", "val", ")", ")", "return", "null", ";"...
Pad Right Pads a string to the right. @param val the string to be padded. @param len the length to pad. @param offset an offset value to add. @param char the character to pad with.
[ "Pad", "Right", "Pads", "a", "string", "to", "the", "right", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L99-L114
train
origin1tech/chek
dist/modules/string.js
titlecase
function titlecase(val, conjunctions) { if (!is_1.isValue(val)) return null; // conjunctions var conj = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; return val.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (m, i, t) { if (i > 0 && i + m.length !==...
javascript
function titlecase(val, conjunctions) { if (!is_1.isValue(val)) return null; // conjunctions var conj = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; return val.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (m, i, t) { if (i > 0 && i + m.length !==...
[ "function", "titlecase", "(", "val", ",", "conjunctions", ")", "{", "if", "(", "!", "is_1", ".", "isValue", "(", "val", ")", ")", "return", "null", ";", "// conjunctions", "var", "conj", "=", "/", "^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\\...
Titlecase Converts string to titlecase. This fine script refactored from: @see https://github.com/gouch/to-title-case @param val the value to be transformed. @param conjunctions when true words like and, a, but, for are also titlecased.
[ "Titlecase", "Converts", "string", "to", "titlecase", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L224-L243
train
origin1tech/chek
dist/modules/string.js
uuid
function uuid() { var d = Date.now(); // Use high perf timer if avail. /* istanbul ignore next */ if (typeof performance !== 'undefined' && is_1.isFunction(performance.now)) d += performance.now(); return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = ...
javascript
function uuid() { var d = Date.now(); // Use high perf timer if avail. /* istanbul ignore next */ if (typeof performance !== 'undefined' && is_1.isFunction(performance.now)) d += performance.now(); return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = ...
[ "function", "uuid", "(", ")", "{", "var", "d", "=", "Date", ".", "now", "(", ")", ";", "// Use high perf timer if avail.", "/* istanbul ignore next */", "if", "(", "typeof", "performance", "!==", "'undefined'", "&&", "is_1", ".", "isFunction", "(", "performance"...
UUID Generates a UUID.
[ "UUID", "Generates", "a", "UUID", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/string.js#L261-L272
train
WebArtWork/derer
lib/swig.js
validateOptions
function validateOptions(options) { if (!options) { return; } utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) { if (!options.hasOwnProperty(key)) { return; } if (!utils.isArray(options[key]) || options[key].length !== 2) { throw new Error('Option "' + key + '"...
javascript
function validateOptions(options) { if (!options) { return; } utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) { if (!options.hasOwnProperty(key)) { return; } if (!utils.isArray(options[key]) || options[key].length !== 2) { throw new Error('Option "' + key + '"...
[ "function", "validateOptions", "(", "options", ")", "{", "if", "(", "!", "options", ")", "{", "return", ";", "}", "utils", ".", "each", "(", "[", "'varControls'", ",", "'tagControls'", ",", "'cmtControls'", "]", ",", "function", "(", "key", ")", "{", "...
Validate the Swig options object. @param {?SwigOpts} options Swig options object. @return {undefined} This method will throw errors if anything is wrong. @private
[ "Validate", "the", "Swig", "options", "object", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L88-L125
train
WebArtWork/derer
lib/swig.js
getLocals
function getLocals(options) { if (!options || !options.locals) { return self.options.locals; } return utils.extend({}, self.options.locals, options.locals); }
javascript
function getLocals(options) { if (!options || !options.locals) { return self.options.locals; } return utils.extend({}, self.options.locals, options.locals); }
[ "function", "getLocals", "(", "options", ")", "{", "if", "(", "!", "options", "||", "!", "options", ".", "locals", ")", "{", "return", "self", ".", "options", ".", "locals", ";", "}", "return", "utils", ".", "extend", "(", "{", "}", ",", "self", "....
Get combined locals context. @param {?SwigOpts} [options] Swig options object. @return {object} Locals context. @private
[ "Get", "combined", "locals", "context", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L186-L192
train
WebArtWork/derer
lib/swig.js
cacheGet
function cacheGet(key, options) { if (shouldCache(options)) { return; } if (self.options.cache === 'memory') { return self.cache[key]; } return self.options.cache.get(key); }
javascript
function cacheGet(key, options) { if (shouldCache(options)) { return; } if (self.options.cache === 'memory') { return self.cache[key]; } return self.options.cache.get(key); }
[ "function", "cacheGet", "(", "key", ",", "options", ")", "{", "if", "(", "shouldCache", "(", "options", ")", ")", "{", "return", ";", "}", "if", "(", "self", ".", "options", ".", "cache", "===", "'memory'", ")", "{", "return", "self", ".", "cache", ...
Get compiled template from the cache. @param {string} key Name of template. @return {object|undefined} Template function and tokens. @private
[ "Get", "compiled", "template", "from", "the", "cache", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L211-L221
train
WebArtWork/derer
lib/swig.js
cacheSet
function cacheSet(key, options, val) { if (shouldCache(options)) { return; } if (self.options.cache === 'memory') { self.cache[key] = val; return; } self.options.cache.set(key, val); }
javascript
function cacheSet(key, options, val) { if (shouldCache(options)) { return; } if (self.options.cache === 'memory') { self.cache[key] = val; return; } self.options.cache.set(key, val); }
[ "function", "cacheSet", "(", "key", ",", "options", ",", "val", ")", "{", "if", "(", "shouldCache", "(", "options", ")", ")", "{", "return", ";", "}", "if", "(", "self", ".", "options", ".", "cache", "===", "'memory'", ")", "{", "self", ".", "cache...
Store a template in the cache. @param {string} key Name of template. @param {object} val Template function and tokens. @return {undefined} @private
[ "Store", "a", "template", "in", "the", "cache", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L230-L241
train
WebArtWork/derer
lib/swig.js
remapBlocks
function remapBlocks(blocks, tokens) { return utils.map(tokens, function (token) { var args = token.args ? token.args.join('') : ''; if (token.name === 'block' && blocks[args]) { token = blocks[args]; } if (token.content && token.content.length) { token.content = remapBlocks(...
javascript
function remapBlocks(blocks, tokens) { return utils.map(tokens, function (token) { var args = token.args ? token.args.join('') : ''; if (token.name === 'block' && blocks[args]) { token = blocks[args]; } if (token.content && token.content.length) { token.content = remapBlocks(...
[ "function", "remapBlocks", "(", "blocks", ",", "tokens", ")", "{", "return", "utils", ".", "map", "(", "tokens", ",", "function", "(", "token", ")", "{", "var", "args", "=", "token", ".", "args", "?", "token", ".", "args", ".", "join", "(", "''", "...
Re-Map blocks within a list of tokens to the template's block objects. @param {array} tokens List of tokens for the parent object. @param {object} template Current template that needs to be mapped to the parent's block and token list. @return {array} @private
[ "Re", "-", "Map", "blocks", "within", "a", "list", "of", "tokens", "to", "the", "template", "s", "block", "objects", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L390-L401
train
WebArtWork/derer
lib/swig.js
importNonBlocks
function importNonBlocks(blocks, tokens) { var temp = []; utils.each(blocks, function (block) { temp.push(block); }); utils.each(temp.reverse(), function (block) { if (block.name !== 'block') { tokens.unshift(block); } }); }
javascript
function importNonBlocks(blocks, tokens) { var temp = []; utils.each(blocks, function (block) { temp.push(block); }); utils.each(temp.reverse(), function (block) { if (block.name !== 'block') { tokens.unshift(block); } }); }
[ "function", "importNonBlocks", "(", "blocks", ",", "tokens", ")", "{", "var", "temp", "=", "[", "]", ";", "utils", ".", "each", "(", "blocks", ",", "function", "(", "block", ")", "{", "temp", ".", "push", "(", "block", ")", ";", "}", ")", ";", "u...
Import block-level tags to the token list that are not actual block tags. @param {array} blocks List of block-level tags. @param {array} tokens List of tokens to render. @return {undefined} @private
[ "Import", "block", "-", "level", "tags", "to", "the", "token", "list", "that", "are", "not", "actual", "block", "tags", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L410-L418
train
WebArtWork/derer
lib/swig.js
getParents
function getParents(tokens, options) { var parentName = tokens.parent, parentFiles = [], parents = [], parentFile, parent, l; while (parentName) { if (!options || !options.filename) { throw new Error('Cannot extend "' + parentName + '" because current template has no...
javascript
function getParents(tokens, options) { var parentName = tokens.parent, parentFiles = [], parents = [], parentFile, parent, l; while (parentName) { if (!options || !options.filename) { throw new Error('Cannot extend "' + parentName + '" because current template has no...
[ "function", "getParents", "(", "tokens", ",", "options", ")", "{", "var", "parentName", "=", "tokens", ".", "parent", ",", "parentFiles", "=", "[", "]", ",", "parents", "=", "[", "]", ",", "parentFile", ",", "parent", ",", "l", ";", "while", "(", "pa...
Recursively compile and get parents of given parsed token object. @param {object} tokens Parsed tokens from template. @param {SwigOpts} [options={}] Swig options object. @return {object} Parsed tokens from parent templates. @private
[ "Recursively", "compile", "and", "get", "parents", "of", "given", "parsed", "token", "object", "." ]
edf9f82c8042b543e6f291f605430fac84702b2d
https://github.com/WebArtWork/derer/blob/edf9f82c8042b543e6f291f605430fac84702b2d/lib/swig.js#L428-L462
train
base-apps/base-apps-router
dist/FrontRouter.js
FrontRouter
function FrontRouter() { var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; _classCallCheck(this, FrontRouter); this.options = { pageRoot: opts.pageRoot || process.cwd(), overwrite: opts.overwrite || false }; this.routes = []; // Figure out what li...
javascript
function FrontRouter() { var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; _classCallCheck(this, FrontRouter); this.options = { pageRoot: opts.pageRoot || process.cwd(), overwrite: opts.overwrite || false }; this.routes = []; // Figure out what li...
[ "function", "FrontRouter", "(", ")", "{", "var", "opts", "=", "arguments", ".", "length", "<=", "0", "||", "arguments", "[", "0", "]", "===", "undefined", "?", "{", "}", ":", "arguments", "[", "0", "]", ";", "_classCallCheck", "(", "this", ",", "Fron...
Creates a new instance of `FrontRouter`. @prop {FrontRouterOptions} opts - Class options.
[ "Creates", "a", "new", "instance", "of", "FrontRouter", "." ]
bf5e99987003635fbac0144c0be35d5a863065d9
https://github.com/base-apps/base-apps-router/blob/bf5e99987003635fbac0144c0be35d5a863065d9/dist/FrontRouter.js#L28-L70
train
toajs/toa-morgan
index.js
compileToken
function compileToken (token, arg) { let fn = tokens[token] || noOp return function () { return arg ? fn.call(this, arg) : fn.call(this) } }
javascript
function compileToken (token, arg) { let fn = tokens[token] || noOp return function () { return arg ? fn.call(this, arg) : fn.call(this) } }
[ "function", "compileToken", "(", "token", ",", "arg", ")", "{", "let", "fn", "=", "tokens", "[", "token", "]", "||", "noOp", "return", "function", "(", ")", "{", "return", "arg", "?", "fn", ".", "call", "(", "this", ",", "arg", ")", ":", "fn", "....
Compile a token string into a function. @param {string} token @param {string} arg @return {function} @private
[ "Compile", "a", "token", "string", "into", "a", "function", "." ]
8308b474dff45a513c85ad90b0ddc5379bb5fb11
https://github.com/toajs/toa-morgan/blob/8308b474dff45a513c85ad90b0ddc5379bb5fb11/index.js#L269-L275
train
redisjs/jsr-server
lib/command/pubsub/punsubscribe.js
execute
function execute(req, res) { this.state.pubsub.punsubscribe(req.conn, req.args); }
javascript
function execute(req, res) { this.state.pubsub.punsubscribe(req.conn, req.args); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "this", ".", "state", ".", "pubsub", ".", "punsubscribe", "(", "req", ".", "conn", ",", "req", ".", "args", ")", ";", "}" ]
Respond to the PUNSUBSCRIBE command.
[ "Respond", "to", "the", "PUNSUBSCRIBE", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/pubsub/punsubscribe.js#L17-L19
train
emmetio/variable-resolver
index.js
createModel
function createModel(string) { const reVariable = /\$\{([a-z][\w\-]*)\}/ig; const escapeCharCode = 92; // `\` symbol const variables = []; // We have to replace unescaped (e.g. not preceded with `\`) tokens. // Instead of writing a stream parser, we’ll cut some edges here: // 1. Find all tokens...
javascript
function createModel(string) { const reVariable = /\$\{([a-z][\w\-]*)\}/ig; const escapeCharCode = 92; // `\` symbol const variables = []; // We have to replace unescaped (e.g. not preceded with `\`) tokens. // Instead of writing a stream parser, we’ll cut some edges here: // 1. Find all tokens...
[ "function", "createModel", "(", "string", ")", "{", "const", "reVariable", "=", "/", "\\$\\{([a-z][\\w\\-]*)\\}", "/", "ig", ";", "const", "escapeCharCode", "=", "92", ";", "// `\\` symbol", "const", "variables", "=", "[", "]", ";", "// We have to replace unescape...
Creates variable model from given string. The model contains a `string` with all escaped variable tokens written without escape symbol and `variables` property with all unescaped variables and their ranges @param {String} string @return {Object}
[ "Creates", "variable", "model", "from", "given", "string", ".", "The", "model", "contains", "a", "string", "with", "all", "escaped", "variable", "tokens", "written", "without", "escape", "symbol", "and", "variables", "property", "with", "all", "unescaped", "vari...
c6cf8ef476e731447418e718c8bd3f15fa518deb
https://github.com/emmetio/variable-resolver/blob/c6cf8ef476e731447418e718c8bd3f15fa518deb/index.js#L68-L115
train