id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
15,700 | ninsuo/symfony-collection | jquery.collection.js | function (element) {
$(element).find(':input').each(function (index, inputObj) {
putFieldValue(inputObj, getFieldValue(inputObj), true);
});
} | javascript | function (element) {
$(element).find(':input').each(function (index, inputObj) {
putFieldValue(inputObj, getFieldValue(inputObj), true);
});
} | [
"function",
"(",
"element",
")",
"{",
"$",
"(",
"element",
")",
".",
"find",
"(",
"':input'",
")",
".",
"each",
"(",
"function",
"(",
"index",
",",
"inputObj",
")",
"{",
"putFieldValue",
"(",
"inputObj",
",",
"getFieldValue",
"(",
"inputObj",
")",
",",... | sometimes, setting a value will only be made in memory and not physically in the dom; and we need the full dom when we want to duplicate a field. | [
"sometimes",
"setting",
"a",
"value",
"will",
"only",
"be",
"made",
"in",
"memory",
"and",
"not",
"physically",
"in",
"the",
"dom",
";",
"and",
"we",
"need",
"the",
"full",
"dom",
"when",
"we",
"want",
"to",
"duplicate",
"a",
"field",
"."
] | d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0 | https://github.com/ninsuo/symfony-collection/blob/d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0/jquery.collection.js#L262-L266 | |
15,701 | ninsuo/symfony-collection | jquery.collection.js | function (collection, elements, settings, index) {
for (var i = index + 1; i < elements.length; i++) {
elements = swapElements(collection, elements, i - 1, i);
}
return collection.find(settings.elements_selector);
} | javascript | function (collection, elements, settings, index) {
for (var i = index + 1; i < elements.length; i++) {
elements = swapElements(collection, elements, i - 1, i);
}
return collection.find(settings.elements_selector);
} | [
"function",
"(",
"collection",
",",
"elements",
",",
"settings",
",",
"index",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"index",
"+",
"1",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"elements",
"=",
"swapElements",
"(",
"coll... | if we create an element at position 2, all element indexes from 2 to N should be increased. for example, in 0-A 1-B 2-C 3-D, adding X at position 1 will create 0-A 1-X 2-B 3-C 4-D | [
"if",
"we",
"create",
"an",
"element",
"at",
"position",
"2",
"all",
"element",
"indexes",
"from",
"2",
"to",
"N",
"should",
"be",
"increased",
".",
"for",
"example",
"in",
"0",
"-",
"A",
"1",
"-",
"B",
"2",
"-",
"C",
"3",
"-",
"D",
"adding",
"X"... | d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0 | https://github.com/ninsuo/symfony-collection/blob/d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0/jquery.collection.js#L316-L321 | |
15,702 | ninsuo/symfony-collection | jquery.collection.js | function (collection, settings, elements, element, index) {
if (elements.length > settings.min && trueOrUndefined(settings.before_remove(collection, element))) {
var deletion = function () {
var toDelete = element;
if (!settings.preserve_names) {
... | javascript | function (collection, settings, elements, element, index) {
if (elements.length > settings.min && trueOrUndefined(settings.before_remove(collection, element))) {
var deletion = function () {
var toDelete = element;
if (!settings.preserve_names) {
... | [
"function",
"(",
"collection",
",",
"settings",
",",
"elements",
",",
"element",
",",
"index",
")",
"{",
"if",
"(",
"elements",
".",
"length",
">",
"settings",
".",
"min",
"&&",
"trueOrUndefined",
"(",
"settings",
".",
"before_remove",
"(",
"collection",
"... | removes the current element when clicking on a "delete" button and decrease all following indexes from 1 position. | [
"removes",
"the",
"current",
"element",
"when",
"clicking",
"on",
"a",
"delete",
"button",
"and",
"decrease",
"all",
"following",
"indexes",
"from",
"1",
"position",
"."
] | d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0 | https://github.com/ninsuo/symfony-collection/blob/d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0/jquery.collection.js#L598-L628 | |
15,703 | ninsuo/symfony-collection | jquery.collection.js | function (collection, settings, elements, element, oldIndex, newIndex) {
if (1 === Math.abs(newIndex - oldIndex)) {
elements = swapElements(collection, elements, oldIndex, newIndex);
if (!(newIndex - oldIndex > 0 ? trueOrUndefined(settings.after_up(collection, element)) : tru... | javascript | function (collection, settings, elements, element, oldIndex, newIndex) {
if (1 === Math.abs(newIndex - oldIndex)) {
elements = swapElements(collection, elements, oldIndex, newIndex);
if (!(newIndex - oldIndex > 0 ? trueOrUndefined(settings.after_up(collection, element)) : tru... | [
"function",
"(",
"collection",
",",
"settings",
",",
"elements",
",",
"element",
",",
"oldIndex",
",",
"newIndex",
")",
"{",
"if",
"(",
"1",
"===",
"Math",
".",
"abs",
"(",
"newIndex",
"-",
"oldIndex",
")",
")",
"{",
"elements",
"=",
"swapElements",
"(... | move an element from a position to an arbitrary new position | [
"move",
"an",
"element",
"from",
"a",
"position",
"to",
"an",
"arbitrary",
"new",
"position"
] | d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0 | https://github.com/ninsuo/symfony-collection/blob/d5e6cbc7c7dc1f0509631c9bb6094fead0f6c8f0/jquery.collection.js#L665-L691 | |
15,704 | electron-userland/electron-installer-debian | src/dependencies.js | dependenciesForElectron | function dependenciesForElectron (electronVersion) {
return {
depends: common.getDepends(electronVersion, dependencyMap)
.concat(trashRequiresAsBoolean(electronVersion, dependencyMap)),
recommends: [
'pulseaudio | libasound2'
],
suggests: [
'gir1.2-gnomekeyring-1.0',
... | javascript | function dependenciesForElectron (electronVersion) {
return {
depends: common.getDepends(electronVersion, dependencyMap)
.concat(trashRequiresAsBoolean(electronVersion, dependencyMap)),
recommends: [
'pulseaudio | libasound2'
],
suggests: [
'gir1.2-gnomekeyring-1.0',
... | [
"function",
"dependenciesForElectron",
"(",
"electronVersion",
")",
"{",
"return",
"{",
"depends",
":",
"common",
".",
"getDepends",
"(",
"electronVersion",
",",
"dependencyMap",
")",
".",
"concat",
"(",
"trashRequiresAsBoolean",
"(",
"electronVersion",
",",
"depend... | The dependencies for Electron itself, given an Electron version. | [
"The",
"dependencies",
"for",
"Electron",
"itself",
"given",
"an",
"Electron",
"version",
"."
] | 4ad7774f4e172bf11992efe81d9d12704df693d4 | https://github.com/electron-userland/electron-installer-debian/blob/4ad7774f4e172bf11992efe81d9d12704df693d4/src/dependencies.js#L33-L50 |
15,705 | nearform/udaru | packages/udaru-hapi-server/index.js | logMessage | function logMessage (message) {
if (!process.send) {
console.log(message)
} else {
process.send(message)
}
} | javascript | function logMessage (message) {
if (!process.send) {
console.log(message)
} else {
process.send(message)
}
} | [
"function",
"logMessage",
"(",
"message",
")",
"{",
"if",
"(",
"!",
"process",
".",
"send",
")",
"{",
"console",
".",
"log",
"(",
"message",
")",
"}",
"else",
"{",
"process",
".",
"send",
"(",
"message",
")",
"}",
"}"
] | if forked as child, send output message via ipc to parent otherwise output to console | [
"if",
"forked",
"as",
"child",
"send",
"output",
"message",
"via",
"ipc",
"to",
"parent",
"otherwise",
"output",
"to",
"console"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-hapi-server/index.js#L12-L18 |
15,706 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | createTeam | function createTeam (params, opts, cb) {
if (!cb) {
cb = opts
}
if (!opts || typeof opts === 'function') {
opts = {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { createOnly } = opts
const tasks = [
(job, n... | javascript | function createTeam (params, opts, cb) {
if (!cb) {
cb = opts
}
if (!opts || typeof opts === 'function') {
opts = {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { createOnly } = opts
const tasks = [
(job, n... | [
"function",
"createTeam",
"(",
"params",
",",
"opts",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"cb",
")",
"{",
"cb",
"=",
"opts",
"}",
"if",
"(",
"!",
"opts",
"||",
"typeof",
"opts",
"===",
"'function'",
")",
"{",
"opts",
"=",
"{",
"}",
"}",
"let",... | Creates a new team
@param {Object} params { id, name, description, metadata, parentId, organizationId, user } "metadata" optoinal
@param {Object} opts { createOnly }
@param {Function} cb | [
"Creates",
"a",
"new",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L436-L479 |
15,707 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | listTeamPolicies | function listTeamPolicies ({ id, page = 1, limit, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, page, limit, organizationId }, validationRules.listTeamPolicies, function (err) {
if (err) return cb(Boom.badRequest(err))
... | javascript | function listTeamPolicies ({ id, page = 1, limit, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, page, limit, organizationId }, validationRules.listTeamPolicies, function (err) {
if (err) return cb(Boom.badRequest(err))
... | [
"function",
"listTeamPolicies",
"(",
"{",
"id",
",",
"page",
"=",
"1",
",",
"limit",
",",
"organizationId",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
... | Fetch a team's policies
@param {params} params { id, page, limit }
@param {Function} cb | [
"Fetch",
"a",
"team",
"s",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L487-L520 |
15,708 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | readTeam | function readTeam ({ id, organizationId }, cb) {
const job = {
team: {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.applyEachSeries([
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.readTeam, (err) =>... | javascript | function readTeam ({ id, organizationId }, cb) {
const job = {
team: {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.applyEachSeries([
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.readTeam, (err) =>... | [
"function",
"readTeam",
"(",
"{",
"id",
",",
"organizationId",
"}",
",",
"cb",
")",
"{",
"const",
"job",
"=",
"{",
"team",
":",
"{",
"}",
"}",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
... | Fetch specific team data
@param {params} params { id, organizationId }
@param {Function} cb | [
"Fetch",
"specific",
"team",
"data"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L528-L558 |
15,709 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | updateTeam | function updateTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, name, description, metadata, organizationId } = params
Joi.validate({ id, name, description, organizationId, metadata }, Joi.object().keys(validationRules.updateTeam).or('... | javascript | function updateTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, name, description, metadata, organizationId } = params
Joi.validate({ id, name, description, organizationId, metadata }, Joi.object().keys(validationRules.updateTeam).or('... | [
"function",
"updateTeam",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"name",
",",
"desc... | Uodate team data
@param {Object} params {id, name, description, metadata, organizationId } "metadata" optional
@param {Function} cb | [
"Uodate",
"team",
"data"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L565-L595 |
15,710 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | deleteTeam | function deleteTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
db.withTransaction([
(job, next) => {
const { id, organizationId } = params
Joi.validate({ id, organizationId }, validationRules.deleteTeam, (err) => {
... | javascript | function deleteTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
db.withTransaction([
(job, next) => {
const { id, organizationId } = params
Joi.validate({ id, organizationId }, validationRules.deleteTeam, (err) => {
... | [
"function",
"deleteTeam",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"db",
".",
"withTransaction",
"(",
"[",
"(",
... | Delete specific team
@param {Object} params { id, organizationId }
@param {Function} cb [description] | [
"Delete",
"specific",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L603-L633 |
15,711 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | addTeamPolicies | function addTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
Joi.validate({ id, organizationId, policies: params.policies }, validationRules.addTeamPolicies, function (err) {
if (err) return cb... | javascript | function addTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
Joi.validate({ id, organizationId, policies: params.policies }, validationRules.addTeamPolicies, function (err) {
if (err) return cb... | [
"function",
"addTeamPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId",... | Add one or more policies to a team
@param {Object} params { id, organizationId, policies }
@param {Function} cb | [
"Add",
"one",
"or",
"more",
"policies",
"to",
"a",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L731-L753 |
15,712 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | replaceTeamPolicies | function replaceTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId, policies }, validationRules.replaceTeamPo... | javascript | function replaceTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId, policies }, validationRules.replaceTeamPo... | [
"function",
"replaceTeamPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organization... | Replace team poilicies
@param {Object} params { id, organizationId, policies }
@param {Function} cb | [
"Replace",
"team",
"poilicies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L794-L825 |
15,713 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | deleteTeamPolicies | function deleteTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
Joi.validate({ id, organizationId }, validationRules.deleteTeamPolicies, function (err) {
if (err) return cb(Boom.badRequest(err)... | javascript | function deleteTeamPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
Joi.validate({ id, organizationId }, validationRules.deleteTeamPolicies, function (err) {
if (err) return cb(Boom.badRequest(err)... | [
"function",
"deleteTeamPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationI... | Remove all team's policies
@param {Object} params { id, organizationId }
@param {Function} cb | [
"Remove",
"all",
"team",
"s",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L833-L849 |
15,714 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | deleteTeamPolicy | function deleteTeamPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { teamId, organizationId, policyId, instance } = params
Joi.validate({ teamId, organizationId, policyId, instance }, validationRules.deleteTeamPolicy, function (err) {
... | javascript | function deleteTeamPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { teamId, organizationId, policyId, instance } = params
Joi.validate({ teamId, organizationId, policyId, instance }, validationRules.deleteTeamPolicy, function (err) {
... | [
"function",
"deleteTeamPolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"teamId",
",",
"organizatio... | Remove a specific team policy
@param {Object} params { userId, organizationId, policyId, instance } "instance" optional
@param {Function} cb | [
"Remove",
"a",
"specific",
"team",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L857-L873 |
15,715 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | readTeamUsers | function readTeamUsers ({ id, page = 1, limit, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, page, limit, organizationId }, validationRules.readTeamUsers, function (err) {
if (err) return cb(Boom.badRequest(err))
... | javascript | function readTeamUsers ({ id, page = 1, limit, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, page, limit, organizationId }, validationRules.readTeamUsers, function (err) {
if (err) return cb(Boom.badRequest(err))
... | [
"function",
"readTeamUsers",
"(",
"{",
"id",
",",
"page",
"=",
"1",
",",
"limit",
",",
"organizationId",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"... | Fetch the users data from a team
@param {params} params { id, page, limit }
@param {Function} cb | [
"Fetch",
"the",
"users",
"data",
"from",
"a",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L881-L914 |
15,716 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | addUsersToTeam | function addUsersToTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, users, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, users, organizationId }, validationRules.addUsersToTeam, (err) =>... | javascript | function addUsersToTeam (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, users, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, users, organizationId }, validationRules.addUsersToTeam, (err) =>... | [
"function",
"addUsersToTeam",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"users",
",",
... | Add one or more users to a team
@param {Object} params { id, users, organizationId }
@param {Function} cb | [
"Add",
"one",
"or",
"more",
"users",
"to",
"a",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L922-L954 |
15,717 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | deleteTeamMembers | function deleteTeamMembers (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.deleteTeamMembers, (err) => {
... | javascript | function deleteTeamMembers (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.deleteTeamMembers, (err) => {
... | [
"function",
"deleteTeamMembers",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId... | Delete team members
@param {Object} params { id, organizationId }
@param {Function} cb | [
"Delete",
"team",
"members"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L1003-L1033 |
15,718 | nearform/udaru | packages/udaru-core/lib/ops/teamOps.js | search | function search (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
const { organizationId, query, type } = params
Joi.validate({ organizationId, query }, validationRules.searchTeam, function (err) {
if (err) {
return cb(Bo... | javascript | function search (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
const { organizationId, query, type } = params
Joi.validate({ organizationId, query }, validationRules.searchTeam, function (err) {
if (err) {
return cb(Bo... | [
"function",
"search",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
"'data'",
",",
"'total'",
")",
"const",
"{",
"organiza... | Search for team
@param {Object} params { organizationId, query }
@param {Function} cb | [
"Search",
"for",
"team"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/teamOps.js#L1078-L1116 |
15,719 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | readUser | function readUser (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
let user
const tasks = []
tasks.push((next) => {
Joi.validate({ id, organizationId }, validationRules.readUser, (err) => {
... | javascript | function readUser (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
let user
const tasks = []
tasks.push((next) => {
Joi.validate({ id, organizationId }, validationRules.readUser, (err) => {
... | [
"function",
"readUser",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId",
"}",... | Get user details
@param {Object} params { id, organizationId }
@param {Function} cb | [
"Get",
"user",
"details"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L190-L259 |
15,720 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | updateUser | function updateUser (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, name, metadata } = params
Joi.validate({ id, organizationId, name, metadata }, validationRules.updateUser, function (err) {
if (err) return cb(Boom... | javascript | function updateUser (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, name, metadata } = params
Joi.validate({ id, organizationId, name, metadata }, validationRules.updateUser, function (err) {
if (err) return cb(Boom... | [
"function",
"updateUser",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId",
",... | Update user details
@param {Object} params { id, organizationId, name, metadata } "metadata" can be null
@param {Function} cb | [
"Update",
"user",
"details"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L350-L376 |
15,721 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | replaceUserPolicies | function replaceUserPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId, policies }, validationRules.replaceUserPo... | javascript | function replaceUserPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId, policies }, validationRules.replaceUserPo... | [
"function",
"replaceUserPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organization... | Replace user policies
@param {Object} params { id, organizationId, policies }
@param {Function} cb | [
"Replace",
"user",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L384-L421 |
15,722 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | deleteUserPolicy | function deleteUserPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { userId, organizationId, policyId, instance } = params
const tasks = [
(job, next) => {
Joi.validate({ userId, organizationId, policyId, instance }, vali... | javascript | function deleteUserPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { userId, organizationId, policyId, instance } = params
const tasks = [
(job, next) => {
Joi.validate({ userId, organizationId, policyId, instance }, vali... | [
"function",
"deleteUserPolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"userId",
",",
"organizatio... | Remove one user policy
@param {Object} params { userId, organizationId, policyId }
@param {Function} cb | [
"Remove",
"one",
"user",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L557-L588 |
15,723 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | insertUser | function insertUser (client, { id, name, organizationId, metadata }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
id = id || uuidV4()
const sqlQuery = SQL`
INSERT INTO users (
id, name, org_id, metadata
) VALUES (
${id}, ... | javascript | function insertUser (client, { id, name, organizationId, metadata }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
id = id || uuidV4()
const sqlQuery = SQL`
INSERT INTO users (
id, name, org_id, metadata
) VALUES (
${id}, ... | [
"function",
"insertUser",
"(",
"client",
",",
"{",
"id",
",",
"name",
",",
"organizationId",
",",
"metadata",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]"... | Insert a new user into the database
@param {Object} client
@param {String|null} options.id
@param {String} options.name
@param {String} options.organizationId
@param {String} options.metadata (optional)
@param {Function} cb | [
"Insert",
"a",
"new",
"user",
"into",
"the",
"database"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L600-L623 |
15,724 | nearform/udaru | packages/udaru-core/lib/ops/userOps.js | listUserTeams | function listUserTeams ({ id, organizationId, page = 1, limit }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
Joi.validate({ id, organizationId, page, limit }, validationRules.listUserTeams, function (err) {
if (err) return cb(Boom.badReques... | javascript | function listUserTeams ({ id, organizationId, page = 1, limit }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
Joi.validate({ id, organizationId, page, limit }, validationRules.listUserTeams, function (err) {
if (err) return cb(Boom.badReques... | [
"function",
"listUserTeams",
"(",
"{",
"id",
",",
"organizationId",
",",
"page",
"=",
"1",
",",
"limit",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"... | List the teams to which the user belongs to
Does not go recursively to parent teams
@param {Object} params { id, organizationId, limit, page }
@param {Function} cb | [
"List",
"the",
"teams",
"to",
"which",
"the",
"user",
"belongs",
"to",
"Does",
"not",
"go",
"recursively",
"to",
"parent",
"teams"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/userOps.js#L756-L781 |
15,725 | nearform/udaru | packages/udaru-core/lib/ops/authorizeOps.js | batchAuthorization | function batchAuthorization ({ resourceBatch, userId, organizationId, sourceIpAddress, sourcePort }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.waterfall([
function validate (next) {
Joi.validate({ resourceBatch, userId, organizationId },... | javascript | function batchAuthorization ({ resourceBatch, userId, organizationId, sourceIpAddress, sourcePort }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.waterfall([
function validate (next) {
Joi.validate({ resourceBatch, userId, organizationId },... | [
"function",
"batchAuthorization",
"(",
"{",
"resourceBatch",
",",
"userId",
",",
"organizationId",
",",
"sourceIpAddress",
",",
"sourcePort",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
... | Return if a user can perform an action on a certain resource
@param {Object} options { resource, action, userId, }
@param {Function} cb | [
"Return",
"if",
"a",
"user",
"can",
"perform",
"an",
"action",
"on",
"a",
"certain",
"resource"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/authorizeOps.js#L82-L106 |
15,726 | nearform/udaru | packages/udaru-core/lib/ops/authorizeOps.js | listAuthorizationsOnResources | function listAuthorizationsOnResources ({ userId, resources, organizationId, sourceIpAddress, sourcePort }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.waterfall([
function validate (next) {
Joi.validate({ userId, resources, organizationId... | javascript | function listAuthorizationsOnResources ({ userId, resources, organizationId, sourceIpAddress, sourcePort }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
async.waterfall([
function validate (next) {
Joi.validate({ userId, resources, organizationId... | [
"function",
"listAuthorizationsOnResources",
"(",
"{",
"userId",
",",
"resources",
",",
"organizationId",
",",
"sourceIpAddress",
",",
"sourcePort",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
... | List all user's actions on a given list of resources
@param {Object} options { userId, resources }
@param {Function} cb | [
"List",
"all",
"user",
"s",
"actions",
"on",
"a",
"given",
"list",
"of",
"resources"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/authorizeOps.js#L142-L160 |
15,727 | nearform/udaru | packages/udaru-hapi-server/bench/util/loadVolumeData.js | loadUsers | function loadUsers (startId, orgId, teamId, callback) {
// insert users
console.log('inserting users ' + startId + ' to ' + (startId + NUM_USERS_PER_TEAM - 1) + ' into team: ' + teamId)
var userSql = 'INSERT INTO users (id, name, org_id, metadata)\nVALUES\n'
var userTeamSql = 'INSERT INTO team_members (user_id... | javascript | function loadUsers (startId, orgId, teamId, callback) {
// insert users
console.log('inserting users ' + startId + ' to ' + (startId + NUM_USERS_PER_TEAM - 1) + ' into team: ' + teamId)
var userSql = 'INSERT INTO users (id, name, org_id, metadata)\nVALUES\n'
var userTeamSql = 'INSERT INTO team_members (user_id... | [
"function",
"loadUsers",
"(",
"startId",
",",
"orgId",
",",
"teamId",
",",
"callback",
")",
"{",
"// insert users",
"console",
".",
"log",
"(",
"'inserting users '",
"+",
"startId",
"+",
"' to '",
"+",
"(",
"startId",
"+",
"NUM_USERS_PER_TEAM",
"-",
"1",
")"... | insert users and add them to teams in batches | [
"insert",
"users",
"and",
"add",
"them",
"to",
"teams",
"in",
"batches"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-hapi-server/bench/util/loadVolumeData.js#L157-L194 |
15,728 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | readPolicyVariables | function readPolicyVariables ({ id, organizationId, type }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, type }, validationRules.readPolicyVariables, function (err) {
if (err) return cb(Boom.badRequest(err))
cons... | javascript | function readPolicyVariables ({ id, organizationId, type }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, type }, validationRules.readPolicyVariables, function (err) {
if (err) return cb(Boom.badRequest(err))
cons... | [
"function",
"readPolicyVariables",
"(",
"{",
"id",
",",
"organizationId",
",",
"type",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
... | fetch specific policy variables
@param {Object} params { id, organizationId, type } "type" is optional, defaults to organization policies
@param {Function} cb | [
"fetch",
"specific",
"policy",
"variables"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L227-L269 |
15,729 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | listPolicyInstances | function listPolicyInstances ({ id, organizationId, type }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, type }, validationRules.listPolicyInstances, function (err) {
if (err) return cb(Boom.badRequest(err))
cons... | javascript | function listPolicyInstances ({ id, organizationId, type }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, type }, validationRules.listPolicyInstances, function (err) {
if (err) return cb(Boom.badRequest(err))
cons... | [
"function",
"listPolicyInstances",
"(",
"{",
"id",
",",
"organizationId",
",",
"type",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
... | list policy instances in their respective entities
@param {Object} params { id, organizationId, type } "type" is optional, defaults to organization policies
@param {Function} cb | [
"list",
"policy",
"instances",
"in",
"their",
"respective",
"entities"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L277-L315 |
15,730 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | createPolicy | function createPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, version, name, organizationId, statements } = params
Joi.validate({ id, version, name, organizationId, statements }, validationRules.createPolicy, function (err) {
... | javascript | function createPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, version, name, organizationId, statements } = params
Joi.validate({ id, version, name, organizationId, statements }, validationRules.createPolicy, function (err) {
... | [
"function",
"createPolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"version",
",",
... | Creates a new policy
@param {Object} params { id, version, name, organizationId, statements }
@param {Function} cb | [
"Creates",
"a",
"new",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L323-L346 |
15,731 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | updatePolicy | function updatePolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, version, name, statements } = params
Joi.validate({ id, organizationId, version, name, statements }, validationRules.updatePolicy, function (err) {
... | javascript | function updatePolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId, version, name, statements } = params
Joi.validate({ id, organizationId, version, name, statements }, validationRules.updatePolicy, function (err) {
... | [
"function",
"updatePolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId",
... | Update policy values
@param {Object} params { id, organizationId, version, name, statements }
@param {Function} cb | [
"Update",
"policy",
"values"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L354-L383 |
15,732 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | deletePolicy | function deletePolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.deletePolicy, (err) => {
if ... | javascript | function deletePolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, organizationId } = params
const tasks = [
(job, next) => {
Joi.validate({ id, organizationId }, validationRules.deletePolicy, (err) => {
if ... | [
"function",
"deletePolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"organizationId",
... | Delete a specific policy
@param {Object} params { id, organizationId }
@param {Function} cb | [
"Delete",
"a",
"specific",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L391-L421 |
15,733 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | listAllUserPolicies | function listAllUserPolicies ({ userId, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const rootOrgId = config.get('authorization.superUser.organization.id')
const sql = SQL`
WITH user_teams AS (
SELECT id FROM teams WHERE ... | javascript | function listAllUserPolicies ({ userId, organizationId }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const rootOrgId = config.get('authorization.superUser.organization.id')
const sql = SQL`
WITH user_teams AS (
SELECT id FROM teams WHERE ... | [
"function",
"listAllUserPolicies",
"(",
"{",
"userId",
",",
"organizationId",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"cons... | List all user policies
@param {Object} params { userId, organizationId }
@param {Function} cb | [
"List",
"all",
"user",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L429-L545 |
15,734 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | readSharedPolicy | function readSharedPolicy ({ id }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id }, validationRules.readSharedPolicy, function (err) {
if (err) return cb(Boom.badRequest(err))
const sqlQuery = SQL`
SELECT *
FR... | javascript | function readSharedPolicy ({ id }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id }, validationRules.readSharedPolicy, function (err) {
if (err) return cb(Boom.badRequest(err))
const sqlQuery = SQL`
SELECT *
FR... | [
"function",
"readSharedPolicy",
"(",
"{",
"id",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"Joi",
".",
"validate",
"(",
"{... | fetch specific shared policy
@param {Object} params { id }
@param {Function} cb | [
"fetch",
"specific",
"shared",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L700-L722 |
15,735 | nearform/udaru | packages/udaru-core/lib/ops/policyOps.js | createSharedPolicy | function createSharedPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate(params, validationRules.createSharedPolicy, function (err) {
if (err) return cb(Boom.badRequest(err))
const { id, version, name, statements } = params
... | javascript | function createSharedPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate(params, validationRules.createSharedPolicy, function (err) {
if (err) return cb(Boom.badRequest(err))
const { id, version, name, statements } = params
... | [
"function",
"createSharedPolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"Joi",
".",
"validate",
"(",
"params",
... | Creates a new shared policy
@param {Object} params { id, version, name, statements }
@param {Function} cb | [
"Creates",
"a",
"new",
"shared",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/policyOps.js#L730-L753 |
15,736 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | insertOrgAdminUser | function insertOrgAdminUser (job, next) {
if (job.user) {
const { id, name } = job.user
const { id: organizationId } = job.organization
userOps.insertUser(job.client, { id, name, organizationId }, (err, res) => {
if (err) return next(err)
job.user.id = res.rows[0].id
user... | javascript | function insertOrgAdminUser (job, next) {
if (job.user) {
const { id, name } = job.user
const { id: organizationId } = job.organization
userOps.insertUser(job.client, { id, name, organizationId }, (err, res) => {
if (err) return next(err)
job.user.id = res.rows[0].id
user... | [
"function",
"insertOrgAdminUser",
"(",
"job",
",",
"next",
")",
"{",
"if",
"(",
"job",
".",
"user",
")",
"{",
"const",
"{",
"id",
",",
"name",
"}",
"=",
"job",
".",
"user",
"const",
"{",
"id",
":",
"organizationId",
"}",
"=",
"job",
".",
"organizat... | Insert a new user and attach to it the organization admin policy
@param {Object} job
@param {Function} next | [
"Insert",
"a",
"new",
"user",
"and",
"attach",
"to",
"it",
"the",
"organization",
"admin",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L175-L191 |
15,737 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | list | function list ({ limit, page }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
Joi.validate({ limit, page }, validationRules.list, (err) => {
if (err) return cb(Boom.badRequest(err))
const sqlQuery = SQL`
WITH total AS (
... | javascript | function list ({ limit, page }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify('data', 'total')
Joi.validate({ limit, page }, validationRules.list, (err) => {
if (err) return cb(Boom.badRequest(err))
const sqlQuery = SQL`
WITH total AS (
... | [
"function",
"list",
"(",
"{",
"limit",
",",
"page",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
"'data'",
",",
"'total'",
")",
... | Fetch all organizations
@param {Object} params must contain both `limit` and `page` for pagination. Page is 1-indexed.
@param {Function} cb | [
"Fetch",
"all",
"organizations"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L208-L240 |
15,738 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | readById | function readById (id, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
let organization
const tasks = []
tasks.push((next) => {
Joi.validate(id, validationRules.readById, (err) => {
if (err) return next(Boom.badRequest(err))
n... | javascript | function readById (id, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
let organization
const tasks = []
tasks.push((next) => {
Joi.validate(id, validationRules.readById, (err) => {
if (err) return next(Boom.badRequest(err))
n... | [
"function",
"readById",
"(",
"id",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"let",
"organization",
"const",
"tasks",
"=",
"[",
... | Fetch data for an organization
@param {String} id
@param {Function} cb | [
"Fetch",
"data",
"for",
"an",
"organization"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L248-L299 |
15,739 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | create | function create (params, opts, cb) {
if (!cb) {
cb = opts
}
if (!opts || typeof opts === 'function') {
opts = {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { createOnly } = opts
const tasks = [
(job, next... | javascript | function create (params, opts, cb) {
if (!cb) {
cb = opts
}
if (!opts || typeof opts === 'function') {
opts = {}
}
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { createOnly } = opts
const tasks = [
(job, next... | [
"function",
"create",
"(",
"params",
",",
"opts",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"cb",
")",
"{",
"cb",
"=",
"opts",
"}",
"if",
"(",
"!",
"opts",
"||",
"typeof",
"opts",
"===",
"'function'",
")",
"{",
"opts",
"=",
"{",
"}",
"}",
"let",
"... | Creates a new organization
@param {Object} params {id, name, description, metadata, user} "metadata" optional
@param {Object} opts { createOnly }
@param {Function} cb | [
"Creates",
"a",
"new",
"organization"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L308-L358 |
15,740 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | replaceOrganizationPolicies | function replaceOrganizationPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, policies }, validationRules.replaceOrganizationPolicies, (err) =>... | javascript | function replaceOrganizationPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, policies } = params
const tasks = [
(job, next) => {
Joi.validate({ id, policies }, validationRules.replaceOrganizationPolicies, (err) =>... | [
"function",
"replaceOrganizationPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
"poli... | Replace organization policies
@param {Object} params { id, policies }
@param {Function} cb | [
"Replace",
"organization",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L439-L475 |
15,741 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | deleteOrganizationAttachedPolicies | function deleteOrganizationAttachedPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id } = params
const tasks = [
(job, next) => {
Joi.validate({ id }, validationRules.deleteOrganizationPolicies, (err) => {
... | javascript | function deleteOrganizationAttachedPolicies (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id } = params
const tasks = [
(job, next) => {
Joi.validate({ id }, validationRules.deleteOrganizationPolicies, (err) => {
... | [
"function",
"deleteOrganizationAttachedPolicies",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
"}",
... | Rmove all organization's attached policies
@param {Object} params { id, organizationId }
@param {Function} cb | [
"Rmove",
"all",
"organization",
"s",
"attached",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L572-L600 |
15,742 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | deleteOrganizationAttachedPolicy | function deleteOrganizationAttachedPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, policyId, instance } = params
const tasks = [
(job, next) => {
Joi.validate({ id, policyId, instance }, validationRules.deleteOrgani... | javascript | function deleteOrganizationAttachedPolicy (params, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
const { id, policyId, instance } = params
const tasks = [
(job, next) => {
Joi.validate({ id, policyId, instance }, validationRules.deleteOrgani... | [
"function",
"deleteOrganizationAttachedPolicy",
"(",
"params",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",
"]",
"=",
"asyncify",
"(",
")",
"const",
"{",
"id",
",",
... | Remove one organization policy
@param {Object} params { id, policyId, instance } "instance" optional
@param {Function} cb | [
"Remove",
"one",
"organization",
"policy"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L608-L638 |
15,743 | nearform/udaru | packages/udaru-core/lib/ops/organizationOps.js | listOrganizationPolicies | function listOrganizationPolicies ({ id, organizationId, page = 1, limit }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, page, limit }, validationRules.listOrganizationPolicies, function (err) {
if (err) return cb(Boom.ba... | javascript | function listOrganizationPolicies ({ id, organizationId, page = 1, limit }, cb) {
let promise = null
if (typeof cb !== 'function') [promise, cb] = asyncify()
Joi.validate({ id, organizationId, page, limit }, validationRules.listOrganizationPolicies, function (err) {
if (err) return cb(Boom.ba... | [
"function",
"listOrganizationPolicies",
"(",
"{",
"id",
",",
"organizationId",
",",
"page",
"=",
"1",
",",
"limit",
"}",
",",
"cb",
")",
"{",
"let",
"promise",
"=",
"null",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"[",
"promise",
",",
"cb",... | List an organizations policies
@param {Object} params { id, organizationId, limit, page }
@param {Function} cb | [
"List",
"an",
"organizations",
"policies"
] | 1e69f8e2d7e5734d05b7954fa4b86801e96d17b2 | https://github.com/nearform/udaru/blob/1e69f8e2d7e5734d05b7954fa4b86801e96d17b2/packages/udaru-core/lib/ops/organizationOps.js#L712-L743 |
15,744 | skonves/express-http-context | index.js | set | function set(key, value) {
if (ns && ns.active) {
return ns.set(key, value);
}
} | javascript | function set(key, value) {
if (ns && ns.active) {
return ns.set(key, value);
}
} | [
"function",
"set",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"ns",
"&&",
"ns",
".",
"active",
")",
"{",
"return",
"ns",
".",
"set",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | Adds a value to the context by key. If the key already exists, its value will be overwritten. No value will persist if the context has not yet been initialized.
@param {string} key
@param {*} value | [
"Adds",
"a",
"value",
"to",
"the",
"context",
"by",
"key",
".",
"If",
"the",
"key",
"already",
"exists",
"its",
"value",
"will",
"be",
"overwritten",
".",
"No",
"value",
"will",
"persist",
"if",
"the",
"context",
"has",
"not",
"yet",
"been",
"initialized... | e390acadb41219cc5c763b41cd5e959758594ef5 | https://github.com/skonves/express-http-context/blob/e390acadb41219cc5c763b41cd5e959758594ef5/index.js#L28-L32 |
15,745 | devote/HTML5-History-API | history.js | function(basepath, type, redirect) {
settings["basepath"] = ('' + (basepath == null ? settings["basepath"] : basepath))
.replace(/(?:^|\/)[^\/]*$/, '/');
settings["type"] = type == null ? settings["type"] : type;
settings["redirect"] = redirect == null ? settings["redirect"] : !!redirect;
... | javascript | function(basepath, type, redirect) {
settings["basepath"] = ('' + (basepath == null ? settings["basepath"] : basepath))
.replace(/(?:^|\/)[^\/]*$/, '/');
settings["type"] = type == null ? settings["type"] : type;
settings["redirect"] = redirect == null ? settings["redirect"] : !!redirect;
... | [
"function",
"(",
"basepath",
",",
"type",
",",
"redirect",
")",
"{",
"settings",
"[",
"\"basepath\"",
"]",
"=",
"(",
"''",
"+",
"(",
"basepath",
"==",
"null",
"?",
"settings",
"[",
"\"basepath\"",
"]",
":",
"basepath",
")",
")",
".",
"replace",
"(",
... | Setting library initialization
@param {null|String} [basepath] The base path to the site; defaults to the root "/".
@param {null|String} [type] Substitute the string after the anchor; by default "/".
@param {null|Boolean} [redirect] Enable link translation. | [
"Setting",
"library",
"initialization"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L149-L154 | |
15,746 | devote/HTML5-History-API | history.js | function(state, title, url) {
var t = document.title;
if (lastTitle != null) {
document.title = lastTitle;
}
historyPushState && fastFixChrome(historyPushState, arguments);
changeState(state, url);
document.title = t;
lastTitle = title;
} | javascript | function(state, title, url) {
var t = document.title;
if (lastTitle != null) {
document.title = lastTitle;
}
historyPushState && fastFixChrome(historyPushState, arguments);
changeState(state, url);
document.title = t;
lastTitle = title;
} | [
"function",
"(",
"state",
",",
"title",
",",
"url",
")",
"{",
"var",
"t",
"=",
"document",
".",
"title",
";",
"if",
"(",
"lastTitle",
"!=",
"null",
")",
"{",
"document",
".",
"title",
"=",
"lastTitle",
";",
"}",
"historyPushState",
"&&",
"fastFixChrome... | The method adds a state object entry
to the history.
@namespace history
@param {Object} state
@param {string} title
@param {string} [url] | [
"The",
"method",
"adds",
"a",
"state",
"object",
"entry",
"to",
"the",
"history",
"."
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L189-L198 | |
15,747 | devote/HTML5-History-API | history.js | function(state, title, url) {
var t = document.title;
if (lastTitle != null) {
document.title = lastTitle;
}
delete stateStorage[windowLocation.href];
historyReplaceState && fastFixChrome(historyReplaceState, arguments);
changeState(state, url, true);
document.title = t... | javascript | function(state, title, url) {
var t = document.title;
if (lastTitle != null) {
document.title = lastTitle;
}
delete stateStorage[windowLocation.href];
historyReplaceState && fastFixChrome(historyReplaceState, arguments);
changeState(state, url, true);
document.title = t... | [
"function",
"(",
"state",
",",
"title",
",",
"url",
")",
"{",
"var",
"t",
"=",
"document",
".",
"title",
";",
"if",
"(",
"lastTitle",
"!=",
"null",
")",
"{",
"document",
".",
"title",
"=",
"lastTitle",
";",
"}",
"delete",
"stateStorage",
"[",
"window... | The method updates the state object,
title, and optionally the URL of the
current entry in the history.
@namespace history
@param {Object} state
@param {string} title
@param {string} [url] | [
"The",
"method",
"updates",
"the",
"state",
"object",
"title",
"and",
"optionally",
"the",
"URL",
"of",
"the",
"current",
"entry",
"in",
"the",
"history",
"."
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L209-L219 | |
15,748 | devote/HTML5-History-API | history.js | function(url) {
if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
changeState(null, url);
} else {
windowLocation.assign(url);
}
} | javascript | function(url) {
if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
changeState(null, url);
} else {
windowLocation.assign(url);
}
} | [
"function",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"isSupportHistoryAPI",
"&&",
"(",
"''",
"+",
"url",
")",
".",
"indexOf",
"(",
"'#'",
")",
"===",
"0",
")",
"{",
"changeState",
"(",
"null",
",",
"url",
")",
";",
"}",
"else",
"{",
"windowLocation",
... | Navigates to the given page.
@namespace history.location | [
"Navigates",
"to",
"the",
"given",
"page",
"."
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L270-L276 | |
15,749 | devote/HTML5-History-API | history.js | function(url) {
if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
changeState(null, url, true);
} else {
windowLocation.replace(url);
}
} | javascript | function(url) {
if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
changeState(null, url, true);
} else {
windowLocation.replace(url);
}
} | [
"function",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"isSupportHistoryAPI",
"&&",
"(",
"''",
"+",
"url",
")",
".",
"indexOf",
"(",
"'#'",
")",
"===",
"0",
")",
"{",
"changeState",
"(",
"null",
",",
"url",
",",
"true",
")",
";",
"}",
"else",
"{",
"... | Removes the current page from
the session history and navigates
to the given page.
@namespace history.location | [
"Removes",
"the",
"current",
"page",
"from",
"the",
"session",
"history",
"and",
"navigates",
"to",
"the",
"given",
"page",
"."
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L292-L298 | |
15,750 | devote/HTML5-History-API | history.js | parseURL | function parseURL(href, isWindowLocation, isNotAPI) {
var re = /(?:([a-zA-Z0-9\-]+\:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/;
if (href != null && href !== '' && !isWindowLocation) {
var current = parseURL(),
base = document.getElementsByTagName('base... | javascript | function parseURL(href, isWindowLocation, isNotAPI) {
var re = /(?:([a-zA-Z0-9\-]+\:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/;
if (href != null && href !== '' && !isWindowLocation) {
var current = parseURL(),
base = document.getElementsByTagName('base... | [
"function",
"parseURL",
"(",
"href",
",",
"isWindowLocation",
",",
"isNotAPI",
")",
"{",
"var",
"re",
"=",
"/",
"(?:([a-zA-Z0-9\\-]+\\:))?(?:\\/\\/(?:[^@]*@)?([^\\/:\\?#]+)(?::([0-9]+))?)?([^\\?#]*)(?:(\\?[^#]+)|\\?)?(?:(#.*))?",
"/",
";",
"if",
"(",
"href",
"!=",
"null",
... | Prepares a parts of the current or specified reference for later use in the library
@param {string} [href]
@param {boolean} [isWindowLocation]
@param {boolean} [isNotAPI]
@return {Object} | [
"Prepares",
"a",
"parts",
"of",
"the",
"current",
"or",
"specified",
"reference",
"for",
"later",
"use",
"in",
"the",
"library"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L417-L480 |
15,751 | devote/HTML5-History-API | history.js | maybeBindToGlobal | function maybeBindToGlobal(func) {
if (func && global &&
global['EventTarget'] &&
typeof global['EventTarget'].prototype.addEventListener === 'function' &&
typeof func.bind === 'function') {
return func.bind(global);
}
return func;
} | javascript | function maybeBindToGlobal(func) {
if (func && global &&
global['EventTarget'] &&
typeof global['EventTarget'].prototype.addEventListener === 'function' &&
typeof func.bind === 'function') {
return func.bind(global);
}
return func;
} | [
"function",
"maybeBindToGlobal",
"(",
"func",
")",
"{",
"if",
"(",
"func",
"&&",
"global",
"&&",
"global",
"[",
"'EventTarget'",
"]",
"&&",
"typeof",
"global",
"[",
"'EventTarget'",
"]",
".",
"prototype",
".",
"addEventListener",
"===",
"'function'",
"&&",
"... | This method attempts to bind a function to global.
@param {Function} [func] The function to be bound
@return {Function} Returns the bound function or func | [
"This",
"method",
"attempts",
"to",
"bind",
"a",
"function",
"to",
"global",
"."
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L508-L516 |
15,752 | devote/HTML5-History-API | history.js | storageInitialize | function storageInitialize() {
var sessionStorage;
/**
* sessionStorage throws error when cookies are disabled
* Chrome content settings when running the site in a Facebook IFrame.
* see: https://github.com/devote/HTML5-History-API/issues/34
* and: http://stackoverflow.com/a/12976988/669360
... | javascript | function storageInitialize() {
var sessionStorage;
/**
* sessionStorage throws error when cookies are disabled
* Chrome content settings when running the site in a Facebook IFrame.
* see: https://github.com/devote/HTML5-History-API/issues/34
* and: http://stackoverflow.com/a/12976988/669360
... | [
"function",
"storageInitialize",
"(",
")",
"{",
"var",
"sessionStorage",
";",
"/**\n * sessionStorage throws error when cookies are disabled\n * Chrome content settings when running the site in a Facebook IFrame.\n * see: https://github.com/devote/HTML5-History-API/issues/34\n * and:... | Initializing storage for the custom state's object | [
"Initializing",
"storage",
"for",
"the",
"custom",
"state",
"s",
"object"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L521-L561 |
15,753 | devote/HTML5-History-API | history.js | prepareDescriptorsForObject | function prepareDescriptorsForObject(object, prop, descriptor) {
descriptor = descriptor || {};
// the default for the object 'location' is the standard object 'window.location'
object = object === locationDescriptors ? windowLocation : object;
// setter for object properties
descriptor.set = (descr... | javascript | function prepareDescriptorsForObject(object, prop, descriptor) {
descriptor = descriptor || {};
// the default for the object 'location' is the standard object 'window.location'
object = object === locationDescriptors ? windowLocation : object;
// setter for object properties
descriptor.set = (descr... | [
"function",
"prepareDescriptorsForObject",
"(",
"object",
",",
"prop",
",",
"descriptor",
")",
"{",
"descriptor",
"=",
"descriptor",
"||",
"{",
"}",
";",
"// the default for the object 'location' is the standard object 'window.location'",
"object",
"=",
"object",
"===",
"... | Adds the missing property in descriptor
@param {Object} object An object that stores values
@param {String} prop Name of the property in the object
@param {Object|null} descriptor Descriptor
@return {Object} Returns the generated descriptor | [
"Adds",
"the",
"missing",
"property",
"in",
"descriptor"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L714-L727 |
15,754 | devote/HTML5-History-API | history.js | firePopState | function firePopState() {
var o = document.createEvent ? document.createEvent('Event') : document.createEventObject();
if (o.initEvent) {
o.initEvent('popstate', false, false);
} else {
o.type = 'popstate';
}
o.state = historyObject.state;
// send a newly created events to be process... | javascript | function firePopState() {
var o = document.createEvent ? document.createEvent('Event') : document.createEventObject();
if (o.initEvent) {
o.initEvent('popstate', false, false);
} else {
o.type = 'popstate';
}
o.state = historyObject.state;
// send a newly created events to be process... | [
"function",
"firePopState",
"(",
")",
"{",
"var",
"o",
"=",
"document",
".",
"createEvent",
"?",
"document",
".",
"createEvent",
"(",
"'Event'",
")",
":",
"document",
".",
"createEventObject",
"(",
")",
";",
"if",
"(",
"o",
".",
"initEvent",
")",
"{",
... | dispatch current state event | [
"dispatch",
"current",
"state",
"event"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L818-L828 |
15,755 | devote/HTML5-History-API | history.js | changeState | function changeState(state, url, replace, lastURLValue) {
if (!isSupportHistoryAPI) {
// if not used implementation history.location
if (isUsedHistoryLocationFlag === 0) isUsedHistoryLocationFlag = 2;
// normalization url
var urlObject = parseURL(url, isUsedHistoryLocationFlag === 2 && ('' +... | javascript | function changeState(state, url, replace, lastURLValue) {
if (!isSupportHistoryAPI) {
// if not used implementation history.location
if (isUsedHistoryLocationFlag === 0) isUsedHistoryLocationFlag = 2;
// normalization url
var urlObject = parseURL(url, isUsedHistoryLocationFlag === 2 && ('' +... | [
"function",
"changeState",
"(",
"state",
",",
"url",
",",
"replace",
",",
"lastURLValue",
")",
"{",
"if",
"(",
"!",
"isSupportHistoryAPI",
")",
"{",
"// if not used implementation history.location",
"if",
"(",
"isUsedHistoryLocationFlag",
"===",
"0",
")",
"isUsedHis... | Change the data of the current history for HTML4 browsers
@param {Object} state
@param {string} [url]
@param {Boolean} [replace]
@param {string} [lastURLValue]
@return void | [
"Change",
"the",
"data",
"of",
"the",
"current",
"history",
"for",
"HTML4",
"browsers"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L849-L874 |
15,756 | devote/HTML5-History-API | history.js | onHashChange | function onHashChange(event) {
// https://github.com/devote/HTML5-History-API/issues/46
var fireNow = lastURL;
// new value to lastURL
lastURL = windowLocation.href;
// if not empty fireNow, otherwise skipped the current handler event
if (fireNow) {
// if checkUrlForPopState equal current ... | javascript | function onHashChange(event) {
// https://github.com/devote/HTML5-History-API/issues/46
var fireNow = lastURL;
// new value to lastURL
lastURL = windowLocation.href;
// if not empty fireNow, otherwise skipped the current handler event
if (fireNow) {
// if checkUrlForPopState equal current ... | [
"function",
"onHashChange",
"(",
"event",
")",
"{",
"// https://github.com/devote/HTML5-History-API/issues/46",
"var",
"fireNow",
"=",
"lastURL",
";",
"// new value to lastURL",
"lastURL",
"=",
"windowLocation",
".",
"href",
";",
"// if not empty fireNow, otherwise skipped the ... | Event handler function changes the hash in the address bar
@param {Event} event
@return void | [
"Event",
"handler",
"function",
"changes",
"the",
"hash",
"in",
"the",
"address",
"bar"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L882-L910 |
15,757 | devote/HTML5-History-API | history.js | onLoad | function onLoad(noScroll) {
// Get rid of the events popstate when the first loading a document in the webkit browsers
setTimeout(function() {
// hang up the event handler for the built-in popstate event in the browser
addEvent('popstate', function(e) {
// set the current url, that suppress ... | javascript | function onLoad(noScroll) {
// Get rid of the events popstate when the first loading a document in the webkit browsers
setTimeout(function() {
// hang up the event handler for the built-in popstate event in the browser
addEvent('popstate', function(e) {
// set the current url, that suppress ... | [
"function",
"onLoad",
"(",
"noScroll",
")",
"{",
"// Get rid of the events popstate when the first loading a document in the webkit browsers",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"// hang up the event handler for the built-in popstate event in the browser",
"addEvent",
"(",
... | The event handler is fully loaded document
@param {*} [noScroll]
@return void | [
"The",
"event",
"handler",
"is",
"fully",
"loaded",
"document"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L918-L943 |
15,758 | devote/HTML5-History-API | history.js | onAnchorClick | function onAnchorClick(e) {
var event = e || global.event;
var target = anchorTarget(event.target || event.srcElement);
var defaultPrevented = "defaultPrevented" in event ? event['defaultPrevented'] : event.returnValue === false;
if (target && target.nodeName === "A" && !defaultPrevented) {
var cu... | javascript | function onAnchorClick(e) {
var event = e || global.event;
var target = anchorTarget(event.target || event.srcElement);
var defaultPrevented = "defaultPrevented" in event ? event['defaultPrevented'] : event.returnValue === false;
if (target && target.nodeName === "A" && !defaultPrevented) {
var cu... | [
"function",
"onAnchorClick",
"(",
"e",
")",
"{",
"var",
"event",
"=",
"e",
"||",
"global",
".",
"event",
";",
"var",
"target",
"=",
"anchorTarget",
"(",
"event",
".",
"target",
"||",
"event",
".",
"srcElement",
")",
";",
"var",
"defaultPrevented",
"=",
... | Handles anchor elements with a hash fragment for non-HTML5 browsers
@param {Event} e | [
"Handles",
"anchor",
"elements",
"with",
"a",
"hash",
"fragment",
"for",
"non",
"-",
"HTML5",
"browsers"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L963-L983 |
15,759 | devote/HTML5-History-API | history.js | scrollToAnchorId | function scrollToAnchorId(hash) {
var target = document.getElementById(hash = (hash || '').replace(/^#/, ''));
if (target && target.id === hash && target.nodeName === "A") {
var rect = target.getBoundingClientRect();
global.scrollTo((documentElement.scrollLeft || 0), rect.top + (documentElement.scro... | javascript | function scrollToAnchorId(hash) {
var target = document.getElementById(hash = (hash || '').replace(/^#/, ''));
if (target && target.id === hash && target.nodeName === "A") {
var rect = target.getBoundingClientRect();
global.scrollTo((documentElement.scrollLeft || 0), rect.top + (documentElement.scro... | [
"function",
"scrollToAnchorId",
"(",
"hash",
")",
"{",
"var",
"target",
"=",
"document",
".",
"getElementById",
"(",
"hash",
"=",
"(",
"hash",
"||",
"''",
")",
".",
"replace",
"(",
"/",
"^#",
"/",
",",
"''",
")",
")",
";",
"if",
"(",
"target",
"&&"... | Scroll page to current anchor in url-hash
@param hash | [
"Scroll",
"page",
"to",
"current",
"anchor",
"in",
"url",
"-",
"hash"
] | 2cad95c15985c7e7ba7091ff80d894f63a3c3c03 | https://github.com/devote/HTML5-History-API/blob/2cad95c15985c7e7ba7091ff80d894f63a3c3c03/history.js#L990-L997 |
15,760 | catamphetamine/webpack-isomorphic-tools | source/plugin/write assets.js | get_assets | function get_assets(name, extension = 'js')
{
let chunk = json.assetsByChunkName[name]
// a chunk could be a string or an array, so make sure it is an array
if (!(Array.isArray(chunk)))
{
chunk = [chunk]
}
return chunk
// filter by extension
.filter(name => path.extname(extract_path(name)) === `... | javascript | function get_assets(name, extension = 'js')
{
let chunk = json.assetsByChunkName[name]
// a chunk could be a string or an array, so make sure it is an array
if (!(Array.isArray(chunk)))
{
chunk = [chunk]
}
return chunk
// filter by extension
.filter(name => path.extname(extract_path(name)) === `... | [
"function",
"get_assets",
"(",
"name",
",",
"extension",
"=",
"'js'",
")",
"{",
"let",
"chunk",
"=",
"json",
".",
"assetsByChunkName",
"[",
"name",
"]",
"// a chunk could be a string or an array, so make sure it is an array",
"if",
"(",
"!",
"(",
"Array",
".",
"is... | gets asset paths by name and extension of their chunk | [
"gets",
"asset",
"paths",
"by",
"name",
"and",
"extension",
"of",
"their",
"chunk"
] | 59aa50fbde327ec0921a9acd370868851260a4e0 | https://github.com/catamphetamine/webpack-isomorphic-tools/blob/59aa50fbde327ec0921a9acd370868851260a4e0/source/plugin/write assets.js#L144-L159 |
15,761 | catamphetamine/webpack-isomorphic-tools | source/index.js | wait_for | function wait_for(condition, proceed)
{
function check()
{
// if the condition is met, then proceed
if (condition())
{
return proceed()
}
message_timer += check_interval
if (message_timer >= message_interval)
{
message_timer = 0
tools.log.debug(`(${tools.webpack_ass... | javascript | function wait_for(condition, proceed)
{
function check()
{
// if the condition is met, then proceed
if (condition())
{
return proceed()
}
message_timer += check_interval
if (message_timer >= message_interval)
{
message_timer = 0
tools.log.debug(`(${tools.webpack_ass... | [
"function",
"wait_for",
"(",
"condition",
",",
"proceed",
")",
"{",
"function",
"check",
"(",
")",
"{",
"// if the condition is met, then proceed",
"if",
"(",
"condition",
"(",
")",
")",
"{",
"return",
"proceed",
"(",
")",
"}",
"message_timer",
"+=",
"check_in... | waits for condition to be met, then proceeds | [
"waits",
"for",
"condition",
"to",
"be",
"met",
"then",
"proceeds"
] | 59aa50fbde327ec0921a9acd370868851260a4e0 | https://github.com/catamphetamine/webpack-isomorphic-tools/blob/59aa50fbde327ec0921a9acd370868851260a4e0/source/index.js#L764-L788 |
15,762 | catamphetamine/webpack-isomorphic-tools | source/tools/log.js | generate_log_message | function generate_log_message(parameters)
{
// преобразовать все аргументы функции в текстовый вид
return parameters.map(argument =>
{
// преобразование объектов в строку
if (typeof argument === 'object')
{
// для ошибок - распечатывать стек вызовов
if (argument instanceof Error)
{
return argument... | javascript | function generate_log_message(parameters)
{
// преобразовать все аргументы функции в текстовый вид
return parameters.map(argument =>
{
// преобразование объектов в строку
if (typeof argument === 'object')
{
// для ошибок - распечатывать стек вызовов
if (argument instanceof Error)
{
return argument... | [
"function",
"generate_log_message",
"(",
"parameters",
")",
"{",
"// преобразовать все аргументы функции в текстовый вид",
"return",
"parameters",
".",
"map",
"(",
"argument",
"=>",
"{",
"// преобразование объектов в строку",
"if",
"(",
"typeof",
"argument",
"===",
"'object... | transforms arguments to text | [
"transforms",
"arguments",
"to",
"text"
] | 59aa50fbde327ec0921a9acd370868851260a4e0 | https://github.com/catamphetamine/webpack-isomorphic-tools/blob/59aa50fbde327ec0921a9acd370868851260a4e0/source/tools/log.js#L51-L85 |
15,763 | catamphetamine/webpack-isomorphic-tools | source/common.js | alias | function alias(path, aliases)
{
// if it's a path to a file - don't interfere
if (!is_package_path(path))
{
return
}
// extract module name from the path
const slash_index = path.indexOf('/')
const module_name = slash_index >= 0 ? path.substring(0, slash_index) : path
const rest = slash_index >= 0 ? path.sub... | javascript | function alias(path, aliases)
{
// if it's a path to a file - don't interfere
if (!is_package_path(path))
{
return
}
// extract module name from the path
const slash_index = path.indexOf('/')
const module_name = slash_index >= 0 ? path.substring(0, slash_index) : path
const rest = slash_index >= 0 ? path.sub... | [
"function",
"alias",
"(",
"path",
",",
"aliases",
")",
"{",
"// if it's a path to a file - don't interfere",
"if",
"(",
"!",
"is_package_path",
"(",
"path",
")",
")",
"{",
"return",
"}",
"// extract module name from the path",
"const",
"slash_index",
"=",
"path",
".... | alias the path provided the aliases map | [
"alias",
"the",
"path",
"provided",
"the",
"aliases",
"map"
] | 59aa50fbde327ec0921a9acd370868851260a4e0 | https://github.com/catamphetamine/webpack-isomorphic-tools/blob/59aa50fbde327ec0921a9acd370868851260a4e0/source/common.js#L265-L286 |
15,764 | untu/comedy | lib/threaded-actor-worker.js | compileDefinition | function compileDefinition(def) {
if (_.isArray(def)) {
return _.map(def, compileDefinition);
}
try {
if (def[0] == '{') {
// Plain object defined behaviour => wrap in braces.
return eval(`(${def})`);
}
else if (def[0] == '[') {
// Definition array => first deserialize array, th... | javascript | function compileDefinition(def) {
if (_.isArray(def)) {
return _.map(def, compileDefinition);
}
try {
if (def[0] == '{') {
// Plain object defined behaviour => wrap in braces.
return eval(`(${def})`);
}
else if (def[0] == '[') {
// Definition array => first deserialize array, th... | [
"function",
"compileDefinition",
"(",
"def",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"def",
")",
")",
"{",
"return",
"_",
".",
"map",
"(",
"def",
",",
"compileDefinition",
")",
";",
"}",
"try",
"{",
"if",
"(",
"def",
"[",
"0",
"]",
"==",
... | Compiles a serialized actor definition.
@param {String|String[]} def Serialized definition.
@returns {*} Compiled actor definition. | [
"Compiles",
"a",
"serialized",
"actor",
"definition",
"."
] | cdbfd95b0ab5af85f6cdde44b0f1d536e8fd445d | https://github.com/untu/comedy/blob/cdbfd95b0ab5af85f6cdde44b0f1d536e8fd445d/lib/threaded-actor-worker.js#L166-L190 |
15,765 | HumbleSoftware/Flotr2 | examples/lib/codemirror/mode/gfm/gfm.js | handleText | function handleText(stream, mdState) {
var match;
if (stream.match(/^\w+:\/\/\S+/)) {
return 'linkhref';
}
if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
return mdMode.getType(mdState);
}
if (match = stream.match(/^[^\[*\\<>` ]+/)) {
var word = match[0];
... | javascript | function handleText(stream, mdState) {
var match;
if (stream.match(/^\w+:\/\/\S+/)) {
return 'linkhref';
}
if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
return mdMode.getType(mdState);
}
if (match = stream.match(/^[^\[*\\<>` ]+/)) {
var word = match[0];
... | [
"function",
"handleText",
"(",
"stream",
",",
"mdState",
")",
"{",
"var",
"match",
";",
"if",
"(",
"stream",
".",
"match",
"(",
"/",
"^\\w+:\\/\\/\\S+",
"/",
")",
")",
"{",
"return",
"'linkhref'",
";",
"}",
"if",
"(",
"stream",
".",
"match",
"(",
"/"... | custom handleText to prevent emphasis in the middle of a word and add autolinking | [
"custom",
"handleText",
"to",
"prevent",
"emphasis",
"in",
"the",
"middle",
"of",
"a",
"word",
"and",
"add",
"autolinking"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/examples/lib/codemirror/mode/gfm/gfm.js#L69-L88 |
15,766 | HumbleSoftware/Flotr2 | lib/prototype.js | function(a, b) {
for (var i = 0, node; node = b[i]; i++)
a.push(node);
return a;
} | javascript | function(a, b) {
for (var i = 0, node; node = b[i]; i++)
a.push(node);
return a;
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"node",
";",
"node",
"=",
"b",
"[",
"i",
"]",
";",
"i",
"++",
")",
"a",
".",
"push",
"(",
"node",
")",
";",
"return",
"a",
";",
"}"
] | UTILITY FUNCTIONS joins two collections | [
"UTILITY",
"FUNCTIONS",
"joins",
"two",
"collections"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/lib/prototype.js#L3069-L3073 | |
15,767 | HumbleSoftware/Flotr2 | lib/prototype.js | function(a, b, total) {
if (a == 0) return b > 0 ? [b] : [];
return $R(1, total).inject([], function(memo, i) {
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
return memo;
});
} | javascript | function(a, b, total) {
if (a == 0) return b > 0 ? [b] : [];
return $R(1, total).inject([], function(memo, i) {
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
return memo;
});
} | [
"function",
"(",
"a",
",",
"b",
",",
"total",
")",
"{",
"if",
"(",
"a",
"==",
"0",
")",
"return",
"b",
">",
"0",
"?",
"[",
"b",
"]",
":",
"[",
"]",
";",
"return",
"$R",
"(",
"1",
",",
"total",
")",
".",
"inject",
"(",
"[",
"]",
",",
"fu... | handles the an+b logic | [
"handles",
"the",
"an",
"+",
"b",
"logic"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/lib/prototype.js#L3297-L3303 | |
15,768 | HumbleSoftware/Flotr2 | flotr2.examples.types.js | drawGraph | function drawGraph (opts) {
// Clone the options, so the 'options' variable always keeps intact.
var o = Flotr._.extend(Flotr._.clone(options), opts || {});
// Return a new graph.
return Flotr.draw(
container,
[ d1, d2, d3 ],
o
);
} | javascript | function drawGraph (opts) {
// Clone the options, so the 'options' variable always keeps intact.
var o = Flotr._.extend(Flotr._.clone(options), opts || {});
// Return a new graph.
return Flotr.draw(
container,
[ d1, d2, d3 ],
o
);
} | [
"function",
"drawGraph",
"(",
"opts",
")",
"{",
"// Clone the options, so the 'options' variable always keeps intact.",
"var",
"o",
"=",
"Flotr",
".",
"_",
".",
"extend",
"(",
"Flotr",
".",
"_",
".",
"clone",
"(",
"options",
")",
",",
"opts",
"||",
"{",
"}",
... | Draw graph with default options, overwriting with passed options | [
"Draw",
"graph",
"with",
"default",
"options",
"overwriting",
"with",
"passed",
"options"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.examples.types.js#L666-L677 |
15,769 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(name, graphType){
Flotr.graphTypes[name] = graphType;
Flotr.defaultOptions[name] = graphType.options || {};
Flotr.defaultOptions.defaultType = Flotr.defaultOptions.defaultType || name;
} | javascript | function(name, graphType){
Flotr.graphTypes[name] = graphType;
Flotr.defaultOptions[name] = graphType.options || {};
Flotr.defaultOptions.defaultType = Flotr.defaultOptions.defaultType || name;
} | [
"function",
"(",
"name",
",",
"graphType",
")",
"{",
"Flotr",
".",
"graphTypes",
"[",
"name",
"]",
"=",
"graphType",
";",
"Flotr",
".",
"defaultOptions",
"[",
"name",
"]",
"=",
"graphType",
".",
"options",
"||",
"{",
"}",
";",
"Flotr",
".",
"defaultOpt... | Can be used to add your own chart type.
@param {String} name - Type of chart, like 'pies', 'bars' etc.
@param {String} graphType - The object containing the basic drawing functions (draw, etc) | [
"Can",
"be",
"used",
"to",
"add",
"your",
"own",
"chart",
"type",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L37-L41 | |
15,770 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(name, plugin){
Flotr.plugins[name] = plugin;
Flotr.defaultOptions[name] = plugin.options || {};
} | javascript | function(name, plugin){
Flotr.plugins[name] = plugin;
Flotr.defaultOptions[name] = plugin.options || {};
} | [
"function",
"(",
"name",
",",
"plugin",
")",
"{",
"Flotr",
".",
"plugins",
"[",
"name",
"]",
"=",
"plugin",
";",
"Flotr",
".",
"defaultOptions",
"[",
"name",
"]",
"=",
"plugin",
".",
"options",
"||",
"{",
"}",
";",
"}"
] | Can be used to add a plugin
@param {String} name - The name of the plugin
@param {String} plugin - The object containing the plugin's data (callbacks, options, function1, function2, ...) | [
"Can",
"be",
"used",
"to",
"add",
"a",
"plugin"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L48-L51 | |
15,771 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(noTicks, min, max, decimals){
var delta = (max - min) / noTicks,
magn = Flotr.getMagnitude(delta),
tickSize = 10,
norm = delta / magn; // Norm is between 1.0 and 10.0.
if(norm < 1.5) tickSize = 1;
else if(norm < 2.25) tickSize = 2;
else if(norm < 3) tickSize = (... | javascript | function(noTicks, min, max, decimals){
var delta = (max - min) / noTicks,
magn = Flotr.getMagnitude(delta),
tickSize = 10,
norm = delta / magn; // Norm is between 1.0 and 10.0.
if(norm < 1.5) tickSize = 1;
else if(norm < 2.25) tickSize = 2;
else if(norm < 3) tickSize = (... | [
"function",
"(",
"noTicks",
",",
"min",
",",
"max",
",",
"decimals",
")",
"{",
"var",
"delta",
"=",
"(",
"max",
"-",
"min",
")",
"/",
"noTicks",
",",
"magn",
"=",
"Flotr",
".",
"getMagnitude",
"(",
"delta",
")",
",",
"tickSize",
"=",
"10",
",",
"... | Function calculates the ticksize and returns it.
@param {Integer} noTicks - number of ticks
@param {Integer} min - lower bound integer value for the current axis
@param {Integer} max - upper bound integer value for the current axis
@param {Integer} decimals - number of decimals for the ticks
@return {Integer} returns t... | [
"Function",
"calculates",
"the",
"ticksize",
"and",
"returns",
"it",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L117-L129 | |
15,772 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(x){
return Math.pow(10, Math.floor(Math.log(x) / Math.LN10));
} | javascript | function(x){
return Math.pow(10, Math.floor(Math.log(x) / Math.LN10));
} | [
"function",
"(",
"x",
")",
"{",
"return",
"Math",
".",
"pow",
"(",
"10",
",",
"Math",
".",
"floor",
"(",
"Math",
".",
"log",
"(",
"x",
")",
"/",
"Math",
".",
"LN10",
")",
")",
";",
"}"
] | Returns the magnitude of the input value.
@param {Integer, Float} x - integer or float value
@return {Integer, Float} returns the magnitude of the input value | [
"Returns",
"the",
"magnitude",
"of",
"the",
"input",
"value",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L183-L185 | |
15,773 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(color, options) {
var opacity = options.opacity;
if (!color) return 'rgba(0, 0, 0, 0)';
if (color instanceof Color) return color.alpha(opacity).toString();
if (_.isString(color)) return Color.parse(color).alpha(opacity).toString();
var grad = color.colors ? color : {colors: color};
... | javascript | function(color, options) {
var opacity = options.opacity;
if (!color) return 'rgba(0, 0, 0, 0)';
if (color instanceof Color) return color.alpha(opacity).toString();
if (_.isString(color)) return Color.parse(color).alpha(opacity).toString();
var grad = color.colors ? color : {colors: color};
... | [
"function",
"(",
"color",
",",
"options",
")",
"{",
"var",
"opacity",
"=",
"options",
".",
"opacity",
";",
"if",
"(",
"!",
"color",
")",
"return",
"'rgba(0, 0, 0, 0)'",
";",
"if",
"(",
"color",
"instanceof",
"Color",
")",
"return",
"color",
".",
"alpha",... | Process color and options into color style. | [
"Process",
"color",
"and",
"options",
"into",
"color",
"style",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L482-L513 | |
15,774 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(element){
element = getEl(element);
return {
height : element.offsetHeight,
width : element.offsetWidth };
} | javascript | function(element){
element = getEl(element);
return {
height : element.offsetHeight,
width : element.offsetWidth };
} | [
"function",
"(",
"element",
")",
"{",
"element",
"=",
"getEl",
"(",
"element",
")",
";",
"return",
"{",
"height",
":",
"element",
".",
"offsetHeight",
",",
"width",
":",
"element",
".",
"offsetWidth",
"}",
";",
"}"
] | Return element size. | [
"Return",
"element",
"size",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L823-L828 | |
15,775 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(){
var a = this.axes,
xaxis, yaxis, range;
_.each(this.series, function (series) {
range = series.getRange();
if (range) {
xaxis = series.xaxis;
yaxis = series.yaxis;
xaxis.datamin = Math.min(range.xmin, xaxis.datamin);
xaxis.datamax = Math.max(range.x... | javascript | function(){
var a = this.axes,
xaxis, yaxis, range;
_.each(this.series, function (series) {
range = series.getRange();
if (range) {
xaxis = series.xaxis;
yaxis = series.yaxis;
xaxis.datamin = Math.min(range.xmin, xaxis.datamin);
xaxis.datamax = Math.max(range.x... | [
"function",
"(",
")",
"{",
"var",
"a",
"=",
"this",
".",
"axes",
",",
"xaxis",
",",
"yaxis",
",",
"range",
";",
"_",
".",
"each",
"(",
"this",
".",
"series",
",",
"function",
"(",
"series",
")",
"{",
"range",
"=",
"series",
".",
"getRange",
"(",
... | Function determines the min and max values for the xaxis and yaxis.
TODO logarithmic range validation (consideration of 0) | [
"Function",
"determines",
"the",
"min",
"and",
"max",
"values",
"for",
"the",
"xaxis",
"and",
"yaxis",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1063-L1105 | |
15,776 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(after) {
var
context = this.ctx,
i;
E.fire(this.el, 'flotr:beforedraw', [this.series, this]);
if (this.series.length) {
context.save();
context.translate(this.plotOffset.left, this.plotOffset.top);
for (i = 0; i < this.series.length; i++) {
if (!this.serie... | javascript | function(after) {
var
context = this.ctx,
i;
E.fire(this.el, 'flotr:beforedraw', [this.series, this]);
if (this.series.length) {
context.save();
context.translate(this.plotOffset.left, this.plotOffset.top);
for (i = 0; i < this.series.length; i++) {
if (!this.serie... | [
"function",
"(",
"after",
")",
"{",
"var",
"context",
"=",
"this",
".",
"ctx",
",",
"i",
";",
"E",
".",
"fire",
"(",
"this",
".",
"el",
",",
"'flotr:beforedraw'",
",",
"[",
"this",
".",
"series",
",",
"this",
"]",
")",
";",
"if",
"(",
"this",
"... | Draws grid, labels, series and outline. | [
"Draws",
"grid",
"labels",
"series",
"and",
"outline",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1207-L1230 | |
15,777 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(series){
function drawChart (series, typeKey) {
var options = this.getOptions(series, typeKey);
this[typeKey].draw(options);
}
var drawn = false;
series = series || this.series;
_.each(flotr.graphTypes, function (type, typeKey) {
if (series[typeKey] && series[typeKey].s... | javascript | function(series){
function drawChart (series, typeKey) {
var options = this.getOptions(series, typeKey);
this[typeKey].draw(options);
}
var drawn = false;
series = series || this.series;
_.each(flotr.graphTypes, function (type, typeKey) {
if (series[typeKey] && series[typeKey].s... | [
"function",
"(",
"series",
")",
"{",
"function",
"drawChart",
"(",
"series",
",",
"typeKey",
")",
"{",
"var",
"options",
"=",
"this",
".",
"getOptions",
"(",
"series",
",",
"typeKey",
")",
";",
"this",
"[",
"typeKey",
"]",
".",
"draw",
"(",
"options",
... | Actually draws the graph.
@param {Object} series - series to draw | [
"Actually",
"draws",
"the",
"graph",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1235-L1253 | |
15,778 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function (e){
var
d = document,
b = d.body,
de = d.documentElement,
axes = this.axes,
plotOffset = this.plotOffset,
lastMousePos = this.lastMousePos,
pointer = E.eventPointer(e),
dx = pointer.x - lastMousePos.pageX,
dy = pointer.y - lastMousePos.pageY,
r,... | javascript | function (e){
var
d = document,
b = d.body,
de = d.documentElement,
axes = this.axes,
plotOffset = this.plotOffset,
lastMousePos = this.lastMousePos,
pointer = E.eventPointer(e),
dx = pointer.x - lastMousePos.pageX,
dy = pointer.y - lastMousePos.pageY,
r,... | [
"function",
"(",
"e",
")",
"{",
"var",
"d",
"=",
"document",
",",
"b",
"=",
"d",
".",
"body",
",",
"de",
"=",
"d",
".",
"documentElement",
",",
"axes",
"=",
"this",
".",
"axes",
",",
"plotOffset",
"=",
"this",
".",
"plotOffset",
",",
"lastMousePos"... | Calculates the coordinates from a mouse event object.
@param {Event} event - Mouse Event object.
@return {Object} Object with coordinates of the mouse. | [
"Calculates",
"the",
"coordinates",
"from",
"a",
"mouse",
"event",
"object",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1295-L1333 | |
15,779 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function (event){
/*
// @TODO Context menu?
if(event.isRightClick()) {
event.stop();
var overlay = this.overlay;
overlay.hide();
function cancelContextMenu () {
overlay.show();
E.stopObserving(document, 'mousemove', cancelContextMenu);
}
E.observe(docum... | javascript | function (event){
/*
// @TODO Context menu?
if(event.isRightClick()) {
event.stop();
var overlay = this.overlay;
overlay.hide();
function cancelContextMenu () {
overlay.show();
E.stopObserving(document, 'mousemove', cancelContextMenu);
}
E.observe(docum... | [
"function",
"(",
"event",
")",
"{",
"/*\n // @TODO Context menu?\n if(event.isRightClick()) {\n event.stop();\n\n var overlay = this.overlay;\n overlay.hide();\n\n function cancelContextMenu () {\n overlay.show();\n E.stopObserving(document, 'mousemove', cancelConte... | Observes the 'mousedown' event.
@param {Event} event - 'mousedown' Event object. | [
"Observes",
"the",
"mousedown",
"event",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1359-L1397 | |
15,780 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | getCanvas | function getCanvas(canvas, name){
if(!canvas){
canvas = D.create('canvas');
if (typeof FlashCanvas != "undefined" && typeof canvas.getContext === 'function') {
FlashCanvas.initElement(canvas);
this.isFlashCanvas = true;
}
canvas.className = 'flotr-'+name;
... | javascript | function getCanvas(canvas, name){
if(!canvas){
canvas = D.create('canvas');
if (typeof FlashCanvas != "undefined" && typeof canvas.getContext === 'function') {
FlashCanvas.initElement(canvas);
this.isFlashCanvas = true;
}
canvas.className = 'flotr-'+name;
... | [
"function",
"getCanvas",
"(",
"canvas",
",",
"name",
")",
"{",
"if",
"(",
"!",
"canvas",
")",
"{",
"canvas",
"=",
"D",
".",
"create",
"(",
"'canvas'",
")",
";",
"if",
"(",
"typeof",
"FlashCanvas",
"!=",
"\"undefined\"",
"&&",
"typeof",
"canvas",
".",
... | Enable text functions | [
"Enable",
"text",
"functions"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1591-L1612 |
15,781 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function () {
if (!this.used) return;
var axis = this,
o = axis.options,
min = o.min !== null ? o.min : axis.datamin,
max = o.max !== null ? o.max : axis.datamax,
margin = o.autoscaleMargin;
if (o.scaling == 'logarithmic') {
if (min <= 0) min = axis.d... | javascript | function () {
if (!this.used) return;
var axis = this,
o = axis.options,
min = o.min !== null ? o.min : axis.datamin,
max = o.max !== null ? o.max : axis.datamax,
margin = o.autoscaleMargin;
if (o.scaling == 'logarithmic') {
if (min <= 0) min = axis.d... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"used",
")",
"return",
";",
"var",
"axis",
"=",
"this",
",",
"o",
"=",
"axis",
".",
"options",
",",
"min",
"=",
"o",
".",
"min",
"!==",
"null",
"?",
"o",
".",
"min",
":",
"axis",
".",
... | Calculates the range of an axis to apply autoscaling. | [
"Calculates",
"the",
"range",
"of",
"an",
"axis",
"to",
"apply",
"autoscaling",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L1836-L1903 | |
15,782 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(data){
return _.map(data, function(s){
var series;
if (s.data) {
series = new Series();
_.extend(series, s);
} else {
series = new Series({data:s});
}
return series;
});
} | javascript | function(data){
return _.map(data, function(s){
var series;
if (s.data) {
series = new Series();
_.extend(series, s);
} else {
series = new Series({data:s});
}
return series;
});
} | [
"function",
"(",
"data",
")",
"{",
"return",
"_",
".",
"map",
"(",
"data",
",",
"function",
"(",
"s",
")",
"{",
"var",
"series",
";",
"if",
"(",
"s",
".",
"data",
")",
"{",
"series",
"=",
"new",
"Series",
"(",
")",
";",
"_",
".",
"extend",
"(... | Collects dataseries from input and parses the series into the right format. It returns an Array
of Objects each having at least the 'data' key set.
@param {Array, Object} data - Object or array of dataseries
@return {Array} Array of Objects parsed into the right format ({(...,) data: [[x1,y1], [x2,y2], ...] (, ...)}) | [
"Collects",
"dataseries",
"from",
"input",
"and",
"parses",
"the",
"series",
"into",
"the",
"right",
"format",
".",
"It",
"returns",
"an",
"Array",
"of",
"Objects",
"each",
"having",
"at",
"least",
"the",
"data",
"key",
"set",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L2121-L2132 | |
15,783 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function (options) {
var
context = options.context,
lineWidth = options.lineWidth,
shadowSize = options.shadowSize,
offset;
context.save();
context.lineJoin = 'round';
if (shadowSize) {
context.lineWidth = shadowSize / 2;
offset = lineWidth / 2 + context.li... | javascript | function (options) {
var
context = options.context,
lineWidth = options.lineWidth,
shadowSize = options.shadowSize,
offset;
context.save();
context.lineJoin = 'round';
if (shadowSize) {
context.lineWidth = shadowSize / 2;
offset = lineWidth / 2 + context.li... | [
"function",
"(",
"options",
")",
"{",
"var",
"context",
"=",
"options",
".",
"context",
",",
"lineWidth",
"=",
"options",
".",
"lineWidth",
",",
"shadowSize",
"=",
"options",
".",
"shadowSize",
",",
"offset",
";",
"context",
".",
"save",
"(",
")",
";",
... | Draws lines series in the canvas element.
@param {Object} options | [
"Draws",
"lines",
"series",
"in",
"the",
"canvas",
"element",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L2160-L2190 | |
15,784 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(series) {
var ctx = this.ctx,
bw = series.gantt.barWidth,
lw = Math.min(series.gantt.lineWidth, bw);
ctx.save();
ctx.translate(this.plotOffset.left, this.plotOffset.top);
ctx.lineJoin = 'miter';
/**
* @todo linewidth not interpreted the right way.
*/
ctx.line... | javascript | function(series) {
var ctx = this.ctx,
bw = series.gantt.barWidth,
lw = Math.min(series.gantt.lineWidth, bw);
ctx.save();
ctx.translate(this.plotOffset.left, this.plotOffset.top);
ctx.lineJoin = 'miter';
/**
* @todo linewidth not interpreted the right way.
*/
ctx.line... | [
"function",
"(",
"series",
")",
"{",
"var",
"ctx",
"=",
"this",
".",
"ctx",
",",
"bw",
"=",
"series",
".",
"gantt",
".",
"barWidth",
",",
"lw",
"=",
"Math",
".",
"min",
"(",
"series",
".",
"gantt",
".",
"lineWidth",
",",
"bw",
")",
";",
"ctx",
... | Draws gantt series in the canvas element.
@param {Object} series - Series with options.gantt.show = true. | [
"Draws",
"gantt",
"series",
"in",
"the",
"canvas",
"element",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L3063-L3089 | |
15,785 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(s, method, args){
var
success = false,
options;
if (!_.isArray(s)) s = [s];
function e(s, index) {
_.each(_.keys(flotr.graphTypes), function (type) {
if (s[type] && s[type].show && !s.hide && this[type][method]) {
options = this.getOptions(s, type);
... | javascript | function(s, method, args){
var
success = false,
options;
if (!_.isArray(s)) s = [s];
function e(s, index) {
_.each(_.keys(flotr.graphTypes), function (type) {
if (s[type] && s[type].show && !s.hide && this[type][method]) {
options = this.getOptions(s, type);
... | [
"function",
"(",
"s",
",",
"method",
",",
"args",
")",
"{",
"var",
"success",
"=",
"false",
",",
"options",
";",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"s",
")",
")",
"s",
"=",
"[",
"s",
"]",
";",
"function",
"e",
"(",
"s",
",",
"index",
... | Try a method on a graph type. If the method exists, execute it.
@param {Object} series
@param {String} method Method name.
@param {Array} args Arguments applied to method.
@return executed successfully or failed. | [
"Try",
"a",
"method",
"on",
"a",
"graph",
"type",
".",
"If",
"the",
"method",
"exists",
"execute",
"it",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4340-L4367 | |
15,786 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(n){
var octx = this.octx,
s = n.series;
if (s.mouse.lineColor) {
octx.save();
octx.lineWidth = (s.points ? s.points.lineWidth : 1);
octx.strokeStyle = s.mouse.lineColor;
octx.fillStyle = this.processColor(s.mouse.fillColor || '#ffffff', {opacity: s.mouse.fillOpacity});
... | javascript | function(n){
var octx = this.octx,
s = n.series;
if (s.mouse.lineColor) {
octx.save();
octx.lineWidth = (s.points ? s.points.lineWidth : 1);
octx.strokeStyle = s.mouse.lineColor;
octx.fillStyle = this.processColor(s.mouse.fillColor || '#ffffff', {opacity: s.mouse.fillOpacity});
... | [
"function",
"(",
"n",
")",
"{",
"var",
"octx",
"=",
"this",
".",
"octx",
",",
"s",
"=",
"n",
".",
"series",
";",
"if",
"(",
"s",
".",
"mouse",
".",
"lineColor",
")",
"{",
"octx",
".",
"save",
"(",
")",
";",
"octx",
".",
"lineWidth",
"=",
"(",... | Updates the mouse tracking point on the overlay. | [
"Updates",
"the",
"mouse",
"tracking",
"point",
"on",
"the",
"overlay",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4371-L4398 | |
15,787 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(){
var prev = this.prevHit,
octx = this.octx,
plotOffset = this.plotOffset;
octx.save();
octx.translate(plotOffset.left, plotOffset.top);
if (prev) {
if (!this.hit.executeOnType(prev.series, 'clearHit', this.prevHit)) {
// TODO fix this (points) should move to gene... | javascript | function(){
var prev = this.prevHit,
octx = this.octx,
plotOffset = this.plotOffset;
octx.save();
octx.translate(plotOffset.left, plotOffset.top);
if (prev) {
if (!this.hit.executeOnType(prev.series, 'clearHit', this.prevHit)) {
// TODO fix this (points) should move to gene... | [
"function",
"(",
")",
"{",
"var",
"prev",
"=",
"this",
".",
"prevHit",
",",
"octx",
"=",
"this",
".",
"octx",
",",
"plotOffset",
"=",
"this",
".",
"plotOffset",
";",
"octx",
".",
"save",
"(",
")",
";",
"octx",
".",
"translate",
"(",
"plotOffset",
"... | Removes the mouse tracking point from the overlay. | [
"Removes",
"the",
"mouse",
"tracking",
"point",
"from",
"the",
"overlay",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4402-L4426 | |
15,788 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(area, preventEvent){
var options = this.options,
xa = this.axes.x,
ya = this.axes.y,
vertScale = ya.scale,
hozScale = xa.scale,
selX = options.selection.mode.indexOf('x') != -1,
selY = options.selection.mode.indexOf('y') != -1,
s = this.selection.selection;
... | javascript | function(area, preventEvent){
var options = this.options,
xa = this.axes.x,
ya = this.axes.y,
vertScale = ya.scale,
hozScale = xa.scale,
selX = options.selection.mode.indexOf('x') != -1,
selY = options.selection.mode.indexOf('y') != -1,
s = this.selection.selection;
... | [
"function",
"(",
"area",
",",
"preventEvent",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"xa",
"=",
"this",
".",
"axes",
".",
"x",
",",
"ya",
"=",
"this",
".",
"axes",
".",
"y",
",",
"vertScale",
"=",
"ya",
".",
"scale",
",",
... | Allows the user the manually select an area.
@param {Object} area - Object with coordinates to select. | [
"Allows",
"the",
"user",
"the",
"manually",
"select",
"an",
"area",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4825-L4845 | |
15,789 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(pos, pointer) {
var mode = this.options.selection.mode,
selection = this.selection.selection;
if(mode.indexOf('x') == -1) {
pos.x = (pos == selection.first) ? 0 : this.plotWidth;
}else{
pos.x = boundX(pointer.relX, this);
}
if (mode.indexOf('y') == -1) {
... | javascript | function(pos, pointer) {
var mode = this.options.selection.mode,
selection = this.selection.selection;
if(mode.indexOf('x') == -1) {
pos.x = (pos == selection.first) ? 0 : this.plotWidth;
}else{
pos.x = boundX(pointer.relX, this);
}
if (mode.indexOf('y') == -1) {
... | [
"function",
"(",
"pos",
",",
"pointer",
")",
"{",
"var",
"mode",
"=",
"this",
".",
"options",
".",
"selection",
".",
"mode",
",",
"selection",
"=",
"this",
".",
"selection",
".",
"selection",
";",
"if",
"(",
"mode",
".",
"indexOf",
"(",
"'x'",
")",
... | Calculates the position of the selection.
@param {Object} pos - Position object.
@param {Event} event - Event object. | [
"Calculates",
"the",
"position",
"of",
"the",
"selection",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4852-L4867 | |
15,790 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(){
var s = this.selection.selection;
return Math.abs(s.second.x - s.first.x) >= 5 ||
Math.abs(s.second.y - s.first.y) >= 5;
} | javascript | function(){
var s = this.selection.selection;
return Math.abs(s.second.x - s.first.x) >= 5 ||
Math.abs(s.second.y - s.first.y) >= 5;
} | [
"function",
"(",
")",
"{",
"var",
"s",
"=",
"this",
".",
"selection",
".",
"selection",
";",
"return",
"Math",
".",
"abs",
"(",
"s",
".",
"second",
".",
"x",
"-",
"s",
".",
"first",
".",
"x",
")",
">=",
"5",
"||",
"Math",
".",
"abs",
"(",
"s"... | Determines whether or not the selection is sane and should be drawn.
@return {Boolean} - True when sane, false otherwise. | [
"Determines",
"whether",
"or",
"not",
"the",
"selection",
"is",
"sane",
"and",
"should",
"be",
"drawn",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L4960-L4964 | |
15,791 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(){
// If the data grid has already been built, nothing to do here
if (this.spreadsheet.datagrid) return this.spreadsheet.datagrid;
var s = this.series,
datagrid = this.spreadsheet.loadDataGrid(),
colgroup = ['<colgroup><col />'],
buttonDownload, buttonSelect, t;
... | javascript | function(){
// If the data grid has already been built, nothing to do here
if (this.spreadsheet.datagrid) return this.spreadsheet.datagrid;
var s = this.series,
datagrid = this.spreadsheet.loadDataGrid(),
colgroup = ['<colgroup><col />'],
buttonDownload, buttonSelect, t;
... | [
"function",
"(",
")",
"{",
"// If the data grid has already been built, nothing to do here",
"if",
"(",
"this",
".",
"spreadsheet",
".",
"datagrid",
")",
"return",
"this",
".",
"spreadsheet",
".",
"datagrid",
";",
"var",
"s",
"=",
"this",
".",
"series",
",",
"da... | Constructs the data table for the spreadsheet
@todo make a spreadsheet manager (Flotr.Spreadsheet)
@return {Element} The resulting table element | [
"Constructs",
"the",
"data",
"table",
"for",
"the",
"spreadsheet"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L5502-L5590 | |
15,792 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(tabName){
if (this.spreadsheet.activeTab === tabName){
return;
}
switch(tabName) {
case 'graph':
D.hide(this.spreadsheet.container);
D.removeClass(this.spreadsheet.tabs.data, 'selected');
D.addClass(this.spreadsheet.tabs.graph, 'selected');
break;
cas... | javascript | function(tabName){
if (this.spreadsheet.activeTab === tabName){
return;
}
switch(tabName) {
case 'graph':
D.hide(this.spreadsheet.container);
D.removeClass(this.spreadsheet.tabs.data, 'selected');
D.addClass(this.spreadsheet.tabs.graph, 'selected');
break;
cas... | [
"function",
"(",
"tabName",
")",
"{",
"if",
"(",
"this",
".",
"spreadsheet",
".",
"activeTab",
"===",
"tabName",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"tabName",
")",
"{",
"case",
"'graph'",
":",
"D",
".",
"hide",
"(",
"this",
".",
"spreadshee... | Shows the specified tab, by its name
@todo make a tab manager (Flotr.Tabs)
@param {String} tabName - The tab name | [
"Shows",
"the",
"specified",
"tab",
"by",
"its",
"name"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L5596-L5617 | |
15,793 | HumbleSoftware/Flotr2 | flotr2.nolibs.js | function(){
var csv = '',
series = this.series,
options = this.options,
dg = this.spreadsheet.loadDataGrid(),
separator = encodeURIComponent(options.spreadsheet.csvFileSeparator);
if (options.spreadsheet.decimalSeparator === options.spreadsheet.csvFileSeparator) {
thro... | javascript | function(){
var csv = '',
series = this.series,
options = this.options,
dg = this.spreadsheet.loadDataGrid(),
separator = encodeURIComponent(options.spreadsheet.csvFileSeparator);
if (options.spreadsheet.decimalSeparator === options.spreadsheet.csvFileSeparator) {
thro... | [
"function",
"(",
")",
"{",
"var",
"csv",
"=",
"''",
",",
"series",
"=",
"this",
".",
"series",
",",
"options",
"=",
"this",
".",
"options",
",",
"dg",
"=",
"this",
".",
"spreadsheet",
".",
"loadDataGrid",
"(",
")",
",",
"separator",
"=",
"encodeURICo... | Converts the data into CSV in order to download a file | [
"Converts",
"the",
"data",
"into",
"CSV",
"in",
"order",
"to",
"download",
"a",
"file"
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.nolibs.js#L5651-L5685 | |
15,794 | HumbleSoftware/Flotr2 | flotr2.amd.js | function(src, dest){
var i, v, result = dest || {};
for (i in src) {
v = src[i];
if (v && typeof(v) === 'object') {
if (v.constructor === Array) {
result[i] = this._.clone(v);
} else if (v.constructor !== RegExp && !this._.isElement(v)) {
result[i] = Flotr.merge(... | javascript | function(src, dest){
var i, v, result = dest || {};
for (i in src) {
v = src[i];
if (v && typeof(v) === 'object') {
if (v.constructor === Array) {
result[i] = this._.clone(v);
} else if (v.constructor !== RegExp && !this._.isElement(v)) {
result[i] = Flotr.merge(... | [
"function",
"(",
"src",
",",
"dest",
")",
"{",
"var",
"i",
",",
"v",
",",
"result",
"=",
"dest",
"||",
"{",
"}",
";",
"for",
"(",
"i",
"in",
"src",
")",
"{",
"v",
"=",
"src",
"[",
"i",
"]",
";",
"if",
"(",
"v",
"&&",
"typeof",
"(",
"v",
... | Recursively merges two objects.
@param {Object} src - source object (likely the object with the least properties)
@param {Object} dest - destination object (optional, object with the most properties)
@return {Object} recursively merged Object
@TODO See if we can't remove this. | [
"Recursively",
"merges",
"two",
"objects",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.amd.js#L89-L108 | |
15,795 | HumbleSoftware/Flotr2 | flotr2.amd.js | function(element, child){
if(_.isString(child))
element.innerHTML += child;
else if (_.isElement(child))
element.appendChild(child);
} | javascript | function(element, child){
if(_.isString(child))
element.innerHTML += child;
else if (_.isElement(child))
element.appendChild(child);
} | [
"function",
"(",
"element",
",",
"child",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"child",
")",
")",
"element",
".",
"innerHTML",
"+=",
"child",
";",
"else",
"if",
"(",
"_",
".",
"isElement",
"(",
"child",
")",
")",
"element",
".",
"appendC... | Insert a child.
@param {Element} element
@param {Element|String} Element or string to be appended. | [
"Insert",
"a",
"child",
"."
] | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.amd.js#L781-L786 | |
15,796 | HumbleSoftware/Flotr2 | flotr2.amd.js | function (mouse) {
var
options = this.options,
prevHit = this.prevHit,
closest, sensibility, dataIndex, seriesIndex, series, value, xaxis, yaxis, n;
if (this.series.length === 0) return;
// Nearest data element.
// dist, x, y, relX, relY, absX, absY, sAngle, eAngle, fraction, mouse,... | javascript | function (mouse) {
var
options = this.options,
prevHit = this.prevHit,
closest, sensibility, dataIndex, seriesIndex, series, value, xaxis, yaxis, n;
if (this.series.length === 0) return;
// Nearest data element.
// dist, x, y, relX, relY, absX, absY, sAngle, eAngle, fraction, mouse,... | [
"function",
"(",
"mouse",
")",
"{",
"var",
"options",
"=",
"this",
".",
"options",
",",
"prevHit",
"=",
"this",
".",
"prevHit",
",",
"closest",
",",
"sensibility",
",",
"dataIndex",
",",
"seriesIndex",
",",
"series",
",",
"value",
",",
"xaxis",
",",
"y... | Retrieves the nearest data point from the mouse cursor. If it's within
a certain range, draw a point on the overlay canvas and display the x and y
value of the data.
@param {Object} mouse - Object that holds the relative x and y coordinates of the cursor. | [
"Retrieves",
"the",
"nearest",
"data",
"point",
"from",
"the",
"mouse",
"cursor",
".",
"If",
"it",
"s",
"within",
"a",
"certain",
"range",
"draw",
"a",
"point",
"on",
"the",
"overlay",
"canvas",
"and",
"display",
"the",
"x",
"and",
"y",
"value",
"of",
... | df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5 | https://github.com/HumbleSoftware/Flotr2/blob/df0ddedcab1a8fdb3a7abafc5fe97819931e7bd5/flotr2.amd.js#L4243-L4313 | |
15,797 | TooTallNate/NodObjC | lib/import.js | resolve | function resolve (framework) {
// strip off a trailing slash if present
if (framework[framework.length-1] == '/')
framework = framework.slice(0, framework.length-1);
// already absolute, return as-is
if (~framework.indexOf('/')) return framework;
var i=0, l=PATH.length, rtn=null;
for (; i<l; i++) {
... | javascript | function resolve (framework) {
// strip off a trailing slash if present
if (framework[framework.length-1] == '/')
framework = framework.slice(0, framework.length-1);
// already absolute, return as-is
if (~framework.indexOf('/')) return framework;
var i=0, l=PATH.length, rtn=null;
for (; i<l; i++) {
... | [
"function",
"resolve",
"(",
"framework",
")",
"{",
"// strip off a trailing slash if present",
"if",
"(",
"framework",
"[",
"framework",
".",
"length",
"-",
"1",
"]",
"==",
"'/'",
")",
"framework",
"=",
"framework",
".",
"slice",
"(",
"0",
",",
"framework",
... | Accepts a single framework name and resolves it into an absolute path
to the base directory of the framework.
In most cases, you will not need to use this function in your code.
$.resolve('Foundation')
// '/System/Library/Frameworks/Foundation.framework'
@param {String} framework The framework name or path to resol... | [
"Accepts",
"a",
"single",
"framework",
"name",
"and",
"resolves",
"it",
"into",
"an",
"absolute",
"path",
"to",
"the",
"base",
"directory",
"of",
"the",
"framework",
"."
] | e4710fb8b73d3a2860de1e959e335a6de3e2191c | https://github.com/TooTallNate/NodObjC/blob/e4710fb8b73d3a2860de1e959e335a6de3e2191c/lib/import.js#L250-L262 |
15,798 | TooTallNate/NodObjC | lib/types.js | getStruct | function getStruct (type) {
// First check if a regular name was passed in
var rtn = structCache[type];
if (rtn) return rtn;
// If the struct type name has already been created, return that one
var name = parseStructName(type);
rtn = structCache[name];
if (rtn) return rtn;
if(knownStructs[name]) typ... | javascript | function getStruct (type) {
// First check if a regular name was passed in
var rtn = structCache[type];
if (rtn) return rtn;
// If the struct type name has already been created, return that one
var name = parseStructName(type);
rtn = structCache[name];
if (rtn) return rtn;
if(knownStructs[name]) typ... | [
"function",
"getStruct",
"(",
"type",
")",
"{",
"// First check if a regular name was passed in",
"var",
"rtn",
"=",
"structCache",
"[",
"type",
"]",
";",
"if",
"(",
"rtn",
")",
"return",
"rtn",
";",
"// If the struct type name has already been created, return that one",
... | Returns the struct constructor function for the given struct name or type.
{CGPoint="x"d"y"d}
@api private | [
"Returns",
"the",
"struct",
"constructor",
"function",
"for",
"the",
"given",
"struct",
"name",
"or",
"type",
"."
] | e4710fb8b73d3a2860de1e959e335a6de3e2191c | https://github.com/TooTallNate/NodObjC/blob/e4710fb8b73d3a2860de1e959e335a6de3e2191c/lib/types.js#L49-L72 |
15,799 | TooTallNate/NodObjC | lib/types.js | parseStructName | function parseStructName (struct) {
var s = struct.substring(1, struct.length-1)
, equalIndex = s.indexOf('=')
if (~equalIndex)
s = s.substring(0, equalIndex)
return s
} | javascript | function parseStructName (struct) {
var s = struct.substring(1, struct.length-1)
, equalIndex = s.indexOf('=')
if (~equalIndex)
s = s.substring(0, equalIndex)
return s
} | [
"function",
"parseStructName",
"(",
"struct",
")",
"{",
"var",
"s",
"=",
"struct",
".",
"substring",
"(",
"1",
",",
"struct",
".",
"length",
"-",
"1",
")",
",",
"equalIndex",
"=",
"s",
".",
"indexOf",
"(",
"'='",
")",
"if",
"(",
"~",
"equalIndex",
... | Extracts only the name of the given struct type encoding string.
@api private | [
"Extracts",
"only",
"the",
"name",
"of",
"the",
"given",
"struct",
"type",
"encoding",
"string",
"."
] | e4710fb8b73d3a2860de1e959e335a6de3e2191c | https://github.com/TooTallNate/NodObjC/blob/e4710fb8b73d3a2860de1e959e335a6de3e2191c/lib/types.js#L80-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.