repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gpbl/denormalizr | src/index.js | denormalizeIterable | function denormalizeIterable(items, entities, schema, bag) {
const isMappable = typeof items.map === 'function';
const itemSchema = Array.isArray(schema) ? schema[0] : schema.schema;
// Handle arrayOf iterables
if (isMappable) {
return items.map(o => denormalize(o, entities, itemSchema, bag));
}
// H... | javascript | function denormalizeIterable(items, entities, schema, bag) {
const isMappable = typeof items.map === 'function';
const itemSchema = Array.isArray(schema) ? schema[0] : schema.schema;
// Handle arrayOf iterables
if (isMappable) {
return items.map(o => denormalize(o, entities, itemSchema, bag));
}
// H... | [
"function",
"denormalizeIterable",
"(",
"items",
",",
"entities",
",",
"schema",
",",
"bag",
")",
"{",
"const",
"isMappable",
"=",
"typeof",
"items",
".",
"map",
"===",
"'function'",
";",
"const",
"itemSchema",
"=",
"Array",
".",
"isArray",
"(",
"schema",
... | Denormalizes each entity in the given array.
@param {Array|Immutable.List} items
@param {object|Immutable.Map} entities
@param {schema.Entity} schema
@param {object} bag
@returns {Array|Immutable.List} | [
"Denormalizes",
"each",
"entity",
"in",
"the",
"given",
"array",
"."
] | 11baeab9e9cb058f1096196d0d4c2e42e0ef8937 | https://github.com/gpbl/denormalizr/blob/11baeab9e9cb058f1096196d0d4c2e42e0ef8937/src/index.js#L44-L60 | train |
gpbl/denormalizr | src/index.js | denormalizeObject | function denormalizeObject(obj, entities, schema, bag) {
let denormalized = obj;
const schemaDefinition = typeof schema.inferSchema === 'function'
? schema.inferSchema(obj)
: (schema.schema || schema)
;
Object.keys(schemaDefinition)
// .filter(attribute => attribute.substring(0, 1) !== '_')
.f... | javascript | function denormalizeObject(obj, entities, schema, bag) {
let denormalized = obj;
const schemaDefinition = typeof schema.inferSchema === 'function'
? schema.inferSchema(obj)
: (schema.schema || schema)
;
Object.keys(schemaDefinition)
// .filter(attribute => attribute.substring(0, 1) !== '_')
.f... | [
"function",
"denormalizeObject",
"(",
"obj",
",",
"entities",
",",
"schema",
",",
"bag",
")",
"{",
"let",
"denormalized",
"=",
"obj",
";",
"const",
"schemaDefinition",
"=",
"typeof",
"schema",
".",
"inferSchema",
"===",
"'function'",
"?",
"schema",
".",
"inf... | Takes an object and denormalizes it.
Note: For non-immutable objects, this will mutate the object. This is
necessary for handling circular dependencies. In order to not mutate the
original object, the caller should copy the object before passing it here.
@param {object|Immutable.Map} obj
@param {object|Immutable.... | [
"Takes",
"an",
"object",
"and",
"denormalizes",
"it",
"."
] | 11baeab9e9cb058f1096196d0d4c2e42e0ef8937 | https://github.com/gpbl/denormalizr/blob/11baeab9e9cb058f1096196d0d4c2e42e0ef8937/src/index.js#L98-L117 | train |
gpbl/denormalizr | src/index.js | denormalizeEntity | function denormalizeEntity(entityOrId, entities, schema, bag) {
const key = schema.key;
const { entity, id } = resolveEntityOrId(entityOrId, entities, schema);
if (!bag.hasOwnProperty(key)) {
bag[key] = {};
}
if (!bag[key].hasOwnProperty(id)) {
// Ensure we don't mutate it non-immutable objects
... | javascript | function denormalizeEntity(entityOrId, entities, schema, bag) {
const key = schema.key;
const { entity, id } = resolveEntityOrId(entityOrId, entities, schema);
if (!bag.hasOwnProperty(key)) {
bag[key] = {};
}
if (!bag[key].hasOwnProperty(id)) {
// Ensure we don't mutate it non-immutable objects
... | [
"function",
"denormalizeEntity",
"(",
"entityOrId",
",",
"entities",
",",
"schema",
",",
"bag",
")",
"{",
"const",
"key",
"=",
"schema",
".",
"key",
";",
"const",
"{",
"entity",
",",
"id",
"}",
"=",
"resolveEntityOrId",
"(",
"entityOrId",
",",
"entities",
... | Takes an entity, saves a reference to it in the 'bag' and then denormalizes
it. Saving the reference is necessary for circular dependencies.
@param {object|Immutable.Map|number|string} entityOrId
@param {object|Immutable.Map} entities
@param {schema.Entity} schema
@param {object} bag
@returns {object|Immutable... | [
"Takes",
"an",
"entity",
"saves",
"a",
"reference",
"to",
"it",
"in",
"the",
"bag",
"and",
"then",
"denormalizes",
"it",
".",
"Saving",
"the",
"reference",
"is",
"necessary",
"for",
"circular",
"dependencies",
"."
] | 11baeab9e9cb058f1096196d0d4c2e42e0ef8937 | https://github.com/gpbl/denormalizr/blob/11baeab9e9cb058f1096196d0d4c2e42e0ef8937/src/index.js#L129-L148 | train |
VividCortex/angular-recaptcha | release/angular-recaptcha.js | function (elm, conf) {
conf.sitekey = conf.key || config.key;
conf.theme = conf.theme || config.theme;
conf.stoken = conf.stoken || config.stoken;
conf.size = conf.size || config.size;
conf.type = conf.type || config.ty... | javascript | function (elm, conf) {
conf.sitekey = conf.key || config.key;
conf.theme = conf.theme || config.theme;
conf.stoken = conf.stoken || config.stoken;
conf.size = conf.size || config.size;
conf.type = conf.type || config.ty... | [
"function",
"(",
"elm",
",",
"conf",
")",
"{",
"conf",
".",
"sitekey",
"=",
"conf",
".",
"key",
"||",
"config",
".",
"key",
";",
"conf",
".",
"theme",
"=",
"conf",
".",
"theme",
"||",
"config",
".",
"theme",
";",
"conf",
".",
"stoken",
"=",
"conf... | Creates a new reCaptcha object
@param elm the DOM element where to put the captcha
@param conf the captcha object configuration
@throws NoKeyException if no key is provided in the provider config or the directive instance (via attribute) | [
"Creates",
"a",
"new",
"reCaptcha",
"object"
] | 73d01e431d07f2fc9b84c5e62677e8ed5b41a377 | https://github.com/VividCortex/angular-recaptcha/blob/73d01e431d07f2fc9b84c5e62677e8ed5b41a377/release/angular-recaptcha.js#L189-L207 | train | |
jeka-kiselyov/dimeshift | public/scripts/app/views/dialogs/logout.js | function() {
App.currentUser.signOut();
App.viewStack.clear();
App.router.redirect('/');
$('#fill_profile_invitation').hide();
} | javascript | function() {
App.currentUser.signOut();
App.viewStack.clear();
App.router.redirect('/');
$('#fill_profile_invitation').hide();
} | [
"function",
"(",
")",
"{",
"App",
".",
"currentUser",
".",
"signOut",
"(",
")",
";",
"App",
".",
"viewStack",
".",
"clear",
"(",
")",
";",
"App",
".",
"router",
".",
"redirect",
"(",
"'/'",
")",
";",
"$",
"(",
"'#fill_profile_invitation'",
")",
".",
... | don't need template for this one, as we are not going to show it | [
"don",
"t",
"need",
"template",
"for",
"this",
"one",
"as",
"we",
"are",
"not",
"going",
"to",
"show",
"it"
] | 45063f370728d5cfa989d2c6b2a4e2c50bc9eec7 | https://github.com/jeka-kiselyov/dimeshift/blob/45063f370728d5cfa989d2c6b2a4e2c50bc9eec7/public/scripts/app/views/dialogs/logout.js#L5-L10 | train | |
jeka-kiselyov/dimeshift | Gruntfile.js | function(nodemon) {
nodemon.on('log', function(event) {
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function() {
// Delay before server listens on port
setTimeout(function()... | javascript | function(nodemon) {
nodemon.on('log', function(event) {
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function() {
// Delay before server listens on port
setTimeout(function()... | [
"function",
"(",
"nodemon",
")",
"{",
"nodemon",
".",
"on",
"(",
"'log'",
",",
"function",
"(",
"event",
")",
"{",
"console",
".",
"log",
"(",
"event",
".",
"colour",
")",
";",
"}",
")",
";",
"// opens browser on initial server start",
"nodemon",
".",
"o... | omit this property if you aren't serving HTML files and don't want to open a browser tab on start | [
"omit",
"this",
"property",
"if",
"you",
"aren",
"t",
"serving",
"HTML",
"files",
"and",
"don",
"t",
"want",
"to",
"open",
"a",
"browser",
"tab",
"on",
"start"
] | 45063f370728d5cfa989d2c6b2a4e2c50bc9eec7 | https://github.com/jeka-kiselyov/dimeshift/blob/45063f370728d5cfa989d2c6b2a4e2c50bc9eec7/Gruntfile.js#L24-L44 | train | |
conveyal/transitive.js | lib/renderer/renderededge.js | constuctIdListString | function constuctIdListString (items) {
var idArr = []
forEach(items, item => {
idArr.push(item.getId())
})
idArr.sort()
return idArr.join(',')
} | javascript | function constuctIdListString (items) {
var idArr = []
forEach(items, item => {
idArr.push(item.getId())
})
idArr.sort()
return idArr.join(',')
} | [
"function",
"constuctIdListString",
"(",
"items",
")",
"{",
"var",
"idArr",
"=",
"[",
"]",
"forEach",
"(",
"items",
",",
"item",
"=>",
"{",
"idArr",
".",
"push",
"(",
"item",
".",
"getId",
"(",
")",
")",
"}",
")",
"idArr",
".",
"sort",
"(",
")",
... | Helper method to construct a merged ID string from a list of items with
their own IDs | [
"Helper",
"method",
"to",
"construct",
"a",
"merged",
"ID",
"string",
"from",
"a",
"list",
"of",
"items",
"with",
"their",
"own",
"IDs"
] | 4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b | https://github.com/conveyal/transitive.js/blob/4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b/lib/renderer/renderededge.js#L262-L269 | train |
conveyal/transitive.js | lib/display/tile-layer.js | zoomed | function zoomed () {
// Get the height and width
height = el.clientHeight
width = el.clientWidth
// Set the map tile size
tile.size([width, height])
// Get the current display bounds
var bounds = display.llBounds()
// Project the bounds based on the current projection
var psw = pr... | javascript | function zoomed () {
// Get the height and width
height = el.clientHeight
width = el.clientWidth
// Set the map tile size
tile.size([width, height])
// Get the current display bounds
var bounds = display.llBounds()
// Project the bounds based on the current projection
var psw = pr... | [
"function",
"zoomed",
"(",
")",
"{",
"// Get the height and width",
"height",
"=",
"el",
".",
"clientHeight",
"width",
"=",
"el",
".",
"clientWidth",
"// Set the map tile size",
"tile",
".",
"size",
"(",
"[",
"width",
",",
"height",
"]",
")",
"// Get the current... | Reload tiles on pan and zoom | [
"Reload",
"tiles",
"on",
"pan",
"and",
"zoom"
] | 4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b | https://github.com/conveyal/transitive.js/blob/4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b/lib/display/tile-layer.js#L41-L82 | train |
conveyal/transitive.js | lib/display/tile-layer.js | matrix3d | function matrix3d (scale, translate) {
var k = scale / 256
var r = scale % 1 ? Number : Math.round
return 'matrix3d(' + [k, 0, 0, 0, 0, k, 0, 0, 0, 0, k, 0, r(translate[0] *
scale), r(translate[1] * scale), 0, 1] + ')'
} | javascript | function matrix3d (scale, translate) {
var k = scale / 256
var r = scale % 1 ? Number : Math.round
return 'matrix3d(' + [k, 0, 0, 0, 0, k, 0, 0, 0, 0, k, 0, r(translate[0] *
scale), r(translate[1] * scale), 0, 1] + ')'
} | [
"function",
"matrix3d",
"(",
"scale",
",",
"translate",
")",
"{",
"var",
"k",
"=",
"scale",
"/",
"256",
"var",
"r",
"=",
"scale",
"%",
"1",
"?",
"Number",
":",
"Math",
".",
"round",
"return",
"'matrix3d('",
"+",
"[",
"k",
",",
"0",
",",
"0",
",",... | Get the 3D Transform Matrix | [
"Get",
"the",
"3D",
"Transform",
"Matrix"
] | 4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b | https://github.com/conveyal/transitive.js/blob/4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b/lib/display/tile-layer.js#L116-L121 | train |
conveyal/transitive.js | lib/display/tile-layer.js | prefixMatch | function prefixMatch (p) {
var i = -1
var n = p.length
var s = document.body.style
while (++i < n) {
if (p[i] + 'Transform' in s) return '-' + p[i].toLowerCase() + '-'
}
return ''
} | javascript | function prefixMatch (p) {
var i = -1
var n = p.length
var s = document.body.style
while (++i < n) {
if (p[i] + 'Transform' in s) return '-' + p[i].toLowerCase() + '-'
}
return ''
} | [
"function",
"prefixMatch",
"(",
"p",
")",
"{",
"var",
"i",
"=",
"-",
"1",
"var",
"n",
"=",
"p",
".",
"length",
"var",
"s",
"=",
"document",
".",
"body",
".",
"style",
"while",
"(",
"++",
"i",
"<",
"n",
")",
"{",
"if",
"(",
"p",
"[",
"i",
"]... | Match the transform prefix | [
"Match",
"the",
"transform",
"prefix"
] | 4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b | https://github.com/conveyal/transitive.js/blob/4ba541f40f2dcbfd77f11028da07bd3cec9f2b0b/lib/display/tile-layer.js#L127-L135 | train |
lukasmartinelli/mapbox-gl-inspect | lib/stylegen.js | generateInspectStyle | function generateInspectStyle(originalMapStyle, coloredLayers, opts) {
opts = Object.assign({
backgroundColor: '#fff'
}, opts);
var backgroundLayer = {
'id': 'background',
'type': 'background',
'paint': {
'background-color': opts.backgroundColor
}
};
var sources = {};
Object.keys... | javascript | function generateInspectStyle(originalMapStyle, coloredLayers, opts) {
opts = Object.assign({
backgroundColor: '#fff'
}, opts);
var backgroundLayer = {
'id': 'background',
'type': 'background',
'paint': {
'background-color': opts.backgroundColor
}
};
var sources = {};
Object.keys... | [
"function",
"generateInspectStyle",
"(",
"originalMapStyle",
",",
"coloredLayers",
",",
"opts",
")",
"{",
"opts",
"=",
"Object",
".",
"assign",
"(",
"{",
"backgroundColor",
":",
"'#fff'",
"}",
",",
"opts",
")",
";",
"var",
"backgroundLayer",
"=",
"{",
"'id'"... | Create inspection style out of the original style and the new colored layers
@param {Object} Original map styles
@param {array} Array of colored Mapbox GL layers
@return {Object} Colored inspect style | [
"Create",
"inspection",
"style",
"out",
"of",
"the",
"original",
"style",
"and",
"the",
"new",
"colored",
"layers"
] | 19dd99ebf3e0ea639ba7044d2e52563706614a93 | https://github.com/lukasmartinelli/mapbox-gl-inspect/blob/19dd99ebf3e0ea639ba7044d2e52563706614a93/lib/stylegen.js#L108-L133 | train |
lukasmartinelli/mapbox-gl-inspect | lib/colors.js | brightColor | function brightColor(layerId, alpha) {
var luminosity = 'bright';
var hue = null;
if (/water|ocean|lake|sea|river/.test(layerId)) {
hue = 'blue';
}
if (/state|country|place/.test(layerId)) {
hue = 'pink';
}
if (/road|highway|transport/.test(layerId)) {
hue = 'orange';
}
if (/contour|bu... | javascript | function brightColor(layerId, alpha) {
var luminosity = 'bright';
var hue = null;
if (/water|ocean|lake|sea|river/.test(layerId)) {
hue = 'blue';
}
if (/state|country|place/.test(layerId)) {
hue = 'pink';
}
if (/road|highway|transport/.test(layerId)) {
hue = 'orange';
}
if (/contour|bu... | [
"function",
"brightColor",
"(",
"layerId",
",",
"alpha",
")",
"{",
"var",
"luminosity",
"=",
"'bright'",
";",
"var",
"hue",
"=",
"null",
";",
"if",
"(",
"/",
"water|ocean|lake|sea|river",
"/",
".",
"test",
"(",
"layerId",
")",
")",
"{",
"hue",
"=",
"'b... | Assign a color to a unique layer ID and also considering
common layer names such as water or wood.
@param {string} layerId
@return {string} Unique random for the layer ID | [
"Assign",
"a",
"color",
"to",
"a",
"unique",
"layer",
"ID",
"and",
"also",
"considering",
"common",
"layer",
"names",
"such",
"as",
"water",
"or",
"wood",
"."
] | 19dd99ebf3e0ea639ba7044d2e52563706614a93 | https://github.com/lukasmartinelli/mapbox-gl-inspect/blob/19dd99ebf3e0ea639ba7044d2e52563706614a93/lib/colors.js#L9-L50 | train |
larrymyers/jasmine-reporters | src/appveyor_reporter.js | setApi | function setApi() {
self.api = {};
if(process && process.env && process.env.APPVEYOR_API_URL) {
var fullUrl = process.env.APPVEYOR_API_URL;
var urlParts = fullUrl.split("/")[2].split(":");
self.api = {
host: urlParts[0],
... | javascript | function setApi() {
self.api = {};
if(process && process.env && process.env.APPVEYOR_API_URL) {
var fullUrl = process.env.APPVEYOR_API_URL;
var urlParts = fullUrl.split("/")[2].split(":");
self.api = {
host: urlParts[0],
... | [
"function",
"setApi",
"(",
")",
"{",
"self",
".",
"api",
"=",
"{",
"}",
";",
"if",
"(",
"process",
"&&",
"process",
".",
"env",
"&&",
"process",
".",
"env",
".",
"APPVEYOR_API_URL",
")",
"{",
"var",
"fullUrl",
"=",
"process",
".",
"env",
".",
"APPV... | set API host information | [
"set",
"API",
"host",
"information"
] | 4487b61e0681ae81015795738c4c2ef138b2d3ba | https://github.com/larrymyers/jasmine-reporters/blob/4487b61e0681ae81015795738c4c2ef138b2d3ba/src/appveyor_reporter.js#L71-L86 | train |
larrymyers/jasmine-reporters | src/appveyor_reporter.js | postSpecsToAppVeyor | function postSpecsToAppVeyor() {
log.info(inColor("Posting spec batch to AppVeyor API", "magenta"));
var postData = JSON.stringify(self.unreportedSpecs);
var options = {
host: self.api.host,
path: self.api.endpoint,
port: self.api.por... | javascript | function postSpecsToAppVeyor() {
log.info(inColor("Posting spec batch to AppVeyor API", "magenta"));
var postData = JSON.stringify(self.unreportedSpecs);
var options = {
host: self.api.host,
path: self.api.endpoint,
port: self.api.por... | [
"function",
"postSpecsToAppVeyor",
"(",
")",
"{",
"log",
".",
"info",
"(",
"inColor",
"(",
"\"Posting spec batch to AppVeyor API\"",
",",
"\"magenta\"",
")",
")",
";",
"var",
"postData",
"=",
"JSON",
".",
"stringify",
"(",
"self",
".",
"unreportedSpecs",
")",
... | post batch to AppVeyor API | [
"post",
"batch",
"to",
"AppVeyor",
"API"
] | 4487b61e0681ae81015795738c4c2ef138b2d3ba | https://github.com/larrymyers/jasmine-reporters/blob/4487b61e0681ae81015795738c4c2ef138b2d3ba/src/appveyor_reporter.js#L130-L168 | train |
larrymyers/jasmine-reporters | src/appveyor_reporter.js | getOutcome | function getOutcome(spec) {
var outcome = "None";
if(isFailed(spec)) {
outcome = "Failed";
}
if(isDisabled(spec)) {
outcome = "Ignored";
}
if(isSkipped(spec)) {
outcome = "Skipped";
}
... | javascript | function getOutcome(spec) {
var outcome = "None";
if(isFailed(spec)) {
outcome = "Failed";
}
if(isDisabled(spec)) {
outcome = "Ignored";
}
if(isSkipped(spec)) {
outcome = "Skipped";
}
... | [
"function",
"getOutcome",
"(",
"spec",
")",
"{",
"var",
"outcome",
"=",
"\"None\"",
";",
"if",
"(",
"isFailed",
"(",
"spec",
")",
")",
"{",
"outcome",
"=",
"\"Failed\"",
";",
"}",
"if",
"(",
"isDisabled",
"(",
"spec",
")",
")",
"{",
"outcome",
"=",
... | detect spec outcome and return AppVeyor literals | [
"detect",
"spec",
"outcome",
"and",
"return",
"AppVeyor",
"literals"
] | 4487b61e0681ae81015795738c4c2ef138b2d3ba | https://github.com/larrymyers/jasmine-reporters/blob/4487b61e0681ae81015795738c4c2ef138b2d3ba/src/appveyor_reporter.js#L171-L191 | train |
larrymyers/jasmine-reporters | src/appveyor_reporter.js | mapSpecToResult | function mapSpecToResult(spec) {
var firstFailedExpectation = spec.failedExpectations[0] || {};
var result = {
testName: spec.fullName,
testFramework: "jasmine2",
durationMilliseconds: elapsed(spec.__startTime, spec.__endTime),
ou... | javascript | function mapSpecToResult(spec) {
var firstFailedExpectation = spec.failedExpectations[0] || {};
var result = {
testName: spec.fullName,
testFramework: "jasmine2",
durationMilliseconds: elapsed(spec.__startTime, spec.__endTime),
ou... | [
"function",
"mapSpecToResult",
"(",
"spec",
")",
"{",
"var",
"firstFailedExpectation",
"=",
"spec",
".",
"failedExpectations",
"[",
"0",
"]",
"||",
"{",
"}",
";",
"var",
"result",
"=",
"{",
"testName",
":",
"spec",
".",
"fullName",
",",
"testFramework",
":... | map jasmine spec to AppVeyor test result | [
"map",
"jasmine",
"spec",
"to",
"AppVeyor",
"test",
"result"
] | 4487b61e0681ae81015795738c4c2ef138b2d3ba | https://github.com/larrymyers/jasmine-reporters/blob/4487b61e0681ae81015795738c4c2ef138b2d3ba/src/appveyor_reporter.js#L194-L208 | train |
larrymyers/jasmine-reporters | src/teamcity_reporter.js | tclog | function tclog(message, attrs) {
var str = "##teamcity[" + message;
if (typeof(attrs) === "object") {
if (!("timestamp" in attrs)) {
attrs.timestamp = new Date();
}
for (var prop in attrs) {
if (attrs.hasOwnP... | javascript | function tclog(message, attrs) {
var str = "##teamcity[" + message;
if (typeof(attrs) === "object") {
if (!("timestamp" in attrs)) {
attrs.timestamp = new Date();
}
for (var prop in attrs) {
if (attrs.hasOwnP... | [
"function",
"tclog",
"(",
"message",
",",
"attrs",
")",
"{",
"var",
"str",
"=",
"\"##teamcity[\"",
"+",
"message",
";",
"if",
"(",
"typeof",
"(",
"attrs",
")",
"===",
"\"object\"",
")",
"{",
"if",
"(",
"!",
"(",
"\"timestamp\"",
"in",
"attrs",
")",
"... | shorthand for logging TeamCity messages defined here because it needs access to the `delegates` closure variable | [
"shorthand",
"for",
"logging",
"TeamCity",
"messages",
"defined",
"here",
"because",
"it",
"needs",
"access",
"to",
"the",
"delegates",
"closure",
"variable"
] | 4487b61e0681ae81015795738c4c2ef138b2d3ba | https://github.com/larrymyers/jasmine-reporters/blob/4487b61e0681ae81015795738c4c2ef138b2d3ba/src/teamcity_reporter.js#L150-L167 | train |
svgdotjs/svg.select.js | src/svg.select.js | function (value, options) {
// Check the parameters and reassign if needed
if (typeof value === 'object') {
options = value;
value = true;
}
var selectHandler = this.remember('_selectHandler') || new SelectHandler(this);
selectHandler.init(value === und... | javascript | function (value, options) {
// Check the parameters and reassign if needed
if (typeof value === 'object') {
options = value;
value = true;
}
var selectHandler = this.remember('_selectHandler') || new SelectHandler(this);
selectHandler.init(value === und... | [
"function",
"(",
"value",
",",
"options",
")",
"{",
"// Check the parameters and reassign if needed",
"if",
"(",
"typeof",
"value",
"===",
"'object'",
")",
"{",
"options",
"=",
"value",
";",
"value",
"=",
"true",
";",
"}",
"var",
"selectHandler",
"=",
"this",
... | Select element with mouse | [
"Select",
"element",
"with",
"mouse"
] | 28996aeea6de8bd86fb4eda2ef423121aaa6980a | https://github.com/svgdotjs/svg.select.js/blob/28996aeea6de8bd86fb4eda2ef423121aaa6980a/src/svg.select.js#L385-L399 | train | |
jonschlinkert/en-route | lib/route.js | handle | function handle(route, file) {
route.status = 'starting';
route.emit('handle', file);
for (let layer of route.stack) {
route.emit('layer', layer, file);
layer.handle(file);
}
route.status = 'finished';
route.emit('handle', file);
return file;
} | javascript | function handle(route, file) {
route.status = 'starting';
route.emit('handle', file);
for (let layer of route.stack) {
route.emit('layer', layer, file);
layer.handle(file);
}
route.status = 'finished';
route.emit('handle', file);
return file;
} | [
"function",
"handle",
"(",
"route",
",",
"file",
")",
"{",
"route",
".",
"status",
"=",
"'starting'",
";",
"route",
".",
"emit",
"(",
"'handle'",
",",
"file",
")",
";",
"for",
"(",
"let",
"layer",
"of",
"route",
".",
"stack",
")",
"{",
"route",
"."... | Sync method, used when options.sync is true | [
"Sync",
"method",
"used",
"when",
"options",
".",
"sync",
"is",
"true"
] | e556b051a68a79ea08bb15925a2bb32850a4d98a | https://github.com/jonschlinkert/en-route/blob/e556b051a68a79ea08bb15925a2bb32850a4d98a/lib/route.js#L144-L156 | train |
jonschlinkert/en-route | lib/to-regex.js | toRegexpSource | function toRegexpSource(val, keys, options) {
if (Array.isArray(val)) {
return arrayToRegexp(val, keys, options);
}
if (val instanceof RegExp) {
return regexpToRegexp(val, keys, options);
}
return stringToRegexp(val, keys, options);
} | javascript | function toRegexpSource(val, keys, options) {
if (Array.isArray(val)) {
return arrayToRegexp(val, keys, options);
}
if (val instanceof RegExp) {
return regexpToRegexp(val, keys, options);
}
return stringToRegexp(val, keys, options);
} | [
"function",
"toRegexpSource",
"(",
"val",
",",
"keys",
",",
"options",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"{",
"return",
"arrayToRegexp",
"(",
"val",
",",
"keys",
",",
"options",
")",
";",
"}",
"if",
"(",
"val",
"in... | Create a regexp source string from the given value.
@param {string|array|regexp} val
@param {array} keys
@param {object} options
@return {regexp}
@api public | [
"Create",
"a",
"regexp",
"source",
"string",
"from",
"the",
"given",
"value",
"."
] | e556b051a68a79ea08bb15925a2bb32850a4d98a | https://github.com/jonschlinkert/en-route/blob/e556b051a68a79ea08bb15925a2bb32850a4d98a/lib/to-regex.js#L34-L44 | train |
jonschlinkert/en-route | lib/to-regex.js | stringToRegexp | function stringToRegexp(str, keys, options = {}) {
let tokens = parse(str, options);
let end = options.end !== false;
let strict = options.strict;
let delimiter = options.delimiter ? escapeString(options.delimiter) : '\\/';
let delimiters = options.delimiters || './';
let endsWith = [].concat(options.endsWi... | javascript | function stringToRegexp(str, keys, options = {}) {
let tokens = parse(str, options);
let end = options.end !== false;
let strict = options.strict;
let delimiter = options.delimiter ? escapeString(options.delimiter) : '\\/';
let delimiters = options.delimiters || './';
let endsWith = [].concat(options.endsWi... | [
"function",
"stringToRegexp",
"(",
"str",
",",
"keys",
",",
"options",
"=",
"{",
"}",
")",
"{",
"let",
"tokens",
"=",
"parse",
"(",
"str",
",",
"options",
")",
";",
"let",
"end",
"=",
"options",
".",
"end",
"!==",
"false",
";",
"let",
"strict",
"="... | Create a regular expression from the given string.
@param {string} str
@param {Array=} keys
@param {Object=} options
@return {!RegExp} | [
"Create",
"a",
"regular",
"expression",
"from",
"the",
"given",
"string",
"."
] | e556b051a68a79ea08bb15925a2bb32850a4d98a | https://github.com/jonschlinkert/en-route/blob/e556b051a68a79ea08bb15925a2bb32850a4d98a/lib/to-regex.js#L55-L103 | train |
jonschlinkert/en-route | lib/to-regex.js | arrayToRegexp | function arrayToRegexp(arr, keys, options) {
let parts = [];
arr.forEach(ele => parts.push(toRegexpSource(ele, keys, options)));
return new RegExp(`(?:${parts.join('|')})`, flags(options));
} | javascript | function arrayToRegexp(arr, keys, options) {
let parts = [];
arr.forEach(ele => parts.push(toRegexpSource(ele, keys, options)));
return new RegExp(`(?:${parts.join('|')})`, flags(options));
} | [
"function",
"arrayToRegexp",
"(",
"arr",
",",
"keys",
",",
"options",
")",
"{",
"let",
"parts",
"=",
"[",
"]",
";",
"arr",
".",
"forEach",
"(",
"ele",
"=>",
"parts",
".",
"push",
"(",
"toRegexpSource",
"(",
"ele",
",",
"keys",
",",
"options",
")",
... | Transform an array into a regular expression.
@param {!Array} arr
@param {Array=} keys
@param {Object=} options
@return {!RegExp} | [
"Transform",
"an",
"array",
"into",
"a",
"regular",
"expression",
"."
] | e556b051a68a79ea08bb15925a2bb32850a4d98a | https://github.com/jonschlinkert/en-route/blob/e556b051a68a79ea08bb15925a2bb32850a4d98a/lib/to-regex.js#L114-L118 | train |
jonschlinkert/en-route | lib/to-regex.js | regexpToRegexp | function regexpToRegexp(regex, keys, options) {
if (!Array.isArray(keys)) return regex.source;
let groups = regex.source.match(/\((?!\?)/g);
if (!groups) return regex.source;
let i = 0;
let group = () => ({
name: i++,
prefix: null,
delimiter: null,
optional: false,
repeat: false,
par... | javascript | function regexpToRegexp(regex, keys, options) {
if (!Array.isArray(keys)) return regex.source;
let groups = regex.source.match(/\((?!\?)/g);
if (!groups) return regex.source;
let i = 0;
let group = () => ({
name: i++,
prefix: null,
delimiter: null,
optional: false,
repeat: false,
par... | [
"function",
"regexpToRegexp",
"(",
"regex",
",",
"keys",
",",
"options",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"keys",
")",
")",
"return",
"regex",
".",
"source",
";",
"let",
"groups",
"=",
"regex",
".",
"source",
".",
"match",
"(",... | Create keys from match groups in the given regex
@param {!RegExp} path
@param {Array=} keys
@return {!RegExp} | [
"Create",
"keys",
"from",
"match",
"groups",
"in",
"the",
"given",
"regex"
] | e556b051a68a79ea08bb15925a2bb32850a4d98a | https://github.com/jonschlinkert/en-route/blob/e556b051a68a79ea08bb15925a2bb32850a4d98a/lib/to-regex.js#L127-L146 | train |
jeromegn/Backbone.localStorage | src/driver.js | getSyncMethod | function getSyncMethod(model, options = {}) {
const forceAjaxSync = options.ajaxSync;
const hasLocalStorage = getLocalStorage(model);
return !forceAjaxSync && hasLocalStorage ? localSync : ajaxSync;
} | javascript | function getSyncMethod(model, options = {}) {
const forceAjaxSync = options.ajaxSync;
const hasLocalStorage = getLocalStorage(model);
return !forceAjaxSync && hasLocalStorage ? localSync : ajaxSync;
} | [
"function",
"getSyncMethod",
"(",
"model",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"forceAjaxSync",
"=",
"options",
".",
"ajaxSync",
";",
"const",
"hasLocalStorage",
"=",
"getLocalStorage",
"(",
"model",
")",
";",
"return",
"!",
"forceAjaxSync",
"&... | Get the local or ajax sync call
@param {Model} model - Model to sync
@param {object} options - Options to pass, takes ajaxSync
@returns {function} The sync method that will be called | [
"Get",
"the",
"local",
"or",
"ajax",
"sync",
"call"
] | 560df91a82630e491cc225cb2c7e68ec77ef697e | https://github.com/jeromegn/Backbone.localStorage/blob/560df91a82630e491cc225cb2c7e68ec77ef697e/src/driver.js#L16-L21 | train |
CartoDB/carto.js | src/geo/geocoder/mapbox-geocoder.js | _formatResponse | function _formatResponse (rawMapboxResponse) {
if (!rawMapboxResponse.features.length) {
return [];
}
return [{
boundingbox: _getBoundingBox(rawMapboxResponse.features[0]),
center: _getCenter(rawMapboxResponse.features[0]),
type: _getType(rawMapboxResponse.features[0])
}];
} | javascript | function _formatResponse (rawMapboxResponse) {
if (!rawMapboxResponse.features.length) {
return [];
}
return [{
boundingbox: _getBoundingBox(rawMapboxResponse.features[0]),
center: _getCenter(rawMapboxResponse.features[0]),
type: _getType(rawMapboxResponse.features[0])
}];
} | [
"function",
"_formatResponse",
"(",
"rawMapboxResponse",
")",
"{",
"if",
"(",
"!",
"rawMapboxResponse",
".",
"features",
".",
"length",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"[",
"{",
"boundingbox",
":",
"_getBoundingBox",
"(",
"rawMapboxResponse",... | Transform a mapbox geocoder response on a object friendly with our search widget.
@param {object} rawMapboxResponse - The raw mapbox geocoding response, {@see https://www.mapbox.com/api-documentation/?language=JavaScript#response-object} | [
"Transform",
"a",
"mapbox",
"geocoder",
"response",
"on",
"a",
"object",
"friendly",
"with",
"our",
"search",
"widget",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/geo/geocoder/mapbox-geocoder.js#L38-L47 | train |
CartoDB/carto.js | src/api/v4/layer/layer.js | Layer | function Layer (source, style, options = {}) {
Base.apply(this, arguments);
_checkSource(source);
_checkStyle(style);
this._client = undefined;
this._engine = undefined;
this._internalModel = undefined;
this._source = source;
this._style = style;
this._visible = _.isBoolean(options.visible) ? optio... | javascript | function Layer (source, style, options = {}) {
Base.apply(this, arguments);
_checkSource(source);
_checkStyle(style);
this._client = undefined;
this._engine = undefined;
this._internalModel = undefined;
this._source = source;
this._style = style;
this._visible = _.isBoolean(options.visible) ? optio... | [
"function",
"Layer",
"(",
"source",
",",
"style",
",",
"options",
"=",
"{",
"}",
")",
"{",
"Base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"_checkSource",
"(",
"source",
")",
";",
"_checkStyle",
"(",
"style",
")",
";",
"this",
".",
"... | Represents a layer Object.
A layer is the primary way to visualize geospatial data.
To create a layer a {@link carto.source.Base|source} and {@link carto.style.Base|styles}
are required:
- The {@link carto.source.Base|source} is used to know **what** data will be displayed in the Layer.
- The {@link carto.style.Base... | [
"Represents",
"a",
"layer",
"Object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/layer.js#L84-L104 | train |
CartoDB/carto.js | src/api/v4/layer/layer.js | _getInteractivityFields | function _getInteractivityFields (columns) {
var fields = columns.map(function (column, index) {
return {
name: column,
title: true,
position: index
};
});
return {
fields: fields
};
} | javascript | function _getInteractivityFields (columns) {
var fields = columns.map(function (column, index) {
return {
name: column,
title: true,
position: index
};
});
return {
fields: fields
};
} | [
"function",
"_getInteractivityFields",
"(",
"columns",
")",
"{",
"var",
"fields",
"=",
"columns",
".",
"map",
"(",
"function",
"(",
"column",
",",
"index",
")",
"{",
"return",
"{",
"name",
":",
"column",
",",
"title",
":",
"true",
",",
"position",
":",
... | Scope functions
Transform the columns array into the format expected by the CartoDBLayer. | [
"Scope",
"functions",
"Transform",
"the",
"columns",
"array",
"into",
"the",
"format",
"expected",
"by",
"the",
"CartoDBLayer",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/layer.js#L474-L486 | train |
CartoDB/carto.js | src/api/v4/layer/layer.js | _validateAggregationColumnsAndInteractivity | function _validateAggregationColumnsAndInteractivity (aggregationColumns, clickColumns, overColumns) {
var aggColumns = (aggregationColumns && Object.keys(aggregationColumns)) || [];
_validateColumnsConcordance(aggColumns, clickColumns, 'featureClick');
_validateColumnsConcordance(aggColumns, overColumns, 'featu... | javascript | function _validateAggregationColumnsAndInteractivity (aggregationColumns, clickColumns, overColumns) {
var aggColumns = (aggregationColumns && Object.keys(aggregationColumns)) || [];
_validateColumnsConcordance(aggColumns, clickColumns, 'featureClick');
_validateColumnsConcordance(aggColumns, overColumns, 'featu... | [
"function",
"_validateAggregationColumnsAndInteractivity",
"(",
"aggregationColumns",
",",
"clickColumns",
",",
"overColumns",
")",
"{",
"var",
"aggColumns",
"=",
"(",
"aggregationColumns",
"&&",
"Object",
".",
"keys",
"(",
"aggregationColumns",
")",
")",
"||",
"[",
... | When there are aggregated columns and interactivity columns they must agree | [
"When",
"there",
"are",
"aggregated",
"columns",
"and",
"interactivity",
"columns",
"they",
"must",
"agree"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/layer.js#L526-L531 | train |
CartoDB/carto.js | src/api/v4/dataview/category/parse-data.js | parseCategoryData | function parseCategoryData (data, count, max, min, nulls, operation) {
if (!data) {
return null;
}
/**
* @typedef {object} carto.dataview.CategoryData
* @property {number} count - The total number of categories
* @property {number} max - Maximum category value
* @property {number} min - Minimum ca... | javascript | function parseCategoryData (data, count, max, min, nulls, operation) {
if (!data) {
return null;
}
/**
* @typedef {object} carto.dataview.CategoryData
* @property {number} count - The total number of categories
* @property {number} max - Maximum category value
* @property {number} min - Minimum ca... | [
"function",
"parseCategoryData",
"(",
"data",
",",
"count",
",",
"max",
",",
"min",
",",
"nulls",
",",
"operation",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"null",
";",
"}",
"/**\n * @typedef {object} carto.dataview.CategoryData\n * @property {nu... | Transform the data obtained from an internal category dataview into a
public object.
@param {object[]} data
@param {number} count
@param {number} max
@param {number} min
@param {number} nulls
@param {string} operation
@return {carto.dataview.CategoryData} - The parsed and formatted data for the given parameters | [
"Transform",
"the",
"data",
"obtained",
"from",
"an",
"internal",
"category",
"dataview",
"into",
"a",
"public",
"object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/dataview/category/parse-data.js#L16-L38 | train |
CartoDB/carto.js | src/api/v4/client.js | Client | function Client (settings) {
settings.serverUrl = (settings.serverUrl || DEFAULT_SERVER_URL).replace(/{username}/, settings.username || '');
_checkSettings(settings);
this._layers = new Layers();
this._dataviews = [];
this._engine = new Engine({
apiKey: settings.apiKey,
username: settings.username,
... | javascript | function Client (settings) {
settings.serverUrl = (settings.serverUrl || DEFAULT_SERVER_URL).replace(/{username}/, settings.username || '');
_checkSettings(settings);
this._layers = new Layers();
this._dataviews = [];
this._engine = new Engine({
apiKey: settings.apiKey,
username: settings.username,
... | [
"function",
"Client",
"(",
"settings",
")",
"{",
"settings",
".",
"serverUrl",
"=",
"(",
"settings",
".",
"serverUrl",
"||",
"DEFAULT_SERVER_URL",
")",
".",
"replace",
"(",
"/",
"{username}",
"/",
",",
"settings",
".",
"username",
"||",
"''",
")",
";",
"... | This is the entry point for a CARTO.js application.
A CARTO client allows managing layers and dataviews. Some operations like addding a layer or a dataview are asynchronous.
The client takes care of the communication between CARTO.js and the server for you.
To create a new client you need a CARTO account, where you w... | [
"This",
"is",
"the",
"entry",
"point",
"for",
"a",
"CARTO",
".",
"js",
"application",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/client.js#L53-L65 | train |
CartoDB/carto.js | src/vis/tooltip-manager.js | function (deps) {
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.tooltipModel) throw new Error('tooltipModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
this._mapModel = deps.mapModel;
this._tooltipModel = deps.tooltipModel;
this._infowi... | javascript | function (deps) {
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.tooltipModel) throw new Error('tooltipModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
this._mapModel = deps.mapModel;
this._tooltipModel = deps.tooltipModel;
this._infowi... | [
"function",
"(",
"deps",
")",
"{",
"if",
"(",
"!",
"deps",
".",
"mapModel",
")",
"throw",
"new",
"Error",
"(",
"'mapModel is required'",
")",
";",
"if",
"(",
"!",
"deps",
".",
"tooltipModel",
")",
"throw",
"new",
"Error",
"(",
"'tooltipModel is required'",... | Manages the tooltips for a map. It listens to events triggered by a
CartoDBLayerGroupView and updates models accordingly | [
"Manages",
"the",
"tooltips",
"for",
"a",
"map",
".",
"It",
"listens",
"to",
"events",
"triggered",
"by",
"a",
"CartoDBLayerGroupView",
"and",
"updates",
"models",
"accordingly"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/vis/tooltip-manager.js#L7-L17 | train | |
CartoDB/carto.js | src/api/v4/layer/metadata/categories.js | Categories | function Categories (rule) {
var categoryBuckets = rule.getBucketsWithCategoryFilter();
var defaultBuckets = rule.getBucketsWithDefaultFilter();
/**
* @typedef {object} carto.layer.metadata.Category
* @property {number|string} name - The name of the category
* @property {string} value - The value of the... | javascript | function Categories (rule) {
var categoryBuckets = rule.getBucketsWithCategoryFilter();
var defaultBuckets = rule.getBucketsWithDefaultFilter();
/**
* @typedef {object} carto.layer.metadata.Category
* @property {number|string} name - The name of the category
* @property {string} value - The value of the... | [
"function",
"Categories",
"(",
"rule",
")",
"{",
"var",
"categoryBuckets",
"=",
"rule",
".",
"getBucketsWithCategoryFilter",
"(",
")",
";",
"var",
"defaultBuckets",
"=",
"rule",
".",
"getBucketsWithDefaultFilter",
"(",
")",
";",
"/**\n * @typedef {object} carto.laye... | Metadata type categories
Adding a Turbocarto ramp (with categories) in the style generates a response
from the server with the resulting information after computing the ramp.
This information is wrapped in a metadata object of type 'categories', that
contains a list of categories with the name of the category and the ... | [
"Metadata",
"type",
"categories"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/metadata/categories.js#L25-L44 | train |
CartoDB/carto.js | src/windshaft/response.js | Response | function Response (windshaftSettings, serverResponse) {
this._windshaftSettings = windshaftSettings;
this._layerGroupId = serverResponse.layergroupid;
this._layers = serverResponse.metadata.layers;
this._dataviews = serverResponse.metadata.dataviews;
this._analyses = serverResponse.metadata.analyses;
this._... | javascript | function Response (windshaftSettings, serverResponse) {
this._windshaftSettings = windshaftSettings;
this._layerGroupId = serverResponse.layergroupid;
this._layers = serverResponse.metadata.layers;
this._dataviews = serverResponse.metadata.dataviews;
this._analyses = serverResponse.metadata.analyses;
this._... | [
"function",
"Response",
"(",
"windshaftSettings",
",",
"serverResponse",
")",
"{",
"this",
".",
"_windshaftSettings",
"=",
"windshaftSettings",
";",
"this",
".",
"_layerGroupId",
"=",
"serverResponse",
".",
"layergroupid",
";",
"this",
".",
"_layers",
"=",
"server... | Wrapper over a server response to a map instantiation giving some utility methods.
@constructor
@param {object} windshaftSettings - Object containing the request options.
@param {string} serverResponse - The json string representing a windshaft response to a map instantiation. | [
"Wrapper",
"over",
"a",
"server",
"response",
"to",
"a",
"map",
"instantiation",
"giving",
"some",
"utility",
"methods",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/windshaft/response.js#L10-L17 | train |
CartoDB/carto.js | src/geo/geocoder/tomtom-geocoder.js | _formatResponse | function _formatResponse (rawTomTomResponse) {
if (!rawTomTomResponse.results.length) {
return [];
}
const bestCandidate = rawTomTomResponse.results[0];
return [{
boundingbox: _getBoundingBox(bestCandidate),
center: _getCenter(bestCandidate),
type: _getType(bestCandidate)
}];
} | javascript | function _formatResponse (rawTomTomResponse) {
if (!rawTomTomResponse.results.length) {
return [];
}
const bestCandidate = rawTomTomResponse.results[0];
return [{
boundingbox: _getBoundingBox(bestCandidate),
center: _getCenter(bestCandidate),
type: _getType(bestCandidate)
}];
} | [
"function",
"_formatResponse",
"(",
"rawTomTomResponse",
")",
"{",
"if",
"(",
"!",
"rawTomTomResponse",
".",
"results",
".",
"length",
")",
"{",
"return",
"[",
"]",
";",
"}",
"const",
"bestCandidate",
"=",
"rawTomTomResponse",
".",
"results",
"[",
"0",
"]",
... | Transform a tomtom geocoder response into an object more friendly for our search widget.
@param {object} rawTomTomResponse - The raw tomtom geocoding response, {@see https://developer.tomtom.com/search-api/search-api-documentation-geocoding/geocode} | [
"Transform",
"a",
"tomtom",
"geocoder",
"response",
"into",
"an",
"object",
"more",
"friendly",
"for",
"our",
"search",
"widget",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/geo/geocoder/tomtom-geocoder.js#L42-L53 | train |
CartoDB/carto.js | src/geo/geocoder/tomtom-geocoder.js | _getType | function _getType (result) {
let type = result.type;
if (TYPES[type]) {
if (type === 'Geography' && result.entityType) {
type = type + ':' + result.entityType;
}
return TYPES[type];
}
return 'default';
} | javascript | function _getType (result) {
let type = result.type;
if (TYPES[type]) {
if (type === 'Geography' && result.entityType) {
type = type + ':' + result.entityType;
}
return TYPES[type];
}
return 'default';
} | [
"function",
"_getType",
"(",
"result",
")",
"{",
"let",
"type",
"=",
"result",
".",
"type",
";",
"if",
"(",
"TYPES",
"[",
"type",
"]",
")",
"{",
"if",
"(",
"type",
"===",
"'Geography'",
"&&",
"result",
".",
"entityType",
")",
"{",
"type",
"=",
"typ... | Transform the feature type into a well known enum. | [
"Transform",
"the",
"feature",
"type",
"into",
"a",
"well",
"known",
"enum",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/geo/geocoder/tomtom-geocoder.js#L65-L75 | train |
CartoDB/carto.js | src/api/v4/layer/base.js | Base | function Base (source, layer, options) {
options = options || {};
this._id = options.id || Base.$generateId();
} | javascript | function Base (source, layer, options) {
options = options || {};
this._id = options.id || Base.$generateId();
} | [
"function",
"Base",
"(",
"source",
",",
"layer",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_id",
"=",
"options",
".",
"id",
"||",
"Base",
".",
"$generateId",
"(",
")",
";",
"}"
] | Base layer object.
This object should not be used directly! use {@link carto.layer.Layer} instead.
@constructor
@abstract
@fires error
@memberof carto.layer
@api | [
"Base",
"layer",
"object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/base.js#L15-L18 | train |
CartoDB/carto.js | src/api/v4/dataview/histogram/parse-data.js | parseHistogramData | function parseHistogramData (data, nulls, totalAmount) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @descripti... | javascript | function parseHistogramData (data, nulls, totalAmount) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @descripti... | [
"function",
"parseHistogramData",
"(",
"data",
",",
"nulls",
",",
"totalAmount",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"null",
";",
"}",
"var",
"compactData",
"=",
"_",
".",
"compact",
"(",
"data",
")",
";",
"var",
"maxBin",
"=",
"_",... | Transform the data obtained from an internal histogram dataview into a
public object.
@param {object[]} data - The raw histogram data
@param {number} nulls - Number of data with a null
@param {number} totalAmount - Total number of data in the histogram
@return {carto.dataview.HistogramData} - The parsed and formatted... | [
"Transform",
"the",
"data",
"obtained",
"from",
"an",
"internal",
"histogram",
"dataview",
"into",
"a",
"public",
"object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/dataview/histogram/parse-data.js#L13-L39 | train |
CartoDB/carto.js | src/api/v4/layer/metadata/base.js | Base | function Base (type, rule) {
this._type = type || '';
this._column = rule.getColumn();
this._mapping = rule.getMapping();
this._property = rule.getProperty();
} | javascript | function Base (type, rule) {
this._type = type || '';
this._column = rule.getColumn();
this._mapping = rule.getMapping();
this._property = rule.getProperty();
} | [
"function",
"Base",
"(",
"type",
",",
"rule",
")",
"{",
"this",
".",
"_type",
"=",
"type",
"||",
"''",
";",
"this",
".",
"_column",
"=",
"rule",
".",
"getColumn",
"(",
")",
";",
"this",
".",
"_mapping",
"=",
"rule",
".",
"getMapping",
"(",
")",
"... | Base metadata object
@constructor
@abstract
@memberof carto.layer.metadata
@api | [
"Base",
"metadata",
"object"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/metadata/base.js#L9-L14 | train |
CartoDB/carto.js | src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js | serialize | function serialize (layersCollection, dataviewsCollection) {
var analysisList = AnalysisService.getAnalysisList(layersCollection, dataviewsCollection);
return _generateUniqueAnalysisList(analysisList);
} | javascript | function serialize (layersCollection, dataviewsCollection) {
var analysisList = AnalysisService.getAnalysisList(layersCollection, dataviewsCollection);
return _generateUniqueAnalysisList(analysisList);
} | [
"function",
"serialize",
"(",
"layersCollection",
",",
"dataviewsCollection",
")",
"{",
"var",
"analysisList",
"=",
"AnalysisService",
".",
"getAnalysisList",
"(",
"layersCollection",
",",
"dataviewsCollection",
")",
";",
"return",
"_generateUniqueAnalysisList",
"(",
"a... | Return a payload with the serialization of all the analyses in the
layersCollection and the dataviewsCollection. | [
"Return",
"a",
"payload",
"with",
"the",
"serialization",
"of",
"all",
"the",
"analyses",
"in",
"the",
"layersCollection",
"and",
"the",
"dataviewsCollection",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js#L8-L11 | train |
CartoDB/carto.js | src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js | _generateUniqueAnalysisList | function _generateUniqueAnalysisList (analysisList) {
var analysisIds = {};
return _.reduce(analysisList, function (list, analysis) {
if (!analysisIds[analysis.get('id')] && !_isAnalysisPartOfOtherAnalyses(analysis, analysisList)) {
analysisIds[analysis.get('id')] = true; // keep a set of already added an... | javascript | function _generateUniqueAnalysisList (analysisList) {
var analysisIds = {};
return _.reduce(analysisList, function (list, analysis) {
if (!analysisIds[analysis.get('id')] && !_isAnalysisPartOfOtherAnalyses(analysis, analysisList)) {
analysisIds[analysis.get('id')] = true; // keep a set of already added an... | [
"function",
"_generateUniqueAnalysisList",
"(",
"analysisList",
")",
"{",
"var",
"analysisIds",
"=",
"{",
"}",
";",
"return",
"_",
".",
"reduce",
"(",
"analysisList",
",",
"function",
"(",
"list",
",",
"analysis",
")",
"{",
"if",
"(",
"!",
"analysisIds",
"... | Return an analysis list without duplicated or nested analyses | [
"Return",
"an",
"analysis",
"list",
"without",
"duplicated",
"or",
"nested",
"analyses"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js#L16-L25 | train |
CartoDB/carto.js | src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js | _isAnalysisPartOfOtherAnalyses | function _isAnalysisPartOfOtherAnalyses (analysis, analysisList) {
return _.any(analysisList, function (otherAnalysisModel) {
if (!analysis.equals(otherAnalysisModel)) {
return otherAnalysisModel.findAnalysisById(analysis.get('id'));
}
return false;
});
} | javascript | function _isAnalysisPartOfOtherAnalyses (analysis, analysisList) {
return _.any(analysisList, function (otherAnalysisModel) {
if (!analysis.equals(otherAnalysisModel)) {
return otherAnalysisModel.findAnalysisById(analysis.get('id'));
}
return false;
});
} | [
"function",
"_isAnalysisPartOfOtherAnalyses",
"(",
"analysis",
",",
"analysisList",
")",
"{",
"return",
"_",
".",
"any",
"(",
"analysisList",
",",
"function",
"(",
"otherAnalysisModel",
")",
"{",
"if",
"(",
"!",
"analysis",
".",
"equals",
"(",
"otherAnalysisMode... | Check if an analysis is referenced by other anylisis in the given
analysis collection. | [
"Check",
"if",
"an",
"analysis",
"is",
"referenced",
"by",
"other",
"anylisis",
"in",
"the",
"given",
"analysis",
"collection",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/windshaft/map-serializer/anonymous-map-serializer/analysis-serializer.js#L31-L38 | train |
CartoDB/carto.js | src/core/profiler.js | function (defer) {
if (this.t0 !== null) {
Profiler.new_value(this.name, this._elapsed(), 't', defer);
this.t0 = null;
}
} | javascript | function (defer) {
if (this.t0 !== null) {
Profiler.new_value(this.name, this._elapsed(), 't', defer);
this.t0 = null;
}
} | [
"function",
"(",
"defer",
")",
"{",
"if",
"(",
"this",
".",
"t0",
"!==",
"null",
")",
"{",
"Profiler",
".",
"new_value",
"(",
"this",
".",
"name",
",",
"this",
".",
"_elapsed",
"(",
")",
",",
"'t'",
",",
"defer",
")",
";",
"this",
".",
"t0",
"=... | finish a time measurement and register it ``start`` should be called first, if not this function does not take effect | [
"finish",
"a",
"time",
"measurement",
"and",
"register",
"it",
"start",
"should",
"be",
"called",
"first",
"if",
"not",
"this",
"function",
"does",
"not",
"take",
"effect"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/core/profiler.js#L113-L118 | train | |
CartoDB/carto.js | src/core/profiler.js | function () {
++this.count;
if (this.t0 === null) {
this.start();
return;
}
var elapsed = this._elapsed();
if (elapsed > 1) {
Profiler.new_value(this.name, this.count);
this.count = 0;
this.start();
}
} | javascript | function () {
++this.count;
if (this.t0 === null) {
this.start();
return;
}
var elapsed = this._elapsed();
if (elapsed > 1) {
Profiler.new_value(this.name, this.count);
this.count = 0;
this.start();
}
} | [
"function",
"(",
")",
"{",
"++",
"this",
".",
"count",
";",
"if",
"(",
"this",
".",
"t0",
"===",
"null",
")",
"{",
"this",
".",
"start",
"(",
")",
";",
"return",
";",
"}",
"var",
"elapsed",
"=",
"this",
".",
"_elapsed",
"(",
")",
";",
"if",
"... | measures how many times per second this function is called | [
"measures",
"how",
"many",
"times",
"per",
"second",
"this",
"function",
"is",
"called"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/core/profiler.js#L141-L153 | train | |
CartoDB/carto.js | src/geo/gmaps/gmaps-cartodb-layer-group-view.js | function (coord, zoom, ownerDocument) {
var key = zoom + '/' + coord.x + '/' + coord.y;
if (!this.cache[key]) {
var img = this.cache[key] = new Image(256, 256);
this.cache[key].src = this._getTileUrl(coord, zoom);
this.cache[key].setAttribute('gTileKey', key);
this.cache[key]... | javascript | function (coord, zoom, ownerDocument) {
var key = zoom + '/' + coord.x + '/' + coord.y;
if (!this.cache[key]) {
var img = this.cache[key] = new Image(256, 256);
this.cache[key].src = this._getTileUrl(coord, zoom);
this.cache[key].setAttribute('gTileKey', key);
this.cache[key]... | [
"function",
"(",
"coord",
",",
"zoom",
",",
"ownerDocument",
")",
"{",
"var",
"key",
"=",
"zoom",
"+",
"'/'",
"+",
"coord",
".",
"x",
"+",
"'/'",
"+",
"coord",
".",
"y",
";",
"if",
"(",
"!",
"this",
".",
"cache",
"[",
"key",
"]",
")",
"{",
"v... | Get a tile element from a coordinate, zoom level, and an ownerDocument. | [
"Get",
"a",
"tile",
"element",
"from",
"a",
"coordinate",
"zoom",
"level",
"and",
"an",
"ownerDocument",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/geo/gmaps/gmaps-cartodb-layer-group-view.js#L252-L261 | train | |
CartoDB/carto.js | src/api/v4/source/sql.js | SQL | function SQL (query) {
_checkQuery(query);
this._query = query;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | javascript | function SQL (query) {
_checkQuery(query);
this._query = query;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | [
"function",
"SQL",
"(",
"query",
")",
"{",
"_checkQuery",
"(",
"query",
")",
";",
"this",
".",
"_query",
"=",
"query",
";",
"Base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"_appliedFilters",
".",
"on",
"(",
"'change:filters'... | A SQL Query that can be used as the data source for layers and dataviews.
@param {string} query A SQL query containing a SELECT statement
@fires error
@example
new carto.source.SQL('SELECT * FROM european_cities');
@constructor
@extends carto.source.Base
@memberof carto.source
@fires queryChanged
@api | [
"A",
"SQL",
"Query",
"that",
"can",
"be",
"used",
"as",
"the",
"data",
"source",
"for",
"layers",
"and",
"dataviews",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/source/sql.js#L21-L28 | train |
CartoDB/carto.js | src/windshaft/client.js | function (settings) {
validatePresenceOfOptions(settings, ['urlTemplate', 'userName']);
if (settings.templateName) {
this.endpoints = {
get: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateName, 'jsonp'].join('/'),
post: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateNa... | javascript | function (settings) {
validatePresenceOfOptions(settings, ['urlTemplate', 'userName']);
if (settings.templateName) {
this.endpoints = {
get: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateName, 'jsonp'].join('/'),
post: [WindshaftConfig.MAPS_API_BASE_URL, 'named', settings.templateNa... | [
"function",
"(",
"settings",
")",
"{",
"validatePresenceOfOptions",
"(",
"settings",
",",
"[",
"'urlTemplate'",
",",
"'userName'",
"]",
")",
";",
"if",
"(",
"settings",
".",
"templateName",
")",
"{",
"this",
".",
"endpoints",
"=",
"{",
"get",
":",
"[",
"... | Windshaft client. It provides a method to create instances of maps in Windshaft.
@param {object} options Options to set up the client | [
"Windshaft",
"client",
".",
"It",
"provides",
"a",
"method",
"to",
"create",
"instances",
"of",
"maps",
"in",
"Windshaft",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/windshaft/client.js#L28-L45 | train | |
CartoDB/carto.js | src/api/v4/layer/metadata/buckets.js | Buckets | function Buckets (rule) {
var rangeBuckets = rule.getBucketsWithRangeFilter();
/**
* @typedef {object} carto.layer.metadata.Bucket
* @property {number} min - The minimum range value
* @property {number} max - The maximum range value
* @property {number|string} value - The value of the bucket
* @api
... | javascript | function Buckets (rule) {
var rangeBuckets = rule.getBucketsWithRangeFilter();
/**
* @typedef {object} carto.layer.metadata.Bucket
* @property {number} min - The minimum range value
* @property {number} max - The maximum range value
* @property {number|string} value - The value of the bucket
* @api
... | [
"function",
"Buckets",
"(",
"rule",
")",
"{",
"var",
"rangeBuckets",
"=",
"rule",
".",
"getBucketsWithRangeFilter",
"(",
")",
";",
"/**\n * @typedef {object} carto.layer.metadata.Bucket\n * @property {number} min - The minimum range value\n * @property {number} max - The maximum ... | Metadata type buckets
Adding a Turbocarto ramp (with ranges) in the style generates a response
from the server with the resulting information, after computing the ramp.
This information is wrapped in a metadata object of type 'buckets', that
contains a list of buckets with the range (min, max) and the value. And
also ... | [
"Metadata",
"type",
"buckets"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/metadata/buckets.js#L29-L51 | train |
CartoDB/carto.js | src/api/v4/dataview/formula/parse-data.js | parseFormulaData | function parseFormulaData (nulls, operation, result) {
/**
* @description
* Object containing formula data
*
* @typedef {object} carto.dataview.FormulaData
* @property {number} nulls - Number of null values in the column
* @property {string} operation - Operation used
* @property {number} result ... | javascript | function parseFormulaData (nulls, operation, result) {
/**
* @description
* Object containing formula data
*
* @typedef {object} carto.dataview.FormulaData
* @property {number} nulls - Number of null values in the column
* @property {string} operation - Operation used
* @property {number} result ... | [
"function",
"parseFormulaData",
"(",
"nulls",
",",
"operation",
",",
"result",
")",
"{",
"/**\n * @description\n * Object containing formula data\n *\n * @typedef {object} carto.dataview.FormulaData\n * @property {number} nulls - Number of null values in the column\n * @property {str... | Transform the data obtained from an internal formula dataview into a
public object.
@param {number} nulls
@param {string} operation
@param {number} result
@return {carto.dataview.FormulaData} - The parsed and formatted data for the given parameters | [
"Transform",
"the",
"data",
"obtained",
"from",
"an",
"internal",
"formula",
"dataview",
"into",
"a",
"public",
"object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/dataview/formula/parse-data.js#L11-L27 | train |
CartoDB/carto.js | src/api/v4/native/google-maps-map-type.js | GoogleMapsMapType | function GoogleMapsMapType (layers, engine, map) {
this._layers = layers;
this._engine = engine;
this._map = map;
this._hoveredLayers = [];
this.tileSize = new google.maps.Size(256, 256);
this._internalView = new GMapsCartoDBLayerGroupView(this._engine._cartoLayerGroup, {
nativeMap: map
});
this._... | javascript | function GoogleMapsMapType (layers, engine, map) {
this._layers = layers;
this._engine = engine;
this._map = map;
this._hoveredLayers = [];
this.tileSize = new google.maps.Size(256, 256);
this._internalView = new GMapsCartoDBLayerGroupView(this._engine._cartoLayerGroup, {
nativeMap: map
});
this._... | [
"function",
"GoogleMapsMapType",
"(",
"layers",
",",
"engine",
",",
"map",
")",
"{",
"this",
".",
"_layers",
"=",
"layers",
";",
"this",
".",
"_engine",
"=",
"engine",
";",
"this",
".",
"_map",
"=",
"map",
";",
"this",
".",
"_hoveredLayers",
"=",
"[",
... | This object is a custom Google Maps MapType to enable feature interactivity
using an internal GMapsCartoDBLayerGroupView instance.
NOTE: It also contains the feature events handlers. That's why it requires the carto layers array. | [
"This",
"object",
"is",
"a",
"custom",
"Google",
"Maps",
"MapType",
"to",
"enable",
"feature",
"interactivity",
"using",
"an",
"internal",
"GMapsCartoDBLayerGroupView",
"instance",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/native/google-maps-map-type.js#L14-L30 | train |
CartoDB/carto.js | src/api/v4/layer/aggregation.js | _checkAndTransformColumns | function _checkAndTransformColumns (columns) {
var returnValue = null;
if (columns) {
_checkColumns(columns);
returnValue = {};
Object.keys(columns).forEach(function (key) {
returnValue[key] = _columnToSnakeCase(columns[key]);
});
}
return returnValue;
} | javascript | function _checkAndTransformColumns (columns) {
var returnValue = null;
if (columns) {
_checkColumns(columns);
returnValue = {};
Object.keys(columns).forEach(function (key) {
returnValue[key] = _columnToSnakeCase(columns[key]);
});
}
return returnValue;
} | [
"function",
"_checkAndTransformColumns",
"(",
"columns",
")",
"{",
"var",
"returnValue",
"=",
"null",
";",
"if",
"(",
"columns",
")",
"{",
"_checkColumns",
"(",
"columns",
")",
";",
"returnValue",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"columns",
... | Windshaft uses snake_case for column parameters | [
"Windshaft",
"uses",
"snake_case",
"for",
"column",
"parameters"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/aggregation.js#L150-L162 | train |
CartoDB/carto.js | src/api/v4/error-handling/carto-error-extender.js | _getListedError | function _getListedError (cartoError, errorList) {
var errorListkeys = _.keys(errorList);
var key;
for (var i = 0; i < errorListkeys.length; i++) {
key = errorListkeys[i];
if (!(errorList[key].messageRegex instanceof RegExp)) {
throw new Error('MessageRegex on ' + key + ' is not a RegExp.');
}
... | javascript | function _getListedError (cartoError, errorList) {
var errorListkeys = _.keys(errorList);
var key;
for (var i = 0; i < errorListkeys.length; i++) {
key = errorListkeys[i];
if (!(errorList[key].messageRegex instanceof RegExp)) {
throw new Error('MessageRegex on ' + key + ' is not a RegExp.');
}
... | [
"function",
"_getListedError",
"(",
"cartoError",
",",
"errorList",
")",
"{",
"var",
"errorListkeys",
"=",
"_",
".",
"keys",
"(",
"errorList",
")",
";",
"var",
"key",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"errorListkeys",
".",
"length",... | Get the listed error from a cartoError, if no listedError is found return a generic
unknown error.
@param {CartoError} cartoError | [
"Get",
"the",
"listed",
"error",
"from",
"a",
"cartoError",
"if",
"no",
"listedError",
"is",
"found",
"return",
"a",
"generic",
"unknown",
"error",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/error-handling/carto-error-extender.js#L36-L57 | train |
CartoDB/carto.js | src/api/v4/error-handling/carto-error-extender.js | _buildErrorCode | function _buildErrorCode (cartoError, key) {
var fragments = [];
fragments.push(cartoError && cartoError.origin);
fragments.push(cartoError && cartoError.type);
fragments.push(key);
fragments = _.compact(fragments);
return fragments.join(':');
} | javascript | function _buildErrorCode (cartoError, key) {
var fragments = [];
fragments.push(cartoError && cartoError.origin);
fragments.push(cartoError && cartoError.type);
fragments.push(key);
fragments = _.compact(fragments);
return fragments.join(':');
} | [
"function",
"_buildErrorCode",
"(",
"cartoError",
",",
"key",
")",
"{",
"var",
"fragments",
"=",
"[",
"]",
";",
"fragments",
".",
"push",
"(",
"cartoError",
"&&",
"cartoError",
".",
"origin",
")",
";",
"fragments",
".",
"push",
"(",
"cartoError",
"&&",
"... | Generate an unique string that represents a cartoError
@param {cartoError} cartoError
@param {string} key | [
"Generate",
"an",
"unique",
"string",
"that",
"represents",
"a",
"cartoError"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/error-handling/carto-error-extender.js#L82-L90 | train |
CartoDB/carto.js | src/vis/map-cursor-manager.js | function (deps) {
if (!deps.mapView) throw new Error('mapView is required');
if (!deps.mapModel) throw new Error('mapModel is required');
this._mapView = deps.mapView;
this._mapModel = deps.mapModel;
// Map to keep track of clickable layers that are being feature overed
this._clickableLayersBeingFeatureOv... | javascript | function (deps) {
if (!deps.mapView) throw new Error('mapView is required');
if (!deps.mapModel) throw new Error('mapModel is required');
this._mapView = deps.mapView;
this._mapModel = deps.mapModel;
// Map to keep track of clickable layers that are being feature overed
this._clickableLayersBeingFeatureOv... | [
"function",
"(",
"deps",
")",
"{",
"if",
"(",
"!",
"deps",
".",
"mapView",
")",
"throw",
"new",
"Error",
"(",
"'mapView is required'",
")",
";",
"if",
"(",
"!",
"deps",
".",
"mapModel",
")",
"throw",
"new",
"Error",
"(",
"'mapModel is required'",
")",
... | Changes the mouse pointer based on feature events and status
of map's interactivity.
@param {Object} deps Dependencies | [
"Changes",
"the",
"mouse",
"pointer",
"based",
"on",
"feature",
"events",
"and",
"status",
"of",
"map",
"s",
"interactivity",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/vis/map-cursor-manager.js#L8-L17 | train | |
CartoDB/carto.js | src/api/v4/filter/bounding-box-gmaps.js | BoundingBoxGoogleMaps | function BoundingBoxGoogleMaps (map) {
if (!_isGoogleMap(map)) {
throw new Error('Bounding box requires a Google Maps map but got: ' + map);
}
// Adapt the Google Maps map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new GoogleMapsBoundingBoxAdapter(map);
// U... | javascript | function BoundingBoxGoogleMaps (map) {
if (!_isGoogleMap(map)) {
throw new Error('Bounding box requires a Google Maps map but got: ' + map);
}
// Adapt the Google Maps map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new GoogleMapsBoundingBoxAdapter(map);
// U... | [
"function",
"BoundingBoxGoogleMaps",
"(",
"map",
")",
"{",
"if",
"(",
"!",
"_isGoogleMap",
"(",
"map",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Bounding box requires a Google Maps map but got: '",
"+",
"map",
")",
";",
"}",
"// Adapt the Google Maps map to off... | Bounding box filter for Google Maps maps.
When this filter is included into a dataview only the data inside the {@link https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map|googleMap}
bounds will be taken into account.
@param {google.maps.map} map - The google map to track the bounds
@fires... | [
"Bounding",
"box",
"filter",
"for",
"Google",
"Maps",
"maps",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/filter/bounding-box-gmaps.js#L29-L40 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | parse | function parse(uriStr) {
var m = ('' + uriStr).match(URI_RE_);
if (!m) { return null; }
return new URI(
nullIfAbsent(m[1]),
nullIfAbsent(m[2]),
nullIfAbsent(m[3]),
nullIfAbsent(m[4]),
nullIfAbsent(m[5]),
nullIfAbsent(m[6]),
nullIfAbsent(m[7]));
} | javascript | function parse(uriStr) {
var m = ('' + uriStr).match(URI_RE_);
if (!m) { return null; }
return new URI(
nullIfAbsent(m[1]),
nullIfAbsent(m[2]),
nullIfAbsent(m[3]),
nullIfAbsent(m[4]),
nullIfAbsent(m[5]),
nullIfAbsent(m[6]),
nullIfAbsent(m[7]));
} | [
"function",
"parse",
"(",
"uriStr",
")",
"{",
"var",
"m",
"=",
"(",
"''",
"+",
"uriStr",
")",
".",
"match",
"(",
"URI_RE_",
")",
";",
"if",
"(",
"!",
"m",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"URI",
"(",
"nullIfAbsent",
"(",
"... | creates a uri from the string form. The parser is relaxed, so special
characters that aren't escaped but don't cause ambiguities will not cause
parse failures.
@return {URI|null} | [
"creates",
"a",
"uri",
"from",
"the",
"string",
"form",
".",
"The",
"parser",
"is",
"relaxed",
"so",
"special",
"characters",
"that",
"aren",
"t",
"escaped",
"but",
"don",
"t",
"cause",
"ambiguities",
"will",
"not",
"cause",
"parse",
"failures",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L1086-L1097 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | create | function create(scheme, credentials, domain, port, path, query, fragment) {
var uri = new URI(
encodeIfExists2(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists2(
credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists(domain),
port > 0 ? port.toString(... | javascript | function create(scheme, credentials, domain, port, path, query, fragment) {
var uri = new URI(
encodeIfExists2(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists2(
credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists(domain),
port > 0 ? port.toString(... | [
"function",
"create",
"(",
"scheme",
",",
"credentials",
",",
"domain",
",",
"port",
",",
"path",
",",
"query",
",",
"fragment",
")",
"{",
"var",
"uri",
"=",
"new",
"URI",
"(",
"encodeIfExists2",
"(",
"scheme",
",",
"URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_",
... | creates a uri from the given parts.
@param scheme {string} an unencoded scheme such as "http" or null
@param credentials {string} unencoded user credentials or null
@param domain {string} an unencoded domain name or null
@param port {number} a port number in [1, 32768].
-1 indicates no port, as does null.
@param path ... | [
"creates",
"a",
"uri",
"from",
"the",
"given",
"parts",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L1115-L1133 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | encodeIfExists2 | function encodeIfExists2(unescapedPart, extra) {
if ('string' == typeof unescapedPart) {
return encodeURI(unescapedPart).replace(extra, encodeOne);
}
return null;
} | javascript | function encodeIfExists2(unescapedPart, extra) {
if ('string' == typeof unescapedPart) {
return encodeURI(unescapedPart).replace(extra, encodeOne);
}
return null;
} | [
"function",
"encodeIfExists2",
"(",
"unescapedPart",
",",
"extra",
")",
"{",
"if",
"(",
"'string'",
"==",
"typeof",
"unescapedPart",
")",
"{",
"return",
"encodeURI",
"(",
"unescapedPart",
")",
".",
"replace",
"(",
"extra",
",",
"encodeOne",
")",
";",
"}",
... | if unescapedPart is non null, then escapes any characters in it that aren't
valid characters in a url and also escapes any special characters that
appear in extra.
@param unescapedPart {string}
@param extra {RegExp} a character set of characters in [\01-\177].
@return {string|null} null iff unescapedPart == null. | [
"if",
"unescapedPart",
"is",
"non",
"null",
"then",
"escapes",
"any",
"characters",
"in",
"it",
"that",
"aren",
"t",
"valid",
"characters",
"in",
"a",
"url",
"and",
"also",
"escapes",
"any",
"special",
"characters",
"that",
"appear",
"in",
"extra",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L1149-L1154 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | resolve | function resolve(baseUri, relativeUri) {
// there are several kinds of relative urls:
// 1. //foo - replaces everything from the domain on. foo is a domain name
// 2. foo - replaces the last part of the path, the whole query and fragment
// 3. /foo - replaces the the path, the query and fragment
// 4. ?foo -... | javascript | function resolve(baseUri, relativeUri) {
// there are several kinds of relative urls:
// 1. //foo - replaces everything from the domain on. foo is a domain name
// 2. foo - replaces the last part of the path, the whole query and fragment
// 3. /foo - replaces the the path, the query and fragment
// 4. ?foo -... | [
"function",
"resolve",
"(",
"baseUri",
",",
"relativeUri",
")",
"{",
"// there are several kinds of relative urls:",
"// 1. //foo - replaces everything from the domain on. foo is a domain name",
"// 2. foo - replaces the last part of the path, the whole query and fragment",
"// 3. /foo - repl... | resolves a relative url string to a base uri.
@return {URI} | [
"resolves",
"a",
"relative",
"url",
"string",
"to",
"a",
"base",
"uri",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L1227-L1304 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | URI | function URI(
rawScheme,
rawCredentials, rawDomain, port,
rawPath, rawQuery, rawFragment) {
this.scheme_ = rawScheme;
this.credentials_ = rawCredentials;
this.domain_ = rawDomain;
this.port_ = port;
this.path_ = rawPath;
this.query_ = rawQuery;
this.fragment_ = rawFragment;
/**
* @type {A... | javascript | function URI(
rawScheme,
rawCredentials, rawDomain, port,
rawPath, rawQuery, rawFragment) {
this.scheme_ = rawScheme;
this.credentials_ = rawCredentials;
this.domain_ = rawDomain;
this.port_ = port;
this.path_ = rawPath;
this.query_ = rawQuery;
this.fragment_ = rawFragment;
/**
* @type {A... | [
"function",
"URI",
"(",
"rawScheme",
",",
"rawCredentials",
",",
"rawDomain",
",",
"port",
",",
"rawPath",
",",
"rawQuery",
",",
"rawFragment",
")",
"{",
"this",
".",
"scheme_",
"=",
"rawScheme",
";",
"this",
".",
"credentials_",
"=",
"rawCredentials",
";",
... | a mutable URI.
This class contains setters and getters for the parts of the URI.
The <tt>getXYZ</tt>/<tt>setXYZ</tt> methods return the decoded part -- so
<code>uri.parse('/foo%20bar').getPath()</code> will return the decoded path,
<tt>/foo bar</tt>.
<p>The raw versions of fields are available too.
<code>uri.parse('/... | [
"a",
"mutable",
"URI",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L1332-L1347 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | lookupEntity | function lookupEntity(name) {
// TODO: entity lookup as specified by HTML5 actually depends on the
// presence of the ";".
if (ENTITIES.hasOwnProperty(name)) { return ENTITIES[name]; }
var m = name.match(decimalEscapeRe);
if (m) {
return String.fromCharCode(parseInt(m[1], 10));
} else if (... | javascript | function lookupEntity(name) {
// TODO: entity lookup as specified by HTML5 actually depends on the
// presence of the ";".
if (ENTITIES.hasOwnProperty(name)) { return ENTITIES[name]; }
var m = name.match(decimalEscapeRe);
if (m) {
return String.fromCharCode(parseInt(m[1], 10));
} else if (... | [
"function",
"lookupEntity",
"(",
"name",
")",
"{",
"// TODO: entity lookup as specified by HTML5 actually depends on the",
"// presence of the \";\".",
"if",
"(",
"ENTITIES",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"return",
"ENTITIES",
"[",
"name",
"]",
";",... | Decodes an HTML entity.
{\@updoc
$ lookupEntity('lt')
# '<'
$ lookupEntity('GT')
# '>'
$ lookupEntity('amp')
# '&'
$ lookupEntity('nbsp')
# '\xA0'
$ lookupEntity('apos')
# "'"
$ lookupEntity('quot')
# '"'
$ lookupEntity('#xa')
# '\n'
$ lookupEntity('#10')
# '\n'
$ lookupEntity('#x0a')
# '\n'
$ lookupEntity('#010')
# '... | [
"Decodes",
"an",
"HTML",
"entity",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L3895-L3912 | train |
CartoDB/carto.js | vendor/html-css-sanitizer-bundle.js | makeSaxParser | function makeSaxParser(handler) {
// Accept quoted or unquoted keys (Closure compat)
var hcopy = {
cdata: handler.cdata || handler['cdata'],
comment: handler.comment || handler['comment'],
endDoc: handler.endDoc || handler['endDoc'],
endTag: handler.endTag || handler['endTag'],
pcd... | javascript | function makeSaxParser(handler) {
// Accept quoted or unquoted keys (Closure compat)
var hcopy = {
cdata: handler.cdata || handler['cdata'],
comment: handler.comment || handler['comment'],
endDoc: handler.endDoc || handler['endDoc'],
endTag: handler.endTag || handler['endTag'],
pcd... | [
"function",
"makeSaxParser",
"(",
"handler",
")",
"{",
"// Accept quoted or unquoted keys (Closure compat)",
"var",
"hcopy",
"=",
"{",
"cdata",
":",
"handler",
".",
"cdata",
"||",
"handler",
"[",
"'cdata'",
"]",
",",
"comment",
":",
"handler",
".",
"comment",
"|... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused by th... | [
"Given",
"a",
"SAX",
"-",
"like",
"event",
"handler",
"produce",
"a",
"function",
"that",
"feeds",
"those",
"events",
"and",
"a",
"parameter",
"to",
"the",
"event",
"handler",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/vendor/html-css-sanitizer-bundle.js#L4053-L4068 | train |
CartoDB/carto.js | src/api/v4/dataview/time-series/parse-data.js | parseTimeSeriesData | function parseTimeSeriesData (data, nulls, totalAmount, offset) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @... | javascript | function parseTimeSeriesData (data, nulls, totalAmount, offset) {
if (!data) {
return null;
}
var compactData = _.compact(data);
var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
? maxBin.freq
: null;
/**
* @... | [
"function",
"parseTimeSeriesData",
"(",
"data",
",",
"nulls",
",",
"totalAmount",
",",
"offset",
")",
"{",
"if",
"(",
"!",
"data",
")",
"{",
"return",
"null",
";",
"}",
"var",
"compactData",
"=",
"_",
".",
"compact",
"(",
"data",
")",
";",
"var",
"ma... | Transform the data obtained from an internal timeseries dataview into a public object.
@param {object[]} data - The raw time series data
@param {number} nulls - Number of data with a null
@param {number} totalAmount - Total number of data in the histogram
@return {TimeSeriesData} - The parsed and formatted data for ... | [
"Transform",
"the",
"data",
"obtained",
"from",
"an",
"internal",
"timeseries",
"dataview",
"into",
"a",
"public",
"object",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/dataview/time-series/parse-data.js#L16-L43 | train |
CartoDB/carto.js | src/api/v4/source/dataset.js | Dataset | function Dataset (tableName) {
_checkTableName(tableName);
this._tableName = tableName;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | javascript | function Dataset (tableName) {
_checkTableName(tableName);
this._tableName = tableName;
Base.apply(this, arguments);
this._appliedFilters.on('change:filters', () => this._updateInternalModelQuery(this._getQueryToApply()));
} | [
"function",
"Dataset",
"(",
"tableName",
")",
"{",
"_checkTableName",
"(",
"tableName",
")",
";",
"this",
".",
"_tableName",
"=",
"tableName",
";",
"Base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"_appliedFilters",
".",
"on",
... | A Dataset that can be used as the data source for layers and dataviews.
@param {string} tableName The name of an existing table
@example
new carto.source.Dataset('european_cities');
@constructor
@fires error
@extends carto.source.Base
@memberof carto.source
@api | [
"A",
"Dataset",
"that",
"can",
"be",
"used",
"as",
"the",
"data",
"source",
"for",
"layers",
"and",
"dataviews",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/source/dataset.js#L20-L27 | train |
CartoDB/carto.js | src/api/v4/dataview/histogram/index.js | Histogram | function Histogram (source, column, options) {
this._initialize(source, column, options);
this._bins = this._options.bins;
this._start = this._options.start;
this._end = this._options.end;
} | javascript | function Histogram (source, column, options) {
this._initialize(source, column, options);
this._bins = this._options.bins;
this._start = this._options.start;
this._end = this._options.end;
} | [
"function",
"Histogram",
"(",
"source",
",",
"column",
",",
"options",
")",
"{",
"this",
".",
"_initialize",
"(",
"source",
",",
"column",
",",
"options",
")",
";",
"this",
".",
"_bins",
"=",
"this",
".",
"_options",
".",
"bins",
";",
"this",
".",
"_... | A histogram is used to represent the distribution of numerical data.
See {@link https://en.wikipedia.org/wiki/Histogram}.
@param {carto.source.Base} source - The source where the dataview will fetch the data
@param {string} column - The column name to get the data
@param {object} [options]
@param {number} [options.bi... | [
"A",
"histogram",
"is",
"used",
"to",
"represent",
"the",
"distribution",
"of",
"numerical",
"data",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/dataview/histogram/index.js#L63-L68 | train |
CartoDB/carto.js | src/vis/infowindow-manager.js | function (deps, options) {
deps = deps || {};
options = options || {};
if (!deps.engine) throw new Error('engine is required');
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
if (!deps.tooltipModel) throw new Error('too... | javascript | function (deps, options) {
deps = deps || {};
options = options || {};
if (!deps.engine) throw new Error('engine is required');
if (!deps.mapModel) throw new Error('mapModel is required');
if (!deps.infowindowModel) throw new Error('infowindowModel is required');
if (!deps.tooltipModel) throw new Error('too... | [
"function",
"(",
"deps",
",",
"options",
")",
"{",
"deps",
"=",
"deps",
"||",
"{",
"}",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"deps",
".",
"engine",
")",
"throw",
"new",
"Error",
"(",
"'engine is required'",
")",
";",... | Manages the infowindows for a map. It listens to events triggered by a
CartoDBLayerGroupView and updates models accordingly | [
"Manages",
"the",
"infowindows",
"for",
"a",
"map",
".",
"It",
"listens",
"to",
"events",
"triggered",
"by",
"a",
"CartoDBLayerGroupView",
"and",
"updates",
"models",
"accordingly"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/vis/infowindow-manager.js#L7-L26 | train | |
CartoDB/carto.js | src/api/v4/filter/bounding-box-leaflet.js | BoundingBoxLeaflet | function BoundingBoxLeaflet (map) {
if (!_isLeafletMap(map)) {
throw new Error('Bounding box requires a Leaflet map but got: ' + map);
}
// Adapt the Leaflet map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new LeafletBoundingBoxAdapter(map);
// Use the adapte... | javascript | function BoundingBoxLeaflet (map) {
if (!_isLeafletMap(map)) {
throw new Error('Bounding box requires a Leaflet map but got: ' + map);
}
// Adapt the Leaflet map to offer unique:
// - getBounds() function
// - 'boundsChanged' event
var mapAdapter = new LeafletBoundingBoxAdapter(map);
// Use the adapte... | [
"function",
"BoundingBoxLeaflet",
"(",
"map",
")",
"{",
"if",
"(",
"!",
"_isLeafletMap",
"(",
"map",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Bounding box requires a Leaflet map but got: '",
"+",
"map",
")",
";",
"}",
"// Adapt the Leaflet map to offer unique:... | Bounding box filter for Leaflet maps.
When this filter is included into a dataview only the data inside the {@link http://leafletjs.com/reference-1.3.1.html#map|leafletMap}
bounds will be taken into account.
@param {L.Map} map - The leaflet map view
@fires boundsChanged
@constructor
@extends carto.filter.Base
@memb... | [
"Bounding",
"box",
"filter",
"for",
"Leaflet",
"maps",
"."
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/filter/bounding-box-leaflet.js#L28-L39 | train |
CartoDB/carto.js | src/api/v4/layer/metadata/parser.js | getMetadataFromRules | function getMetadataFromRules (rulesData) {
var metadata = [];
rulesData.forEach(function (ruleData) {
var rule = new Rule(ruleData);
if (_isBucketsMetadata(rule)) {
metadata.push(new BucketsMetadata(rule));
} else if (_isCategoriesMetadata(rule)) {
metadata.push(new CategoriesMetadata(rul... | javascript | function getMetadataFromRules (rulesData) {
var metadata = [];
rulesData.forEach(function (ruleData) {
var rule = new Rule(ruleData);
if (_isBucketsMetadata(rule)) {
metadata.push(new BucketsMetadata(rule));
} else if (_isCategoriesMetadata(rule)) {
metadata.push(new CategoriesMetadata(rul... | [
"function",
"getMetadataFromRules",
"(",
"rulesData",
")",
"{",
"var",
"metadata",
"=",
"[",
"]",
";",
"rulesData",
".",
"forEach",
"(",
"function",
"(",
"ruleData",
")",
"{",
"var",
"rule",
"=",
"new",
"Rule",
"(",
"ruleData",
")",
";",
"if",
"(",
"_i... | Generates a list of Metadata objects from the original cartocss_meta rules
@param {Rules} rulesData
@return {metadata.Base[]} | [
"Generates",
"a",
"list",
"of",
"Metadata",
"objects",
"from",
"the",
"original",
"cartocss_meta",
"rules"
] | 0b7ca24d7066354de265d07f717ef8b336c7e0ce | https://github.com/CartoDB/carto.js/blob/0b7ca24d7066354de265d07f717ef8b336c7e0ce/src/api/v4/layer/metadata/parser.js#L11-L25 | train |
ma-ha/rest-web-ui | html/modules/pong-histogram/pong-histogram.js | pongHistogram_UpdateBars | function pongHistogram_UpdateBars( divId, dta, xMin, xMax ) {
log( "pongHistogram", "UpdateBars "+divId);
var pmd = moduleConfig[ divId ];
var cnt = ( pmd.blockCount ? pmd.blockCount : 10 );
// get y-axis scaling
var yMax = pmd.yAxisMax;
if ( !yMax || yMax == 'auto' ) {
yMax = 0;
for ( var i = 0; ... | javascript | function pongHistogram_UpdateBars( divId, dta, xMin, xMax ) {
log( "pongHistogram", "UpdateBars "+divId);
var pmd = moduleConfig[ divId ];
var cnt = ( pmd.blockCount ? pmd.blockCount : 10 );
// get y-axis scaling
var yMax = pmd.yAxisMax;
if ( !yMax || yMax == 'auto' ) {
yMax = 0;
for ( var i = 0; ... | [
"function",
"pongHistogram_UpdateBars",
"(",
"divId",
",",
"dta",
",",
"xMin",
",",
"xMax",
")",
"{",
"log",
"(",
"\"pongHistogram\"",
",",
"\"UpdateBars \"",
"+",
"divId",
")",
";",
"var",
"pmd",
"=",
"moduleConfig",
"[",
"divId",
"]",
";",
"var",
"cnt",
... | Change labels an height of histogram bars | [
"Change",
"labels",
"an",
"height",
"of",
"histogram",
"bars"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-histogram/pong-histogram.js#L110-L143 | train |
ma-ha/rest-web-ui | html/js/portal-ng.js | loadIncludes | function loadIncludes() {
for ( var module in reqModules ) {
if ( module && module != 'pong-tableXX' ) { // just to exclude modules, for debugging it's better to include them hardcoded in index.html
// extra CSS files
if ( moduleMap[ module ] ) {
if ( moduleMap[ module ].css ) {
for... | javascript | function loadIncludes() {
for ( var module in reqModules ) {
if ( module && module != 'pong-tableXX' ) { // just to exclude modules, for debugging it's better to include them hardcoded in index.html
// extra CSS files
if ( moduleMap[ module ] ) {
if ( moduleMap[ module ].css ) {
for... | [
"function",
"loadIncludes",
"(",
")",
"{",
"for",
"(",
"var",
"module",
"in",
"reqModules",
")",
"{",
"if",
"(",
"module",
"&&",
"module",
"!=",
"'pong-tableXX'",
")",
"{",
"// just to exclude modules, for debugging it's better to include them hardcoded in index.html",
... | load includes for modules | [
"load",
"includes",
"for",
"modules"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/portal-ng.js#L506-L537 | train |
ma-ha/rest-web-ui | html/js/portal-ng.js | getUrlGETparams | function getUrlGETparams() {
var vars = {}, hash;
var hashes = window.location.href.slice( window.location.href.indexOf('?') + 1 ).split('&');
for( var i = 0; i < hashes.length; i++ ) {
hash = hashes[i].split('=');
vars[ hash[0] ] = hash[1];
// switch on console logging
if ( ... | javascript | function getUrlGETparams() {
var vars = {}, hash;
var hashes = window.location.href.slice( window.location.href.indexOf('?') + 1 ).split('&');
for( var i = 0; i < hashes.length; i++ ) {
hash = hashes[i].split('=');
vars[ hash[0] ] = hash[1];
// switch on console logging
if ( ... | [
"function",
"getUrlGETparams",
"(",
")",
"{",
"var",
"vars",
"=",
"{",
"}",
",",
"hash",
";",
"var",
"hashes",
"=",
"window",
".",
"location",
".",
"href",
".",
"slice",
"(",
"window",
".",
"location",
".",
"href",
".",
"indexOf",
"(",
"'?'",
")",
... | Read a page's GET URL variables and return them as an object. | [
"Read",
"a",
"page",
"s",
"GET",
"URL",
"variables",
"and",
"return",
"them",
"as",
"an",
"object",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/portal-ng.js#L1463-L1475 | train |
ma-ha/rest-web-ui | html/js/portal-ng.js | publishEvent | function publishEvent( channelName, eventObj ) {
var broker = getEventBroker( 'main' )
eventObj.channel = channelName
broker.publish( eventObj );
} | javascript | function publishEvent( channelName, eventObj ) {
var broker = getEventBroker( 'main' )
eventObj.channel = channelName
broker.publish( eventObj );
} | [
"function",
"publishEvent",
"(",
"channelName",
",",
"eventObj",
")",
"{",
"var",
"broker",
"=",
"getEventBroker",
"(",
"'main'",
")",
"eventObj",
".",
"channel",
"=",
"channelName",
"broker",
".",
"publish",
"(",
"eventObj",
")",
";",
"}"
] | short cut function | [
"short",
"cut",
"function"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/portal-ng.js#L1600-L1604 | train |
ma-ha/rest-web-ui | html/modules/pong-feedback/pong-feedback.js | feedbackEvtCallback | function feedbackEvtCallback( evt ) {
log( "pong-feedback", "feedbackEvtCallback" )
if ( evt && evt.text ) {
log( "pong-feedback", "feedbackEvtCallback "+evt.text )
if ( pongLastFeedbackTxt.indexOf( evt.text ) >= 0 ) {
if ( evt.text.length > 0 ) {
var feedbackTxt = $.i18n( evt.text )
... | javascript | function feedbackEvtCallback( evt ) {
log( "pong-feedback", "feedbackEvtCallback" )
if ( evt && evt.text ) {
log( "pong-feedback", "feedbackEvtCallback "+evt.text )
if ( pongLastFeedbackTxt.indexOf( evt.text ) >= 0 ) {
if ( evt.text.length > 0 ) {
var feedbackTxt = $.i18n( evt.text )
... | [
"function",
"feedbackEvtCallback",
"(",
"evt",
")",
"{",
"log",
"(",
"\"pong-feedback\"",
",",
"\"feedbackEvtCallback\"",
")",
"if",
"(",
"evt",
"&&",
"evt",
".",
"text",
")",
"{",
"log",
"(",
"\"pong-feedback\"",
",",
"\"feedbackEvtCallback \"",
"+",
"evt",
"... | The callback is subscribed for feedback events | [
"The",
"callback",
"is",
"subscribed",
"for",
"feedback",
"events"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-feedback/pong-feedback.js#L51-L79 | train |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.language.js | function ( count, forms ) {
var pluralRules,
pluralFormIndex,
index,
explicitPluralPattern = new RegExp('\\d+=', 'i'),
formCount,
form;
if ( !forms || forms.length === 0 ) {
return '';
}
// Handle for Explicit 0= & 1= values
for ( index = 0; index < forms.length; index++ ) {
... | javascript | function ( count, forms ) {
var pluralRules,
pluralFormIndex,
index,
explicitPluralPattern = new RegExp('\\d+=', 'i'),
formCount,
form;
if ( !forms || forms.length === 0 ) {
return '';
}
// Handle for Explicit 0= & 1= values
for ( index = 0; index < forms.length; index++ ) {
... | [
"function",
"(",
"count",
",",
"forms",
")",
"{",
"var",
"pluralRules",
",",
"pluralFormIndex",
",",
"index",
",",
"explicitPluralPattern",
"=",
"new",
"RegExp",
"(",
"'\\\\d+='",
",",
"'i'",
")",
",",
"formCount",
",",
"form",
";",
"if",
"(",
"!",
"form... | Plural form transformations, needed for some languages.
@param count
integer Non-localized quantifier
@param forms
array List of plural forms
@return string Correct form for quantifier in this language | [
"Plural",
"form",
"transformations",
"needed",
"for",
"some",
"languages",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.language.js#L273-L314 | train | |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.language.js | function ( number, pluralRules ) {
var i,
pluralForms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ],
pluralFormIndex = 0;
for ( i = 0; i < pluralForms.length; i++ ) {
if ( pluralRules[pluralForms[i]] ) {
if ( pluralRuleParser( pluralRules[pluralForms[i]], number ) ) {
return pluralFor... | javascript | function ( number, pluralRules ) {
var i,
pluralForms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ],
pluralFormIndex = 0;
for ( i = 0; i < pluralForms.length; i++ ) {
if ( pluralRules[pluralForms[i]] ) {
if ( pluralRuleParser( pluralRules[pluralForms[i]], number ) ) {
return pluralFor... | [
"function",
"(",
"number",
",",
"pluralRules",
")",
"{",
"var",
"i",
",",
"pluralForms",
"=",
"[",
"'zero'",
",",
"'one'",
",",
"'two'",
",",
"'few'",
",",
"'many'",
",",
"'other'",
"]",
",",
"pluralFormIndex",
"=",
"0",
";",
"for",
"(",
"i",
"=",
... | For the number, get the plural for index
@param number
@param pluralRules
@return plural form index | [
"For",
"the",
"number",
"get",
"the",
"plural",
"for",
"index"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.language.js#L323-L339 | train | |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.language.js | function ( num, integer ) {
var tmp, item, i,
transformTable, numberString, convertedNumber;
// Set the target Transform table:
transformTable = this.digitTransformTable( $.i18n().locale );
numberString = '' + num;
convertedNumber = '';
if ( !transformTable ) {
return num;
}
// Check ... | javascript | function ( num, integer ) {
var tmp, item, i,
transformTable, numberString, convertedNumber;
// Set the target Transform table:
transformTable = this.digitTransformTable( $.i18n().locale );
numberString = '' + num;
convertedNumber = '';
if ( !transformTable ) {
return num;
}
// Check ... | [
"function",
"(",
"num",
",",
"integer",
")",
"{",
"var",
"tmp",
",",
"item",
",",
"i",
",",
"transformTable",
",",
"numberString",
",",
"convertedNumber",
";",
"// Set the target Transform table:",
"transformTable",
"=",
"this",
".",
"digitTransformTable",
"(",
... | Converts a number using digitTransformTable.
@param {number} num Value to be converted
@param {boolean} integer Convert the return value to an integer | [
"Converts",
"a",
"number",
"using",
"digitTransformTable",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.language.js#L347-L384 | train | |
ma-ha/rest-web-ui | html/modules/pong-search/pong-search.js | initializeTheSearch | function initializeTheSearch( divId, type , params ) {
if ( params && params.get && params.get.search ) {
//alert( JSON.stringify( moduleConfig[ divId ] ) )
var cfg = moduleConfig[ divId ];
if ( cfg.update ) {
for ( var i= 0; i < cfg.update.length; i++ ) {
var p = {}
p[ cfg.update[i... | javascript | function initializeTheSearch( divId, type , params ) {
if ( params && params.get && params.get.search ) {
//alert( JSON.stringify( moduleConfig[ divId ] ) )
var cfg = moduleConfig[ divId ];
if ( cfg.update ) {
for ( var i= 0; i < cfg.update.length; i++ ) {
var p = {}
p[ cfg.update[i... | [
"function",
"initializeTheSearch",
"(",
"divId",
",",
"type",
",",
"params",
")",
"{",
"if",
"(",
"params",
"&&",
"params",
".",
"get",
"&&",
"params",
".",
"get",
".",
"search",
")",
"{",
"//alert( JSON.stringify( moduleConfig[ divId ] ) )",
"var",
"cfg",
"="... | do the search | [
"do",
"the",
"search"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-search/pong-search.js#L46-L59 | train |
ma-ha/rest-web-ui | html/modules/pong-search/pong-search.js | addSearchHeaderRenderHtml | function addSearchHeaderRenderHtml( divId, type , params, config ) {
log( "PoNG-Search", "add content " );
if ( ! config.page ) return;
var html = [];
var lang = '';
html.push( '<div class="pongSearch" id="'+divId+'">' );
html.push( '<form id="'+divId+'Form">' );
html.push( '<input type="hidden" name="layou... | javascript | function addSearchHeaderRenderHtml( divId, type , params, config ) {
log( "PoNG-Search", "add content " );
if ( ! config.page ) return;
var html = [];
var lang = '';
html.push( '<div class="pongSearch" id="'+divId+'">' );
html.push( '<form id="'+divId+'Form">' );
html.push( '<input type="hidden" name="layou... | [
"function",
"addSearchHeaderRenderHtml",
"(",
"divId",
",",
"type",
",",
"params",
",",
"config",
")",
"{",
"log",
"(",
"\"PoNG-Search\"",
",",
"\"add content \"",
")",
";",
"if",
"(",
"!",
"config",
".",
"page",
")",
"return",
";",
"var",
"html",
"=",
"... | search header html rendering | [
"search",
"header",
"html",
"rendering"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-search/pong-search.js#L62-L90 | train |
ma-ha/rest-web-ui | html/modules/pong-sourcecode/pong-sourcecode.js | pongSrcCodeDivRenderHTML | function pongSrcCodeDivRenderHTML( divId, resourceURL, params, cfg ) {
log( "Pong-SrcCode", "load source code" );
if ( ! cfg.type ) { cfg.type = "plain"; }
$.get( resourceURL, params )
.done(
function ( srcData ) {
jQuerySyntaxInsertCode( divId, srcData, cfg.type, cfg.options||{} );
}
).fail( funct... | javascript | function pongSrcCodeDivRenderHTML( divId, resourceURL, params, cfg ) {
log( "Pong-SrcCode", "load source code" );
if ( ! cfg.type ) { cfg.type = "plain"; }
$.get( resourceURL, params )
.done(
function ( srcData ) {
jQuerySyntaxInsertCode( divId, srcData, cfg.type, cfg.options||{} );
}
).fail( funct... | [
"function",
"pongSrcCodeDivRenderHTML",
"(",
"divId",
",",
"resourceURL",
",",
"params",
",",
"cfg",
")",
"{",
"log",
"(",
"\"Pong-SrcCode\"",
",",
"\"load source code\"",
")",
";",
"if",
"(",
"!",
"cfg",
".",
"type",
")",
"{",
"cfg",
".",
"type",
"=",
"... | load source code from resourceURL and render view | [
"load",
"source",
"code",
"from",
"resourceURL",
"and",
"render",
"view"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-sourcecode/pong-sourcecode.js#L74-L83 | train |
ma-ha/rest-web-ui | html/modules/pong-list/pong-list.js | pongListDivHTML | function pongListDivHTML( divId, resourceURL, params ) {
log( "PoNG-List", "divId="+divId+" resourceURL="+resourceURL );
pongTableInit( divId, "PongList" );
if ( moduleConfig[ divId ] != null ) {
renderPongListDivHTML( divId, resourceURL, params, moduleConfig[ divId ] );
} else {
$.getJSON(
resourceUR... | javascript | function pongListDivHTML( divId, resourceURL, params ) {
log( "PoNG-List", "divId="+divId+" resourceURL="+resourceURL );
pongTableInit( divId, "PongList" );
if ( moduleConfig[ divId ] != null ) {
renderPongListDivHTML( divId, resourceURL, params, moduleConfig[ divId ] );
} else {
$.getJSON(
resourceUR... | [
"function",
"pongListDivHTML",
"(",
"divId",
",",
"resourceURL",
",",
"params",
")",
"{",
"log",
"(",
"\"PoNG-List\"",
",",
"\"divId=\"",
"+",
"divId",
"+",
"\" resourceURL=\"",
"+",
"resourceURL",
")",
";",
"pongTableInit",
"(",
"divId",
",",
"\"PongList\"",
... | This uses heavily pong-table.js functions!! | [
"This",
"uses",
"heavily",
"pong",
"-",
"table",
".",
"js",
"functions!!"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-list/pong-list.js#L28-L43 | train |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.messagestore.js | function( locale, messages ) {
if ( !this.messages[locale] ) {
this.messages[locale] = messages;
} else {
this.messages[locale] = $.extend( this.messages[locale], messages );
}
} | javascript | function( locale, messages ) {
if ( !this.messages[locale] ) {
this.messages[locale] = messages;
} else {
this.messages[locale] = $.extend( this.messages[locale], messages );
}
} | [
"function",
"(",
"locale",
",",
"messages",
")",
"{",
"if",
"(",
"!",
"this",
".",
"messages",
"[",
"locale",
"]",
")",
"{",
"this",
".",
"messages",
"[",
"locale",
"]",
"=",
"messages",
";",
"}",
"else",
"{",
"this",
".",
"messages",
"[",
"locale"... | Set messages to the given locale.
If locale exists, add messages to the locale.
@param locale
@param messages | [
"Set",
"messages",
"to",
"the",
"given",
"locale",
".",
"If",
"locale",
"exists",
"add",
"messages",
"to",
"the",
"locale",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.messagestore.js#L91-L97 | train | |
ma-ha/rest-web-ui | html/modules/pong-on-the-fly/pong-on-the-fly.js | pongOnTheFlyAddActionBtn | function pongOnTheFlyAddActionBtn(id, modalName, resourceURL, params) {
log( "PoNG-OnTheFly", "modalFormAddActionBtn " + id );
if ( !modalName ) {
modalName = "OnTheFly";
}
var buttonLbl = modalName;
if ( params && params.showConfig ) {
buttonLbl = 'Show the configruation of this view...';
}
var ... | javascript | function pongOnTheFlyAddActionBtn(id, modalName, resourceURL, params) {
log( "PoNG-OnTheFly", "modalFormAddActionBtn " + id );
if ( !modalName ) {
modalName = "OnTheFly";
}
var buttonLbl = modalName;
if ( params && params.showConfig ) {
buttonLbl = 'Show the configruation of this view...';
}
var ... | [
"function",
"pongOnTheFlyAddActionBtn",
"(",
"id",
",",
"modalName",
",",
"resourceURL",
",",
"params",
")",
"{",
"log",
"(",
"\"PoNG-OnTheFly\"",
",",
"\"modalFormAddActionBtn \"",
"+",
"id",
")",
";",
"if",
"(",
"!",
"modalName",
")",
"{",
"modalName",
"=",
... | Init HTML and JS | [
"Init",
"HTML",
"and",
"JS"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-on-the-fly/pong-on-the-fly.js#L28-L78 | train |
ma-ha/rest-web-ui | html/modules/pong-on-the-fly/pong-on-the-fly.js | pongOnTheFlyCreModalFromMeta | function pongOnTheFlyCreModalFromMeta(id, modalName, resourceURL) {
log( "PoNG-OnTheFly", "Create modal view content " + resourceURL );
if ( !modalName ) {
modalName = "OnTheFly";
}
if ( resourceURL ) {
log( "PoNG-OnTheFly", "Get JSON for " + id );
// var jsonCfg = pongOnTheFlyFindSubJSON( layoutOr... | javascript | function pongOnTheFlyCreModalFromMeta(id, modalName, resourceURL) {
log( "PoNG-OnTheFly", "Create modal view content " + resourceURL );
if ( !modalName ) {
modalName = "OnTheFly";
}
if ( resourceURL ) {
log( "PoNG-OnTheFly", "Get JSON for " + id );
// var jsonCfg = pongOnTheFlyFindSubJSON( layoutOr... | [
"function",
"pongOnTheFlyCreModalFromMeta",
"(",
"id",
",",
"modalName",
",",
"resourceURL",
")",
"{",
"log",
"(",
"\"PoNG-OnTheFly\"",
",",
"\"Create modal view content \"",
"+",
"resourceURL",
")",
";",
"if",
"(",
"!",
"modalName",
")",
"{",
"modalName",
"=",
... | creae modal dialog from | [
"creae",
"modal",
"dialog",
"from"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-on-the-fly/pong-on-the-fly.js#L127-L157 | train |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.js | function () {
var i18n = this;
// Set locale of String environment
String.locale = i18n.locale;
// Override String.localeString method
String.prototype.toLocaleString = function () {
var localeParts, localePartIndex, value, locale, fallbackIndex,
tryingLocale, message;
value = this.valueO... | javascript | function () {
var i18n = this;
// Set locale of String environment
String.locale = i18n.locale;
// Override String.localeString method
String.prototype.toLocaleString = function () {
var localeParts, localePartIndex, value, locale, fallbackIndex,
tryingLocale, message;
value = this.valueO... | [
"function",
"(",
")",
"{",
"var",
"i18n",
"=",
"this",
";",
"// Set locale of String environment",
"String",
".",
"locale",
"=",
"i18n",
".",
"locale",
";",
"// Override String.localeString method",
"String",
".",
"prototype",
".",
"toLocaleString",
"=",
"function",... | Initialize by loading locales and setting up
String.prototype.toLocaleString and String.locale. | [
"Initialize",
"by",
"loading",
"locales",
"and",
"setting",
"up",
"String",
".",
"prototype",
".",
"toLocaleString",
"and",
"String",
".",
"locale",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.js#L42-L88 | train | |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.js | function ( key, parameters ) {
var message = key.toLocaleString();
// FIXME: This changes the state of the I18N object,
// should probably not change the 'this.parser' but just
// pass it to the parser.
this.parser.language = $.i18n.languages[$.i18n().locale] || $.i18n.languages['default'];
if( messag... | javascript | function ( key, parameters ) {
var message = key.toLocaleString();
// FIXME: This changes the state of the I18N object,
// should probably not change the 'this.parser' but just
// pass it to the parser.
this.parser.language = $.i18n.languages[$.i18n().locale] || $.i18n.languages['default'];
if( messag... | [
"function",
"(",
"key",
",",
"parameters",
")",
"{",
"var",
"message",
"=",
"key",
".",
"toLocaleString",
"(",
")",
";",
"// FIXME: This changes the state of the I18N object,",
"// should probably not change the 'this.parser' but just",
"// pass it to the parser.",
"this",
".... | Does parameter and magic word substitution.
@param {string} key Message key
@param {Array} parameters Message parameters
@return {string} | [
"Does",
"parameter",
"and",
"magic",
"word",
"substitution",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.js#L165-L183 | train | |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.js | function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[index] !== undefined ? parameters[index] : '$' + match;
} );
} | javascript | function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[index] !== undefined ? parameters[index] : '$' + match;
} );
} | [
"function",
"(",
"message",
",",
"parameters",
")",
"{",
"return",
"message",
".",
"replace",
"(",
"/",
"\\$(\\d+)",
"/",
"g",
",",
"function",
"(",
"str",
",",
"match",
")",
"{",
"var",
"index",
"=",
"parseInt",
"(",
"match",
",",
"10",
")",
"-",
... | The default parser only handles variable substitution | [
"The",
"default",
"parser",
"only",
"handles",
"variable",
"substitution"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.js#L265-L270 | train | |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.parser.js | choice | function choice ( parserSyntax ) {
return function () {
var i, result;
for ( i = 0; i < parserSyntax.length; i++ ) {
result = parserSyntax[i]();
if ( result !== null ) {
return result;
}
}
return null;
};
} | javascript | function choice ( parserSyntax ) {
return function () {
var i, result;
for ( i = 0; i < parserSyntax.length; i++ ) {
result = parserSyntax[i]();
if ( result !== null ) {
return result;
}
}
return null;
};
} | [
"function",
"choice",
"(",
"parserSyntax",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"i",
",",
"result",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"parserSyntax",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"=",
"parserSynta... | Try parsers until one works, if none work return null | [
"Try",
"parsers",
"until",
"one",
"works",
"if",
"none",
"work",
"return",
"null"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.parser.js#L56-L70 | train |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.parser.js | sequence | function sequence ( parserSyntax ) {
var i, res,
originalPos = pos,
result = [];
for ( i = 0; i < parserSyntax.length; i++ ) {
res = parserSyntax[i]();
if ( res === null ) {
pos = originalPos;
return null;
}
result.push( res );
}
return result;
} | javascript | function sequence ( parserSyntax ) {
var i, res,
originalPos = pos,
result = [];
for ( i = 0; i < parserSyntax.length; i++ ) {
res = parserSyntax[i]();
if ( res === null ) {
pos = originalPos;
return null;
}
result.push( res );
}
return result;
} | [
"function",
"sequence",
"(",
"parserSyntax",
")",
"{",
"var",
"i",
",",
"res",
",",
"originalPos",
"=",
"pos",
",",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"parserSyntax",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Try several parserSyntax-es in a row. All must succeed; otherwise, return null. This is the only eager one. | [
"Try",
"several",
"parserSyntax",
"-",
"es",
"in",
"a",
"row",
".",
"All",
"must",
"succeed",
";",
"otherwise",
"return",
"null",
".",
"This",
"is",
"the",
"only",
"eager",
"one",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.parser.js#L75-L93 | train |
ma-ha/rest-web-ui | html/js/i18n/jquery.i18n.parser.js | nOrMore | function nOrMore ( n, p ) {
return function () {
var originalPos = pos,
result = [],
parsed = p();
while ( parsed !== null ) {
result.push( parsed );
parsed = p();
}
if ( result.length < n ) {
pos = originalPos;
return null;
}
return result;
... | javascript | function nOrMore ( n, p ) {
return function () {
var originalPos = pos,
result = [],
parsed = p();
while ( parsed !== null ) {
result.push( parsed );
parsed = p();
}
if ( result.length < n ) {
pos = originalPos;
return null;
}
return result;
... | [
"function",
"nOrMore",
"(",
"n",
",",
"p",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"originalPos",
"=",
"pos",
",",
"result",
"=",
"[",
"]",
",",
"parsed",
"=",
"p",
"(",
")",
";",
"while",
"(",
"parsed",
"!==",
"null",
")",
"{",
"... | Run the same parser over and over until it fails. Must succeed a minimum of n times; otherwise, return null. | [
"Run",
"the",
"same",
"parser",
"over",
"and",
"over",
"until",
"it",
"fails",
".",
"Must",
"succeed",
"a",
"minimum",
"of",
"n",
"times",
";",
"otherwise",
"return",
"null",
"."
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/js/i18n/jquery.i18n.parser.js#L97-L116 | train |
ma-ha/rest-web-ui | html/modules/pong-table/pong-table.js | pongTableCmpFields | function pongTableCmpFields( a, b ) {
var cellValA = getSubData( a, pongTable_sc );
var cellValB = getSubData( b, pongTable_sc );
log( "Pong-Table", 'Sort: '+pongTable_sc+" "+cellValA+" "+cellValB );
if ( Number( cellValA ) && Number( cellValB ) ) {
if ( ! isNaN( parseFloat( cellValA ) ) && ! isNaN( parseFl... | javascript | function pongTableCmpFields( a, b ) {
var cellValA = getSubData( a, pongTable_sc );
var cellValB = getSubData( b, pongTable_sc );
log( "Pong-Table", 'Sort: '+pongTable_sc+" "+cellValA+" "+cellValB );
if ( Number( cellValA ) && Number( cellValB ) ) {
if ( ! isNaN( parseFloat( cellValA ) ) && ! isNaN( parseFl... | [
"function",
"pongTableCmpFields",
"(",
"a",
",",
"b",
")",
"{",
"var",
"cellValA",
"=",
"getSubData",
"(",
"a",
",",
"pongTable_sc",
")",
";",
"var",
"cellValB",
"=",
"getSubData",
"(",
"b",
",",
"pongTable_sc",
")",
";",
"log",
"(",
"\"Pong-Table\"",
",... | little dirty, but works well | [
"little",
"dirty",
"but",
"works",
"well"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-table/pong-table.js#L907-L931 | train |
ma-ha/rest-web-ui | html/modules/pong-table/pong-table.js | pongListUpdateRow | function pongListUpdateRow( divId, divs, rowDta, r, cx, i, tblDiv ) {
log( "PoNG-List", 'upd-div row='+r+'/'+cx );
for ( var c = 0; c < divs.length; c ++ ) {
log( "PoNG-List", 'upd-div '+cx+'/'+c );
if ( divs[c].cellType == 'div' ) {
log( "PoNG-List", 'upd-div-x '+divs[c].id );
if ( divs[c].divs... | javascript | function pongListUpdateRow( divId, divs, rowDta, r, cx, i, tblDiv ) {
log( "PoNG-List", 'upd-div row='+r+'/'+cx );
for ( var c = 0; c < divs.length; c ++ ) {
log( "PoNG-List", 'upd-div '+cx+'/'+c );
if ( divs[c].cellType == 'div' ) {
log( "PoNG-List", 'upd-div-x '+divs[c].id );
if ( divs[c].divs... | [
"function",
"pongListUpdateRow",
"(",
"divId",
",",
"divs",
",",
"rowDta",
",",
"r",
",",
"cx",
",",
"i",
",",
"tblDiv",
")",
"{",
"log",
"(",
"\"PoNG-List\"",
",",
"'upd-div row='",
"+",
"r",
"+",
"'/'",
"+",
"cx",
")",
";",
"for",
"(",
"var",
"c"... | fill recursively empty cells of one row with data | [
"fill",
"recursively",
"empty",
"cells",
"of",
"one",
"row",
"with",
"data"
] | e2db0d55bb31a4f16fd07609ecae79156cb38378 | https://github.com/ma-ha/rest-web-ui/blob/e2db0d55bb31a4f16fd07609ecae79156cb38378/html/modules/pong-table/pong-table.js#L1836-L1853 | train |
sqlectron/sqlectron-core | src/servers.js | encryptSecrects | function encryptSecrects(server, cryptoSecret, oldSever) {
const updatedServer = { ...server };
/* eslint no-param-reassign:0 */
if (server.password) {
const isPassDiff = (oldSever && server.password !== oldSever.password);
if (!oldSever || isPassDiff) {
updatedServer.password = crypto.encrypt(ser... | javascript | function encryptSecrects(server, cryptoSecret, oldSever) {
const updatedServer = { ...server };
/* eslint no-param-reassign:0 */
if (server.password) {
const isPassDiff = (oldSever && server.password !== oldSever.password);
if (!oldSever || isPassDiff) {
updatedServer.password = crypto.encrypt(ser... | [
"function",
"encryptSecrects",
"(",
"server",
",",
"cryptoSecret",
",",
"oldSever",
")",
"{",
"const",
"updatedServer",
"=",
"{",
"...",
"server",
"}",
";",
"/* eslint no-param-reassign:0 */",
"if",
"(",
"server",
".",
"password",
")",
"{",
"const",
"isPassDiff"... | ensure all secret fields are encrypted | [
"ensure",
"all",
"secret",
"fields",
"are",
"encrypted"
] | 87094c7becf49f9f2ff18bc26c999f9ab60fe129 | https://github.com/sqlectron/sqlectron-core/blob/87094c7becf49f9f2ff18bc26c999f9ab60fe129/src/servers.js#L73-L95 | train |
nikku/karma-browserify | lib/bundle-file.js | BundleFile | function BundleFile() {
var location = getTempFileName('.browserify.js');
function write(content) {
fs.writeFileSync(location, content);
}
function exists() {
return fs.existsSync(location);
}
function remove() {
if (exists()) {
fs.unlinkSync(location);
}
}
function touch() {
... | javascript | function BundleFile() {
var location = getTempFileName('.browserify.js');
function write(content) {
fs.writeFileSync(location, content);
}
function exists() {
return fs.existsSync(location);
}
function remove() {
if (exists()) {
fs.unlinkSync(location);
}
}
function touch() {
... | [
"function",
"BundleFile",
"(",
")",
"{",
"var",
"location",
"=",
"getTempFileName",
"(",
"'.browserify.js'",
")",
";",
"function",
"write",
"(",
"content",
")",
"{",
"fs",
".",
"writeFileSync",
"(",
"location",
",",
"content",
")",
";",
"}",
"function",
"e... | A instance of a bundle file | [
"A",
"instance",
"of",
"a",
"bundle",
"file"
] | b2709c3d4945744ebb8fea92fa3b12d433d5729f | https://github.com/nikku/karma-browserify/blob/b2709c3d4945744ebb8fea92fa3b12d433d5729f/lib/bundle-file.js#L18-L51 | train |
nikku/karma-browserify | lib/bro.js | extractSourceMap | function extractSourceMap(bundleContents) {
var start = bundleContents.lastIndexOf('//# sourceMappingURL');
var sourceMapComment = start !== -1 ? bundleContents.substring(start) : '';
return sourceMapComment && convert.fromComment(sourceMapComment);
} | javascript | function extractSourceMap(bundleContents) {
var start = bundleContents.lastIndexOf('//# sourceMappingURL');
var sourceMapComment = start !== -1 ? bundleContents.substring(start) : '';
return sourceMapComment && convert.fromComment(sourceMapComment);
} | [
"function",
"extractSourceMap",
"(",
"bundleContents",
")",
"{",
"var",
"start",
"=",
"bundleContents",
".",
"lastIndexOf",
"(",
"'//# sourceMappingURL'",
")",
";",
"var",
"sourceMapComment",
"=",
"start",
"!==",
"-",
"1",
"?",
"bundleContents",
".",
"substring",
... | Extract the source map from the given bundle contents
@param {String} source
@return {SourceMap} if it could be parsed | [
"Extract",
"the",
"source",
"map",
"from",
"the",
"given",
"bundle",
"contents"
] | b2709c3d4945744ebb8fea92fa3b12d433d5729f | https://github.com/nikku/karma-browserify/blob/b2709c3d4945744ebb8fea92fa3b12d433d5729f/lib/bro.js#L56-L61 | train |
nikku/karma-browserify | lib/bro.js | addBundleFile | function addBundleFile(bundleFile, config) {
var files = config.files,
preprocessors = config.preprocessors;
// list of patterns using our preprocessor
var patterns = reduce(preprocessors, function(matched, val, key) {
if (val.indexOf('browserify') !== -1) {
matched.push(key);
... | javascript | function addBundleFile(bundleFile, config) {
var files = config.files,
preprocessors = config.preprocessors;
// list of patterns using our preprocessor
var patterns = reduce(preprocessors, function(matched, val, key) {
if (val.indexOf('browserify') !== -1) {
matched.push(key);
... | [
"function",
"addBundleFile",
"(",
"bundleFile",
",",
"config",
")",
"{",
"var",
"files",
"=",
"config",
".",
"files",
",",
"preprocessors",
"=",
"config",
".",
"preprocessors",
";",
"// list of patterns using our preprocessor",
"var",
"patterns",
"=",
"reduce",
"(... | Add bundle file to the list of files in the
configuration, right before the first browserified
test file and after everything else.
That makes sure users can include non-commonJS files
prior to the browserified bundle.
@param {BundleFile} bundleFile the file containing the browserify bundle
@param {Object} config the... | [
"Add",
"bundle",
"file",
"to",
"the",
"list",
"of",
"files",
"in",
"the",
"configuration",
"right",
"before",
"the",
"first",
"browserified",
"test",
"file",
"and",
"after",
"everything",
"else",
"."
] | b2709c3d4945744ebb8fea92fa3b12d433d5729f | https://github.com/nikku/karma-browserify/blob/b2709c3d4945744ebb8fea92fa3b12d433d5729f/lib/bro.js#L84-L121 | train |
nikku/karma-browserify | lib/bro.js | framework | function framework(emitter, config, logger) {
log = logger.create('framework.browserify');
if (!bundleFile) {
bundleFile = new BundleFile();
}
bundleFile.touch();
log.debug('created browserify bundle: %s', bundleFile.location);
b = createBundle(config);
// TODO(Nikku): hook into k... | javascript | function framework(emitter, config, logger) {
log = logger.create('framework.browserify');
if (!bundleFile) {
bundleFile = new BundleFile();
}
bundleFile.touch();
log.debug('created browserify bundle: %s', bundleFile.location);
b = createBundle(config);
// TODO(Nikku): hook into k... | [
"function",
"framework",
"(",
"emitter",
",",
"config",
",",
"logger",
")",
"{",
"log",
"=",
"logger",
".",
"create",
"(",
"'framework.browserify'",
")",
";",
"if",
"(",
"!",
"bundleFile",
")",
"{",
"bundleFile",
"=",
"new",
"BundleFile",
"(",
")",
";",
... | The browserify framework that creates the initial logger and bundle file
as well as prepends the bundle file to the karma file configuration. | [
"The",
"browserify",
"framework",
"that",
"creates",
"the",
"initial",
"logger",
"and",
"bundle",
"file",
"as",
"well",
"as",
"prepends",
"the",
"bundle",
"file",
"to",
"the",
"karma",
"file",
"configuration",
"."
] | b2709c3d4945744ebb8fea92fa3b12d433d5729f | https://github.com/nikku/karma-browserify/blob/b2709c3d4945744ebb8fea92fa3b12d433d5729f/lib/bro.js#L135-L169 | train |
nikku/karma-browserify | lib/bro.js | bundlePreprocessor | function bundlePreprocessor(config) {
var debug = config.browserify && config.browserify.debug;
function updateSourceMap(file, content) {
var map;
if (debug) {
map = extractSourceMap(content);
file.sourceMap = map && map.sourcemap;
}
}
return function(content, fil... | javascript | function bundlePreprocessor(config) {
var debug = config.browserify && config.browserify.debug;
function updateSourceMap(file, content) {
var map;
if (debug) {
map = extractSourceMap(content);
file.sourceMap = map && map.sourcemap;
}
}
return function(content, fil... | [
"function",
"bundlePreprocessor",
"(",
"config",
")",
"{",
"var",
"debug",
"=",
"config",
".",
"browserify",
"&&",
"config",
".",
"browserify",
".",
"debug",
";",
"function",
"updateSourceMap",
"(",
"file",
",",
"content",
")",
"{",
"var",
"map",
";",
"if"... | A special preprocessor that builds the main browserify bundle once and
passes the bundle contents through on all later preprocessing request. | [
"A",
"special",
"preprocessor",
"that",
"builds",
"the",
"main",
"browserify",
"bundle",
"once",
"and",
"passes",
"the",
"bundle",
"contents",
"through",
"on",
"all",
"later",
"preprocessing",
"request",
"."
] | b2709c3d4945744ebb8fea92fa3b12d433d5729f | https://github.com/nikku/karma-browserify/blob/b2709c3d4945744ebb8fea92fa3b12d433d5729f/lib/bro.js#L370-L411 | train |
yuku/jquery-textcomplete | src/dropdown.js | Dropdown | function Dropdown(element, completer, option) {
this.$el = Dropdown.createElement(option);
this.completer = completer;
this.id = completer.id + 'dropdown';
this._data = []; // zipped data.
this.$inputEl = $(element);
this.option = option;
// Override setPosition method.... | javascript | function Dropdown(element, completer, option) {
this.$el = Dropdown.createElement(option);
this.completer = completer;
this.id = completer.id + 'dropdown';
this._data = []; // zipped data.
this.$inputEl = $(element);
this.option = option;
// Override setPosition method.... | [
"function",
"Dropdown",
"(",
"element",
",",
"completer",
",",
"option",
")",
"{",
"this",
".",
"$el",
"=",
"Dropdown",
".",
"createElement",
"(",
"option",
")",
";",
"this",
".",
"completer",
"=",
"completer",
";",
"this",
".",
"id",
"=",
"completer",
... | Construct Dropdown object. element - Textarea or contenteditable element. | [
"Construct",
"Dropdown",
"object",
".",
"element",
"-",
"Textarea",
"or",
"contenteditable",
"element",
"."
] | 3aa8a1b2e74a451f0017ce700ebcf2c405a25184 | https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/dropdown.js#L45-L62 | train |
yuku/jquery-textcomplete | src/dropdown.js | function (e) {
var $el = $(e.target);
e.preventDefault();
if (!$el.hasClass('textcomplete-item')) {
$el = $el.closest('.textcomplete-item');
}
this._index = parseInt($el.data('index'), 10);
this._activateIndexedItem();
} | javascript | function (e) {
var $el = $(e.target);
e.preventDefault();
if (!$el.hasClass('textcomplete-item')) {
$el = $el.closest('.textcomplete-item');
}
this._index = parseInt($el.data('index'), 10);
this._activateIndexedItem();
} | [
"function",
"(",
"e",
")",
"{",
"var",
"$el",
"=",
"$",
"(",
"e",
".",
"target",
")",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"if",
"(",
"!",
"$el",
".",
"hasClass",
"(",
"'textcomplete-item'",
")",
")",
"{",
"$el",
"=",
"$el",
".",
"cl... | Activate hovered item. | [
"Activate",
"hovered",
"item",
"."
] | 3aa8a1b2e74a451f0017ce700ebcf2c405a25184 | https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/dropdown.js#L257-L265 | train | |
yuku/jquery-textcomplete | src/strategy.js | function (func) {
var memo = {};
return function (term, callback) {
if (memo[term]) {
callback(memo[term]);
} else {
func.call(this, term, function (data) {
memo[term] = (memo[term] || []).concat(data);
callback.apply(null, arguments);
});
}
};
... | javascript | function (func) {
var memo = {};
return function (term, callback) {
if (memo[term]) {
callback(memo[term]);
} else {
func.call(this, term, function (data) {
memo[term] = (memo[term] || []).concat(data);
callback.apply(null, arguments);
});
}
};
... | [
"function",
"(",
"func",
")",
"{",
"var",
"memo",
"=",
"{",
"}",
";",
"return",
"function",
"(",
"term",
",",
"callback",
")",
"{",
"if",
"(",
"memo",
"[",
"term",
"]",
")",
"{",
"callback",
"(",
"memo",
"[",
"term",
"]",
")",
";",
"}",
"else",... | Memoize a search function. | [
"Memoize",
"a",
"search",
"function",
"."
] | 3aa8a1b2e74a451f0017ce700ebcf2c405a25184 | https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/strategy.js#L5-L17 | train | |
yuku/jquery-textcomplete | src/content_editable.js | function (value, strategy, e) {
var pre = this.getTextFromHeadToCaret();
// use ownerDocument instead of window to support iframes
var sel = this.el.ownerDocument.getSelection();
var range = sel.getRangeAt(0);
var selection = range.cloneRange();
selection.selectNodeContents(ra... | javascript | function (value, strategy, e) {
var pre = this.getTextFromHeadToCaret();
// use ownerDocument instead of window to support iframes
var sel = this.el.ownerDocument.getSelection();
var range = sel.getRangeAt(0);
var selection = range.cloneRange();
selection.selectNodeContents(ra... | [
"function",
"(",
"value",
",",
"strategy",
",",
"e",
")",
"{",
"var",
"pre",
"=",
"this",
".",
"getTextFromHeadToCaret",
"(",
")",
";",
"// use ownerDocument instead of window to support iframes",
"var",
"sel",
"=",
"this",
".",
"el",
".",
"ownerDocument",
".",
... | Update the content with the given value and strategy. When an dropdown item is selected, it is executed. | [
"Update",
"the",
"content",
"with",
"the",
"given",
"value",
"and",
"strategy",
".",
"When",
"an",
"dropdown",
"item",
"is",
"selected",
"it",
"is",
"executed",
"."
] | 3aa8a1b2e74a451f0017ce700ebcf2c405a25184 | https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/content_editable.js#L22-L70 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.