repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
feedhenry/fh-forms | lib/middleware/formProjects.js | getTheme | function getTheme(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppTheme(_.extend(req.connectionOptions, params), function(err, theme) {
if (err) {
return next(err);
}
req.appformsResultPayload = req.appformsResultPayload || {};
if (_.isObjec... | javascript | function getTheme(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppTheme(_.extend(req.connectionOptions, params), function(err, theme) {
if (err) {
return next(err);
}
req.appformsResultPayload = req.appformsResultPayload || {};
if (_.isObjec... | [
"function",
"getTheme",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"projectid",
"||",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"getAppTheme",
"(",
"_",
".",
"... | Middleware To Get A Theme Assocaited With A Project
@param req
@param res
@param next | [
"Middleware",
"To",
"Get",
"A",
"Theme",
"Assocaited",
"With",
"A",
"Project"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L68-L90 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | remove | function remove(req, res, next) {
var params = {
appId: req.params.id
};
forms.deleteAppReferences(req.connectionOptions, params, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function remove(req, res, next) {
var params = {
appId: req.params.id
};
forms.deleteAppReferences(req.connectionOptions, params, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"remove",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"deleteAppReferences",
"(",
"req",
".",
"connectionOptions",
",",
"params",
",",
"f... | Removing A Forms Project. This is mainly done when projects are deleted.
Cleans up references to the project in the database. AppThemes/AppForms/AppConfig etc.
@param req
@param res
@param next | [
"Removing",
"A",
"Forms",
"Project",
".",
"This",
"is",
"mainly",
"done",
"when",
"projects",
"are",
"deleted",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L100-L106 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | get | function get(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppFormsForApp(_.extend(req.connectionOptions, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function get(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppFormsForApp(_.extend(req.connectionOptions, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"get",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"projectid",
"||",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"getAppFormsForApp",
"(",
"_",
".",
... | Get Forms Related To A Project Guid
@param req
@param res
@param next | [
"Get",
"Forms",
"Related",
"To",
"A",
"Project",
"Guid"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L114-L120 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | getFormIds | function getFormIds(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppFormsForApp(_.extend(req.connectionOptions, params), function(err, appFormResult) {
if (err) {
return next(err);
}
//Only Want The Form Ids
req.appformsResultPayload = {
... | javascript | function getFormIds(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppFormsForApp(_.extend(req.connectionOptions, params), function(err, appFormResult) {
if (err) {
return next(err);
}
//Only Want The Form Ids
req.appformsResultPayload = {
... | [
"function",
"getFormIds",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"projectid",
"||",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"getAppFormsForApp",
"(",
"_",
... | Getting Form Ids Only Associated With A Project
@param req
@param res
@param next | [
"Getting",
"Form",
"Ids",
"Only",
"Associated",
"With",
"A",
"Project"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L128-L148 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | getConfig | function getConfig(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppConfig(req.connectionOptions, params, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function getConfig(req, res, next) {
var params = {
appId: req.params.projectid || req.params.id
};
forms.getAppConfig(req.connectionOptions, params, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"getConfig",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"projectid",
"||",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"getAppConfig",
"(",
"req",
".",... | Get Config For A Single Project
@param req
@param res
@param next | [
"Get",
"Config",
"For",
"A",
"Single",
"Project"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L157-L163 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | updateConfig | function updateConfig(req, res, next) {
var params = {
appId: req.params.id
};
forms.updateAppConfig(req.connectionOptions, _.extend(req.body, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function updateConfig(req, res, next) {
var params = {
appId: req.params.id
};
forms.updateAppConfig(req.connectionOptions, _.extend(req.body, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"updateConfig",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"appId",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"forms",
".",
"updateAppConfig",
"(",
"req",
".",
"connectionOptions",
",",
"_",
".",
"exte... | Update Config For A Single Project
@param req
@param res
@param next | [
"Update",
"Config",
"For",
"A",
"Single",
"Project"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L172-L178 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | exportProjects | function exportProjects(req, res, next) {
var options = req.connectionOptions;
forms.exportAppForms(options, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function exportProjects(req, res, next) {
var options = req.connectionOptions;
forms.exportAppForms(options, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"exportProjects",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"forms",
".",
"exportAppForms",
"(",
"options",
",",
"formsResultHandlers",
"(",
"constants",
".",
"resultTypes",
".",
"... | Exporting All App Forms
@param req
@param res
@param next | [
"Exporting",
"All",
"App",
"Forms"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L186-L190 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | importProjects | function importProjects(req, res, next) {
var options = req.connectionOptions;
var appFormsToImport = req.body || [];
if (!_.isArray(appFormsToImport)) {
return next("Expected An Array Of App Form Entries");
}
forms.importAppForms(options, appFormsToImport, formsResultHandlers(constants.resultTypes.for... | javascript | function importProjects(req, res, next) {
var options = req.connectionOptions;
var appFormsToImport = req.body || [];
if (!_.isArray(appFormsToImport)) {
return next("Expected An Array Of App Form Entries");
}
forms.importAppForms(options, appFormsToImport, formsResultHandlers(constants.resultTypes.for... | [
"function",
"importProjects",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"var",
"appFormsToImport",
"=",
"req",
".",
"body",
"||",
"[",
"]",
";",
"if",
"(",
"!",
"_",
".",
"isArray",
"(... | Importing All App Forms
@param req
@param res
@param next | [
"Importing",
"All",
"App",
"Forms"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L198-L208 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | exportProjectConfig | function exportProjectConfig(req, res, next) {
var options = req.connectionOptions;
forms.exportAppConfig(options, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function exportProjectConfig(req, res, next) {
var options = req.connectionOptions;
forms.exportAppConfig(options, formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"exportProjectConfig",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"forms",
".",
"exportAppConfig",
"(",
"options",
",",
"formsResultHandlers",
"(",
"constants",
".",
"resultTypes",
".... | Exporting Project Config
@param req
@param res
@param next | [
"Exporting",
"Project",
"Config"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L216-L220 | train |
feedhenry/fh-forms | lib/middleware/formProjects.js | importProjectConfig | function importProjectConfig(req, res, next) {
var options = req.connectionOptions;
var projectConfigToImport = req.body || [];
if (!_.isArray(projectConfigToImport)) {
return next("Expected An Array Of Project Config Values");
}
forms.importAppConfig(options, projectConfigToImport, formsResultHandlers... | javascript | function importProjectConfig(req, res, next) {
var options = req.connectionOptions;
var projectConfigToImport = req.body || [];
if (!_.isArray(projectConfigToImport)) {
return next("Expected An Array Of Project Config Values");
}
forms.importAppConfig(options, projectConfigToImport, formsResultHandlers... | [
"function",
"importProjectConfig",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"var",
"projectConfigToImport",
"=",
"req",
".",
"body",
"||",
"[",
"]",
";",
"if",
"(",
"!",
"_",
".",
"isAr... | Importing Project Config.
@param req
@param res
@param next | [
"Importing",
"Project",
"Config",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/formProjects.js#L228-L238 | train |
feedhenry/fh-forms | lib/impl/pdfGeneration/doPdfGeneration.js | loadPdfTemplate | function loadPdfTemplate(params, cb) {
logger.debug("renderPDF loadPdfTemplate", params);
//Already have a compiled template, no need to compile it again.
if (pdfTemplate) {
return cb(null, pdfTemplate);
} else {
readAndCompileTemplate(function(err, compiledTemplate) {
pdfTemplate = compiledTempl... | javascript | function loadPdfTemplate(params, cb) {
logger.debug("renderPDF loadPdfTemplate", params);
//Already have a compiled template, no need to compile it again.
if (pdfTemplate) {
return cb(null, pdfTemplate);
} else {
readAndCompileTemplate(function(err, compiledTemplate) {
pdfTemplate = compiledTempl... | [
"function",
"loadPdfTemplate",
"(",
"params",
",",
"cb",
")",
"{",
"logger",
".",
"debug",
"(",
"\"renderPDF loadPdfTemplate\"",
",",
"params",
")",
";",
"//Already have a compiled template, no need to compile it again.",
"if",
"(",
"pdfTemplate",
")",
"{",
"return",
... | Loading The Submission Template From Studio
@param params
- location
- pdfTemplateLoc
@param cb
@returns {*}
@private | [
"Loading",
"The",
"Submission",
"Template",
"From",
"Studio"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/pdfGeneration/doPdfGeneration.js#L19-L31 | train |
cloudfour/drizzle-builder | src/write/index.js | write | function write(drizzleData) {
return Promise.all([
writePages(drizzleData),
writeCollections(drizzleData)
]).then(
() => drizzleData,
error => DrizzleError.error(error, drizzleData.options)
);
} | javascript | function write(drizzleData) {
return Promise.all([
writePages(drizzleData),
writeCollections(drizzleData)
]).then(
() => drizzleData,
error => DrizzleError.error(error, drizzleData.options)
);
} | [
"function",
"write",
"(",
"drizzleData",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"[",
"writePages",
"(",
"drizzleData",
")",
",",
"writeCollections",
"(",
"drizzleData",
")",
"]",
")",
".",
"then",
"(",
"(",
")",
"=>",
"drizzleData",
",",
"error"... | Write pages and collection-pages to filesystem.
@param {Object} drizzleData All drizzle data so far
@return {Promise} resolving to drizzleData | [
"Write",
"pages",
"and",
"collection",
"-",
"pages",
"to",
"filesystem",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/write/index.js#L12-L20 | train |
stackgl/gl-shader-core | shader-core.js | relinkUniforms | function relinkUniforms(gl, program, locations, uniforms) {
for(var i=0; i<uniforms.length; ++i) {
locations[i] = gl.getUniformLocation(program, uniforms[i].name)
}
} | javascript | function relinkUniforms(gl, program, locations, uniforms) {
for(var i=0; i<uniforms.length; ++i) {
locations[i] = gl.getUniformLocation(program, uniforms[i].name)
}
} | [
"function",
"relinkUniforms",
"(",
"gl",
",",
"program",
",",
"locations",
",",
"uniforms",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"uniforms",
".",
"length",
";",
"++",
"i",
")",
"{",
"locations",
"[",
"i",
"]",
"=",
"gl",
"."... | Relinks all uniforms | [
"Relinks",
"all",
"uniforms"
] | 25e021e9239ad7b73ce08ff0fdc97e2e68e1d075 | https://github.com/stackgl/gl-shader-core/blob/25e021e9239ad7b73ce08ff0fdc97e2e68e1d075/shader-core.js#L65-L69 | train |
stackgl/gl-shader-core | shader-core.js | createShader | function createShader(
gl
, vertSource
, fragSource
, uniforms
, attributes) {
//Compile vertex shader
var vertShader = gl.createShader(gl.VERTEX_SHADER)
gl.shaderSource(vertShader, vertSource)
gl.compileShader(vertShader)
if(!gl.getShaderParameter(vertShader, gl.COMPILE_STATUS)) {
var errL... | javascript | function createShader(
gl
, vertSource
, fragSource
, uniforms
, attributes) {
//Compile vertex shader
var vertShader = gl.createShader(gl.VERTEX_SHADER)
gl.shaderSource(vertShader, vertSource)
gl.compileShader(vertShader)
if(!gl.getShaderParameter(vertShader, gl.COMPILE_STATUS)) {
var errL... | [
"function",
"createShader",
"(",
"gl",
",",
"vertSource",
",",
"fragSource",
",",
"uniforms",
",",
"attributes",
")",
"{",
"//Compile vertex shader",
"var",
"vertShader",
"=",
"gl",
".",
"createShader",
"(",
"gl",
".",
"VERTEX_SHADER",
")",
"gl",
".",
"shaderS... | Compiles and links a shader program with the given attribute and vertex list | [
"Compiles",
"and",
"links",
"a",
"shader",
"program",
"with",
"the",
"given",
"attribute",
"and",
"vertex",
"list"
] | 25e021e9239ad7b73ce08ff0fdc97e2e68e1d075 | https://github.com/stackgl/gl-shader-core/blob/25e021e9239ad7b73ce08ff0fdc97e2e68e1d075/shader-core.js#L72-L127 | train |
cloudfour/drizzle-builder | src/parse/pages.js | parsePages | function parsePages(options) {
return readFileTree(options.src.pages, options.keys.pages, options);
} | javascript | function parsePages(options) {
return readFileTree(options.src.pages, options.keys.pages, options);
} | [
"function",
"parsePages",
"(",
"options",
")",
"{",
"return",
"readFileTree",
"(",
"options",
".",
"src",
".",
"pages",
",",
"options",
".",
"keys",
".",
"pages",
",",
"options",
")",
";",
"}"
] | Parse page files.
@param {Object} Options
@return {Promise} resolving to page data | [
"Parse",
"page",
"files",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/parse/pages.js#L11-L13 | train |
crispy1989/node-zstreams | lib/transform.js | ZTransform | function ZTransform(options) {
if(options) {
if(options.objectMode) {
options.readableObjectMode = true;
options.writableObjectMode = true;
}
if(options.readableObjectMode && options.writableObjectMode) {
options.objectMode = true;
}
if(typeof options.transform === 'function') {
this._transform =... | javascript | function ZTransform(options) {
if(options) {
if(options.objectMode) {
options.readableObjectMode = true;
options.writableObjectMode = true;
}
if(options.readableObjectMode && options.writableObjectMode) {
options.objectMode = true;
}
if(typeof options.transform === 'function') {
this._transform =... | [
"function",
"ZTransform",
"(",
"options",
")",
"{",
"if",
"(",
"options",
")",
"{",
"if",
"(",
"options",
".",
"objectMode",
")",
"{",
"options",
".",
"readableObjectMode",
"=",
"true",
";",
"options",
".",
"writableObjectMode",
"=",
"true",
";",
"}",
"i... | ZTransform transforms input to the stream through the _transform function.
@class ZTransform
@constructor
@extends Transform
@uses _Stream
@uses _Readable
@uses _Writable
@param {Object} [options] - Stream options | [
"ZTransform",
"transforms",
"input",
"to",
"the",
"stream",
"through",
"the",
"_transform",
"function",
"."
] | 4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd | https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/transform.js#L19-L50 | train |
crispy1989/node-zstreams | lib/streams/compound-duplex.js | CompoundDuplex | function CompoundDuplex(writable, readable, options) {
var self = this;
var convertToZStream = require('../index'); // for circular dependencies
if(!readable || typeof readable.read !== 'function') {
options = readable;
readable = writable;
writable = null;
}
if(writable && !writable._isZStream) {
writab... | javascript | function CompoundDuplex(writable, readable, options) {
var self = this;
var convertToZStream = require('../index'); // for circular dependencies
if(!readable || typeof readable.read !== 'function') {
options = readable;
readable = writable;
writable = null;
}
if(writable && !writable._isZStream) {
writab... | [
"function",
"CompoundDuplex",
"(",
"writable",
",",
"readable",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"convertToZStream",
"=",
"require",
"(",
"'../index'",
")",
";",
"// for circular dependencies",
"if",
"(",
"!",
"readable",
"||",... | Stream that allows encapsulating a set of streams piped together as a single stream.
@class CompoundDuplex
@constructor
@param {Writable} writable - The first stream in the pipeline to encapsulate. This is optional. If all
streams in the pipeline are ZStreams, the readable alone can be used to determine the first st... | [
"Stream",
"that",
"allows",
"encapsulating",
"a",
"set",
"of",
"streams",
"piped",
"together",
"as",
"a",
"single",
"stream",
"."
] | 4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd | https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/streams/compound-duplex.js#L14-L65 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | get | function get(connections, params, cb) {
//validateParams
//LookUpDataSource
//CheckFormsThatAre Using The Data Source
//Return Result.
async.waterfall([
function validateParams(cb) {
validate(params).has(CONSTANTS.DATA_SOURCE_ID, function(err) {
if (err) {
return cb(buildErrorResp... | javascript | function get(connections, params, cb) {
//validateParams
//LookUpDataSource
//CheckFormsThatAre Using The Data Source
//Return Result.
async.waterfall([
function validateParams(cb) {
validate(params).has(CONSTANTS.DATA_SOURCE_ID, function(err) {
if (err) {
return cb(buildErrorResp... | [
"function",
"get",
"(",
"connections",
",",
"params",
",",
"cb",
")",
"{",
"//validateParams",
"//LookUpDataSource",
"//CheckFormsThatAre Using The Data Source",
"//Return Result.",
"async",
".",
"waterfall",
"(",
"[",
"function",
"validateParams",
"(",
"cb",
")",
"{"... | Get A Specific Data Source Definition
@param connections
@param params
@param params._id: Data Source Id
@param params.includeAuditLog: flag to include a data source audit log or not.
@param params.includeAuditLogData: flag for including the data set with the audit log list.
@param cb | [
"Get",
"A",
"Specific",
"Data",
"Source",
"Definition"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L26-L86 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | list | function list(connections, params, callback) {
logger.debug("Listing Data Sources", params);
var currentTime = new Date(params.currentTime);
//If listing data sources needing a cache update, need to supply a valid date.
if (params.listDataSourcesNeedingUpdate && !params.currentTime && currentTime.toString() !... | javascript | function list(connections, params, callback) {
logger.debug("Listing Data Sources", params);
var currentTime = new Date(params.currentTime);
//If listing data sources needing a cache update, need to supply a valid date.
if (params.listDataSourcesNeedingUpdate && !params.currentTime && currentTime.toString() !... | [
"function",
"list",
"(",
"connections",
",",
"params",
",",
"callback",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Listing Data Sources\"",
",",
"params",
")",
";",
"var",
"currentTime",
"=",
"new",
"Date",
"(",
"params",
".",
"currentTime",
")",
";",
"//If... | Listing All Data Sources. In The Environment, this will include the current cache data.
@param connections
@param params
- listDataSourcesNeedingUpdate: Flag For Only Returning Data Sources That Require An Update
- currentTime: Time Stamp To Compare Data Source Last Updated Timestamps To
@param callback | [
"Listing",
"All",
"Data",
"Sources",
".",
"In",
"The",
"Environment",
"this",
"will",
"include",
"the",
"current",
"cache",
"data",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L96-L142 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | create | function create(connections, dataSource, callback) {
async.waterfall([
function validateParams(cb) {
//If it is a deploy, the JSON can contain an _id param
if (connections.deploy) {
return cb(undefined, dataSource);
}
//Otherwise, check that it is not there.
validate(dataSo... | javascript | function create(connections, dataSource, callback) {
async.waterfall([
function validateParams(cb) {
//If it is a deploy, the JSON can contain an _id param
if (connections.deploy) {
return cb(undefined, dataSource);
}
//Otherwise, check that it is not there.
validate(dataSo... | [
"function",
"create",
"(",
"connections",
",",
"dataSource",
",",
"callback",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"function",
"validateParams",
"(",
"cb",
")",
"{",
"//If it is a deploy, the JSON can contain an _id param",
"if",
"(",
"connections",
".",
... | Creating A New Data Source
@param connections
@param dataSource
@param callback | [
"Creating",
"A",
"New",
"Data",
"Source"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L150-L207 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | remove | function remove(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_SOURCE_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Source"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params[CONSTANT... | javascript | function remove(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_SOURCE_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Source"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params[CONSTANT... | [
"function",
"remove",
"(",
"connections",
",",
"params",
",",
"cb",
")",
"{",
"var",
"failed",
"=",
"validate",
"(",
"params",
")",
".",
"has",
"(",
"CONSTANTS",
".",
"DATA_SOURCE_ID",
")",
";",
"if",
"(",
"failed",
")",
"{",
"return",
"cb",
"(",
"bu... | Removing A Data Source
@param connections
@param params
@param cb | [
"Removing",
"A",
"Data",
"Source"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L215-L264 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | validateDataSource | function validateDataSource(connections, dataSource, cb) {
var dataSourceToValidate = _.clone(dataSource);
var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);
//Expect The Data Source To Have Data
var failure = validate(dataSourceToValidate).has(CONSTANTS.DATA_SOURCE_DAT... | javascript | function validateDataSource(connections, dataSource, cb) {
var dataSourceToValidate = _.clone(dataSource);
var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);
//Expect The Data Source To Have Data
var failure = validate(dataSourceToValidate).has(CONSTANTS.DATA_SOURCE_DAT... | [
"function",
"validateDataSource",
"(",
"connections",
",",
"dataSource",
",",
"cb",
")",
"{",
"var",
"dataSourceToValidate",
"=",
"_",
".",
"clone",
"(",
"dataSource",
")",
";",
"var",
"DataSource",
"=",
"models",
".",
"get",
"(",
"connections",
".",
"mongoo... | Validating A Data Source Object.
@param connections
@param dataSource
@param cb | [
"Validating",
"A",
"Data",
"Source",
"Object",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L274-L323 | train |
feedhenry/fh-forms | lib/impl/dataSources/index.js | deploy | function deploy(connections, dataSource, cb) {
async.waterfall([
function validateParams(cb) {
var dataSourceValidator = validate(dataSource);
//The data source parameter should have an ID property.
dataSourceValidator.has(CONSTANTS.DATA_SOURCE_ID, function(err) {
if (err) {
r... | javascript | function deploy(connections, dataSource, cb) {
async.waterfall([
function validateParams(cb) {
var dataSourceValidator = validate(dataSource);
//The data source parameter should have an ID property.
dataSourceValidator.has(CONSTANTS.DATA_SOURCE_ID, function(err) {
if (err) {
r... | [
"function",
"deploy",
"(",
"connections",
",",
"dataSource",
",",
"cb",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"function",
"validateParams",
"(",
"cb",
")",
"{",
"var",
"dataSourceValidator",
"=",
"validate",
"(",
"dataSource",
")",
";",
"//The data ... | Deploying A Data Source. Check If It Exists First, then update, if not create it. | [
"Deploying",
"A",
"Data",
"Source",
".",
"Check",
"If",
"It",
"Exists",
"First",
"then",
"update",
"if",
"not",
"create",
"it",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/index.js#L328-L373 | train |
feedhenry/fh-forms | lib/middleware/parseMongoConnectionOptions.js | parseMongoConnectionOptions | function parseMongoConnectionOptions(req, res, next) {
var options = {};
options.uri = req.mongoUrl;
req.connectionOptions = options;
return next();
} | javascript | function parseMongoConnectionOptions(req, res, next) {
var options = {};
options.uri = req.mongoUrl;
req.connectionOptions = options;
return next();
} | [
"function",
"parseMongoConnectionOptions",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"{",
"}",
";",
"options",
".",
"uri",
"=",
"req",
".",
"mongoUrl",
";",
"req",
".",
"connectionOptions",
"=",
"options",
";",
"return",
"next... | Populating mongo connection options for forms operations.
@param req
@param res
@param next
@returns {*} | [
"Populating",
"mongo",
"connection",
"options",
"for",
"forms",
"operations",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/parseMongoConnectionOptions.js#L8-L15 | train |
crispy1989/node-zstreams | lib/streams/string-readable-stream.js | StringReadableStream | function StringReadableStream(str, options) {
if(!options) options = {};
delete options.objectMode;
delete options.readableObjectMode;
Readable.call(this, options);
this._currentString = str;
this._currentStringPos = 0;
this._stringChunkSize = options.chunkSize || 1024;
} | javascript | function StringReadableStream(str, options) {
if(!options) options = {};
delete options.objectMode;
delete options.readableObjectMode;
Readable.call(this, options);
this._currentString = str;
this._currentStringPos = 0;
this._stringChunkSize = options.chunkSize || 1024;
} | [
"function",
"StringReadableStream",
"(",
"str",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"options",
"=",
"{",
"}",
";",
"delete",
"options",
".",
"objectMode",
";",
"delete",
"options",
".",
"readableObjectMode",
";",
"Readable",
".",
"cal... | A readable string that outputs data from a string given to the constructor.
@class StringReadableStream
@constructor
@param {String|Buffer} str - The string to output to the stream
@param {Object} options - Options for the stream
@param {Number} options.chunkSize - The size of chunk to output to the stream, defaults t... | [
"A",
"readable",
"string",
"that",
"outputs",
"data",
"from",
"a",
"string",
"given",
"to",
"the",
"constructor",
"."
] | 4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd | https://github.com/crispy1989/node-zstreams/blob/4ec01a49d1d00c542ee1dfa4b3bedcf1324e9ffd/lib/streams/string-readable-stream.js#L13-L21 | train |
cloudfour/drizzle-builder | src/parse/templates.js | parseTemplates | function parseTemplates(options) {
return readFileTree(options.src.templates, options.keys.templates, options);
} | javascript | function parseTemplates(options) {
return readFileTree(options.src.templates, options.keys.templates, options);
} | [
"function",
"parseTemplates",
"(",
"options",
")",
"{",
"return",
"readFileTree",
"(",
"options",
".",
"src",
".",
"templates",
",",
"options",
".",
"keys",
".",
"templates",
",",
"options",
")",
";",
"}"
] | Parse layout files.
@param {Object} options
@return {Promise} resolving to object of parsed template contents | [
"Parse",
"layout",
"files",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/parse/templates.js#L8-L10 | train |
feedhenry/fh-forms | lib/middleware/forms.js | list | function list(req, res, next) {
var notStats = req.query && (req.query.notStats === 'true' || req.query.notStats === true);
var opts = _.extend(req.connectionOptions, { notStats: notStats });
logger.debug("List Forms Middleware ", opts);
forms.getAllForms(opts, formsResultHandlers(constants.resultTypes.forms, ... | javascript | function list(req, res, next) {
var notStats = req.query && (req.query.notStats === 'true' || req.query.notStats === true);
var opts = _.extend(req.connectionOptions, { notStats: notStats });
logger.debug("List Forms Middleware ", opts);
forms.getAllForms(opts, formsResultHandlers(constants.resultTypes.forms, ... | [
"function",
"list",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"notStats",
"=",
"req",
".",
"query",
"&&",
"(",
"req",
".",
"query",
".",
"notStats",
"===",
"'true'",
"||",
"req",
".",
"query",
".",
"notStats",
"===",
"true",
")",
";",
... | List All Forms
@param req
@param res
@param next | [
"List",
"All",
"Forms"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L14-L20 | train |
feedhenry/fh-forms | lib/middleware/forms.js | listDeployedForms | function listDeployedForms(req, res, next) {
var projectForms = req.appformsResultPayload.data || [];
logger.debug("Middleware: listDeployedForms: ", {connection: req.connectionOptions, projectForms: projectForms});
//Only Want The Project Ids
projectForms = _.map(projectForms, function(form) {
if (_.isObj... | javascript | function listDeployedForms(req, res, next) {
var projectForms = req.appformsResultPayload.data || [];
logger.debug("Middleware: listDeployedForms: ", {connection: req.connectionOptions, projectForms: projectForms});
//Only Want The Project Ids
projectForms = _.map(projectForms, function(form) {
if (_.isObj... | [
"function",
"listDeployedForms",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"projectForms",
"=",
"req",
".",
"appformsResultPayload",
".",
"data",
"||",
"[",
"]",
";",
"logger",
".",
"debug",
"(",
"\"Middleware: listDeployedForms: \"",
",",
"{",
"... | Listing Forms Deployed To An Environment
@param req
@param res
@param next | [
"Listing",
"Forms",
"Deployed",
"To",
"An",
"Environment"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L28-L42 | train |
feedhenry/fh-forms | lib/middleware/forms.js | search | function search(req, res, next) {
var projectForms = req.appformsResultPayload.data || [];
//Only Want The Project Ids
projectForms = _.map(projectForms, function(form) {
if (_.isObject(form)) {
return form._id;
} else {
return form;
}
});
var formsToFind = req.body || [];
formsToF... | javascript | function search(req, res, next) {
var projectForms = req.appformsResultPayload.data || [];
//Only Want The Project Ids
projectForms = _.map(projectForms, function(form) {
if (_.isObject(form)) {
return form._id;
} else {
return form;
}
});
var formsToFind = req.body || [];
formsToF... | [
"function",
"search",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"projectForms",
"=",
"req",
".",
"appformsResultPayload",
".",
"data",
"||",
"[",
"]",
";",
"//Only Want The Project Ids",
"projectForms",
"=",
"_",
".",
"map",
"(",
"projectForms",
... | Function to list forms that are deployed.
The request should contain an array of deployed forms.
@param req
@param res
@param next | [
"Function",
"to",
"list",
"forms",
"that",
"are",
"deployed",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L53-L85 | train |
feedhenry/fh-forms | lib/middleware/forms.js | create | function create(req, res, next) {
var options = req.connectionOptions;
req.user = req.user || {};
var params = {
userEmail: req.user.email || req.body.updatedBy
};
options = _.extend(options, params);
logger.debug("Middleware: create form: ", {options: options});
forms.updateForm(options, req.body,... | javascript | function create(req, res, next) {
var options = req.connectionOptions;
req.user = req.user || {};
var params = {
userEmail: req.user.email || req.body.updatedBy
};
options = _.extend(options, params);
logger.debug("Middleware: create form: ", {options: options});
forms.updateForm(options, req.body,... | [
"function",
"create",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"req",
".",
"user",
"=",
"req",
".",
"user",
"||",
"{",
"}",
";",
"var",
"params",
"=",
"{",
"userEmail",
":",
"req",
... | Create A New Form
@param req
@param res
@param next | [
"Create",
"A",
"New",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L93-L105 | train |
feedhenry/fh-forms | lib/middleware/forms.js | deploy | function deploy(req, res, next) {
var options = req.connectionOptions;
var form = req.body;
req.user = req.user || {};
if (req.appformsResultPayload && _.isObject(req.appformsResultPayload.data)) {
form = req.appformsResultPayload.data;
}
//Expect A Data Source Data Set To Be Available If Deploying A ... | javascript | function deploy(req, res, next) {
var options = req.connectionOptions;
var form = req.body;
req.user = req.user || {};
if (req.appformsResultPayload && _.isObject(req.appformsResultPayload.data)) {
form = req.appformsResultPayload.data;
}
//Expect A Data Source Data Set To Be Available If Deploying A ... | [
"function",
"deploy",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"var",
"form",
"=",
"req",
".",
"body",
";",
"req",
".",
"user",
"=",
"req",
".",
"user",
"||",
"{",
"}",
";",
"if",... | Deploying A Form. Creates A Form If It Already Exists
@param req
@param res
@param next | [
"Deploying",
"A",
"Form",
".",
"Creates",
"A",
"Form",
"If",
"It",
"Already",
"Exists"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L113-L133 | train |
feedhenry/fh-forms | lib/middleware/forms.js | get | function get(req, res, next) {
//Admin Fields And Data Sources Should Not Be Shown For App Requests
var showAdminAndDataSources = !req.params.projectid;
var getParams = {
"_id": req.params.id,
"showAdminFields": showAdminAndDataSources,
includeDataSources: showAdminAndDataSources,
//Data Source ... | javascript | function get(req, res, next) {
//Admin Fields And Data Sources Should Not Be Shown For App Requests
var showAdminAndDataSources = !req.params.projectid;
var getParams = {
"_id": req.params.id,
"showAdminFields": showAdminAndDataSources,
includeDataSources: showAdminAndDataSources,
//Data Source ... | [
"function",
"get",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"//Admin Fields And Data Sources Should Not Be Shown For App Requests",
"var",
"showAdminAndDataSources",
"=",
"!",
"req",
".",
"params",
".",
"projectid",
";",
"var",
"getParams",
"=",
"{",
"\"_id\""... | Get A Single Form Definition
@param req
@param res
@param next | [
"Get",
"A",
"Single",
"Form",
"Definition"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L141-L157 | train |
feedhenry/fh-forms | lib/middleware/forms.js | update | function update(req, res, next) {
var options = req.connectionOptions;
req.appformsResultPayload = req.appformsResultPayload || {};
var params = {
userEmail: req.user.email
};
options = _.extend(options, params);
var form = req.body;
if (_.isObject(req.appformsResultPayload.data) && !req.body._id)... | javascript | function update(req, res, next) {
var options = req.connectionOptions;
req.appformsResultPayload = req.appformsResultPayload || {};
var params = {
userEmail: req.user.email
};
options = _.extend(options, params);
var form = req.body;
if (_.isObject(req.appformsResultPayload.data) && !req.body._id)... | [
"function",
"update",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"options",
"=",
"req",
".",
"connectionOptions",
";",
"req",
".",
"appformsResultPayload",
"=",
"req",
".",
"appformsResultPayload",
"||",
"{",
"}",
";",
"var",
"params",
"=",
"{... | Update A Single Existing Form
@param req
@param res
@param next | [
"Update",
"A",
"Single",
"Existing",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L165-L184 | train |
feedhenry/fh-forms | lib/middleware/forms.js | undeploy | function undeploy(req, res, next) {
var removeParams = {
_id: req.params.id
};
logger.debug("Middleware: undeploy form: ", {params: removeParams});
forms.deleteForm(_.extend(req.connectionOptions, removeParams), formsResultHandlers(constants.resultTypes.forms, req, next));
} | javascript | function undeploy(req, res, next) {
var removeParams = {
_id: req.params.id
};
logger.debug("Middleware: undeploy form: ", {params: removeParams});
forms.deleteForm(_.extend(req.connectionOptions, removeParams), formsResultHandlers(constants.resultTypes.forms, req, next));
} | [
"function",
"undeploy",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"removeParams",
"=",
"{",
"_id",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"logger",
".",
"debug",
"(",
"\"Middleware: undeploy form: \"",
",",
"{",
"params",
":",
"rem... | Undeploy An Existing Form. Does not remove any submission data.
@param req
@param res
@param next | [
"Undeploy",
"An",
"Existing",
"Form",
".",
"Does",
"not",
"remove",
"any",
"submission",
"data",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L209-L217 | train |
feedhenry/fh-forms | lib/middleware/forms.js | listSubscribers | function listSubscribers(req, res, next) {
var listSubscribersParams = {
_id: req.params.id
};
logger.debug("Middleware: listSubscribers: ", {params: listSubscribersParams});
forms.getNotifications(_.extend(req.connectionOptions, listSubscribersParams), formsResultHandlers(constants.resultTypes.forms, req... | javascript | function listSubscribers(req, res, next) {
var listSubscribersParams = {
_id: req.params.id
};
logger.debug("Middleware: listSubscribers: ", {params: listSubscribersParams});
forms.getNotifications(_.extend(req.connectionOptions, listSubscribersParams), formsResultHandlers(constants.resultTypes.forms, req... | [
"function",
"listSubscribers",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"listSubscribersParams",
"=",
"{",
"_id",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"logger",
".",
"debug",
"(",
"\"Middleware: listSubscribers: \"",
",",
"{",
"para... | List All Subscribers For A Form
@param req
@param res
@param next | [
"List",
"All",
"Subscribers",
"For",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L225-L233 | train |
feedhenry/fh-forms | lib/middleware/forms.js | updateSubscribers | function updateSubscribers(req, res, next) {
var updateSubscribersParams = {
_id: req.params.id
};
var subscribers = req.body.subscribers;
logger.debug("Middleware: listSubscribers: ", {params: updateSubscribersParams, subscribers: subscribers});
forms.updateNotifications(_.extend(req.connectionOptions... | javascript | function updateSubscribers(req, res, next) {
var updateSubscribersParams = {
_id: req.params.id
};
var subscribers = req.body.subscribers;
logger.debug("Middleware: listSubscribers: ", {params: updateSubscribersParams, subscribers: subscribers});
forms.updateNotifications(_.extend(req.connectionOptions... | [
"function",
"updateSubscribers",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"updateSubscribersParams",
"=",
"{",
"_id",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"var",
"subscribers",
"=",
"req",
".",
"body",
".",
"subscribers",
";",
"... | Update The Subscribers Associated With A Form
@param req
@param res
@param next | [
"Update",
"The",
"Subscribers",
"Associated",
"With",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L241-L251 | train |
feedhenry/fh-forms | lib/middleware/forms.js | clone | function clone(req, res, next) {
var cloneFormParams = {
_id: req.params.id,
name: req.body.name,
userEmail: req.body.updatedBy
};
logger.debug("Middleware: clone form: ", {params: cloneFormParams});
forms.cloneForm(_.extend(req.connectionOptions, cloneFormParams), formsResultHandlers(constants.re... | javascript | function clone(req, res, next) {
var cloneFormParams = {
_id: req.params.id,
name: req.body.name,
userEmail: req.body.updatedBy
};
logger.debug("Middleware: clone form: ", {params: cloneFormParams});
forms.cloneForm(_.extend(req.connectionOptions, cloneFormParams), formsResultHandlers(constants.re... | [
"function",
"clone",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"cloneFormParams",
"=",
"{",
"_id",
":",
"req",
".",
"params",
".",
"id",
",",
"name",
":",
"req",
".",
"body",
".",
"name",
",",
"userEmail",
":",
"req",
".",
"body",
"."... | Clone An Existing Form
@param req
@param res
@param next | [
"Clone",
"An",
"Existing",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L260-L270 | train |
feedhenry/fh-forms | lib/middleware/forms.js | importForm | function importForm(req, res, next) {
req.appformsResultPayload = req.appformsResultPayload || {};
var formData = (req.appformsResultPayload.data && req.appformsResultPayload.type === constants.resultTypes.formTemplate) ? req.appformsResultPayload.data : undefined ;
var importFormParams = {
form: formData,
... | javascript | function importForm(req, res, next) {
req.appformsResultPayload = req.appformsResultPayload || {};
var formData = (req.appformsResultPayload.data && req.appformsResultPayload.type === constants.resultTypes.formTemplate) ? req.appformsResultPayload.data : undefined ;
var importFormParams = {
form: formData,
... | [
"function",
"importForm",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",
"appformsResultPayload",
"=",
"req",
".",
"appformsResultPayload",
"||",
"{",
"}",
";",
"var",
"formData",
"=",
"(",
"req",
".",
"appformsResultPayload",
".",
"data",
"&&"... | Importing A Form From A Template | [
"Importing",
"A",
"Form",
"From",
"A",
"Template"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L275-L289 | train |
feedhenry/fh-forms | lib/middleware/forms.js | projects | function projects(req, res, next) {
var params = {
"formId": req.params.id
};
logger.debug("Middleware: form projects: ", {params: params});
forms.getFormApps(_.extend(req.connectionOptions, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | javascript | function projects(req, res, next) {
var params = {
"formId": req.params.id
};
logger.debug("Middleware: form projects: ", {params: params});
forms.getFormApps(_.extend(req.connectionOptions, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
} | [
"function",
"projects",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"\"formId\"",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"logger",
".",
"debug",
"(",
"\"Middleware: form projects: \"",
",",
"{",
"params",
":",
"pa... | Get All Projects Associated With A Form
@param req
@param res
@param next | [
"Get",
"All",
"Projects",
"Associated",
"With",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L297-L305 | train |
feedhenry/fh-forms | lib/middleware/forms.js | submissions | function submissions(req, res, next) {
var params = {
formId: req.params.id
};
logger.debug("Middleware: form submissions: ", {params: params});
forms.getSubmissions(req.connectionOptions, params, function(err, getSubmissionResponse) {
if (err) {
logger.error("Middleware: form submissions ", {er... | javascript | function submissions(req, res, next) {
var params = {
formId: req.params.id
};
logger.debug("Middleware: form submissions: ", {params: params});
forms.getSubmissions(req.connectionOptions, params, function(err, getSubmissionResponse) {
if (err) {
logger.error("Middleware: form submissions ", {er... | [
"function",
"submissions",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"params",
"=",
"{",
"formId",
":",
"req",
".",
"params",
".",
"id",
"}",
";",
"logger",
".",
"debug",
"(",
"\"Middleware: form submissions: \"",
",",
"{",
"params",
":",
"... | List All Submissions Associated With A Form
@param req
@param res
@param next | [
"List",
"All",
"Submissions",
"Associated",
"With",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L313-L332 | train |
feedhenry/fh-forms | lib/middleware/forms.js | submitFormData | function submitFormData(req, res, next) {
var submission = req.body || {};
submission.appId = req.params.projectid;
submission.appEnvironment = req.params.environment;
submission.deviceId = submission.deviceId || "Device Unknown";
var submissionParams = {
submission: submission
};
logger.debug("Mid... | javascript | function submitFormData(req, res, next) {
var submission = req.body || {};
submission.appId = req.params.projectid;
submission.appEnvironment = req.params.environment;
submission.deviceId = submission.deviceId || "Device Unknown";
var submissionParams = {
submission: submission
};
logger.debug("Mid... | [
"function",
"submitFormData",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"submission",
"=",
"req",
".",
"body",
"||",
"{",
"}",
";",
"submission",
".",
"appId",
"=",
"req",
".",
"params",
".",
"projectid",
";",
"submission",
".",
"appEnviron... | Make A Submission Against A Form
@param req
@param res
@param next | [
"Make",
"A",
"Submission",
"Against",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/middleware/forms.js#L340-L354 | train |
feedhenry/fh-forms | lib/impl/updateRules.js | createRules | function createRules(rulesToCreate, cb) {
function addRule(ruleToCreate, addRuleCallback) {
var fr = new rulesModel(ruleToCreate);
fr.save(function(err, frdoc) {
if (err) {
return addRuleCallback(err);
}
return addRuleCallback(null, frdoc);
});
}
async.... | javascript | function createRules(rulesToCreate, cb) {
function addRule(ruleToCreate, addRuleCallback) {
var fr = new rulesModel(ruleToCreate);
fr.save(function(err, frdoc) {
if (err) {
return addRuleCallback(err);
}
return addRuleCallback(null, frdoc);
});
}
async.... | [
"function",
"createRules",
"(",
"rulesToCreate",
",",
"cb",
")",
"{",
"function",
"addRule",
"(",
"ruleToCreate",
",",
"addRuleCallback",
")",
"{",
"var",
"fr",
"=",
"new",
"rulesModel",
"(",
"ruleToCreate",
")",
";",
"fr",
".",
"save",
"(",
"function",
"(... | iterate through the form field rules vs the new rules | [
"iterate",
"through",
"the",
"form",
"field",
"rules",
"vs",
"the",
"new",
"rules"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateRules.js#L101-L115 | train |
feedhenry/fh-forms | lib/impl/updateRules.js | updateRules | function updateRules(rulesToUpdate, cb) {
function updateRule(ruleDetails, cb1) {
var id = ruleDetails._id;
rulesModel.findOne({_id: id}, function(err, ruleToUpdate) {
if (err) {
return cb1(err);
}
if (ruleToUpdate === null && !options.createIfNotFound) {
re... | javascript | function updateRules(rulesToUpdate, cb) {
function updateRule(ruleDetails, cb1) {
var id = ruleDetails._id;
rulesModel.findOne({_id: id}, function(err, ruleToUpdate) {
if (err) {
return cb1(err);
}
if (ruleToUpdate === null && !options.createIfNotFound) {
re... | [
"function",
"updateRules",
"(",
"rulesToUpdate",
",",
"cb",
")",
"{",
"function",
"updateRule",
"(",
"ruleDetails",
",",
"cb1",
")",
"{",
"var",
"id",
"=",
"ruleDetails",
".",
"_id",
";",
"rulesModel",
".",
"findOne",
"(",
"{",
"_id",
":",
"id",
"}",
"... | process any updates | [
"process",
"any",
"updates"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateRules.js#L137-L161 | train |
feedhenry/fh-forms | lib/impl/updateRules.js | deleteRules | function deleteRules(rulesToDelete, cb) {
var idsToRemove = _.pluck(rulesToDelete, "_id");
function deleteRule(fieldRuleId, cb1) {
rulesModel.findByIdAndRemove(fieldRuleId, cb1);
}
async.each(idsToRemove, deleteRule, cb);
} | javascript | function deleteRules(rulesToDelete, cb) {
var idsToRemove = _.pluck(rulesToDelete, "_id");
function deleteRule(fieldRuleId, cb1) {
rulesModel.findByIdAndRemove(fieldRuleId, cb1);
}
async.each(idsToRemove, deleteRule, cb);
} | [
"function",
"deleteRules",
"(",
"rulesToDelete",
",",
"cb",
")",
"{",
"var",
"idsToRemove",
"=",
"_",
".",
"pluck",
"(",
"rulesToDelete",
",",
"\"_id\"",
")",
";",
"function",
"deleteRule",
"(",
"fieldRuleId",
",",
"cb1",
")",
"{",
"rulesModel",
".",
"find... | process any deletes | [
"process",
"any",
"deletes"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateRules.js#L164-L171 | train |
ForstaLabs/librelay-node | src/util.js | sleep | async function sleep(seconds) {
let ms = seconds * 1000;
while (ms > _maxTimeout) {
// Support sleeping longer than the javascript max setTimeout...
await new Promise(resolve => setTimeout(resolve, _maxTimeout));
ms -= _maxTimeout;
}
return await new Promise(resolve => setTimeout... | javascript | async function sleep(seconds) {
let ms = seconds * 1000;
while (ms > _maxTimeout) {
// Support sleeping longer than the javascript max setTimeout...
await new Promise(resolve => setTimeout(resolve, _maxTimeout));
ms -= _maxTimeout;
}
return await new Promise(resolve => setTimeout... | [
"async",
"function",
"sleep",
"(",
"seconds",
")",
"{",
"let",
"ms",
"=",
"seconds",
"*",
"1000",
";",
"while",
"(",
"ms",
">",
"_maxTimeout",
")",
"{",
"// Support sleeping longer than the javascript max setTimeout...",
"await",
"new",
"Promise",
"(",
"resolve",
... | `setTimeout` max valid value.
Sleep for N seconds.
@param {number} seconds | [
"setTimeout",
"max",
"valid",
"value",
".",
"Sleep",
"for",
"N",
"seconds",
"."
] | f411c6585772ac67b842767bc7ce23edcbfae4ae | https://github.com/ForstaLabs/librelay-node/blob/f411c6585772ac67b842767bc7ce23edcbfae4ae/src/util.js#L26-L34 | train |
feedhenry/fh-forms | lib/impl/refactorRules.js | isFieldStillValidTarget | function isFieldStillValidTarget(fieldOrPageIdToCheck, pages, cb) {
var fieldExistsInForm = false;
var invalidPages = _.filter(pages, function(page) {
var currentPageId = page._id.toString();
if (currentPageId === fieldOrPageIdToCheck) {
fieldExistsInForm = true;
}
... | javascript | function isFieldStillValidTarget(fieldOrPageIdToCheck, pages, cb) {
var fieldExistsInForm = false;
var invalidPages = _.filter(pages, function(page) {
var currentPageId = page._id.toString();
if (currentPageId === fieldOrPageIdToCheck) {
fieldExistsInForm = true;
}
... | [
"function",
"isFieldStillValidTarget",
"(",
"fieldOrPageIdToCheck",
",",
"pages",
",",
"cb",
")",
"{",
"var",
"fieldExistsInForm",
"=",
"false",
";",
"var",
"invalidPages",
"=",
"_",
".",
"filter",
"(",
"pages",
",",
"function",
"(",
"page",
")",
"{",
"var",... | A field target is not valid if it does not exist in the form or it is an adminOnly field.
@param fieldOrPageIdToCheck
@param pages
@returns {boolean} | [
"A",
"field",
"target",
"is",
"not",
"valid",
"if",
"it",
"does",
"not",
"exist",
"in",
"the",
"form",
"or",
"it",
"is",
"an",
"adminOnly",
"field",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/refactorRules.js#L94-L131 | train |
feedhenry/fh-forms | lib/impl/refactorRules.js | getSourceRepeatingSections | function getSourceRepeatingSections(rule) {
return _.chain(rule.ruleConditionalStatements)
.map(function(ruleConditionalStatement) {
var sourceId = ruleConditionalStatement.sourceField.toString();
return fieldSectionMapping[sourceId];
})
.filter(function(section) {
return s... | javascript | function getSourceRepeatingSections(rule) {
return _.chain(rule.ruleConditionalStatements)
.map(function(ruleConditionalStatement) {
var sourceId = ruleConditionalStatement.sourceField.toString();
return fieldSectionMapping[sourceId];
})
.filter(function(section) {
return s... | [
"function",
"getSourceRepeatingSections",
"(",
"rule",
")",
"{",
"return",
"_",
".",
"chain",
"(",
"rule",
".",
"ruleConditionalStatements",
")",
".",
"map",
"(",
"function",
"(",
"ruleConditionalStatement",
")",
"{",
"var",
"sourceId",
"=",
"ruleConditionalStatem... | Get ids of repeating sections with fields which act as sources in a rule
@param rule
@returns {String[]} | [
"Get",
"ids",
"of",
"repeating",
"sections",
"with",
"fields",
"which",
"act",
"as",
"sources",
"in",
"a",
"rule"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/refactorRules.js#L182-L196 | train |
feedhenry/fh-forms | lib/impl/refactorRules.js | updateFormRules | function updateFormRules(cb) {
//Filters out any conditional statements that are no longer valid.
function filterConditionalStatements(rule) {
return _.filter(rule.ruleConditionalStatements, function(ruleCondStatement) {
var sourceField = ruleCondStatement.sourceField.toString();
if (inv... | javascript | function updateFormRules(cb) {
//Filters out any conditional statements that are no longer valid.
function filterConditionalStatements(rule) {
return _.filter(rule.ruleConditionalStatements, function(ruleCondStatement) {
var sourceField = ruleCondStatement.sourceField.toString();
if (inv... | [
"function",
"updateFormRules",
"(",
"cb",
")",
"{",
"//Filters out any conditional statements that are no longer valid.",
"function",
"filterConditionalStatements",
"(",
"rule",
")",
"{",
"return",
"_",
".",
"filter",
"(",
"rule",
".",
"ruleConditionalStatements",
",",
"f... | Need to delete any rules that are to be deleted | [
"Need",
"to",
"delete",
"any",
"rules",
"that",
"are",
"to",
"be",
"deleted"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/refactorRules.js#L306-L386 | train |
feedhenry/fh-forms | lib/impl/refactorRules.js | filterConditionalStatements | function filterConditionalStatements(rule) {
return _.filter(rule.ruleConditionalStatements, function(ruleCondStatement) {
var sourceField = ruleCondStatement.sourceField.toString();
if (invalidFields[sourceField]) {
/**
* If the user flagged the field in this rule for deleti... | javascript | function filterConditionalStatements(rule) {
return _.filter(rule.ruleConditionalStatements, function(ruleCondStatement) {
var sourceField = ruleCondStatement.sourceField.toString();
if (invalidFields[sourceField]) {
/**
* If the user flagged the field in this rule for deleti... | [
"function",
"filterConditionalStatements",
"(",
"rule",
")",
"{",
"return",
"_",
".",
"filter",
"(",
"rule",
".",
"ruleConditionalStatements",
",",
"function",
"(",
"ruleCondStatement",
")",
"{",
"var",
"sourceField",
"=",
"ruleCondStatement",
".",
"sourceField",
... | Filters out any conditional statements that are no longer valid. | [
"Filters",
"out",
"any",
"conditional",
"statements",
"that",
"are",
"no",
"longer",
"valid",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/refactorRules.js#L309-L325 | train |
cloudfour/drizzle-builder | src/write/collections.js | walkCollections | function walkCollections(patterns, drizzleData, writePromises = []) {
if (hasCollection(patterns)) {
writePromises.push(
writePage(
patterns.collection.id,
patterns.collection,
drizzleData.options.dest.patterns,
drizzleData.options.keys.collections.plural
)
);
}
... | javascript | function walkCollections(patterns, drizzleData, writePromises = []) {
if (hasCollection(patterns)) {
writePromises.push(
writePage(
patterns.collection.id,
patterns.collection,
drizzleData.options.dest.patterns,
drizzleData.options.keys.collections.plural
)
);
}
... | [
"function",
"walkCollections",
"(",
"patterns",
",",
"drizzleData",
",",
"writePromises",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"hasCollection",
"(",
"patterns",
")",
")",
"{",
"writePromises",
".",
"push",
"(",
"writePage",
"(",
"patterns",
".",
"collection",... | Traverse patterns object and write out any collection objects to files.
@param {Object} pages current level of pages tree
@param {Object} drizzleData
@param {Array} writePromises All write promises so far
@return {Array} of Promises | [
"Traverse",
"patterns",
"object",
"and",
"write",
"out",
"any",
"collection",
"objects",
"to",
"files",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/write/collections.js#L15-L32 | train |
cloudfour/drizzle-builder | src/write/collections.js | writeCollections | function writeCollections(drizzleData) {
return Promise.all(walkCollections(drizzleData.patterns, drizzleData)).then(
writePromises => drizzleData,
error => DrizzleError.error(error, drizzleData.options.debug)
);
} | javascript | function writeCollections(drizzleData) {
return Promise.all(walkCollections(drizzleData.patterns, drizzleData)).then(
writePromises => drizzleData,
error => DrizzleError.error(error, drizzleData.options.debug)
);
} | [
"function",
"writeCollections",
"(",
"drizzleData",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"walkCollections",
"(",
"drizzleData",
".",
"patterns",
",",
"drizzleData",
")",
")",
".",
"then",
"(",
"writePromises",
"=>",
"drizzleData",
",",
"error",
"=>"... | Traverse the patterns object and write out collections HTML pages.
@param {Object} drizzleData
@return {Promise} resolving to {Object} drizzleData | [
"Traverse",
"the",
"patterns",
"object",
"and",
"write",
"out",
"collections",
"HTML",
"pages",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/write/collections.js#L40-L45 | train |
back4app/back4app-entity | src/back/models/attributes/AttributeDictionary.js | AttributeDictionary | function AttributeDictionary(attributes) {
expect(arguments).to.have.length.below(
2,
'Invalid arguments length when creating an AttributeDictionary (it has ' +
'to be passed less than 2 arguments)'
);
if (attributes) {
expect(typeof attributes).to.equal(
'object',
'Invalid argument t... | javascript | function AttributeDictionary(attributes) {
expect(arguments).to.have.length.below(
2,
'Invalid arguments length when creating an AttributeDictionary (it has ' +
'to be passed less than 2 arguments)'
);
if (attributes) {
expect(typeof attributes).to.equal(
'object',
'Invalid argument t... | [
"function",
"AttributeDictionary",
"(",
"attributes",
")",
"{",
"expect",
"(",
"arguments",
")",
".",
"to",
".",
"have",
".",
"length",
".",
"below",
"(",
"2",
",",
"'Invalid arguments length when creating an AttributeDictionary (it has '",
"+",
"'to be passed less than... | Dictionary of Entity Attributes.
@constructor
@memberof module:back4app-entity/models/attributes
@param {?(module:back4app-entity/models/attributes.Attribute[]|
Object.<!string, !(module:back4app-entity/models/attributes.Attribute|
Object)>)}
[attributes] The attributes to be added in the dictionary. They can be given
... | [
"Dictionary",
"of",
"Entity",
"Attributes",
"."
] | 16a15284d2e119508fcb4e0c88f647ffb285d2e9 | https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/attributes/AttributeDictionary.js#L34-L61 | train |
back4app/back4app-entity | src/back/models/attributes/AttributeDictionary.js | _addAttribute | function _addAttribute() {
var attributeDictionary = arguments[0];
var attribute = null;
var name = null;
if (arguments.length === 2) {
attribute = arguments[1];
} else {
attribute = arguments[1];
name = arguments[2];
}
expect(attribute).to.be.an(
'object',
'Invalid argument type wh... | javascript | function _addAttribute() {
var attributeDictionary = arguments[0];
var attribute = null;
var name = null;
if (arguments.length === 2) {
attribute = arguments[1];
} else {
attribute = arguments[1];
name = arguments[2];
}
expect(attribute).to.be.an(
'object',
'Invalid argument type wh... | [
"function",
"_addAttribute",
"(",
")",
"{",
"var",
"attributeDictionary",
"=",
"arguments",
"[",
"0",
"]",
";",
"var",
"attribute",
"=",
"null",
";",
"var",
"name",
"=",
"null",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"2",
")",
"{",
"attribu... | Adds a new attribute to the dictionary.
@name
module:back4app-entity/models/attributes.AttributeDictionary~_addAttribute
@function
@param {!module:back4app-entity/models/attributes.AttributeDictionary}
attributeDictionary It is the attribute dictionary to which the attribute
will be added.
@param {!module:back4app-enti... | [
"Adds",
"a",
"new",
"attribute",
"to",
"the",
"dictionary",
"."
] | 16a15284d2e119508fcb4e0c88f647ffb285d2e9 | https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/attributes/AttributeDictionary.js#L113-L167 | train |
back4app/back4app-entity | src/back/models/attributes/AttributeDictionary.js | concat | function concat(attributeDictionary, attribute) {
expect(arguments).to.have.length(
2,
'Invalid arguments length when concatenating an AttributeDictionary (it ' +
'has to be passed 2 arguments)'
);
expect(attributeDictionary).to.be.instanceof(
AttributeDictionary,
'Invalid argument "attribute... | javascript | function concat(attributeDictionary, attribute) {
expect(arguments).to.have.length(
2,
'Invalid arguments length when concatenating an AttributeDictionary (it ' +
'has to be passed 2 arguments)'
);
expect(attributeDictionary).to.be.instanceof(
AttributeDictionary,
'Invalid argument "attribute... | [
"function",
"concat",
"(",
"attributeDictionary",
",",
"attribute",
")",
"{",
"expect",
"(",
"arguments",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
",",
"'Invalid arguments length when concatenating an AttributeDictionary (it '",
"+",
"'has to be passed 2 ar... | Concatenates an AttributeDictionary instance with an Attribute instance and
returns a new AttributeDictionary.
@name module:back4app-entity/models/attributes.AttributeDictionary.concat
@function
@param {!module:back4app-entity/models/attributes.AttributeDictionary}
attributeDictionary The AttributeDictionary to be conc... | [
"Concatenates",
"an",
"AttributeDictionary",
"instance",
"with",
"an",
"Attribute",
"instance",
"and",
"returns",
"a",
"new",
"AttributeDictionary",
"."
] | 16a15284d2e119508fcb4e0c88f647ffb285d2e9 | https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/models/attributes/AttributeDictionary.js#L186-L214 | train |
feedhenry/fh-forms | lib/impl/dataTargets.js | get | function get(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_TARGET_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Get A Data Target"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params._id)) {
re... | javascript | function get(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_TARGET_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Get A Data Target"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params._id)) {
re... | [
"function",
"get",
"(",
"connections",
",",
"params",
",",
"cb",
")",
"{",
"var",
"failed",
"=",
"validate",
"(",
"params",
")",
".",
"has",
"(",
"CONSTANTS",
".",
"DATA_TARGET_ID",
")",
";",
"if",
"(",
"failed",
")",
"{",
"return",
"cb",
"(",
"build... | Get A Specific Data Target Definition
@param connections
@param params
@param cb | [
"Get",
"A",
"Specific",
"Data",
"Target",
"Definition"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataTargets.js#L77-L126 | train |
feedhenry/fh-forms | lib/impl/dataTargets.js | remove | function remove(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_TARGET_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Target"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params._id)) {
... | javascript | function remove(connections, params, cb) {
var failed = validate(params).has(CONSTANTS.DATA_TARGET_ID);
if (failed) {
return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Target"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
}
if (!misc.checkId(params._id)) {
... | [
"function",
"remove",
"(",
"connections",
",",
"params",
",",
"cb",
")",
"{",
"var",
"failed",
"=",
"validate",
"(",
"params",
")",
".",
"has",
"(",
"CONSTANTS",
".",
"DATA_TARGET_ID",
")",
";",
"if",
"(",
"failed",
")",
"{",
"return",
"cb",
"(",
"bu... | Removing A Data Target
@param connections
@param params
@param cb | [
"Removing",
"A",
"Data",
"Target"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataTargets.js#L135-L181 | train |
feedhenry/fh-forms | lib/impl/dataTargets.js | list | function list(connections, params, cb) {
async.waterfall([
function findDataTargets(cb) {
lookUpDataTargets(connections, {
query: {},
lean: true
}, function(err, dataTargets) {
if (err) {
return cb(buildErrorResponse({
error: err,
userDetail: "... | javascript | function list(connections, params, cb) {
async.waterfall([
function findDataTargets(cb) {
lookUpDataTargets(connections, {
query: {},
lean: true
}, function(err, dataTargets) {
if (err) {
return cb(buildErrorResponse({
error: err,
userDetail: "... | [
"function",
"list",
"(",
"connections",
",",
"params",
",",
"cb",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"function",
"findDataTargets",
"(",
"cb",
")",
"{",
"lookUpDataTargets",
"(",
"connections",
",",
"{",
"query",
":",
"{",
"}",
",",
"lean",
... | Listing All Data Targets. In The Environment, this will include the current cache data.
@param connections
@param params
@param cb | [
"Listing",
"All",
"Data",
"Targets",
".",
"In",
"The",
"Environment",
"this",
"will",
"include",
"the",
"current",
"cache",
"data",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataTargets.js#L189-L208 | train |
feedhenry/fh-forms | lib/impl/dataTargets.js | create | function create(connections, dataTarget, cb) {
async.waterfall([
function validateParams(cb) {
validate(dataTarget).hasno(CONSTANTS.DATA_TARGET_ID, function(err) {
if (err) {
return cb(buildErrorResponse({error: new Error("Data Target ID Should Not Be Included When Creating A Data Target")... | javascript | function create(connections, dataTarget, cb) {
async.waterfall([
function validateParams(cb) {
validate(dataTarget).hasno(CONSTANTS.DATA_TARGET_ID, function(err) {
if (err) {
return cb(buildErrorResponse({error: new Error("Data Target ID Should Not Be Included When Creating A Data Target")... | [
"function",
"create",
"(",
"connections",
",",
"dataTarget",
",",
"cb",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"function",
"validateParams",
"(",
"cb",
")",
"{",
"validate",
"(",
"dataTarget",
")",
".",
"hasno",
"(",
"CONSTANTS",
".",
"DATA_TARGET_... | Creating A New Data Target
@param connections
@param dataTarget
@param cb | [
"Creating",
"A",
"New",
"Data",
"Target"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataTargets.js#L296-L328 | train |
feedhenry/fh-forms | lib/impl/dataTargets.js | validateDataTarget | function validateDataTarget(connections, dataTarget, cb) {
var DataTarget = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_TARGET);
var testDataTarget = new DataTarget(dataTarget);
//Validating Without Saving
testDataTarget.validate(function(err) {
if (err) {
return cb(buildErrorRes... | javascript | function validateDataTarget(connections, dataTarget, cb) {
var DataTarget = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_TARGET);
var testDataTarget = new DataTarget(dataTarget);
//Validating Without Saving
testDataTarget.validate(function(err) {
if (err) {
return cb(buildErrorRes... | [
"function",
"validateDataTarget",
"(",
"connections",
",",
"dataTarget",
",",
"cb",
")",
"{",
"var",
"DataTarget",
"=",
"models",
".",
"get",
"(",
"connections",
".",
"mongooseConnection",
",",
"models",
".",
"MODELNAMES",
".",
"DATA_TARGET",
")",
";",
"var",
... | Validating A Data Target Object.
@param connections
@param dataTarget
@param cb | [
"Validating",
"A",
"Data",
"Target",
"Object",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataTargets.js#L336-L352 | train |
makeup-js/makeup-screenreader-trap | src/util.js | getSiblings | function getSiblings(el) {
const allSiblings = getPreviousSiblings(el).concat(getNextSiblings(el));
return allSiblings.filter(filterSibling);
} | javascript | function getSiblings(el) {
const allSiblings = getPreviousSiblings(el).concat(getNextSiblings(el));
return allSiblings.filter(filterSibling);
} | [
"function",
"getSiblings",
"(",
"el",
")",
"{",
"const",
"allSiblings",
"=",
"getPreviousSiblings",
"(",
"el",
")",
".",
"concat",
"(",
"getNextSiblings",
"(",
"el",
")",
")",
";",
"return",
"allSiblings",
".",
"filter",
"(",
"filterSibling",
")",
";",
"}"... | returns all sibling element nodes of given element | [
"returns",
"all",
"sibling",
"element",
"nodes",
"of",
"given",
"element"
] | 4ce73c000f66194028d9992ee000c7c50b242148 | https://github.com/makeup-js/makeup-screenreader-trap/blob/4ce73c000f66194028d9992ee000c7c50b242148/src/util.js#L41-L45 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | validatefieldCodes | function validatefieldCodes() {
//Flag for finding a duplicate field code
var duplicateFieldCode = false;
var invalidFieldCode = false;
var fieldCodes = {};
formData.pages = _.map(formData.pages, function(page) {
page.fields = _.map(page.fields, function(field) {
var fieldCode = field... | javascript | function validatefieldCodes() {
//Flag for finding a duplicate field code
var duplicateFieldCode = false;
var invalidFieldCode = false;
var fieldCodes = {};
formData.pages = _.map(formData.pages, function(page) {
page.fields = _.map(page.fields, function(field) {
var fieldCode = field... | [
"function",
"validatefieldCodes",
"(",
")",
"{",
"//Flag for finding a duplicate field code",
"var",
"duplicateFieldCode",
"=",
"false",
";",
"var",
"invalidFieldCode",
"=",
"false",
";",
"var",
"fieldCodes",
"=",
"{",
"}",
";",
"formData",
".",
"pages",
"=",
"_",... | User Field codes must be unique within a form.
All field codes must have a length > 0, otherwise don't save the form.
No asynchronous functionality in this function.
@param cb | [
"User",
"Field",
"codes",
"must",
"be",
"unique",
"within",
"a",
"form",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L82-L130 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | validateDuplicateName | function validateDuplicateName(cb) {
var formId = formData._id;
var formName = formData.name;
if (!formName) {
return cb(new Error("No form name passed"));
}
var query = {};
//If there is a form id, then the query to the form model must exclude the current form id that is being updated.... | javascript | function validateDuplicateName(cb) {
var formId = formData._id;
var formName = formData.name;
if (!formName) {
return cb(new Error("No form name passed"));
}
var query = {};
//If there is a form id, then the query to the form model must exclude the current form id that is being updated.... | [
"function",
"validateDuplicateName",
"(",
"cb",
")",
"{",
"var",
"formId",
"=",
"formData",
".",
"_id",
";",
"var",
"formName",
"=",
"formData",
".",
"name",
";",
"if",
"(",
"!",
"formName",
")",
"{",
"return",
"cb",
"(",
"new",
"Error",
"(",
"\"No for... | Validating form duplicate names. | [
"Validating",
"form",
"duplicate",
"names",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L135-L166 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | getFormDataSources | function getFormDataSources(formJSON) {
var dataSources;
var pages = formJSON.pages || [];
dataSources = _.map(pages, function(page) {
var fields = page.fields || [];
fields = _.map(fields, function(field) {
//If the field is defined as a Data Source field, and it has a data source, the... | javascript | function getFormDataSources(formJSON) {
var dataSources;
var pages = formJSON.pages || [];
dataSources = _.map(pages, function(page) {
var fields = page.fields || [];
fields = _.map(fields, function(field) {
//If the field is defined as a Data Source field, and it has a data source, the... | [
"function",
"getFormDataSources",
"(",
"formJSON",
")",
"{",
"var",
"dataSources",
";",
"var",
"pages",
"=",
"formJSON",
".",
"pages",
"||",
"[",
"]",
";",
"dataSources",
"=",
"_",
".",
"map",
"(",
"pages",
",",
"function",
"(",
"page",
")",
"{",
"var"... | Extracting any data sources that are contained in any field in the forms.
Will only return unique entries
@param formJSON -- JSON Definition Of The Form | [
"Extracting",
"any",
"data",
"sources",
"that",
"are",
"contained",
"in",
"any",
"field",
"in",
"the",
"forms",
".",
"Will",
"only",
"return",
"unique",
"entries"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L173-L199 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | findMatchingDocuments | function findMatchingDocuments(type, documentIDs, modelToSearch, cb) {
var errorTextDataType = type === models.MODELNAMES.DATA_SOURCE ? "Data Sources" : "Data Targets";
//If the form contains no data sources, then no need to verify
if (documentIDs.length === 0) {
return cb(undefined, []);
}
... | javascript | function findMatchingDocuments(type, documentIDs, modelToSearch, cb) {
var errorTextDataType = type === models.MODELNAMES.DATA_SOURCE ? "Data Sources" : "Data Targets";
//If the form contains no data sources, then no need to verify
if (documentIDs.length === 0) {
return cb(undefined, []);
}
... | [
"function",
"findMatchingDocuments",
"(",
"type",
",",
"documentIDs",
",",
"modelToSearch",
",",
"cb",
")",
"{",
"var",
"errorTextDataType",
"=",
"type",
"===",
"models",
".",
"MODELNAMES",
".",
"DATA_SOURCE",
"?",
"\"Data Sources\"",
":",
"\"Data Targets\"",
";",... | Finding Matching Documents
@param type - Data Source or Data Target
@param documentIDs - Array Of Document IDs
@param modelToSearch - Model to search on
@param cb | [
"Finding",
"Matching",
"Documents"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L208-L283 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | verifyDataSources | function verifyDataSources(formDataSourceIds, cb) {
findMatchingDocuments(models.MODELNAMES.DATA_SOURCE, formDataSourceIds, dataSourceModel, cb);
} | javascript | function verifyDataSources(formDataSourceIds, cb) {
findMatchingDocuments(models.MODELNAMES.DATA_SOURCE, formDataSourceIds, dataSourceModel, cb);
} | [
"function",
"verifyDataSources",
"(",
"formDataSourceIds",
",",
"cb",
")",
"{",
"findMatchingDocuments",
"(",
"models",
".",
"MODELNAMES",
".",
"DATA_SOURCE",
",",
"formDataSourceIds",
",",
"dataSourceModel",
",",
"cb",
")",
";",
"}"
] | Function To Verify All Data Sources Attached To A Form.
@param formDataSourceIds -- Array Of Data Source IDs Attached To Verify | [
"Function",
"To",
"Verify",
"All",
"Data",
"Sources",
"Attached",
"To",
"A",
"Form",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L289-L291 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | verifyDataTargets | function verifyDataTargets(dataTargetIds, cb) {
findMatchingDocuments(models.MODELNAMES.DATA_TARGET, dataTargetIds, dataTargetModel, cb);
} | javascript | function verifyDataTargets(dataTargetIds, cb) {
findMatchingDocuments(models.MODELNAMES.DATA_TARGET, dataTargetIds, dataTargetModel, cb);
} | [
"function",
"verifyDataTargets",
"(",
"dataTargetIds",
",",
"cb",
")",
"{",
"findMatchingDocuments",
"(",
"models",
".",
"MODELNAMES",
".",
"DATA_TARGET",
",",
"dataTargetIds",
",",
"dataTargetModel",
",",
"cb",
")",
";",
"}"
] | Verifying All Data Targets Associated With A Form
@param dataTargetIds
@param cb | [
"Verifying",
"All",
"Data",
"Targets",
"Associated",
"With",
"A",
"Form"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L298-L300 | train |
feedhenry/fh-forms | lib/impl/updateForm.js | verifyFormDataSourcesAndTargets | function verifyFormDataSourcesAndTargets(formData, cb) {
var formDataSourceIds = getFormDataSources(formData);
var dataTargets = formData.dataTargets || [];
async.series({
dataSources : function(cb) {
verifyDataSources(formDataSourceIds, cb);
},
dataTargets: function(cb) {
... | javascript | function verifyFormDataSourcesAndTargets(formData, cb) {
var formDataSourceIds = getFormDataSources(formData);
var dataTargets = formData.dataTargets || [];
async.series({
dataSources : function(cb) {
verifyDataSources(formDataSourceIds, cb);
},
dataTargets: function(cb) {
... | [
"function",
"verifyFormDataSourcesAndTargets",
"(",
"formData",
",",
"cb",
")",
"{",
"var",
"formDataSourceIds",
"=",
"getFormDataSources",
"(",
"formData",
")",
";",
"var",
"dataTargets",
"=",
"formData",
".",
"dataTargets",
"||",
"[",
"]",
";",
"async",
".",
... | Verifying the presence of all Data Sources and Data Targets associated with the form. | [
"Verifying",
"the",
"presence",
"of",
"all",
"Data",
"Sources",
"and",
"Data",
"Targets",
"associated",
"with",
"the",
"form",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/updateForm.js#L303-L315 | train |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | WebService | function WebService(options) {
this.options = opts(this, options);
if(!this.options.apiroot) this.options.apiroot = "https://api.cloudmine.io";
var src = this.options.appid;
if (options.savelogin) {
if (!this.options.email) this.options.email = retrieve('email', src);
if (!this.options.user... | javascript | function WebService(options) {
this.options = opts(this, options);
if(!this.options.apiroot) this.options.apiroot = "https://api.cloudmine.io";
var src = this.options.appid;
if (options.savelogin) {
if (!this.options.email) this.options.email = retrieve('email', src);
if (!this.options.user... | [
"function",
"WebService",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"if",
"(",
"!",
"this",
".",
"options",
".",
"apiroot",
")",
"this",
".",
"options",
".",
"apiroot",
"=",
"\"https://api.clo... | Construct a new WebService instance
<p>Each method on the WebService instance will return an APICall object which may be used to
access the results of the method called. You can chain multiple events together with the
returned object (an APICall instance).
<p>All events are at least guaranteed to have the callback si... | [
"Construct",
"a",
"new",
"WebService",
"instance"
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L57-L69 | train |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(snippet, parameters, options) {
options = opts(this, options);
parameters = merge({}, options.params, parameters);
options.params = null;
options.snippet = null;
var call_opts = {
action: 'run/' + snippet,
type: options.method || 'GET',
options: options
... | javascript | function(snippet, parameters, options) {
options = opts(this, options);
parameters = merge({}, options.params, parameters);
options.params = null;
options.snippet = null;
var call_opts = {
action: 'run/' + snippet,
type: options.method || 'GET',
options: options
... | [
"function",
"(",
"snippet",
",",
"parameters",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"parameters",
"=",
"merge",
"(",
"{",
"}",
",",
"options",
".",
"params",
",",
"parameters",
")",
";",
"options",
... | Run a code snippet directly.
Default http method is 'GET', to change the method set the method option for options.
@param {string} snippet The name of the code snippet to run.
@param {object} params Data to send to the code snippet (optional).
@param {object} [options] Override defaults set on WebService. See WebServic... | [
"Run",
"a",
"code",
"snippet",
"directly",
".",
"Default",
"http",
"method",
"is",
"GET",
"to",
"change",
"the",
"method",
"set",
"the",
"method",
"option",
"for",
"options",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L254-L273 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(notification, options) {
options = opts(this, options);
return new APICall({
action: 'push',
type: 'POST',
query: server_params(options),
options: options,
data: JSON.stringify(notification)
});
} | javascript | function(notification, options) {
options = opts(this, options);
return new APICall({
action: 'push',
type: 'POST',
query: server_params(options),
options: options,
data: JSON.stringify(notification)
});
} | [
"function",
"(",
"notification",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"return",
"new",
"APICall",
"(",
"{",
"action",
":",
"'push'",
",",
"type",
":",
"'POST'",
",",
"query",
":",
"server_params",
"("... | Sends a push notification to your users.
This requires an API key with push permission.
@param {object} [notification] A notification object. This object can have one or more fields for dispatching the notification.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters... | [
"Sends",
"a",
"push",
"notification",
"to",
"your",
"users",
".",
"This",
"requires",
"an",
"API",
"key",
"with",
"push",
"permission",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L420-L429 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(id, options) {
options = opts(this, options);
return new APICall({
action: 'account/' + id,
type: 'GET',
query: server_params(options),
options: options
});
} | javascript | function(id, options) {
options = opts(this, options);
return new APICall({
action: 'account/' + id,
type: 'GET',
query: server_params(options),
options: options
});
} | [
"function",
"(",
"id",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"return",
"new",
"APICall",
"(",
"{",
"action",
":",
"'account/'",
"+",
"id",
",",
"type",
":",
"'GET'",
",",
"query",
":",
"server_params... | Get specific user by id.
@param {string} id User id being requested.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
Results may be affected by defaults and/or by the options parameter.
@return {APICall} An APICall instance for the web service request used to at... | [
"Get",
"specific",
"user",
"by",
"id",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L439-L447 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(key, file, options) {
options = opts(this, options);
if (!key) key = this.keygen();
if (!options.filename) options.filename = key;
// Warning: may not necessarily use ajax to perform upload.
var apicall = new APICall({
action: 'binary/' + key,
type: 'post',
... | javascript | function(key, file, options) {
options = opts(this, options);
if (!key) key = this.keygen();
if (!options.filename) options.filename = key;
// Warning: may not necessarily use ajax to perform upload.
var apicall = new APICall({
action: 'binary/' + key,
type: 'post',
... | [
"function",
"(",
"key",
",",
"file",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"if",
"(",
"!",
"key",
")",
"key",
"=",
"this",
".",
"keygen",
"(",
")",
";",
"if",
"(",
"!",
"options",
".",
"filenam... | Upload a file stored in CloudMine.
@param {string} key The binary file's object key.
@param {file|string} file FileAPI: A HTML5 FileAPI File object, Node.js: The filename to upload.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
@return {APICall} An APICall ins... | [
"Upload",
"a",
"file",
"stored",
"in",
"CloudMine",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L509-L572 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(key, options) {
options = opts(this, options);
var response = {success: {}}, query;
if (options.filename) {
query = {
force_download: true,
apikey: options.apikey,
session_token: options.session_token,
filename: options.filename
}
... | javascript | function(key, options) {
options = opts(this, options);
var response = {success: {}}, query;
if (options.filename) {
query = {
force_download: true,
apikey: options.apikey,
session_token: options.session_token,
filename: options.filename
}
... | [
"function",
"(",
"key",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"var",
"response",
"=",
"{",
"success",
":",
"{",
"}",
"}",
",",
"query",
";",
"if",
"(",
"options",
".",
"filename",
")",
"{",
"quer... | Download a file stored in CloudMine.
@param {string} key The binary file's object key.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
@config {string} [filename] If present, the file will be downloaded directly to the computer with the
filename given. This does... | [
"Download",
"a",
"file",
"stored",
"in",
"CloudMine",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L584-L655 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(user_id, profile, options) {
options = opts(this, options);
return new APICall({
action: 'account/' + user_id,
type: 'POST',
options: options,
query: server_params(options),
data: JSON.stringify(profile)
});
... | javascript | function(user_id, profile, options) {
options = opts(this, options);
return new APICall({
action: 'account/' + user_id,
type: 'POST',
options: options,
query: server_params(options),
data: JSON.stringify(profile)
});
... | [
"function",
"(",
"user_id",
",",
"profile",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"return",
"new",
"APICall",
"(",
"{",
"action",
":",
"'account/'",
"+",
"user_id",
",",
"type",
":",
"'POST'",
",",
"... | Update a user object without having a session token. Requires the use of the master key
@param {string} user_id the user id of the user to update.
@param {object} profile a JSON object representing the profile
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters. | [
"Update",
"a",
"user",
"object",
"without",
"having",
"a",
"session",
"token",
".",
"Requires",
"the",
"use",
"of",
"the",
"master",
"key"
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L751-L760 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(user_id, password, options) {
options = opts(this, options);
var payload = JSON.stringify({
password: password
});
return new APICall({
action: 'account/' + user_id + '/password/change',
type: 'POST',
options: options,
processResponse: APICall.b... | javascript | function(user_id, password, options) {
options = opts(this, options);
var payload = JSON.stringify({
password: password
});
return new APICall({
action: 'account/' + user_id + '/password/change',
type: 'POST',
options: options,
processResponse: APICall.b... | [
"function",
"(",
"user_id",
",",
"password",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"var",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"{",
"password",
":",
"password",
"}",
")",
";",
"return",
"ne... | Update a user password without having a session token. Requires the use of the master key
@param {string} user_id The id of the user to change the password.
@param {string} password The new password for the user.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
@... | [
"Update",
"a",
"user",
"password",
"without",
"having",
"a",
"session",
"token",
".",
"Requires",
"the",
"use",
"of",
"the",
"master",
"key"
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L832-L846 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(email, options) {
options = opts(this, options);
options.applevel = true;
var payload = JSON.stringify({
email: email
});
return new APICall({
action: 'account/password/reset',
type: 'POST',
options: options,
processResponse: APICall.basicR... | javascript | function(email, options) {
options = opts(this, options);
options.applevel = true;
var payload = JSON.stringify({
email: email
});
return new APICall({
action: 'account/password/reset',
type: 'POST',
options: options,
processResponse: APICall.basicR... | [
"function",
"(",
"email",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"options",
".",
"applevel",
"=",
"true",
";",
"var",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"{",
"email",
":",
"email",
"}",
... | Initiate a password reset request.
@param {string} email The email to send a reset password email to.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
@return {APICall} An APICall instance for the web service request used to attach events. | [
"Initiate",
"a",
"password",
"reset",
"request",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L889-L903 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(token, newPassword, options) {
options = opts(this, options);
options.applevel = true;
var payload = JSON.stringify({
password: newPassword
});
return new APICall({
action: "account/password/reset/" + token,
type: 'POST',
data: payload,
pro... | javascript | function(token, newPassword, options) {
options = opts(this, options);
options.applevel = true;
var payload = JSON.stringify({
password: newPassword
});
return new APICall({
action: "account/password/reset/" + token,
type: 'POST',
data: payload,
pro... | [
"function",
"(",
"token",
",",
"newPassword",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"options",
".",
"applevel",
"=",
"true",
";",
"var",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"{",
"password",
... | Change the password for an account from the token received from password reset.
@param {string} token The token for password reset. Usually received by email.
@param {string} newPassword The password to assign to the user.
@param {object} [options] Override defaults set on WebService. See WebService constructor for par... | [
"Change",
"the",
"password",
"for",
"an",
"account",
"from",
"the",
"token",
"received",
"from",
"password",
"reset",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L912-L926 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(query, options) {
options = opts(this, options);
if(!options.session_token) throw new Error("Must be logged in to perform a social query");
if(query.headers && !isObject(query.headers)) throw new Error("Headers must be an object");
if(query.params && !isObject(query.params)) throw new ... | javascript | function(query, options) {
options = opts(this, options);
if(!options.session_token) throw new Error("Must be logged in to perform a social query");
if(query.headers && !isObject(query.headers)) throw new Error("Headers must be an object");
if(query.params && !isObject(query.params)) throw new ... | [
"function",
"(",
"query",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"if",
"(",
"!",
"options",
".",
"session_token",
")",
"throw",
"new",
"Error",
"(",
"\"Must be logged in to perform a social query\"",
")",
";"... | Query a social network.
Must be logged in as a user who has logged in to a social network.
@param {object} query An object with the parameters of the query.
@config {string} query.network A network to authenticate against. @see WebService.SocialNetworks
@config {string} query.endpoint The endpoint to hit, on the social... | [
"Query",
"a",
"social",
"network",
".",
"Must",
"be",
"logged",
"in",
"as",
"a",
"user",
"who",
"has",
"logged",
"in",
"to",
"a",
"social",
"network",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1077-L1101 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(auth, password, options) {
if (isObject(auth)) options = password;
else auth = {email: auth, password: password}
options = opts(this, options);
options.applevel = true;
var config = {
action: 'account',
type: 'DELETE',
options: options,
processResp... | javascript | function(auth, password, options) {
if (isObject(auth)) options = password;
else auth = {email: auth, password: password}
options = opts(this, options);
options.applevel = true;
var config = {
action: 'account',
type: 'DELETE',
options: options,
processResp... | [
"function",
"(",
"auth",
",",
"password",
",",
"options",
")",
"{",
"if",
"(",
"isObject",
"(",
"auth",
")",
")",
"options",
"=",
"password",
";",
"else",
"auth",
"=",
"{",
"email",
":",
"auth",
",",
"password",
":",
"password",
"}",
"options",
"=",
... | Delete a user.
If you are using the master api key, omit the user password to delete the user.
If you are not using the master api key, provide the user name and password in the corresponding
email and password fields.
@param {object} data An object that may contain email / username fields and optionally a password fi... | [
"Delete",
"a",
"user",
".",
"If",
"you",
"are",
"using",
"the",
"master",
"api",
"key",
"omit",
"the",
"user",
"password",
"to",
"delete",
"the",
"user",
".",
"If",
"you",
"are",
"not",
"using",
"the",
"master",
"api",
"key",
"provide",
"the",
"user",
... | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1199-L1237 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(aclid, options){
options = opts(this, options);
return new APICall({
action: 'access/' + aclid,
type: 'DELETE',
processResponse: APICall.basicResponse,
options: options
});
} | javascript | function(aclid, options){
options = opts(this, options);
return new APICall({
action: 'access/' + aclid,
type: 'DELETE',
processResponse: APICall.basicResponse,
options: options
});
} | [
"function",
"(",
"aclid",
",",
"options",
")",
"{",
"options",
"=",
"opts",
"(",
"this",
",",
"options",
")",
";",
"return",
"new",
"APICall",
"(",
"{",
"action",
":",
"'access/'",
"+",
"aclid",
",",
"type",
":",
"'DELETE'",
",",
"processResponse",
":"... | Deletes an ACL via id.
@param {string} aclid The ACL id value to be deleted.
@param {object} [options] Override defaults set on WebService. See WebService constructor for parameters.
@return {APICall} An APICall instance for the web service request used to attach events.
@function
@name deleteACL
@memberOf WebServic... | [
"Deletes",
"an",
"ACL",
"via",
"id",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1285-L1294 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function() {
if (this.options.applevel === true || this.options.applevel === false) return this.options.applevel;
return this.options.session_token == null;
} | javascript | function() {
if (this.options.applevel === true || this.options.applevel === false) return this.options.applevel;
return this.options.session_token == null;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"applevel",
"===",
"true",
"||",
"this",
".",
"options",
".",
"applevel",
"===",
"false",
")",
"return",
"this",
".",
"options",
".",
"applevel",
";",
"return",
"this",
".",
"options",
... | Determine if this store is using application data.
@return {boolean} true if this store is using application data, false if is using user-level data. | [
"Determine",
"if",
"this",
"store",
"is",
"using",
"application",
"data",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1395-L1398 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(eventType, callback, context) {
if (isFunction(callback)) {
context = context || this;
if (!this._events[eventType]) this._events[eventType] = [];
// normal callback not called.
var self = this;
this._events[eventType].push([callback, context, function() {
... | javascript | function(eventType, callback, context) {
if (isFunction(callback)) {
context = context || this;
if (!this._events[eventType]) this._events[eventType] = [];
// normal callback not called.
var self = this;
this._events[eventType].push([callback, context, function() {
... | [
"function",
"(",
"eventType",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"isFunction",
"(",
"callback",
")",
")",
"{",
"context",
"=",
"context",
"||",
"this",
";",
"if",
"(",
"!",
"this",
".",
"_events",
"[",
"eventType",
"]",
")",
"this"... | Attach an event listener to this APICall object.
@param {string|number} eventType The event to listen to. Can be an http code as number or string,
success, meta, result, error.
@param {function} callback Callback to call upon event trigger.
@param {object} context Context to call the callback in.
@return {APICall} The ... | [
"Attach",
"an",
"event",
"listener",
"to",
"this",
"APICall",
"object",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1602-L1615 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(event/*, arg1...*/) {
var events = this._events[event];
if (events != null) {
var args = slice(arguments, 1);
each(events, function(event) {
event[2].apply(event[1], args);
});
}
return this;
} | javascript | function(event/*, arg1...*/) {
var events = this._events[event];
if (events != null) {
var args = slice(arguments, 1);
each(events, function(event) {
event[2].apply(event[1], args);
});
}
return this;
} | [
"function",
"(",
"event",
"/*, arg1...*/",
")",
"{",
"var",
"events",
"=",
"this",
".",
"_events",
"[",
"event",
"]",
";",
"if",
"(",
"events",
"!=",
"null",
")",
"{",
"var",
"args",
"=",
"slice",
"(",
"arguments",
",",
"1",
")",
";",
"each",
"(",
... | Trigger an event on this APICall object. This will call all event handlers in order.
All parameters following event will be sent to the event handlers.
@param {string|number} event The event to trigger.
@return {APICall} The current APICall object | [
"Trigger",
"an",
"event",
"on",
"this",
"APICall",
"object",
".",
"This",
"will",
"call",
"all",
"event",
"handlers",
"in",
"order",
".",
"All",
"parameters",
"following",
"event",
"will",
"be",
"sent",
"to",
"the",
"event",
"handlers",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1623-L1633 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function(eventType, callback, context) {
if (eventType == null && callback == null && context == null) {
this._events = {};
} else if (eventType == null) {
each(this._events, function(value, key, collection) {
collection._events[key] = removeCallbacks(value, callback, context);
... | javascript | function(eventType, callback, context) {
if (eventType == null && callback == null && context == null) {
this._events = {};
} else if (eventType == null) {
each(this._events, function(value, key, collection) {
collection._events[key] = removeCallbacks(value, callback, context);
... | [
"function",
"(",
"eventType",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"eventType",
"==",
"null",
"&&",
"callback",
"==",
"null",
"&&",
"context",
"==",
"null",
")",
"{",
"this",
".",
"_events",
"=",
"{",
"}",
";",
"}",
"else",
"if",
"... | Remove event handlers.
Event handlers will be removed based on the parameters given. If no parameters are given, all
event handlers will be removed.
@param {string|number} eventType The event type which can be an http code as number or string,
or can be success, error, meta, result, abort.
@param {function} callback Th... | [
"Remove",
"event",
"handlers",
".",
"Event",
"handlers",
"will",
"be",
"removed",
"based",
"on",
"the",
"parameters",
"given",
".",
"If",
"no",
"parameters",
"are",
"given",
"all",
"event",
"handlers",
"will",
"be",
"removed",
"."
] | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1645-L1656 | train | |
cloudmine/CloudMineSDK-JavaScript | js/cloudmine.js | function() {
if (this.xhr) {
this.xhr.abort();
} else if (this.config) {
this.config.complete.call(this, this.xhr, 'abort');
}
// Cleanup leftover state.
if (this.xhr) {
this.xhr = undefined;
delete this.xhr;
}
if (this.config) {
this.co... | javascript | function() {
if (this.xhr) {
this.xhr.abort();
} else if (this.config) {
this.config.complete.call(this, this.xhr, 'abort');
}
// Cleanup leftover state.
if (this.xhr) {
this.xhr = undefined;
delete this.xhr;
}
if (this.config) {
this.co... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"xhr",
")",
"{",
"this",
".",
"xhr",
".",
"abort",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"config",
")",
"{",
"this",
".",
"config",
".",
"complete",
".",
"call",
"(",
"this",
",... | Aborts the current connection. This is ineffective for running synchronous calls or completed
calls. Synchronous calls can be achieved by setting async to false in WebService.
@return {APICall} The current APICall object | [
"Aborts",
"the",
"current",
"connection",
".",
"This",
"is",
"ineffective",
"for",
"running",
"synchronous",
"calls",
"or",
"completed",
"calls",
".",
"Synchronous",
"calls",
"can",
"be",
"achieved",
"by",
"setting",
"async",
"to",
"false",
"in",
"WebService",
... | 647a84cd3631e7399d0802cdf069d7104a4b2192 | https://github.com/cloudmine/CloudMineSDK-JavaScript/blob/647a84cd3631e7399d0802cdf069d7104a4b2192/js/cloudmine.js#L1679-L1697 | train | |
back4app/back4app-entity | src/back/utils/objects.js | copy | function copy(o) {
expect(arguments).to.have.length(
1,
'Invalid argument length when copying an object (it has to be passed ' +
'1 argument)'
);
expect(o).to.be.an(
'object',
'Invalid argument "o" when copying an object (it has to be an object)'
);
var oCopy = {};
for (var property i... | javascript | function copy(o) {
expect(arguments).to.have.length(
1,
'Invalid argument length when copying an object (it has to be passed ' +
'1 argument)'
);
expect(o).to.be.an(
'object',
'Invalid argument "o" when copying an object (it has to be an object)'
);
var oCopy = {};
for (var property i... | [
"function",
"copy",
"(",
"o",
")",
"{",
"expect",
"(",
"arguments",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
",",
"'Invalid argument length when copying an object (it has to be passed '",
"+",
"'1 argument)'",
")",
";",
"expect",
"(",
"o",
")",
".... | Makes a copy of a given object.
@param {!Object} o The object to be copied.
@returns {Object} The new copy of the given object.
@example
var copy = objects.copy(myObject); | [
"Makes",
"a",
"copy",
"of",
"a",
"given",
"object",
"."
] | 16a15284d2e119508fcb4e0c88f647ffb285d2e9 | https://github.com/back4app/back4app-entity/blob/16a15284d2e119508fcb4e0c88f647ffb285d2e9/src/back/utils/objects.js#L24-L43 | train |
taskworld/legendary-pancake | examples/homepage/src/documentationPages.js | rerouteLinks | function rerouteLinks (html) {
return html.replace(/href="(\.\/[a-z0-9\-]+\.md)"/g, (all, key) => {
const found = documentationPages.filter((page) => page.key === key)[0]
if (!found) return all
/* global __legendary_pancake_base_pathname__ */
const base = __legendary_pancake_base_pathname__ // eslint-... | javascript | function rerouteLinks (html) {
return html.replace(/href="(\.\/[a-z0-9\-]+\.md)"/g, (all, key) => {
const found = documentationPages.filter((page) => page.key === key)[0]
if (!found) return all
/* global __legendary_pancake_base_pathname__ */
const base = __legendary_pancake_base_pathname__ // eslint-... | [
"function",
"rerouteLinks",
"(",
"html",
")",
"{",
"return",
"html",
".",
"replace",
"(",
"/",
"href=\"(\\.\\/[a-z0-9\\-]+\\.md)\"",
"/",
"g",
",",
"(",
"all",
",",
"key",
")",
"=>",
"{",
"const",
"found",
"=",
"documentationPages",
".",
"filter",
"(",
"("... | Rewrite links to direct to the correct page. | [
"Rewrite",
"links",
"to",
"direct",
"to",
"the",
"correct",
"page",
"."
] | 5e3a3ff81f7a65808a3bfe945767368db0d46e8c | https://github.com/taskworld/legendary-pancake/blob/5e3a3ff81f7a65808a3bfe945767368db0d46e8c/examples/homepage/src/documentationPages.js#L53-L62 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | updateValidAndInvalidDataSources | function updateValidAndInvalidDataSources(dataSourcesToSplit, currentInvalidDataSources) {
logger.debug("dataSourcesToSplit", dataSourcesToSplit);
currentInvalidDataSources = currentInvalidDataSources || [];
var validInvalid = _.partition(dataSourcesToSplit, function(dataSourceUpdateData) {
if (dataSourceUpda... | javascript | function updateValidAndInvalidDataSources(dataSourcesToSplit, currentInvalidDataSources) {
logger.debug("dataSourcesToSplit", dataSourcesToSplit);
currentInvalidDataSources = currentInvalidDataSources || [];
var validInvalid = _.partition(dataSourcesToSplit, function(dataSourceUpdateData) {
if (dataSourceUpda... | [
"function",
"updateValidAndInvalidDataSources",
"(",
"dataSourcesToSplit",
",",
"currentInvalidDataSources",
")",
"{",
"logger",
".",
"debug",
"(",
"\"dataSourcesToSplit\"",
",",
"dataSourcesToSplit",
")",
";",
"currentInvalidDataSources",
"=",
"currentInvalidDataSources",
"|... | Splitting Data Sources Into Invalid And Valid Data Sources.
@param dataSourcesToSplit
@param currentInvalidDataSources
@returns {{valid, invalid: Array}} | [
"Splitting",
"Data",
"Sources",
"Into",
"Invalid",
"And",
"Valid",
"Data",
"Sources",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L20-L39 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | findDataSources | function findDataSources(connections, dataSources, cb) {
//Just Want The Data Source IDs.
logger.debug("findDataSources", {dataSources: dataSources});
var dataSourceIDsToUpdate = _.map(dataSources, function(dataSourceUpdateData) {
return dataSourceUpdateData.error ? null : dataSourceUpdateData._id;
});
d... | javascript | function findDataSources(connections, dataSources, cb) {
//Just Want The Data Source IDs.
logger.debug("findDataSources", {dataSources: dataSources});
var dataSourceIDsToUpdate = _.map(dataSources, function(dataSourceUpdateData) {
return dataSourceUpdateData.error ? null : dataSourceUpdateData._id;
});
d... | [
"function",
"findDataSources",
"(",
"connections",
",",
"dataSources",
",",
"cb",
")",
"{",
"//Just Want The Data Source IDs.",
"logger",
".",
"debug",
"(",
"\"findDataSources\"",
",",
"{",
"dataSources",
":",
"dataSources",
"}",
")",
";",
"var",
"dataSourceIDsToUpd... | Finding All Data Sources That Need To Be Updated
@param dataSources
@param connections
@param cb
@returns {*} | [
"Finding",
"All",
"Data",
"Sources",
"That",
"Need",
"To",
"Be",
"Updated"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L48-L109 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | validateParams | function validateParams(dataSources, cb) {
dataSources = _.map(dataSources, function(dataSourceUpdateData) {
var failed = validate(dataSourceUpdateData).has(CONSTANTS.DATA_SOURCE_ID);
if (failed) {
dataSourceUpdateData.error = buildErrorResponse({error: new Error("Invalid Parameters For Updating Data S... | javascript | function validateParams(dataSources, cb) {
dataSources = _.map(dataSources, function(dataSourceUpdateData) {
var failed = validate(dataSourceUpdateData).has(CONSTANTS.DATA_SOURCE_ID);
if (failed) {
dataSourceUpdateData.error = buildErrorResponse({error: new Error("Invalid Parameters For Updating Data S... | [
"function",
"validateParams",
"(",
"dataSources",
",",
"cb",
")",
"{",
"dataSources",
"=",
"_",
".",
"map",
"(",
"dataSources",
",",
"function",
"(",
"dataSourceUpdateData",
")",
"{",
"var",
"failed",
"=",
"validate",
"(",
"dataSourceUpdateData",
")",
".",
"... | Validating Data Source Parameters
@param dataSources
@param cb | [
"Validating",
"Data",
"Source",
"Parameters"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L116-L134 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | updateDataSourceCaches | function updateDataSourceCaches(params, dsWithDocuments, dsWithNoDocuments, cb) {
//Updating All Of The Data Sources
//Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed.
dsWithDocuments = _.map(dsWithDocuments, function(dataSourceData) {
dataSourceData.data... | javascript | function updateDataSourceCaches(params, dsWithDocuments, dsWithNoDocuments, cb) {
//Updating All Of The Data Sources
//Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed.
dsWithDocuments = _.map(dsWithDocuments, function(dataSourceData) {
dataSourceData.data... | [
"function",
"updateDataSourceCaches",
"(",
"params",
",",
"dsWithDocuments",
",",
"dsWithNoDocuments",
",",
"cb",
")",
"{",
"//Updating All Of The Data Sources",
"//Generating Hashes For The Incoming Data Set. Useful for determining if the stored data set has changed.",
"dsWithDocuments"... | Updating All Data Source Caches With New Data Sets Or Errors
@param params
- currentTime
@param dsWithDocuments
@param dsWithNoDocuments
@param cb | [
"Updating",
"All",
"Data",
"Source",
"Caches",
"With",
"New",
"Data",
"Sets",
"Or",
"Errors"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L144-L162 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | updateForms | function updateForms(params, validDataSources, invalidDataSources, cb) {
//Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form.
var dataSoucesUpdated = _.filter(validDataSources, function(dataSourceData) {
return d... | javascript | function updateForms(params, validDataSources, invalidDataSources, cb) {
//Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form.
var dataSoucesUpdated = _.filter(validDataSources, function(dataSourceData) {
return d... | [
"function",
"updateForms",
"(",
"params",
",",
"validDataSources",
",",
"invalidDataSources",
",",
"cb",
")",
"{",
"//Only interested In Data Sources Where Data Was Actually Updated. If the data set is still the same, then no need to mark the form as updated the form.",
"var",
"dataSouce... | Updating All Forms Associated With Valid Data Source Updates
@param params
- currentTime
- connections
@param validDataSources
@param invalidDataSources
@param cb | [
"Updating",
"All",
"Forms",
"Associated",
"With",
"Valid",
"Data",
"Source",
"Updates"
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L173-L205 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | saveAuditLogEntryAndUpdateDataSource | function saveAuditLogEntryAndUpdateDataSource(params, callback) {
var cacheElement = params.cacheElement;
var dataSourceDocument = params.dataSourceDocument;
var dataSourceData = params.dataSourceData;
async.waterfall([
function saveAuditLog(cb) {
//An Audit Log Entry Is Based On The Cache Update Ent... | javascript | function saveAuditLogEntryAndUpdateDataSource(params, callback) {
var cacheElement = params.cacheElement;
var dataSourceDocument = params.dataSourceDocument;
var dataSourceData = params.dataSourceData;
async.waterfall([
function saveAuditLog(cb) {
//An Audit Log Entry Is Based On The Cache Update Ent... | [
"function",
"saveAuditLogEntryAndUpdateDataSource",
"(",
"params",
",",
"callback",
")",
"{",
"var",
"cacheElement",
"=",
"params",
".",
"cacheElement",
";",
"var",
"dataSourceDocument",
"=",
"params",
".",
"dataSourceDocument",
";",
"var",
"dataSourceData",
"=",
"p... | Saving The Updated Data Source and Updating The Audit Log.
@param params
@param params.cacheElement - Cache Element Being Updated
@param params.dataSourceDocument - The Mongoose Data Source Document
@param params.dataSourceData - The Data Source Data To Be Updated
@param params.connections.mongooseConnection - The Mong... | [
"Saving",
"The",
"Updated",
"Data",
"Source",
"and",
"Updating",
"The",
"Audit",
"Log",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L216-L274 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | updateDataSourceEntry | function updateDataSourceEntry(params, dataSourceData, callback) {
var dataToUpdate = dataSourceData.data;
var dataSourceDocument = dataSourceData.document;
logger.debug("updateDataSourceEntry ", params, dataSourceData);
//If there is no cache entry, create a new one to validate.
var cacheElement = dataSour... | javascript | function updateDataSourceEntry(params, dataSourceData, callback) {
var dataToUpdate = dataSourceData.data;
var dataSourceDocument = dataSourceData.document;
logger.debug("updateDataSourceEntry ", params, dataSourceData);
//If there is no cache entry, create a new one to validate.
var cacheElement = dataSour... | [
"function",
"updateDataSourceEntry",
"(",
"params",
",",
"dataSourceData",
",",
"callback",
")",
"{",
"var",
"dataToUpdate",
"=",
"dataSourceData",
".",
"data",
";",
"var",
"dataSourceDocument",
"=",
"dataSourceData",
".",
"document",
";",
"logger",
".",
"debug",
... | Update A Single Data Source Data Entry.
@param params
- currentTime
@param dataSourceData
@param callback | [
"Update",
"A",
"Single",
"Data",
"Source",
"Data",
"Entry",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L284-L372 | train |
feedhenry/fh-forms | lib/impl/dataSources/updateCache.js | prepareResponse | function prepareResponse(validDataSources, invalidDataSources, cb) {
//There Were Errors Updating Data Sources, should return an error
logger.debug("prepareResponse Before", validDataSources);
//For The Valid Data Sources, Just want the updated Document JSON
validDataSources = _.map(validDataSources, function(... | javascript | function prepareResponse(validDataSources, invalidDataSources, cb) {
//There Were Errors Updating Data Sources, should return an error
logger.debug("prepareResponse Before", validDataSources);
//For The Valid Data Sources, Just want the updated Document JSON
validDataSources = _.map(validDataSources, function(... | [
"function",
"prepareResponse",
"(",
"validDataSources",
",",
"invalidDataSources",
",",
"cb",
")",
"{",
"//There Were Errors Updating Data Sources, should return an error",
"logger",
".",
"debug",
"(",
"\"prepareResponse Before\"",
",",
"validDataSources",
")",
";",
"//For Th... | Preparing The JSON Response For The Data Source Cache Update.
@param validDataSources
@param invalidDataSources
@param cb
@returns {*} | [
"Preparing",
"The",
"JSON",
"Response",
"For",
"The",
"Data",
"Source",
"Cache",
"Update",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/dataSources/updateCache.js#L381-L404 | train |
feedhenry/fh-forms | lib/impl/getForms.js | getSubmissionStorage | function getSubmissionStorage(cb) {
//If no stats are required, don't try and do the map-reduce operation.
if (options.notStats) {
return cb();
}
// NOTE: this function executes in MongoDB rather than Node.js
//Need a map-reduce operation to count the files, otherwise would have t... | javascript | function getSubmissionStorage(cb) {
//If no stats are required, don't try and do the map-reduce operation.
if (options.notStats) {
return cb();
}
// NOTE: this function executes in MongoDB rather than Node.js
//Need a map-reduce operation to count the files, otherwise would have t... | [
"function",
"getSubmissionStorage",
"(",
"cb",
")",
"{",
"//If no stats are required, don't try and do the map-reduce operation.",
"if",
"(",
"options",
".",
"notStats",
")",
"{",
"return",
"cb",
"(",
")",
";",
"}",
"// NOTE: this function executes in MongoDB rather than Node... | Function for getting the current submission storage.
Submission Storage = formsubmissions + fileStorage.chunks + fileStorage.files | [
"Function",
"for",
"getting",
"the",
"current",
"submission",
"storage",
"."
] | 87df586b9589e3c636e1e607163862cfb64872dd | https://github.com/feedhenry/fh-forms/blob/87df586b9589e3c636e1e607163862cfb64872dd/lib/impl/getForms.js#L57-L126 | train |
cloudfour/drizzle-builder | src/utils/object.js | deepObj | function deepObj(pathKeys, obj, createEntries = true) {
return pathKeys.reduce((prev, curr) => {
if (typeof prev[curr] === 'undefined') {
if (createEntries) {
prev[curr] = {};
} else {
DrizzleError.error(
new DrizzleError(
`Property ${curr} not found on supplied o... | javascript | function deepObj(pathKeys, obj, createEntries = true) {
return pathKeys.reduce((prev, curr) => {
if (typeof prev[curr] === 'undefined') {
if (createEntries) {
prev[curr] = {};
} else {
DrizzleError.error(
new DrizzleError(
`Property ${curr} not found on supplied o... | [
"function",
"deepObj",
"(",
"pathKeys",
",",
"obj",
",",
"createEntries",
"=",
"true",
")",
"{",
"return",
"pathKeys",
".",
"reduce",
"(",
"(",
"prev",
",",
"curr",
")",
"=>",
"{",
"if",
"(",
"typeof",
"prev",
"[",
"curr",
"]",
"===",
"'undefined'",
... | Return a reference to the deeply-nested object indicated by the items
in `pathKeys`. If `createEntries`, entry levels will be created as needed
if they don't yet exist on `obj`.
@param {Array} pathKeys Elements making up the "path" to the reference
@param {Object} Object to add needed references to
@exa... | [
"Return",
"a",
"reference",
"to",
"the",
"deeply",
"-",
"nested",
"object",
"indicated",
"by",
"the",
"items",
"in",
"pathKeys",
".",
"If",
"createEntries",
"entry",
"levels",
"will",
"be",
"created",
"as",
"needed",
"if",
"they",
"don",
"t",
"yet",
"exist... | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L16-L32 | train |
cloudfour/drizzle-builder | src/utils/object.js | deepCollection | function deepCollection(collectionId, obj) {
const pathBits = idKeys(collectionId);
pathBits.pop();
pathBits.push('collection');
pathBits.shift();
return deepObj(pathBits, obj, false);
} | javascript | function deepCollection(collectionId, obj) {
const pathBits = idKeys(collectionId);
pathBits.pop();
pathBits.push('collection');
pathBits.shift();
return deepObj(pathBits, obj, false);
} | [
"function",
"deepCollection",
"(",
"collectionId",
",",
"obj",
")",
"{",
"const",
"pathBits",
"=",
"idKeys",
"(",
"collectionId",
")",
";",
"pathBits",
".",
"pop",
"(",
")",
";",
"pathBits",
".",
"push",
"(",
"'collection'",
")",
";",
"pathBits",
".",
"s... | Given a nested pattern `obj` and a `patternId`, find its collection
in the object `obj`.
@see deepPattern | [
"Given",
"a",
"nested",
"pattern",
"obj",
"and",
"a",
"patternId",
"find",
"its",
"collection",
"in",
"the",
"object",
"obj",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L57-L63 | train |
cloudfour/drizzle-builder | src/utils/object.js | isObject | function isObject(obj) {
const objType = typeof obj;
return objType === 'object' && Boolean(obj) && !Array.isArray(obj);
} | javascript | function isObject(obj) {
const objType = typeof obj;
return objType === 'object' && Boolean(obj) && !Array.isArray(obj);
} | [
"function",
"isObject",
"(",
"obj",
")",
"{",
"const",
"objType",
"=",
"typeof",
"obj",
";",
"return",
"objType",
"===",
"'object'",
"&&",
"Boolean",
"(",
"obj",
")",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"obj",
")",
";",
"}"
] | IsObject function opinionated against Arrays
@param {Obj}
@return {Boolean} | [
"IsObject",
"function",
"opinionated",
"against",
"Arrays"
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L70-L73 | train |
cloudfour/drizzle-builder | src/utils/object.js | flattenById | function flattenById(obj, keyedObj = {}) {
if (obj.hasOwnProperty('id')) {
keyedObj[obj.id] = obj;
}
for (var key in obj) {
if (isObject(obj[key])) {
flattenById(obj[key], keyedObj);
}
}
return keyedObj;
} | javascript | function flattenById(obj, keyedObj = {}) {
if (obj.hasOwnProperty('id')) {
keyedObj[obj.id] = obj;
}
for (var key in obj) {
if (isObject(obj[key])) {
flattenById(obj[key], keyedObj);
}
}
return keyedObj;
} | [
"function",
"flattenById",
"(",
"obj",
",",
"keyedObj",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"'id'",
")",
")",
"{",
"keyedObj",
"[",
"obj",
".",
"id",
"]",
"=",
"obj",
";",
"}",
"for",
"(",
"var",
"key",
"in",
... | Take a deeply-nested object and return a single-level object keyed
by the `id` property of original object entries.
@param {Obj} obj
@param {Obj} keyedObj For recursion; not strictly necessary but...
@return {Obj} keyed by ids | [
"Take",
"a",
"deeply",
"-",
"nested",
"object",
"and",
"return",
"a",
"single",
"-",
"level",
"object",
"keyed",
"by",
"the",
"id",
"property",
"of",
"original",
"object",
"entries",
"."
] | 1c320cb059c749c28339a661d1768d3a643e5f1c | https://github.com/cloudfour/drizzle-builder/blob/1c320cb059c749c28339a661d1768d3a643e5f1c/src/utils/object.js#L83-L93 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.