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
JKHeadley/rest-hapi
utilities/handler-helper.js
_addOneHandler
async function _addOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) { try { let ownerObject = await ownerModel .findOne({ _id: ownerId }) .select(associationName) let payload = Object.assign({}, request.payload) if (ownerObject) { if (!p...
javascript
async function _addOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) { try { let ownerObject = await ownerModel .findOne({ _id: ownerId }) .select(associationName) let payload = Object.assign({}, request.payload) if (ownerObject) { if (!p...
[ "async", "function", "_addOneHandler", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "childId", ",", "associationName", ",", "request", ",", "Log", ")", "{", "try", "{", "let", "ownerObject", "=", "await", "ownerModel", ".", "findOne", "(", "{",...
Adds an association to a document @param ownerModel: The model that is being added to. @param ownerId: The id of the owner document. @param childModel: The model that is being added. @param childId: The id of the child document. @param associationName: The name of the association from the ownerModel's perspective. @par...
[ "Adds", "an", "association", "to", "a", "document" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L727-L795
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_removeOne
function _removeOne( ownerModel, ownerId, childModel, childId, associationName, Log ) { let request = { params: { ownerId: ownerId, childId: childId } } return _removeOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) }
javascript
function _removeOne( ownerModel, ownerId, childModel, childId, associationName, Log ) { let request = { params: { ownerId: ownerId, childId: childId } } return _removeOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) }
[ "function", "_removeOne", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "childId", ",", "associationName", ",", "Log", ")", "{", "let", "request", "=", "{", "params", ":", "{", "ownerId", ":", "ownerId", ",", "childId", ":", "childId", "}", ...
RemoveOne function exposed as a mongoose wrapper. @param ownerModel: The model that is being removed from. @param ownerId: The id of the owner document. @param childModel: The model that is being removed. @param childId: The id of the child document. @param associationName: The name of the association from the ownerMod...
[ "RemoveOne", "function", "exposed", "as", "a", "mongoose", "wrapper", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L808-L826
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_removeOneHandler
async function _removeOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) { try { let ownerObject = await ownerModel .findOne({ _id: ownerId }) .select(associationName) if (ownerObject) { try { if ( ownerModel.routeOptions && ...
javascript
async function _removeOneHandler( ownerModel, ownerId, childModel, childId, associationName, request, Log ) { try { let ownerObject = await ownerModel .findOne({ _id: ownerId }) .select(associationName) if (ownerObject) { try { if ( ownerModel.routeOptions && ...
[ "async", "function", "_removeOneHandler", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "childId", ",", "associationName", ",", "request", ",", "Log", ")", "{", "try", "{", "let", "ownerObject", "=", "await", "ownerModel", ".", "findOne", "(", "...
Removes an association to a document @param ownerModel: The model that is being removed from. @param ownerId: The id of the owner document. @param childModel: The model that is being removed. @param childId: The id of the child document. @param associationName: The name of the association from the ownerModel's perspect...
[ "Removes", "an", "association", "to", "a", "document" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L839-L899
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_addMany
function _addMany( ownerModel, ownerId, childModel, associationName, payload, Log ) { let request = { params: { ownerId: ownerId }, payload: payload } return _addManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
javascript
function _addMany( ownerModel, ownerId, childModel, associationName, payload, Log ) { let request = { params: { ownerId: ownerId }, payload: payload } return _addManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
[ "function", "_addMany", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "associationName", ",", "payload", ",", "Log", ")", "{", "let", "request", "=", "{", "params", ":", "{", "ownerId", ":", "ownerId", "}", ",", "payload", ":", "payload", "}...
AddMany function exposed as a mongoose wrapper. @param ownerModel: The model that is being added to. @param ownerId: The id of the owner document. @param childModel: The model that is being added. @param associationName: The name of the association from the ownerModel's perspective. @param payload: Either a list of id'...
[ "AddMany", "function", "exposed", "as", "a", "mongoose", "wrapper", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L912-L929
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_addManyHandler
async function _addManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) { try { // EXPL: make a copy of the payload so that request.payload remains unchanged let payload = request.payload.map(item => { return _.isObject(item) ? _.assignIn({}, item) : item }) ...
javascript
async function _addManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) { try { // EXPL: make a copy of the payload so that request.payload remains unchanged let payload = request.payload.map(item => { return _.isObject(item) ? _.assignIn({}, item) : item }) ...
[ "async", "function", "_addManyHandler", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "associationName", ",", "request", ",", "Log", ")", "{", "try", "{", "// EXPL: make a copy of the payload so that request.payload remains unchanged", "let", "payload", "=", ...
Adds multiple associations to a document. @param ownerModel: The model that is being added to. @param ownerId: The id of the owner document. @param childModel: The model that is being added. @param associationName: The name of the association from the ownerModel's perspective. @param request: The Hapi request object, o...
[ "Adds", "multiple", "associations", "to", "a", "document", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L941-L1026
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_removeMany
function _removeMany( ownerModel, ownerId, childModel, associationName, payload, Log ) { let request = { params: { ownerId: ownerId }, payload: payload } return _removeManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
javascript
function _removeMany( ownerModel, ownerId, childModel, associationName, payload, Log ) { let request = { params: { ownerId: ownerId }, payload: payload } return _removeManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
[ "function", "_removeMany", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "associationName", ",", "payload", ",", "Log", ")", "{", "let", "request", "=", "{", "params", ":", "{", "ownerId", ":", "ownerId", "}", ",", "payload", ":", "payload", ...
RemoveMany function exposed as a mongoose wrapper. @param ownerModel: The model that is being removed from. @param ownerId: The id of the owner document. @param childModel: The model that is being removed. @param associationName: The name of the association from the ownerModel's perspective. @param payload: A list of i...
[ "RemoveMany", "function", "exposed", "as", "a", "mongoose", "wrapper", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L1039-L1056
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_removeManyHandler
async function _removeManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) { try { // EXPL: make a copy of the payload so that request.payload remains unchanged let payload = request.payload.map(item => { return _.isObject(item) ? _.assignIn({}, item) : item }) ...
javascript
async function _removeManyHandler( ownerModel, ownerId, childModel, associationName, request, Log ) { try { // EXPL: make a copy of the payload so that request.payload remains unchanged let payload = request.payload.map(item => { return _.isObject(item) ? _.assignIn({}, item) : item }) ...
[ "async", "function", "_removeManyHandler", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "associationName", ",", "request", ",", "Log", ")", "{", "try", "{", "// EXPL: make a copy of the payload so that request.payload remains unchanged", "let", "payload", "=...
Removes multiple associations from a document @param ownerModel: The model that is being removed from. @param ownerId: The id of the owner document. @param childModel: The model that is being removed. @param associationName: The name of the association from the ownerModel's perspective. @param request: The Hapi request...
[ "Removes", "multiple", "associations", "from", "a", "document" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L1068-L1136
train
JKHeadley/rest-hapi
utilities/handler-helper.js
_getAll
function _getAll(ownerModel, ownerId, childModel, associationName, query, Log) { let request = { params: { ownerId: ownerId }, query: query } return _getAllHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
javascript
function _getAll(ownerModel, ownerId, childModel, associationName, query, Log) { let request = { params: { ownerId: ownerId }, query: query } return _getAllHandler( ownerModel, ownerId, childModel, associationName, request, Log ) }
[ "function", "_getAll", "(", "ownerModel", ",", "ownerId", ",", "childModel", ",", "associationName", ",", "query", ",", "Log", ")", "{", "let", "request", "=", "{", "params", ":", "{", "ownerId", ":", "ownerId", "}", ",", "query", ":", "query", "}", "r...
GetAll function exposed as a mongoose wrapper. @param ownerModel: The model that is being added to. @param ownerId: The id of the owner document. @param childModel: The model that is being added. @param associationName: The name of the association from the ownerModel's perspective. @param query: rest-hapi query paramet...
[ "GetAll", "function", "exposed", "as", "a", "mongoose", "wrapper", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L1149-L1159
train
JKHeadley/rest-hapi
utilities/handler-helper.js
filterDeletedEmbeds
function filterDeletedEmbeds(result, parent, parentkey, depth, Log) { if (_.isArray(result)) { result = result.filter(function(obj) { let keep = filterDeletedEmbeds(obj, result, parentkey, depth + 1, Log) // Log.log("KEEP:", keep); return keep }) // Log.log("UPDATED:", parentkey); //...
javascript
function filterDeletedEmbeds(result, parent, parentkey, depth, Log) { if (_.isArray(result)) { result = result.filter(function(obj) { let keep = filterDeletedEmbeds(obj, result, parentkey, depth + 1, Log) // Log.log("KEEP:", keep); return keep }) // Log.log("UPDATED:", parentkey); //...
[ "function", "filterDeletedEmbeds", "(", "result", ",", "parent", ",", "parentkey", ",", "depth", ",", "Log", ")", "{", "if", "(", "_", ".", "isArray", "(", "result", ")", ")", "{", "result", "=", "result", ".", "filter", "(", "function", "(", "obj", ...
This function is called after embedded associations have been populated so that any associations that have been soft deleted are removed. @param result: the object that is being inspected @param parent: the parent of the result object @param parentkey: the parents key for the result object @param depth: the current rec...
[ "This", "function", "is", "called", "after", "embedded", "associations", "have", "been", "populated", "so", "that", "any", "associations", "that", "have", "been", "soft", "deleted", "are", "removed", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L1640-L1671
train
JKHeadley/rest-hapi
utilities/validation-helper.js
function(model, logger) { assert( model.schema, "model not mongoose format. 'schema' property required." ) assert( model.schema.paths, "model not mongoose format. 'schema.paths' property required." ) assert( model.schema.tree, "model not mongoose format. 'schema.t...
javascript
function(model, logger) { assert( model.schema, "model not mongoose format. 'schema' property required." ) assert( model.schema.paths, "model not mongoose format. 'schema.paths' property required." ) assert( model.schema.tree, "model not mongoose format. 'schema.t...
[ "function", "(", "model", ",", "logger", ")", "{", "assert", "(", "model", ".", "schema", ",", "\"model not mongoose format. 'schema' property required.\"", ")", "assert", "(", "model", ".", "schema", ".", "paths", ",", "\"model not mongoose format. 'schema.paths' prope...
Assert that a given model follows the mongoose model format. @param model @param logger @returns {boolean}
[ "Assert", "that", "a", "given", "model", "follows", "the", "mongoose", "model", "format", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/validation-helper.js#L12-L43
train
JKHeadley/rest-hapi
seed/user.model.js
function(server, model, options, logger) { const Log = logger.bind('Password Update') let Boom = require('boom') let collectionName = model.collectionDisplayName || model.modelName Log.note('Generating Password Update endpoint for ' + collectionName) let handler = as...
javascript
function(server, model, options, logger) { const Log = logger.bind('Password Update') let Boom = require('boom') let collectionName = model.collectionDisplayName || model.modelName Log.note('Generating Password Update endpoint for ' + collectionName) let handler = as...
[ "function", "(", "server", ",", "model", ",", "options", ",", "logger", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", "'Password Update'", ")", "let", "Boom", "=", "require", "(", "'boom'", ")", "let", "collectionName", "=", "model", ".", ...
Password Update Endpoint
[ "Password", "Update", "Endpoint" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/seed/user.model.js#L57-L112
train
JKHeadley/rest-hapi
rest-hapi.js
getLogger
function getLogger(label) { let config = defaultConfig extend(true, config, module.exports.config) let rootLogger = logging.getLogger(chalk.gray(label)) rootLogger.logLevel = config.loglevel return rootLogger }
javascript
function getLogger(label) { let config = defaultConfig extend(true, config, module.exports.config) let rootLogger = logging.getLogger(chalk.gray(label)) rootLogger.logLevel = config.loglevel return rootLogger }
[ "function", "getLogger", "(", "label", ")", "{", "let", "config", "=", "defaultConfig", "extend", "(", "true", ",", "config", ",", "module", ".", "exports", ".", "config", ")", "let", "rootLogger", "=", "logging", ".", "getLogger", "(", "chalk", ".", "gr...
Get a new Log object with a root label. @param label: The root label for the Log. @returns {*}
[ "Get", "a", "new", "Log", "object", "with", "a", "root", "label", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/rest-hapi.js#L132-L142
train
JKHeadley/rest-hapi
rest-hapi.js
mongooseInit
function mongooseInit(mongoose, logger, config) { const Log = logger.bind('mongoose-init') mongoose.Promise = Promise logUtil.logActionStart( Log, 'Connecting to Database', _.omit(config.mongo, ['pass']) ) mongoose.connect(config.mongo.URI) globals.mongoose = mongoose Log.log('mongoose co...
javascript
function mongooseInit(mongoose, logger, config) { const Log = logger.bind('mongoose-init') mongoose.Promise = Promise logUtil.logActionStart( Log, 'Connecting to Database', _.omit(config.mongo, ['pass']) ) mongoose.connect(config.mongo.URI) globals.mongoose = mongoose Log.log('mongoose co...
[ "function", "mongooseInit", "(", "mongoose", ",", "logger", ",", "config", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", "'mongoose-init'", ")", "mongoose", ".", "Promise", "=", "Promise", "logUtil", ".", "logActionStart", "(", "Log", ",", "'C...
Connect mongoose and add to globals. @param mongoose @param logger @param config @returns {*}
[ "Connect", "mongoose", "and", "add", "to", "globals", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/rest-hapi.js#L151-L169
train
JKHeadley/rest-hapi
rest-hapi.js
registerMrHorse
async function registerMrHorse(server, logger, config) { const Log = logger.bind('register-MrHorse') let policyPath = '' if (config.enablePolicies) { if (config.absolutePolicyPath === true) { policyPath = config.policyPath } else { policyPath = __dirname.replace( 'node_modules/rest-h...
javascript
async function registerMrHorse(server, logger, config) { const Log = logger.bind('register-MrHorse') let policyPath = '' if (config.enablePolicies) { if (config.absolutePolicyPath === true) { policyPath = config.policyPath } else { policyPath = __dirname.replace( 'node_modules/rest-h...
[ "async", "function", "registerMrHorse", "(", "server", ",", "logger", ",", "config", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", "'register-MrHorse'", ")", "let", "policyPath", "=", "''", "if", "(", "config", ".", "enablePolicies", ")", "{",...
Register and configure the mrhorse plugin. @param server @param logger @param config @returns {Promise<void>}
[ "Register", "and", "configure", "the", "mrhorse", "plugin", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/rest-hapi.js#L178-L211
train
JKHeadley/rest-hapi
rest-hapi.js
registerHapiSwagger
async function registerHapiSwagger(server, logger, config) { const Log = logger.bind('register-hapi-swagger') let swaggerOptions = { documentationPath: '/', host: config.swaggerHost, expanded: config.docExpansion, swaggerUI: config.enableSwaggerUI, documentationPage: config.enableSwaggerUI, ...
javascript
async function registerHapiSwagger(server, logger, config) { const Log = logger.bind('register-hapi-swagger') let swaggerOptions = { documentationPath: '/', host: config.swaggerHost, expanded: config.docExpansion, swaggerUI: config.enableSwaggerUI, documentationPage: config.enableSwaggerUI, ...
[ "async", "function", "registerHapiSwagger", "(", "server", ",", "logger", ",", "config", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", "'register-hapi-swagger'", ")", "let", "swaggerOptions", "=", "{", "documentationPath", ":", "'/'", ",", "host",...
Register and configure the hapi-swagger plugin. @param server @param logger @param config @returns {Promise<void>}
[ "Register", "and", "configure", "the", "hapi", "-", "swagger", "plugin", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/rest-hapi.js#L220-L253
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(model, query, mongooseQuery, logger) { // This line has to come first validationHelper.validateModel(model, logger) const Log = logger.bind() // (email == 'test@user.com' && (firstName == 'test2@user.com' || firstName == 'test4@user.com')) && (age < 15 || age > 30) // LITERAL // { /...
javascript
function(model, query, mongooseQuery, logger) { // This line has to come first validationHelper.validateModel(model, logger) const Log = logger.bind() // (email == 'test@user.com' && (firstName == 'test2@user.com' || firstName == 'test4@user.com')) && (age < 15 || age > 30) // LITERAL // { /...
[ "function", "(", "model", ",", "query", ",", "mongooseQuery", ",", "logger", ")", "{", "// This line has to come first", "validationHelper", ".", "validateModel", "(", "model", ",", "logger", ")", "const", "Log", "=", "logger", ".", "bind", "(", ")", "// (emai...
Create a mongoose query based off of the request query @param model: A mongoose model object. @param query: The incoming request query. @param mongooseQuery: A mongoose query. @param logger: A logging object. @returns {*}: A modified mongoose query.
[ "Create", "a", "mongoose", "query", "based", "off", "of", "the", "request", "query" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L41-L144
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) let readableFields = [] let fields = model.schema.paths for (let fieldName in fields) { let field = fields[fieldName].options if (!field.exclude && fieldName !== '__v') { rea...
javascript
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) let readableFields = [] let fields = model.schema.paths for (let fieldName in fields) { let field = fields[fieldName].options if (!field.exclude && fieldName !== '__v') { rea...
[ "function", "(", "model", ",", "logger", ")", "{", "// This line has to come first", "validationHelper", ".", "validateModel", "(", "model", ",", "logger", ")", "let", "readableFields", "=", "[", "]", "let", "fields", "=", "model", ".", "schema", ".", "paths",...
Get a list of fields that can be returned as part of a query result. @param model: A mongoose model object. @param logger: A logging object. @returns {Array}: A list of fields.
[ "Get", "a", "list", "of", "fields", "that", "can", "be", "returned", "as", "part", "of", "a", "query", "result", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L152-L168
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) const Log = logger.bind() let sortableFields = this.getReadableFields(model, Log) for (let i = sortableFields.length - 1; i >= 0; i--) { let descendingField = '-' + sortableFields[i] ...
javascript
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) const Log = logger.bind() let sortableFields = this.getReadableFields(model, Log) for (let i = sortableFields.length - 1; i >= 0; i--) { let descendingField = '-' + sortableFields[i] ...
[ "function", "(", "model", ",", "logger", ")", "{", "// This line has to come first", "validationHelper", ".", "validateModel", "(", "model", ",", "logger", ")", "const", "Log", "=", "logger", ".", "bind", "(", ")", "let", "sortableFields", "=", "this", ".", ...
Get a list of valid query sort inputs. @param model: A mongoose model object. @param logger: A logging object. @returns {Array}: A list of fields.
[ "Get", "a", "list", "of", "valid", "query", "sort", "inputs", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L176-L189
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) let queryableFields = [] let fields = model.schema.paths let fieldNames = Object.keys(fields) let associations = model.routeOptions ? model.routeOptions.associations : null ...
javascript
function(model, logger) { // This line has to come first validationHelper.validateModel(model, logger) let queryableFields = [] let fields = model.schema.paths let fieldNames = Object.keys(fields) let associations = model.routeOptions ? model.routeOptions.associations : null ...
[ "function", "(", "model", ",", "logger", ")", "{", "// This line has to come first", "validationHelper", ".", "validateModel", "(", "model", ",", "logger", ")", "let", "queryableFields", "=", "[", "]", "let", "fields", "=", "model", ".", "schema", ".", "paths"...
Get a list of fields that can be queried against. @param model: A mongoose model object. @param logger: A logging object. @returns {Array}: A list of fields.
[ "Get", "a", "list", "of", "fields", "that", "can", "be", "queried", "against", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L197-L230
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(query, mongooseQuery, logger) { const Log = logger.bind() if (query.$page) { mongooseQuery = this.setPage(query, mongooseQuery, Log) } else { mongooseQuery = this.setSkip(query, mongooseQuery, Log) } mongooseQuery = this.setLimit(query, mongooseQuery, Log) return mongooseQ...
javascript
function(query, mongooseQuery, logger) { const Log = logger.bind() if (query.$page) { mongooseQuery = this.setPage(query, mongooseQuery, Log) } else { mongooseQuery = this.setSkip(query, mongooseQuery, Log) } mongooseQuery = this.setLimit(query, mongooseQuery, Log) return mongooseQ...
[ "function", "(", "query", ",", "mongooseQuery", ",", "logger", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", ")", "if", "(", "query", ".", "$page", ")", "{", "mongooseQuery", "=", "this", ".", "setPage", "(", "query", ",", "mongooseQuery",...
Handle pagination for the query if needed. @param query: The incoming request query. @param mongooseQuery: A mongoose query. @param logger: A logging object. @returns {*}: The updated mongoose query.
[ "Handle", "pagination", "for", "the", "query", "if", "needed", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L257-L268
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(query, mongooseQuery, logger) { if (query.$exclude) { if (!Array.isArray(query.$exclude)) { query.$exclude = query.$exclude.split(',') } mongooseQuery.where({ _id: { $nin: query.$exclude } }) delete query.$exclude } return mongooseQuery }
javascript
function(query, mongooseQuery, logger) { if (query.$exclude) { if (!Array.isArray(query.$exclude)) { query.$exclude = query.$exclude.split(',') } mongooseQuery.where({ _id: { $nin: query.$exclude } }) delete query.$exclude } return mongooseQuery }
[ "function", "(", "query", ",", "mongooseQuery", ",", "logger", ")", "{", "if", "(", "query", ".", "$exclude", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "query", ".", "$exclude", ")", ")", "{", "query", ".", "$exclude", "=", "query", "...
Set the list of objectIds to exclude. @param query: The incoming request query. @param mongooseQuery: A mongoose query. @param logger: A logging object. @returns {*}: The updated mongoose query.
[ "Set", "the", "list", "of", "objectIds", "to", "exclude", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L320-L330
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(query, model, logger) { const Log = logger.bind() if (query.$term) { query.$or = [] // TODO: allow option to choose ANDing or ORing of searchFields/queryableFields let queryableFields = this.getQueryableFields(model, Log) let stringFields = this.getStringFields(model, Log) // E...
javascript
function(query, model, logger) { const Log = logger.bind() if (query.$term) { query.$or = [] // TODO: allow option to choose ANDing or ORing of searchFields/queryableFields let queryableFields = this.getQueryableFields(model, Log) let stringFields = this.getStringFields(model, Log) // E...
[ "function", "(", "query", ",", "model", ",", "logger", ")", "{", "const", "Log", "=", "logger", ".", "bind", "(", ")", "if", "(", "query", ".", "$term", ")", "{", "query", ".", "$or", "=", "[", "]", "// TODO: allow option to choose ANDing or ORing of searc...
Perform a regex search on the models immediate fields @param query:The incoming request query. @param model: A mongoose model object @param logger: A logging object
[ "Perform", "a", "regex", "search", "on", "the", "models", "immediate", "fields" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L338-L377
train
JKHeadley/rest-hapi
utilities/query-helper.js
function(query, mongooseQuery, logger) { if (query.$sort) { if (Array.isArray(query.$sort)) { query.$sort = query.$sort.join(' ') } mongooseQuery.sort(query.$sort) delete query.$sort } return mongooseQuery }
javascript
function(query, mongooseQuery, logger) { if (query.$sort) { if (Array.isArray(query.$sort)) { query.$sort = query.$sort.join(' ') } mongooseQuery.sort(query.$sort) delete query.$sort } return mongooseQuery }
[ "function", "(", "query", ",", "mongooseQuery", ",", "logger", ")", "{", "if", "(", "query", ".", "$sort", ")", "{", "if", "(", "Array", ".", "isArray", "(", "query", ".", "$sort", ")", ")", "{", "query", ".", "$sort", "=", "query", ".", "$sort", ...
Set the sort priority for the mongoose query. @param query: The incoming request query. @param mongooseQuery: A mongoose query. @param logger: A logging object. @returns {*}: The updated mongoose query.
[ "Set", "the", "sort", "priority", "for", "the", "mongoose", "query", "." ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L435-L444
train
JKHeadley/rest-hapi
utilities/query-helper.js
getReference
function getReference(model, embed, logger) { let property = model.schema.obj[embed] while (_.isArray(property)) { property = property[0] } if (property && property.ref) { return { model: property.ref, include: { model: globals.mongoose.model(property.ref), as: embed } } } else { r...
javascript
function getReference(model, embed, logger) { let property = model.schema.obj[embed] while (_.isArray(property)) { property = property[0] } if (property && property.ref) { return { model: property.ref, include: { model: globals.mongoose.model(property.ref), as: embed } } } else { r...
[ "function", "getReference", "(", "model", ",", "embed", ",", "logger", ")", "{", "let", "property", "=", "model", ".", "schema", ".", "obj", "[", "embed", "]", "while", "(", "_", ".", "isArray", "(", "property", ")", ")", "{", "property", "=", "prope...
Creates an association object from a model property if the property is a reference id @param model @param embed @param logger @returns {*} The association object or null if no reference is found
[ "Creates", "an", "association", "object", "from", "a", "model", "property", "if", "the", "property", "is", "a", "reference", "id" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/query-helper.js#L638-L651
train
JKHeadley/rest-hapi
utilities/auth-helper.js
function(model, type, logger) { let routeScope = model.routeOptions.routeScope || {} let rootScope = routeScope.rootScope let scope = [] let additionalScope = null switch (type) { case 'create': additionalScope = routeScope.createScope break case 'read': additio...
javascript
function(model, type, logger) { let routeScope = model.routeOptions.routeScope || {} let rootScope = routeScope.rootScope let scope = [] let additionalScope = null switch (type) { case 'create': additionalScope = routeScope.createScope break case 'read': additio...
[ "function", "(", "model", ",", "type", ",", "logger", ")", "{", "let", "routeScope", "=", "model", ".", "routeOptions", ".", "routeScope", "||", "{", "}", "let", "rootScope", "=", "routeScope", ".", "rootScope", "let", "scope", "=", "[", "]", "let", "a...
Generates the proper scope for an endpoint based on the model routeOptions @param model: A mongoose model @param type: The scope CRUD type. Valid values are 'create', 'read', 'update', 'delete', and 'associate'. @param logger: A logging object @returns {Array}: A list of authorization scopes for the endpoint.
[ "Generates", "the", "proper", "scope", "for", "an", "endpoint", "based", "on", "the", "model", "routeOptions" ]
36110fd3cb2775b3b2068b18d775f1c87fbcef76
https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/auth-helper.js#L13-L59
train
textlint/textlint
packages/textlint/bin/textlint.js
showError
function showError(error) { console.error(logSymbols.error, "Error"); console.error(`${error.message}\n`); console.error(logSymbols.error, "Stack trace"); console.error(error.stack); }
javascript
function showError(error) { console.error(logSymbols.error, "Error"); console.error(`${error.message}\n`); console.error(logSymbols.error, "Stack trace"); console.error(error.stack); }
[ "function", "showError", "(", "error", ")", "{", "console", ".", "error", "(", "logSymbols", ".", "error", ",", "\"Error\"", ")", ";", "console", ".", "error", "(", "`", "${", "error", ".", "message", "}", "\\n", "`", ")", ";", "console", ".", "error...
show error message for user @param {Error} error
[ "show", "error", "message", "for", "user" ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/packages/textlint/bin/textlint.js#L22-L27
train
textlint/textlint
packages/@textlint/markdown-to-ast/src/markdown-parser.js
parse
function parse(text) { const ast = remark.parse(text); const src = new StructuredSource(text); traverse(ast).forEach(function(node) { // eslint-disable-next-line no-invalid-this if (this.notLeaf) { if (node.type) { const replacedType = SyntaxMap[node.type]; ...
javascript
function parse(text) { const ast = remark.parse(text); const src = new StructuredSource(text); traverse(ast).forEach(function(node) { // eslint-disable-next-line no-invalid-this if (this.notLeaf) { if (node.type) { const replacedType = SyntaxMap[node.type]; ...
[ "function", "parse", "(", "text", ")", "{", "const", "ast", "=", "remark", ".", "parse", "(", "text", ")", ";", "const", "src", "=", "new", "StructuredSource", "(", "text", ")", ";", "traverse", "(", "ast", ")", ".", "forEach", "(", "function", "(", ...
parse markdown text and return ast mapped location info. @param {string} text @returns {TxtNode}
[ "parse", "markdown", "text", "and", "return", "ast", "mapped", "location", "info", "." ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/packages/@textlint/markdown-to-ast/src/markdown-parser.js#L19-L55
train
textlint/textlint
packages/@textlint/text-to-ast/src/plaintext-parser.js
createParagraph
function createParagraph(nodes) { const firstNode = nodes[0]; const lastNode = nodes[nodes.length - 1]; return { type: Syntax.Paragraph, raw: nodes .map(function(node) { return node.raw; }) .join(""), range: [firstNode.range[0], las...
javascript
function createParagraph(nodes) { const firstNode = nodes[0]; const lastNode = nodes[nodes.length - 1]; return { type: Syntax.Paragraph, raw: nodes .map(function(node) { return node.raw; }) .join(""), range: [firstNode.range[0], las...
[ "function", "createParagraph", "(", "nodes", ")", "{", "const", "firstNode", "=", "nodes", "[", "0", "]", ";", "const", "lastNode", "=", "nodes", "[", "nodes", ".", "length", "-", "1", "]", ";", "return", "{", "type", ":", "Syntax", ".", "Paragraph", ...
create paragraph node from TxtNodes @param {[TxtNode]} nodes @returns {TxtNode} Paragraph node
[ "create", "paragraph", "node", "from", "TxtNodes" ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/packages/@textlint/text-to-ast/src/plaintext-parser.js#L72-L95
train
textlint/textlint
packages/@textlint/text-to-ast/src/plaintext-parser.js
parse
function parse(text) { const textLineByLine = text.split(LINEBREAKE_MARK); // it should be alternately Str and Break let startIndex = 0; const lastLineIndex = textLineByLine.length - 1; const isLasEmptytLine = (line, index) => { return index === lastLineIndex && line === ""; }; const...
javascript
function parse(text) { const textLineByLine = text.split(LINEBREAKE_MARK); // it should be alternately Str and Break let startIndex = 0; const lastLineIndex = textLineByLine.length - 1; const isLasEmptytLine = (line, index) => { return index === lastLineIndex && line === ""; }; const...
[ "function", "parse", "(", "text", ")", "{", "const", "textLineByLine", "=", "text", ".", "split", "(", "LINEBREAKE_MARK", ")", ";", "// it should be alternately Str and Break", "let", "startIndex", "=", "0", ";", "const", "lastLineIndex", "=", "textLineByLine", "....
parse text and return ast mapped location info. @param {string} text @returns {TxtNode}
[ "parse", "text", "and", "return", "ast", "mapped", "location", "info", "." ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/packages/@textlint/text-to-ast/src/plaintext-parser.js#L102-L154
train
textlint/textlint
examples/perf/perf.js
time
function time(cmd, runs, runNumber, results, cb) { var start = process.hrtime(); exec(cmd, { silent: true }, function() { var diff = process.hrtime(start), actual = diff[0] * 1e3 + diff[1] / 1e6; // ms results.push(actual); echo("Performance Run #" + runNumber + ": %dms", a...
javascript
function time(cmd, runs, runNumber, results, cb) { var start = process.hrtime(); exec(cmd, { silent: true }, function() { var diff = process.hrtime(start), actual = diff[0] * 1e3 + diff[1] / 1e6; // ms results.push(actual); echo("Performance Run #" + runNumber + ": %dms", a...
[ "function", "time", "(", "cmd", ",", "runs", ",", "runNumber", ",", "results", ",", "cb", ")", "{", "var", "start", "=", "process", ".", "hrtime", "(", ")", ";", "exec", "(", "cmd", ",", "{", "silent", ":", "true", "}", ",", "function", "(", ")",...
Calculates the time for each run for performance @param {string} cmd cmd @param {int} runs Total number of runs to do @param {int} runNumber Current run number @param {int[]} results Collection results from each run @param {function} cb Function to call when everything is done @returns {int[]} calls the cb with all the...
[ "Calculates", "the", "time", "for", "each", "run", "for", "performance" ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/examples/perf/perf.js#L22-L36
train
textlint/textlint
examples/rulesdir/rules/no-todo.js
getParents
function getParents(node) { var result = []; var parent = node.parent; while (parent != null) { result.push(parent); parent = parent.parent; } return result; }
javascript
function getParents(node) { var result = []; var parent = node.parent; while (parent != null) { result.push(parent); parent = parent.parent; } return result; }
[ "function", "getParents", "(", "node", ")", "{", "var", "result", "=", "[", "]", ";", "var", "parent", "=", "node", ".", "parent", ";", "while", "(", "parent", "!=", "null", ")", "{", "result", ".", "push", "(", "parent", ")", ";", "parent", "=", ...
Get parents of node. The parent nodes are returned in order from the closest parent to the outer ones. @param node @returns {Array}
[ "Get", "parents", "of", "node", ".", "The", "parent", "nodes", "are", "returned", "in", "order", "from", "the", "closest", "parent", "to", "the", "outer", "ones", "." ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/examples/rulesdir/rules/no-todo.js#L10-L18
train
textlint/textlint
examples/rulesdir/rules/no-todo.js
isNodeWrapped
function isNodeWrapped(node, types) { var parents = getParents(node); var parentsTypes = parents.map(function(parent) { return parent.type; }); return types.some(function(type) { return parentsTypes.some(function(parentType) { return parentType === type; }); }); }
javascript
function isNodeWrapped(node, types) { var parents = getParents(node); var parentsTypes = parents.map(function(parent) { return parent.type; }); return types.some(function(type) { return parentsTypes.some(function(parentType) { return parentType === type; }); }); }
[ "function", "isNodeWrapped", "(", "node", ",", "types", ")", "{", "var", "parents", "=", "getParents", "(", "node", ")", ";", "var", "parentsTypes", "=", "parents", ".", "map", "(", "function", "(", "parent", ")", "{", "return", "parent", ".", "type", ...
Return true if `node` is wrapped any one of `types`. @param {TxtNode} node is target node @param {string[]} types are wrapped target node @returns {boolean}
[ "Return", "true", "if", "node", "is", "wrapped", "any", "one", "of", "types", "." ]
61ebd75dac6804827aad9b4268867c60e328e566
https://github.com/textlint/textlint/blob/61ebd75dac6804827aad9b4268867c60e328e566/examples/rulesdir/rules/no-todo.js#L25-L35
train
slanatech/swagger-stats
ui/plugins/cubism/cubism.v1.js
cubism_graphiteParse
function cubism_graphiteParse(text) { var i = text.indexOf("|"), meta = text.substring(0, i), c = meta.lastIndexOf(","), b = meta.lastIndexOf(",", c - 1), a = meta.lastIndexOf(",", b - 1), start = meta.substring(a + 1, b) * 1000, step = meta.substring(c + 1) * 1000; return text ...
javascript
function cubism_graphiteParse(text) { var i = text.indexOf("|"), meta = text.substring(0, i), c = meta.lastIndexOf(","), b = meta.lastIndexOf(",", c - 1), a = meta.lastIndexOf(",", b - 1), start = meta.substring(a + 1, b) * 1000, step = meta.substring(c + 1) * 1000; return text ...
[ "function", "cubism_graphiteParse", "(", "text", ")", "{", "var", "i", "=", "text", ".", "indexOf", "(", "\"|\"", ")", ",", "meta", "=", "text", ".", "substring", "(", "0", ",", "i", ")", ",", "c", "=", "meta", ".", "lastIndexOf", "(", "\",\"", ")"...
Helper method for parsing graphite's raw format.
[ "Helper", "method", "for", "parsing", "graphite", "s", "raw", "format", "." ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/ui/plugins/cubism/cubism.v1.js#L428-L441
train
slanatech/swagger-stats
ui/plugins/cubism/cubism.v1.js
prepare
function prepare(start1, stop) { var steps = Math.min(size, Math.round((start1 - start) / step)); if (!steps || fetching) return; // already fetched, or fetching! fetching = true; steps = Math.min(size, steps + cubism_metricOverlap); var start0 = new Date(stop - steps * step); request(start0, st...
javascript
function prepare(start1, stop) { var steps = Math.min(size, Math.round((start1 - start) / step)); if (!steps || fetching) return; // already fetched, or fetching! fetching = true; steps = Math.min(size, steps + cubism_metricOverlap); var start0 = new Date(stop - steps * step); request(start0, st...
[ "function", "prepare", "(", "start1", ",", "stop", ")", "{", "var", "steps", "=", "Math", ".", "min", "(", "size", ",", "Math", ".", "round", "(", "(", "start1", "-", "start", ")", "/", "step", ")", ")", ";", "if", "(", "!", "steps", "||", "fet...
Prefetch new data into a temporary array.
[ "Prefetch", "new", "data", "into", "a", "temporary", "array", "." ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/ui/plugins/cubism/cubism.v1.js#L593-L606
train
slanatech/swagger-stats
ui/plugins/cubism/cubism.v1.js
beforechange
function beforechange(start1, stop1) { if (!isFinite(start)) start = start1; values.splice(0, Math.max(0, Math.min(size, Math.round((start1 - start) / step)))); start = start1; stop = stop1; }
javascript
function beforechange(start1, stop1) { if (!isFinite(start)) start = start1; values.splice(0, Math.max(0, Math.min(size, Math.round((start1 - start) / step)))); start = start1; stop = stop1; }
[ "function", "beforechange", "(", "start1", ",", "stop1", ")", "{", "if", "(", "!", "isFinite", "(", "start", ")", ")", "start", "=", "start1", ";", "values", ".", "splice", "(", "0", ",", "Math", ".", "max", "(", "0", ",", "Math", ".", "min", "("...
When the context changes, switch to the new data, ready-or-not!
[ "When", "the", "context", "changes", "switch", "to", "the", "new", "data", "ready", "-", "or", "-", "not!" ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/ui/plugins/cubism/cubism.v1.js#L609-L614
train
slanatech/swagger-stats
ui/plugins/cubism/cubism.v1.js
cubism_metricShift
function cubism_metricShift(request, offset) { return function(start, stop, step, callback) { request(new Date(+start + offset), new Date(+stop + offset), step, callback); }; }
javascript
function cubism_metricShift(request, offset) { return function(start, stop, step, callback) { request(new Date(+start + offset), new Date(+stop + offset), step, callback); }; }
[ "function", "cubism_metricShift", "(", "request", ",", "offset", ")", "{", "return", "function", "(", "start", ",", "stop", ",", "step", ",", "callback", ")", "{", "request", "(", "new", "Date", "(", "+", "start", "+", "offset", ")", ",", "new", "Date"...
Wraps the specified request implementation, and shifts time by the given offset.
[ "Wraps", "the", "specified", "request", "implementation", "and", "shifts", "time", "by", "the", "given", "offset", "." ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/ui/plugins/cubism/cubism.v1.js#L665-L669
train
slanatech/swagger-stats
lib/swsInterface.js
expireSessionIDs
function expireSessionIDs(){ var tssec = Date.now(); var expired = []; for(var sid in sessionIDs){ if(sessionIDs[sid] < (tssec + 500)){ expired.push(sid); } } for(var i=0;i<expired.length;i++){ delete sessionIDs[expired[i]]; debug('Session ID expired: %s',...
javascript
function expireSessionIDs(){ var tssec = Date.now(); var expired = []; for(var sid in sessionIDs){ if(sessionIDs[sid] < (tssec + 500)){ expired.push(sid); } } for(var i=0;i<expired.length;i++){ delete sessionIDs[expired[i]]; debug('Session ID expired: %s',...
[ "function", "expireSessionIDs", "(", ")", "{", "var", "tssec", "=", "Date", ".", "now", "(", ")", ";", "var", "expired", "=", "[", "]", ";", "for", "(", "var", "sid", "in", "sessionIDs", ")", "{", "if", "(", "sessionIDs", "[", "sid", "]", "<", "(...
If authentication is enabled, executed periodically and expires old session IDs
[ "If", "authentication", "is", "enabled", "executed", "periodically", "and", "expires", "old", "session", "IDs" ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/lib/swsInterface.js#L60-L72
train
slanatech/swagger-stats
lib/swsInterface.js
processOptions
function processOptions(options){ if(!options) return; for(var op in swsUtil.supportedOptions){ if(op in options){ swsOptions[op] = options[op]; } } // update standard path pathUI = swsOptions.uriPath+'/ui'; pathDist = swsOptions.uriPath+'/dist'; pathStats = sws...
javascript
function processOptions(options){ if(!options) return; for(var op in swsUtil.supportedOptions){ if(op in options){ swsOptions[op] = options[op]; } } // update standard path pathUI = swsOptions.uriPath+'/ui'; pathDist = swsOptions.uriPath+'/dist'; pathStats = sws...
[ "function", "processOptions", "(", "options", ")", "{", "if", "(", "!", "options", ")", "return", ";", "for", "(", "var", "op", "in", "swsUtil", ".", "supportedOptions", ")", "{", "if", "(", "op", "in", "options", ")", "{", "swsOptions", "[", "op", "...
Override defaults if options are provided
[ "Override", "defaults", "if", "options", "are", "provided" ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/lib/swsInterface.js#L104-L123
train
slanatech/swagger-stats
lib/swsInterface.js
function (options) { processOptions(options); processor = new swsProcessor(); processor.init(swsOptions); return function trackingMiddleware(req, res, next) { // Respond to requests handled by swagger-stats // swagger-stats requests will not be counted in stat...
javascript
function (options) { processOptions(options); processor = new swsProcessor(); processor.init(swsOptions); return function trackingMiddleware(req, res, next) { // Respond to requests handled by swagger-stats // swagger-stats requests will not be counted in stat...
[ "function", "(", "options", ")", "{", "processOptions", "(", "options", ")", ";", "processor", "=", "new", "swsProcessor", "(", ")", ";", "processor", ".", "init", "(", "swsOptions", ")", ";", "return", "function", "trackingMiddleware", "(", "req", ",", "r...
Initialize swagger-stats and return middleware to perform API Data collection
[ "Initialize", "swagger", "-", "stats", "and", "return", "middleware", "to", "perform", "API", "Data", "collection" ]
94b99c98ae5fadad72c250d516333b603e9b0fc1
https://github.com/slanatech/swagger-stats/blob/94b99c98ae5fadad72c250d516333b603e9b0fc1/lib/swsInterface.js#L326-L369
train
rajgoel/reveal.js-plugins
broadcast/RTCMultiConnection.js
getIPs
function getIPs(callback) { if (typeof document === 'undefined' || typeof document.getElementById !== 'function') { return; } var ipDuplicates = {}; //compatibility for firefox and chrome var RTCPeerConnection = window.RTCPeerConnection || wi...
javascript
function getIPs(callback) { if (typeof document === 'undefined' || typeof document.getElementById !== 'function') { return; } var ipDuplicates = {}; //compatibility for firefox and chrome var RTCPeerConnection = window.RTCPeerConnection || wi...
[ "function", "getIPs", "(", "callback", ")", "{", "if", "(", "typeof", "document", "===", "'undefined'", "||", "typeof", "document", ".", "getElementById", "!==", "'function'", ")", "{", "return", ";", "}", "var", "ipDuplicates", "=", "{", "}", ";", "//comp...
get the IP addresses associated with an account
[ "get", "the", "IP", "addresses", "associated", "with", "an", "account" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/broadcast/RTCMultiConnection.js#L1423-L1529
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
getObject
function getObject() { return objectPool.pop() || { 'array': null, 'cache': null, 'criteria': null, 'false': false, 'index': 0, 'null': false, 'number': null, 'object': null, 'push': null, 'string': null, 'true': false, 'undefined': false, ...
javascript
function getObject() { return objectPool.pop() || { 'array': null, 'cache': null, 'criteria': null, 'false': false, 'index': 0, 'null': false, 'number': null, 'object': null, 'push': null, 'string': null, 'true': false, 'undefined': false, ...
[ "function", "getObject", "(", ")", "{", "return", "objectPool", ".", "pop", "(", ")", "||", "{", "'array'", ":", "null", ",", "'cache'", ":", "null", ",", "'criteria'", ":", "null", ",", "'false'", ":", "false", ",", "'index'", ":", "0", ",", "'null'...
Gets an object from the object pool or creates a new one if the pool is empty. @private @returns {Object} The object from the pool.
[ "Gets", "an", "object", "from", "the", "object", "pool", "or", "creates", "a", "new", "one", "if", "the", "pool", "is", "empty", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L345-L361
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
releaseArray
function releaseArray(array) { array.length = 0; if (arrayPool.length < maxPoolSize) { arrayPool.push(array); } }
javascript
function releaseArray(array) { array.length = 0; if (arrayPool.length < maxPoolSize) { arrayPool.push(array); } }
[ "function", "releaseArray", "(", "array", ")", "{", "array", ".", "length", "=", "0", ";", "if", "(", "arrayPool", ".", "length", "<", "maxPoolSize", ")", "{", "arrayPool", ".", "push", "(", "array", ")", ";", "}", "}" ]
Releases the given array back to the array pool. @private @param {Array} [array] The array to release.
[ "Releases", "the", "given", "array", "back", "to", "the", "array", "pool", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L369-L374
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
releaseObject
function releaseObject(object) { var cache = object.cache; if (cache) { releaseObject(cache); } object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; if (objectPool.length < maxPoolSize) { objectPool.push(object); } }
javascript
function releaseObject(object) { var cache = object.cache; if (cache) { releaseObject(cache); } object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; if (objectPool.length < maxPoolSize) { objectPool.push(object); } }
[ "function", "releaseObject", "(", "object", ")", "{", "var", "cache", "=", "object", ".", "cache", ";", "if", "(", "cache", ")", "{", "releaseObject", "(", "cache", ")", ";", "}", "object", ".", "array", "=", "object", ".", "cache", "=", "object", "....
Releases the given object back to the object pool. @private @param {Object} [object] The object to release.
[ "Releases", "the", "given", "object", "back", "to", "the", "object", "pool", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L382-L391
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
create
function create(prototype, properties) { var result = baseCreate(prototype); return properties ? assign(result, properties) : result; }
javascript
function create(prototype, properties) { var result = baseCreate(prototype); return properties ? assign(result, properties) : result; }
[ "function", "create", "(", "prototype", ",", "properties", ")", "{", "var", "result", "=", "baseCreate", "(", "prototype", ")", ";", "return", "properties", "?", "assign", "(", "result", ",", "properties", ")", ":", "result", ";", "}" ]
Creates an object that inherits from the given `prototype` object. If a `properties` object is provided its own enumerable properties are assigned to the created object. @static @memberOf _ @category Objects @param {Object} prototype The object to inherit from. @param {Object} [properties] The properties to assign to ...
[ "Creates", "an", "object", "that", "inherits", "from", "the", "given", "prototype", "object", ".", "If", "a", "properties", "object", "is", "provided", "its", "own", "enumerable", "properties", "are", "assigned", "to", "the", "created", "object", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L1833-L1836
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
memoize
function memoize(func, resolver) { if (!isFunction(func)) { throw new TypeError; } var memoized = function() { var cache = memoized.cache, key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; return hasOwnProperty.call(cache, key) ...
javascript
function memoize(func, resolver) { if (!isFunction(func)) { throw new TypeError; } var memoized = function() { var cache = memoized.cache, key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; return hasOwnProperty.call(cache, key) ...
[ "function", "memoize", "(", "func", ",", "resolver", ")", "{", "if", "(", "!", "isFunction", "(", "func", ")", ")", "{", "throw", "new", "TypeError", ";", "}", "var", "memoized", "=", "function", "(", ")", "{", "var", "cache", "=", "memoized", ".", ...
Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed w...
[ "Creates", "a", "function", "that", "memoizes", "the", "result", "of", "func", ".", "If", "resolver", "is", "provided", "it", "will", "be", "used", "to", "determine", "the", "cache", "key", "for", "storing", "the", "result", "based", "on", "the", "argument...
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L5559-L5573
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
boolMatch
function boolMatch(s, matchers) { var i, matcher, down = s.toLowerCase(); matchers = [].concat(matchers); for (i = 0; i < matchers.length; i += 1) { matcher = matchers[i]; if (!matcher) continue; if (matcher.test && matcher.test(s)) return true; if (matcher.toLowerCase() === down) re...
javascript
function boolMatch(s, matchers) { var i, matcher, down = s.toLowerCase(); matchers = [].concat(matchers); for (i = 0; i < matchers.length; i += 1) { matcher = matchers[i]; if (!matcher) continue; if (matcher.test && matcher.test(s)) return true; if (matcher.toLowerCase() === down) re...
[ "function", "boolMatch", "(", "s", ",", "matchers", ")", "{", "var", "i", ",", "matcher", ",", "down", "=", "s", ".", "toLowerCase", "(", ")", ";", "matchers", "=", "[", "]", ".", "concat", "(", "matchers", ")", ";", "for", "(", "i", "=", "0", ...
Helper for toBoolean
[ "Helper", "for", "toBoolean" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L6831-L6840
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
compareArrays
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || ...
javascript
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || ...
[ "function", "compareArrays", "(", "array1", ",", "array2", ",", "dontConvert", ")", "{", "var", "len", "=", "Math", ".", "min", "(", "array1", ".", "length", ",", "array2", ".", "length", ")", ",", "lengthDiff", "=", "Math", ".", "abs", "(", "array1", ...
compare two arrays, return the number of differences
[ "compare", "two", "arrays", "return", "the", "number", "of", "differences" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L7885-L7897
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
getLangDefinition
function getLangDefinition(key) { var i = 0, j, lang, next, split, get = function (k) { if (!languages[k] && hasModule) { try { require('./lang/' + k); } catch (e) { } } return languages[k...
javascript
function getLangDefinition(key) { var i = 0, j, lang, next, split, get = function (k) { if (!languages[k] && hasModule) { try { require('./lang/' + k); } catch (e) { } } return languages[k...
[ "function", "getLangDefinition", "(", "key", ")", "{", "var", "i", "=", "0", ",", "j", ",", "lang", ",", "next", ",", "split", ",", "get", "=", "function", "(", "k", ")", "{", "if", "(", "!", "languages", "[", "k", "]", "&&", "hasModule", ")", ...
Determines which language definition to use and returns it. With no parameters, it will return the global language. If you pass in a language key, such as 'en', it will return the definition for 'en', so long as 'en' has already been loaded using moment.lang.
[ "Determines", "which", "language", "definition", "to", "use", "and", "returns", "it", ".", "With", "no", "parameters", "it", "will", "return", "the", "global", "language", ".", "If", "you", "pass", "in", "a", "language", "key", "such", "as", "en", "it", ...
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L8267-L8313
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
makeGetterAndSetter
function makeGetterAndSetter(name, key) { moment.fn[name] = moment.fn[name + 's'] = function (input) { var utc = this._isUTC ? 'UTC' : ''; if (input != null) { this._d['set' + utc + key](input); moment.updateOffset(this); return this; ...
javascript
function makeGetterAndSetter(name, key) { moment.fn[name] = moment.fn[name + 's'] = function (input) { var utc = this._isUTC ? 'UTC' : ''; if (input != null) { this._d['set' + utc + key](input); moment.updateOffset(this); return this; ...
[ "function", "makeGetterAndSetter", "(", "name", ",", "key", ")", "{", "moment", ".", "fn", "[", "name", "]", "=", "moment", ".", "fn", "[", "name", "+", "'s'", "]", "=", "function", "(", "input", ")", "{", "var", "utc", "=", "this", ".", "_isUTC", ...
helper for adding shortcuts
[ "helper", "for", "adding", "shortcuts" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L9584-L9595
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
unformatNumeral
function unformatNumeral (n, string) { var stringOriginal = string, thousandRegExp, millionRegExp, billionRegExp, trillionRegExp, suffixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], bytesMultiplier = false, power; if (string.indexOf(':') > -1) { n._value...
javascript
function unformatNumeral (n, string) { var stringOriginal = string, thousandRegExp, millionRegExp, billionRegExp, trillionRegExp, suffixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], bytesMultiplier = false, power; if (string.indexOf(':') > -1) { n._value...
[ "function", "unformatNumeral", "(", "n", ",", "string", ")", "{", "var", "stringOriginal", "=", "string", ",", "thousandRegExp", ",", "millionRegExp", ",", "billionRegExp", ",", "trillionRegExp", ",", "suffixes", "=", "[", "'KB'", ",", "'MB'", ",", "'GB'", "...
revert to number
[ "revert", "to", "number" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L9911-L9954
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
multiplier
function multiplier(x) { var parts = x.toString().split('.'); if (parts.length < 2) { return 1; } return Math.pow(10, parts[1].length); }
javascript
function multiplier(x) { var parts = x.toString().split('.'); if (parts.length < 2) { return 1; } return Math.pow(10, parts[1].length); }
[ "function", "multiplier", "(", "x", ")", "{", "var", "parts", "=", "x", ".", "toString", "(", ")", ".", "split", "(", "'.'", ")", ";", "if", "(", "parts", ".", "length", "<", "2", ")", "{", "return", "1", ";", "}", "return", "Math", ".", "pow",...
Computes the multiplier necessary to make x >= 1, effectively eliminating miscalculations caused by finite precision.
[ "Computes", "the", "multiplier", "necessary", "to", "make", "x", ">", "=", "1", "effectively", "eliminating", "miscalculations", "caused", "by", "finite", "precision", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L10475-L10481
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
correctionFactor
function correctionFactor() { var args = Array.prototype.slice.call(arguments); return args.reduce(function (prev, next) { var mp = multiplier(prev), mn = multiplier(next); return mp > mn ? mp : mn; }, -Infinity); }
javascript
function correctionFactor() { var args = Array.prototype.slice.call(arguments); return args.reduce(function (prev, next) { var mp = multiplier(prev), mn = multiplier(next); return mp > mn ? mp : mn; }, -Infinity); }
[ "function", "correctionFactor", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "return", "args", ".", "reduce", "(", "function", "(", "prev", ",", "next", ")", "{", "var", "mp", "=...
Given a variable number of arguments, returns the maximum multiplier that must be used to normalize an operation involving all of them.
[ "Given", "a", "variable", "number", "of", "arguments", "returns", "the", "maximum", "multiplier", "that", "must", "be", "used", "to", "normalize", "an", "operation", "involving", "all", "of", "them", "." ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L10488-L10495
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
dot
function dot(arr, arg) { if (!isArray(arr[0])) arr = [ arr ]; if (!isArray(arg[0])) arg = [ arg ]; // convert column to row vector var left = (arr[0].length === 1 && arr.length !== 1) ? jStat.transpose(arr) : arr, right = (arg[0].length === 1 && arg.length !== 1) ? jStat.transpose(arg) : arg, re...
javascript
function dot(arr, arg) { if (!isArray(arr[0])) arr = [ arr ]; if (!isArray(arg[0])) arg = [ arg ]; // convert column to row vector var left = (arr[0].length === 1 && arr.length !== 1) ? jStat.transpose(arr) : arr, right = (arg[0].length === 1 && arg.length !== 1) ? jStat.transpose(arg) : arg, re...
[ "function", "dot", "(", "arr", ",", "arg", ")", "{", "if", "(", "!", "isArray", "(", "arr", "[", "0", "]", ")", ")", "arr", "=", "[", "arr", "]", ";", "if", "(", "!", "isArray", "(", "arg", "[", "0", "]", ")", ")", "arg", "=", "[", "arg",...
Returns the dot product of two matricies
[ "Returns", "the", "dot", "product", "of", "two", "matricies" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L13185-L13204
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
pow
function pow(arr, arg) { return jStat.map(arr, function(value) { return Math.pow(value, arg); }); }
javascript
function pow(arr, arg) { return jStat.map(arr, function(value) { return Math.pow(value, arg); }); }
[ "function", "pow", "(", "arr", ",", "arg", ")", "{", "return", "jStat", ".", "map", "(", "arr", ",", "function", "(", "value", ")", "{", "return", "Math", ".", "pow", "(", "value", ",", "arg", ")", ";", "}", ")", ";", "}" ]
raise every element by a scalar
[ "raise", "every", "element", "by", "a", "scalar" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L13207-L13209
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
aug
function aug(a, b) { var newarr = a.slice(), i = 0; for (; i < newarr.length; i++) { push.apply(newarr[i], b[i]); } return newarr; }
javascript
function aug(a, b) { var newarr = a.slice(), i = 0; for (; i < newarr.length; i++) { push.apply(newarr[i], b[i]); } return newarr; }
[ "function", "aug", "(", "a", ",", "b", ")", "{", "var", "newarr", "=", "a", ".", "slice", "(", ")", ",", "i", "=", "0", ";", "for", "(", ";", "i", "<", "newarr", ".", "length", ";", "i", "++", ")", "{", "push", ".", "apply", "(", "newarr", ...
augment one matrix by another
[ "augment", "one", "matrix", "by", "another" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L13239-L13246
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
det
function det(a) { var alen = a.length, alend = alen * 2, vals = new Array(alend), rowshift = alen - 1, colshift = alend - 1, mrow = rowshift - alen + 1, mcol = colshift, i = 0, result = 0, j; // check for special 2x2 case if (alen === 2) { return a[0][0] * a[1][1] -...
javascript
function det(a) { var alen = a.length, alend = alen * 2, vals = new Array(alend), rowshift = alen - 1, colshift = alend - 1, mrow = rowshift - alen + 1, mcol = colshift, i = 0, result = 0, j; // check for special 2x2 case if (alen === 2) { return a[0][0] * a[1][1] -...
[ "function", "det", "(", "a", ")", "{", "var", "alen", "=", "a", ".", "length", ",", "alend", "=", "alen", "*", "2", ",", "vals", "=", "new", "Array", "(", "alend", ")", ",", "rowshift", "=", "alen", "-", "1", ",", "colshift", "=", "alend", "-",...
calculate the determinant of a matrix
[ "calculate", "the", "determinant", "of", "a", "matrix" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L13265-L13300
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; ...
javascript
function () { if (this.done) { return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.yytext = ''; this.match = ''; ...
[ "function", "(", ")", "{", "if", "(", "this", ".", "done", ")", "{", "return", "this", ".", "EOF", ";", "}", "if", "(", "!", "this", ".", "_input", ")", "{", "this", ".", "done", "=", "true", ";", "}", "var", "token", ",", "match", ",", "temp...
return next match in input
[ "return", "next", "match", "in", "input" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L20708-L20763
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (type) { var error = Exception.errors.filter(function (item) { return item.type === type || item.output === type; })[0]; return error ? error.output : null; }
javascript
function (type) { var error = Exception.errors.filter(function (item) { return item.type === type || item.output === type; })[0]; return error ? error.output : null; }
[ "function", "(", "type", ")", "{", "var", "error", "=", "Exception", ".", "errors", ".", "filter", "(", "function", "(", "item", ")", "{", "return", "item", ".", "type", "===", "type", "||", "item", ".", "output", "===", "type", ";", "}", ")", "[",...
get error by type @param {String} type @returns {*}
[ "get", "error", "by", "type" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L20997-L21003
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (id) { var filtered = instance.matrix.data.filter(function (cell) { if (cell.deps) { return cell.deps.indexOf(id) > -1; } }); var deps = []; filtered.forEach(function (cell) { if (deps.indexOf(cell.id) === -1) { deps.push(ce...
javascript
function (id) { var filtered = instance.matrix.data.filter(function (cell) { if (cell.deps) { return cell.deps.indexOf(id) > -1; } }); var deps = []; filtered.forEach(function (cell) { if (deps.indexOf(cell.id) === -1) { deps.push(ce...
[ "function", "(", "id", ")", "{", "var", "filtered", "=", "instance", ".", "matrix", ".", "data", ".", "filter", "(", "function", "(", "cell", ")", "{", "if", "(", "cell", ".", "deps", ")", "{", "return", "cell", ".", "deps", ".", "indexOf", "(", ...
get dependencies by element @param {String} id @returns {Array}
[ "get", "dependencies", "by", "element" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21239-L21254
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (id) { var deps = getDependencies(id); if (deps.length) { deps.forEach(function (refId) { if (allDependencies.indexOf(refId) === -1) { allDependencies.push(refId); var item = instance.matrix.getItem(refId); if (item.deps.length) ...
javascript
function (id) { var deps = getDependencies(id); if (deps.length) { deps.forEach(function (refId) { if (allDependencies.indexOf(refId) === -1) { allDependencies.push(refId); var item = instance.matrix.getItem(refId); if (item.deps.length) ...
[ "function", "(", "id", ")", "{", "var", "deps", "=", "getDependencies", "(", "id", ")", ";", "if", "(", "deps", ".", "length", ")", "{", "deps", ".", "forEach", "(", "function", "(", "refId", ")", "{", "if", "(", "allDependencies", ".", "indexOf", ...
get total dependencies @param {String} id
[ "get", "total", "dependencies" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21262-L21277
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (element) { var allDependencies = instance.matrix.getElementDependencies(element), id = element.getAttribute('id'); allDependencies.forEach(function (refId) { var item = instance.matrix.getItem(refId); if (item && item.formula) { var refElement = document.getEle...
javascript
function (element) { var allDependencies = instance.matrix.getElementDependencies(element), id = element.getAttribute('id'); allDependencies.forEach(function (refId) { var item = instance.matrix.getItem(refId); if (item && item.formula) { var refElement = document.getEle...
[ "function", "(", "element", ")", "{", "var", "allDependencies", "=", "instance", ".", "matrix", ".", "getElementDependencies", "(", "element", ")", ",", "id", "=", "element", ".", "getAttribute", "(", "'id'", ")", ";", "allDependencies", ".", "forEach", "(",...
recalculate refs cell @param {Element} element
[ "recalculate", "refs", "cell" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21297-L21308
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (formula, element) { // to avoid double translate formulas, update item data in parser var parsed = parse(formula, element), value = parsed.result, error = parsed.error, nodeName = element.nodeName.toUpperCase(); instance.matrix.updateElementItem(element, {value...
javascript
function (formula, element) { // to avoid double translate formulas, update item data in parser var parsed = parse(formula, element), value = parsed.result, error = parsed.error, nodeName = element.nodeName.toUpperCase(); instance.matrix.updateElementItem(element, {value...
[ "function", "(", "formula", ",", "element", ")", "{", "// to avoid double translate formulas, update item data in parser", "var", "parsed", "=", "parse", "(", "formula", ",", "element", ")", ",", "value", "=", "parsed", ".", "result", ",", "error", "=", "parsed", ...
calculate element formula @param {String} formula @param {Element} element @returns {Object}
[ "calculate", "element", "formula" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21316-L21332
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (element) { var id = element.getAttribute('id'), formula = element.getAttribute('data-formula'); if (formula) { // add item with basic properties to data array instance.matrix.addItem({ id: id, formula: formula }); calculateElementFor...
javascript
function (element) { var id = element.getAttribute('id'), formula = element.getAttribute('data-formula'); if (formula) { // add item with basic properties to data array instance.matrix.addItem({ id: id, formula: formula }); calculateElementFor...
[ "function", "(", "element", ")", "{", "var", "id", "=", "element", ".", "getAttribute", "(", "'id'", ")", ",", "formula", "=", "element", ".", "getAttribute", "(", "'data-formula'", ")", ";", "if", "(", "formula", ")", "{", "// add item with basic properties...
register new found element to matrix @param {Element} element @returns {Object}
[ "register", "new", "found", "element", "to", "matrix" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21339-L21354
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (element) { var id = element.getAttribute('id'); // on db click show formula element.addEventListener('dblclick', function () { var item = instance.matrix.getItem(id); if (item && item.formula) { item.formulaEdit = true; element.value = '=' + item.formula...
javascript
function (element) { var id = element.getAttribute('id'); // on db click show formula element.addEventListener('dblclick', function () { var item = instance.matrix.getItem(id); if (item && item.formula) { item.formulaEdit = true; element.value = '=' + item.formula...
[ "function", "(", "element", ")", "{", "var", "id", "=", "element", ".", "getAttribute", "(", "'id'", ")", ";", "// on db click show formula", "element", ".", "addEventListener", "(", "'dblclick'", ",", "function", "(", ")", "{", "var", "item", "=", "instance...
register events for elements @param element
[ "register", "events", "for", "elements" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21360-L21412
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (cell) { var num = cell.match(/\d+$/), alpha = cell.replace(num, ''); return { alpha: alpha, num: parseInt(num[0], 10) } }
javascript
function (cell) { var num = cell.match(/\d+$/), alpha = cell.replace(num, ''); return { alpha: alpha, num: parseInt(num[0], 10) } }
[ "function", "(", "cell", ")", "{", "var", "num", "=", "cell", ".", "match", "(", "/", "\\d+$", "/", ")", ",", "alpha", "=", "cell", ".", "replace", "(", "num", ",", "''", ")", ";", "return", "{", "alpha", ":", "alpha", ",", "num", ":", "parseIn...
get row name and column number @param cell @returns {{alpha: string, num: number}}
[ "get", "row", "name", "and", "column", "number" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21526-L21534
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (cell, counter) { var alphaNum = instance.utils.getCellAlphaNum(cell), alpha = alphaNum.alpha, col = alpha, row = parseInt(alphaNum.num + counter, 10); if (row < 1) { row = 1; } return col + '' + row; }
javascript
function (cell, counter) { var alphaNum = instance.utils.getCellAlphaNum(cell), alpha = alphaNum.alpha, col = alpha, row = parseInt(alphaNum.num + counter, 10); if (row < 1) { row = 1; } return col + '' + row; }
[ "function", "(", "cell", ",", "counter", ")", "{", "var", "alphaNum", "=", "instance", ".", "utils", ".", "getCellAlphaNum", "(", "cell", ")", ",", "alpha", "=", "alphaNum", ".", "alpha", ",", "col", "=", "alpha", ",", "row", "=", "parseInt", "(", "a...
change row cell index A1 -> A2 @param {String} cell @param {Number} counter @returns {String}
[ "change", "row", "cell", "index", "A1", "-", ">", "A2" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21542-L21553
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (cell, counter) { var alphaNum = instance.utils.getCellAlphaNum(cell), alpha = alphaNum.alpha, col = instance.utils.toChar(parseInt(instance.utils.toNum(alpha) + counter, 10)), row = alphaNum.num; if (!col || col.length === 0) { col = 'A'; } var f...
javascript
function (cell, counter) { var alphaNum = instance.utils.getCellAlphaNum(cell), alpha = alphaNum.alpha, col = instance.utils.toChar(parseInt(instance.utils.toNum(alpha) + counter, 10)), row = alphaNum.num; if (!col || col.length === 0) { col = 'A'; } var f...
[ "function", "(", "cell", ",", "counter", ")", "{", "var", "alphaNum", "=", "instance", ".", "utils", ".", "getCellAlphaNum", "(", "cell", ")", ",", "alpha", "=", "alphaNum", ".", "alpha", ",", "col", "=", "instance", ".", "utils", ".", "toChar", "(", ...
change col cell index A1 -> B1 Z1 -> AA1 @param {String} cell @param {Number} counter @returns {String}
[ "change", "col", "cell", "index", "A1", "-", ">", "B1", "Z1", "-", ">", "AA1" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21561-L21578
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (formula, direction, delta) { var type, counter; // left, right -> col if (['left', 'right'].indexOf(direction) !== -1) { type = 'col'; } else if (['up', 'down'].indexOf(direction) !== -1) { type = 'row' } // down, up -> row if (['down', 'ri...
javascript
function (formula, direction, delta) { var type, counter; // left, right -> col if (['left', 'right'].indexOf(direction) !== -1) { type = 'col'; } else if (['up', 'down'].indexOf(direction) !== -1) { type = 'row' } // down, up -> row if (['down', 'ri...
[ "function", "(", "formula", ",", "direction", ",", "delta", ")", "{", "var", "type", ",", "counter", ";", "// left, right -> col", "if", "(", "[", "'left'", ",", "'right'", "]", ".", "indexOf", "(", "direction", ")", "!==", "-", "1", ")", "{", "type", ...
update formula cells @param {String} formula @param {String} direction @param {Number} delta @returns {String}
[ "update", "formula", "cells" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21616-L21655
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (cell) { var num = cell.match(/\d+$/), alpha = cell.replace(num, ''); return { row: parseInt(num[0], 10) - 1, col: instance.utils.toNum(alpha) }; }
javascript
function (cell) { var num = cell.match(/\d+$/), alpha = cell.replace(num, ''); return { row: parseInt(num[0], 10) - 1, col: instance.utils.toNum(alpha) }; }
[ "function", "(", "cell", ")", "{", "var", "num", "=", "cell", ".", "match", "(", "/", "\\d+$", "/", ")", ",", "alpha", "=", "cell", ".", "replace", "(", "num", ",", "''", ")", ";", "return", "{", "row", ":", "parseInt", "(", "num", "[", "0", ...
get cell coordinates @param {String} cell A1 @returns {{row: Number, col: number}}
[ "get", "cell", "coordinates" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21709-L21717
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (startCell, endCell, callback) { var result = { index: [], // list of cell index: A1, A2, A3 value: [] // list of cell value }; var cols = { start: 0, end: 0 }; if (endCell.col >= startCell.col) { cols = { start: startCell.col, ...
javascript
function (startCell, endCell, callback) { var result = { index: [], // list of cell index: A1, A2, A3 value: [] // list of cell value }; var cols = { start: 0, end: 0 }; if (endCell.col >= startCell.col) { cols = { start: startCell.col, ...
[ "function", "(", "startCell", ",", "endCell", ",", "callback", ")", "{", "var", "result", "=", "{", "index", ":", "[", "]", ",", "// list of cell index: A1, A2, A3", "value", ":", "[", "]", "// list of cell value", "}", ";", "var", "cols", "=", "{", "start...
iterate cell range and get theirs indexes and values @param {Object} startCell ex.: {row:1, col: 1} @param {Object} endCell ex.: {row:10, col: 1} @param {Function=} callback @returns {{index: Array, value: Array}}
[ "iterate", "cell", "range", "and", "get", "theirs", "indexes", "and", "values" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21744-L21799
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (type, exp1, exp2) { var result; switch (type) { case '&': result = exp1.toString() + exp2.toString(); break; } return result; }
javascript
function (type, exp1, exp2) { var result; switch (type) { case '&': result = exp1.toString() + exp2.toString(); break; } return result; }
[ "function", "(", "type", ",", "exp1", ",", "exp2", ")", "{", "var", "result", ";", "switch", "(", "type", ")", "{", "case", "'&'", ":", "result", "=", "exp1", ".", "toString", "(", ")", "+", "exp2", ".", "toString", "(", ")", ";", "break", ";", ...
match special operation @param {String} type @param {String} exp1 @param {String} exp2 @returns {*}
[ "match", "special", "operation" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21878-L21887
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (type, exp1, exp2) { var result; switch (type) { case '=': result = (exp1 === exp2); break; case '>': result = (exp1 > exp2); break; case '<': result = (exp1 < exp2); break; case '>=': result =...
javascript
function (type, exp1, exp2) { var result; switch (type) { case '=': result = (exp1 === exp2); break; case '>': result = (exp1 > exp2); break; case '<': result = (exp1 < exp2); break; case '>=': result =...
[ "function", "(", "type", ",", "exp1", ",", "exp2", ")", "{", "var", "result", ";", "switch", "(", "type", ")", "{", "case", "'='", ":", "result", "=", "(", "exp1", "===", "exp2", ")", ";", "break", ";", "case", "'>'", ":", "result", "=", "(", "...
match logic operation @param {String} type @param {String|Number} exp1 @param {String|Number} exp2 @returns {Boolean} result
[ "match", "logic", "operation" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21896-L21930
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (type, number1, number2) { var result; number1 = helper.number(number1); number2 = helper.number(number2); if (isNaN(number1) || isNaN(number2)) { if (number1[0] === '=' || number2[0] === '=') { throw Error('NEED_UPDATE'); } throw Error('VALUE'); ...
javascript
function (type, number1, number2) { var result; number1 = helper.number(number1); number2 = helper.number(number2); if (isNaN(number1) || isNaN(number2)) { if (number1[0] === '=' || number2[0] === '=') { throw Error('NEED_UPDATE'); } throw Error('VALUE'); ...
[ "function", "(", "type", ",", "number1", ",", "number2", ")", "{", "var", "result", ";", "number1", "=", "helper", ".", "number", "(", "number1", ")", ";", "number2", "=", "helper", ".", "number", "(", "number2", ")", ";", "if", "(", "isNaN", "(", ...
match math operation @param {String} type @param {Number} number1 @param {Number} number2 @returns {*}
[ "match", "math", "operation" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21939-L21978
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (fn, args) { fn = fn.toUpperCase(); args = args || []; if (instance.helper.SUPPORTED_FORMULAS.indexOf(fn) > -1) { if (instance.formulas[fn]) { return instance.formulas[fn].apply(this, args); } } throw Error('NAME'); }
javascript
function (fn, args) { fn = fn.toUpperCase(); args = args || []; if (instance.helper.SUPPORTED_FORMULAS.indexOf(fn) > -1) { if (instance.formulas[fn]) { return instance.formulas[fn].apply(this, args); } } throw Error('NAME'); }
[ "function", "(", "fn", ",", "args", ")", "{", "fn", "=", "fn", ".", "toUpperCase", "(", ")", ";", "args", "=", "args", "||", "[", "]", ";", "if", "(", "instance", ".", "helper", ".", "SUPPORTED_FORMULAS", ".", "indexOf", "(", "fn", ")", ">", "-",...
call function from formula @param {String} fn @param {Array} args @returns {*}
[ "call", "function", "from", "formula" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L21986-L21997
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (args) { args = args || []; var str = args[0]; if (str) { str = str.toUpperCase(); if (instance.formulas[str]) { return ((typeof instance.formulas[str] === 'function') ? instance.formulas[str].apply(this, args) : instance.formulas[str]); } } thr...
javascript
function (args) { args = args || []; var str = args[0]; if (str) { str = str.toUpperCase(); if (instance.formulas[str]) { return ((typeof instance.formulas[str] === 'function') ? instance.formulas[str].apply(this, args) : instance.formulas[str]); } } thr...
[ "function", "(", "args", ")", "{", "args", "=", "args", "||", "[", "]", ";", "var", "str", "=", "args", "[", "0", "]", ";", "if", "(", "str", ")", "{", "str", "=", "str", ".", "toUpperCase", "(", ")", ";", "if", "(", "instance", ".", "formula...
get variable from formula @param {Array} args @returns {*}
[ "get", "variable", "from", "formula" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22004-L22016
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (cell) { var value, fnCellValue = instance.custom.cellValue, element = this, item = instance.matrix.getItem(cell); // check if custom cellValue fn exists if (instance.utils.isFunction(fnCellValue)) { var cellCoords = instance.utils.cellCoords(cell), ...
javascript
function (cell) { var value, fnCellValue = instance.custom.cellValue, element = this, item = instance.matrix.getItem(cell); // check if custom cellValue fn exists if (instance.utils.isFunction(fnCellValue)) { var cellCoords = instance.utils.cellCoords(cell), ...
[ "function", "(", "cell", ")", "{", "var", "value", ",", "fnCellValue", "=", "instance", ".", "custom", ".", "cellValue", ",", "element", "=", "this", ",", "item", "=", "instance", ".", "matrix", ".", "getItem", "(", "cell", ")", ";", "// check if custom ...
Get cell value @param {String} cell => A1 AA1 @returns {*}
[ "Get", "cell", "value" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22023-L22077
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (start, end) { var fnCellValue = instance.custom.cellValue, coordsStart = instance.utils.cellCoords(start), coordsEnd = instance.utils.cellCoords(end), element = this; // iterate cells to get values and indexes var cells = instance.utils.iterateCells.call(this, ...
javascript
function (start, end) { var fnCellValue = instance.custom.cellValue, coordsStart = instance.utils.cellCoords(start), coordsEnd = instance.utils.cellCoords(end), element = this; // iterate cells to get values and indexes var cells = instance.utils.iterateCells.call(this, ...
[ "function", "(", "start", ",", "end", ")", "{", "var", "fnCellValue", "=", "instance", ".", "custom", ".", "cellValue", ",", "coordsStart", "=", "instance", ".", "utils", ".", "cellCoords", "(", "start", ")", ",", "coordsEnd", "=", "instance", ".", "util...
Get cell range values @param {String} start cell A1 @param {String} end cell B3 @returns {Array}
[ "Get", "cell", "range", "values" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22085-L22111
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (id) { id = id.replace(/\$/g, ''); return instance.helper.cellValue.call(this, id); }
javascript
function (id) { id = id.replace(/\$/g, ''); return instance.helper.cellValue.call(this, id); }
[ "function", "(", "id", ")", "{", "id", "=", "id", ".", "replace", "(", "/", "\\$", "/", "g", ",", "''", ")", ";", "return", "instance", ".", "helper", ".", "cellValue", ".", "call", "(", "this", ",", "id", ")", ";", "}" ]
Get fixed cell value @param {String} id @returns {*}
[ "Get", "fixed", "cell", "value" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22118-L22121
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (start, end) { start = start.replace(/\$/g, ''); end = end.replace(/\$/g, ''); return instance.helper.cellRangeValue.call(this, start, end); }
javascript
function (start, end) { start = start.replace(/\$/g, ''); end = end.replace(/\$/g, ''); return instance.helper.cellRangeValue.call(this, start, end); }
[ "function", "(", "start", ",", "end", ")", "{", "start", "=", "start", ".", "replace", "(", "/", "\\$", "/", "g", ",", "''", ")", ";", "end", "=", "end", ".", "replace", "(", "/", "\\$", "/", "g", ",", "''", ")", ";", "return", "instance", "....
Get fixed cell range values @param {String} start @param {String} end @returns {Array}
[ "Get", "fixed", "cell", "range", "values" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22129-L22134
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function (formula, element) { var result = null, error = null; try { parser.setObj(element); result = parser.parse(formula); var id; if (element instanceof HTMLElement) { id = element.getAttribute('id'); } else if (element && element.id) { id = element.i...
javascript
function (formula, element) { var result = null, error = null; try { parser.setObj(element); result = parser.parse(formula); var id; if (element instanceof HTMLElement) { id = element.getAttribute('id'); } else if (element && element.id) { id = element.i...
[ "function", "(", "formula", ",", "element", ")", "{", "var", "result", "=", "null", ",", "error", "=", "null", ";", "try", "{", "parser", ".", "setObj", "(", "element", ")", ";", "result", "=", "parser", ".", "parse", "(", "formula", ")", ";", "var...
parse input string using parser @returns {Object} {{error: *, result: *}} @param formula @param element
[ "parse", "input", "string", "using", "parser" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22143-L22192
train
rajgoel/reveal.js-plugins
spreadsheet/ruleJS.all.full.js
function () { instance = this; parser = new FormulaParser(instance); instance.formulas = Formula; instance.matrix = new Matrix(); instance.custom = {}; if (rootElement) { instance.matrix.scan(); } }
javascript
function () { instance = this; parser = new FormulaParser(instance); instance.formulas = Formula; instance.matrix = new Matrix(); instance.custom = {}; if (rootElement) { instance.matrix.scan(); } }
[ "function", "(", ")", "{", "instance", "=", "this", ";", "parser", "=", "new", "FormulaParser", "(", "instance", ")", ";", "instance", ".", "formulas", "=", "Formula", ";", "instance", ".", "matrix", "=", "new", "Matrix", "(", ")", ";", "instance", "."...
initial method, create formulas, parser and matrix objects
[ "initial", "method", "create", "formulas", "parser", "and", "matrix", "objects" ]
240f37227f923076dbe9a8a24bce39655200f04b
https://github.com/rajgoel/reveal.js-plugins/blob/240f37227f923076dbe9a8a24bce39655200f04b/spreadsheet/ruleJS.all.full.js#L22197-L22210
train
amqp/rhea
lib/sasl.js
function (connection, mechanisms) { this.connection = connection; this.transport = new Transport(connection.amqp_transport.identifier, SASL_PROTOCOL_ID, frames.TYPE_SASL, this); this.next = connection.amqp_transport; this.mechanisms = mechanisms; this.mechanism = undefined; this.outcome = undefi...
javascript
function (connection, mechanisms) { this.connection = connection; this.transport = new Transport(connection.amqp_transport.identifier, SASL_PROTOCOL_ID, frames.TYPE_SASL, this); this.next = connection.amqp_transport; this.mechanisms = mechanisms; this.mechanism = undefined; this.outcome = undefi...
[ "function", "(", "connection", ",", "mechanisms", ")", "{", "this", ".", "connection", "=", "connection", ";", "this", ".", "transport", "=", "new", "Transport", "(", "connection", ".", "amqp_transport", ".", "identifier", ",", "SASL_PROTOCOL_ID", ",", "frames...
The mechanisms argument is a map of mechanism names to factory functions for objects that implement that mechanism.
[ "The", "mechanisms", "argument", "is", "a", "map", "of", "mechanism", "names", "to", "factory", "functions", "for", "objects", "that", "implement", "that", "mechanism", "." ]
f2142dbc4077695141e0f2d62f03575c31e59968
https://github.com/amqp/rhea/blob/f2142dbc4077695141e0f2d62f03575c31e59968/lib/sasl.js#L154-L164
train
mapbox/mapbox-gl-geocoder
lib/index.js
function(){ if (this.options.placeholder) return this.options.placeholder; if (this.options.language){ var firstLanguage = this.options.language.split(",")[0]; var language = subtag.language(firstLanguage); var localizedValue = localization.placeholder[language]; if (localizedValue) ret...
javascript
function(){ if (this.options.placeholder) return this.options.placeholder; if (this.options.language){ var firstLanguage = this.options.language.split(",")[0]; var language = subtag.language(firstLanguage); var localizedValue = localization.placeholder[language]; if (localizedValue) ret...
[ "function", "(", ")", "{", "if", "(", "this", ".", "options", ".", "placeholder", ")", "return", "this", ".", "options", ".", "placeholder", ";", "if", "(", "this", ".", "options", ".", "language", ")", "{", "var", "firstLanguage", "=", "this", ".", ...
Get the text to use as the search bar placeholder If placeholder is provided in options, then use options.placeholder Otherwise, if language is provided in options, then use the localized string of the first language if available Otherwise use the default @returns {String} the value to use as the search bar placehold...
[ "Get", "the", "text", "to", "use", "as", "the", "search", "bar", "placeholder" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/index.js#L552-L561
train
mapbox/mapbox-gl-geocoder
lib/index.js
function(language){ var browserLocale = navigator.language || navigator.userLanguage || navigator.browserLanguage; this.options.language = language || this.options.language || browserLocale; return this; }
javascript
function(language){ var browserLocale = navigator.language || navigator.userLanguage || navigator.browserLanguage; this.options.language = language || this.options.language || browserLocale; return this; }
[ "function", "(", "language", ")", "{", "var", "browserLocale", "=", "navigator", ".", "language", "||", "navigator", ".", "userLanguage", "||", "navigator", ".", "browserLanguage", ";", "this", ".", "options", ".", "language", "=", "language", "||", "this", ...
Get the language to use in UI elements and when making search requests Look first at the explicitly set options otherwise use the browser's language settings @param {String} language Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 63...
[ "Get", "the", "language", "to", "use", "in", "UI", "elements", "and", "when", "making", "search", "requests" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/index.js#L623-L627
train
mapbox/mapbox-gl-geocoder
lib/index.js
function(selected){ // clean up any old marker that might be present this._removeMarker(); var defaultMarkerOptions = { color: '#4668F2' } var markerOptions = extend({}, defaultMarkerOptions, this.options.marker) this.mapMarker = new this._mapboxgl.Marker(markerOptions); this.mapMarker...
javascript
function(selected){ // clean up any old marker that might be present this._removeMarker(); var defaultMarkerOptions = { color: '#4668F2' } var markerOptions = extend({}, defaultMarkerOptions, this.options.marker) this.mapMarker = new this._mapboxgl.Marker(markerOptions); this.mapMarker...
[ "function", "(", "selected", ")", "{", "// clean up any old marker that might be present", "this", ".", "_removeMarker", "(", ")", ";", "var", "defaultMarkerOptions", "=", "{", "color", ":", "'#4668F2'", "}", "var", "markerOptions", "=", "extend", "(", "{", "}", ...
Handle the placement of a result marking the selected result @private @param {Object} selected the selected geojson feature @returns {MapboxGeocoder} this
[ "Handle", "the", "placement", "of", "a", "result", "marking", "the", "selected", "result" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/index.js#L807-L819
train
mapbox/mapbox-gl-geocoder
lib/events.js
MapboxEventManager
function MapboxEventManager(options) { this.origin = options.origin || 'https://api.mapbox.com'; this.endpoint = 'events/v2'; this.access_token = options.accessToken; this.version = '0.2.0' this.sessionID = this.generateSessionID(); this.userAgent = this.getUserAgent(); this.options = options; this.sen...
javascript
function MapboxEventManager(options) { this.origin = options.origin || 'https://api.mapbox.com'; this.endpoint = 'events/v2'; this.access_token = options.accessToken; this.version = '0.2.0' this.sessionID = this.generateSessionID(); this.userAgent = this.getUserAgent(); this.options = options; this.sen...
[ "function", "MapboxEventManager", "(", "options", ")", "{", "this", ".", "origin", "=", "options", ".", "origin", "||", "'https://api.mapbox.com'", ";", "this", ".", "endpoint", "=", "'events/v2'", ";", "this", ".", "access_token", "=", "options", ".", "access...
Construct a new mapbox event client to send interaction events to the mapbox event service @param {Object} options options with which to create the service @param {String} options.accessToken the mapbox access token to make requests @param {Number} [options.flushInterval=1000] the number of ms after which to flush the ...
[ "Construct", "a", "new", "mapbox", "event", "client", "to", "send", "interaction", "events", "to", "the", "mapbox", "event", "service" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L12-L39
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(selected, geocoder){ var resultIndex = this.getSelectedIndex(selected, geocoder); var payload = this.getEventPayload('search.select', geocoder); payload.resultIndex = resultIndex; payload.resultPlaceName = selected.place_name; payload.resultId = selected.id; if ((resultIndex === this.l...
javascript
function(selected, geocoder){ var resultIndex = this.getSelectedIndex(selected, geocoder); var payload = this.getEventPayload('search.select', geocoder); payload.resultIndex = resultIndex; payload.resultPlaceName = selected.place_name; payload.resultId = selected.id; if ((resultIndex === this.l...
[ "function", "(", "selected", ",", "geocoder", ")", "{", "var", "resultIndex", "=", "this", ".", "getSelectedIndex", "(", "selected", ",", "geocoder", ")", ";", "var", "payload", "=", "this", ".", "getEventPayload", "(", "'search.select'", ",", "geocoder", ")...
Send a search.select event to the mapbox events service This event marks the array index of the item selected by the user out of the array of possible options @private @param {Object} selected the geojson feature selected by the user @param {Object} geocoder a mapbox-gl-geocoder instance @returns {Promise}
[ "Send", "a", "search", ".", "select", "event", "to", "the", "mapbox", "events", "service", "This", "event", "marks", "the", "array", "index", "of", "the", "item", "selected", "by", "the", "user", "out", "of", "the", "array", "of", "possible", "options" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L50-L64
train
mapbox/mapbox-gl-geocoder
lib/events.js
function (payload, callback) { if (!this.enableEventLogging) { if (callback) return callback(); return; } var options = this.getRequestOptions(payload); this.request(options, function(err){ if (err) return this.handleError(err, callback); if (callback) { return callback()...
javascript
function (payload, callback) { if (!this.enableEventLogging) { if (callback) return callback(); return; } var options = this.getRequestOptions(payload); this.request(options, function(err){ if (err) return this.handleError(err, callback); if (callback) { return callback()...
[ "function", "(", "payload", ",", "callback", ")", "{", "if", "(", "!", "this", ".", "enableEventLogging", ")", "{", "if", "(", "callback", ")", "return", "callback", "(", ")", ";", "return", ";", "}", "var", "options", "=", "this", ".", "getRequestOpti...
Send an event to the events service The event is skipped if the instance is not enabled to send logging events @private @param {Object} payload the http POST body of the event @param {Function} [callback] a callback function to invoke when the send has completed @returns {Promise}
[ "Send", "an", "event", "to", "the", "events", "service" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L109-L121
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(payload){ if (!Array.isArray(payload)) payload = [payload]; var options = { // events must be sent with POST method: "POST", host: this.origin, path: this.endpoint + "?access_token=" + this.access_token, headers: { 'Content-Type': 'application/json' }, ...
javascript
function(payload){ if (!Array.isArray(payload)) payload = [payload]; var options = { // events must be sent with POST method: "POST", host: this.origin, path: this.endpoint + "?access_token=" + this.access_token, headers: { 'Content-Type': 'application/json' }, ...
[ "function", "(", "payload", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "payload", ")", ")", "payload", "=", "[", "payload", "]", ";", "var", "options", "=", "{", "// events must be sent with POST", "method", ":", "\"POST\"", ",", "host", ":"...
Get http request options @private @param {*} payload
[ "Get", "http", "request", "options" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L127-L140
train
mapbox/mapbox-gl-geocoder
lib/events.js
function (event, geocoder) { var proximity; if (!geocoder.options.proximity) proximity = null; else proximity = [geocoder.options.proximity.longitude, geocoder.options.proximity.latitude]; var zoom = (geocoder._map) ? geocoder._map.getZoom() : null; var payload = { event: event, created...
javascript
function (event, geocoder) { var proximity; if (!geocoder.options.proximity) proximity = null; else proximity = [geocoder.options.proximity.longitude, geocoder.options.proximity.latitude]; var zoom = (geocoder._map) ? geocoder._map.getZoom() : null; var payload = { event: event, created...
[ "function", "(", "event", ",", "geocoder", ")", "{", "var", "proximity", ";", "if", "(", "!", "geocoder", ".", "options", ".", "proximity", ")", "proximity", "=", "null", ";", "else", "proximity", "=", "[", "geocoder", ".", "options", ".", "proximity", ...
Get the event payload to send to the events service Most payload properties are shared across all events @private @param {String} event the name of the event to send to the events service. Valid options are 'search.start', 'search.select', 'search.feedback'. @param {Object} geocoder a mapbox-gl-geocoder instance @retur...
[ "Get", "the", "event", "payload", "to", "send", "to", "the", "events", "service", "Most", "payload", "properties", "are", "shared", "across", "all", "events" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L150-L183
train
mapbox/mapbox-gl-geocoder
lib/events.js
function (opts, callback) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { if (this.status == 204){ //success return callback(null); }else { return callback(this.statusText); } } }; ...
javascript
function (opts, callback) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { if (this.status == 204){ //success return callback(null); }else { return callback(this.statusText); } } }; ...
[ "function", "(", "opts", ",", "callback", ")", "{", "var", "xhttp", "=", "new", "XMLHttpRequest", "(", ")", ";", "xhttp", ".", "onreadystatechange", "=", "function", "(", ")", "{", "if", "(", "this", ".", "readyState", "==", "4", ")", "{", "if", "(",...
Wraps the request function for easier testing Make an http request and invoke a callback @private @param {Object} opts options describing the http request to be made @param {Function} callback the callback to invoke when the http request is completed
[ "Wraps", "the", "request", "function", "for", "easier", "testing", "Make", "an", "http", "request", "and", "invoke", "a", "callback" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L192-L211
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(selected, geocoder){ if (!geocoder._typeahead) return; var results = geocoder._typeahead.data; var selectedID = selected.id; var resultIDs = results.map(function (feature) { return feature.id; }); var selectedIdx = resultIDs.indexOf(selectedID); return selectedIdx; }
javascript
function(selected, geocoder){ if (!geocoder._typeahead) return; var results = geocoder._typeahead.data; var selectedID = selected.id; var resultIDs = results.map(function (feature) { return feature.id; }); var selectedIdx = resultIDs.indexOf(selectedID); return selectedIdx; }
[ "function", "(", "selected", ",", "geocoder", ")", "{", "if", "(", "!", "geocoder", ".", "_typeahead", ")", "return", ";", "var", "results", "=", "geocoder", ".", "_typeahead", ".", "data", ";", "var", "selectedID", "=", "selected", ".", "id", ";", "va...
Get the 0-based numeric index of the item that the user selected out of the list of options @private @param {Object} selected the geojson feature selected by the user @param {Object} geocoder a Mapbox-GL-Geocoder instance @returns {Number} the index of the selected result
[ "Get", "the", "0", "-", "based", "numeric", "index", "of", "the", "item", "that", "the", "user", "selected", "out", "of", "the", "list", "of", "options" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L246-L255
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(options){ if (options.enableEventLogging === false) return false; if (options.origin && options.origin.indexOf('api.mapbox.com') == -1) return false; // hard to make sense of events when a local instance is suplementing results from origin if (options.localGeocoder) return false; // hard to...
javascript
function(options){ if (options.enableEventLogging === false) return false; if (options.origin && options.origin.indexOf('api.mapbox.com') == -1) return false; // hard to make sense of events when a local instance is suplementing results from origin if (options.localGeocoder) return false; // hard to...
[ "function", "(", "options", ")", "{", "if", "(", "options", ".", "enableEventLogging", "===", "false", ")", "return", "false", ";", "if", "(", "options", ".", "origin", "&&", "options", ".", "origin", ".", "indexOf", "(", "'api.mapbox.com'", ")", "==", "...
Check whether events should be logged Clients using a localGeocoder or an origin other than mapbox should not have events logged @private
[ "Check", "whether", "events", "should", "be", "logged", "Clients", "using", "a", "localGeocoder", "or", "an", "origin", "other", "than", "mapbox", "should", "not", "have", "events", "logged" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L262-L270
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(){ if (this.eventQueue.length > 0){ this.send(this.eventQueue); this.eventQueue = new Array(); } // //reset the timer if (this.timer) clearTimeout(this.timer); if (this.flushInterval) this.timer = setTimeout(this.flush.bind(this), this.flushInterval) }
javascript
function(){ if (this.eventQueue.length > 0){ this.send(this.eventQueue); this.eventQueue = new Array(); } // //reset the timer if (this.timer) clearTimeout(this.timer); if (this.flushInterval) this.timer = setTimeout(this.flush.bind(this), this.flushInterval) }
[ "function", "(", ")", "{", "if", "(", "this", ".", "eventQueue", ".", "length", ">", "0", ")", "{", "this", ".", "send", "(", "this", ".", "eventQueue", ")", ";", "this", ".", "eventQueue", "=", "new", "Array", "(", ")", ";", "}", "// //reset the t...
Flush out the event queue by sending events to the events service @private
[ "Flush", "out", "the", "event", "queue", "by", "sending", "events", "to", "the", "events", "service" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L276-L284
train
mapbox/mapbox-gl-geocoder
lib/events.js
function(evt, forceFlush){ this.eventQueue.push(evt); if (this.eventQueue.length >= this.maxQueueSize || forceFlush){ this.flush(); } }
javascript
function(evt, forceFlush){ this.eventQueue.push(evt); if (this.eventQueue.length >= this.maxQueueSize || forceFlush){ this.flush(); } }
[ "function", "(", "evt", ",", "forceFlush", ")", "{", "this", ".", "eventQueue", ".", "push", "(", "evt", ")", ";", "if", "(", "this", ".", "eventQueue", ".", "length", ">=", "this", ".", "maxQueueSize", "||", "forceFlush", ")", "{", "this", ".", "flu...
Push event into the pending queue @param {Object} evt the event to send to the events service @param {Boolean} forceFlush indicates that the event queue should be flushed after adding this event regardless of size of the queue @private
[ "Push", "event", "into", "the", "pending", "queue" ]
355634a36314c5a2edaecdfefa0d59d1a5007ffd
https://github.com/mapbox/mapbox-gl-geocoder/blob/355634a36314c5a2edaecdfefa0d59d1a5007ffd/lib/events.js#L292-L297
train
actionhero/actionhero
config/logger.js
buildConsoleLogger
function buildConsoleLogger (level = 'info') { return function (api) { return winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.colorize(), winston.format.printf(info => { return `${api.id} @ ${info.timestamp} - ${info.level}:...
javascript
function buildConsoleLogger (level = 'info') { return function (api) { return winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.colorize(), winston.format.printf(info => { return `${api.id} @ ${info.timestamp} - ${info.level}:...
[ "function", "buildConsoleLogger", "(", "level", "=", "'info'", ")", "{", "return", "function", "(", "api", ")", "{", "return", "winston", ".", "createLogger", "(", "{", "format", ":", "winston", ".", "format", ".", "combine", "(", "winston", ".", "format",...
learn more about winston v3 loggers @ - https://github.com/winstonjs/winston - https://github.com/winstonjs/winston/blob/master/docs/transports.md
[ "learn", "more", "about", "winston", "v3", "loggers" ]
046c81f1879efcad47048f4505b215e38bd72b7f
https://github.com/actionhero/actionhero/blob/046c81f1879efcad47048f4505b215e38bd72b7f/config/logger.js#L10-L25
train
wnr/element-resize-detector
src/listener-handler.js
getListeners
function getListeners(element) { var id = idHandler.get(element); if (id === undefined) { return []; } return eventListeners[id] || []; }
javascript
function getListeners(element) { var id = idHandler.get(element); if (id === undefined) { return []; } return eventListeners[id] || []; }
[ "function", "getListeners", "(", "element", ")", "{", "var", "id", "=", "idHandler", ".", "get", "(", "element", ")", ";", "if", "(", "id", "===", "undefined", ")", "{", "return", "[", "]", ";", "}", "return", "eventListeners", "[", "id", "]", "||", ...
Gets all listeners for the given element. @public @param {element} element The element to get all listeners for. @returns All listeners for the given element.
[ "Gets", "all", "listeners", "for", "the", "given", "element", "." ]
27983e59dce9d8f1296d8f555dc2340840fb0804
https://github.com/wnr/element-resize-detector/blob/27983e59dce9d8f1296d8f555dc2340840fb0804/src/listener-handler.js#L12-L20
train
wnr/element-resize-detector
src/listener-handler.js
addListener
function addListener(element, listener) { var id = idHandler.get(element); if(!eventListeners[id]) { eventListeners[id] = []; } eventListeners[id].push(listener); }
javascript
function addListener(element, listener) { var id = idHandler.get(element); if(!eventListeners[id]) { eventListeners[id] = []; } eventListeners[id].push(listener); }
[ "function", "addListener", "(", "element", ",", "listener", ")", "{", "var", "id", "=", "idHandler", ".", "get", "(", "element", ")", ";", "if", "(", "!", "eventListeners", "[", "id", "]", ")", "{", "eventListeners", "[", "id", "]", "=", "[", "]", ...
Stores the given listener for the given element. Will not actually add the listener to the element. @public @param {element} element The element that should have the listener added. @param {function} listener The callback that the element has added.
[ "Stores", "the", "given", "listener", "for", "the", "given", "element", ".", "Will", "not", "actually", "add", "the", "listener", "to", "the", "element", "." ]
27983e59dce9d8f1296d8f555dc2340840fb0804
https://github.com/wnr/element-resize-detector/blob/27983e59dce9d8f1296d8f555dc2340840fb0804/src/listener-handler.js#L28-L36
train
wnr/element-resize-detector
src/id-handler.js
getId
function getId(element) { var state = getState(element); if (state && state.id !== undefined) { return state.id; } return null; }
javascript
function getId(element) { var state = getState(element); if (state && state.id !== undefined) { return state.id; } return null; }
[ "function", "getId", "(", "element", ")", "{", "var", "state", "=", "getState", "(", "element", ")", ";", "if", "(", "state", "&&", "state", ".", "id", "!==", "undefined", ")", "{", "return", "state", ".", "id", ";", "}", "return", "null", ";", "}"...
Gets the resize detector id of the element. @public @param {element} element The target element to get the id of. @returns {string|number|null} The id of the element. Null if it has no id.
[ "Gets", "the", "resize", "detector", "id", "of", "the", "element", "." ]
27983e59dce9d8f1296d8f555dc2340840fb0804
https://github.com/wnr/element-resize-detector/blob/27983e59dce9d8f1296d8f555dc2340840fb0804/src/id-handler.js#L13-L21
train
wnr/element-resize-detector
src/id-handler.js
setId
function setId(element) { var state = getState(element); if (!state) { throw new Error("setId required the element to have a resize detection state."); } var id = idGenerator.generate(); state.id = id; return id; }
javascript
function setId(element) { var state = getState(element); if (!state) { throw new Error("setId required the element to have a resize detection state."); } var id = idGenerator.generate(); state.id = id; return id; }
[ "function", "setId", "(", "element", ")", "{", "var", "state", "=", "getState", "(", "element", ")", ";", "if", "(", "!", "state", ")", "{", "throw", "new", "Error", "(", "\"setId required the element to have a resize detection state.\"", ")", ";", "}", "var",...
Sets the resize detector id of the element. Requires the element to have a resize detector state initialized. @public @param {element} element The target element to set the id of. @returns {string|number|null} The id of the element.
[ "Sets", "the", "resize", "detector", "id", "of", "the", "element", ".", "Requires", "the", "element", "to", "have", "a", "resize", "detector", "state", "initialized", "." ]
27983e59dce9d8f1296d8f555dc2340840fb0804
https://github.com/wnr/element-resize-detector/blob/27983e59dce9d8f1296d8f555dc2340840fb0804/src/id-handler.js#L29-L41
train