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
tritech/node-icalendar
lib/rrule.js
byday
function byday(rules, dt, after) { if(!rules || !rules.length) return dt; // Generate a list of candiDATES. (HA!) var candidates = rules.map(function(rule) { // Align on the correct day of the week... var days = rule[1]-wkday(dt); if(days < 0) days += 7; var newdt = add_d(ne...
javascript
function byday(rules, dt, after) { if(!rules || !rules.length) return dt; // Generate a list of candiDATES. (HA!) var candidates = rules.map(function(rule) { // Align on the correct day of the week... var days = rule[1]-wkday(dt); if(days < 0) days += 7; var newdt = add_d(ne...
[ "function", "byday", "(", "rules", ",", "dt", ",", "after", ")", "{", "if", "(", "!", "rules", "||", "!", "rules", ".", "length", ")", "return", "dt", ";", "// Generate a list of candiDATES. (HA!)", "var", "candidates", "=", "rules", ".", "map", "(", "fu...
Advance to the next day that satisfies the byday rule...
[ "Advance", "to", "the", "next", "day", "that", "satisfies", "the", "byday", "rule", "..." ]
afe4df6ffcf3ab03f2a854c25c50b1420cf5b4f6
https://github.com/tritech/node-icalendar/blob/afe4df6ffcf3ab03f2a854c25c50b1420cf5b4f6/lib/rrule.js#L540-L578
train
tritech/node-icalendar
spec/icalendar-spec.js
toStr
function toStr(next) { var stream = new Writable(); var str = ""; stream.write = function(chunk) { str += (chunk); }; stream.end = function() { next(str); }; return stream; }
javascript
function toStr(next) { var stream = new Writable(); var str = ""; stream.write = function(chunk) { str += (chunk); }; stream.end = function() { next(str); }; return stream; }
[ "function", "toStr", "(", "next", ")", "{", "var", "stream", "=", "new", "Writable", "(", ")", ";", "var", "str", "=", "\"\"", ";", "stream", ".", "write", "=", "function", "(", "chunk", ")", "{", "str", "+=", "(", "chunk", ")", ";", "}", ";", ...
fake Writable stream to collect the data into a string
[ "fake", "Writable", "stream", "to", "collect", "the", "data", "into", "a", "string" ]
afe4df6ffcf3ab03f2a854c25c50b1420cf5b4f6
https://github.com/tritech/node-icalendar/blob/afe4df6ffcf3ab03f2a854c25c50b1420cf5b4f6/spec/icalendar-spec.js#L24-L34
train
jonschlinkert/update-copyright
index.js
updateYear
function updateYear(context) { return context.dateRange ? utils.updateYear(context.dateRange, String(utils.year())) : utils.year(); }
javascript
function updateYear(context) { return context.dateRange ? utils.updateYear(context.dateRange, String(utils.year())) : utils.year(); }
[ "function", "updateYear", "(", "context", ")", "{", "return", "context", ".", "dateRange", "?", "utils", ".", "updateYear", "(", "context", ".", "dateRange", ",", "String", "(", "utils", ".", "year", "(", ")", ")", ")", ":", "utils", ".", "year", "(", ...
Parse the copyright statement and update the year or year range. @param {Object} `context` @return {String}
[ "Parse", "the", "copyright", "statement", "and", "update", "the", "year", "or", "year", "range", "." ]
5e8197a906a13c4400d777dc982b55216a31aa88
https://github.com/jonschlinkert/update-copyright/blob/5e8197a906a13c4400d777dc982b55216a31aa88/index.js#L37-L41
train
jonschlinkert/update-copyright
index.js
updateCopyright
function updateCopyright(str, context, options) { if (typeof str !== 'string') { options = context; context = str; str = null; } var opts = utils.merge({template: template, copyright: ''}, options); var pkg = opts.pkg || utils.loadPkg.sync(process.cwd()); var engine = new utils.Engine(opts); /...
javascript
function updateCopyright(str, context, options) { if (typeof str !== 'string') { options = context; context = str; str = null; } var opts = utils.merge({template: template, copyright: ''}, options); var pkg = opts.pkg || utils.loadPkg.sync(process.cwd()); var engine = new utils.Engine(opts); /...
[ "function", "updateCopyright", "(", "str", ",", "context", ",", "options", ")", "{", "if", "(", "typeof", "str", "!==", "'string'", ")", "{", "options", "=", "context", ";", "context", "=", "str", ";", "str", "=", "null", ";", "}", "var", "opts", "="...
Update an existing copyright statement, or create a new one if one isn't passed. @param {String} `str` String with copyright statement @param {Object} `context` Context to use for rendering the copyright template @param {Object} `options` @return {String}
[ "Update", "an", "existing", "copyright", "statement", "or", "create", "a", "new", "one", "if", "one", "isn", "t", "passed", "." ]
5e8197a906a13c4400d777dc982b55216a31aa88
https://github.com/jonschlinkert/update-copyright/blob/5e8197a906a13c4400d777dc982b55216a31aa88/index.js#L53-L98
train
cedx/gulp-php-minify
gulpfile.esm.js
_exec
function _exec(command, args = [], options = {}) { return new Promise((fulfill, reject) => spawn(normalize(command), args, {shell: true, stdio: 'inherit', ...options}) .on('close', code => code ? reject(new Error(`${command}: ${code}`)) : fulfill()) ); }
javascript
function _exec(command, args = [], options = {}) { return new Promise((fulfill, reject) => spawn(normalize(command), args, {shell: true, stdio: 'inherit', ...options}) .on('close', code => code ? reject(new Error(`${command}: ${code}`)) : fulfill()) ); }
[ "function", "_exec", "(", "command", ",", "args", "=", "[", "]", ",", "options", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "fulfill", ",", "reject", ")", "=>", "spawn", "(", "normalize", "(", "command", ")", ",", "args", ",", ...
Spawns a new process using the specified command. @param {string} command The command to run. @param {string[]} [args] The command arguments. @param {SpawnOptions} [options] The settings to customize how the process is spawned. @return {Promise<void>} Completes when the command is finally terminated.
[ "Spawns", "a", "new", "process", "using", "the", "specified", "command", "." ]
0ca6499271a056a0951a41377f0c9eb4fae0c5e1
https://github.com/cedx/gulp-php-minify/blob/0ca6499271a056a0951a41377f0c9eb4fae0c5e1/gulpfile.esm.js#L70-L74
train
infinum/mobx-jsonapi-store
dist/NetworkUtils.js
create
function create(store, url, data, headers, options) { return exports.config.storeFetch({ data: data, method: 'POST', options: __assign({}, options, { headers: headers }), store: store, url: url, }); }
javascript
function create(store, url, data, headers, options) { return exports.config.storeFetch({ data: data, method: 'POST', options: __assign({}, options, { headers: headers }), store: store, url: url, }); }
[ "function", "create", "(", "store", ",", "url", ",", "data", ",", "headers", ",", "options", ")", "{", "return", "exports", ".", "config", ".", "storeFetch", "(", "{", "data", ":", "data", ",", "method", ":", "'POST'", ",", "options", ":", "__assign", ...
API call used to create data on the server @export @param {Store} store Related Store @param {string} url API call URL @param {object} [data] Request body @param {IHeaders} [headers] Headers to be sent @param {IRequestOptions} [options] Server options @returns {Promise<Response>} Resolves with a Response object
[ "API", "call", "used", "to", "create", "data", "on", "the", "server" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/NetworkUtils.js#L139-L147
train
infinum/mobx-jsonapi-store
dist/NetworkUtils.js
remove
function remove(store, url, headers, options) { return exports.config.storeFetch({ data: null, method: 'DELETE', options: __assign({}, options, { headers: headers }), store: store, url: url, }); }
javascript
function remove(store, url, headers, options) { return exports.config.storeFetch({ data: null, method: 'DELETE', options: __assign({}, options, { headers: headers }), store: store, url: url, }); }
[ "function", "remove", "(", "store", ",", "url", ",", "headers", ",", "options", ")", "{", "return", "exports", ".", "config", ".", "storeFetch", "(", "{", "data", ":", "null", ",", "method", ":", "'DELETE'", ",", "options", ":", "__assign", "(", "{", ...
API call used to remove data from the server @export @param {Store} store Related Store @param {string} url API call URL @param {IHeaders} [headers] Headers to be sent @param {IRequestOptions} [options] Server options @returns {Promise<Response>} Resolves with a Response object
[ "API", "call", "used", "to", "remove", "data", "from", "the", "server" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/NetworkUtils.js#L180-L188
train
infinum/mobx-jsonapi-store
dist/NetworkUtils.js
fetchLink
function fetchLink(link, store, requestHeaders, options) { if (link) { var href = typeof link === 'object' ? link.href : link; /* istanbul ignore else */ if (href) { return read(store, href, requestHeaders, options); } } return Promise.resolve(new Response_1.Respo...
javascript
function fetchLink(link, store, requestHeaders, options) { if (link) { var href = typeof link === 'object' ? link.href : link; /* istanbul ignore else */ if (href) { return read(store, href, requestHeaders, options); } } return Promise.resolve(new Response_1.Respo...
[ "function", "fetchLink", "(", "link", ",", "store", ",", "requestHeaders", ",", "options", ")", "{", "if", "(", "link", ")", "{", "var", "href", "=", "typeof", "link", "===", "'object'", "?", "link", ".", "href", ":", "link", ";", "/* istanbul ignore els...
Fetch a link from the server @export @param {JsonApi.ILink} link Link URL or a link object @param {Store} store Store that will be used to save the response @param {IDictionary<string>} [requestHeaders] Request headers @param {IRequestOptions} [options] Server options @returns {Promise<LibResponse>} Response promise
[ "Fetch", "a", "link", "from", "the", "server" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/NetworkUtils.js#L200-L209
train
infinum/mobx-jsonapi-store
dist/utils.js
mapItems
function mapItems(data, fn) { return data instanceof Array ? data.map(function (item) { return fn(item); }) : fn(data); }
javascript
function mapItems(data, fn) { return data instanceof Array ? data.map(function (item) { return fn(item); }) : fn(data); }
[ "function", "mapItems", "(", "data", ",", "fn", ")", "{", "return", "data", "instanceof", "Array", "?", "data", ".", "map", "(", "function", "(", "item", ")", "{", "return", "fn", "(", "item", ")", ";", "}", ")", ":", "fn", "(", "data", ")", ";",...
Iterate trough one item or array of items and call the defined function @export @template T @param {(object|Array<object>)} data - Data which needs to be iterated @param {Function} fn - Function that needs to be callse @returns {(T|Array<T>)} - The result of iteration
[ "Iterate", "trough", "one", "item", "or", "array", "of", "items", "and", "call", "the", "defined", "function" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/utils.js#L27-L29
train
infinum/mobx-jsonapi-store
dist/utils.js
flattenRecord
function flattenRecord(record) { var data = { __internal: { id: record.id, type: record.type, }, }; objectForEach(record.attributes, function (key) { data[key] = record.attributes[key]; }); objectForEach(record.relationships, function (key) { v...
javascript
function flattenRecord(record) { var data = { __internal: { id: record.id, type: record.type, }, }; objectForEach(record.attributes, function (key) { data[key] = record.attributes[key]; }); objectForEach(record.relationships, function (key) { v...
[ "function", "flattenRecord", "(", "record", ")", "{", "var", "data", "=", "{", "__internal", ":", "{", "id", ":", "record", ".", "id", ",", "type", ":", "record", ".", "type", ",", "}", ",", "}", ";", "objectForEach", "(", "record", ".", "attributes"...
Flatten the JSON API record so it can be inserted into the model @export @param {IJsonApiRecord} record - original JSON API record @returns {IDictionary<any>} - Flattened object
[ "Flatten", "the", "JSON", "API", "record", "so", "it", "can", "be", "inserted", "into", "the", "model" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/utils.js#L38-L73
train
infinum/mobx-jsonapi-store
dist/utils.js
keys
function keys(obj) { var keyList = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { keyList.push(key); } } return keyList; }
javascript
function keys(obj) { var keyList = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { keyList.push(key); } } return keyList; }
[ "function", "keys", "(", "obj", ")", "{", "var", "keyList", "=", "[", "]", ";", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "keyList", ".", "push", "(", "key", ")", ";", ...
Get all object keys @export @param {object} obj Object to process @returns {Array<string>} List of object keys
[ "Get", "all", "object", "keys" ]
0e30aecf6079af4379b35260ad4b83b169da8adb
https://github.com/infinum/mobx-jsonapi-store/blob/0e30aecf6079af4379b35260ad4b83b169da8adb/dist/utils.js#L128-L136
train
lightsofapollo/superagent-promise
index.js
wrap
function wrap(superagent, Promise) { /** * Request object similar to superagent.Request, but with end() returning * a promise. */ function PromiseRequest() { superagent.Request.apply(this, arguments); } // Inherit form superagent.Request PromiseRequest.prototype = Object.create(superagent.Reques...
javascript
function wrap(superagent, Promise) { /** * Request object similar to superagent.Request, but with end() returning * a promise. */ function PromiseRequest() { superagent.Request.apply(this, arguments); } // Inherit form superagent.Request PromiseRequest.prototype = Object.create(superagent.Reques...
[ "function", "wrap", "(", "superagent", ",", "Promise", ")", "{", "/**\n * Request object similar to superagent.Request, but with end() returning\n * a promise.\n */", "function", "PromiseRequest", "(", ")", "{", "superagent", ".", "Request", ".", "apply", "(", "this", ...
Promise wrapper for superagent
[ "Promise", "wrapper", "for", "superagent" ]
2b83fec676e07af24fb9a62908cca060ae706511
https://github.com/lightsofapollo/superagent-promise/blob/2b83fec676e07af24fb9a62908cca060ae706511/index.js#L5-L124
train
opbeat/opbeat-node
lib/instrumentation/protocol.js
encode
function encode (samples, durations, cb) { var agent = samples.length > 0 ? samples[0]._agent : null var transactions = groupTransactions(samples, durations) var traces = [].concat.apply([], samples.map(function (trans) { return trans.traces })) var groups = groupTraces(traces) var raw = rawTransactions...
javascript
function encode (samples, durations, cb) { var agent = samples.length > 0 ? samples[0]._agent : null var transactions = groupTransactions(samples, durations) var traces = [].concat.apply([], samples.map(function (trans) { return trans.traces })) var groups = groupTraces(traces) var raw = rawTransactions...
[ "function", "encode", "(", "samples", ",", "durations", ",", "cb", ")", "{", "var", "agent", "=", "samples", ".", "length", ">", "0", "?", "samples", "[", "0", "]", ".", "_agent", ":", "null", "var", "transactions", "=", "groupTransactions", "(", "samp...
Encodes recorded transactions into a format expected by the Opbeat intake API. samples: An array containing objects of type Transaction. It's expected that each Transaction have a unique name within a 15ms window based on its duration. durations: An object whos keys are generated by `transactionGroupingKey`. Each val...
[ "Encodes", "recorded", "transactions", "into", "a", "format", "expected", "by", "the", "Opbeat", "intake", "API", "." ]
09c99083d067fe8084a311f69a9655c1e850dbe2
https://github.com/opbeat/opbeat-node/blob/09c99083d067fe8084a311f69a9655c1e850dbe2/lib/instrumentation/protocol.js#L29-L53
train
opbeat/opbeat-node
lib/instrumentation/modules/ioredis.js
wrapInitPromise
function wrapInitPromise (original) { return function wrappedInitPromise () { var command = this var cb = this.callback if (typeof cb === 'function') { this.callback = agent._instrumentation.bindFunction(function wrappedCallback () { var trace = command.__obTrace if (t...
javascript
function wrapInitPromise (original) { return function wrappedInitPromise () { var command = this var cb = this.callback if (typeof cb === 'function') { this.callback = agent._instrumentation.bindFunction(function wrappedCallback () { var trace = command.__obTrace if (t...
[ "function", "wrapInitPromise", "(", "original", ")", "{", "return", "function", "wrappedInitPromise", "(", ")", "{", "var", "command", "=", "this", "var", "cb", "=", "this", ".", "callback", "if", "(", "typeof", "cb", "===", "'function'", ")", "{", "this",...
wrap initPromise to allow us to get notified when the callback to a command is called. If we don't do this we will still get notified because we register a callback with command.promise.finally the wrappedSendCommand, but the finally call will not get fired until the tick after the command.callback have fired, so if th...
[ "wrap", "initPromise", "to", "allow", "us", "to", "get", "notified", "when", "the", "callback", "to", "a", "command", "is", "called", ".", "If", "we", "don", "t", "do", "this", "we", "will", "still", "get", "notified", "because", "we", "register", "a", ...
09c99083d067fe8084a311f69a9655c1e850dbe2
https://github.com/opbeat/opbeat-node/blob/09c99083d067fe8084a311f69a9655c1e850dbe2/lib/instrumentation/modules/ioredis.js#L28-L43
train
stomita/node-salesforce
lib/repl.js
promisify
function promisify(repl) { var _eval = repl.eval; repl.eval = function(cmd, context, filename, callback) { _eval.call(repl, cmd, context, filename, function(err, res) { if (isPromiseLike(res)) { res.then(function(ret) { callback(null, ret); }, function(err) { callback(e...
javascript
function promisify(repl) { var _eval = repl.eval; repl.eval = function(cmd, context, filename, callback) { _eval.call(repl, cmd, context, filename, function(err, res) { if (isPromiseLike(res)) { res.then(function(ret) { callback(null, ret); }, function(err) { callback(e...
[ "function", "promisify", "(", "repl", ")", "{", "var", "_eval", "=", "repl", ".", "eval", ";", "repl", ".", "eval", "=", "function", "(", "cmd", ",", "context", ",", "filename", ",", "callback", ")", "{", "_eval", ".", "call", "(", "repl", ",", "cm...
Intercept the evaled value when it is "promise", and resolve its value before sending back to REPL. @private
[ "Intercept", "the", "evaled", "value", "when", "it", "is", "promise", "and", "resolve", "its", "value", "before", "sending", "back", "to", "REPL", "." ]
3dec6f206e027f2331cc1ffb9037ac3b50996a3f
https://github.com/stomita/node-salesforce/blob/3dec6f206e027f2331cc1ffb9037ac3b50996a3f/lib/repl.js#L12-L28
train
stomita/node-salesforce
lib/repl.js
defineBuiltinVars
function defineBuiltinVars(context) { // define salesforce package root objects for (var key in sf) { if (sf.hasOwnProperty(key) && !global[key]) { context[key] = sf[key]; } } // expose salesforce package root as "$sf" in context. context.$sf = sf; // create default connection object var co...
javascript
function defineBuiltinVars(context) { // define salesforce package root objects for (var key in sf) { if (sf.hasOwnProperty(key) && !global[key]) { context[key] = sf[key]; } } // expose salesforce package root as "$sf" in context. context.$sf = sf; // create default connection object var co...
[ "function", "defineBuiltinVars", "(", "context", ")", "{", "// define salesforce package root objects", "for", "(", "var", "key", "in", "sf", ")", "{", "if", "(", "sf", ".", "hasOwnProperty", "(", "key", ")", "&&", "!", "global", "[", "key", "]", ")", "{",...
Map all node-salesforce object to REPL context @private
[ "Map", "all", "node", "-", "salesforce", "object", "to", "REPL", "context" ]
3dec6f206e027f2331cc1ffb9037ac3b50996a3f
https://github.com/stomita/node-salesforce/blob/3dec6f206e027f2331cc1ffb9037ac3b50996a3f/lib/repl.js#L54-L80
train
stomita/node-salesforce
lib/tooling.js
function(conn) { this._conn = conn; this._logger = conn._logger; var delegates = [ "query", "queryMore", "create", "insert", "retrieve", "update", "upsert", "del", "delete", "destroy", "describe", "describeGlobal", "sobject" ]; delegates.forEach(function(met...
javascript
function(conn) { this._conn = conn; this._logger = conn._logger; var delegates = [ "query", "queryMore", "create", "insert", "retrieve", "update", "upsert", "del", "delete", "destroy", "describe", "describeGlobal", "sobject" ]; delegates.forEach(function(met...
[ "function", "(", "conn", ")", "{", "this", ".", "_conn", "=", "conn", ";", "this", ".", "_logger", "=", "conn", ".", "_logger", ";", "var", "delegates", "=", "[", "\"query\"", ",", "\"queryMore\"", ",", "\"create\"", ",", "\"insert\"", ",", "\"retrieve\"...
API class for Tooling API call @class @param {Connection} conn - Connection
[ "API", "class", "for", "Tooling", "API", "call" ]
3dec6f206e027f2331cc1ffb9037ac3b50996a3f
https://github.com/stomita/node-salesforce/blob/3dec6f206e027f2331cc1ffb9037ac3b50996a3f/lib/tooling.js#L16-L53
train
stomita/node-salesforce
lib/record-stream.js
function() { source.removeListener('record', onRecord); dest.removeListener('drain', onDrain); source.removeListener('end', onEnd); source.removeListener('close', onClose); source.removeListener('error', onError); dest.removeListener('error', onError); source.removeListener('end', cleanup...
javascript
function() { source.removeListener('record', onRecord); dest.removeListener('drain', onDrain); source.removeListener('end', onEnd); source.removeListener('close', onClose); source.removeListener('error', onError); dest.removeListener('error', onError); source.removeListener('end', cleanup...
[ "function", "(", ")", "{", "source", ".", "removeListener", "(", "'record'", ",", "onRecord", ")", ";", "dest", ".", "removeListener", "(", "'drain'", ",", "onDrain", ")", ";", "source", ".", "removeListener", "(", "'end'", ",", "onEnd", ")", ";", "sourc...
remove all the event listeners that were added.
[ "remove", "all", "the", "event", "listeners", "that", "were", "added", "." ]
3dec6f206e027f2331cc1ffb9037ac3b50996a3f
https://github.com/stomita/node-salesforce/blob/3dec6f206e027f2331cc1ffb9037ac3b50996a3f/lib/record-stream.js#L141-L156
train
stomita/node-salesforce
lib/request.js
promisedRequest
function promisedRequest(params, callback) { var deferred = Promise.defer(); var req; var createRequest = function() { if (!req) { req = request(params, function(err, response) { if (err) { deferred.reject(err); } else { deferred.resolve(response); } });...
javascript
function promisedRequest(params, callback) { var deferred = Promise.defer(); var req; var createRequest = function() { if (!req) { req = request(params, function(err, response) { if (err) { deferred.reject(err); } else { deferred.resolve(response); } });...
[ "function", "promisedRequest", "(", "params", ",", "callback", ")", "{", "var", "deferred", "=", "Promise", ".", "defer", "(", ")", ";", "var", "req", ";", "var", "createRequest", "=", "function", "(", ")", "{", "if", "(", "!", "req", ")", "{", "req"...
HTTP request method, returns promise instead of stream @private
[ "HTTP", "request", "method", "returns", "promise", "instead", "of", "stream" ]
3dec6f206e027f2331cc1ffb9037ac3b50996a3f
https://github.com/stomita/node-salesforce/blob/3dec6f206e027f2331cc1ffb9037ac3b50996a3f/lib/request.js#L10-L26
train
opbeat/opbeat-node
lib/parsers.js
setCulprit
function setCulprit (payload) { if (payload.culprit) return // skip if user provided a custom culprit var frames = payload.stacktrace.frames var filename = frames[0].filename var fnName = frames[0].function for (var n = 0; n < frames.length; n++) { if (frames[n].in_app) { filename = frames[n].filena...
javascript
function setCulprit (payload) { if (payload.culprit) return // skip if user provided a custom culprit var frames = payload.stacktrace.frames var filename = frames[0].filename var fnName = frames[0].function for (var n = 0; n < frames.length; n++) { if (frames[n].in_app) { filename = frames[n].filena...
[ "function", "setCulprit", "(", "payload", ")", "{", "if", "(", "payload", ".", "culprit", ")", "return", "// skip if user provided a custom culprit", "var", "frames", "=", "payload", ".", "stacktrace", ".", "frames", "var", "filename", "=", "frames", "[", "0", ...
Default `culprit` to the top of the stack or the highest `in_app` frame if such exists
[ "Default", "culprit", "to", "the", "top", "of", "the", "stack", "or", "the", "highest", "in_app", "frame", "if", "such", "exists" ]
09c99083d067fe8084a311f69a9655c1e850dbe2
https://github.com/opbeat/opbeat-node/blob/09c99083d067fe8084a311f69a9655c1e850dbe2/lib/parsers.js#L193-L206
train
opbeat/opbeat-node
lib/request.js
capturePayload
function capturePayload (endpoint, payload) { var dumpfile = path.join(os.tmpdir(), 'opbeat-' + endpoint + '-' + Date.now() + '.json') fs.writeFile(dumpfile, JSON.stringify(payload), function (err) { if (err) console.log('could not capture intake payload: %s', err.message) else console.log('intake payload c...
javascript
function capturePayload (endpoint, payload) { var dumpfile = path.join(os.tmpdir(), 'opbeat-' + endpoint + '-' + Date.now() + '.json') fs.writeFile(dumpfile, JSON.stringify(payload), function (err) { if (err) console.log('could not capture intake payload: %s', err.message) else console.log('intake payload c...
[ "function", "capturePayload", "(", "endpoint", ",", "payload", ")", "{", "var", "dumpfile", "=", "path", ".", "join", "(", "os", ".", "tmpdir", "(", ")", ",", "'opbeat-'", "+", "endpoint", "+", "'-'", "+", "Date", ".", "now", "(", ")", "+", "'.json'"...
Used only for debugging data sent to the intake API
[ "Used", "only", "for", "debugging", "data", "sent", "to", "the", "intake", "API" ]
09c99083d067fe8084a311f69a9655c1e850dbe2
https://github.com/opbeat/opbeat-node/blob/09c99083d067fe8084a311f69a9655c1e850dbe2/lib/request.js#L138-L144
train
Esri/terraformer-arcgis-parser
examples/terraformer-arcgis-fileparser.js
tryRead
function tryRead(fd, buff, offset, length) { return new Promise((resolve, reject) => { fs.read(fd, buff, offset, length, null, (err, bytesRead, buffer) => { if (err) return reject(err); const buffLen = buffer.length; offset += bytesRead; if (offset >= buffLen) return resolve(buff); i...
javascript
function tryRead(fd, buff, offset, length) { return new Promise((resolve, reject) => { fs.read(fd, buff, offset, length, null, (err, bytesRead, buffer) => { if (err) return reject(err); const buffLen = buffer.length; offset += bytesRead; if (offset >= buffLen) return resolve(buff); i...
[ "function", "tryRead", "(", "fd", ",", "buff", ",", "offset", ",", "length", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "fs", ".", "read", "(", "fd", ",", "buff", ",", "offset", ",", "length", ",", "...
Reads file by chunkSize at a time. Will resolve with the buffer if it's full, otherwise will resolve with nothing, indicating another read should happen.
[ "Reads", "file", "by", "chunkSize", "at", "a", "time", ".", "Will", "resolve", "with", "the", "buffer", "if", "it", "s", "full", "otherwise", "will", "resolve", "with", "nothing", "indicating", "another", "read", "should", "happen", "." ]
c7af3110f8219db6605a111844f0febb46cf8e9e
https://github.com/Esri/terraformer-arcgis-parser/blob/c7af3110f8219db6605a111844f0febb46cf8e9e/examples/terraformer-arcgis-fileparser.js#L58-L76
train
grow/airkit
modal/index.js
Modal
function Modal(config) { this.config = config; this.timers_ = []; this.scrollY = 0; this.initDom_(); var closeAttribute = 'data-' + this.config.className + '-x'; var closeClass = this.config.className + '-x'; var data = 'data-' + this.config.className + '-id'; var func = function(targetEl, e) { va...
javascript
function Modal(config) { this.config = config; this.timers_ = []; this.scrollY = 0; this.initDom_(); var closeAttribute = 'data-' + this.config.className + '-x'; var closeClass = this.config.className + '-x'; var data = 'data-' + this.config.className + '-id'; var func = function(targetEl, e) { va...
[ "function", "Modal", "(", "config", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "timers_", "=", "[", "]", ";", "this", ".", "scrollY", "=", "0", ";", "this", ".", "initDom_", "(", ")", ";", "var", "closeAttribute", "=", "'data...
Modal dialog. @constructor
[ "Modal", "dialog", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/modal/index.js#L30-L54
train
grow/airkit
modal/index.js
init
function init(opt_config) { if (modalInstance) { return; } var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } modalInstance = new Modal(config); }
javascript
function init(opt_config) { if (modalInstance) { return; } var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } modalInstance = new Modal(config); }
[ "function", "init", "(", "opt_config", ")", "{", "if", "(", "modalInstance", ")", "{", "return", ";", "}", "var", "config", "=", "objects", ".", "clone", "(", "defaultConfig", ")", ";", "if", "(", "opt_config", ")", "{", "objects", ".", "merge", "(", ...
Initializes a modal dialog singleton. @param {Object=} opt_config Config options.
[ "Initializes", "a", "modal", "dialog", "singleton", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/modal/index.js#L290-L300
train
grow/airkit
scrolldelegator/index.js
start
function start() { if (isStarted()) { return; } // Debounce the scroll event by executing the onScroll callback using a timed // interval. window.addEventListener('scroll', onScroll_, {'passive': true}); interval = window.setInterval(function() { if (scrolled) { for (var i = 0, delegate; dele...
javascript
function start() { if (isStarted()) { return; } // Debounce the scroll event by executing the onScroll callback using a timed // interval. window.addEventListener('scroll', onScroll_, {'passive': true}); interval = window.setInterval(function() { if (scrolled) { for (var i = 0, delegate; dele...
[ "function", "start", "(", ")", "{", "if", "(", "isStarted", "(", ")", ")", "{", "return", ";", "}", "// Debounce the scroll event by executing the onScroll callback using a timed", "// interval.", "window", ".", "addEventListener", "(", "'scroll'", ",", "onScroll_", "...
Starts the scroll listener.
[ "Starts", "the", "scroll", "listener", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/scrolldelegator/index.js#L41-L57
train
grow/airkit
utils/uri.js
getParameterValue
function getParameterValue(key, opt_uri) { var uri = opt_uri || window.location.href; key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); var regex = new RegExp('[\\?&]' + key + '=([^&#]*)'); var results = regex.exec(uri); var result = results === null ? null : results[1]; return result ? urlDecode_(...
javascript
function getParameterValue(key, opt_uri) { var uri = opt_uri || window.location.href; key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]'); var regex = new RegExp('[\\?&]' + key + '=([^&#]*)'); var results = regex.exec(uri); var result = results === null ? null : results[1]; return result ? urlDecode_(...
[ "function", "getParameterValue", "(", "key", ",", "opt_uri", ")", "{", "var", "uri", "=", "opt_uri", "||", "window", ".", "location", ".", "href", ";", "key", "=", "key", ".", "replace", "(", "/", "[\\[]", "/", ",", "'\\\\\\['", ")", ".", "replace", ...
Returns the value of a key in a query string.
[ "Returns", "the", "value", "of", "a", "key", "in", "a", "query", "string", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/uri.js#L11-L18
train
grow/airkit
utils/uri.js
updateParamsFromUrl
function updateParamsFromUrl(config) { // If there is no query string in the URL, then there's nothing to do in this // function, so break early. if (!location.search) { return; } var c = objects.clone(UpdateParamsFromUrlDefaultConfig); objects.merge(c, config); var selector = c.selector; var attr ...
javascript
function updateParamsFromUrl(config) { // If there is no query string in the URL, then there's nothing to do in this // function, so break early. if (!location.search) { return; } var c = objects.clone(UpdateParamsFromUrlDefaultConfig); objects.merge(c, config); var selector = c.selector; var attr ...
[ "function", "updateParamsFromUrl", "(", "config", ")", "{", "// If there is no query string in the URL, then there's nothing to do in this", "// function, so break early.", "if", "(", "!", "location", ".", "search", ")", "{", "return", ";", "}", "var", "c", "=", "objects"...
Updates the URL attribute of elements with query params from the current URL. @param {Object} config Config object. Properties are: selector: CSS query selector of elements to act upon. attr: The element attribute to update. params: A list of URL params (string or RegExp) to set on the element attr from the current URL...
[ "Updates", "the", "URL", "attribute", "of", "elements", "with", "query", "params", "from", "the", "current", "URL", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/uri.js#L37-L94
train
grow/airkit
utils/uri.js
parseQueryString
function parseQueryString(query, callback) { // Break early for empty string. if (!query) { return; } // Remove leading `?` so that callers can pass `location.search` directly to // this function. if (query.startsWith('?')) { query = query.slice(1); } var pairs = query.split('&'); for (var i ...
javascript
function parseQueryString(query, callback) { // Break early for empty string. if (!query) { return; } // Remove leading `?` so that callers can pass `location.search` directly to // this function. if (query.startsWith('?')) { query = query.slice(1); } var pairs = query.split('&'); for (var i ...
[ "function", "parseQueryString", "(", "query", ",", "callback", ")", "{", "// Break early for empty string.", "if", "(", "!", "query", ")", "{", "return", ";", "}", "// Remove leading `?` so that callers can pass `location.search` directly to", "// this function.", "if", "("...
Parses a query string and calls a callback function for every key-value pair found in the string. @param {string} query Query string (without the leading question mark). @param {function(string, string)} callback Function called for every key-value pair found in the query string.
[ "Parses", "a", "query", "string", "and", "calls", "a", "callback", "function", "for", "every", "key", "-", "value", "pair", "found", "in", "the", "string", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/uri.js#L104-L128
train
grow/airkit
utils/uri.js
parseQueryMap
function parseQueryMap(query) { var map = {}; parseQueryString(query, function(key, value) { map[key] = value; }); return map; }
javascript
function parseQueryMap(query) { var map = {}; parseQueryString(query, function(key, value) { map[key] = value; }); return map; }
[ "function", "parseQueryMap", "(", "query", ")", "{", "var", "map", "=", "{", "}", ";", "parseQueryString", "(", "query", ",", "function", "(", "key", ",", "value", ")", "{", "map", "[", "key", "]", "=", "value", ";", "}", ")", ";", "return", "map",...
Parses a query string and returns a map of key-value pairs. @param {string} query Query string (without the leading question mark). @return {Object} Map of key-value pairs.
[ "Parses", "a", "query", "string", "and", "returns", "a", "map", "of", "key", "-", "value", "pairs", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/uri.js#L136-L142
train
grow/airkit
utils/uri.js
encodeQueryMap
function encodeQueryMap(map) { var params = []; for (var key in map) { var value = map[key]; params.push(key + '=' + urlEncode_(value)); } return params.join('&'); }
javascript
function encodeQueryMap(map) { var params = []; for (var key in map) { var value = map[key]; params.push(key + '=' + urlEncode_(value)); } return params.join('&'); }
[ "function", "encodeQueryMap", "(", "map", ")", "{", "var", "params", "=", "[", "]", ";", "for", "(", "var", "key", "in", "map", ")", "{", "var", "value", "=", "map", "[", "key", "]", ";", "params", ".", "push", "(", "key", "+", "'='", "+", "url...
Returns a URL-encoded query string from a map of key-value pairs. @param {Object} map Map of key-value pairs. @return {string} URL-encoded query string.
[ "Returns", "a", "URL", "-", "encoded", "query", "string", "from", "a", "map", "of", "key", "-", "value", "pairs", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/uri.js#L150-L157
train
grow/airkit
dates/datetoggle.js
initStyle
function initStyle(opt_config) { var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } var attrName = config.attributeName; var selector = '[' + attrName + ']'; var rules = {}; rules[selector] = {'display': 'none !important'}; ui.createStyle(rules); }
javascript
function initStyle(opt_config) { var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } var attrName = config.attributeName; var selector = '[' + attrName + ']'; var rules = {}; rules[selector] = {'display': 'none !important'}; ui.createStyle(rules); }
[ "function", "initStyle", "(", "opt_config", ")", "{", "var", "config", "=", "objects", ".", "clone", "(", "defaultConfig", ")", ";", "if", "(", "opt_config", ")", "{", "objects", ".", "merge", "(", "config", ",", "opt_config", ")", ";", "}", "var", "at...
Creates the styles used for toggling dates. Permits usage of datetoggle without needing to manually add styles to the page. You can optionally call this at the top of the page to avoid FOUC.
[ "Creates", "the", "styles", "used", "for", "toggling", "dates", ".", "Permits", "usage", "of", "datetoggle", "without", "needing", "to", "manually", "add", "styles", "to", "the", "page", ".", "You", "can", "optionally", "call", "this", "at", "the", "top", ...
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/dates/datetoggle.js#L63-L73
train
grow/airkit
utils/events.js
getDelegateFunction_
function getDelegateFunction_(listener) { if (!delegateFunctionMap.has(listener)) { var delegateFunction = function(e) { e = e || window.event; var target = e.target || e.srcElement; target = target.nodeType === 3 ? target.parentNode : target; do { listener(target, ...
javascript
function getDelegateFunction_(listener) { if (!delegateFunctionMap.has(listener)) { var delegateFunction = function(e) { e = e || window.event; var target = e.target || e.srcElement; target = target.nodeType === 3 ? target.parentNode : target; do { listener(target, ...
[ "function", "getDelegateFunction_", "(", "listener", ")", "{", "if", "(", "!", "delegateFunctionMap", ".", "has", "(", "listener", ")", ")", "{", "var", "delegateFunction", "=", "function", "(", "e", ")", "{", "e", "=", "e", "||", "window", ".", "event",...
Creates the delegate function that gets added during addDelegatedListener. @param {Function} listener Listener function. @private
[ "Creates", "the", "delegate", "function", "that", "gets", "added", "during", "addDelegatedListener", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/events.js#L38-L55
train
grow/airkit
utils/events.js
addDelegatedListener
function addDelegatedListener(el, type, listener) { incrementListenerCount(listener); return el.addEventListener(type, getDelegateFunction_(listener)); }
javascript
function addDelegatedListener(el, type, listener) { incrementListenerCount(listener); return el.addEventListener(type, getDelegateFunction_(listener)); }
[ "function", "addDelegatedListener", "(", "el", ",", "type", ",", "listener", ")", "{", "incrementListenerCount", "(", "listener", ")", ";", "return", "el", ".", "addEventListener", "(", "type", ",", "getDelegateFunction_", "(", "listener", ")", ")", ";", "}" ]
Adds an event listener to an element where the event target is discovered by moving up the clicked element's descendants. @param {Element} el Element to host the listener. @param {string} type Listener type. @param {Function} listener Listener function.
[ "Adds", "an", "event", "listener", "to", "an", "element", "where", "the", "event", "target", "is", "discovered", "by", "moving", "up", "the", "clicked", "element", "s", "descendants", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/events.js#L64-L67
train
grow/airkit
utils/events.js
removeDelegatedListener
function removeDelegatedListener(el, type, listener) { var delegate = getDelegateFunction_(listener); decrementListenerCount(listener); if (getListenerCount(listener) <= 0) { delegateFunctionMap.delete(listener); } return el.removeEventListener(type, delegate); }
javascript
function removeDelegatedListener(el, type, listener) { var delegate = getDelegateFunction_(listener); decrementListenerCount(listener); if (getListenerCount(listener) <= 0) { delegateFunctionMap.delete(listener); } return el.removeEventListener(type, delegate); }
[ "function", "removeDelegatedListener", "(", "el", ",", "type", ",", "listener", ")", "{", "var", "delegate", "=", "getDelegateFunction_", "(", "listener", ")", ";", "decrementListenerCount", "(", "listener", ")", ";", "if", "(", "getListenerCount", "(", "listene...
Removes an event listener to an element where the event target is discovered by moving up the clicked element's descendants. @param {Element} el Element to host the listener. @param {string} type Listener type. @param {Function} listener Listener function.
[ "Removes", "an", "event", "listener", "to", "an", "element", "where", "the", "event", "target", "is", "discovered", "by", "moving", "up", "the", "clicked", "element", "s", "descendants", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/events.js#L76-L83
train
grow/airkit
ui/inview.js
function(selector, opt_offset, opt_delay) { this.selector = selector; this.offset = opt_offset || null; this.delay = opt_delay || 0; // Ensure all videos are loaded. var els = document.querySelectorAll(this.selector); [].forEach.call(els, function(el) { el.load(); }); }
javascript
function(selector, opt_offset, opt_delay) { this.selector = selector; this.offset = opt_offset || null; this.delay = opt_delay || 0; // Ensure all videos are loaded. var els = document.querySelectorAll(this.selector); [].forEach.call(els, function(el) { el.load(); }); }
[ "function", "(", "selector", ",", "opt_offset", ",", "opt_delay", ")", "{", "this", ".", "selector", "=", "selector", ";", "this", ".", "offset", "=", "opt_offset", "||", "null", ";", "this", ".", "delay", "=", "opt_delay", "||", "0", ";", "// Ensure all...
Plays videos when they enter the viewport. @param {string} selector Query selector to find elements to act upon. @param {number=} opt_offset Offset (by percentage of the element) to apply when checking if the element is in view. @param {Array.<number>=} opt_delay An array of [min delay, max delay].
[ "Plays", "videos", "when", "they", "enter", "the", "viewport", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/ui/inview.js#L94-L104
train
lantiga/ki
editor/scripts/escope.js
Variable
function Variable(name, scope) { /** * The variable name, as given in the source code. * @member {String} Variable#name */ this.name = name; /** * List of defining occurrences of this variable (like in 'var ...' * statements or as parameter), as AS...
javascript
function Variable(name, scope) { /** * The variable name, as given in the source code. * @member {String} Variable#name */ this.name = name; /** * List of defining occurrences of this variable (like in 'var ...' * statements or as parameter), as AS...
[ "function", "Variable", "(", "name", ",", "scope", ")", "{", "/** \n * The variable name, as given in the source code.\n * @member {String} Variable#name \n */", "this", ".", "name", "=", "name", ";", "/**\n * List of defining occurrences of this variab...
A Variable represents a locally scoped identifier. These include arguments to functions. @class Variable
[ "A", "Variable", "represents", "a", "locally", "scoped", "identifier", ".", "These", "include", "arguments", "to", "functions", "." ]
5c2fdfc5f0ad9d6ea88161962604550193f5d6db
https://github.com/lantiga/ki/blob/5c2fdfc5f0ad9d6ea88161962604550193f5d6db/editor/scripts/escope.js#L282-L328
train
grow/airkit
youtubemodal/index.js
YouTubeModal
function YouTubeModal(config) { this.config = config; this.parentElement = document.querySelector(this.config.parentSelector); this.closeEventListener_ = this.setActive_.bind(this, false); this.popstateListener_ = this.onHistoryChange_.bind(this); this.el_ = null; this.closeEl_ = null; this.attributionEl_...
javascript
function YouTubeModal(config) { this.config = config; this.parentElement = document.querySelector(this.config.parentSelector); this.closeEventListener_ = this.setActive_.bind(this, false); this.popstateListener_ = this.onHistoryChange_.bind(this); this.el_ = null; this.closeEl_ = null; this.attributionEl_...
[ "function", "YouTubeModal", "(", "config", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "parentElement", "=", "document", ".", "querySelector", "(", "this", ".", "config", ".", "parentSelector", ")", ";", "this", ".", "closeEventListener...
Plays a YouTube video in a modal dialog. @constructor
[ "Plays", "a", "YouTube", "video", "in", "a", "modal", "dialog", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/youtubemodal/index.js#L39-L74
train
grow/airkit
youtubemodal/index.js
init
function init(opt_config) { if (singleton) { return; } var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } singleton = new YouTubeModal(config); }
javascript
function init(opt_config) { if (singleton) { return; } var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } singleton = new YouTubeModal(config); }
[ "function", "init", "(", "opt_config", ")", "{", "if", "(", "singleton", ")", "{", "return", ";", "}", "var", "config", "=", "objects", ".", "clone", "(", "defaultConfig", ")", ";", "if", "(", "opt_config", ")", "{", "objects", ".", "merge", "(", "co...
Initializes a YouTube modal dialog singleton. @param {Object=} opt_config Config options.
[ "Initializes", "a", "YouTube", "modal", "dialog", "singleton", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/youtubemodal/index.js#L263-L273
train
grow/airkit
analytics/googlecontentexperiments.js
init
function init(opt_config) { var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } initVariations(config); }
javascript
function init(opt_config) { var config = objects.clone(defaultConfig); if (opt_config) { objects.merge(config, opt_config); } initVariations(config); }
[ "function", "init", "(", "opt_config", ")", "{", "var", "config", "=", "objects", ".", "clone", "(", "defaultConfig", ")", ";", "if", "(", "opt_config", ")", "{", "objects", ".", "merge", "(", "config", ",", "opt_config", ")", ";", "}", "initVariations",...
Loads GCX library and then initializes variations.
[ "Loads", "GCX", "library", "and", "then", "initializes", "variations", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/analytics/googlecontentexperiments.js#L19-L25
train
grow/airkit
dynamicdata/index.js
processStagingResp
function processStagingResp(resp, now, evergreen) { var keysToData = {}; for (var key in resp) { [].forEach.call(resp[key], function(datedRow) { var start = datedRow['start_date'] ? new Date(datedRow['start_date']) : null; var end = datedRow['end_date'] ? new Date(datedRow['end_date']) : null; ...
javascript
function processStagingResp(resp, now, evergreen) { var keysToData = {}; for (var key in resp) { [].forEach.call(resp[key], function(datedRow) { var start = datedRow['start_date'] ? new Date(datedRow['start_date']) : null; var end = datedRow['end_date'] ? new Date(datedRow['end_date']) : null; ...
[ "function", "processStagingResp", "(", "resp", ",", "now", ",", "evergreen", ")", "{", "var", "keysToData", "=", "{", "}", ";", "for", "(", "var", "key", "in", "resp", ")", "{", "[", "]", ".", "forEach", ".", "call", "(", "resp", "[", "key", "]", ...
Normalizes staging data to become the same format as prod data.
[ "Normalizes", "staging", "data", "to", "become", "the", "same", "format", "as", "prod", "data", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/dynamicdata/index.js#L37-L54
train
grow/airkit
gulp/compilejs.js
compilejs
function compilejs(sources, outdir, outfile, opt_options) { var bundler = browserify({ entries: sources, debug: false }); return rebundle_(bundler, outdir, outfile, opt_options); }
javascript
function compilejs(sources, outdir, outfile, opt_options) { var bundler = browserify({ entries: sources, debug: false }); return rebundle_(bundler, outdir, outfile, opt_options); }
[ "function", "compilejs", "(", "sources", ",", "outdir", ",", "outfile", ",", "opt_options", ")", "{", "var", "bundler", "=", "browserify", "(", "{", "entries", ":", "sources", ",", "debug", ":", "false", "}", ")", ";", "return", "rebundle_", "(", "bundle...
Compiles js code using browserify and uglify. @param {Array.<string>} sources List of JS source files. @param {string} outdir Output directory. @param {string} outfile Output file name. @param {Object=} opt_options Options.
[ "Compiles", "js", "code", "using", "browserify", "and", "uglify", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/gulp/compilejs.js#L17-L23
train
grow/airkit
gulp/compilejs.js
watchjs
function watchjs(sources, outdir, outfile, opt_options) { var bundler = watchify(browserify({ entries: sources, debug: false, // Watchify options: cache: {}, packageCache: {}, fullPaths: true })); bundler.on('update', function() { gutil.log('recompiling js...'); rebundle_(bundler,...
javascript
function watchjs(sources, outdir, outfile, opt_options) { var bundler = watchify(browserify({ entries: sources, debug: false, // Watchify options: cache: {}, packageCache: {}, fullPaths: true })); bundler.on('update', function() { gutil.log('recompiling js...'); rebundle_(bundler,...
[ "function", "watchjs", "(", "sources", ",", "outdir", ",", "outfile", ",", "opt_options", ")", "{", "var", "bundler", "=", "watchify", "(", "browserify", "(", "{", "entries", ":", "sources", ",", "debug", ":", "false", ",", "// Watchify options:", "cache", ...
Watches JS code for changes and triggers compilation. @param {Array.<string>} sources List of JS source files. @param {string} outdir Output directory. @param {string} outfile Output file name. @param {Object=} opt_options Options.
[ "Watches", "JS", "code", "for", "changes", "and", "triggers", "compilation", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/gulp/compilejs.js#L33-L49
train
grow/airkit
utils/dom.js
createDom
function createDom(tagName, opt_className) { var element = document.createElement(tagName); if (opt_className) { element.className = opt_className; } return element; }
javascript
function createDom(tagName, opt_className) { var element = document.createElement(tagName); if (opt_className) { element.className = opt_className; } return element; }
[ "function", "createDom", "(", "tagName", ",", "opt_className", ")", "{", "var", "element", "=", "document", ".", "createElement", "(", "tagName", ")", ";", "if", "(", "opt_className", ")", "{", "element", ".", "className", "=", "opt_className", ";", "}", "...
Creates a dom element and optionally adds a class name. @param {string} tagName Element's tag name. @param {string?} opt_className Class name to add. @return {Element} Created element.
[ "Creates", "a", "dom", "element", "and", "optionally", "adds", "a", "class", "name", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/dom.js#L7-L13
train
grow/airkit
scrolltoggle/index.js
ScrollToggle
function ScrollToggle(el, config) { this.el_ = el; this.config_ = objects.clone(config); if (this.el_.hasAttribute('data-ak-scrolltoggle')) { var elConfig = JSON.parse(this.el_.getAttribute('data-ak-scrolltoggle')); if (elConfig && typeof elConfig === 'object') { objects.merge(this.config_, elConfi...
javascript
function ScrollToggle(el, config) { this.el_ = el; this.config_ = objects.clone(config); if (this.el_.hasAttribute('data-ak-scrolltoggle')) { var elConfig = JSON.parse(this.el_.getAttribute('data-ak-scrolltoggle')); if (elConfig && typeof elConfig === 'object') { objects.merge(this.config_, elConfi...
[ "function", "ScrollToggle", "(", "el", ",", "config", ")", "{", "this", ".", "el_", "=", "el", ";", "this", ".", "config_", "=", "objects", ".", "clone", "(", "config", ")", ";", "if", "(", "this", ".", "el_", ".", "hasAttribute", "(", "'data-ak-scro...
Toggles a class on an element when a scroll direction has been detected. @param {Element} el The element. @param {Object} config Config options. @constructor
[ "Toggles", "a", "class", "on", "an", "element", "when", "a", "scroll", "direction", "has", "been", "detected", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/scrolltoggle/index.js#L29-L43
train
RiptideElements/passport-google-auth
lib/GoogleOAuth2Strategy.js
GoogleOAuth2Strategy
function GoogleOAuth2Strategy(options, verify) { var self = this; if (typeof options === 'function') { verify = options; options = {}; } if (!verify) { throw new Error('GoogleOAuth2Strategy requires a verify callback'); } requiredArgs...
javascript
function GoogleOAuth2Strategy(options, verify) { var self = this; if (typeof options === 'function') { verify = options; options = {}; } if (!verify) { throw new Error('GoogleOAuth2Strategy requires a verify callback'); } requiredArgs...
[ "function", "GoogleOAuth2Strategy", "(", "options", ",", "verify", ")", "{", "var", "self", "=", "this", ";", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "verify", "=", "options", ";", "options", "=", "{", "}", ";", "}", "if", "(", ...
Creates an instance of `GoogleOAuth2Strategy`. The Google OAuth 2.0 authentication strategy authenticates requests by delegating to Google's OAuth 2.0 authentication implementation in their Node.JS API. OAuth 2.0 provides a facility for delegated authentication, whereby users can authenticate using a third-party ser...
[ "Creates", "an", "instance", "of", "GoogleOAuth2Strategy", "." ]
ff29996480c1a55e44411b84a12b0242c8bb6e8d
https://github.com/RiptideElements/passport-google-auth/blob/ff29996480c1a55e44411b84a12b0242c8bb6e8d/lib/GoogleOAuth2Strategy.js#L111-L153
train
grow/airkit
utils/video.js
initVideoFallback
function initVideoFallback(opt_config) { var videoSelector = (opt_config && opt_config.videoSelector) || defaultConfig.fallbackVideoSelector; var imageSelector = (opt_config && opt_config.imageSelector) || defaultConfig.fallbackImageSelector; var breakpoint = (opt_config && opt_config.breakpoint) ...
javascript
function initVideoFallback(opt_config) { var videoSelector = (opt_config && opt_config.videoSelector) || defaultConfig.fallbackVideoSelector; var imageSelector = (opt_config && opt_config.imageSelector) || defaultConfig.fallbackImageSelector; var breakpoint = (opt_config && opt_config.breakpoint) ...
[ "function", "initVideoFallback", "(", "opt_config", ")", "{", "var", "videoSelector", "=", "(", "opt_config", "&&", "opt_config", ".", "videoSelector", ")", "||", "defaultConfig", ".", "fallbackVideoSelector", ";", "var", "imageSelector", "=", "(", "opt_config", "...
Shows or hides video elements and their corresponding image elements depending on whether the user agent can play video. Fallback is only implemented between video and images, not video formats. You should rely on the video element's default behavior with <source> tags to support fallback between video formats. As a r...
[ "Shows", "or", "hides", "video", "elements", "and", "their", "corresponding", "image", "elements", "depending", "on", "whether", "the", "user", "agent", "can", "play", "video", "." ]
870204d7512237c6ac5712ccc5583b81d6cd2d17
https://github.com/grow/airkit/blob/870204d7512237c6ac5712ccc5583b81d6cd2d17/utils/video.js#L49-L76
train
nohros/nsPopover
src/nsPopover.js
adjustRect
function adjustRect(rect, adjustX, adjustY, ev) { // if pageX or pageY is defined we need to lock the popover to the given // x and y position. // clone the rect, so we can manipulate its properties. var localRect = { bottom: rect.bottom, ...
javascript
function adjustRect(rect, adjustX, adjustY, ev) { // if pageX or pageY is defined we need to lock the popover to the given // x and y position. // clone the rect, so we can manipulate its properties. var localRect = { bottom: rect.bottom, ...
[ "function", "adjustRect", "(", "rect", ",", "adjustX", ",", "adjustY", ",", "ev", ")", "{", "// if pageX or pageY is defined we need to lock the popover to the given\r", "// x and y position.\r", "// clone the rect, so we can manipulate its properties.\r", "var", "localRect", "=", ...
Adjust a rect accordingly to the given x and y mouse positions. @param rect {ClientRect} The rect to be adjusted.
[ "Adjust", "a", "rect", "accordingly", "to", "the", "given", "x", "and", "y", "mouse", "positions", "." ]
0d768929a4590f9602c87851dca0df54d19d069a
https://github.com/nohros/nsPopover/blob/0d768929a4590f9602c87851dca0df54d19d069a/src/nsPopover.js#L144-L170
train
nohros/nsPopover
src/nsPopover.js
loadTemplate
function loadTemplate(template, plain) { if (!template) { return ''; } if (angular.isString(template) && plain) { return template; } return $templateCache.get(template) || $http.get(template, { cache : true }); ...
javascript
function loadTemplate(template, plain) { if (!template) { return ''; } if (angular.isString(template) && plain) { return template; } return $templateCache.get(template) || $http.get(template, { cache : true }); ...
[ "function", "loadTemplate", "(", "template", ",", "plain", ")", "{", "if", "(", "!", "template", ")", "{", "return", "''", ";", "}", "if", "(", "angular", ".", "isString", "(", "template", ")", "&&", "plain", ")", "{", "return", "template", ";", "}",...
Load the given template in the cache if it is not already loaded. @param template The URI of the template to be loaded. @returns {String} A promise that the template will be loaded. @remarks If the template is null or undefined a empty string will be returned.
[ "Load", "the", "given", "template", "in", "the", "cache", "if", "it", "is", "not", "already", "loaded", "." ]
0d768929a4590f9602c87851dca0df54d19d069a
https://github.com/nohros/nsPopover/blob/0d768929a4590f9602c87851dca0df54d19d069a/src/nsPopover.js#L225-L235
train
nohros/nsPopover
src/nsPopover.js
move
function move(popover, placement, align, rect, triangle) { var containerRect; var popoverRect = getBoundingClientRect(popover[0]); var popoverRight; var top, left; var positionX = function() { if (align === 'center') { re...
javascript
function move(popover, placement, align, rect, triangle) { var containerRect; var popoverRect = getBoundingClientRect(popover[0]); var popoverRight; var top, left; var positionX = function() { if (align === 'center') { re...
[ "function", "move", "(", "popover", ",", "placement", ",", "align", ",", "rect", ",", "triangle", ")", "{", "var", "containerRect", ";", "var", "popoverRect", "=", "getBoundingClientRect", "(", "popover", "[", "0", "]", ")", ";", "var", "popoverRight", ";"...
Move the popover to the |placement| position of the object located on the |rect|. @param popover {Object} The popover object to be moved. @param placement {String} The relative position to move the popover - top | bottom | left | right. @param align {String} The way the popover should be aligned - center | left | righ...
[ "Move", "the", "popover", "to", "the", "|placement|", "position", "of", "the", "object", "located", "on", "the", "|rect|", "." ]
0d768929a4590f9602c87851dca0df54d19d069a
https://github.com/nohros/nsPopover/blob/0d768929a4590f9602c87851dca0df54d19d069a/src/nsPopover.js#L246-L312
train
nohros/nsPopover
src/nsPopover.js
function(delay, e) { // Disable popover if ns-popover value is false if ($parse(attrs.nsPopover)(scope) === false) { return; } $timeout.cancel(displayer_.id_); if (!isDef(delay)) { delay = 0; ...
javascript
function(delay, e) { // Disable popover if ns-popover value is false if ($parse(attrs.nsPopover)(scope) === false) { return; } $timeout.cancel(displayer_.id_); if (!isDef(delay)) { delay = 0; ...
[ "function", "(", "delay", ",", "e", ")", "{", "// Disable popover if ns-popover value is false\r", "if", "(", "$parse", "(", "attrs", ".", "nsPopover", ")", "(", "scope", ")", "===", "false", ")", "{", "return", ";", "}", "$timeout", ".", "cancel", "(", "d...
Set the display property of the popover to 'block' after |delay| milliseconds. @param delay {Number} The time (in seconds) to wait before set the display property. @param e {Event} The event which caused the popover to be shown.
[ "Set", "the", "display", "property", "of", "the", "popover", "to", "block", "after", "|delay|", "milliseconds", "." ]
0d768929a4590f9602c87851dca0df54d19d069a
https://github.com/nohros/nsPopover/blob/0d768929a4590f9602c87851dca0df54d19d069a/src/nsPopover.js#L370-L426
train
nohros/nsPopover
src/nsPopover.js
function(delay) { $timeout.cancel(hider_.id_); // do not hide if -1 is passed in. if(delay !== "-1") { // delay the hiding operation for 1.5s by default. if (!isDef(delay)) { delay = 1.5; } ...
javascript
function(delay) { $timeout.cancel(hider_.id_); // do not hide if -1 is passed in. if(delay !== "-1") { // delay the hiding operation for 1.5s by default. if (!isDef(delay)) { delay = 1.5; } ...
[ "function", "(", "delay", ")", "{", "$timeout", ".", "cancel", "(", "hider_", ".", "id_", ")", ";", "// do not hide if -1 is passed in.\r", "if", "(", "delay", "!==", "\"-1\"", ")", "{", "// delay the hiding operation for 1.5s by default.\r", "if", "(", "!", "isDe...
Set the display property of the popover to 'none' after |delay| milliseconds. @param delay {Number} The time (in seconds) to wait before set the display property.
[ "Set", "the", "display", "property", "of", "the", "popover", "to", "none", "after", "|delay|", "milliseconds", "." ]
0d768929a4590f9602c87851dca0df54d19d069a
https://github.com/nohros/nsPopover/blob/0d768929a4590f9602c87851dca0df54d19d069a/src/nsPopover.js#L445-L468
train
evenchange4/react-intl-cra
src/index.js
extract
function extract( pattern /* : string */, babelPlugins /* : Array<string> */ = [] ) /* : string */ { const srcPaths = glob.sync(pattern, { absolute: true }); const relativeSrcPaths = glob.sync(pattern); const contents = srcPaths.map(p => fs.readFileSync(p, 'utf-8')); const reqBabelPlugins = babelPlugins.map...
javascript
function extract( pattern /* : string */, babelPlugins /* : Array<string> */ = [] ) /* : string */ { const srcPaths = glob.sync(pattern, { absolute: true }); const relativeSrcPaths = glob.sync(pattern); const contents = srcPaths.map(p => fs.readFileSync(p, 'utf-8')); const reqBabelPlugins = babelPlugins.map...
[ "function", "extract", "(", "pattern", "/* : string */", ",", "babelPlugins", "/* : Array<string> */", "=", "[", "]", ")", "/* : string */", "{", "const", "srcPaths", "=", "glob", ".", "sync", "(", "pattern", ",", "{", "absolute", ":", "true", "}", ")", ";",...
For babel.transform
[ "For", "babel", ".", "transform" ]
f06afc5c7e462aec5c739c8f7448f81bf473c9e0
https://github.com/evenchange4/react-intl-cra/blob/f06afc5c7e462aec5c739c8f7448f81bf473c9e0/src/index.js#L9-L41
train
spalger/grunt-run
src/tasks/run.js
trackBackgroundProc
function trackBackgroundProc() { runningProcs.push(proc); proc.on('close', function () { remove(runningProcs, proc); clearPid(name); grunt.log.debug('Process ' + name + ' closed.'); }); }
javascript
function trackBackgroundProc() { runningProcs.push(proc); proc.on('close', function () { remove(runningProcs, proc); clearPid(name); grunt.log.debug('Process ' + name + ' closed.'); }); }
[ "function", "trackBackgroundProc", "(", ")", "{", "runningProcs", ".", "push", "(", "proc", ")", ";", "proc", ".", "on", "(", "'close'", ",", "function", "(", ")", "{", "remove", "(", "runningProcs", ",", "proc", ")", ";", "clearPid", "(", "name", ")",...
we aren't waiting for this proc to close, so setup some tracking stuff
[ "we", "aren", "t", "waiting", "for", "this", "proc", "to", "close", "so", "setup", "some", "tracking", "stuff" ]
f10171d9b736e18538b41a08cab48fa31fec465f
https://github.com/spalger/grunt-run/blob/f10171d9b736e18538b41a08cab48fa31fec465f/src/tasks/run.js#L196-L203
train
spalger/grunt-run
src/tasks/run.js
waitForReadyOutput
function waitForReadyOutput() { function onCloseBeforeReady(exitCode) { done(exitCode && new Error('non-zero exit code ' + exitCode)); } let outputBuffer = ''; function checkChunkForReady(chunk) { outputBuffer += chunk.toString('utf8'); // ensure the buffer doesn't gro...
javascript
function waitForReadyOutput() { function onCloseBeforeReady(exitCode) { done(exitCode && new Error('non-zero exit code ' + exitCode)); } let outputBuffer = ''; function checkChunkForReady(chunk) { outputBuffer += chunk.toString('utf8'); // ensure the buffer doesn't gro...
[ "function", "waitForReadyOutput", "(", ")", "{", "function", "onCloseBeforeReady", "(", "exitCode", ")", "{", "done", "(", "exitCode", "&&", "new", "Error", "(", "'non-zero exit code '", "+", "exitCode", ")", ")", ";", "}", "let", "outputBuffer", "=", "''", ...
we are scanning the output for a specific regular expression
[ "we", "are", "scanning", "the", "output", "for", "a", "specific", "regular", "expression" ]
f10171d9b736e18538b41a08cab48fa31fec465f
https://github.com/spalger/grunt-run/blob/f10171d9b736e18538b41a08cab48fa31fec465f/src/tasks/run.js#L206-L234
train
pugjs/pug-lexer
index.js
Lexer
function Lexer(str, options) { options = options || {}; if (typeof str !== 'string') { throw new Error('Expected source code to be a string but got "' + (typeof str) + '"') } if (typeof options !== 'object') { throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"') } ...
javascript
function Lexer(str, options) { options = options || {}; if (typeof str !== 'string') { throw new Error('Expected source code to be a string but got "' + (typeof str) + '"') } if (typeof options !== 'object') { throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"') } ...
[ "function", "Lexer", "(", "str", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "typeof", "str", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Expected source code to be a string but got \"'", "+", "(", ...
Initialize `Lexer` with the given `str`. @param {String} str @param {String} filename @api private
[ "Initialize", "Lexer", "with", "the", "given", "str", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L23-L47
train
pugjs/pug-lexer
index.js
function(type, val){ var res = {type: type, line: this.lineno, col: this.colno}; if (val !== undefined) res.val = val; return res; }
javascript
function(type, val){ var res = {type: type, line: this.lineno, col: this.colno}; if (val !== undefined) res.val = val; return res; }
[ "function", "(", "type", ",", "val", ")", "{", "var", "res", "=", "{", "type", ":", "type", ",", "line", ":", "this", ".", "lineno", ",", "col", ":", "this", ".", "colno", "}", ";", "if", "(", "val", "!==", "undefined", ")", "res", ".", "val", ...
Construct a token with the given `type` and `val`. @param {String} type @param {String} val @return {Object} @api private
[ "Construct", "a", "token", "with", "the", "given", "type", "and", "val", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L108-L114
train
pugjs/pug-lexer
index.js
function(regexp, type){ var captures; if (captures = regexp.exec(this.input)) { var len = captures[0].length; var val = captures[1]; var diff = len - (val ? val.length : 0); var tok = this.tok(type, val); this.consume(len); this.incrementColumn(diff); return tok; } ...
javascript
function(regexp, type){ var captures; if (captures = regexp.exec(this.input)) { var len = captures[0].length; var val = captures[1]; var diff = len - (val ? val.length : 0); var tok = this.tok(type, val); this.consume(len); this.incrementColumn(diff); return tok; } ...
[ "function", "(", "regexp", ",", "type", ")", "{", "var", "captures", ";", "if", "(", "captures", "=", "regexp", ".", "exec", "(", "this", ".", "input", ")", ")", "{", "var", "len", "=", "captures", "[", "0", "]", ".", "length", ";", "var", "val",...
Scan for `type` with the given `regexp`. @param {String} type @param {RegExp} regexp @return {Object} @api private
[ "Scan", "for", "type", "with", "the", "given", "regexp", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L159-L170
train
pugjs/pug-lexer
index.js
function() { if (this.input.length) return; if (this.interpolated) { this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); } for (var i = 0; this.indentStack[i]; i++) { this.tokens.push(this.tok('outdent')); } this.tokens.push(this.tok('e...
javascript
function() { if (this.input.length) return; if (this.interpolated) { this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); } for (var i = 0; this.indentStack[i]; i++) { this.tokens.push(this.tok('outdent')); } this.tokens.push(this.tok('e...
[ "function", "(", ")", "{", "if", "(", "this", ".", "input", ".", "length", ")", "return", ";", "if", "(", "this", ".", "interpolated", ")", "{", "this", ".", "error", "(", "'NO_END_BRACKET'", ",", "'End of line was reached with no closing bracket for interpolati...
end-of-source.
[ "end", "-", "of", "-", "source", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L272-L283
train
pugjs/pug-lexer
index.js
function() { if (/^#\{/.test(this.input)) { var match = this.bracketExpression(1); this.consume(match.end + 1); var tok = this.tok('interpolation', match.src); this.tokens.push(tok); this.incrementColumn(2); // '#{' this.assertExpression(match.src); var splitted = match.sr...
javascript
function() { if (/^#\{/.test(this.input)) { var match = this.bracketExpression(1); this.consume(match.end + 1); var tok = this.tok('interpolation', match.src); this.tokens.push(tok); this.incrementColumn(2); // '#{' this.assertExpression(match.src); var splitted = match.sr...
[ "function", "(", ")", "{", "if", "(", "/", "^#\\{", "/", ".", "test", "(", "this", ".", "input", ")", ")", "{", "var", "match", "=", "this", ".", "bracketExpression", "(", "1", ")", ";", "this", ".", "consume", "(", "match", ".", "end", "+", "1...
Interpolated tag.
[ "Interpolated", "tag", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L320-L335
train
pugjs/pug-lexer
index.js
function() { var captures; if (captures = /^(?:block +)?prepend +([^\n]+)/.exec(this.input)) { var name = captures[1].trim(); var comment = ''; if (name.indexOf('//') !== -1) { comment = '//' + name.split('//').slice(1).join('//'); name = name.split('//')[0].trim(); } ...
javascript
function() { var captures; if (captures = /^(?:block +)?prepend +([^\n]+)/.exec(this.input)) { var name = captures[1].trim(); var comment = ''; if (name.indexOf('//') !== -1) { comment = '//' + name.split('//').slice(1).join('//'); name = name.split('//')[0].trim(); } ...
[ "function", "(", ")", "{", "var", "captures", ";", "if", "(", "captures", "=", "/", "^(?:block +)?prepend +([^\\n]+)", "/", ".", "exec", "(", "this", ".", "input", ")", ")", "{", "var", "name", "=", "captures", "[", "1", "]", ".", "trim", "(", ")", ...
Block prepend.
[ "Block", "prepend", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L590-L606
train
pugjs/pug-lexer
index.js
function(){ var tok, captures, increment; if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) { // try to consume simple or interpolated call if (captures[3]) { // simple call increment = captures[0].length; this.consume(increment); tok = this.tok('call', cap...
javascript
function(){ var tok, captures, increment; if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) { // try to consume simple or interpolated call if (captures[3]) { // simple call increment = captures[0].length; this.consume(increment); tok = this.tok('call', cap...
[ "function", "(", ")", "{", "var", "tok", ",", "captures", ",", "increment", ";", "if", "(", "captures", "=", "/", "^\\+(\\s*)(([-\\w]+)|(#\\{))", "/", ".", "exec", "(", "this", ".", "input", ")", ")", "{", "// try to consume simple or interpolated call", "if",...
Call mixin.
[ "Call", "mixin", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L779-L821
train
pugjs/pug-lexer
index.js
function() { var tok if (tok = this.scanEndOfLine(/^-/, 'blockcode')) { this.tokens.push(tok); this.interpolationAllowed = false; this.callLexerFunction('pipelessText'); return true; } }
javascript
function() { var tok if (tok = this.scanEndOfLine(/^-/, 'blockcode')) { this.tokens.push(tok); this.interpolationAllowed = false; this.callLexerFunction('pipelessText'); return true; } }
[ "function", "(", ")", "{", "var", "tok", "if", "(", "tok", "=", "this", ".", "scanEndOfLine", "(", "/", "^-", "/", ",", "'blockcode'", ")", ")", "{", "this", ".", "tokens", ".", "push", "(", "tok", ")", ";", "this", ".", "interpolationAllowed", "="...
Block code.
[ "Block", "code", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L992-L1000
train
pugjs/pug-lexer
index.js
function() { var captures = this.scanIndentation(); if (captures) { var indents = captures[1].length; this.incrementLine(1); this.consume(indents + 1); if (' ' == this.input[0] || '\t' == this.input[0]) { this.error('INVALID_INDENTATION', 'Invalid indentation, you can use tabs...
javascript
function() { var captures = this.scanIndentation(); if (captures) { var indents = captures[1].length; this.incrementLine(1); this.consume(indents + 1); if (' ' == this.input[0] || '\t' == this.input[0]) { this.error('INVALID_INDENTATION', 'Invalid indentation, you can use tabs...
[ "function", "(", ")", "{", "var", "captures", "=", "this", ".", "scanIndentation", "(", ")", ";", "if", "(", "captures", ")", "{", "var", "indents", "=", "captures", "[", "1", "]", ".", "length", ";", "this", ".", "incrementLine", "(", "1", ")", ";...
Indent | Outdent | Newline.
[ "Indent", "|", "Outdent", "|", "Newline", "." ]
035c891823b2193121421dc3db660810deac6b3e
https://github.com/pugjs/pug-lexer/blob/035c891823b2193121421dc3db660810deac6b3e/index.js#L1185-L1228
train
aerospike-unofficial/aerospike-session-store-expressjs
lib/aerospike_store.js
AerospikeStore
function AerospikeStore (options) { if (!(this instanceof AerospikeStore)) { throw new TypeError('Cannot call AerospikeStore constructor as a function') } options = options || {} Store.call(this, options) this.as_namespace = options.namespace || 'test' this.as_set = options.set || 'expre...
javascript
function AerospikeStore (options) { if (!(this instanceof AerospikeStore)) { throw new TypeError('Cannot call AerospikeStore constructor as a function') } options = options || {} Store.call(this, options) this.as_namespace = options.namespace || 'test' this.as_set = options.set || 'expre...
[ "function", "AerospikeStore", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "AerospikeStore", ")", ")", "{", "throw", "new", "TypeError", "(", "'Cannot call AerospikeStore constructor as a function'", ")", "}", "options", "=", "options", "||...
Return the `AerospikeStore` extending `express`'s session Store. @param {Object} express session @return {Function} @public
[ "Return", "the", "AerospikeStore", "extending", "express", "s", "session", "Store", "." ]
ffaaf48208cb178aa7dde07bf586033cdad5b348
https://github.com/aerospike-unofficial/aerospike-session-store-expressjs/blob/ffaaf48208cb178aa7dde07bf586033cdad5b348/lib/aerospike_store.js#L35-L69
train
isleofcode/ember-cordova
lib/utils/cordova-validator.js
function(json, name, type) { if (json && json.widget) { var nodes = json.widget[type]; if (!!nodes && isArray(nodes)) { for (var i = 0; i < nodes.length; i++) { if (nameIsMatch(nodes[i], name)) { return true; } } } } return false; }
javascript
function(json, name, type) { if (json && json.widget) { var nodes = json.widget[type]; if (!!nodes && isArray(nodes)) { for (var i = 0; i < nodes.length; i++) { if (nameIsMatch(nodes[i], name)) { return true; } } } } return false; }
[ "function", "(", "json", ",", "name", ",", "type", ")", "{", "if", "(", "json", "&&", "json", ".", "widget", ")", "{", "var", "nodes", "=", "json", ".", "widget", "[", "type", "]", ";", "if", "(", "!", "!", "nodes", "&&", "isArray", "(", "nodes...
type == platform || plugin name == 'ios', 'android', 'cordova-plugin-camera'
[ "type", "==", "platform", "||", "plugin", "name", "==", "ios", "android", "cordova", "-", "plugin", "-", "camera" ]
9c21376e416ffa21bbeffd3e1854d9b508a499de
https://github.com/isleofcode/ember-cordova/blob/9c21376e416ffa21bbeffd3e1854d9b508a499de/lib/utils/cordova-validator.js#L26-L40
train
mongodb-js/query-parser
lib/index.js
isCollationValid
function isCollationValid(collation) { let isValid = true; _.forIn(collation, function(value, key) { const itemIndex = _.findIndex(COLLATION_OPTIONS, key); if (itemIndex === -1) { debug('Collation "%s" is invalid bc of its keys', collation); isValid = false; } if (COLLATION_OPTIONS[itemI...
javascript
function isCollationValid(collation) { let isValid = true; _.forIn(collation, function(value, key) { const itemIndex = _.findIndex(COLLATION_OPTIONS, key); if (itemIndex === -1) { debug('Collation "%s" is invalid bc of its keys', collation); isValid = false; } if (COLLATION_OPTIONS[itemI...
[ "function", "isCollationValid", "(", "collation", ")", "{", "let", "isValid", "=", "true", ";", "_", ".", "forIn", "(", "collation", ",", "function", "(", "value", ",", "key", ")", "{", "const", "itemIndex", "=", "_", ".", "findIndex", "(", "COLLATION_OP...
Validation of collation object keys and values. @param {Object} collation @return {Boolean|Object} false if not valid, otherwise the parsed project.
[ "Validation", "of", "collation", "object", "keys", "and", "values", "." ]
93d46bd5fc29363a7ce5c01768e28bb514bcb567
https://github.com/mongodb-js/query-parser/blob/93d46bd5fc29363a7ce5c01768e28bb514bcb567/lib/index.js#L218-L232
train
tbranyen/combyne
lib/compiler.js
normalizeIdentifier
function normalizeIdentifier(identifier) { if (identifier === ".") { // '.' might be referencing either the root or a locally scoped variable // called '.'. So try for the locally scoped variable first and then // default to the root return "(data['.'] || data)"; } return "data" + i...
javascript
function normalizeIdentifier(identifier) { if (identifier === ".") { // '.' might be referencing either the root or a locally scoped variable // called '.'. So try for the locally scoped variable first and then // default to the root return "(data['.'] || data)"; } return "data" + i...
[ "function", "normalizeIdentifier", "(", "identifier", ")", "{", "if", "(", "identifier", "===", "\".\"", ")", "{", "// '.' might be referencing either the root or a locally scoped variable", "// called '.'. So try for the locally scoped variable first and then", "// default to the root...
Normalizes properties in the identifier to be looked up via hash-style instead of dot-notation. @private @param {string} identifier - The identifier to normalize. @returns {string} The identifier normalized.
[ "Normalizes", "properties", "in", "the", "identifier", "to", "be", "looked", "up", "via", "hash", "-", "style", "instead", "of", "dot", "-", "notation", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/compiler.js#L68-L79
train
tbranyen/combyne
lib/compiler.js
Compiler
function Compiler(tree) { this.tree = tree; this.string = ""; // Optimization pass will flatten large templates to result in faster // rendering. var nodes = this.optimize(this.tree.nodes); var compiledSource = this.process(nodes); // The compiled function body. var body = []; // ...
javascript
function Compiler(tree) { this.tree = tree; this.string = ""; // Optimization pass will flatten large templates to result in faster // rendering. var nodes = this.optimize(this.tree.nodes); var compiledSource = this.process(nodes); // The compiled function body. var body = []; // ...
[ "function", "Compiler", "(", "tree", ")", "{", "this", ".", "tree", "=", "tree", ";", "this", ".", "string", "=", "\"\"", ";", "// Optimization pass will flatten large templates to result in faster", "// rendering.", "var", "nodes", "=", "this", ".", "optimize", "...
Represents a Compiler. @class @memberOf module:compiler @param {Tree} tree - A template [Tree]{@link module:tree.Tree} to compile.
[ "Represents", "a", "Compiler", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/compiler.js#L88-L144
train
tbranyen/combyne
lib/utils/parse_property.js
parseProperty
function parseProperty(value) { var retVal = { type: "Property", value: value }; if (value === "false" || value === "true") { retVal.type = "Literal"; } // Easy way to determine if the value is NaN or not. else if (Number(value) === Number(value)) { retVal.type = "Litera...
javascript
function parseProperty(value) { var retVal = { type: "Property", value: value }; if (value === "false" || value === "true") { retVal.type = "Literal"; } // Easy way to determine if the value is NaN or not. else if (Number(value) === Number(value)) { retVal.type = "Litera...
[ "function", "parseProperty", "(", "value", ")", "{", "var", "retVal", "=", "{", "type", ":", "\"Property\"", ",", "value", ":", "value", "}", ";", "if", "(", "value", "===", "\"false\"", "||", "value", "===", "\"true\"", ")", "{", "retVal", ".", "type"...
Used to produce the object representing the type. @memberOf module:utils/is_literal @param {String} value - The extracted property to inspect. @returns {Object} A property descriptor.
[ "Used", "to", "produce", "the", "object", "representing", "the", "type", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/utils/parse_property.js#L18-L36
train
tbranyen/combyne
lib/index.js
Combyne
function Combyne(template, data) { // Allow this method to run standalone. if (!(this instanceof Combyne)) { return new Combyne(template, data); } // Expose the template for easier accessing and mutation. this.template = template; // Default the data to an empty object. this.data = d...
javascript
function Combyne(template, data) { // Allow this method to run standalone. if (!(this instanceof Combyne)) { return new Combyne(template, data); } // Expose the template for easier accessing and mutation. this.template = template; // Default the data to an empty object. this.data = d...
[ "function", "Combyne", "(", "template", ",", "data", ")", "{", "// Allow this method to run standalone.", "if", "(", "!", "(", "this", "instanceof", "Combyne", ")", ")", "{", "return", "new", "Combyne", "(", "template", ",", "data", ")", ";", "}", "// Expose...
Represents a Combyne template. @class Combyne @param {string} template - The template to compile. @param {object} data - Optional data to compile. @memberOf module:index
[ "Represents", "a", "Combyne", "template", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/index.js#L54-L96
train
tbranyen/combyne
lib/shared/get_filter.js
getFilter
function getFilter(name) { if (name in this._filters) { return this._filters[name]; } else if (this._parent) { return this._parent.getFilter(name); } throw new Error("Missing filter " + name); }
javascript
function getFilter(name) { if (name in this._filters) { return this._filters[name]; } else if (this._parent) { return this._parent.getFilter(name); } throw new Error("Missing filter " + name); }
[ "function", "getFilter", "(", "name", ")", "{", "if", "(", "name", "in", "this", ".", "_filters", ")", "{", "return", "this", ".", "_filters", "[", "name", "]", ";", "}", "else", "if", "(", "this", ".", "_parent", ")", "{", "return", "this", ".", ...
Retrieves a filter locally registered, or via the parent. @memberOf module:shared/get_filter @param {string} name - The name of the filter to retrieve.
[ "Retrieves", "a", "filter", "locally", "registered", "or", "via", "the", "parent", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/shared/get_filter.js#L15-L24
train
tbranyen/combyne
lib/shared/encode.js
encode
function encode(raw) { if (type(raw) !== "string") { return raw; } // Identifies all characters in the unicode range: 00A0-9999, ampersands, // greater & less than) with their respective html entity. return raw.replace(/["&'<>`]/g, function(match) { return "&#" + match.charCodeAt(0) + ...
javascript
function encode(raw) { if (type(raw) !== "string") { return raw; } // Identifies all characters in the unicode range: 00A0-9999, ampersands, // greater & less than) with their respective html entity. return raw.replace(/["&'<>`]/g, function(match) { return "&#" + match.charCodeAt(0) + ...
[ "function", "encode", "(", "raw", ")", "{", "if", "(", "type", "(", "raw", ")", "!==", "\"string\"", ")", "{", "return", "raw", ";", "}", "// Identifies all characters in the unicode range: 00A0-9999, ampersands,", "// greater & less than) with their respective html entity....
Encodes a String with HTML entities. Solution adapted from: http://stackoverflow.com/questions/18749591 @memberOf module:shared/encode @param {*} raw - The raw value to encode, identity if not a String. @returns {string} An encoded string with HTML entities.
[ "Encodes", "a", "String", "with", "HTML", "entities", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/shared/encode.js#L23-L33
train
tbranyen/combyne
lib/grammar.js
Grammar
function Grammar(delimiters) { this.delimiters = delimiters; this.internal = [ makeEntry("START_IF", "if"), makeEntry("ELSE", "else"), makeEntry("ELSIF", "elsif"), makeEntry("END_IF", "endif"), makeEntry("NOT", "not"), makeEntry("EQUALITY", "=="), makeEntry("NOT_EQUALI...
javascript
function Grammar(delimiters) { this.delimiters = delimiters; this.internal = [ makeEntry("START_IF", "if"), makeEntry("ELSE", "else"), makeEntry("ELSIF", "elsif"), makeEntry("END_IF", "endif"), makeEntry("NOT", "not"), makeEntry("EQUALITY", "=="), makeEntry("NOT_EQUALI...
[ "function", "Grammar", "(", "delimiters", ")", "{", "this", ".", "delimiters", "=", "delimiters", ";", "this", ".", "internal", "=", "[", "makeEntry", "(", "\"START_IF\"", ",", "\"if\"", ")", ",", "makeEntry", "(", "\"ELSE\"", ",", "\"else\"", ")", ",", ...
Represents a Grammar. @class @memberOf module:grammar @param {object} delimiters - Delimiters to use store and use internally.
[ "Represents", "a", "Grammar", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/grammar.js#L24-L47
train
tbranyen/combyne
lib/grammar.js
makeEntry
function makeEntry(name, value) { var escaped = escapeDelimiter(value); return { name: name, escaped: escaped, test: new RegExp("^" + escaped) }; }
javascript
function makeEntry(name, value) { var escaped = escapeDelimiter(value); return { name: name, escaped: escaped, test: new RegExp("^" + escaped) }; }
[ "function", "makeEntry", "(", "name", ",", "value", ")", "{", "var", "escaped", "=", "escapeDelimiter", "(", "value", ")", ";", "return", "{", "name", ":", "name", ",", "escaped", ":", "escaped", ",", "test", ":", "new", "RegExp", "(", "\"^\"", "+", ...
Abstract the logic for adding items to the grammar. @private @param {string} name - Required to identify the match. @param {string} value - To be escaped and used within a RegExp. @returns {object} The normalized metadata.
[ "Abstract", "the", "logic", "for", "adding", "items", "to", "the", "grammar", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/grammar.js#L57-L65
train
tbranyen/combyne
lib/shared/get_partial.js
getPartial
function getPartial(name) { if (name in this._partials) { return this._partials[name]; } else if (this._parent) { return this._parent.getPartial(name); } throw new Error("Missing partial " + name); }
javascript
function getPartial(name) { if (name in this._partials) { return this._partials[name]; } else if (this._parent) { return this._parent.getPartial(name); } throw new Error("Missing partial " + name); }
[ "function", "getPartial", "(", "name", ")", "{", "if", "(", "name", "in", "this", ".", "_partials", ")", "{", "return", "this", ".", "_partials", "[", "name", "]", ";", "}", "else", "if", "(", "this", ".", "_parent", ")", "{", "return", "this", "."...
Retrieves a partial locally registered, or via the parent. @memberOf module:shared/get_partial @param {string} name - The name of the partial to retrieve.
[ "Retrieves", "a", "partial", "locally", "registered", "or", "via", "the", "parent", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/shared/get_partial.js#L15-L24
train
tbranyen/combyne
lib/tokenizer.js
parseNextToken
function parseNextToken(template, grammar, stack) { grammar.some(function(token) { var capture = token.test.exec(template); // Ignore empty captures. if (capture && capture[0]) { template = template.replace(token.test, ""); stack.push({ name: token.name, capture: capture }); ...
javascript
function parseNextToken(template, grammar, stack) { grammar.some(function(token) { var capture = token.test.exec(template); // Ignore empty captures. if (capture && capture[0]) { template = template.replace(token.test, ""); stack.push({ name: token.name, capture: capture }); ...
[ "function", "parseNextToken", "(", "template", ",", "grammar", ",", "stack", ")", "{", "grammar", ".", "some", "(", "function", "(", "token", ")", "{", "var", "capture", "=", "token", ".", "test", ".", "exec", "(", "template", ")", ";", "// Ignore empty ...
Loop through the grammar and return on the first source match. Remove matches from the source, after pushing to the stack. @private @param {string} template that is searched on till its length is 0. @param {array} grammar array of test regexes. @param {array} stack to push found tokens to. @returns {string} template ...
[ "Loop", "through", "the", "grammar", "and", "return", "on", "the", "first", "source", "match", ".", "Remove", "matches", "from", "the", "source", "after", "pushing", "to", "the", "stack", "." ]
0d921dd183be34c33abe89ad33fea89c2ba16620
https://github.com/tbranyen/combyne/blob/0d921dd183be34c33abe89ad33fea89c2ba16620/lib/tokenizer.js#L36-L49
train
crypto-utils/random-bytes
index.js
randomBytesSync
function randomBytesSync (size) { var err = null for (var i = 0; i < GENERATE_ATTEMPTS; i++) { try { return crypto.randomBytes(size) } catch (e) { err = e } } throw err }
javascript
function randomBytesSync (size) { var err = null for (var i = 0; i < GENERATE_ATTEMPTS; i++) { try { return crypto.randomBytes(size) } catch (e) { err = e } } throw err }
[ "function", "randomBytesSync", "(", "size", ")", "{", "var", "err", "=", "null", "for", "(", "var", "i", "=", "0", ";", "i", "<", "GENERATE_ATTEMPTS", ";", "i", "++", ")", "{", "try", "{", "return", "crypto", ".", "randomBytes", "(", "size", ")", "...
Generates strong pseudo-random bytes sync. @param {number} size @return {Buffer} @public
[ "Generates", "strong", "pseudo", "-", "random", "bytes", "sync", "." ]
732aa5f73edc287c9a4c2837657cc92f781cc372
https://github.com/crypto-utils/random-bytes/blob/732aa5f73edc287c9a4c2837657cc92f781cc372/index.js#L72-L84
train
ioBroker/ioBroker.vis-bars
widgets/bars/js/bars.js
function (div) { var visWidget = vis.views[vis.activeView].widgets[barsIntern.wid]; if (visWidget === undefined) { for (var view in vis.views) { if (view === '___settings') continue; if (vis.views[view].widgets[barsIntern.wid]) { visW...
javascript
function (div) { var visWidget = vis.views[vis.activeView].widgets[barsIntern.wid]; if (visWidget === undefined) { for (var view in vis.views) { if (view === '___settings') continue; if (vis.views[view].widgets[barsIntern.wid]) { visW...
[ "function", "(", "div", ")", "{", "var", "visWidget", "=", "vis", ".", "views", "[", "vis", ".", "activeView", "]", ".", "widgets", "[", "barsIntern", ".", "wid", "]", ";", "if", "(", "visWidget", "===", "undefined", ")", "{", "for", "(", "var", "v...
Return widget for hqWidgets Button
[ "Return", "widget", "for", "hqWidgets", "Button" ]
ad7c4c760a8cd1a4c6236058b7d7fe6eeb79eed2
https://github.com/ioBroker/ioBroker.vis-bars/blob/ad7c4c760a8cd1a4c6236058b7d7fe6eeb79eed2/widgets/bars/js/bars.js#L71-L84
train
serby/save
lib/memory-engine.js
checkForIdAndData
function checkForIdAndData(object, callback) { var id = object[options.idProperty] , foundObject if (id === undefined || id === null) { return callback(new Error('Object has no \'' + options.idProperty + '\' property')) } foundObject = findById(id) if (foundObject === null) { ...
javascript
function checkForIdAndData(object, callback) { var id = object[options.idProperty] , foundObject if (id === undefined || id === null) { return callback(new Error('Object has no \'' + options.idProperty + '\' property')) } foundObject = findById(id) if (foundObject === null) { ...
[ "function", "checkForIdAndData", "(", "object", ",", "callback", ")", "{", "var", "id", "=", "object", "[", "options", ".", "idProperty", "]", ",", "foundObject", "if", "(", "id", "===", "undefined", "||", "id", "===", "null", ")", "{", "return", "callba...
Checks that the object has the ID property present, then checks if the data object has that ID value present.e Returns an Error to the callback if either of the above checks fail @param {Object} object to check @param {Function} callback @api private
[ "Checks", "that", "the", "object", "has", "the", "ID", "property", "present", "then", "checks", "if", "the", "data", "object", "has", "that", "ID", "value", "present", ".", "e" ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L30-L46
train
serby/save
lib/memory-engine.js
create
function create(object, callback) { self.emit('create', object) callback = callback || emptyFn // clone the object var extendedObject = extend({}, object) if (!extendedObject[options.idProperty]) { idSeq += 1 extendedObject[options.idProperty] = '' + idSeq } else { if (findByI...
javascript
function create(object, callback) { self.emit('create', object) callback = callback || emptyFn // clone the object var extendedObject = extend({}, object) if (!extendedObject[options.idProperty]) { idSeq += 1 extendedObject[options.idProperty] = '' + idSeq } else { if (findByI...
[ "function", "create", "(", "object", ",", "callback", ")", "{", "self", ".", "emit", "(", "'create'", ",", "object", ")", "callback", "=", "callback", "||", "emptyFn", "// clone the object", "var", "extendedObject", "=", "extend", "(", "{", "}", ",", "obje...
Create a new entity. Emits a 'create' event. @param {Object} object to create @param {Function} callback (optional) @api public
[ "Create", "a", "new", "entity", ".", "Emits", "a", "create", "event", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L55-L74
train
serby/save
lib/memory-engine.js
createOrUpdate
function createOrUpdate(object, callback) { if (typeof object[options.idProperty] === 'undefined') { // Create a new object self.create(object, callback) } else { // Try and find the object first to update var query = {} query[options.idProperty] = object[options.idProperty] ...
javascript
function createOrUpdate(object, callback) { if (typeof object[options.idProperty] === 'undefined') { // Create a new object self.create(object, callback) } else { // Try and find the object first to update var query = {} query[options.idProperty] = object[options.idProperty] ...
[ "function", "createOrUpdate", "(", "object", ",", "callback", ")", "{", "if", "(", "typeof", "object", "[", "options", ".", "idProperty", "]", "===", "'undefined'", ")", "{", "// Create a new object", "self", ".", "create", "(", "object", ",", "callback", ")...
Create or update a entity. Emits a 'create' event or a 'update'. @param {Object} object to create or update @param {Function} callback (optional) @api public
[ "Create", "or", "update", "a", "entity", ".", "Emits", "a", "create", "event", "or", "a", "update", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L83-L102
train
serby/save
lib/memory-engine.js
read
function read(id, callback) { var query = {} self.emit('read', id) callback = callback || emptyFn query[options.idProperty] = '' + id findByQuery(query, {}, function (error, objects) { if (objects[0] !== undefined) { var cloned = extend({}, objects[0]) self.emit('received', cl...
javascript
function read(id, callback) { var query = {} self.emit('read', id) callback = callback || emptyFn query[options.idProperty] = '' + id findByQuery(query, {}, function (error, objects) { if (objects[0] !== undefined) { var cloned = extend({}, objects[0]) self.emit('received', cl...
[ "function", "read", "(", "id", ",", "callback", ")", "{", "var", "query", "=", "{", "}", "self", ".", "emit", "(", "'read'", ",", "id", ")", "callback", "=", "callback", "||", "emptyFn", "query", "[", "options", ".", "idProperty", "]", "=", "''", "...
Reads a single entity. Emits a 'read' event. @param {Number} id to read @param {Function} callback (optional) @api public
[ "Reads", "a", "single", "entity", ".", "Emits", "a", "read", "event", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L111-L126
train
serby/save
lib/memory-engine.js
update
function update(object, overwrite, callback) { if (typeof overwrite === 'function') { callback = overwrite overwrite = false } self.emit('update', object, overwrite) callback = callback || emptyFn var id = '' + object[options.idProperty] , updatedObject checkForIdAndData(objec...
javascript
function update(object, overwrite, callback) { if (typeof overwrite === 'function') { callback = overwrite overwrite = false } self.emit('update', object, overwrite) callback = callback || emptyFn var id = '' + object[options.idProperty] , updatedObject checkForIdAndData(objec...
[ "function", "update", "(", "object", ",", "overwrite", ",", "callback", ")", "{", "if", "(", "typeof", "overwrite", "===", "'function'", ")", "{", "callback", "=", "overwrite", "overwrite", "=", "false", "}", "self", ".", "emit", "(", "'update'", ",", "o...
Updates a single entity. Emits an 'update' event. Optionally overwrites the entire entity, by default just extends it with the new values. @param {Object} object to update @param {Boolean} whether to overwrite or extend the existing entity @param {Function} callback (optional) @api public
[ "Updates", "a", "single", "entity", ".", "Emits", "an", "update", "event", ".", "Optionally", "overwrites", "the", "entire", "entity", "by", "default", "just", "extends", "it", "with", "the", "new", "values", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L137-L166
train
serby/save
lib/memory-engine.js
deleteMany
function deleteMany(query, callback) { callback = callback || emptyFn self.emit('deleteMany', query) data = Mingo.remove(data, query) self.emit('afterDeleteMany', query) callback() }
javascript
function deleteMany(query, callback) { callback = callback || emptyFn self.emit('deleteMany', query) data = Mingo.remove(data, query) self.emit('afterDeleteMany', query) callback() }
[ "function", "deleteMany", "(", "query", ",", "callback", ")", "{", "callback", "=", "callback", "||", "emptyFn", "self", ".", "emit", "(", "'deleteMany'", ",", "query", ")", "data", "=", "Mingo", ".", "remove", "(", "data", ",", "query", ")", "self", "...
Deletes entities based on a query. Emits a 'delete' event. Performs a find by query, then calls delete for each item returned. Returns an error if no items match the query. @param {Object} query to delete on @param {Function} callback (optional) @api public
[ "Deletes", "entities", "based", "on", "a", "query", ".", "Emits", "a", "delete", "event", ".", "Performs", "a", "find", "by", "query", "then", "calls", "delete", "for", "each", "item", "returned", ".", "Returns", "an", "error", "if", "no", "items", "matc...
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L177-L183
train
serby/save
lib/memory-engine.js
del
function del(id, callback) { callback = callback || emptyFn if (typeof callback !== 'function') { throw new TypeError('callback must be a function or empty') } self.emit('delete', id) var query = {} query[ options.idProperty ] = id deleteMany(query, function() { self.emit('aft...
javascript
function del(id, callback) { callback = callback || emptyFn if (typeof callback !== 'function') { throw new TypeError('callback must be a function or empty') } self.emit('delete', id) var query = {} query[ options.idProperty ] = id deleteMany(query, function() { self.emit('aft...
[ "function", "del", "(", "id", ",", "callback", ")", "{", "callback", "=", "callback", "||", "emptyFn", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "TypeError", "(", "'callback must be a function or empty'", ")", "}", "self",...
Deletes one entity. Emits a 'delete' event. Returns an error if the object can not be found or if the ID property is not present. @param {Object} object to delete @param {Function} callback (optional) @api public
[ "Deletes", "one", "entity", ".", "Emits", "a", "delete", "event", ".", "Returns", "an", "error", "if", "the", "object", "can", "not", "be", "found", "or", "if", "the", "ID", "property", "is", "not", "present", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L193-L208
train
serby/save
lib/memory-engine.js
findByQuery
function findByQuery(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } var cursor = Mingo.find(data, query, options && options.fields) if (options && options.sort) cursor = cursor.sort(options.sort) if (options && options.limit) cursor =...
javascript
function findByQuery(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } var cursor = Mingo.find(data, query, options && options.fields) if (options && options.sort) cursor = cursor.sort(options.sort) if (options && options.limit) cursor =...
[ "function", "findByQuery", "(", "query", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", "options", "=", "{", "}", "}", "var", "cursor", "=", "Mingo", ".", "find", "(...
Performs a find on the data by search query. Sorting can be done similarly to mongo by providing a $sort option to the options object. The query can target fields in a subdocument similarly to mongo by passing a string reference to the subdocument in dot notation. @param {Object} query to search by @param {Object} s...
[ "Performs", "a", "find", "on", "the", "data", "by", "search", "query", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L224-L247
train
serby/save
lib/memory-engine.js
find
function find(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } self.emit('find', query, options) if (callback !== undefined) { findByQuery(query, options, function(error, data) { if (error) return callback(error) self.e...
javascript
function find(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } self.emit('find', query, options) if (callback !== undefined) { findByQuery(query, options, function(error, data) { if (error) return callback(error) self.e...
[ "function", "find", "(", "query", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", "options", "=", "{", "}", "}", "self", ".", "emit", "(", "'find'", ",", "query", "...
Performs a find on the data. Emits a 'find' event. @param {Object} query to search by @param {Object} options @param {Function} callback @api public
[ "Performs", "a", "find", "on", "the", "data", ".", "Emits", "a", "find", "event", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L265-L281
train
serby/save
lib/memory-engine.js
findOne
function findOne(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } self.emit('findOne', query, options) findByQuery(query, options, function (error, objects) { self.emit('received', objects[0]) callback(undefined, objects[0]) }...
javascript
function findOne(query, options, callback) { if (typeof options === 'function') { callback = options options = {} } self.emit('findOne', query, options) findByQuery(query, options, function (error, objects) { self.emit('received', objects[0]) callback(undefined, objects[0]) }...
[ "function", "findOne", "(", "query", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", "options", "=", "{", "}", "}", "self", ".", "emit", "(", "'findOne'", ",", "query...
Performs a find on the data and limits the result set to 1. Emits a 'findOne' event. @param {Object} query to search by @param {Object} options @param {Function} callback @api public
[ "Performs", "a", "find", "on", "the", "data", "and", "limits", "the", "result", "set", "to", "1", ".", "Emits", "a", "findOne", "event", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L292-L302
train
serby/save
lib/memory-engine.js
count
function count(query, callback) { self.emit('count', query) findByQuery(query, options, function (error, objects) { self.emit('received', objects.length) callback(undefined, objects.length) }) }
javascript
function count(query, callback) { self.emit('count', query) findByQuery(query, options, function (error, objects) { self.emit('received', objects.length) callback(undefined, objects.length) }) }
[ "function", "count", "(", "query", ",", "callback", ")", "{", "self", ".", "emit", "(", "'count'", ",", "query", ")", "findByQuery", "(", "query", ",", "options", ",", "function", "(", "error", ",", "objects", ")", "{", "self", ".", "emit", "(", "'re...
Performs a count by query. Emits a 'count' event. @param {Object} query to search by @param {Function} callback @api public
[ "Performs", "a", "count", "by", "query", ".", "Emits", "a", "count", "event", "." ]
9b9232cd73ebe4e408561688ba4ecc5e35a5be30
https://github.com/serby/save/blob/9b9232cd73ebe4e408561688ba4ecc5e35a5be30/lib/memory-engine.js#L311-L317
train
andreogle/eslint-teamcity
src/formatter.js
getTeamCityOutput
function getTeamCityOutput(results, propNames) { const config = getUserConfig(propNames || {}); if (process.env.ESLINT_TEAMCITY_DISPLAY_CONFIG) { console.info(`Running ESLint Teamcity with config: ${JSON.stringify(config, null, 4)}`); } let outputMessages = []; switch (config.reporter.toLowerCase()) { ...
javascript
function getTeamCityOutput(results, propNames) { const config = getUserConfig(propNames || {}); if (process.env.ESLINT_TEAMCITY_DISPLAY_CONFIG) { console.info(`Running ESLint Teamcity with config: ${JSON.stringify(config, null, 4)}`); } let outputMessages = []; switch (config.reporter.toLowerCase()) { ...
[ "function", "getTeamCityOutput", "(", "results", ",", "propNames", ")", "{", "const", "config", "=", "getUserConfig", "(", "propNames", "||", "{", "}", ")", ";", "if", "(", "process", ".", "env", ".", "ESLINT_TEAMCITY_DISPLAY_CONFIG", ")", "{", "console", "....
Determines the formatter to use and any config variables to use @param {array} results The output generated by running ESLint. @param {object} [propNames] Optional config variables that will override all other config settings @returns {string} The concatenated output of all messages to display in TeamCity
[ "Determines", "the", "formatter", "to", "use", "and", "any", "config", "variables", "to", "use" ]
015a7a56d47a77bb3d2544b8d50ff657d77390e7
https://github.com/andreogle/eslint-teamcity/blob/015a7a56d47a77bb3d2544b8d50ff657d77390e7/src/formatter.js#L55-L76
train
posthtml/posthtml-modules
index.js
processNodeContentWithPosthtml
function processNodeContentWithPosthtml(node, options) { return function (content) { return processWithPostHtml(options.plugins, path.join(path.dirname(options.from), node.attrs.href), content, [function (tree) { // remove <content> tags and replace them with node's content return tree.match(match('content'), ...
javascript
function processNodeContentWithPosthtml(node, options) { return function (content) { return processWithPostHtml(options.plugins, path.join(path.dirname(options.from), node.attrs.href), content, [function (tree) { // remove <content> tags and replace them with node's content return tree.match(match('content'), ...
[ "function", "processNodeContentWithPosthtml", "(", "node", ",", "options", ")", "{", "return", "function", "(", "content", ")", "{", "return", "processWithPostHtml", "(", "options", ".", "plugins", ",", "path", ".", "join", "(", "path", ".", "dirname", "(", ...
process every node content with posthtml @param {Object} node [posthtml element object] @param {Object} options @return {Function}
[ "process", "every", "node", "content", "with", "posthtml" ]
b6b778123921d1a4a87d065994810ff410726d5a
https://github.com/posthtml/posthtml-modules/blob/b6b778123921d1a4a87d065994810ff410726d5a/index.js#L15-L24
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
handleMouseDown
function handleMouseDown (e) { if(enabled){ for (var i= 0; i<excludedClasses.length; i++) { if (angular.element(e.target).hasClass(excludedClasses[i])) { return false; } ...
javascript
function handleMouseDown (e) { if(enabled){ for (var i= 0; i<excludedClasses.length; i++) { if (angular.element(e.target).hasClass(excludedClasses[i])) { return false; } ...
[ "function", "handleMouseDown", "(", "e", ")", "{", "if", "(", "enabled", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "excludedClasses", ".", "length", ";", "i", "++", ")", "{", "if", "(", "angular", ".", "element", "(", "e", ".", ...
Handles mousedown event @param {object} e MouseDown event
[ "Handles", "mousedown", "event" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L59-L85
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
handleMouseUp
function handleMouseUp (e) { if(enabled){ var selectable = (e.target.attributes && 'drag-scroll-text' in e.target.attributes); var withinXConstraints = (e.clientX >= (startClientX - allowedClickOffset) && e.clientX <= (startClientX + allowedClickOffset...
javascript
function handleMouseUp (e) { if(enabled){ var selectable = (e.target.attributes && 'drag-scroll-text' in e.target.attributes); var withinXConstraints = (e.clientX >= (startClientX - allowedClickOffset) && e.clientX <= (startClientX + allowedClickOffset...
[ "function", "handleMouseUp", "(", "e", ")", "{", "if", "(", "enabled", ")", "{", "var", "selectable", "=", "(", "e", ".", "target", ".", "attributes", "&&", "'drag-scroll-text'", "in", "e", ".", "target", ".", "attributes", ")", ";", "var", "withinXConst...
Handles mouseup event @param {object} e MouseUp event
[ "Handles", "mouseup", "event" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L91-L113
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
handleMouseMove
function handleMouseMove (e) { if(enabled){ if (pushed) { if(!axis || axis === 'x') { $element[0].scrollLeft -= (-lastClientX + (lastClientX = e.clientX)); } if...
javascript
function handleMouseMove (e) { if(enabled){ if (pushed) { if(!axis || axis === 'x') { $element[0].scrollLeft -= (-lastClientX + (lastClientX = e.clientX)); } if...
[ "function", "handleMouseMove", "(", "e", ")", "{", "if", "(", "enabled", ")", "{", "if", "(", "pushed", ")", "{", "if", "(", "!", "axis", "||", "axis", "===", "'x'", ")", "{", "$element", "[", "0", "]", ".", "scrollLeft", "-=", "(", "-", "lastCli...
Handles mousemove event @param {object} e MouseMove event
[ "Handles", "mousemove", "event" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L119-L132
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
destroy
function destroy () { $element.off('mousedown', handleMouseDown); angular.element($window).off('mouseup', handleMouseUp); angular.element($window).off('mousemove', handleMouseMove); }
javascript
function destroy () { $element.off('mousedown', handleMouseDown); angular.element($window).off('mouseup', handleMouseUp); angular.element($window).off('mousemove', handleMouseMove); }
[ "function", "destroy", "(", ")", "{", "$element", ".", "off", "(", "'mousedown'", ",", "handleMouseDown", ")", ";", "angular", ".", "element", "(", "$window", ")", ".", "off", "(", "'mouseup'", ",", "handleMouseUp", ")", ";", "angular", ".", "element", "...
Destroys all the event listeners
[ "Destroys", "all", "the", "event", "listeners" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L137-L141
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
selectText
function selectText (element) { var range; if ($window.document.selection) { range = $window.document.body.createTextRange(); range.moveToElementText(element); range.select(); } else if ($...
javascript
function selectText (element) { var range; if ($window.document.selection) { range = $window.document.body.createTextRange(); range.moveToElementText(element); range.select(); } else if ($...
[ "function", "selectText", "(", "element", ")", "{", "var", "range", ";", "if", "(", "$window", ".", "document", ".", "selection", ")", "{", "range", "=", "$window", ".", "document", ".", "body", ".", "createTextRange", "(", ")", ";", "range", ".", "mov...
Selects text for a specific element @param {object} element Selected element
[ "Selects", "text", "for", "a", "specific", "element" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L147-L158
train
jellekralt/angular-drag-scroll
src/ng-drag-scroll.js
clearSelection
function clearSelection () { if ($window.getSelection) { if ($window.getSelection().empty) { // Chrome $window.getSelection().empty(); } else if ($window.getSelection().removeAllRanges) { // Firefox ...
javascript
function clearSelection () { if ($window.getSelection) { if ($window.getSelection().empty) { // Chrome $window.getSelection().empty(); } else if ($window.getSelection().removeAllRanges) { // Firefox ...
[ "function", "clearSelection", "(", ")", "{", "if", "(", "$window", ".", "getSelection", ")", "{", "if", "(", "$window", ".", "getSelection", "(", ")", ".", "empty", ")", "{", "// Chrome", "$window", ".", "getSelection", "(", ")", ".", "empty", "(", ")"...
Clears text selection
[ "Clears", "text", "selection" ]
29ea86b2e722e23b86842f7aa8169acf3ed20d52
https://github.com/jellekralt/angular-drag-scroll/blob/29ea86b2e722e23b86842f7aa8169acf3ed20d52/src/ng-drag-scroll.js#L163-L173
train
guylabs/angular-spring-data-rest
src/angular-spring-data-rest-utils.js
deepExtend
function deepExtend(destination) { angular.forEach(arguments, function (obj) { if (obj !== destination) { angular.forEach(obj, function (value, key) { if (destination[key] && destination[key].constructor && destination[key].constructor === Object) { deepExtend...
javascript
function deepExtend(destination) { angular.forEach(arguments, function (obj) { if (obj !== destination) { angular.forEach(obj, function (value, key) { if (destination[key] && destination[key].constructor && destination[key].constructor === Object) { deepExtend...
[ "function", "deepExtend", "(", "destination", ")", "{", "angular", ".", "forEach", "(", "arguments", ",", "function", "(", "obj", ")", "{", "if", "(", "obj", "!==", "destination", ")", "{", "angular", ".", "forEach", "(", "obj", ",", "function", "(", "...
Makes a deep extend of the given destination object and the source objects. @param {object} destination the destination object @returns {object} a copy of the extended destination object
[ "Makes", "a", "deep", "extend", "of", "the", "given", "destination", "object", "and", "the", "source", "objects", "." ]
70d15b5cf3cd37328037d3884c30a4715a12b616
https://github.com/guylabs/angular-spring-data-rest/blob/70d15b5cf3cd37328037d3884c30a4715a12b616/src/angular-spring-data-rest-utils.js#L7-L20
train
guylabs/angular-spring-data-rest
src/angular-spring-data-rest-utils.js
checkUrl
function checkUrl(url, resourceName, hrefKey) { if (url == undefined || !url) { throw new Error("The provided resource name '" + resourceName + "' has no valid URL in the '" + hrefKey + "' property."); } return url }
javascript
function checkUrl(url, resourceName, hrefKey) { if (url == undefined || !url) { throw new Error("The provided resource name '" + resourceName + "' has no valid URL in the '" + hrefKey + "' property."); } return url }
[ "function", "checkUrl", "(", "url", ",", "resourceName", ",", "hrefKey", ")", "{", "if", "(", "url", "==", "undefined", "||", "!", "url", ")", "{", "throw", "new", "Error", "(", "\"The provided resource name '\"", "+", "resourceName", "+", "\"' has no valid UR...
Checks the given URL if it is valid and throws a parameterized exception containing the resource name and the URL property name. @param {string} url the URL to check @param {string} resourceName the name of the resource @param {string} hrefKey the URL property key @returns {string} the URL if it is valid @throws Error...
[ "Checks", "the", "given", "URL", "if", "it", "is", "valid", "and", "throws", "a", "parameterized", "exception", "containing", "the", "resource", "name", "and", "the", "URL", "property", "name", "." ]
70d15b5cf3cd37328037d3884c30a4715a12b616
https://github.com/guylabs/angular-spring-data-rest/blob/70d15b5cf3cd37328037d3884c30a4715a12b616/src/angular-spring-data-rest-utils.js#L81-L87
train
postcss/postcss-font-variant
index.js
getFontFeatureSettingsPrevTo
function getFontFeatureSettingsPrevTo(decl) { var fontFeatureSettings = null; decl.parent.walkDecls(function(decl) { if (decl.prop === "font-feature-settings") { fontFeatureSettings = decl; } }) if (fontFeatureSettings === null) { fontFeatureSettings = decl.clone() fontFeatureSettings.pro...
javascript
function getFontFeatureSettingsPrevTo(decl) { var fontFeatureSettings = null; decl.parent.walkDecls(function(decl) { if (decl.prop === "font-feature-settings") { fontFeatureSettings = decl; } }) if (fontFeatureSettings === null) { fontFeatureSettings = decl.clone() fontFeatureSettings.pro...
[ "function", "getFontFeatureSettingsPrevTo", "(", "decl", ")", "{", "var", "fontFeatureSettings", "=", "null", ";", "decl", ".", "parent", ".", "walkDecls", "(", "function", "(", "decl", ")", "{", "if", "(", "decl", ".", "prop", "===", "\"font-feature-settings\...
Find font-feature-settings declaration before given declaration, create if does not exist
[ "Find", "font", "-", "feature", "-", "settings", "declaration", "before", "given", "declaration", "create", "if", "does", "not", "exist" ]
9084a34e2aea66005f3fa845b2466b6cbdb1b93c
https://github.com/postcss/postcss-font-variant/blob/9084a34e2aea66005f3fa845b2466b6cbdb1b93c/index.js#L69-L84
train