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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
linzjs/linz | lib/api/formtools/list.js | getActiveFilters | function getActiveFilters (req, selectedFilters, data, modelName, cb) {
if (!req) {
throw new Error('req is required.');
}
if (!selectedFilters || !Array.isArray(selectedFilters) || !selectedFilters.length) {
throw new Error('selectedFilters is required and must be of type Array and cannot... | javascript | function getActiveFilters (req, selectedFilters, data, modelName, cb) {
if (!req) {
throw new Error('req is required.');
}
if (!selectedFilters || !Array.isArray(selectedFilters) || !selectedFilters.length) {
throw new Error('selectedFilters is required and must be of type Array and cannot... | [
"function",
"getActiveFilters",
"(",
"req",
",",
"selectedFilters",
",",
"data",
",",
"modelName",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"req",
")",
"{",
"throw",
"new",
"Error",
"(",
"'req is required.'",
")",
";",
"}",
"if",
"(",
"!",
"selectedFilters",... | Get active filters from form post data
@param {Array} selectedFilters An array of selected filter field names
@param {Object} data Form data
@param {String} modelName Name of model
@param {Function} cb Callback function
@return {Object} or undefined
@api public | [
"Get",
"active",
"filters",
"from",
"form",
"post",
"data"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/formtools/list.js#L197-L253 | train |
linzjs/linz | lib/formtools/overview.js | setTabId | function setTabId (sections) {
sections.forEach(function (section, sectionIndex) {
if (!Array.isArray(section)) {
return;
}
section.forEach(function (tab, tabIndex) {
// Replace white space from tab.label with "-", make it lowercase and add the index number at the... | javascript | function setTabId (sections) {
sections.forEach(function (section, sectionIndex) {
if (!Array.isArray(section)) {
return;
}
section.forEach(function (tab, tabIndex) {
// Replace white space from tab.label with "-", make it lowercase and add the index number at the... | [
"function",
"setTabId",
"(",
"sections",
")",
"{",
"sections",
".",
"forEach",
"(",
"function",
"(",
"section",
",",
"sectionIndex",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"section",
")",
")",
"{",
"return",
";",
"}",
"section",
".",
... | Set unique tabId to each tab in overview.body
@param {Array} sections overview body array | [
"Set",
"unique",
"tabId",
"to",
"each",
"tab",
"in",
"overview",
".",
"body"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/formtools/overview.js#L10-L28 | train |
linzjs/linz | lib/formtools/overview.js | renderCell | function renderCell (record, field, model, cb) {
let fieldName = (typeof field === 'object') ? field.fieldName : field,
renderer = (model.schema.tree[fieldName] && model.schema.tree[fieldName].ref && linz.api.model.getObjectIdFromRefField(record[fieldName]) instanceof linz.mongoose.Types.ObjectId) ?
... | javascript | function renderCell (record, field, model, cb) {
let fieldName = (typeof field === 'object') ? field.fieldName : field,
renderer = (model.schema.tree[fieldName] && model.schema.tree[fieldName].ref && linz.api.model.getObjectIdFromRefField(record[fieldName]) instanceof linz.mongoose.Types.ObjectId) ?
... | [
"function",
"renderCell",
"(",
"record",
",",
"field",
",",
"model",
",",
"cb",
")",
"{",
"let",
"fieldName",
"=",
"(",
"typeof",
"field",
"===",
"'object'",
")",
"?",
"field",
".",
"fieldName",
":",
"field",
",",
"renderer",
"=",
"(",
"model",
".",
... | Return the rendered value of field.
@param {Object} record Overview record object
@param {Object or String} Field name or Object containing field name and field label
@param {Obect} model Model object
@param {Function} cb Callback function
@return {Object} Return object: { label: '', value: '' } | [
"Return",
"the",
"rendered",
"value",
"of",
"field",
"."
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/formtools/overview.js#L38-L60 | train |
linzjs/linz | public/js/documentarray.js | getOffset | function getOffset(offset) {
var symbol = offset.charAt(0);
var time = offset.substring(1).split(':');
var hours = Number.parseInt(time[0], 10) * 60;
var minutes = Number.parseInt(time[1], 10);
var total = Number.parseInt(symbol + (hours + minutes));
... | javascript | function getOffset(offset) {
var symbol = offset.charAt(0);
var time = offset.substring(1).split(':');
var hours = Number.parseInt(time[0], 10) * 60;
var minutes = Number.parseInt(time[1], 10);
var total = Number.parseInt(symbol + (hours + minutes));
... | [
"function",
"getOffset",
"(",
"offset",
")",
"{",
"var",
"symbol",
"=",
"offset",
".",
"charAt",
"(",
"0",
")",
";",
"var",
"time",
"=",
"offset",
".",
"substring",
"(",
"1",
")",
".",
"split",
"(",
"':'",
")",
";",
"var",
"hours",
"=",
"Number",
... | Get the offsets as an integer | [
"Get",
"the",
"offsets",
"as",
"an",
"integer"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/public/js/documentarray.js#L320-L330 | train |
Yodata/yodata | packages/client/lib/get-options.js | getConfig | function getConfig(options) {
const profileOptions = {
baseUrl: get('pod.url'),
headers: {
'user-agent': `yodata/client (https://yodata.io)`,
'x-api-key': get('pod.secret')
},
hooks: {
beforeRequest: [
logRequest
],
afterResponse: [
parseResponseData
]
}
}
return defaults(options,... | javascript | function getConfig(options) {
const profileOptions = {
baseUrl: get('pod.url'),
headers: {
'user-agent': `yodata/client (https://yodata.io)`,
'x-api-key': get('pod.secret')
},
hooks: {
beforeRequest: [
logRequest
],
afterResponse: [
parseResponseData
]
}
}
return defaults(options,... | [
"function",
"getConfig",
"(",
"options",
")",
"{",
"const",
"profileOptions",
"=",
"{",
"baseUrl",
":",
"get",
"(",
"'pod.url'",
")",
",",
"headers",
":",
"{",
"'user-agent'",
":",
"`",
"`",
",",
"'x-api-key'",
":",
"get",
"(",
"'pod.secret'",
")",
"}",
... | get client options from currentProfile or default
@param {object} [options]
@param {string} [options.baseurl]
@param {object} [options.headers]
@returns {object} | [
"get",
"client",
"options",
"from",
"currentProfile",
"or",
"default"
] | d7aedd03e49ce5da6e45ab821f54b16d4d4409df | https://github.com/Yodata/yodata/blob/d7aedd03e49ce5da6e45ab821f54b16d4d4409df/packages/client/lib/get-options.js#L15-L32 | train |
linzjs/linz | lib/formtools/renderers-action-record.js | defaultRenderer | function defaultRenderer (data, callback) {
linz.api.views.renderPartial('action-record', data, (err, html) => {
if (err) {
return callback(err);
}
return callback(null, html);
});
} | javascript | function defaultRenderer (data, callback) {
linz.api.views.renderPartial('action-record', data, (err, html) => {
if (err) {
return callback(err);
}
return callback(null, html);
});
} | [
"function",
"defaultRenderer",
"(",
"data",
",",
"callback",
")",
"{",
"linz",
".",
"api",
".",
"views",
".",
"renderPartial",
"(",
"'action-record'",
",",
"data",
",",
"(",
"err",
",",
"html",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"c... | Default record action renderer.
@param {Object} data Data passed to the template.
@param {Function} callback Callback function.
@return {String} Rendered HTML content. | [
"Default",
"record",
"action",
"renderer",
"."
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/formtools/renderers-action-record.js#L11-L23 | train |
Yodata/yodata | packages/transform/src/get-context.js | getContext | async function getContext(target, contextOptions) {
if (isURL(target)) {
const cdef = await got(target)
.then(response => {
const contentType = response.headers["content-type"]
switch (contentType) {
case 'application/x-yaml':
case 'application/x-yml':
return yaml.load(response.body)
... | javascript | async function getContext(target, contextOptions) {
if (isURL(target)) {
const cdef = await got(target)
.then(response => {
const contentType = response.headers["content-type"]
switch (contentType) {
case 'application/x-yaml':
case 'application/x-yml':
return yaml.load(response.body)
... | [
"async",
"function",
"getContext",
"(",
"target",
",",
"contextOptions",
")",
"{",
"if",
"(",
"isURL",
"(",
"target",
")",
")",
"{",
"const",
"cdef",
"=",
"await",
"got",
"(",
"target",
")",
".",
"then",
"(",
"response",
"=>",
"{",
"const",
"contentTyp... | fetch and parse context from a file or http url
@param {string} target
@param {object} [contextOptions]
@returns {Promise} | [
"fetch",
"and",
"parse",
"context",
"from",
"a",
"file",
"or",
"http",
"url"
] | d7aedd03e49ce5da6e45ab821f54b16d4d4409df | https://github.com/Yodata/yodata/blob/d7aedd03e49ce5da6e45ab821f54b16d4d4409df/packages/transform/src/get-context.js#L18-L38 | train |
linzjs/linz | lib/api/model.js | form | function form (req, modelName, callback, formDsl) {
const formFn = () => new Promise((resolve, reject) => {
const formLabels = labels(modelName);
const schema = get(modelName, true).schema;
if (formDsl && typeof formDsl === 'function') {
return resolve(pluginHelpers.formSettin... | javascript | function form (req, modelName, callback, formDsl) {
const formFn = () => new Promise((resolve, reject) => {
const formLabels = labels(modelName);
const schema = get(modelName, true).schema;
if (formDsl && typeof formDsl === 'function') {
return resolve(pluginHelpers.formSettin... | [
"function",
"form",
"(",
"req",
",",
"modelName",
",",
"callback",
",",
"formDsl",
")",
"{",
"const",
"formFn",
"=",
"(",
")",
"=>",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"formLabels",
"=",
"labels",
"(",
"mod... | Retrieve the form DSL for a model
@param {Object} req A HTTP request object which can be used to customised the form
@param {String} modelName The name of the model
@param {Function} callback A callback to return the form DSL to
@return {Void} | [
"Retrieve",
"the",
"form",
"DSL",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L50-L82 | train |
linzjs/linz | lib/api/model.js | formAsPromise | function formAsPromise (req, modelName, formDsl) {
return new Promise((resolve, reject) => {
form(req, modelName, (err, decoratedForm) => {
if (err) {
return reject(err);
}
return resolve(decoratedForm);
}, formDsl);
});
} | javascript | function formAsPromise (req, modelName, formDsl) {
return new Promise((resolve, reject) => {
form(req, modelName, (err, decoratedForm) => {
if (err) {
return reject(err);
}
return resolve(decoratedForm);
}, formDsl);
});
} | [
"function",
"formAsPromise",
"(",
"req",
",",
"modelName",
",",
"formDsl",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"form",
"(",
"req",
",",
"modelName",
",",
"(",
"err",
",",
"decoratedForm",
")",
"=>",... | Promise version of `form`.
See `form`.
@param {Object} req A HTTP request object which can be used to customised the form
@param {String} modelName The name of the model
@return {Promise} A promise with the decorated form DSL. | [
"Promise",
"version",
"of",
"form",
".",
"See",
"form",
"."
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L91-L107 | train |
linzjs/linz | lib/api/model.js | list | function list (req, modelName, callback) {
return get(modelName, true).getList(req, callback);
} | javascript | function list (req, modelName, callback) {
return get(modelName, true).getList(req, callback);
} | [
"function",
"list",
"(",
"req",
",",
"modelName",
",",
"callback",
")",
"{",
"return",
"get",
"(",
"modelName",
",",
"true",
")",
".",
"getList",
"(",
"req",
",",
"callback",
")",
";",
"}"
] | Retrieve the list DSL for a model
@param {Object} req A HTTP request object which can be used to customised the list
@param {String} modelName The name of the model
@param {Function} callback A callback to return the list DSL to
@return {Void} | [
"Retrieve",
"the",
"list",
"DSL",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L116-L118 | train |
linzjs/linz | lib/api/model.js | permissions | function permissions (user, modelName, callback) {
return get(modelName, true).getPermissions(user, callback);
} | javascript | function permissions (user, modelName, callback) {
return get(modelName, true).getPermissions(user, callback);
} | [
"function",
"permissions",
"(",
"user",
",",
"modelName",
",",
"callback",
")",
"{",
"return",
"get",
"(",
"modelName",
",",
"true",
")",
".",
"getPermissions",
"(",
"user",
",",
"callback",
")",
";",
"}"
] | Retrieve the permissions DSL for a model
@param {Object} user The user to which the permissions should be customised
@param {String} modelName The name of the model
@param {Function} callback A callback to return the permissions DSL to
@return {Void} | [
"Retrieve",
"the",
"permissions",
"DSL",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L137-L139 | train |
linzjs/linz | lib/api/model.js | overview | function overview (req, modelName, callback) {
return get(modelName, true).getOverview(req, callback);
} | javascript | function overview (req, modelName, callback) {
return get(modelName, true).getOverview(req, callback);
} | [
"function",
"overview",
"(",
"req",
",",
"modelName",
",",
"callback",
")",
"{",
"return",
"get",
"(",
"modelName",
",",
"true",
")",
".",
"getOverview",
"(",
"req",
",",
"callback",
")",
";",
"}"
] | Retrieve the overview DSL for a model
@param {Object} req A HTTP request object which can be used to customised the overview
@param {String} modelName The name of the model
@param {Function} callback A callback to return the overview DSL to
@return {Void} | [
"Retrieve",
"the",
"overview",
"DSL",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L148-L150 | train |
linzjs/linz | lib/api/model.js | labels | function labels (modelName, callback) {
if (callback) {
return get(modelName, true).getLabels(callback);
}
return get(modelName, true).getLabels();
} | javascript | function labels (modelName, callback) {
if (callback) {
return get(modelName, true).getLabels(callback);
}
return get(modelName, true).getLabels();
} | [
"function",
"labels",
"(",
"modelName",
",",
"callback",
")",
"{",
"if",
"(",
"callback",
")",
"{",
"return",
"get",
"(",
"modelName",
",",
"true",
")",
".",
"getLabels",
"(",
"callback",
")",
";",
"}",
"return",
"get",
"(",
"modelName",
",",
"true",
... | Retrieve the labels for a model
@param {String} modelName The name of the model
@param {Function} callback An optional callback to return the labels object to
@return {Void} | [
"Retrieve",
"the",
"labels",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L158-L166 | train |
linzjs/linz | lib/api/model.js | titleField | function titleField (modelName, field, callback) {
// Make this a no-op unless the field being evaluated is `'title'`.
if (field !== 'title') {
return callback(null, field);
}
if (get(modelName, true).schema.paths[field]) {
return callback(null, field);
}
model(modelName, (err... | javascript | function titleField (modelName, field, callback) {
// Make this a no-op unless the field being evaluated is `'title'`.
if (field !== 'title') {
return callback(null, field);
}
if (get(modelName, true).schema.paths[field]) {
return callback(null, field);
}
model(modelName, (err... | [
"function",
"titleField",
"(",
"modelName",
",",
"field",
",",
"callback",
")",
"{",
"// Make this a no-op unless the field being evaluated is `'title'`.",
"if",
"(",
"field",
"!==",
"'title'",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"field",
")",
";",
"... | Retrieve the title field for a model
@param {String} modelName The name of the model.
@param {String} field A field in the model.
@param {Function} callback A callback to provide the result to.
@return {Void} | [
"Retrieve",
"the",
"title",
"field",
"for",
"a",
"model"
] | 0ac03e722747406d29f9e1eed7e96b6be04456e8 | https://github.com/linzjs/linz/blob/0ac03e722747406d29f9e1eed7e96b6be04456e8/lib/api/model.js#L175-L196 | train |
Yodata/yodata | packages/transform/src/compile.js | compileContext | async function compileContext(target, contextOptions) {
const context = await getContext(target, contextOptions)
return async function (data/** @param {object} */) {
return context.map(data)
}
} | javascript | async function compileContext(target, contextOptions) {
const context = await getContext(target, contextOptions)
return async function (data/** @param {object} */) {
return context.map(data)
}
} | [
"async",
"function",
"compileContext",
"(",
"target",
",",
"contextOptions",
")",
"{",
"const",
"context",
"=",
"await",
"getContext",
"(",
"target",
",",
"contextOptions",
")",
"return",
"async",
"function",
"(",
"data",
"/** @param {object} */",
")",
"{",
"ret... | fetch a conext by path or url and return an async context.map helper function
@param {string} target
@param {object} [contextOptions]
@returns {Promise<function>} | [
"fetch",
"a",
"conext",
"by",
"path",
"or",
"url",
"and",
"return",
"an",
"async",
"context",
".",
"map",
"helper",
"function"
] | d7aedd03e49ce5da6e45ab821f54b16d4d4409df | https://github.com/Yodata/yodata/blob/d7aedd03e49ce5da6e45ab821f54b16d4d4409df/packages/transform/src/compile.js#L14-L20 | train |
Becklyn/kaba | lib/print-package-versions.js | getMaxPackageNameLength | function getMaxPackageNameLength (packages)
{
return Object
.keys(packages)
.reduce((max, name) => Math.max(max, name.length), 0);
} | javascript | function getMaxPackageNameLength (packages)
{
return Object
.keys(packages)
.reduce((max, name) => Math.max(max, name.length), 0);
} | [
"function",
"getMaxPackageNameLength",
"(",
"packages",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"packages",
")",
".",
"reduce",
"(",
"(",
"max",
",",
"name",
")",
"=>",
"Math",
".",
"max",
"(",
"max",
",",
"name",
".",
"length",
")",
",",
"0"... | Returns the max package name length
@private
@param {Object.<string,string>} packages
@return {number} | [
"Returns",
"the",
"max",
"package",
"name",
"length"
] | 8862f48c576762d39536b29b674ae3d074a94b25 | https://github.com/Becklyn/kaba/blob/8862f48c576762d39536b29b674ae3d074a94b25/lib/print-package-versions.js#L11-L16 | train |
Becklyn/kaba | lib/print-package-versions.js | padding | function padding (packageName, maxLength)
{
const length = packageName.length;
return (length < maxLength)
? " ".repeat(maxLength - length)
: "";
} | javascript | function padding (packageName, maxLength)
{
const length = packageName.length;
return (length < maxLength)
? " ".repeat(maxLength - length)
: "";
} | [
"function",
"padding",
"(",
"packageName",
",",
"maxLength",
")",
"{",
"const",
"length",
"=",
"packageName",
".",
"length",
";",
"return",
"(",
"length",
"<",
"maxLength",
")",
"?",
"\" \"",
".",
"repeat",
"(",
"maxLength",
"-",
"length",
")",
":",
"\"\... | Returns the padding for the given
@private
@param {string} packageName
@param {number} maxLength
@return {string} | [
"Returns",
"the",
"padding",
"for",
"the",
"given"
] | 8862f48c576762d39536b29b674ae3d074a94b25 | https://github.com/Becklyn/kaba/blob/8862f48c576762d39536b29b674ae3d074a94b25/lib/print-package-versions.js#L28-L35 | train |
iadvize/health-check-library | javascript/pure/pure.js | createServer | function createServer(port, f) {
f = f || noop;
http.createServer(handler).listen(port, f);
return statusHelper.changeStatus;
} | javascript | function createServer(port, f) {
f = f || noop;
http.createServer(handler).listen(port, f);
return statusHelper.changeStatus;
} | [
"function",
"createServer",
"(",
"port",
",",
"f",
")",
"{",
"f",
"=",
"f",
"||",
"noop",
";",
"http",
".",
"createServer",
"(",
"handler",
")",
".",
"listen",
"(",
"port",
",",
"f",
")",
";",
"return",
"statusHelper",
".",
"changeStatus",
";",
"}"
] | Create an HTTP server that always yield 200 HTTP status code
@param {number} port
@param {function} [f] callback | [
"Create",
"an",
"HTTP",
"server",
"that",
"always",
"yield",
"200",
"HTTP",
"status",
"code"
] | a3751271be44b88b4a558b512e02bd082b93848d | https://github.com/iadvize/health-check-library/blob/a3751271be44b88b4a558b512e02bd082b93848d/javascript/pure/pure.js#L11-L15 | train |
Becklyn/kaba | bin/run.js | runKaba | function runKaba (opts, isVerbose)
{
try
{
const logger = new Logger(kleur.bgYellow.black(" kaba "));
logger.log("kaba started");
const start = process.hrtime();
const cliConfig = new CliConfig(opts);
/** @type {Kaba} kaba */
const kaba = require(`${process.cwd()... | javascript | function runKaba (opts, isVerbose)
{
try
{
const logger = new Logger(kleur.bgYellow.black(" kaba "));
logger.log("kaba started");
const start = process.hrtime();
const cliConfig = new CliConfig(opts);
/** @type {Kaba} kaba */
const kaba = require(`${process.cwd()... | [
"function",
"runKaba",
"(",
"opts",
",",
"isVerbose",
")",
"{",
"try",
"{",
"const",
"logger",
"=",
"new",
"Logger",
"(",
"kleur",
".",
"bgYellow",
".",
"black",
"(",
"\" kaba \"",
")",
")",
";",
"logger",
".",
"log",
"(",
"\"kaba started\"",
")",
";",... | Main kaba function
@param {CliConfigArguments} opts
@param {boolean} isVerbose | [
"Main",
"kaba",
"function"
] | 8862f48c576762d39536b29b674ae3d074a94b25 | https://github.com/Becklyn/kaba/blob/8862f48c576762d39536b29b674ae3d074a94b25/bin/run.js#L124-L189 | train |
emberjs/ember-states | addon/state-manager.js | sendRecursively | function sendRecursively(event, currentState, isUnhandledPass) {
var log = this.enableLogging,
eventName = isUnhandledPass ? 'unhandledEvent' : event,
action = currentState[eventName],
contexts, sendRecursiveArguments, actionArguments;
contexts = [].slice.call(arguments, 3);
// Test to see if ... | javascript | function sendRecursively(event, currentState, isUnhandledPass) {
var log = this.enableLogging,
eventName = isUnhandledPass ? 'unhandledEvent' : event,
action = currentState[eventName],
contexts, sendRecursiveArguments, actionArguments;
contexts = [].slice.call(arguments, 3);
// Test to see if ... | [
"function",
"sendRecursively",
"(",
"event",
",",
"currentState",
",",
"isUnhandledPass",
")",
"{",
"var",
"log",
"=",
"this",
".",
"enableLogging",
",",
"eventName",
"=",
"isUnhandledPass",
"?",
"'unhandledEvent'",
":",
"event",
",",
"action",
"=",
"currentStat... | Sends the event to the currentState, if the event is not handled this method
will proceed to call the parentState recursively until it encounters an
event handler or reaches the top or root of the state path hierarchy.
@method sendRecursively
@param event
@param currentState
@param isUnhandledPass | [
"Sends",
"the",
"event",
"to",
"the",
"currentState",
"if",
"the",
"event",
"is",
"not",
"handled",
"this",
"method",
"will",
"proceed",
"to",
"call",
"the",
"parentState",
"recursively",
"until",
"it",
"encounters",
"an",
"event",
"handler",
"or",
"reaches",
... | d57b64154ac8ec2625a395d8798681130259c3c4 | https://github.com/emberjs/ember-states/blob/d57b64154ac8ec2625a395d8798681130259c3c4/addon/state-manager.js#L28-L70 | train |
emberjs/ember-states | addon/state-manager.js | sendEvent | function sendEvent(eventName, sendRecursiveArguments, isUnhandledPass) {
sendRecursiveArguments.unshift(eventName, this.get('currentState'), isUnhandledPass);
return sendRecursively.apply(this, sendRecursiveArguments);
} | javascript | function sendEvent(eventName, sendRecursiveArguments, isUnhandledPass) {
sendRecursiveArguments.unshift(eventName, this.get('currentState'), isUnhandledPass);
return sendRecursively.apply(this, sendRecursiveArguments);
} | [
"function",
"sendEvent",
"(",
"eventName",
",",
"sendRecursiveArguments",
",",
"isUnhandledPass",
")",
"{",
"sendRecursiveArguments",
".",
"unshift",
"(",
"eventName",
",",
"this",
".",
"get",
"(",
"'currentState'",
")",
",",
"isUnhandledPass",
")",
";",
"return",... | Send an event to the currentState.
@method sendEvent
@param eventName
@param sendRecursiveArguments
@param isUnhandledPass | [
"Send",
"an",
"event",
"to",
"the",
"currentState",
"."
] | d57b64154ac8ec2625a395d8798681130259c3c4 | https://github.com/emberjs/ember-states/blob/d57b64154ac8ec2625a395d8798681130259c3c4/addon/state-manager.js#L80-L83 | train |
ciena-blueplanet/bunsen-core | src/reducer.js | changeEntireFormValue | function changeEntireFormValue ({model, nextValue, prevValue}) {
return {
value: immutableOnce(recursiveClean(nextValue, model)),
valueChangeSet: getChangeSet(prevValue, nextValue)
}
} | javascript | function changeEntireFormValue ({model, nextValue, prevValue}) {
return {
value: immutableOnce(recursiveClean(nextValue, model)),
valueChangeSet: getChangeSet(prevValue, nextValue)
}
} | [
"function",
"changeEntireFormValue",
"(",
"{",
"model",
",",
"nextValue",
",",
"prevValue",
"}",
")",
"{",
"return",
"{",
"value",
":",
"immutableOnce",
"(",
"recursiveClean",
"(",
"nextValue",
",",
"model",
")",
")",
",",
"valueChangeSet",
":",
"getChangeSet"... | Change value of entire form
@param {Object} prevValue - previous form value
@param {Object} nextValue - next form value
@param {BunsenModel} model - model
@returns {Object} new state with value and value changeset | [
"Change",
"value",
"of",
"entire",
"form"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/reducer.js#L117-L122 | train |
ciena-blueplanet/bunsen-core | src/reducer.js | changeNestedFormValue | function changeNestedFormValue ({bunsenId, formValue, model, value}) {
const segments = bunsenId.split('.')
const lastSegment = segments.pop()
const isEmpty = _.isEmpty(value) && (Array.isArray(value) || _.isObject(value)) && !(value instanceof File)
// Make sure form value is immutable
formValue = immutable... | javascript | function changeNestedFormValue ({bunsenId, formValue, model, value}) {
const segments = bunsenId.split('.')
const lastSegment = segments.pop()
const isEmpty = _.isEmpty(value) && (Array.isArray(value) || _.isObject(value)) && !(value instanceof File)
// Make sure form value is immutable
formValue = immutable... | [
"function",
"changeNestedFormValue",
"(",
"{",
"bunsenId",
",",
"formValue",
",",
"model",
",",
"value",
"}",
")",
"{",
"const",
"segments",
"=",
"bunsenId",
".",
"split",
"(",
"'.'",
")",
"const",
"lastSegment",
"=",
"segments",
".",
"pop",
"(",
")",
"c... | Change value of form at specified path
@param {String} bunsenId - path to part of form to change value of
@param {Object} formValue - current form value
@param {BunsenMOdel} model - model
@param {Object} value - new value for path
@returns {Object} new state with value and value changeset
/* eslint-disable complexity | [
"Change",
"value",
"of",
"form",
"at",
"specified",
"path"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/reducer.js#L133-L157 | train |
ciena-blueplanet/bunsen-core | src/reducer.js | unsetProperty | function unsetProperty ({bunsenId, formValue, value}) {
const valueChangeSet = new Map()
valueChangeSet.set(bunsenId, {
value,
type: 'unset'
})
return {
value: unset(formValue, bunsenId),
valueChangeSet
}
} | javascript | function unsetProperty ({bunsenId, formValue, value}) {
const valueChangeSet = new Map()
valueChangeSet.set(bunsenId, {
value,
type: 'unset'
})
return {
value: unset(formValue, bunsenId),
valueChangeSet
}
} | [
"function",
"unsetProperty",
"(",
"{",
"bunsenId",
",",
"formValue",
",",
"value",
"}",
")",
"{",
"const",
"valueChangeSet",
"=",
"new",
"Map",
"(",
")",
"valueChangeSet",
".",
"set",
"(",
"bunsenId",
",",
"{",
"value",
",",
"type",
":",
"'unset'",
"}",
... | Unset a specific property in the form
@param {String} bunsenId - path to property to unset
@param {Object} formValue - current form value
@param {*} value - property value that triggered unset
@returns {Object} object containing new form value and changeset | [
"Unset",
"a",
"specific",
"property",
"in",
"the",
"form"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/reducer.js#L188-L200 | train |
ciena-blueplanet/bunsen-core | src/reducer.js | function (state, action) {
// Apply coniditions to view cells
let normalized
let view
if (state.unnormalizedModel) {
normalized = normalizeModelAndView({
model: state.unnormalizedModel,
view: action.view
})
view = evaluateViewConditions(normalized.view, state.value)
... | javascript | function (state, action) {
// Apply coniditions to view cells
let normalized
let view
if (state.unnormalizedModel) {
normalized = normalizeModelAndView({
model: state.unnormalizedModel,
view: action.view
})
view = evaluateViewConditions(normalized.view, state.value)
... | [
"function",
"(",
"state",
",",
"action",
")",
"{",
"// Apply coniditions to view cells",
"let",
"normalized",
"let",
"view",
"if",
"(",
"state",
".",
"unnormalizedModel",
")",
"{",
"normalized",
"=",
"normalizeModelAndView",
"(",
"{",
"model",
":",
"state",
".",... | Update the bunsen model
@param {State} state - state to update
@param {Action} action - action
@returns {State} - updated state | [
"Update",
"the",
"bunsen",
"model"
] | 993c67e314e2b75003a1ff4c2f0cb667715562b2 | https://github.com/ciena-blueplanet/bunsen-core/blob/993c67e314e2b75003a1ff4c2f0cb667715562b2/src/reducer.js#L270-L304 | 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.