id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,200 | bencoveney/barrelsby | bin/modules.js | getModules | function getModules(directory, logger, local) {
logger(`Getting modules @ ${directory.path}`);
if (directory.barrel) {
// If theres a barrel then use that as it *should* contain descendant modules.
logger(`Found existing barrel @ ${directory.barrel.path}`);
return [directory.barrel];
... | javascript | function getModules(directory, logger, local) {
logger(`Getting modules @ ${directory.path}`);
if (directory.barrel) {
// If theres a barrel then use that as it *should* contain descendant modules.
logger(`Found existing barrel @ ${directory.barrel.path}`);
return [directory.barrel];
... | [
"function",
"getModules",
"(",
"directory",
",",
"logger",
",",
"local",
")",
"{",
"logger",
"(",
"`",
"${",
"directory",
".",
"path",
"}",
"`",
")",
";",
"if",
"(",
"directory",
".",
"barrel",
")",
"{",
"// If theres a barrel then use that as it *should* cont... | Get any typescript modules contained at any depth in the current directory. | [
"Get",
"any",
"typescript",
"modules",
"contained",
"at",
"any",
"depth",
"in",
"the",
"current",
"directory",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/modules.js#L5-L21 |
9,201 | bencoveney/barrelsby | bin/builder.js | buildBarrel | function buildBarrel(directory, builder, quoteCharacter, semicolonCharacter, barrelName, logger, baseUrl, local, include, exclude) {
logger(`Building barrel @ ${directory.path}`);
const content = builder(directory, modules_1.loadDirectoryModules(directory, logger, include, exclude, local), quoteCharacter, semic... | javascript | function buildBarrel(directory, builder, quoteCharacter, semicolonCharacter, barrelName, logger, baseUrl, local, include, exclude) {
logger(`Building barrel @ ${directory.path}`);
const content = builder(directory, modules_1.loadDirectoryModules(directory, logger, include, exclude, local), quoteCharacter, semic... | [
"function",
"buildBarrel",
"(",
"directory",
",",
"builder",
",",
"quoteCharacter",
",",
"semicolonCharacter",
",",
"barrelName",
",",
"logger",
",",
"baseUrl",
",",
"local",
",",
"include",
",",
"exclude",
")",
"{",
"logger",
"(",
"`",
"${",
"directory",
".... | Build a barrel for the specified directory. | [
"Build",
"a",
"barrel",
"for",
"the",
"specified",
"directory",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/builder.js#L29-L51 |
9,202 | bencoveney/barrelsby | bin/builder.js | buildImportPath | function buildImportPath(directory, target, baseUrl) {
// If the base URL option is set then imports should be relative to there.
const startLocation = baseUrl ? baseUrl : directory.path;
const relativePath = path_1.default.relative(startLocation, target.path);
// Get the route and ensure it's relative
... | javascript | function buildImportPath(directory, target, baseUrl) {
// If the base URL option is set then imports should be relative to there.
const startLocation = baseUrl ? baseUrl : directory.path;
const relativePath = path_1.default.relative(startLocation, target.path);
// Get the route and ensure it's relative
... | [
"function",
"buildImportPath",
"(",
"directory",
",",
"target",
",",
"baseUrl",
")",
"{",
"// If the base URL option is set then imports should be relative to there.",
"const",
"startLocation",
"=",
"baseUrl",
"?",
"baseUrl",
":",
"directory",
".",
"path",
";",
"const",
... | Builds the TypeScript | [
"Builds",
"the",
"TypeScript"
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/builder.js#L53-L68 |
9,203 | bencoveney/barrelsby | bin/builder.js | getBasename | function getBasename(relativePath) {
const mayBeSuffix = [".ts", ".tsx", ".d.ts"];
let mayBePath = relativePath;
mayBeSuffix.map(suffix => {
const tmpPath = path_1.default.basename(relativePath, suffix);
if (tmpPath.length < mayBePath.length) {
mayBePath = tmpPath;
}
... | javascript | function getBasename(relativePath) {
const mayBeSuffix = [".ts", ".tsx", ".d.ts"];
let mayBePath = relativePath;
mayBeSuffix.map(suffix => {
const tmpPath = path_1.default.basename(relativePath, suffix);
if (tmpPath.length < mayBePath.length) {
mayBePath = tmpPath;
}
... | [
"function",
"getBasename",
"(",
"relativePath",
")",
"{",
"const",
"mayBeSuffix",
"=",
"[",
"\".ts\"",
",",
"\".tsx\"",
",",
"\".d.ts\"",
"]",
";",
"let",
"mayBePath",
"=",
"relativePath",
";",
"mayBeSuffix",
".",
"map",
"(",
"suffix",
"=>",
"{",
"const",
... | Strips the .ts or .tsx file extension from a path and returns the base filename. | [
"Strips",
"the",
".",
"ts",
"or",
".",
"tsx",
"file",
"extension",
"from",
"a",
"path",
"and",
"returns",
"the",
"base",
"filename",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/builder.js#L74-L85 |
9,204 | bencoveney/barrelsby | bin/destinations.js | getDestinations | function getDestinations(rootTree, locationOption, barrelName, logger) {
let destinations;
switch (locationOption) {
case "top":
default:
destinations = [rootTree];
break;
case "below":
destinations = rootTree.directories;
break;
ca... | javascript | function getDestinations(rootTree, locationOption, barrelName, logger) {
let destinations;
switch (locationOption) {
case "top":
default:
destinations = [rootTree];
break;
case "below":
destinations = rootTree.directories;
break;
ca... | [
"function",
"getDestinations",
"(",
"rootTree",
",",
"locationOption",
",",
"barrelName",
",",
"logger",
")",
"{",
"let",
"destinations",
";",
"switch",
"(",
"locationOption",
")",
"{",
"case",
"\"top\"",
":",
"default",
":",
"destinations",
"=",
"[",
"rootTre... | Assess which directories in the tree should contain barrels. | [
"Assess",
"which",
"directories",
"in",
"the",
"tree",
"should",
"contain",
"barrels",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/destinations.js#L5-L45 |
9,205 | bencoveney/barrelsby | bin/fileTree.js | buildTree | function buildTree(directory, barrelName, logger) {
logger(`Building directory tree for ${utilities_1.convertPathSeparator(directory)}`);
const names = fs_1.default.readdirSync(directory);
const result = {
directories: [],
files: [],
name: path_1.default.basename(directory),
... | javascript | function buildTree(directory, barrelName, logger) {
logger(`Building directory tree for ${utilities_1.convertPathSeparator(directory)}`);
const names = fs_1.default.readdirSync(directory);
const result = {
directories: [],
files: [],
name: path_1.default.basename(directory),
... | [
"function",
"buildTree",
"(",
"directory",
",",
"barrelName",
",",
"logger",
")",
"{",
"logger",
"(",
"`",
"${",
"utilities_1",
".",
"convertPathSeparator",
"(",
"directory",
")",
"}",
"`",
")",
";",
"const",
"names",
"=",
"fs_1",
".",
"default",
".",
"r... | Build directory information recursively. | [
"Build",
"directory",
"information",
"recursively",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/fileTree.js#L10-L38 |
9,206 | bencoveney/barrelsby | bin/fileTree.js | walkTree | function walkTree(directory, callback) {
callback(directory);
directory.directories.forEach(childDirectory => walkTree(childDirectory, callback));
} | javascript | function walkTree(directory, callback) {
callback(directory);
directory.directories.forEach(childDirectory => walkTree(childDirectory, callback));
} | [
"function",
"walkTree",
"(",
"directory",
",",
"callback",
")",
"{",
"callback",
"(",
"directory",
")",
";",
"directory",
".",
"directories",
".",
"forEach",
"(",
"childDirectory",
"=>",
"walkTree",
"(",
"childDirectory",
",",
"callback",
")",
")",
";",
"}"
... | Walk an entire directory tree recursively. | [
"Walk",
"an",
"entire",
"directory",
"tree",
"recursively",
"."
] | 7271065d27ad9060a899a5c64c6b03c749ad7867 | https://github.com/bencoveney/barrelsby/blob/7271065d27ad9060a899a5c64c6b03c749ad7867/bin/fileTree.js#L41-L44 |
9,207 | JKHeadley/rest-hapi | utilities/rest-helper-factory.js | function(server, model, options) {
// TODO: generate multiple DELETE routes at /RESOURCE and at
// TODO: /RESOURCE/{ownerId}/ASSOCIATION that take a list of Id's as a payload
try {
validationHelper.validateModel(model, logger)
let collectionName = model.collectionDisplayName || model.... | javascript | function(server, model, options) {
// TODO: generate multiple DELETE routes at /RESOURCE and at
// TODO: /RESOURCE/{ownerId}/ASSOCIATION that take a list of Id's as a payload
try {
validationHelper.validateModel(model, logger)
let collectionName = model.collectionDisplayName || model.... | [
"function",
"(",
"server",
",",
"model",
",",
"options",
")",
"{",
"// TODO: generate multiple DELETE routes at /RESOURCE and at",
"// TODO: /RESOURCE/{ownerId}/ASSOCIATION that take a list of Id's as a payload",
"try",
"{",
"validationHelper",
".",
"validateModel",
"(",
"model",
... | Generates the restful API endpoints for a single model.
@param server: A Hapi server.
@param model: A mongoose model.
@param options: options object. | [
"Generates",
"the",
"restful",
"API",
"endpoints",
"for",
"a",
"single",
"model",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/rest-helper-factory.js#L39-L136 | |
9,208 | JKHeadley/rest-hapi | utilities/handler-helper.js | _list | function _list(model, query, Log) {
let request = { query: query }
return _listHandler(model, request, Log)
} | javascript | function _list(model, query, Log) {
let request = { query: query }
return _listHandler(model, request, Log)
} | [
"function",
"_list",
"(",
"model",
",",
"query",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"query",
":",
"query",
"}",
"return",
"_listHandler",
"(",
"model",
",",
"request",
",",
"Log",
")",
"}"
] | List function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param query: rest-hapi query parameters to be converted to a mongoose query.
@param Log: A logging object.
@returns {object} A promise for the resulting model documents or the count of the query results.
@private | [
"List",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L68-L71 |
9,209 | JKHeadley/rest-hapi | utilities/handler-helper.js | _find | function _find(model, _id, query, Log) {
let request = { params: { _id: _id }, query: query }
return _findHandler(model, _id, request, Log)
} | javascript | function _find(model, _id, query, Log) {
let request = { params: { _id: _id }, query: query }
return _findHandler(model, _id, request, Log)
} | [
"function",
"_find",
"(",
"model",
",",
"_id",
",",
"query",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"params",
":",
"{",
"_id",
":",
"_id",
"}",
",",
"query",
":",
"query",
"}",
"return",
"_findHandler",
"(",
"model",
",",
"_id",
",",
"... | Find function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param _id: The document id.
@param query: rest-hapi query parameters to be converted to a mongoose query.
@param Log: A logging object.
@returns {object} A promise for the resulting model document.
@private | [
"Find",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L220-L223 |
9,210 | JKHeadley/rest-hapi | utilities/handler-helper.js | _findHandler | async function _findHandler(model, _id, request, Log) {
try {
let query = Object.assign({}, request.query)
try {
if (
model.routeOptions &&
model.routeOptions.find &&
model.routeOptions.find.pre
) {
query = await model.routeOptions.find.pre(_id, query, request, Log)... | javascript | async function _findHandler(model, _id, request, Log) {
try {
let query = Object.assign({}, request.query)
try {
if (
model.routeOptions &&
model.routeOptions.find &&
model.routeOptions.find.pre
) {
query = await model.routeOptions.find.pre(_id, query, request, Log)... | [
"async",
"function",
"_findHandler",
"(",
"model",
",",
"_id",
",",
"request",
",",
"Log",
")",
"{",
"try",
"{",
"let",
"query",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"request",
".",
"query",
")",
"try",
"{",
"if",
"(",
"model",
".",
... | Finds a model document.
@param model: A mongoose model.
@param _id: The document id.
@param request: The Hapi request object, or a container for the wrapper query.
@param Log: A logging object.
@returns {object} A promise for the resulting model document.
@private | [
"Finds",
"a",
"model",
"document",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L233-L313 |
9,211 | JKHeadley/rest-hapi | utilities/handler-helper.js | _create | function _create(model, payload, Log) {
let request = { payload: payload }
return _createHandler(model, request, Log)
} | javascript | function _create(model, payload, Log) {
let request = { payload: payload }
return _createHandler(model, request, Log)
} | [
"function",
"_create",
"(",
"model",
",",
"payload",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"payload",
":",
"payload",
"}",
"return",
"_createHandler",
"(",
"model",
",",
"request",
",",
"Log",
")",
"}"
] | Create function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param payload: Data used to create the model document/s.
@param Log: A logging object.
@returns {object} A promise for the resulting model document/s.
@private | [
"Create",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L323-L326 |
9,212 | JKHeadley/rest-hapi | utilities/handler-helper.js | _update | function _update(model, _id, payload, Log) {
let request = { params: { _id: _id }, payload: payload }
return _updateHandler(model, _id, request, Log)
} | javascript | function _update(model, _id, payload, Log) {
let request = { params: { _id: _id }, payload: payload }
return _updateHandler(model, _id, request, Log)
} | [
"function",
"_update",
"(",
"model",
",",
"_id",
",",
"payload",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"params",
":",
"{",
"_id",
":",
"_id",
"}",
",",
"payload",
":",
"payload",
"}",
"return",
"_updateHandler",
"(",
"model",
",",
"_id",
... | Update function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param _id: The document id.
@param payload: Data used to update the model document.
@param Log: A logging object.
@returns {object} A promise for the resulting model document.
@private | [
"Update",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L442-L445 |
9,213 | JKHeadley/rest-hapi | utilities/handler-helper.js | _updateHandler | async function _updateHandler(model, _id, request, Log) {
let payload = Object.assign({}, request.payload)
try {
try {
if (
model.routeOptions &&
model.routeOptions.update &&
model.routeOptions.update.pre
) {
payload = await model.routeOptions.update.pre(
_i... | javascript | async function _updateHandler(model, _id, request, Log) {
let payload = Object.assign({}, request.payload)
try {
try {
if (
model.routeOptions &&
model.routeOptions.update &&
model.routeOptions.update.pre
) {
payload = await model.routeOptions.update.pre(
_i... | [
"async",
"function",
"_updateHandler",
"(",
"model",
",",
"_id",
",",
"request",
",",
"Log",
")",
"{",
"let",
"payload",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"request",
".",
"payload",
")",
"try",
"{",
"try",
"{",
"if",
"(",
"model",
"... | Updates a model document.
@param model: A mongoose model.
@param _id: The document id.
@param request: The Hapi request object, or a container for the wrapper payload.
@param Log: A logging object.
@returns {object} A promise for the resulting model document.
@private | [
"Updates",
"a",
"model",
"document",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L455-L526 |
9,214 | JKHeadley/rest-hapi | utilities/handler-helper.js | _deleteOne | function _deleteOne(model, _id, hardDelete, Log) {
let request = { params: { _id: _id } }
return _deleteOneHandler(model, _id, hardDelete, request, Log)
} | javascript | function _deleteOne(model, _id, hardDelete, Log) {
let request = { params: { _id: _id } }
return _deleteOneHandler(model, _id, hardDelete, request, Log)
} | [
"function",
"_deleteOne",
"(",
"model",
",",
"_id",
",",
"hardDelete",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"params",
":",
"{",
"_id",
":",
"_id",
"}",
"}",
"return",
"_deleteOneHandler",
"(",
"model",
",",
"_id",
",",
"hardDelete",
",",
... | DeleteOne function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param _id: The document id.
@param hardDelete: Flag used to determine a soft or hard delete.
@param Log: A logging object.
@returns {object} A promise returning true if the delete succeeds.
@private | [
"DeleteOne",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L537-L540 |
9,215 | JKHeadley/rest-hapi | utilities/handler-helper.js | _deleteOneHandler | async function _deleteOneHandler(model, _id, hardDelete, request, Log) {
try {
try {
if (
model.routeOptions &&
model.routeOptions.delete &&
model.routeOptions.delete.pre
) {
await model.routeOptions.delete.pre(_id, hardDelete, request, Log)
}
} catch (err) {
... | javascript | async function _deleteOneHandler(model, _id, hardDelete, request, Log) {
try {
try {
if (
model.routeOptions &&
model.routeOptions.delete &&
model.routeOptions.delete.pre
) {
await model.routeOptions.delete.pre(_id, hardDelete, request, Log)
}
} catch (err) {
... | [
"async",
"function",
"_deleteOneHandler",
"(",
"model",
",",
"_id",
",",
"hardDelete",
",",
"request",
",",
"Log",
")",
"{",
"try",
"{",
"try",
"{",
"if",
"(",
"model",
".",
"routeOptions",
"&&",
"model",
".",
"routeOptions",
".",
"delete",
"&&",
"model"... | Deletes a model document
@param model: A mongoose model.
@param _id: The document id.
@param hardDelete: Flag used to determine a soft or hard delete.
@param request: The Hapi request object.
@param Log: A logging object.
@returns {object} A promise returning true if the delete succeeds.
@private
TODO: only update "de... | [
"Deletes",
"a",
"model",
"document"
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L552-L632 |
9,216 | JKHeadley/rest-hapi | utilities/handler-helper.js | _deleteMany | function _deleteMany(model, payload, Log) {
let request = { payload: payload }
return _deleteManyHandler(model, request, Log)
} | javascript | function _deleteMany(model, payload, Log) {
let request = { payload: payload }
return _deleteManyHandler(model, request, Log)
} | [
"function",
"_deleteMany",
"(",
"model",
",",
"payload",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"payload",
":",
"payload",
"}",
"return",
"_deleteManyHandler",
"(",
"model",
",",
"request",
",",
"Log",
")",
"}"
] | DeleteMany function exposed as a mongoose wrapper.
@param model: A mongoose model.
@param payload: Either an array of ids or an array of objects containing an id and a "hardDelete" flag.
@param Log: A logging object.
@returns {object} A promise returning true if the delete succeeds.
@private | [
"DeleteMany",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L642-L645 |
9,217 | JKHeadley/rest-hapi | utilities/handler-helper.js | _deleteManyHandler | async function _deleteManyHandler(model, 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
})
let promises = []
for (let arg of payload) {
... | javascript | async function _deleteManyHandler(model, 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
})
let promises = []
for (let arg of payload) {
... | [
"async",
"function",
"_deleteManyHandler",
"(",
"model",
",",
"request",
",",
"Log",
")",
"{",
"try",
"{",
"// EXPL: make a copy of the payload so that request.payload remains unchanged",
"let",
"payload",
"=",
"request",
".",
"payload",
".",
"map",
"(",
"item",
"=>",... | Deletes multiple documents.
@param model: A mongoose model.
@param request: The Hapi request object, or a container for the wrapper payload.
@param Log: A logging object.
@returns {object} A promise returning true if the delete succeeds.
@private
TODO: prevent Promise.all from catching first error and returning early.... | [
"Deletes",
"multiple",
"documents",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L656-L678 |
9,218 | JKHeadley/rest-hapi | utilities/handler-helper.js | _addOne | function _addOne(
ownerModel,
ownerId,
childModel,
childId,
associationName,
payload,
Log
) {
let request = {
params: { ownerId: ownerId, childId: childId },
payload: payload
}
return _addOneHandler(
ownerModel,
ownerId,
childModel,
childId,
associationName,
request,
... | javascript | function _addOne(
ownerModel,
ownerId,
childModel,
childId,
associationName,
payload,
Log
) {
let request = {
params: { ownerId: ownerId, childId: childId },
payload: payload
}
return _addOneHandler(
ownerModel,
ownerId,
childModel,
childId,
associationName,
request,
... | [
"function",
"_addOne",
"(",
"ownerModel",
",",
"ownerId",
",",
"childModel",
",",
"childId",
",",
"associationName",
",",
"payload",
",",
"Log",
")",
"{",
"let",
"request",
"=",
"{",
"params",
":",
"{",
"ownerId",
":",
"ownerId",
",",
"childId",
":",
"ch... | AddOne 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 childId: The id of the child document.
@param associationName: The name of the association from the ownerModel's pers... | [
"AddOne",
"function",
"exposed",
"as",
"a",
"mongoose",
"wrapper",
"."
] | 36110fd3cb2775b3b2068b18d775f1c87fbcef76 | https://github.com/JKHeadley/rest-hapi/blob/36110fd3cb2775b3b2068b18d775f1c87fbcef76/utilities/handler-helper.js#L692-L714 |
9,219 | 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 |
9,220 | 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 |
9,221 | 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 |
9,222 | 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 |
9,223 | 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 |
9,224 | 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 |
9,225 | 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 |
9,226 | 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 |
9,227 | 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 |
9,228 | 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 | |
9,229 | 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 | |
9,230 | 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 |
9,231 | 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 |
9,232 | 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 |
9,233 | 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 |
9,234 | 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 | |
9,235 | 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 | |
9,236 | 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 | |
9,237 | 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 | |
9,238 | 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 | |
9,239 | 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 | |
9,240 | 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 | |
9,241 | 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 | |
9,242 | 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 |
9,243 | 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 | |
9,244 | 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 |
9,245 | 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 |
9,246 | 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 |
9,247 | 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 |
9,248 | 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 |
9,249 | 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 |
9,250 | 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 |
9,251 | 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 |
9,252 | 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 |
9,253 | 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 |
9,254 | 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 |
9,255 | 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 |
9,256 | 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 |
9,257 | 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 | |
9,258 | 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 |
9,259 | 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 |
9,260 | 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 |
9,261 | 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 |
9,262 | 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 |
9,263 | 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 |
9,264 | 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 |
9,265 | 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 |
9,266 | 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 |
9,267 | 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 |
9,268 | 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 |
9,269 | 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 |
9,270 | 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 |
9,271 | 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 |
9,272 | 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 |
9,273 | 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 |
9,274 | 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 |
9,275 | 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 | |
9,276 | 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 | |
9,277 | 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 | |
9,278 | 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 | |
9,279 | 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 | |
9,280 | 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 | |
9,281 | 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 | |
9,282 | 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 | |
9,283 | 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 | |
9,284 | 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 | |
9,285 | 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 | |
9,286 | 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 | |
9,287 | 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 | |
9,288 | 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 | |
9,289 | 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 | |
9,290 | 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 | |
9,291 | 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 | |
9,292 | 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 | |
9,293 | 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 | |
9,294 | 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 | |
9,295 | 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 | |
9,296 | 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 | |
9,297 | 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 | |
9,298 | 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 | |
9,299 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.