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
francium/highlight-page
dist/highlight-page.js
unwrap
function unwrap() { var nodes = Array.prototype.slice.call(el.childNodes), wrapper = void 0; nodes.forEach(function (node) { wrapper = node.parentNode; dom(node).insertBefore(node.parentNode); dom(wrapper).r...
javascript
function unwrap() { var nodes = Array.prototype.slice.call(el.childNodes), wrapper = void 0; nodes.forEach(function (node) { wrapper = node.parentNode; dom(node).insertBefore(node.parentNode); dom(wrapper).r...
[ "function", "unwrap", "(", ")", "{", "var", "nodes", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "el", ".", "childNodes", ")", ",", "wrapper", "=", "void", "0", ";", "nodes", ".", "forEach", "(", "function", "(", "node", ")", "{...
Unwraps base element. @returns {Node[]} - child nodes of unwrapped element.
[ "Unwraps", "base", "element", "." ]
4e67fc531321f9987397dc247abba59b9d5ee521
https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/dist/highlight-page.js#L277-L288
train
francium/highlight-page
dist/highlight-page.js
parents
function parents() { var parent = void 0, path = []; while (!!(parent = el.parentNode)) { path.push(parent); el = parent; } return path; }
javascript
function parents() { var parent = void 0, path = []; while (!!(parent = el.parentNode)) { path.push(parent); el = parent; } return path; }
[ "function", "parents", "(", ")", "{", "var", "parent", "=", "void", "0", ",", "path", "=", "[", "]", ";", "while", "(", "!", "!", "(", "parent", "=", "el", ".", "parentNode", ")", ")", "{", "path", ".", "push", "(", "parent", ")", ";", "el", ...
Returns array of base element parents. @returns {HTMLElement[]}
[ "Returns", "array", "of", "base", "element", "parents", "." ]
4e67fc531321f9987397dc247abba59b9d5ee521
https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/dist/highlight-page.js#L294-L304
train
francium/highlight-page
dist/highlight-page.js
fromHTML
function fromHTML(html) { var div = document.createElement('div'); div.innerHTML = html; return div.childNodes; }
javascript
function fromHTML(html) { var div = document.createElement('div'); div.innerHTML = html; return div.childNodes; }
[ "function", "fromHTML", "(", "html", ")", "{", "var", "div", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "div", ".", "innerHTML", "=", "html", ";", "return", "div", ".", "childNodes", ";", "}" ]
Creates dom element from given html string. @param {string} html @returns {NodeList}
[ "Creates", "dom", "element", "from", "given", "html", "string", "." ]
4e67fc531321f9987397dc247abba59b9d5ee521
https://github.com/francium/highlight-page/blob/4e67fc531321f9987397dc247abba59b9d5ee521/dist/highlight-page.js#L340-L344
train
gethuman/pancakes-recipe
batch/batch.manager.js
processCommandLine
function processCommandLine() { if (commander.list) { listApps(); process.exit(0); } if (!commander.app) { commander.help(); } commander.endDate = commander.runDate ? moment(commander.runDate, 'MM/DD/YYYY').toDate() : new Date(); comm...
javascript
function processCommandLine() { if (commander.list) { listApps(); process.exit(0); } if (!commander.app) { commander.help(); } commander.endDate = commander.runDate ? moment(commander.runDate, 'MM/DD/YYYY').toDate() : new Date(); comm...
[ "function", "processCommandLine", "(", ")", "{", "if", "(", "commander", ".", "list", ")", "{", "listApps", "(", ")", ";", "process", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "!", "commander", ".", "app", ")", "{", "commander", ".", "help",...
Process the command line using commander
[ "Process", "the", "command", "line", "using", "commander" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/batch.manager.js#L34-L47
train
gethuman/pancakes-recipe
batch/batch.manager.js
run
function run() { var startTime = (new Date()).getTime(); // parse the command line using the commander object processCommandLine(); // leverage the middleware to initialize all our services, adapters, etc. (i.e. connect to mongo, etc.) mwServiceInit.init({ container: 'batch' })...
javascript
function run() { var startTime = (new Date()).getTime(); // parse the command line using the commander object processCommandLine(); // leverage the middleware to initialize all our services, adapters, etc. (i.e. connect to mongo, etc.) mwServiceInit.init({ container: 'batch' })...
[ "function", "run", "(", ")", "{", "var", "startTime", "=", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", ";", "// parse the command line using the commander object", "processCommandLine", "(", ")", ";", "// leverage the middleware to initialize all our ...
Run a particular batch program
[ "Run", "a", "particular", "batch", "program" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/batch.manager.js#L52-L74
train
yadirhb/vitruvio
source/res/functions.js
supersede
function supersede(target, source, force, deepStringMixin) { if (source) { eachProp(source, function (value, prop) { if (hasProp(target, prop)) { if (deepStringMixin && typeof value === 'object' && value && !isArray(value) && !isFunction(value) && !(value instanceof RegExp)) { ...
javascript
function supersede(target, source, force, deepStringMixin) { if (source) { eachProp(source, function (value, prop) { if (hasProp(target, prop)) { if (deepStringMixin && typeof value === 'object' && value && !isArray(value) && !isFunction(value) && !(value instanceof RegExp)) { ...
[ "function", "supersede", "(", "target", ",", "source", ",", "force", ",", "deepStringMixin", ")", "{", "if", "(", "source", ")", "{", "eachProp", "(", "source", ",", "function", "(", "value", ",", "prop", ")", "{", "if", "(", "hasProp", "(", "target", ...
Simple function to make a supersede the properties between two objects. The properties into the same.
[ "Simple", "function", "to", "make", "a", "supersede", "the", "properties", "between", "two", "objects", ".", "The", "properties", "into", "the", "same", "." ]
2cb640e31bedfb554e6766e1e5c61fbb14226b3b
https://github.com/yadirhb/vitruvio/blob/2cb640e31bedfb554e6766e1e5c61fbb14226b3b/source/res/functions.js#L364-L381
train
yadirhb/vitruvio
source/res/functions.js
create
function create(type, def, base) { // empty constructor type.prototype = base ? typeof base === 'function' ? new base() : base : new Class(); // set base object as prototype return apply(new type(), def); // return empty object with right [[Prototype]] }
javascript
function create(type, def, base) { // empty constructor type.prototype = base ? typeof base === 'function' ? new base() : base : new Class(); // set base object as prototype return apply(new type(), def); // return empty object with right [[Prototype]] }
[ "function", "create", "(", "type", ",", "def", ",", "base", ")", "{", "// empty constructor", "type", ".", "prototype", "=", "base", "?", "typeof", "base", "===", "'function'", "?", "new", "base", "(", ")", ":", "base", ":", "new", "Class", "(", ")", ...
Instantiate a specific function, applies values definition properties and assign a proto object. @param type {Function}
[ "Instantiate", "a", "specific", "function", "applies", "values", "definition", "properties", "and", "assign", "a", "proto", "object", "." ]
2cb640e31bedfb554e6766e1e5c61fbb14226b3b
https://github.com/yadirhb/vitruvio/blob/2cb640e31bedfb554e6766e1e5c61fbb14226b3b/source/res/functions.js#L670-L674
train
yadirhb/vitruvio
source/res/functions.js
define
function define(type, baseClass, members, statics) { // empty constructor type.prototype = baseClass ? typeof baseClass === "function" ? new baseClass() : baseClass : new Class(); // set base object as prototype type.prototype.constructor = type; type.prototype = apply(type.prototype, members || {}); ...
javascript
function define(type, baseClass, members, statics) { // empty constructor type.prototype = baseClass ? typeof baseClass === "function" ? new baseClass() : baseClass : new Class(); // set base object as prototype type.prototype.constructor = type; type.prototype = apply(type.prototype, members || {}); ...
[ "function", "define", "(", "type", ",", "baseClass", ",", "members", ",", "statics", ")", "{", "// empty constructor", "type", ".", "prototype", "=", "baseClass", "?", "typeof", "baseClass", "===", "\"function\"", "?", "new", "baseClass", "(", ")", ":", "bas...
Defines a new member and registers it into the wrapper object. @param memberName {String} The name of the member to be defined. It must be a valid namespace identifier. @param definition {Object} Contains the public class members. @param wrapper {Object} Defines the wrapper of the new Object, if not provided window wi...
[ "Defines", "a", "new", "member", "and", "registers", "it", "into", "the", "wrapper", "object", "." ]
2cb640e31bedfb554e6766e1e5c61fbb14226b3b
https://github.com/yadirhb/vitruvio/blob/2cb640e31bedfb554e6766e1e5c61fbb14226b3b/source/res/functions.js#L688-L694
train
mbullington/goal
lib/helpers.js
inherits
function inherits(constructor, superConstructor) { constructor.prototype = Object.create(superConstructor.prototype, { constructor: { value: constructor } }); return constructor; }
javascript
function inherits(constructor, superConstructor) { constructor.prototype = Object.create(superConstructor.prototype, { constructor: { value: constructor } }); return constructor; }
[ "function", "inherits", "(", "constructor", ",", "superConstructor", ")", "{", "constructor", ".", "prototype", "=", "Object", ".", "create", "(", "superConstructor", ".", "prototype", ",", "{", "constructor", ":", "{", "value", ":", "constructor", "}", "}", ...
implementation of node's util.inherits, works in the browser as well
[ "implementation", "of", "node", "s", "util", ".", "inherits", "works", "in", "the", "browser", "as", "well" ]
20cf8db4a2165c04ed88242c9fd411ce016b988f
https://github.com/mbullington/goal/blob/20cf8db4a2165c04ed88242c9fd411ce016b988f/lib/helpers.js#L18-L25
train
mbullington/goal
lib/helpers.js
typeOf
function typeOf(value) { var returned = Object.prototype.toString.call(value); return returned.substring(1, returned.length - 1).split(' ')[1].toLowerCase(); }
javascript
function typeOf(value) { var returned = Object.prototype.toString.call(value); return returned.substring(1, returned.length - 1).split(' ')[1].toLowerCase(); }
[ "function", "typeOf", "(", "value", ")", "{", "var", "returned", "=", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "value", ")", ";", "return", "returned", ".", "substring", "(", "1", ",", "returned", ".", "length", "-", "1", ")", "...
ES6 iterator ready solution.
[ "ES6", "iterator", "ready", "solution", "." ]
20cf8db4a2165c04ed88242c9fd411ce016b988f
https://github.com/mbullington/goal/blob/20cf8db4a2165c04ed88242c9fd411ce016b988f/lib/helpers.js#L46-L49
train
redisjs/jsr-server
lib/transaction.js
add
function add(err, req, res) { if(err) { // TODO: send args length errors // transaction errors are not queued // but the transaction is left open for more // command to be queued if(err instanceof TransactionError) { return res.send(err); } // last error this.error = err; } ...
javascript
function add(err, req, res) { if(err) { // TODO: send args length errors // transaction errors are not queued // but the transaction is left open for more // command to be queued if(err instanceof TransactionError) { return res.send(err); } // last error this.error = err; } ...
[ "function", "add", "(", "err", ",", "req", ",", "res", ")", "{", "if", "(", "err", ")", "{", "// TODO: send args length errors", "// transaction errors are not queued", "// but the transaction is left open for more", "// command to be queued", "if", "(", "err", "instanceo...
Queue a command. The command and arguments list should already have been validated to determine if an error would occur (EXECABORT). @param err A validation error. @param req The command request. @param res The command response.
[ "Queue", "a", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/transaction.js#L36-L52
train
redisjs/jsr-server
lib/transaction.js
exec
function exec(scope, req, res) { var replies = [], item; // NOTE: incrby invalid amount will trigger EXECABORT // NOTE: wrong number of args are returned to the client // NOTE: but other types of validation errors (argument type coercion) // NOTE: trigger EXECABORT if(this.error) return this.destroy(req, ...
javascript
function exec(scope, req, res) { var replies = [], item; // NOTE: incrby invalid amount will trigger EXECABORT // NOTE: wrong number of args are returned to the client // NOTE: but other types of validation errors (argument type coercion) // NOTE: trigger EXECABORT if(this.error) return this.destroy(req, ...
[ "function", "exec", "(", "scope", ",", "req", ",", "res", ")", "{", "var", "replies", "=", "[", "]", ",", "item", ";", "// NOTE: incrby invalid amount will trigger EXECABORT", "// NOTE: wrong number of args are returned to the client", "// NOTE: but other types of validation ...
Execute this transaction. @param scope The server scope. @param req The request created for the exec command. @param res The response created for the exec command.
[ "Execute", "this", "transaction", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/transaction.js#L61-L93
train
redisjs/jsr-server
lib/transaction.js
destroy
function destroy(req, res, err, reply) { req.conn.transaction = null; req.conn.unwatch(req.db); this.queue = null; this.error = null; res.send(err, reply); }
javascript
function destroy(req, res, err, reply) { req.conn.transaction = null; req.conn.unwatch(req.db); this.queue = null; this.error = null; res.send(err, reply); }
[ "function", "destroy", "(", "req", ",", "res", ",", "err", ",", "reply", ")", "{", "req", ".", "conn", ".", "transaction", "=", "null", ";", "req", ".", "conn", ".", "unwatch", "(", "req", ".", "db", ")", ";", "this", ".", "queue", "=", "null", ...
Clear references, unwatch keys and send a response to the client.
[ "Clear", "references", "unwatch", "keys", "and", "send", "a", "response", "to", "the", "client", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/transaction.js#L99-L105
train
jeremyruppel/hoagie
lib/response.js
format
function format(fn) { return function(chunk) { if (arguments.length > 1) { chunk = util.format.apply(null, arguments); } if (chunk === undefined) { chunk = ''; } fn.call(this, chunk); }; }
javascript
function format(fn) { return function(chunk) { if (arguments.length > 1) { chunk = util.format.apply(null, arguments); } if (chunk === undefined) { chunk = ''; } fn.call(this, chunk); }; }
[ "function", "format", "(", "fn", ")", "{", "return", "function", "(", "chunk", ")", "{", "if", "(", "arguments", ".", "length", ">", "1", ")", "{", "chunk", "=", "util", ".", "format", ".", "apply", "(", "null", ",", "arguments", ")", ";", "}", "...
All hoagie output methods support util.format placeholder formatting.
[ "All", "hoagie", "output", "methods", "support", "util", ".", "format", "placeholder", "formatting", "." ]
9e05b4c9f0537d681dcb240eab41822f15bef613
https://github.com/jeremyruppel/hoagie/blob/9e05b4c9f0537d681dcb240eab41822f15bef613/lib/response.js#L70-L80
train
subfuzion/snapfinder-lib
lib/geo.js
getDistanceInKilometers
function getDistanceInKilometers(p1, p2) { // Credit: adapts code for Haversine formula and degrees-to-radian conversion found at: // http://www.movable-type.co.uk/scripts/latlong.html var R = 6371; // earth's radius in kilometers var dLat = degreesToRadians(p2.lat - p1.lat); var dLon = degreesToRadians(p2.l...
javascript
function getDistanceInKilometers(p1, p2) { // Credit: adapts code for Haversine formula and degrees-to-radian conversion found at: // http://www.movable-type.co.uk/scripts/latlong.html var R = 6371; // earth's radius in kilometers var dLat = degreesToRadians(p2.lat - p1.lat); var dLon = degreesToRadians(p2.l...
[ "function", "getDistanceInKilometers", "(", "p1", ",", "p2", ")", "{", "// Credit: adapts code for Haversine formula and degrees-to-radian conversion found at:", "// http://www.movable-type.co.uk/scripts/latlong.html", "var", "R", "=", "6371", ";", "// earth's radius in kilometers", ...
Calculate great circle distance and return result in kilometers @param p1 the origin with lat (latitude) and lng (longitude) properties @param p2 the destination with lat (latitude) and lng (longitude) properties
[ "Calculate", "great", "circle", "distance", "and", "return", "result", "in", "kilometers" ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/lib/geo.js#L36-L54
train
subfuzion/snapfinder-lib
lib/geo.js
parseGoogleGeocodes
function parseGoogleGeocodes(response) { // the result has a results property that is an array // there may be more than one result when the address is ambiguous // for pragmatic reasons, only use the first result // if the result does not have a zip code, then assume the user // did not provide a valid addre...
javascript
function parseGoogleGeocodes(response) { // the result has a results property that is an array // there may be more than one result when the address is ambiguous // for pragmatic reasons, only use the first result // if the result does not have a zip code, then assume the user // did not provide a valid addre...
[ "function", "parseGoogleGeocodes", "(", "response", ")", "{", "// the result has a results property that is an array", "// there may be more than one result when the address is ambiguous", "// for pragmatic reasons, only use the first result", "// if the result does not have a zip code, then assum...
Parse the JSON result that Google returned @param response an object with results parsed from the body of Google's API response @return an object with zip5, address (formatted address), and location (lat, lng) properties, or null if not a valid address
[ "Parse", "the", "JSON", "result", "that", "Google", "returned" ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/lib/geo.js#L130-L147
train
subfuzion/snapfinder-lib
lib/geo.js
findAddressComponent
function findAddressComponent(components, type) { for (var i = 0; i < components.length; i++) { if (components[i].types.indexOf(type) > -1) { return components[i]; } } return null; }
javascript
function findAddressComponent(components, type) { for (var i = 0; i < components.length; i++) { if (components[i].types.indexOf(type) > -1) { return components[i]; } } return null; }
[ "function", "findAddressComponent", "(", "components", ",", "type", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "components", ".", "length", ";", "i", "++", ")", "{", "if", "(", "components", "[", "i", "]", ".", "types", ".", "indexO...
Return the address component that matches the specified type @param components an array of address components @type specifies the component to return @return the component or null if no components matched
[ "Return", "the", "address", "component", "that", "matches", "the", "specified", "type" ]
121172f10a9ec64bc5f3d749fba97662b336caae
https://github.com/subfuzion/snapfinder-lib/blob/121172f10a9ec64bc5f3d749fba97662b336caae/lib/geo.js#L155-L163
train
vesln/to-date
index.js
ToDate
function ToDate(amount, unit, method) { this.amount = amount; this.method = method; this.unit = unit; }
javascript
function ToDate(amount, unit, method) { this.amount = amount; this.method = method; this.unit = unit; }
[ "function", "ToDate", "(", "amount", ",", "unit", ",", "method", ")", "{", "this", ".", "amount", "=", "amount", ";", "this", ".", "method", "=", "method", ";", "this", ".", "unit", "=", "unit", ";", "}" ]
To Date. @param {Number} amount @param {String} unit [optional] @param {String} method [optional] @constructor
[ "To", "Date", "." ]
16724aaac83bb57b1557ad9b9d2a0496a455b1b6
https://github.com/vesln/to-date/blob/16724aaac83bb57b1557ad9b9d2a0496a455b1b6/index.js#L37-L41
train
vesln/to-date
index.js
function() { var time = null; if (this.method === 'from now') { time = ago.fromNow(this.amount, this.unit); } else if (this.method === 'ago') { time = ago(this.amount, this.unit); } else { throw new Error('Invalid method: ' + this.method); } return new Date(time); }
javascript
function() { var time = null; if (this.method === 'from now') { time = ago.fromNow(this.amount, this.unit); } else if (this.method === 'ago') { time = ago(this.amount, this.unit); } else { throw new Error('Invalid method: ' + this.method); } return new Date(time); }
[ "function", "(", ")", "{", "var", "time", "=", "null", ";", "if", "(", "this", ".", "method", "===", "'from now'", ")", "{", "time", "=", "ago", ".", "fromNow", "(", "this", ".", "amount", ",", "this", ".", "unit", ")", ";", "}", "else", "if", ...
Build the desired date and return it. @returns {Date} @api public
[ "Build", "the", "desired", "date", "and", "return", "it", "." ]
16724aaac83bb57b1557ad9b9d2a0496a455b1b6
https://github.com/vesln/to-date/blob/16724aaac83bb57b1557ad9b9d2a0496a455b1b6/index.js#L126-L138
train
gethuman/pancakes-recipe
utils/base64.js
encode
function encode(number) { if (number === 0) { return ''; } var quotient = Math.floor(number / 64); var remainder = number % 64; var digit; if (remainder < 10) { digit = '' + remainder; } else if (remainder < 36) { digi...
javascript
function encode(number) { if (number === 0) { return ''; } var quotient = Math.floor(number / 64); var remainder = number % 64; var digit; if (remainder < 10) { digit = '' + remainder; } else if (remainder < 36) { digi...
[ "function", "encode", "(", "number", ")", "{", "if", "(", "number", "===", "0", ")", "{", "return", "''", ";", "}", "var", "quotient", "=", "Math", ".", "floor", "(", "number", "/", "64", ")", ";", "var", "remainder", "=", "number", "%", "64", ";...
Take a number and translate it into our custom base64 encoded string @param number @returns {string}
[ "Take", "a", "number", "and", "translate", "it", "into", "our", "custom", "base64", "encoded", "string" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/base64.js#L16-L42
train
gethuman/pancakes-recipe
utils/base64.js
decode
function decode(base64string) { var number = 0; var chars = base64string.split(''); var len = chars.length; var val10; var val64; var asciiVal; for (var i = 0; i < len; i++) { val64 = chars[len - 1 - i]; asciiVal = val64.charCodeAt(0); ...
javascript
function decode(base64string) { var number = 0; var chars = base64string.split(''); var len = chars.length; var val10; var val64; var asciiVal; for (var i = 0; i < len; i++) { val64 = chars[len - 1 - i]; asciiVal = val64.charCodeAt(0); ...
[ "function", "decode", "(", "base64string", ")", "{", "var", "number", "=", "0", ";", "var", "chars", "=", "base64string", ".", "split", "(", "''", ")", ";", "var", "len", "=", "chars", ".", "length", ";", "var", "val10", ";", "var", "val64", ";", "...
For a given string that has been encoded already with our custom base64 encoding scheme, translate it into a number @param base64string @returns {number}
[ "For", "a", "given", "string", "that", "has", "been", "encoded", "already", "with", "our", "custom", "base64", "encoding", "scheme", "translate", "it", "into", "a", "number" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/base64.js#L51-L87
train
shuvava/dev-http-server
lib/httphelper.js
httpNotFound
function httpNotFound(req, res) { console.log(`No request handler found for ${req.url}`); res.writeHead(404, { 'Content-Type': 'text/plain' }); res.write('404 Not found'); res.end(); }
javascript
function httpNotFound(req, res) { console.log(`No request handler found for ${req.url}`); res.writeHead(404, { 'Content-Type': 'text/plain' }); res.write('404 Not found'); res.end(); }
[ "function", "httpNotFound", "(", "req", ",", "res", ")", "{", "console", ".", "log", "(", "`", "${", "req", ".", "url", "}", "`", ")", ";", "res", ".", "writeHead", "(", "404", ",", "{", "'Content-Type'", ":", "'text/plain'", "}", ")", ";", "res", ...
Default implementation of NotFound HTTP response @param {Object} req HTTP request @param {Object} res HTTP response
[ "Default", "implementation", "of", "NotFound", "HTTP", "response" ]
db0f3b28f5805125959679828d81c1919cf519b6
https://github.com/shuvava/dev-http-server/blob/db0f3b28f5805125959679828d81c1919cf519b6/lib/httphelper.js#L16-L21
train
shuvava/dev-http-server
lib/httphelper.js
httpInternalError
function httpInternalError(req, res, err) { console.error(err); res.writeHead(500, { 'Content-Type': 'text/plain' }); res.write(`Error 500 Internal server error: ${err}`); res.end(); }
javascript
function httpInternalError(req, res, err) { console.error(err); res.writeHead(500, { 'Content-Type': 'text/plain' }); res.write(`Error 500 Internal server error: ${err}`); res.end(); }
[ "function", "httpInternalError", "(", "req", ",", "res", ",", "err", ")", "{", "console", ".", "error", "(", "err", ")", ";", "res", ".", "writeHead", "(", "500", ",", "{", "'Content-Type'", ":", "'text/plain'", "}", ")", ";", "res", ".", "write", "(...
Default implementation of InternalError HTTP response @param {Object} req HTTP request @param {Object} res HTTP response @param {string} err Error message
[ "Default", "implementation", "of", "InternalError", "HTTP", "response" ]
db0f3b28f5805125959679828d81c1919cf519b6
https://github.com/shuvava/dev-http-server/blob/db0f3b28f5805125959679828d81c1919cf519b6/lib/httphelper.js#L29-L34
train
shuvava/dev-http-server
lib/httphelper.js
httpOk
function httpOk(req, res, content, fileExt) { res.writeHead(200, { 'Content-Type': Mine.getType(fileExt), }); res.write(content, 'binary'); res.end(); }
javascript
function httpOk(req, res, content, fileExt) { res.writeHead(200, { 'Content-Type': Mine.getType(fileExt), }); res.write(content, 'binary'); res.end(); }
[ "function", "httpOk", "(", "req", ",", "res", ",", "content", ",", "fileExt", ")", "{", "res", ".", "writeHead", "(", "200", ",", "{", "'Content-Type'", ":", "Mine", ".", "getType", "(", "fileExt", ")", ",", "}", ")", ";", "res", ".", "write", "(",...
Default implementation OK HTTP response on GET file request @param {Object} req HTTP request @param {Object} res HTTP response @param {string} content File content @param {string} fileExt File extension
[ "Default", "implementation", "OK", "HTTP", "response", "on", "GET", "file", "request" ]
db0f3b28f5805125959679828d81c1919cf519b6
https://github.com/shuvava/dev-http-server/blob/db0f3b28f5805125959679828d81c1919cf519b6/lib/httphelper.js#L43-L49
train
scrapjs/promise-routine
index.js
routine
function routine (fn, sets, context) { const master = [] if (typeof context === 'undefined') { context = fn } for (const args of sets) { master.push(fn.apply(context, Array.isArray(args) ? args : [args])) } return Promise.all(master) }
javascript
function routine (fn, sets, context) { const master = [] if (typeof context === 'undefined') { context = fn } for (const args of sets) { master.push(fn.apply(context, Array.isArray(args) ? args : [args])) } return Promise.all(master) }
[ "function", "routine", "(", "fn", ",", "sets", ",", "context", ")", "{", "const", "master", "=", "[", "]", "if", "(", "typeof", "context", "===", "'undefined'", ")", "{", "context", "=", "fn", "}", "for", "(", "const", "args", "of", "sets", ")", "{...
Run a promise-returning function multiple times, in a routine. ```js routine(promiseFunc, [...args]) ``` Optionally supply context: ```js routine(foo.promiseFunc, [...args], foo) ```
[ "Run", "a", "promise", "-", "returning", "function", "multiple", "times", "in", "a", "routine", "." ]
9990f5cbf79df7017941c902bcf26b4b9e4893b4
https://github.com/scrapjs/promise-routine/blob/9990f5cbf79df7017941c902bcf26b4b9e4893b4/index.js#L17-L29
train
kirinnee/tslib.elefact
script.js
run
async function run(command) { if (!Array.isArray(command) && typeof command === "string") command = command.split(' '); else throw new Error("command is either a string or a string array"); let c = command.shift(); let v = command; let env = process.env; env.BROWSERSLIST_CONFIG= "./config/.brow...
javascript
async function run(command) { if (!Array.isArray(command) && typeof command === "string") command = command.split(' '); else throw new Error("command is either a string or a string array"); let c = command.shift(); let v = command; let env = process.env; env.BROWSERSLIST_CONFIG= "./config/.brow...
[ "async", "function", "run", "(", "command", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "command", ")", "&&", "typeof", "command", "===", "\"string\"", ")", "command", "=", "command", ".", "split", "(", "' '", ")", ";", "else", "throw", "...
Executes the function as if its on the CMD. Exits the script if the external command crashes.
[ "Executes", "the", "function", "as", "if", "its", "on", "the", "CMD", ".", "Exits", "the", "script", "if", "the", "external", "command", "crashes", "." ]
b300e668c3aeecb76bbb71fd707ebda49ff7d0d0
https://github.com/kirinnee/tslib.elefact/blob/b300e668c3aeecb76bbb71fd707ebda49ff7d0d0/script.js#L70-L95
train
Psychopoulet/node-promfs
lib/extends/_extractFiles.js
_extractRealFiles
function _extractRealFiles (dir, givenFiles, realFiles, callback) { if (0 >= givenFiles.length) { return callback(null, realFiles); } else { const file = join(dir, givenFiles.shift()).trim(); return isFileProm(file).then((exists) => { if (exists) { realFiles.push(file); } ...
javascript
function _extractRealFiles (dir, givenFiles, realFiles, callback) { if (0 >= givenFiles.length) { return callback(null, realFiles); } else { const file = join(dir, givenFiles.shift()).trim(); return isFileProm(file).then((exists) => { if (exists) { realFiles.push(file); } ...
[ "function", "_extractRealFiles", "(", "dir", ",", "givenFiles", ",", "realFiles", ",", "callback", ")", "{", "if", "(", "0", ">=", "givenFiles", ".", "length", ")", "{", "return", "callback", "(", "null", ",", "realFiles", ")", ";", "}", "else", "{", "...
methods Specific to "extractFiles" method, return only the existing files @param {string} dir : directory to work with @param {Array} givenFiles : files detected in the directory @param {Array} realFiles : files detected as real files @param {function|null} callback : operation's result @returns {Promise} Operation's ...
[ "methods", "Specific", "to", "extractFiles", "method", "return", "only", "the", "existing", "files" ]
016e272fc58c6ef6eae5ea551a0e8873f0ac20cc
https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_extractFiles.js#L25-L46
train
oz/bowerball
index.js
respondText
function respondText(res, code, text) { res.statusCode = code; res.setHeader('Content-Type', 'text/plain'); return res.end(text.toString()); }
javascript
function respondText(res, code, text) { res.statusCode = code; res.setHeader('Content-Type', 'text/plain'); return res.end(text.toString()); }
[ "function", "respondText", "(", "res", ",", "code", ",", "text", ")", "{", "res", ".", "statusCode", "=", "code", ";", "res", ".", "setHeader", "(", "'Content-Type'", ",", "'text/plain'", ")", ";", "return", "res", ".", "end", "(", "text", ".", "toStri...
Send an error response in plain-text.
[ "Send", "an", "error", "response", "in", "plain", "-", "text", "." ]
6a267e7f530d400790e66617aa8330b21e2aac31
https://github.com/oz/bowerball/blob/6a267e7f530d400790e66617aa8330b21e2aac31/index.js#L18-L22
train
alisonailea/grunt-ractive-parse
tasks/ractiveparse.js
function(){ var string = '\t\t\t', path = info.path.replace(baseDir, '').split('/'); if(path.length > 1){ for(var i=0;i<path.length;i++){ string = string + '\t'; } } ...
javascript
function(){ var string = '\t\t\t', path = info.path.replace(baseDir, '').split('/'); if(path.length > 1){ for(var i=0;i<path.length;i++){ string = string + '\t'; } } ...
[ "function", "(", ")", "{", "var", "string", "=", "'\\t\\t\\t'", ",", "path", "=", "info", ".", "path", ".", "replace", "(", "baseDir", ",", "''", ")", ".", "split", "(", "'/'", ")", ";", "if", "(", "path", ".", "length", ">", "1", ")", "{", "fo...
Assuming it's a file.
[ "Assuming", "it", "s", "a", "file", "." ]
1c2cfa1a1d53d9e367d341de735a46a81647714c
https://github.com/alisonailea/grunt-ractive-parse/blob/1c2cfa1a1d53d9e367d341de735a46a81647714c/tasks/ractiveparse.js#L189-L200
train
es128/anysort
index.js
splice
function splice(array, criteria, tieBreakers) { if (!criteria) { criteria = returnFalse; } var matcher = anymatch(criteria); var matched = array.filter(matcher); var unmatched = array.filter(function(s) { return matched.indexOf(s) === -1; }).sort(); if (!Array.isArray(criteria)) { criteria = [criteria];...
javascript
function splice(array, criteria, tieBreakers) { if (!criteria) { criteria = returnFalse; } var matcher = anymatch(criteria); var matched = array.filter(matcher); var unmatched = array.filter(function(s) { return matched.indexOf(s) === -1; }).sort(); if (!Array.isArray(criteria)) { criteria = [criteria];...
[ "function", "splice", "(", "array", ",", "criteria", ",", "tieBreakers", ")", "{", "if", "(", "!", "criteria", ")", "{", "criteria", "=", "returnFalse", ";", "}", "var", "matcher", "=", "anymatch", "(", "criteria", ")", ";", "var", "matched", "=", "arr...
given the sorting criteria and full array, returns the fully sorted array as well as separate matched and unmatched lists
[ "given", "the", "sorting", "criteria", "and", "full", "array", "returns", "the", "fully", "sorted", "array", "as", "well", "as", "separate", "matched", "and", "unmatched", "lists" ]
048a87b0a0f3e6586a1edd09e1060a9863e92ea2
https://github.com/es128/anysort/blob/048a87b0a0f3e6586a1edd09e1060a9863e92ea2/index.js#L47-L62
train
es128/anysort
index.js
grouped
function grouped(array, groups, order) { if (!groups) { groups = [returnFalse]; } var sorted = []; var ordered = []; var remaining = array.slice(); var unmatchedPosition = groups.indexOf('unmatched'); groups.forEach(function(criteria, index) { if (index === unmatchedPosition) { return; } var tieBrea...
javascript
function grouped(array, groups, order) { if (!groups) { groups = [returnFalse]; } var sorted = []; var ordered = []; var remaining = array.slice(); var unmatchedPosition = groups.indexOf('unmatched'); groups.forEach(function(criteria, index) { if (index === unmatchedPosition) { return; } var tieBrea...
[ "function", "grouped", "(", "array", ",", "groups", ",", "order", ")", "{", "if", "(", "!", "groups", ")", "{", "groups", "=", "[", "returnFalse", "]", ";", "}", "var", "sorted", "=", "[", "]", ";", "var", "ordered", "=", "[", "]", ";", "var", ...
Does a full sort based on an array of criteria, plus the option to set the position of any unmatched items. Can be used with an anymatch-compatible criteria array, or an array of those arrays.
[ "Does", "a", "full", "sort", "based", "on", "an", "array", "of", "criteria", "plus", "the", "option", "to", "set", "the", "position", "of", "any", "unmatched", "items", ".", "Can", "be", "used", "with", "an", "anymatch", "-", "compatible", "criteria", "a...
048a87b0a0f3e6586a1edd09e1060a9863e92ea2
https://github.com/es128/anysort/blob/048a87b0a0f3e6586a1edd09e1060a9863e92ea2/index.js#L69-L102
train
plepe/modulekit-tabs
src/Tab.js
Tab
function Tab (options) { this.options = options || {} this.master = null this.header = document.createElement('li') this.header.onclick = function () { this.toggle() }.bind(this) this.content = document.createElement('div') this.content.className = 'tabs-section' }
javascript
function Tab (options) { this.options = options || {} this.master = null this.header = document.createElement('li') this.header.onclick = function () { this.toggle() }.bind(this) this.content = document.createElement('div') this.content.className = 'tabs-section' }
[ "function", "Tab", "(", "options", ")", "{", "this", ".", "options", "=", "options", "||", "{", "}", "this", ".", "master", "=", "null", "this", ".", "header", "=", "document", ".", "createElement", "(", "'li'", ")", "this", ".", "header", ".", "oncl...
add a new tab pane to the tabs @param {Object} options @param {String} options.id ID of the tab @param {Number} [options.weight=0] Order tabs by weight. Tabs with lower weight first. @property {DOMNode} content @property {DOMNode} header @property {Tabs} master
[ "add", "a", "new", "tab", "pane", "to", "the", "tabs" ]
6aa10ef20301bc2a4c9f0fcfb7f536b0700ce216
https://github.com/plepe/modulekit-tabs/blob/6aa10ef20301bc2a4c9f0fcfb7f536b0700ce216/src/Tab.js#L12-L23
train
vkiding/jud-vue-render
src/render/browser/extend/components/scrollable/motion.js
quadratic2cubicBezier
function quadratic2cubicBezier (a, b) { return [ [ (a / 3 + (a + b) / 3 - a) / (b - a), (a * a / 3 + a * b * 2 / 3 - a * a) / (b * b - a * a) ], [ (b / 3 + (a + b) / 3 - a) / (b - a), (b * b / 3 + a * b * 2 / 3 - a * a) / (b * b - a * a) ] ] }
javascript
function quadratic2cubicBezier (a, b) { return [ [ (a / 3 + (a + b) / 3 - a) / (b - a), (a * a / 3 + a * b * 2 / 3 - a * a) / (b * b - a * a) ], [ (b / 3 + (a + b) / 3 - a) / (b - a), (b * b / 3 + a * b * 2 / 3 - a * a) / (b * b - a * a) ] ] }
[ "function", "quadratic2cubicBezier", "(", "a", ",", "b", ")", "{", "return", "[", "[", "(", "a", "/", "3", "+", "(", "a", "+", "b", ")", "/", "3", "-", "a", ")", "/", "(", "b", "-", "a", ")", ",", "(", "a", "*", "a", "/", "3", "+", "a",...
transfer Quadratic Bezier Curve to Cubic Bezier Curve @param {number} a abscissa of p1 @param {number} b ordinate of p1 @return {Array} parameter matrix for cubic bezier curve like [[p1x, p1y], [p2x, p2y]]
[ "transfer", "Quadratic", "Bezier", "Curve", "to", "Cubic", "Bezier", "Curve" ]
07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47
https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/scrollable/motion.js#L13-L23
train
meandavejustice/deploy-txp
lib/sign.js
distAddon
function distAddon(opts, cb) { // sign our add-on const generatedXpi = 'addon.xpi'; signAddon(generatedXpi, opts.apiKey, opts.apiSecret, function(err, signedXpiPath) { if (err) return cb(err); // remove our generated xpi since we now have a signed version removeGeneratedXpi(); // move our signed x...
javascript
function distAddon(opts, cb) { // sign our add-on const generatedXpi = 'addon.xpi'; signAddon(generatedXpi, opts.apiKey, opts.apiSecret, function(err, signedXpiPath) { if (err) return cb(err); // remove our generated xpi since we now have a signed version removeGeneratedXpi(); // move our signed x...
[ "function", "distAddon", "(", "opts", ",", "cb", ")", "{", "// sign our add-on", "const", "generatedXpi", "=", "'addon.xpi'", ";", "signAddon", "(", "generatedXpi", ",", "opts", ".", "apiKey", ",", "opts", ".", "apiSecret", ",", "function", "(", "err", ",", ...
if we need to sign and distribute our add-on, we want to use this method
[ "if", "we", "need", "to", "sign", "and", "distribute", "our", "add", "-", "on", "we", "want", "to", "use", "this", "method" ]
d9d3024a836c7976c337e934c5065e2d08f4dadb
https://github.com/meandavejustice/deploy-txp/blob/d9d3024a836c7976c337e934c5065e2d08f4dadb/lib/sign.js#L51-L66
train
marshallswain/feathers-mongo-collections
lib/feathers-mongo-collections.js
function(coll, callback){ // Switch databases var collection = self.db.collection(coll.name); // Get the stats. null if empty. collection.stats(function(err, stats){ // Add the stats to the corresponding database. coll.stats = stats; callback(err, coll); }); }
javascript
function(coll, callback){ // Switch databases var collection = self.db.collection(coll.name); // Get the stats. null if empty. collection.stats(function(err, stats){ // Add the stats to the corresponding database. coll.stats = stats; callback(err, coll); }); }
[ "function", "(", "coll", ",", "callback", ")", "{", "// Switch databases", "var", "collection", "=", "self", ".", "db", ".", "collection", "(", "coll", ".", "name", ")", ";", "// Get the stats. null if empty.", "collection", ".", "stats", "(", "function", "(",...
Async function to add stats to each collection.
[ "Async", "function", "to", "add", "stats", "to", "each", "collection", "." ]
d650b30569984113efda9687f3a45712678bf4e2
https://github.com/marshallswain/feathers-mongo-collections/blob/d650b30569984113efda9687f3a45712678bf4e2/lib/feathers-mongo-collections.js#L51-L60
train
marshallswain/feathers-mongo-collections
lib/feathers-mongo-collections.js
function(data, params, callback) { if (!data.name) { return callback({error:'name is required'}); } this.db.createCollection(data.name, {}, function(err, collection){ var response = { name:collection.collectionName, _id:collection.collectionName }; return callback(null, response)...
javascript
function(data, params, callback) { if (!data.name) { return callback({error:'name is required'}); } this.db.createCollection(data.name, {}, function(err, collection){ var response = { name:collection.collectionName, _id:collection.collectionName }; return callback(null, response)...
[ "function", "(", "data", ",", "params", ",", "callback", ")", "{", "if", "(", "!", "data", ".", "name", ")", "{", "return", "callback", "(", "{", "error", ":", "'name is required'", "}", ")", ";", "}", "this", ".", "db", ".", "createCollection", "(",...
Create a collection. @param {String} data.name - The name of the collection to be created. @return {Object} - name:collectionName
[ "Create", "a", "collection", "." ]
d650b30569984113efda9687f3a45712678bf4e2
https://github.com/marshallswain/feathers-mongo-collections/blob/d650b30569984113efda9687f3a45712678bf4e2/lib/feathers-mongo-collections.js#L82-L93
train
wozlla/WOZLLA.js
WOZLLA.js
GameObject
function GameObject(useRectTransform) { if (useRectTransform === void 0) { useRectTransform = false; } _super.call(this); this._UID = WOZLLA.utils.IdentifyUtils.genUID(); this._active = true; this._visible = true; this._initialized = false; ...
javascript
function GameObject(useRectTransform) { if (useRectTransform === void 0) { useRectTransform = false; } _super.call(this); this._UID = WOZLLA.utils.IdentifyUtils.genUID(); this._active = true; this._visible = true; this._initialized = false; ...
[ "function", "GameObject", "(", "useRectTransform", ")", "{", "if", "(", "useRectTransform", "===", "void", "0", ")", "{", "useRectTransform", "=", "false", ";", "}", "_super", ".", "call", "(", "this", ")", ";", "this", ".", "_UID", "=", "WOZLLA", ".", ...
new a GameObject @method constructor @member WOZLLA.GameObject @param {boolean} useRectTransform specify which transform this game object should be used.
[ "new", "a", "GameObject" ]
96273d43cd6cbbfd9f68789f4320ce0f7df9b148
https://github.com/wozlla/WOZLLA.js/blob/96273d43cd6cbbfd9f68789f4320ce0f7df9b148/WOZLLA.js#L2140-L2157
train
wozlla/WOZLLA.js
WOZLLA.js
Sprite
function Sprite(spriteAtlas, frame, name) { this._spriteAtlas = spriteAtlas; this._frame = frame; this._name = name; }
javascript
function Sprite(spriteAtlas, frame, name) { this._spriteAtlas = spriteAtlas; this._frame = frame; this._name = name; }
[ "function", "Sprite", "(", "spriteAtlas", ",", "frame", ",", "name", ")", "{", "this", ".", "_spriteAtlas", "=", "spriteAtlas", ";", "this", ".", "_frame", "=", "frame", ";", "this", ".", "_name", "=", "name", ";", "}" ]
new a sprite @method constructor @param spriteAtlas @param frame @param name
[ "new", "a", "sprite" ]
96273d43cd6cbbfd9f68789f4320ce0f7df9b148
https://github.com/wozlla/WOZLLA.js/blob/96273d43cd6cbbfd9f68789f4320ce0f7df9b148/WOZLLA.js#L5031-L5035
train
origin1tech/chek
dist/modules/array.js
containsAny
function containsAny(arr, compare, transform) { if (is_1.isString(arr)) arr = arr.split(''); if (is_1.isString(compare)) compare = compare.split(''); if (!is_1.isArray(arr) || !is_1.isArray(compare)) return false; return compare.filter(function (c) { return contains(arr, ...
javascript
function containsAny(arr, compare, transform) { if (is_1.isString(arr)) arr = arr.split(''); if (is_1.isString(compare)) compare = compare.split(''); if (!is_1.isArray(arr) || !is_1.isArray(compare)) return false; return compare.filter(function (c) { return contains(arr, ...
[ "function", "containsAny", "(", "arr", ",", "compare", ",", "transform", ")", "{", "if", "(", "is_1", ".", "isString", "(", "arr", ")", ")", "arr", "=", "arr", ".", "split", "(", "''", ")", ";", "if", "(", "is_1", ".", "isString", "(", "compare", ...
Contains Any Tests array check if contains value. @param arr the array to be inspected. @param compare - array of values to compare.
[ "Contains", "Any", "Tests", "array", "check", "if", "contains", "value", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L111-L121
train
origin1tech/chek
dist/modules/array.js
duplicates
function duplicates(arr, value, breakable) { var i = arr.length; var dupes = 0; while (i--) { if (breakable && dupes > 0) break; if (is_1.isEqual(arr[i], value)) dupes += 1; } return dupes; }
javascript
function duplicates(arr, value, breakable) { var i = arr.length; var dupes = 0; while (i--) { if (breakable && dupes > 0) break; if (is_1.isEqual(arr[i], value)) dupes += 1; } return dupes; }
[ "function", "duplicates", "(", "arr", ",", "value", ",", "breakable", ")", "{", "var", "i", "=", "arr", ".", "length", ";", "var", "dupes", "=", "0", ";", "while", "(", "i", "--", ")", "{", "if", "(", "breakable", "&&", "dupes", ">", "0", ")", ...
Duplicates Counts the number of duplicates in an array. @param arr the array to check for duplicates. @param value the value to match. @param breakable when true allows breaking at first duplicate.
[ "Duplicates", "Counts", "the", "number", "of", "duplicates", "in", "an", "array", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L131-L141
train
origin1tech/chek
dist/modules/array.js
push
function push(arr) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } arr = arr.concat(flatten.apply(void 0, args)); return { array: arr, val: arr.length }; }
javascript
function push(arr) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } arr = arr.concat(flatten.apply(void 0, args)); return { array: arr, val: arr.length }; }
[ "function", "push", "(", "arr", ")", "{", "var", "args", "=", "[", "]", ";", "for", "(", "var", "_i", "=", "1", ";", "_i", "<", "arguments", ".", "length", ";", "_i", "++", ")", "{", "args", "[", "_i", "-", "1", "]", "=", "arguments", "[", ...
Push Non mutating way to push to an array. @param arr the array to push items to. @param args the items to be added.
[ "Push", "Non", "mutating", "way", "to", "push", "to", "an", "array", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L249-L259
train
origin1tech/chek
dist/modules/array.js
splice
function splice(arr, start, remove) { var items = []; for (var _i = 3; _i < arguments.length; _i++) { items[_i - 3] = arguments[_i]; } start = start || 0; var head = arr.slice(0, start); var tail = arr.slice(start); var removed = []; if (remove) { removed = tail.slice(0, ...
javascript
function splice(arr, start, remove) { var items = []; for (var _i = 3; _i < arguments.length; _i++) { items[_i - 3] = arguments[_i]; } start = start || 0; var head = arr.slice(0, start); var tail = arr.slice(start); var removed = []; if (remove) { removed = tail.slice(0, ...
[ "function", "splice", "(", "arr", ",", "start", ",", "remove", ")", "{", "var", "items", "=", "[", "]", ";", "for", "(", "var", "_i", "=", "3", ";", "_i", "<", "arguments", ".", "length", ";", "_i", "++", ")", "{", "items", "[", "_i", "-", "3...
Splice Non mutating way of splicing an array. @param arr the array to be spliced. @param start the starting index (default: 0) @param remove the count to be spliced (default: 1) @param items additional items to be concatenated.
[ "Splice", "Non", "mutating", "way", "of", "splicing", "an", "array", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L287-L311
train
origin1tech/chek
dist/modules/array.js
unshift
function unshift(arr) { var items = []; for (var _i = 1; _i < arguments.length; _i++) { items[_i - 1] = arguments[_i]; } arr = arr.concat(flatten(items)); return { array: arr, val: arr.length }; }
javascript
function unshift(arr) { var items = []; for (var _i = 1; _i < arguments.length; _i++) { items[_i - 1] = arguments[_i]; } arr = arr.concat(flatten(items)); return { array: arr, val: arr.length }; }
[ "function", "unshift", "(", "arr", ")", "{", "var", "items", "=", "[", "]", ";", "for", "(", "var", "_i", "=", "1", ";", "_i", "<", "arguments", ".", "length", ";", "_i", "++", ")", "{", "items", "[", "_i", "-", "1", "]", "=", "arguments", "[...
Unshift Unshifts a value to an array in a non mutable way. @param arr the array to be unshifted. @param value the value to be unshifted
[ "Unshift", "Unshifts", "a", "value", "to", "an", "array", "in", "a", "non", "mutable", "way", "." ]
6bc3ab0ac36126cc7918a244a606009749897b2e
https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L320-L330
train
hydrojs/karma-hydro
index.js
init
function init(config) { var hydroConfig = config.hydro || {}; var hydroJs = hydroConfig.path || dirname(dirname(require.resolve('hydro'))) + '/dist/hydro.js'; var before = hydroConfig.before || []; config.files.unshift(createPattern(__dirname + '/adapter.js')); config.files.unshift(createPattern(hydroJs)); ...
javascript
function init(config) { var hydroConfig = config.hydro || {}; var hydroJs = hydroConfig.path || dirname(dirname(require.resolve('hydro'))) + '/dist/hydro.js'; var before = hydroConfig.before || []; config.files.unshift(createPattern(__dirname + '/adapter.js')); config.files.unshift(createPattern(hydroJs)); ...
[ "function", "init", "(", "config", ")", "{", "var", "hydroConfig", "=", "config", ".", "hydro", "||", "{", "}", ";", "var", "hydroJs", "=", "hydroConfig", ".", "path", "||", "dirname", "(", "dirname", "(", "require", ".", "resolve", "(", "'hydro'", ")"...
Insert hydro into the loaded files. @param {Array} files @api public
[ "Insert", "hydro", "into", "the", "loaded", "files", "." ]
a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193
https://github.com/hydrojs/karma-hydro/blob/a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193/index.js#L32-L43
train
2dbibracte/rlog
public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js
function(element) { // return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset if(element.nodeName === 'HTML') return -window.pageYOffset return element.getBoundingClientRect().top + window.pageYOffset; }
javascript
function(element) { // return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset if(element.nodeName === 'HTML') return -window.pageYOffset return element.getBoundingClientRect().top + window.pageYOffset; }
[ "function", "(", "element", ")", "{", "// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset", "if", "(", "element", ".", "nodeName", "===", "'HTML'", ")", "return", "-", "window", ".", "pageYOffset", "return", "element", ".", "getB...
Get the top position of an element in the document
[ "Get", "the", "top", "position", "of", "an", "element", "in", "the", "document" ]
10f63cf81ffcd23b37c70620c77942c885e3ce5e
https://github.com/2dbibracte/rlog/blob/10f63cf81ffcd23b37c70620c77942c885e3ce5e/public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js#L12-L16
train
2dbibracte/rlog
public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js
function(el, duration, callback){ duration = duration || 500; var start = window.pageYOffset; if (typeof el === 'number') { var end = parseInt(el); } else { var end = getTop(el); } var clock = Date.now(); var requestAnimationFrame = window.requestAnimationFrame || windo...
javascript
function(el, duration, callback){ duration = duration || 500; var start = window.pageYOffset; if (typeof el === 'number') { var end = parseInt(el); } else { var end = getTop(el); } var clock = Date.now(); var requestAnimationFrame = window.requestAnimationFrame || windo...
[ "function", "(", "el", ",", "duration", ",", "callback", ")", "{", "duration", "=", "duration", "||", "500", ";", "var", "start", "=", "window", ".", "pageYOffset", ";", "if", "(", "typeof", "el", "===", "'number'", ")", "{", "var", "end", "=", "pars...
we use requestAnimationFrame to be called by the browser before every repaint if the first argument is an element then scroll to the top of this element if the first argument is numeric then scroll to this location if the callback exist, it is called when the scrolling is finished
[ "we", "use", "requestAnimationFrame", "to", "be", "called", "by", "the", "browser", "before", "every", "repaint", "if", "the", "first", "argument", "is", "an", "element", "then", "scroll", "to", "the", "top", "of", "this", "element", "if", "the", "first", ...
10f63cf81ffcd23b37c70620c77942c885e3ce5e
https://github.com/2dbibracte/rlog/blob/10f63cf81ffcd23b37c70620c77942c885e3ce5e/public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js#L35-L62
train
konfirm/devour-gulp
lib/devour.js
preload
function preload() { var path = config.gulpFiles; if (/^[^\/]/.test(path)) { path = config.basePath + '/' + path; } glob.sync(path + '/*/*.js').map(function(file) { return file.replace(path, '').split('/').filter(function(split) { return !!split; }); }).forEach(function(file) { register( ...
javascript
function preload() { var path = config.gulpFiles; if (/^[^\/]/.test(path)) { path = config.basePath + '/' + path; } glob.sync(path + '/*/*.js').map(function(file) { return file.replace(path, '').split('/').filter(function(split) { return !!split; }); }).forEach(function(file) { register( ...
[ "function", "preload", "(", ")", "{", "var", "path", "=", "config", ".", "gulpFiles", ";", "if", "(", "/", "^[^\\/]", "/", ".", "test", "(", "path", ")", ")", "{", "path", "=", "config", ".", "basePath", "+", "'/'", "+", "path", ";", "}", "glob",...
Load all available tasks and pipes @name preload @access internal @return void
[ "Load", "all", "available", "tasks", "and", "pipes" ]
eed953ac3c582c653fd63cbbb4b550dd33e88d13
https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L49-L80
train
konfirm/devour-gulp
lib/devour.js
register
function register(type, name, create) { if (!(type in definitions)) { definitions[type] = {}; } if (type === 'pipe') { create = chain(create, devour); } definitions[type][name] = create; }
javascript
function register(type, name, create) { if (!(type in definitions)) { definitions[type] = {}; } if (type === 'pipe') { create = chain(create, devour); } definitions[type][name] = create; }
[ "function", "register", "(", "type", ",", "name", ",", "create", ")", "{", "if", "(", "!", "(", "type", "in", "definitions", ")", ")", "{", "definitions", "[", "type", "]", "=", "{", "}", ";", "}", "if", "(", "type", "===", "'pipe'", ")", "{", ...
Register a task or pipe @name resgister @access internal @param string type [accepts any value, actual values: 'task' or 'pipe'] @param string name @param function create @return void
[ "Register", "a", "task", "or", "pipe" ]
eed953ac3c582c653fd63cbbb4b550dd33e88d13
https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L91-L101
train
konfirm/devour-gulp
lib/devour.js
plug
function plug(name) { var part, scope; if (!('buffer' in plug.prototype)) { plug.prototype.buffer = {}; } part = name.split('.'); scope = part.shift(); if (!(scope in plug.prototype.buffer)) { plug.prototype.buffer[scope] = wanted.require('gulp-' + scope); } scope = plug.prototype.buffer[scop...
javascript
function plug(name) { var part, scope; if (!('buffer' in plug.prototype)) { plug.prototype.buffer = {}; } part = name.split('.'); scope = part.shift(); if (!(scope in plug.prototype.buffer)) { plug.prototype.buffer[scope] = wanted.require('gulp-' + scope); } scope = plug.prototype.buffer[scop...
[ "function", "plug", "(", "name", ")", "{", "var", "part", ",", "scope", ";", "if", "(", "!", "(", "'buffer'", "in", "plug", ".", "prototype", ")", ")", "{", "plug", ".", "prototype", ".", "buffer", "=", "{", "}", ";", "}", "part", "=", "name", ...
Obtain a gulp plugin, initialized with given arguments @name plug @access internal @param string name [automatically prefixed with 'gulp-'] @return stream initialized plugin
[ "Obtain", "a", "gulp", "plugin", "initialized", "with", "given", "arguments" ]
eed953ac3c582c653fd63cbbb4b550dd33e88d13
https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L110-L145
train
konfirm/devour-gulp
lib/devour.js
startRequested
function startRequested() { var start = []; if (run.length) { run.forEach(function(task) { var exists = task.replace(/:.*$/, '') in definitions.task; console.log( 'Task %s %s', exists ? chalk.green(task) : chalk.red(task), exists ? 'running' : 'not found!' ); if (exists) { ...
javascript
function startRequested() { var start = []; if (run.length) { run.forEach(function(task) { var exists = task.replace(/:.*$/, '') in definitions.task; console.log( 'Task %s %s', exists ? chalk.green(task) : chalk.red(task), exists ? 'running' : 'not found!' ); if (exists) { ...
[ "function", "startRequested", "(", ")", "{", "var", "start", "=", "[", "]", ";", "if", "(", "run", ".", "length", ")", "{", "run", ".", "forEach", "(", "function", "(", "task", ")", "{", "var", "exists", "=", "task", ".", "replace", "(", "/", ":....
Start tasks provided from the command line @name startRequested @access internal @return bool started
[ "Start", "tasks", "provided", "from", "the", "command", "line" ]
eed953ac3c582c653fd63cbbb4b550dd33e88d13
https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L153-L187
train
jamespdlynn/microjs
examples/game/lib/client.js
readData
function readData(raw){ var dataObj = micro.toJSON(new Buffer(raw)); var type = dataObj._type; delete dataObj._type; switch (type){ case "Ping": //Grab latency (if exists) and bounce back the exact same data packet ...
javascript
function readData(raw){ var dataObj = micro.toJSON(new Buffer(raw)); var type = dataObj._type; delete dataObj._type; switch (type){ case "Ping": //Grab latency (if exists) and bounce back the exact same data packet ...
[ "function", "readData", "(", "raw", ")", "{", "var", "dataObj", "=", "micro", ".", "toJSON", "(", "new", "Buffer", "(", "raw", ")", ")", ";", "var", "type", "=", "dataObj", ".", "_type", ";", "delete", "dataObj", ".", "_type", ";", "switch", "(", "...
Handle data received from server
[ "Handle", "data", "received", "from", "server" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/client.js#L39-L89
train
jamespdlynn/microjs
examples/game/lib/client.js
onUserPlayerChange
function onUserPlayerChange(data){ var player = gameData.player; //Check if data contains different values if (player.get("angle") !== data.angle.toPrecision(1) || player.get("isAccelerating") !== data.isAccelerating){ var buffer = micro.toBinary(data, "PlayerUpdate...
javascript
function onUserPlayerChange(data){ var player = gameData.player; //Check if data contains different values if (player.get("angle") !== data.angle.toPrecision(1) || player.get("isAccelerating") !== data.isAccelerating){ var buffer = micro.toBinary(data, "PlayerUpdate...
[ "function", "onUserPlayerChange", "(", "data", ")", "{", "var", "player", "=", "gameData", ".", "player", ";", "//Check if data contains different values", "if", "(", "player", ".", "get", "(", "\"angle\"", ")", "!==", "data", ".", "angle", ".", "toPrecision", ...
When a user player change event is caught, send a "PlayerUpdate" to the server
[ "When", "a", "user", "player", "change", "event", "is", "caught", "send", "a", "PlayerUpdate", "to", "the", "server" ]
780a4074de84bcd74e3ae50d0ed64144b4474166
https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/client.js#L92-L106
train
jonschlinkert/expand-task
index.js
Task
function Task(options) { if (!(this instanceof Task)) { return new Task(options); } utils.is(this, 'task'); use(this); this.options = options || {}; if (utils.isTask(options)) { this.options = {}; this.addTargets(options); return this; } }
javascript
function Task(options) { if (!(this instanceof Task)) { return new Task(options); } utils.is(this, 'task'); use(this); this.options = options || {}; if (utils.isTask(options)) { this.options = {}; this.addTargets(options); return this; } }
[ "function", "Task", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Task", ")", ")", "{", "return", "new", "Task", "(", "options", ")", ";", "}", "utils", ".", "is", "(", "this", ",", "'task'", ")", ";", "use", "(", "this", ...
Create a new Task with the given `options` ```js var task = new Task({cwd: 'src'}); task.addTargets({ site: {src: ['*.hbs']}, blog: {src: ['*.md']} }); ``` @param {Object} `options` @api public
[ "Create", "a", "new", "Task", "with", "the", "given", "options" ]
b885ce5ec49f93980780a3e31e8ec3a1a892e1de
https://github.com/jonschlinkert/expand-task/blob/b885ce5ec49f93980780a3e31e8ec3a1a892e1de/index.js#L22-L36
train
moov2/grunt-orchard-development
tasks/download.js
function (info, cb) { // Default to a binary request var options = info.src; var dest = info.dest; // Request the url var req = request(options); // On error, callback req.on('error', cb); // On response, callback for wri...
javascript
function (info, cb) { // Default to a binary request var options = info.src; var dest = info.dest; // Request the url var req = request(options); // On error, callback req.on('error', cb); // On response, callback for wri...
[ "function", "(", "info", ",", "cb", ")", "{", "// Default to a binary request", "var", "options", "=", "info", ".", "src", ";", "var", "dest", "=", "info", ".", "dest", ";", "// Request the url", "var", "req", "=", "request", "(", "options", ")", ";", "/...
Downloads single file to local computer.
[ "Downloads", "single", "file", "to", "local", "computer", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L37-L69
train
moov2/grunt-orchard-development
tasks/download.js
function (url, content) { var dirName = path.dirname(url); if (!fs.existsSync(dirName)) { fs.mkdirSync(dirName); } fs.writeFileSync(url, content, { mode: 0777 }); }
javascript
function (url, content) { var dirName = path.dirname(url); if (!fs.existsSync(dirName)) { fs.mkdirSync(dirName); } fs.writeFileSync(url, content, { mode: 0777 }); }
[ "function", "(", "url", ",", "content", ")", "{", "var", "dirName", "=", "path", ".", "dirname", "(", "url", ")", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "dirName", ")", ")", "{", "fs", ".", "mkdirSync", "(", "dirName", ")", ";", "}", ...
Writes data to a file, ensuring that the containing directory exists.
[ "Writes", "data", "to", "a", "file", "ensuring", "that", "the", "containing", "directory", "exists", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L90-L100
train
moov2/grunt-orchard-development
tasks/download.js
function (onComplete) { grunt.file.delete(options.tempDir, { force: true }); fs.exists(options.downloadDestination, function (exists) { if (exists) { fs.unlinkSync(options.downloadDestination); } if (onComplete) { ...
javascript
function (onComplete) { grunt.file.delete(options.tempDir, { force: true }); fs.exists(options.downloadDestination, function (exists) { if (exists) { fs.unlinkSync(options.downloadDestination); } if (onComplete) { ...
[ "function", "(", "onComplete", ")", "{", "grunt", ".", "file", ".", "delete", "(", "options", ".", "tempDir", ",", "{", "force", ":", "true", "}", ")", ";", "fs", ".", "exists", "(", "options", ".", "downloadDestination", ",", "function", "(", "exists"...
Deletes the downloaded zip & temporary directory.
[ "Deletes", "the", "downloaded", "zip", "&", "temporary", "directory", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L129-L141
train
moov2/grunt-orchard-development
tasks/download.js
function (orchardDownload) { grunt.log.writeln('downloading Orchard ' + options.version + ', this may take a while...'); helpers.curl({ src: orchardDownload.url, dest: options.downloadDestination }, function handleCurlComplete (err) { ...
javascript
function (orchardDownload) { grunt.log.writeln('downloading Orchard ' + options.version + ', this may take a while...'); helpers.curl({ src: orchardDownload.url, dest: options.downloadDestination }, function handleCurlComplete (err) { ...
[ "function", "(", "orchardDownload", ")", "{", "grunt", ".", "log", ".", "writeln", "(", "'downloading Orchard '", "+", "options", ".", "version", "+", "', this may take a while...'", ")", ";", "helpers", ".", "curl", "(", "{", "src", ":", "orchardDownload", "....
Downloads a version of Orchard from the Internet.
[ "Downloads", "a", "version", "of", "Orchard", "from", "the", "Internet", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L146-L162
train
moov2/grunt-orchard-development
tasks/download.js
function (orchardDownload) { var content, dest, zip; grunt.log.writeln('extracting downloaded zip...'); fs.mkdirSync(options.tempDir); fs.readFile(options.downloadDestination, function (err, data) { if (err) { throw err; ...
javascript
function (orchardDownload) { var content, dest, zip; grunt.log.writeln('extracting downloaded zip...'); fs.mkdirSync(options.tempDir); fs.readFile(options.downloadDestination, function (err, data) { if (err) { throw err; ...
[ "function", "(", "orchardDownload", ")", "{", "var", "content", ",", "dest", ",", "zip", ";", "grunt", ".", "log", ".", "writeln", "(", "'extracting downloaded zip...'", ")", ";", "fs", ".", "mkdirSync", "(", "options", ".", "tempDir", ")", ";", "fs", "....
Unzips the download that contains Orchard and sets up the extracted files in a directory reflecting the version number.
[ "Unzips", "the", "download", "that", "contains", "Orchard", "and", "sets", "up", "the", "extracted", "files", "in", "a", "directory", "reflecting", "the", "version", "number", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L168-L202
train
moov2/grunt-orchard-development
tasks/download.js
function () { // ensures the uncompressed Orchard code is inside the version directory // inside directory that contains local Orchard install. This is to // ensure a directory structure like `/local/1.8.1/Orchard-1.8.1` // doesn't occur becuase the download zip contents ...
javascript
function () { // ensures the uncompressed Orchard code is inside the version directory // inside directory that contains local Orchard install. This is to // ensure a directory structure like `/local/1.8.1/Orchard-1.8.1` // doesn't occur becuase the download zip contents ...
[ "function", "(", ")", "{", "// ensures the uncompressed Orchard code is inside the version directory", "// inside directory that contains local Orchard install. This is to", "// ensure a directory structure like `/local/1.8.1/Orchard-1.8.1`", "// doesn't occur becuase the download zip contents is with...
Moves extract files into directory that reflects the version number.
[ "Moves", "extract", "files", "into", "directory", "that", "reflects", "the", "version", "number", "." ]
658c5bae73f894469d099a7c2d735f9cda08d0cc
https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L207-L219
train
Psychopoulet/node-promfs
lib/extends/_directoryToString.js
_directoryToString
function _directoryToString (directory, encoding, separator, callback) { if ("undefined" === typeof directory) { throw new ReferenceError("missing \"directory\" argument"); } else if ("string" !== typeof directory) { throw new TypeError("\"directory\" argument is not a string"); } else if ("...
javascript
function _directoryToString (directory, encoding, separator, callback) { if ("undefined" === typeof directory) { throw new ReferenceError("missing \"directory\" argument"); } else if ("string" !== typeof directory) { throw new TypeError("\"directory\" argument is not a string"); } else if ("...
[ "function", "_directoryToString", "(", "directory", ",", "encoding", ",", "separator", ",", "callback", ")", "{", "if", "(", "\"undefined\"", "===", "typeof", "directory", ")", "{", "throw", "new", "ReferenceError", "(", "\"missing \\\"directory\\\" argument\"", ")"...
methods Async directoryToString @param {string} directory : directory to work with @param {string} encoding : encoding to use @param {string} separator : used to separate content (can be "") @param {function|null} callback : operation's result @returns {void}
[ "methods", "Async", "directoryToString" ]
016e272fc58c6ef6eae5ea551a0e8873f0ac20cc
https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_directoryToString.js#L24-L62
train
impromptu/impromptu-git
index.js
function (porcelainStatus) { var PORCELAIN_PROPERTY_REGEXES = { // Leading non-whitespace that is not a question mark staged: /^[^\?\s]/, // Trailing non-whitespace unstaged: /\S$/, // Any "A" or "??" added: /A|\?\?/, // Any "M" modified: /M/, // Any "D" deleted: /D/, // An...
javascript
function (porcelainStatus) { var PORCELAIN_PROPERTY_REGEXES = { // Leading non-whitespace that is not a question mark staged: /^[^\?\s]/, // Trailing non-whitespace unstaged: /\S$/, // Any "A" or "??" added: /A|\?\?/, // Any "M" modified: /M/, // Any "D" deleted: /D/, // An...
[ "function", "(", "porcelainStatus", ")", "{", "var", "PORCELAIN_PROPERTY_REGEXES", "=", "{", "// Leading non-whitespace that is not a question mark", "staged", ":", "/", "^[^\\?\\s]", "/", ",", "// Trailing non-whitespace", "unstaged", ":", "/", "\\S$", "/", ",", "// An...
Helper function to format git statuses
[ "Helper", "function", "to", "format", "git", "statuses" ]
ce078c236bec273d52bd8a2a5f780dee423e3595
https://github.com/impromptu/impromptu-git/blob/ce078c236bec273d52bd8a2a5f780dee423e3595/index.js#L6-L34
train
cemtopkaya/kuark-db
src/db_kalem.js
f_tahta_kalem_takip_ekle
function f_tahta_kalem_takip_ekle(_tahta_id, _kalem_id) { //kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız return result.dbQ.sadd(result.kp.tahta.ssetTakiptekiKalemleri(_tahta_id), _kalem_id) .then(function () { return result.db...
javascript
function f_tahta_kalem_takip_ekle(_tahta_id, _kalem_id) { //kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız return result.dbQ.sadd(result.kp.tahta.ssetTakiptekiKalemleri(_tahta_id), _kalem_id) .then(function () { return result.db...
[ "function", "f_tahta_kalem_takip_ekle", "(", "_tahta_id", ",", "_kalem_id", ")", "{", "//kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız\r", "return", "result", ".", "dbQ", ".", "sadd", "(", "result", ".", "kp", ".", "tahta", ".", ...
Takip edilecek kalem setine ekle @param _tahta_id @param _kalem_id @returns {*}
[ "Takip", "edilecek", "kalem", "setine", "ekle" ]
d584aaf51f65a013bec79220a05007bd70767ac2
https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_kalem.js#L229-L238
train
cemtopkaya/kuark-db
src/db_kalem.js
f_kalem_ekle_tahta
function f_kalem_ekle_tahta(_tahta_id, _ihale_id, _es_kalem, _db_kalem, _kul_id) { var onay_durumu = _es_kalem.OnayDurumu; //genel ihaleye tahtada yeni kalem ekleniyor //bu durumda sadece tahtanın (tahta:401:ihale:101:kalem) kalemlerine eklemeliyiz //ihalenin genel kalemlerine de...
javascript
function f_kalem_ekle_tahta(_tahta_id, _ihale_id, _es_kalem, _db_kalem, _kul_id) { var onay_durumu = _es_kalem.OnayDurumu; //genel ihaleye tahtada yeni kalem ekleniyor //bu durumda sadece tahtanın (tahta:401:ihale:101:kalem) kalemlerine eklemeliyiz //ihalenin genel kalemlerine de...
[ "function", "f_kalem_ekle_tahta", "(", "_tahta_id", ",", "_ihale_id", ",", "_es_kalem", ",", "_db_kalem", ",", "_kul_id", ")", "{", "var", "onay_durumu", "=", "_es_kalem", ".", "OnayDurumu", ";", "//genel ihaleye tahtada yeni kalem ekleniyor\r", "//bu durumda sadece tahta...
Tahtaya yeni kalem ekle @param _tahta_id @param _ihale_id @param _es_kalem @param _db_kalem @param _kul_id @returns {*}
[ "Tahtaya", "yeni", "kalem", "ekle" ]
d584aaf51f65a013bec79220a05007bd70767ac2
https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_kalem.js#L809-L843
train
iopa-io/iopa-rest
src/iopa-rest/context.js
_setIgnoreCase
function _setIgnoreCase(obj, key, val) { var key_lower = key.toLowerCase(); for (var p in obj) { if (obj.hasOwnProperty(p) && key_lower == p.toLowerCase()) { obj[p] = val; return; } } obj[key] = val; }
javascript
function _setIgnoreCase(obj, key, val) { var key_lower = key.toLowerCase(); for (var p in obj) { if (obj.hasOwnProperty(p) && key_lower == p.toLowerCase()) { obj[p] = val; return; } } obj[key] = val; }
[ "function", "_setIgnoreCase", "(", "obj", ",", "key", ",", "val", ")", "{", "var", "key_lower", "=", "key", ".", "toLowerCase", "(", ")", ";", "for", "(", "var", "p", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "p", ")", ...
Adds or updates a javascript object, case insensitive for key property @method private_setIgnoreCase @param obj (object) the object to search @param key (string) the new or existing property name @param val (string) the new property value @private
[ "Adds", "or", "updates", "a", "javascript", "object", "case", "insensitive", "for", "key", "property" ]
14a6b11ecf8859683cd62dc2c853985cfb0555f5
https://github.com/iopa-io/iopa-rest/blob/14a6b11ecf8859683cd62dc2c853985cfb0555f5/src/iopa-rest/context.js#L127-L137
train
derdesign/protos
storages/sqlite.js
SQLiteStorage
function SQLiteStorage(config) { /*jshint bitwise: false */ var self = this; this.events = new EventEmitter(); app.debug(util.format('Initializing SQLite Storage on %s', config.filename)); config = config || {}; config.table = config.table || "storage"; config.mode = config.mode || (sqlite3...
javascript
function SQLiteStorage(config) { /*jshint bitwise: false */ var self = this; this.events = new EventEmitter(); app.debug(util.format('Initializing SQLite Storage on %s', config.filename)); config = config || {}; config.table = config.table || "storage"; config.mode = config.mode || (sqlite3...
[ "function", "SQLiteStorage", "(", "config", ")", "{", "/*jshint bitwise: false */", "var", "self", "=", "this", ";", "this", ".", "events", "=", "new", "EventEmitter", "(", ")", ";", "app", ".", "debug", "(", "util", ".", "format", "(", "'Initializing SQLite...
SQLite Storage class @class SQLiteStorage @extends Storage @constructor @param {object} app Application instance @param {object} config Storage configuration
[ "SQLite", "Storage", "class" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/storages/sqlite.js#L23-L78
train
ottojs/otto-errors
lib/conflict.error.js
ErrorConflict
function ErrorConflict (message) { Error.call(this); // Add Information this.name = 'ErrorConflict'; this.type = 'client'; this.status = 409; if (message) { this.message = message; } }
javascript
function ErrorConflict (message) { Error.call(this); // Add Information this.name = 'ErrorConflict'; this.type = 'client'; this.status = 409; if (message) { this.message = message; } }
[ "function", "ErrorConflict", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "// Add Information", "this", ".", "name", "=", "'ErrorConflict'", ";", "this", ".", "type", "=", "'client'", ";", "this", ".", "status", "=", "409", ";",...
Error - ErrorConflict
[ "Error", "-", "ErrorConflict" ]
a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9
https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/conflict.error.js#L8-L20
train
xiamidaxia/xiami
meteor/minimongo/minimongo.js
function (f, fieldsIndex, ignoreEmptyFields) { if (!f) return function () {}; return function (/*args*/) { var context = this; var args = arguments; if (self.collection.paused) return; if (fieldsIndex !== undefined && self.projectionFn) { args[fi...
javascript
function (f, fieldsIndex, ignoreEmptyFields) { if (!f) return function () {}; return function (/*args*/) { var context = this; var args = arguments; if (self.collection.paused) return; if (fieldsIndex !== undefined && self.projectionFn) { args[fi...
[ "function", "(", "f", ",", "fieldsIndex", ",", "ignoreEmptyFields", ")", "{", "if", "(", "!", "f", ")", "return", "function", "(", ")", "{", "}", ";", "return", "function", "(", "/*args*/", ")", "{", "var", "context", "=", "this", ";", "var", "args",...
furthermore, callbacks enqueue until the operation we're working on is done.
[ "furthermore", "callbacks", "enqueue", "until", "the", "operation", "we", "re", "working", "on", "is", "done", "." ]
6fcee92c493c12bf8fd67c7068e67fa6a72a306b
https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/minimongo/minimongo.js#L321-L341
train
valiton/node-various-cluster
lib/worker.js
Worker
function Worker() { this.config = JSON.parse(process.env.WORKER_CONFIG); if (typeof this.config !== 'object') { throw new Error('WORKER_CONFIG is missing'); } process.title = process.variousCluster = this.config.title; }
javascript
function Worker() { this.config = JSON.parse(process.env.WORKER_CONFIG); if (typeof this.config !== 'object') { throw new Error('WORKER_CONFIG is missing'); } process.title = process.variousCluster = this.config.title; }
[ "function", "Worker", "(", ")", "{", "this", ".", "config", "=", "JSON", ".", "parse", "(", "process", ".", "env", ".", "WORKER_CONFIG", ")", ";", "if", "(", "typeof", "this", ".", "config", "!==", "'object'", ")", "{", "throw", "new", "Error", "(", ...
create a new Worker instance @memberOf global @constructor @this {Worker}
[ "create", "a", "new", "Worker", "instance" ]
b570ff342ef9138e4ae57a3639f3abc8820217ab
https://github.com/valiton/node-various-cluster/blob/b570ff342ef9138e4ae57a3639f3abc8820217ab/lib/worker.js#L96-L102
train
integreat-io/integreat-adapter-couchdb
lib/authstrats/couchdb.js
couchdbAuth
function couchdbAuth ({uri, key, secret} = {}) { return { /** * Check whether we've already ran authentication. * @returns {boolean} `true` if already authenticated, otherwise `false` */ isAuthenticated () { return !!this._cookie }, /** * Authenticate and return true if auth...
javascript
function couchdbAuth ({uri, key, secret} = {}) { return { /** * Check whether we've already ran authentication. * @returns {boolean} `true` if already authenticated, otherwise `false` */ isAuthenticated () { return !!this._cookie }, /** * Authenticate and return true if auth...
[ "function", "couchdbAuth", "(", "{", "uri", ",", "key", ",", "secret", "}", "=", "{", "}", ")", "{", "return", "{", "/**\n * Check whether we've already ran authentication.\n * @returns {boolean} `true` if already authenticated, otherwise `false`\n */", "isAuthenticat...
Create an instance of the couchdb strategy. Will retrieve an an authentication cookie and send the cookie with every request. @param {Object} options - Options object @returns {Object} Strategy object
[ "Create", "an", "instance", "of", "the", "couchdb", "strategy", ".", "Will", "retrieve", "an", "an", "authentication", "cookie", "and", "send", "the", "cookie", "with", "every", "request", "." ]
e792aaa3e85c5dae41959bc449ed3b0e149f7ebf
https://github.com/integreat-io/integreat-adapter-couchdb/blob/e792aaa3e85c5dae41959bc449ed3b0e149f7ebf/lib/authstrats/couchdb.js#L11-L47
train
gethuman/pancakes-recipe
middleware/mw.caller.js
getDeviceId
function getDeviceId(req) { // NOTE: client_id and client_secret are deprecated so eventually remove var deviceId = req.headers['x-device-id']; var deviceSecret = req.headers['x-device-secret']; // if client ID and secret don't exist, then no device if (!deviceId || !deviceSecr...
javascript
function getDeviceId(req) { // NOTE: client_id and client_secret are deprecated so eventually remove var deviceId = req.headers['x-device-id']; var deviceSecret = req.headers['x-device-secret']; // if client ID and secret don't exist, then no device if (!deviceId || !deviceSecr...
[ "function", "getDeviceId", "(", "req", ")", "{", "// NOTE: client_id and client_secret are deprecated so eventually remove", "var", "deviceId", "=", "req", ".", "headers", "[", "'x-device-id'", "]", ";", "var", "deviceSecret", "=", "req", ".", "headers", "[", "'x-devi...
Get the device id if it exists and the secret is valid @param req @returns {string}
[ "Get", "the", "device", "id", "if", "it", "exists", "and", "the", "secret", "is", "valid" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.caller.js#L14-L36
train
gethuman/pancakes-recipe
middleware/mw.caller.js
getCaller
function getCaller(req) { var ipAddress = req.headers['x-forwarded-for'] || req.info.remoteAddress || ''; var user = req.user; if (user) { // if user admin and there is an onBehalfOf value then use onBehalfOf if (user.role === 'admin' && req.query.onBehalfOfId) { ...
javascript
function getCaller(req) { var ipAddress = req.headers['x-forwarded-for'] || req.info.remoteAddress || ''; var user = req.user; if (user) { // if user admin and there is an onBehalfOf value then use onBehalfOf if (user.role === 'admin' && req.query.onBehalfOfId) { ...
[ "function", "getCaller", "(", "req", ")", "{", "var", "ipAddress", "=", "req", ".", "headers", "[", "'x-forwarded-for'", "]", "||", "req", ".", "info", ".", "remoteAddress", "||", "''", ";", "var", "user", "=", "req", ".", "user", ";", "if", "(", "us...
Get the caller based on the request @param req @returns {*}
[ "Get", "the", "caller", "based", "on", "the", "request" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.caller.js#L43-L91
train
andreypopp/es6-module-jstransform
visitors.js
visitImportDeclaration
function visitImportDeclaration(traverse, node, path, state) { var specifier, name; utils.catchup(node.range[0], state); switch (node.kind) { // import "module" case undefined: utils.append('require(' + node.source.raw + ');', state); break; // import name from "module" case "defaul...
javascript
function visitImportDeclaration(traverse, node, path, state) { var specifier, name; utils.catchup(node.range[0], state); switch (node.kind) { // import "module" case undefined: utils.append('require(' + node.source.raw + ');', state); break; // import name from "module" case "defaul...
[ "function", "visitImportDeclaration", "(", "traverse", ",", "node", ",", "path", ",", "state", ")", "{", "var", "specifier", ",", "name", ";", "utils", ".", "catchup", "(", "node", ".", "range", "[", "0", "]", ",", "state", ")", ";", "switch", "(", "...
Visit ImportDeclaration. Examples: import "module" import name from "module" import { name, one as other } from "module"
[ "Visit", "ImportDeclaration", "." ]
639fe364f6a3bc1de87d2d3edf5b0dd682b3289b
https://github.com/andreypopp/es6-module-jstransform/blob/639fe364f6a3bc1de87d2d3edf5b0dd682b3289b/visitors.js#L16-L62
train
andreypopp/es6-module-jstransform
visitors.js
visitModuleDeclaration
function visitModuleDeclaration(traverse, node, path, state) { utils.catchup(node.range[0], state); utils.append('var ' + node.id.name + ' = require(' + node.source.raw + ');', state); utils.move(node.range[1], state); return false; }
javascript
function visitModuleDeclaration(traverse, node, path, state) { utils.catchup(node.range[0], state); utils.append('var ' + node.id.name + ' = require(' + node.source.raw + ');', state); utils.move(node.range[1], state); return false; }
[ "function", "visitModuleDeclaration", "(", "traverse", ",", "node", ",", "path", ",", "state", ")", "{", "utils", ".", "catchup", "(", "node", ".", "range", "[", "0", "]", ",", "state", ")", ";", "utils", ".", "append", "(", "'var '", "+", "node", "....
Visit ModuleDeclaration. Example: module name from "module"
[ "Visit", "ModuleDeclaration", "." ]
639fe364f6a3bc1de87d2d3edf5b0dd682b3289b
https://github.com/andreypopp/es6-module-jstransform/blob/639fe364f6a3bc1de87d2d3edf5b0dd682b3289b/visitors.js#L216-L221
train
derdesign/protos
lib/protos.js
commonStartupOperations
function commonStartupOperations() { if (options.stayUp) { process.on('uncaughtException', app.log); // prints stack trace } startupMessage.call(this, options); }
javascript
function commonStartupOperations() { if (options.stayUp) { process.on('uncaughtException', app.log); // prints stack trace } startupMessage.call(this, options); }
[ "function", "commonStartupOperations", "(", ")", "{", "if", "(", "options", ".", "stayUp", ")", "{", "process", ".", "on", "(", "'uncaughtException'", ",", "app", ".", "log", ")", ";", "// prints stack trace", "}", "startupMessage", ".", "call", "(", "this",...
Convenience function, to avoid repetition
[ "Convenience", "function", "to", "avoid", "repetition" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/protos.js#L685-L690
train
allex-servercore-libs/servicepack
authentication/strategies/ipstrategycreator.js
ip2long
function ip2long( a, b, c, d ) { for ( c = b = 0; d = a.split('.')[b++]; c += d >> 8 | b > 4 ? NaN : d * (1 << -8 * b) ) d = parseInt( +d && d ); return c }
javascript
function ip2long( a, b, c, d ) { for ( c = b = 0; d = a.split('.')[b++]; c += d >> 8 | b > 4 ? NaN : d * (1 << -8 * b) ) d = parseInt( +d && d ); return c }
[ "function", "ip2long", "(", "a", ",", "b", ",", "c", ",", "d", ")", "{", "for", "(", "c", "=", "b", "=", "0", ";", "d", "=", "a", ".", "split", "(", "'.'", ")", "[", "b", "++", "]", ";", "c", "+=", "d", ">>", "8", "|", "b", ">", "4", ...
Convert an IP to a long integer.
[ "Convert", "an", "IP", "to", "a", "long", "integer", "." ]
1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23
https://github.com/allex-servercore-libs/servicepack/blob/1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23/authentication/strategies/ipstrategycreator.js#L13-L31
train
allex-servercore-libs/servicepack
authentication/strategies/ipstrategycreator.js
cidr_match
function cidr_match( ip, range ) { // // If the range doesn't have a slash it will only match if identical to the IP. // if ( range.indexOf( "/" ) < 0 ) { return ( ip == range ); } // // Split the range by the slash // var parsed = range.split( "/" ); if...
javascript
function cidr_match( ip, range ) { // // If the range doesn't have a slash it will only match if identical to the IP. // if ( range.indexOf( "/" ) < 0 ) { return ( ip == range ); } // // Split the range by the slash // var parsed = range.split( "/" ); if...
[ "function", "cidr_match", "(", "ip", ",", "range", ")", "{", "//", "// If the range doesn't have a slash it will only match if identical to the IP.", "//", "if", "(", "range", ".", "indexOf", "(", "\"/\"", ")", "<", "0", ")", "{", "return", "(", "ip", "==", "ra...
Determine whether the given IP falls within the specified CIDR range.
[ "Determine", "whether", "the", "given", "IP", "falls", "within", "the", "specified", "CIDR", "range", "." ]
1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23
https://github.com/allex-servercore-libs/servicepack/blob/1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23/authentication/strategies/ipstrategycreator.js#L56-L132
train
Rifdhan/weighted-randomly-select
index.js
selectWithValidation
function selectWithValidation(choices) { // Validate argument is an array if(!choices || !choices.length) { throw new Error("Randomly Select: invalid argument, please provide a non-empty array"); } // Validate that: // - each array entry has a 'chance' and 'result' property // - each 'chance' field is a number...
javascript
function selectWithValidation(choices) { // Validate argument is an array if(!choices || !choices.length) { throw new Error("Randomly Select: invalid argument, please provide a non-empty array"); } // Validate that: // - each array entry has a 'chance' and 'result' property // - each 'chance' field is a number...
[ "function", "selectWithValidation", "(", "choices", ")", "{", "// Validate argument is an array", "if", "(", "!", "choices", "||", "!", "choices", ".", "length", ")", "{", "throw", "new", "Error", "(", "\"Randomly Select: invalid argument, please provide a non-empty array...
Performs validation on input before performing the random selection
[ "Performs", "validation", "on", "input", "before", "performing", "the", "random", "selection" ]
b11f26f70f3a16e130a24b5b9f87631297024e8c
https://github.com/Rifdhan/weighted-randomly-select/blob/b11f26f70f3a16e130a24b5b9f87631297024e8c/index.js#L4-L33
train
Rifdhan/weighted-randomly-select
index.js
selectWithoutValidation
function selectWithoutValidation(choices) { // Generate a list of options with positive non-zero chances let choicesWithNonZeroChances = []; let totalWeight = 0.0; for(let i = 0; i < choices.length; i++) { if(choices[i].chance > 0.0) { choicesWithNonZeroChances.push(choices[i]); totalWeight += choices[i].ch...
javascript
function selectWithoutValidation(choices) { // Generate a list of options with positive non-zero chances let choicesWithNonZeroChances = []; let totalWeight = 0.0; for(let i = 0; i < choices.length; i++) { if(choices[i].chance > 0.0) { choicesWithNonZeroChances.push(choices[i]); totalWeight += choices[i].ch...
[ "function", "selectWithoutValidation", "(", "choices", ")", "{", "// Generate a list of options with positive non-zero chances", "let", "choicesWithNonZeroChances", "=", "[", "]", ";", "let", "totalWeight", "=", "0.0", ";", "for", "(", "let", "i", "=", "0", ";", "i"...
Performs the random selection without validating any input
[ "Performs", "the", "random", "selection", "without", "validating", "any", "input" ]
b11f26f70f3a16e130a24b5b9f87631297024e8c
https://github.com/Rifdhan/weighted-randomly-select/blob/b11f26f70f3a16e130a24b5b9f87631297024e8c/index.js#L36-L58
train
emiljohansson/captn
captn.dom.addclass/index.js
addClass
function addClass(element, className) { if (!hasClassNameProperty(element) || hasClass(element, className)) { return; } element.className = (element.className + ' ' + className).replace(/^\s+|\s+$/g, ''); }
javascript
function addClass(element, className) { if (!hasClassNameProperty(element) || hasClass(element, className)) { return; } element.className = (element.className + ' ' + className).replace(/^\s+|\s+$/g, ''); }
[ "function", "addClass", "(", "element", ",", "className", ")", "{", "if", "(", "!", "hasClassNameProperty", "(", "element", ")", "||", "hasClass", "(", "element", ",", "className", ")", ")", "{", "return", ";", "}", "element", ".", "className", "=", "(",...
Adds a class name to the element's list of class names. @static @param {DOMElement} element The DOM element to modify. @param {string} className The name to append. @example hasClass(el, 'container'); // => false addClass(el, 'container'); hasClass(el, 'container'); // => true
[ "Adds", "a", "class", "name", "to", "the", "element", "s", "list", "of", "class", "names", "." ]
dae7520116dc2148b4de06af7e1d7a47a3a3ac37
https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.addclass/index.js#L22-L27
train
ripter/bind
src/bind.dom.js
bind
function bind(element, eventName, callback) { element.addEventListener(eventName, callback); return function unbind() { element.removeEventListener(eventName, callback); }; }
javascript
function bind(element, eventName, callback) { element.addEventListener(eventName, callback); return function unbind() { element.removeEventListener(eventName, callback); }; }
[ "function", "bind", "(", "element", ",", "eventName", ",", "callback", ")", "{", "element", ".", "addEventListener", "(", "eventName", ",", "callback", ")", ";", "return", "function", "unbind", "(", ")", "{", "element", ".", "removeEventListener", "(", "even...
bind - listens to event on element, returning a function to stop listening to the event. @param {EventTarget} element - https://developer.mozilla.org/en-US/docs/Web/API/EventTarget @param {String} eventName - Name of the event. Like 'click', or 'did-custom-event' @param {Function} callback - @return unbind - function t...
[ "bind", "-", "listens", "to", "event", "on", "element", "returning", "a", "function", "to", "stop", "listening", "to", "the", "event", "." ]
e41e89fc3dc3ea3eb0e8ccfeb8ba97ba4a29b7a5
https://github.com/ripter/bind/blob/e41e89fc3dc3ea3eb0e8ccfeb8ba97ba4a29b7a5/src/bind.dom.js#L8-L14
train
xiamidaxia/xiami
meteor/minimongo/projection.js
function (doc, ruleTree) { // Special case for "sets" if (_.isArray(doc)) return _.map(doc, function (subdoc) { return transform(subdoc, ruleTree); }); var res = details.including ? {} : EJSON.clone(doc); _.each(ruleTree, function (rule, key) { if (!_.has(doc, key)) return; if...
javascript
function (doc, ruleTree) { // Special case for "sets" if (_.isArray(doc)) return _.map(doc, function (subdoc) { return transform(subdoc, ruleTree); }); var res = details.including ? {} : EJSON.clone(doc); _.each(ruleTree, function (rule, key) { if (!_.has(doc, key)) return; if...
[ "function", "(", "doc", ",", "ruleTree", ")", "{", "// Special case for \"sets\"", "if", "(", "_", ".", "isArray", "(", "doc", ")", ")", "return", "_", ".", "map", "(", "doc", ",", "function", "(", "subdoc", ")", "{", "return", "transform", "(", "subdo...
returns transformed doc according to ruleTree
[ "returns", "transformed", "doc", "according", "to", "ruleTree" ]
6fcee92c493c12bf8fd67c7068e67fa6a72a306b
https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/minimongo/projection.js#L24-L45
train
bithavoc/node-orch-amqp
lib/amqp_source.js
AmqpQueue
function AmqpQueue(source) { assert.ok(source); TasksSource.Queue.apply(this, []); this.source = source; this._amqpProcessing = false; }
javascript
function AmqpQueue(source) { assert.ok(source); TasksSource.Queue.apply(this, []); this.source = source; this._amqpProcessing = false; }
[ "function", "AmqpQueue", "(", "source", ")", "{", "assert", ".", "ok", "(", "source", ")", ";", "TasksSource", ".", "Queue", ".", "apply", "(", "this", ",", "[", "]", ")", ";", "this", ".", "source", "=", "source", ";", "this", ".", "_amqpProcessing"...
AMQP Queue Wrapper
[ "AMQP", "Queue", "Wrapper" ]
d61b1035e87e4c41df1c7a7cb1472d91f225d117
https://github.com/bithavoc/node-orch-amqp/blob/d61b1035e87e4c41df1c7a7cb1472d91f225d117/lib/amqp_source.js#L72-L77
train
robertontiu/wrapper6
src/promises.js
resolve
function resolve(promiseLike) { // Return if already promised if (promiseLike instanceof Promise) { return promiseLike; } var promises = []; if (promiseLike instanceof Array) { promiseLike.forEach((promiseLikeEntry) => { promises.push(promisify(promiseLikeEntry)); ...
javascript
function resolve(promiseLike) { // Return if already promised if (promiseLike instanceof Promise) { return promiseLike; } var promises = []; if (promiseLike instanceof Array) { promiseLike.forEach((promiseLikeEntry) => { promises.push(promisify(promiseLikeEntry)); ...
[ "function", "resolve", "(", "promiseLike", ")", "{", "// Return if already promised", "if", "(", "promiseLike", "instanceof", "Promise", ")", "{", "return", "promiseLike", ";", "}", "var", "promises", "=", "[", "]", ";", "if", "(", "promiseLike", "instanceof", ...
Resolves one or more promise-likes @param {*} promiseLike @returns {Promise}
[ "Resolves", "one", "or", "more", "promise", "-", "likes" ]
70f99dcda0f2e0926b689be349ab9bb95e84a22d
https://github.com/robertontiu/wrapper6/blob/70f99dcda0f2e0926b689be349ab9bb95e84a22d/src/promises.js#L35-L70
train
the-terribles/evergreen
lib/graph-builder.js
GraphBuilder
function GraphBuilder(options){ options = options || {}; // Precedence for resolvers. this.resolvers = options.resolvers || [ require('./resolvers/absolute'), require('./resolvers/relative'), require('./resolvers/environment') ]; this.handlers = options.directives || []; }
javascript
function GraphBuilder(options){ options = options || {}; // Precedence for resolvers. this.resolvers = options.resolvers || [ require('./resolvers/absolute'), require('./resolvers/relative'), require('./resolvers/environment') ]; this.handlers = options.directives || []; }
[ "function", "GraphBuilder", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "// Precedence for resolvers.", "this", ".", "resolvers", "=", "options", ".", "resolvers", "||", "[", "require", "(", "'./resolvers/absolute'", ")", ",", "re...
Instantiate the GraphBuilder with the set of Directive Handlers. Directive Handler: { strategy: 'name', handle: function(DirectiveContext, tree, metadata, callback){ return callback(err, DirectiveContext); } @param options {Object} @constructor
[ "Instantiate", "the", "GraphBuilder", "with", "the", "set", "of", "Directive", "Handlers", "." ]
c1adaea1ce825727c5c5ed75d858e2f0d22657e2
https://github.com/the-terribles/evergreen/blob/c1adaea1ce825727c5c5ed75d858e2f0d22657e2/lib/graph-builder.js#L29-L41
train
gethuman/pancakes-recipe
middleware/mw.error.handling.js
handleGlobalError
function handleGlobalError() { // make sure Q provides long stack traces (disabled in prod for performance) Q.longStackSupport = config.longStackSupport; // hopefully we handle errors before this point, but this will log anything not caught process.on('uncaughtException', function (err...
javascript
function handleGlobalError() { // make sure Q provides long stack traces (disabled in prod for performance) Q.longStackSupport = config.longStackSupport; // hopefully we handle errors before this point, but this will log anything not caught process.on('uncaughtException', function (err...
[ "function", "handleGlobalError", "(", ")", "{", "// make sure Q provides long stack traces (disabled in prod for performance)", "Q", ".", "longStackSupport", "=", "config", ".", "longStackSupport", ";", "// hopefully we handle errors before this point, but this will log anything not caug...
Configure global error handling which includes Q and catching uncaught exceptions
[ "Configure", "global", "error", "handling", "which", "includes", "Q", "and", "catching", "uncaught", "exceptions" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.error.handling.js#L13-L25
train
gethuman/pancakes-recipe
middleware/mw.error.handling.js
handlePreResponseError
function handlePreResponseError(server) { server.ext('onPreResponse', function (request, reply) { var response = request.response; var originalResponse = response; var msg; // No error, keep going with the reply as normal if (!response.isBoom) { reply...
javascript
function handlePreResponseError(server) { server.ext('onPreResponse', function (request, reply) { var response = request.response; var originalResponse = response; var msg; // No error, keep going with the reply as normal if (!response.isBoom) { reply...
[ "function", "handlePreResponseError", "(", "server", ")", "{", "server", ".", "ext", "(", "'onPreResponse'", ",", "function", "(", "request", ",", "reply", ")", "{", "var", "response", "=", "request", ".", "response", ";", "var", "originalResponse", "=", "re...
Set up the pre-response error handler @param server
[ "Set", "up", "the", "pre", "-", "response", "error", "handler" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.error.handling.js#L31-L100
train
erwan/gulp-gist
index.js
leftAlign
function leftAlign(lines) { if (lines.length == 0) return lines; var distance = lines[0].match(/^\s*/)[0].length; var result = []; lines.forEach(function(line){ result.push(line.slice(Math.min(distance, line.match(/^\s*/)[0].length))); }); return result; }
javascript
function leftAlign(lines) { if (lines.length == 0) return lines; var distance = lines[0].match(/^\s*/)[0].length; var result = []; lines.forEach(function(line){ result.push(line.slice(Math.min(distance, line.match(/^\s*/)[0].length))); }); return result; }
[ "function", "leftAlign", "(", "lines", ")", "{", "if", "(", "lines", ".", "length", "==", "0", ")", "return", "lines", ";", "var", "distance", "=", "lines", "[", "0", "]", ".", "match", "(", "/", "^\\s*", "/", ")", "[", "0", "]", ".", "length", ...
Remove indent from the left, aligning everything with the first line
[ "Remove", "indent", "from", "the", "left", "aligning", "everything", "with", "the", "first", "line" ]
1ea776220d6bd322cec9804e40b2c54e735ed0d8
https://github.com/erwan/gulp-gist/blob/1ea776220d6bd322cec9804e40b2c54e735ed0d8/index.js#L13-L21
train
usrz/javascript-esquire
src/esquire.js
inject
function inject() { var args = normalize(arguments); /* Sanity check, need a callback */ if (!args.function) { throw new EsquireError("Callback for injection unspecified"); } /* Create a fake "null" module and return its value */ var module = new Module(null, args.arguments...
javascript
function inject() { var args = normalize(arguments); /* Sanity check, need a callback */ if (!args.function) { throw new EsquireError("Callback for injection unspecified"); } /* Create a fake "null" module and return its value */ var module = new Module(null, args.arguments...
[ "function", "inject", "(", ")", "{", "var", "args", "=", "normalize", "(", "arguments", ")", ";", "/* Sanity check, need a callback */", "if", "(", "!", "args", ".", "function", ")", "{", "throw", "new", "EsquireError", "(", "\"Callback for injection unspecified\"...
Request injection for the specified modules. @instance @function inject @memberof Esquire @example - var esq = new Esquire(); esq.inject(['modA', 'depB'], function(a, b) { // 'a' will be an instance of 'modA' // 'b' will be an instance of 'depB' return "something"; }).then(function(result) { // The function will be ...
[ "Request", "injection", "for", "the", "specified", "modules", "." ]
59ed57393d9fc1fedd9ec50a7abb6fa7e59e491b
https://github.com/usrz/javascript-esquire/blob/59ed57393d9fc1fedd9ec50a7abb6fa7e59e491b/src/esquire.js#L1076-L1092
train
onecommons/polyform
packages/polyform-config/index.js
tryExtensions
function tryExtensions(p, exts, isMain) { for (var i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; }
javascript
function tryExtensions(p, exts, isMain) { for (var i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; }
[ "function", "tryExtensions", "(", "p", ",", "exts", ",", "isMain", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "exts", ".", "length", ";", "i", "++", ")", "{", "const", "filename", "=", "tryFile", "(", "p", "+", "exts", "[", "i",...
given a path check a the file exists with any of the set extensions
[ "given", "a", "path", "check", "a", "the", "file", "exists", "with", "any", "of", "the", "set", "extensions" ]
98cc56f7e8283e9a46a789434400e5d432b1ac80
https://github.com/onecommons/polyform/blob/98cc56f7e8283e9a46a789434400e5d432b1ac80/packages/polyform-config/index.js#L44-L53
train
c1rabbit/mers-min
mers.js
generate
function generate (orgID, loanNumber) { //strip non-numeric or letters loanNumber = loanNumber.replace(/\D/g,""); orgID = orgID.replace(/\D/g,""); //string letters var loanNum = loanNumber.replace(/[a-z]/gi,""); orgID = orgID.replace(/[a-z]/gi,""); if (orgID.toString().length != 7 ){ throw new Error...
javascript
function generate (orgID, loanNumber) { //strip non-numeric or letters loanNumber = loanNumber.replace(/\D/g,""); orgID = orgID.replace(/\D/g,""); //string letters var loanNum = loanNumber.replace(/[a-z]/gi,""); orgID = orgID.replace(/[a-z]/gi,""); if (orgID.toString().length != 7 ){ throw new Error...
[ "function", "generate", "(", "orgID", ",", "loanNumber", ")", "{", "//strip non-numeric or letters", "loanNumber", "=", "loanNumber", ".", "replace", "(", "/", "\\D", "/", "g", ",", "\"\"", ")", ";", "orgID", "=", "orgID", ".", "replace", "(", "/", "\\D", ...
mod 10 weight 2
[ "mod", "10", "weight", "2" ]
426371ccb80ed1e710244166396d21bb3cd0e716
https://github.com/c1rabbit/mers-min/blob/426371ccb80ed1e710244166396d21bb3cd0e716/mers.js#L2-L51
train
BeepBoopHQ/botkit-storage-beepboop
src/storage.js
bbTeamToBotkitTeam
function bbTeamToBotkitTeam (team) { return { id: team.slack_team_id, createdBy: team.slack_user_id, url: `https://${team.slack_team_domain}.slack.com/`, name: team.slack_team_name, bot: { name: team.slack_bot_user_name, token: team.slack_bot_access_token, user_id: team.slack_bot...
javascript
function bbTeamToBotkitTeam (team) { return { id: team.slack_team_id, createdBy: team.slack_user_id, url: `https://${team.slack_team_domain}.slack.com/`, name: team.slack_team_name, bot: { name: team.slack_bot_user_name, token: team.slack_bot_access_token, user_id: team.slack_bot...
[ "function", "bbTeamToBotkitTeam", "(", "team", ")", "{", "return", "{", "id", ":", "team", ".", "slack_team_id", ",", "createdBy", ":", "team", ".", "slack_user_id", ",", "url", ":", "`", "${", "team", ".", "slack_team_domain", "}", "`", ",", "name", ":"...
transform beep boop team into what botkit expects
[ "transform", "beep", "boop", "team", "into", "what", "botkit", "expects" ]
4bb2bfda995feb71a8ad77df213f11c6cbb7650d
https://github.com/BeepBoopHQ/botkit-storage-beepboop/blob/4bb2bfda995feb71a8ad77df213f11c6cbb7650d/src/storage.js#L137-L151
train
nrn/gen-pasta
gen-pasta.js
genPasta
function genPasta (opts) { // GENERAL Functions // function slice (ar, start, end) { return Array.prototype.slice.call(ar, start, end) } function log () { if (console && console.log) console.log(slice(arguments)) } function combine (returned, added) { Object.keys(added).forEach(function (key...
javascript
function genPasta (opts) { // GENERAL Functions // function slice (ar, start, end) { return Array.prototype.slice.call(ar, start, end) } function log () { if (console && console.log) console.log(slice(arguments)) } function combine (returned, added) { Object.keys(added).forEach(function (key...
[ "function", "genPasta", "(", "opts", ")", "{", "// GENERAL Functions", "//", "function", "slice", "(", "ar", ",", "start", ",", "end", ")", "{", "return", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "ar", ",", "start", ",", "end", ")", ...
gen-pasta.js
[ "gen", "-", "pasta", ".", "js" ]
7e583cd000a8eab9b15c96440d24240d613a8801
https://github.com/nrn/gen-pasta/blob/7e583cd000a8eab9b15c96440d24240d613a8801/gen-pasta.js#L3-L59
train
dalekjs/dalek-driver-sauce
lib/commands/url.js
function (url, hash, uuid) { this.lastCalledUrl = url; this.actionQueue.push(this.webdriverClient.url.bind(this.webdriverClient, url)); this.actionQueue.push(this._openCb.bind(this, url, hash, uuid)); return this; }
javascript
function (url, hash, uuid) { this.lastCalledUrl = url; this.actionQueue.push(this.webdriverClient.url.bind(this.webdriverClient, url)); this.actionQueue.push(this._openCb.bind(this, url, hash, uuid)); return this; }
[ "function", "(", "url", ",", "hash", ",", "uuid", ")", "{", "this", ".", "lastCalledUrl", "=", "url", ";", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "url", ".", "bind", "(", "this", ".", "webdriverClient", ",", ...
Navigate to a new URL @method open @param {string} url Url to navigate to @param {string} hash Unique hash of that fn call @param {string} uuid Unique hash of that fn call @chainable
[ "Navigate", "to", "a", "new", "URL" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/url.js#L50-L55
train
dalekjs/dalek-driver-sauce
lib/commands/url.js
function (expected, hash) { this.actionQueue.push(this.webdriverClient.getUrl.bind(this.webdriverClient)); this.actionQueue.push(this._urlCb.bind(this, expected, hash)); return this; }
javascript
function (expected, hash) { this.actionQueue.push(this.webdriverClient.getUrl.bind(this.webdriverClient)); this.actionQueue.push(this._urlCb.bind(this, expected, hash)); return this; }
[ "function", "(", "expected", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "getUrl", ".", "bind", "(", "this", ".", "webdriverClient", ")", ")", ";", "this", ".", "actionQueue", ".", "push", "...
Fetches the current url @method url @param {string} expected Expected url @param {string} hash Unique hash of that fn call @chainable
[ "Fetches", "the", "current", "url" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/url.js#L84-L88
train
just-paja/pwf.js
lib/pwf.js
function(mods) { for (var i = 0, len = mods.length; i < len; i++) { if (!internal.is_module_ready(mods[i])) { return false; } } return true; }
javascript
function(mods) { for (var i = 0, len = mods.length; i < len; i++) { if (!internal.is_module_ready(mods[i])) { return false; } } return true; }
[ "function", "(", "mods", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "mods", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "!", "internal", ".", "is_module_ready", "(", "mods", "[", "i", "]", ")", ...
Dear sir, are all modules of this list ready? @param Object modules List (array) of module names @return bool
[ "Dear", "sir", "are", "all", "modules", "of", "this", "list", "ready?" ]
f2ae9607f378b3ba4553d48f4a1bc179029b16ea
https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L44-L52
train
just-paja/pwf.js
lib/pwf.js
function(mods) { for (var i = 0, len = mods.length; i < len; i++) { if (self.get_module_status(mods[i]) !== internal.states.initialized) { return false; } } return true; }
javascript
function(mods) { for (var i = 0, len = mods.length; i < len; i++) { if (self.get_module_status(mods[i]) !== internal.states.initialized) { return false; } } return true; }
[ "function", "(", "mods", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "mods", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "self", ".", "get_module_status", "(", "mods", "[", "i", "]", ")", "!==", ...
Dear sir, are all members of this noble name list initialized? @param list modules module name @return bool
[ "Dear", "sir", "are", "all", "members", "of", "this", "noble", "name", "list", "initialized?" ]
f2ae9607f378b3ba4553d48f4a1bc179029b16ea
https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L61-L69
train
just-paja/pwf.js
lib/pwf.js
function() { if (typeof console !== 'undefined' && ((pwf.has('module', 'config') && pwf.config.get('debug.frontend')) || !pwf.has('module', 'config'))) { var args = pwf.clone_array(arguments); if (args.length > 1) { console.log(args); } else { console.log(args[0]); } } }
javascript
function() { if (typeof console !== 'undefined' && ((pwf.has('module', 'config') && pwf.config.get('debug.frontend')) || !pwf.has('module', 'config'))) { var args = pwf.clone_array(arguments); if (args.length > 1) { console.log(args); } else { console.log(args[0]); } } }
[ "function", "(", ")", "{", "if", "(", "typeof", "console", "!==", "'undefined'", "&&", "(", "(", "pwf", ".", "has", "(", "'module'", ",", "'config'", ")", "&&", "pwf", ".", "config", ".", "get", "(", "'debug.frontend'", ")", ")", "||", "!", "pwf", ...
Safe dump data into console. Takes any number of any arguments @param mixed any @return void
[ "Safe", "dump", "data", "into", "console", ".", "Takes", "any", "number", "of", "any", "arguments" ]
f2ae9607f378b3ba4553d48f4a1bc179029b16ea
https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L1205-L1216
train
just-paja/pwf.js
lib/pwf.js
function(items) { var register = []; /// Export as module if running under nodejs if (typeof global === 'object') { register.push(global); } if (typeof window === 'object') { register.push(window); } // Browse all resolved global objects and bind pwf items for (var i = 0; i < register.length; ...
javascript
function(items) { var register = []; /// Export as module if running under nodejs if (typeof global === 'object') { register.push(global); } if (typeof window === 'object') { register.push(window); } // Browse all resolved global objects and bind pwf items for (var i = 0; i < register.length; ...
[ "function", "(", "items", ")", "{", "var", "register", "=", "[", "]", ";", "/// Export as module if running under nodejs", "if", "(", "typeof", "global", "===", "'object'", ")", "{", "register", ".", "push", "(", "global", ")", ";", "}", "if", "(", "typeof...
Register items into global objects @param object items Key-value objects to register @return void
[ "Register", "items", "into", "global", "objects" ]
f2ae9607f378b3ba4553d48f4a1bc179029b16ea
https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L1223-L1267
train
dvalchanov/luckio
src/luckio.js
luckio
function luckio(chance) { var min = 1; var max = math.maxRange(chance); var luckyNumber = math.randomNumber(min, max); return function() { if (math.randomNumber(min, max) === luckyNumber) return true; return false; } }
javascript
function luckio(chance) { var min = 1; var max = math.maxRange(chance); var luckyNumber = math.randomNumber(min, max); return function() { if (math.randomNumber(min, max) === luckyNumber) return true; return false; } }
[ "function", "luckio", "(", "chance", ")", "{", "var", "min", "=", "1", ";", "var", "max", "=", "math", ".", "maxRange", "(", "chance", ")", ";", "var", "luckyNumber", "=", "math", ".", "randomNumber", "(", "min", ",", "max", ")", ";", "return", "fu...
Pick a lucky number and return a function that matches its picked lucky number to the initial one. If equal it will return `true`, if not `false`. @param {Number} chance Lucky chance to pick a number @returns {Function}
[ "Pick", "a", "lucky", "number", "and", "return", "a", "function", "that", "matches", "its", "picked", "lucky", "number", "to", "the", "initial", "one", ".", "If", "equal", "it", "will", "return", "true", "if", "not", "false", "." ]
5340b97880f848c2cebc997a1e9a2771572e1762
https://github.com/dvalchanov/luckio/blob/5340b97880f848c2cebc997a1e9a2771572e1762/src/luckio.js#L13-L22
train
gethuman/pancakes-recipe
utils/i18n.js
getScopeValue
function getScopeValue(scope, field) { if (!scope || !field) { return null; } var fieldParts = field.split('.'); var pntr = scope; _.each(fieldParts, function (fieldPart) { if (pntr) { pntr = pntr[fieldPart]; } }); return pntr; ...
javascript
function getScopeValue(scope, field) { if (!scope || !field) { return null; } var fieldParts = field.split('.'); var pntr = scope; _.each(fieldParts, function (fieldPart) { if (pntr) { pntr = pntr[fieldPart]; } }); return pntr; ...
[ "function", "getScopeValue", "(", "scope", ",", "field", ")", "{", "if", "(", "!", "scope", "||", "!", "field", ")", "{", "return", "null", ";", "}", "var", "fieldParts", "=", "field", ".", "split", "(", "'.'", ")", ";", "var", "pntr", "=", "scope"...
Get a value from scope for a given field @param scope @param field @returns {{}}
[ "Get", "a", "value", "from", "scope", "for", "a", "given", "field" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L18-L31
train