id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8,200 | gilbitron/Raneto | app/functions/contentProcessors.js | slugToTitle | function slugToTitle (slug) {
slug = slug.replace('.md', '').trim();
return _s.titleize(_s.humanize(path.basename(slug)));
} | javascript | function slugToTitle (slug) {
slug = slug.replace('.md', '').trim();
return _s.titleize(_s.humanize(path.basename(slug)));
} | [
"function",
"slugToTitle",
"(",
"slug",
")",
"{",
"slug",
"=",
"slug",
".",
"replace",
"(",
"'.md'",
",",
"''",
")",
".",
"trim",
"(",
")",
";",
"return",
"_s",
".",
"titleize",
"(",
"_s",
".",
"humanize",
"(",
"path",
".",
"basename",
"(",
"slug",... | Convert a slug to a title | [
"Convert",
"a",
"slug",
"to",
"a",
"title"
] | b142a33948bb0e29c77f49bebac6b58f40a4255f | https://github.com/gilbitron/Raneto/blob/b142a33948bb0e29c77f49bebac6b58f40a4255f/app/functions/contentProcessors.js#L43-L46 |
8,201 | gilbitron/Raneto | app/functions/contentProcessors.js | stripMeta | function stripMeta (markdownContent) {
switch (true) {
case _metaRegex.test(markdownContent):
return markdownContent.replace(_metaRegex, '').trim();
case _metaRegexYaml.test(markdownContent):
return markdownContent.replace(_metaRegexYaml, '').trim();
default:
return markdownContent.trim(... | javascript | function stripMeta (markdownContent) {
switch (true) {
case _metaRegex.test(markdownContent):
return markdownContent.replace(_metaRegex, '').trim();
case _metaRegexYaml.test(markdownContent):
return markdownContent.replace(_metaRegexYaml, '').trim();
default:
return markdownContent.trim(... | [
"function",
"stripMeta",
"(",
"markdownContent",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"_metaRegex",
".",
"test",
"(",
"markdownContent",
")",
":",
"return",
"markdownContent",
".",
"replace",
"(",
"_metaRegex",
",",
"''",
")",
".",
"trim",
"(... | Strip meta from Markdown content | [
"Strip",
"meta",
"from",
"Markdown",
"content"
] | b142a33948bb0e29c77f49bebac6b58f40a4255f | https://github.com/gilbitron/Raneto/blob/b142a33948bb0e29c77f49bebac6b58f40a4255f/app/functions/contentProcessors.js#L49-L58 |
8,202 | gilbitron/Raneto | app/functions/contentProcessors.js | processMeta | function processMeta (markdownContent) {
let meta = {};
let metaArr;
let metaString;
let metas;
let yamlObject;
switch (true) {
case _metaRegex.test(markdownContent):
metaArr = markdownContent.match(_metaRegex);
metaString = metaArr ? metaArr[1].trim() : '';
if (metaString) {
... | javascript | function processMeta (markdownContent) {
let meta = {};
let metaArr;
let metaString;
let metas;
let yamlObject;
switch (true) {
case _metaRegex.test(markdownContent):
metaArr = markdownContent.match(_metaRegex);
metaString = metaArr ? metaArr[1].trim() : '';
if (metaString) {
... | [
"function",
"processMeta",
"(",
"markdownContent",
")",
"{",
"let",
"meta",
"=",
"{",
"}",
";",
"let",
"metaArr",
";",
"let",
"metaString",
";",
"let",
"metas",
";",
"let",
"yamlObject",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"_metaRegex",
".",
... | Get meta information from Markdown content | [
"Get",
"meta",
"information",
"from",
"Markdown",
"content"
] | b142a33948bb0e29c77f49bebac6b58f40a4255f | https://github.com/gilbitron/Raneto/blob/b142a33948bb0e29c77f49bebac6b58f40a4255f/app/functions/contentProcessors.js#L61-L97 |
8,203 | gilbitron/Raneto | app/functions/contentProcessors.js | processVars | function processVars (markdownContent, config) {
if (config.variables && Array.isArray(config.variables)) {
config.variables.forEach((v) => {
markdownContent = markdownContent.replace(new RegExp('%' + v.name + '%', 'g'), v.content);
});
}
if (config.base_url) {
markdownContent = markdownContent.... | javascript | function processVars (markdownContent, config) {
if (config.variables && Array.isArray(config.variables)) {
config.variables.forEach((v) => {
markdownContent = markdownContent.replace(new RegExp('%' + v.name + '%', 'g'), v.content);
});
}
if (config.base_url) {
markdownContent = markdownContent.... | [
"function",
"processVars",
"(",
"markdownContent",
",",
"config",
")",
"{",
"if",
"(",
"config",
".",
"variables",
"&&",
"Array",
".",
"isArray",
"(",
"config",
".",
"variables",
")",
")",
"{",
"config",
".",
"variables",
".",
"forEach",
"(",
"(",
"v",
... | Replace content variables in Markdown content | [
"Replace",
"content",
"variables",
"in",
"Markdown",
"content"
] | b142a33948bb0e29c77f49bebac6b58f40a4255f | https://github.com/gilbitron/Raneto/blob/b142a33948bb0e29c77f49bebac6b58f40a4255f/app/functions/contentProcessors.js#L100-L113 |
8,204 | gilbitron/Raneto | app/functions/create_meta_info.js | create_meta_info | function create_meta_info (meta_title, meta_description, meta_sort) {
var yamlDocument = {};
var meta_info_is_present = meta_title || meta_description || meta_sort;
if (meta_info_is_present) {
if (meta_title) { yamlDocument.Title = meta_title; }
if (meta_description) { yamlDocum... | javascript | function create_meta_info (meta_title, meta_description, meta_sort) {
var yamlDocument = {};
var meta_info_is_present = meta_title || meta_description || meta_sort;
if (meta_info_is_present) {
if (meta_title) { yamlDocument.Title = meta_title; }
if (meta_description) { yamlDocum... | [
"function",
"create_meta_info",
"(",
"meta_title",
",",
"meta_description",
",",
"meta_sort",
")",
"{",
"var",
"yamlDocument",
"=",
"{",
"}",
";",
"var",
"meta_info_is_present",
"=",
"meta_title",
"||",
"meta_description",
"||",
"meta_sort",
";",
"if",
"(",
"met... | Returns an empty string if all input strings are empty | [
"Returns",
"an",
"empty",
"string",
"if",
"all",
"input",
"strings",
"are",
"empty"
] | b142a33948bb0e29c77f49bebac6b58f40a4255f | https://github.com/gilbitron/Raneto/blob/b142a33948bb0e29c77f49bebac6b58f40a4255f/app/functions/create_meta_info.js#L8-L23 |
8,205 | jnordberg/gif.js | src/LZWEncoder.js | cl_block | function cl_block(outs) {
cl_hash(HSIZE);
free_ent = ClearCode + 2;
clear_flg = true;
output(ClearCode, outs);
} | javascript | function cl_block(outs) {
cl_hash(HSIZE);
free_ent = ClearCode + 2;
clear_flg = true;
output(ClearCode, outs);
} | [
"function",
"cl_block",
"(",
"outs",
")",
"{",
"cl_hash",
"(",
"HSIZE",
")",
";",
"free_ent",
"=",
"ClearCode",
"+",
"2",
";",
"clear_flg",
"=",
"true",
";",
"output",
"(",
"ClearCode",
",",
"outs",
")",
";",
"}"
] | Clear out the hash table table clear for block compress | [
"Clear",
"out",
"the",
"hash",
"table",
"table",
"clear",
"for",
"block",
"compress"
] | a2201f123ed9e5582e57c3d15f5df00c0b8367bd | https://github.com/jnordberg/gif.js/blob/a2201f123ed9e5582e57c3d15f5df00c0b8367bd/src/LZWEncoder.js#L68-L73 |
8,206 | jnordberg/gif.js | src/LZWEncoder.js | flush_char | function flush_char(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
} | javascript | function flush_char(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
} | [
"function",
"flush_char",
"(",
"outs",
")",
"{",
"if",
"(",
"a_count",
">",
"0",
")",
"{",
"outs",
".",
"writeByte",
"(",
"a_count",
")",
";",
"outs",
".",
"writeBytes",
"(",
"accum",
",",
"0",
",",
"a_count",
")",
";",
"a_count",
"=",
"0",
";",
... | Flush the packet to disk, and reset the accumulator | [
"Flush",
"the",
"packet",
"to",
"disk",
"and",
"reset",
"the",
"accumulator"
] | a2201f123ed9e5582e57c3d15f5df00c0b8367bd | https://github.com/jnordberg/gif.js/blob/a2201f123ed9e5582e57c3d15f5df00c0b8367bd/src/LZWEncoder.js#L148-L154 |
8,207 | okonet/lint-staged | src/getConfig.js | isSimple | function isSimple(config) {
return (
isObject(config) &&
!config.hasOwnProperty('linters') &&
intersection(Object.keys(defaultConfig), Object.keys(config)).length === 0
)
} | javascript | function isSimple(config) {
return (
isObject(config) &&
!config.hasOwnProperty('linters') &&
intersection(Object.keys(defaultConfig), Object.keys(config)).length === 0
)
} | [
"function",
"isSimple",
"(",
"config",
")",
"{",
"return",
"(",
"isObject",
"(",
"config",
")",
"&&",
"!",
"config",
".",
"hasOwnProperty",
"(",
"'linters'",
")",
"&&",
"intersection",
"(",
"Object",
".",
"keys",
"(",
"defaultConfig",
")",
",",
"Object",
... | Check if the config is "simple" i.e. doesn't contains any of full config keys
@param config
@returns {boolean} | [
"Check",
"if",
"the",
"config",
"is",
"simple",
"i",
".",
"e",
".",
"doesn",
"t",
"contains",
"any",
"of",
"full",
"config",
"keys"
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/getConfig.js#L73-L79 |
8,208 | okonet/lint-staged | src/getConfig.js | unknownValidationReporter | function unknownValidationReporter(config, option) {
/**
* If the unkonwn property is a glob this is probably
* a typical mistake of mixing simple and advanced configs
*/
if (isGlob(option)) {
// prettier-ignore
const message = `You are probably trying to mix simple and advanced config formats. Add... | javascript | function unknownValidationReporter(config, option) {
/**
* If the unkonwn property is a glob this is probably
* a typical mistake of mixing simple and advanced configs
*/
if (isGlob(option)) {
// prettier-ignore
const message = `You are probably trying to mix simple and advanced config formats. Add... | [
"function",
"unknownValidationReporter",
"(",
"config",
",",
"option",
")",
"{",
"/**\n * If the unkonwn property is a glob this is probably\n * a typical mistake of mixing simple and advanced configs\n */",
"if",
"(",
"isGlob",
"(",
"option",
")",
")",
"{",
"// prettier-igno... | Reporter for unknown options
@param config
@param option
@returns {void} | [
"Reporter",
"for",
"unknown",
"options"
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/getConfig.js#L124-L144 |
8,209 | okonet/lint-staged | src/getConfig.js | getConfig | function getConfig(sourceConfig, debugMode) {
debug('Normalizing config')
const config = defaultsDeep(
{}, // Do not mutate sourceConfig!!!
isSimple(sourceConfig) ? { linters: sourceConfig } : sourceConfig,
defaultConfig
)
// Check if renderer is set in sourceConfig and if not, set accordingly to v... | javascript | function getConfig(sourceConfig, debugMode) {
debug('Normalizing config')
const config = defaultsDeep(
{}, // Do not mutate sourceConfig!!!
isSimple(sourceConfig) ? { linters: sourceConfig } : sourceConfig,
defaultConfig
)
// Check if renderer is set in sourceConfig and if not, set accordingly to v... | [
"function",
"getConfig",
"(",
"sourceConfig",
",",
"debugMode",
")",
"{",
"debug",
"(",
"'Normalizing config'",
")",
"const",
"config",
"=",
"defaultsDeep",
"(",
"{",
"}",
",",
"// Do not mutate sourceConfig!!!",
"isSimple",
"(",
"sourceConfig",
")",
"?",
"{",
"... | For a given configuration object that we retrive from .lintstagedrc or package.json
construct a full configuration with all options set.
This is a bit tricky since we support 2 different syntxes: simple and full
For simple config, only the `linters` configuration is provided.
@param {Object} sourceConfig
@returns {{
... | [
"For",
"a",
"given",
"configuration",
"object",
"that",
"we",
"retrive",
"from",
".",
"lintstagedrc",
"or",
"package",
".",
"json",
"construct",
"a",
"full",
"configuration",
"with",
"all",
"options",
"set",
"."
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/getConfig.js#L158-L172 |
8,210 | okonet/lint-staged | src/getConfig.js | validateConfig | function validateConfig(config) {
debug('Validating config')
const deprecatedConfig = {
gitDir: "lint-staged now automatically resolves '.git' directory.",
verbose: `Use the command line flag ${chalk.bold('--debug')} instead.`
}
const errors = []
try {
schema.validateSync(config, { abortEarly: ... | javascript | function validateConfig(config) {
debug('Validating config')
const deprecatedConfig = {
gitDir: "lint-staged now automatically resolves '.git' directory.",
verbose: `Use the command line flag ${chalk.bold('--debug')} instead.`
}
const errors = []
try {
schema.validateSync(config, { abortEarly: ... | [
"function",
"validateConfig",
"(",
"config",
")",
"{",
"debug",
"(",
"'Validating config'",
")",
"const",
"deprecatedConfig",
"=",
"{",
"gitDir",
":",
"\"lint-staged now automatically resolves '.git' directory.\"",
",",
"verbose",
":",
"`",
"${",
"chalk",
".",
"bold",... | Runs config validation. Throws error if the config is not valid.
@param config {Object}
@returns config {Object} | [
"Runs",
"config",
"validation",
".",
"Throws",
"error",
"if",
"the",
"config",
"is",
"not",
"valid",
"."
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/getConfig.js#L179-L224 |
8,211 | okonet/lint-staged | src/resolveTaskFn.js | execLinter | function execLinter(bin, args, execaOptions, pathsToLint) {
const binArgs = args.concat(pathsToLint)
debug('bin:', bin)
debug('args: %O', binArgs)
debug('opts: %o', execaOptions)
return execa(bin, binArgs, { ...execaOptions })
} | javascript | function execLinter(bin, args, execaOptions, pathsToLint) {
const binArgs = args.concat(pathsToLint)
debug('bin:', bin)
debug('args: %O', binArgs)
debug('opts: %o', execaOptions)
return execa(bin, binArgs, { ...execaOptions })
} | [
"function",
"execLinter",
"(",
"bin",
",",
"args",
",",
"execaOptions",
",",
"pathsToLint",
")",
"{",
"const",
"binArgs",
"=",
"args",
".",
"concat",
"(",
"pathsToLint",
")",
"debug",
"(",
"'bin:'",
",",
"bin",
")",
"debug",
"(",
"'args: %O'",
",",
"binA... | Execute the given linter binary with arguments and file paths using execa and
return the promise.
@param {string} bin
@param {Array<string>} args
@param {Object} execaOptions
@param {Array<string>} pathsToLint
@return {Promise} child_process | [
"Execute",
"the",
"given",
"linter",
"binary",
"with",
"arguments",
"and",
"file",
"paths",
"using",
"execa",
"and",
"return",
"the",
"promise",
"."
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/resolveTaskFn.js#L25-L33 |
8,212 | okonet/lint-staged | src/resolveTaskFn.js | makeErr | function makeErr(linter, result, context = {}) {
// Indicate that some linter will fail so we don't update the index with formatting changes
context.hasErrors = true // eslint-disable-line no-param-reassign
const { stdout, stderr, killed, signal } = result
if (killed || (signal && signal !== '')) {
return t... | javascript | function makeErr(linter, result, context = {}) {
// Indicate that some linter will fail so we don't update the index with formatting changes
context.hasErrors = true // eslint-disable-line no-param-reassign
const { stdout, stderr, killed, signal } = result
if (killed || (signal && signal !== '')) {
return t... | [
"function",
"makeErr",
"(",
"linter",
",",
"result",
",",
"context",
"=",
"{",
"}",
")",
"{",
"// Indicate that some linter will fail so we don't update the index with formatting changes",
"context",
".",
"hasErrors",
"=",
"true",
"// eslint-disable-line no-param-reassign",
"... | Create a failure message dependding on process result.
@param {string} linter
@param {Object} result
@param {string} result.stdout
@param {string} result.stderr
@param {boolean} result.failed
@param {boolean} result.killed
@param {string} result.signal
@param {Object} context (see https://github.com/SamVerschueren/lis... | [
"Create",
"a",
"failure",
"message",
"dependding",
"on",
"process",
"result",
"."
] | 098452423fd3cdc4d80f861d330d64bc82f7bbaf | https://github.com/okonet/lint-staged/blob/098452423fd3cdc4d80f861d330d64bc82f7bbaf/src/resolveTaskFn.js#L65-L80 |
8,213 | oliviertassinari/react-swipeable-views | packages/react-swipeable-views-core/src/mod.js | mod | function mod(n, m) {
const q = n % m;
return q < 0 ? q + m : q;
} | javascript | function mod(n, m) {
const q = n % m;
return q < 0 ? q + m : q;
} | [
"function",
"mod",
"(",
"n",
",",
"m",
")",
"{",
"const",
"q",
"=",
"n",
"%",
"m",
";",
"return",
"q",
"<",
"0",
"?",
"q",
"+",
"m",
":",
"q",
";",
"}"
] | Extended version of % with negative integer support. | [
"Extended",
"version",
"of",
"%",
"with",
"negative",
"integer",
"support",
"."
] | 400a004ef2a1c3f7804091a9f47f48c94d2125bf | https://github.com/oliviertassinari/react-swipeable-views/blob/400a004ef2a1c3f7804091a9f47f48c94d2125bf/packages/react-swipeable-views-core/src/mod.js#L2-L5 |
8,214 | oliviertassinari/react-swipeable-views | packages/react-swipeable-views/src/SwipeableViews.js | applyRotationMatrix | function applyRotationMatrix(touch, axis) {
const rotationMatrix = axisProperties.rotationMatrix[axis];
return {
pageX: rotationMatrix.x[0] * touch.pageX + rotationMatrix.x[1] * touch.pageY,
pageY: rotationMatrix.y[0] * touch.pageX + rotationMatrix.y[1] * touch.pageY,
};
} | javascript | function applyRotationMatrix(touch, axis) {
const rotationMatrix = axisProperties.rotationMatrix[axis];
return {
pageX: rotationMatrix.x[0] * touch.pageX + rotationMatrix.x[1] * touch.pageY,
pageY: rotationMatrix.y[0] * touch.pageX + rotationMatrix.y[1] * touch.pageY,
};
} | [
"function",
"applyRotationMatrix",
"(",
"touch",
",",
"axis",
")",
"{",
"const",
"rotationMatrix",
"=",
"axisProperties",
".",
"rotationMatrix",
"[",
"axis",
"]",
";",
"return",
"{",
"pageX",
":",
"rotationMatrix",
".",
"x",
"[",
"0",
"]",
"*",
"touch",
".... | We are using a 2x2 rotation matrix. | [
"We",
"are",
"using",
"a",
"2x2",
"rotation",
"matrix",
"."
] | 400a004ef2a1c3f7804091a9f47f48c94d2125bf | https://github.com/oliviertassinari/react-swipeable-views/blob/400a004ef2a1c3f7804091a9f47f48c94d2125bf/packages/react-swipeable-views/src/SwipeableViews.js#L115-L122 |
8,215 | jhildenbiddle/css-vars-ponyfill | src/transform-css.js | resolveFunc | function resolveFunc(value) {
const name = value.split(',')[0].replace(/[\s\n\t]/g, '');
const fallback = (value.match(/(?:\s*,\s*){1}(.*)?/) || [])[1];
const match = settings.variables.hasOwnProperty(name) ? String(settings.variables[name]) : undefined;
... | javascript | function resolveFunc(value) {
const name = value.split(',')[0].replace(/[\s\n\t]/g, '');
const fallback = (value.match(/(?:\s*,\s*){1}(.*)?/) || [])[1];
const match = settings.variables.hasOwnProperty(name) ? String(settings.variables[name]) : undefined;
... | [
"function",
"resolveFunc",
"(",
"value",
")",
"{",
"const",
"name",
"=",
"value",
".",
"split",
"(",
"','",
")",
"[",
"0",
"]",
".",
"replace",
"(",
"/",
"[\\s\\n\\t]",
"/",
"g",
",",
"''",
")",
";",
"const",
"fallback",
"=",
"(",
"value",
".",
"... | Resolves contents of CSS custom property function
@param {string} value String containing contents of CSS var() function
@returns {string}
@example
resolveFunc('--x, var(--y, green)')
// => obj['--x'] or obj['--y'] or 'green'
resolveFunc('--fail')
// => 'var(--fail)' when obj['--fail'] does not exist | [
"Resolves",
"contents",
"of",
"CSS",
"custom",
"property",
"function"
] | e22453fba24bdf0d593b0dbca17b05a947c7ed32 | https://github.com/jhildenbiddle/css-vars-ponyfill/blob/e22453fba24bdf0d593b0dbca17b05a947c7ed32/src/transform-css.js#L170-L187 |
8,216 | jhildenbiddle/css-vars-ponyfill | src/index.js | getTimeStamp | function getTimeStamp() {
return isBrowser && (window.performance || {}).now ? window.performance.now() : new Date().getTime();
} | javascript | function getTimeStamp() {
return isBrowser && (window.performance || {}).now ? window.performance.now() : new Date().getTime();
} | [
"function",
"getTimeStamp",
"(",
")",
"{",
"return",
"isBrowser",
"&&",
"(",
"window",
".",
"performance",
"||",
"{",
"}",
")",
".",
"now",
"?",
"window",
".",
"performance",
".",
"now",
"(",
")",
":",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
... | Returns a time stamp in milliseconds
@returns {number} | [
"Returns",
"a",
"time",
"stamp",
"in",
"milliseconds"
] | e22453fba24bdf0d593b0dbca17b05a947c7ed32 | https://github.com/jhildenbiddle/css-vars-ponyfill/blob/e22453fba24bdf0d593b0dbca17b05a947c7ed32/src/index.js#L797-L799 |
8,217 | iamdustan/smoothscroll | src/smoothscroll.js | shouldBailOut | function shouldBailOut(firstArg) {
if (
firstArg === null ||
typeof firstArg !== 'object' ||
firstArg.behavior === undefined ||
firstArg.behavior === 'auto' ||
firstArg.behavior === 'instant'
) {
// first argument is not an object/null
// or behavior is auto, instant or... | javascript | function shouldBailOut(firstArg) {
if (
firstArg === null ||
typeof firstArg !== 'object' ||
firstArg.behavior === undefined ||
firstArg.behavior === 'auto' ||
firstArg.behavior === 'instant'
) {
// first argument is not an object/null
// or behavior is auto, instant or... | [
"function",
"shouldBailOut",
"(",
"firstArg",
")",
"{",
"if",
"(",
"firstArg",
"===",
"null",
"||",
"typeof",
"firstArg",
"!==",
"'object'",
"||",
"firstArg",
".",
"behavior",
"===",
"undefined",
"||",
"firstArg",
".",
"behavior",
"===",
"'auto'",
"||",
"fir... | indicates if a smooth behavior should be applied
@method shouldBailOut
@param {Number|Object} firstArg
@returns {Boolean} | [
"indicates",
"if",
"a",
"smooth",
"behavior",
"should",
"be",
"applied"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L82-L106 |
8,218 | iamdustan/smoothscroll | src/smoothscroll.js | hasScrollableSpace | function hasScrollableSpace(el, axis) {
if (axis === 'Y') {
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
}
if (axis === 'X') {
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
}
} | javascript | function hasScrollableSpace(el, axis) {
if (axis === 'Y') {
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
}
if (axis === 'X') {
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
}
} | [
"function",
"hasScrollableSpace",
"(",
"el",
",",
"axis",
")",
"{",
"if",
"(",
"axis",
"===",
"'Y'",
")",
"{",
"return",
"el",
".",
"clientHeight",
"+",
"ROUNDING_TOLERANCE",
"<",
"el",
".",
"scrollHeight",
";",
"}",
"if",
"(",
"axis",
"===",
"'X'",
")... | indicates if an element has scrollable space in the provided axis
@method hasScrollableSpace
@param {Node} el
@param {String} axis
@returns {Boolean} | [
"indicates",
"if",
"an",
"element",
"has",
"scrollable",
"space",
"in",
"the",
"provided",
"axis"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L115-L123 |
8,219 | iamdustan/smoothscroll | src/smoothscroll.js | canOverflow | function canOverflow(el, axis) {
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
return overflowValue === 'auto' || overflowValue === 'scroll';
} | javascript | function canOverflow(el, axis) {
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
return overflowValue === 'auto' || overflowValue === 'scroll';
} | [
"function",
"canOverflow",
"(",
"el",
",",
"axis",
")",
"{",
"var",
"overflowValue",
"=",
"w",
".",
"getComputedStyle",
"(",
"el",
",",
"null",
")",
"[",
"'overflow'",
"+",
"axis",
"]",
";",
"return",
"overflowValue",
"===",
"'auto'",
"||",
"overflowValue"... | indicates if an element has a scrollable overflow property in the axis
@method canOverflow
@param {Node} el
@param {String} axis
@returns {Boolean} | [
"indicates",
"if",
"an",
"element",
"has",
"a",
"scrollable",
"overflow",
"property",
"in",
"the",
"axis"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L132-L136 |
8,220 | iamdustan/smoothscroll | src/smoothscroll.js | isScrollable | function isScrollable(el) {
var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
return isScrollableY || isScrollableX;
} | javascript | function isScrollable(el) {
var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
return isScrollableY || isScrollableX;
} | [
"function",
"isScrollable",
"(",
"el",
")",
"{",
"var",
"isScrollableY",
"=",
"hasScrollableSpace",
"(",
"el",
",",
"'Y'",
")",
"&&",
"canOverflow",
"(",
"el",
",",
"'Y'",
")",
";",
"var",
"isScrollableX",
"=",
"hasScrollableSpace",
"(",
"el",
",",
"'X'",
... | indicates if an element can be scrolled in either axis
@method isScrollable
@param {Node} el
@param {String} axis
@returns {Boolean} | [
"indicates",
"if",
"an",
"element",
"can",
"be",
"scrolled",
"in",
"either",
"axis"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L145-L150 |
8,221 | iamdustan/smoothscroll | src/smoothscroll.js | findScrollableParent | function findScrollableParent(el) {
while (el !== d.body && isScrollable(el) === false) {
el = el.parentNode || el.host;
}
return el;
} | javascript | function findScrollableParent(el) {
while (el !== d.body && isScrollable(el) === false) {
el = el.parentNode || el.host;
}
return el;
} | [
"function",
"findScrollableParent",
"(",
"el",
")",
"{",
"while",
"(",
"el",
"!==",
"d",
".",
"body",
"&&",
"isScrollable",
"(",
"el",
")",
"===",
"false",
")",
"{",
"el",
"=",
"el",
".",
"parentNode",
"||",
"el",
".",
"host",
";",
"}",
"return",
"... | finds scrollable parent of an element
@method findScrollableParent
@param {Node} el
@returns {Node} el | [
"finds",
"scrollable",
"parent",
"of",
"an",
"element"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L158-L164 |
8,222 | iamdustan/smoothscroll | src/smoothscroll.js | smoothScroll | function smoothScroll(el, x, y) {
var scrollable;
var startX;
var startY;
var method;
var startTime = now();
// define scroll context
if (el === d.body) {
scrollable = w;
startX = w.scrollX || w.pageXOffset;
startY = w.scrollY || w.pageYOffset;
method = original.scro... | javascript | function smoothScroll(el, x, y) {
var scrollable;
var startX;
var startY;
var method;
var startTime = now();
// define scroll context
if (el === d.body) {
scrollable = w;
startX = w.scrollX || w.pageXOffset;
startY = w.scrollY || w.pageYOffset;
method = original.scro... | [
"function",
"smoothScroll",
"(",
"el",
",",
"x",
",",
"y",
")",
"{",
"var",
"scrollable",
";",
"var",
"startX",
";",
"var",
"startY",
";",
"var",
"method",
";",
"var",
"startTime",
"=",
"now",
"(",
")",
";",
"// define scroll context",
"if",
"(",
"el",... | scrolls window or element with a smooth behavior
@method smoothScroll
@param {Object|Node} el
@param {Number} x
@param {Number} y
@returns {undefined} | [
"scrolls",
"window",
"or",
"element",
"with",
"a",
"smooth",
"behavior"
] | 46ce13e65eee17640dacbbd50f7c64f4a393b3ef | https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L204-L234 |
8,223 | kaola-fed/megalo | dist/vue.runtime.esm.js | defineReactive$$1 | function defineReactive$$1 (
obj,
key,
val,
customSetter,
shallow
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
va... | javascript | function defineReactive$$1 (
obj,
key,
val,
customSetter,
shallow
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
va... | [
"function",
"defineReactive$$1",
"(",
"obj",
",",
"key",
",",
"val",
",",
"customSetter",
",",
"shallow",
")",
"{",
"var",
"dep",
"=",
"new",
"Dep",
"(",
")",
";",
"var",
"property",
"=",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"obj",
",",
"key",... | Define a reactive property on an Object. | [
"Define",
"a",
"reactive",
"property",
"on",
"an",
"Object",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L999-L1058 |
8,224 | kaola-fed/megalo | dist/vue.runtime.esm.js | queueWatcher | function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length... | javascript | function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length... | [
"function",
"queueWatcher",
"(",
"watcher",
")",
"{",
"var",
"id",
"=",
"watcher",
".",
"id",
";",
"if",
"(",
"has",
"[",
"id",
"]",
"==",
"null",
")",
"{",
"has",
"[",
"id",
"]",
"=",
"true",
";",
"if",
"(",
"!",
"flushing",
")",
"{",
"queue",... | Push a watcher into the watcher queue.
Jobs with duplicate IDs will be skipped unless it's
pushed when the queue is being flushed. | [
"Push",
"a",
"watcher",
"into",
"the",
"watcher",
"queue",
".",
"Jobs",
"with",
"duplicate",
"IDs",
"will",
"be",
"skipped",
"unless",
"it",
"s",
"pushed",
"when",
"the",
"queue",
"is",
"being",
"flushed",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L4319-L4345 |
8,225 | kaola-fed/megalo | dist/vue.runtime.esm.js | getStyle | function getStyle (vnode, checkChild) {
var res = {};
var styleData;
if (checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.dat... | javascript | function getStyle (vnode, checkChild) {
var res = {};
var styleData;
if (checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (
childNode && childNode.data &&
(styleData = normalizeStyleData(childNode.dat... | [
"function",
"getStyle",
"(",
"vnode",
",",
"checkChild",
")",
"{",
"var",
"res",
"=",
"{",
"}",
";",
"var",
"styleData",
";",
"if",
"(",
"checkChild",
")",
"{",
"var",
"childNode",
"=",
"vnode",
";",
"while",
"(",
"childNode",
".",
"componentInstance",
... | parent component style should be after child's
so that parent component's style could override it | [
"parent",
"component",
"style",
"should",
"be",
"after",
"child",
"s",
"so",
"that",
"parent",
"component",
"s",
"style",
"could",
"override",
"it"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L7048-L7076 |
8,226 | kaola-fed/megalo | packages/weex-template-compiler/build.js | postTransformComponent | function postTransformComponent (
el,
options
) {
// $flow-disable-line (we know isReservedTag is there)
if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') {
addAttr(el, RECYCLE_LIST_MARKER, 'true');
}
} | javascript | function postTransformComponent (
el,
options
) {
// $flow-disable-line (we know isReservedTag is there)
if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') {
addAttr(el, RECYCLE_LIST_MARKER, 'true');
}
} | [
"function",
"postTransformComponent",
"(",
"el",
",",
"options",
")",
"{",
"// $flow-disable-line (we know isReservedTag is there)",
"if",
"(",
"!",
"options",
".",
"isReservedTag",
"(",
"el",
".",
"tag",
")",
"&&",
"el",
".",
"tag",
"!==",
"'cell-slot'",
")",
"... | mark components as inside recycle-list so that we know we need to invoke their special @render function instead of render in create-component.js | [
"mark",
"components",
"as",
"inside",
"recycle",
"-",
"list",
"so",
"that",
"we",
"know",
"we",
"need",
"to",
"invoke",
"their",
"special"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-template-compiler/build.js#L3965-L3973 |
8,227 | kaola-fed/megalo | packages/weex-vue-framework/factory.js | registerComponentHook | function registerComponentHook (
componentId,
type, // hook type, could be "lifecycle" or "instance"
hook, // hook name
fn
) {
if (!document || !document.taskCenter) {
warn("Can't find available \"document\" or \"taskCenter\".");
return
}
if (typeof document.taskCenter.registerHook === 'function')... | javascript | function registerComponentHook (
componentId,
type, // hook type, could be "lifecycle" or "instance"
hook, // hook name
fn
) {
if (!document || !document.taskCenter) {
warn("Can't find available \"document\" or \"taskCenter\".");
return
}
if (typeof document.taskCenter.registerHook === 'function')... | [
"function",
"registerComponentHook",
"(",
"componentId",
",",
"type",
",",
"// hook type, could be \"lifecycle\" or \"instance\"",
"hook",
",",
"// hook name",
"fn",
")",
"{",
"if",
"(",
"!",
"document",
"||",
"!",
"document",
".",
"taskCenter",
")",
"{",
"warn",
... | Register the component hook to weex native render engine. The hook will be triggered by native, not javascript. | [
"Register",
"the",
"component",
"hook",
"to",
"weex",
"native",
"render",
"engine",
".",
"The",
"hook",
"will",
"be",
"triggered",
"by",
"native",
"not",
"javascript",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4082-L4096 |
8,228 | kaola-fed/megalo | packages/weex-vue-framework/factory.js | updateComponentData | function updateComponentData (
componentId,
newData,
callback
) {
if (!document || !document.taskCenter) {
warn("Can't find available \"document\" or \"taskCenter\".");
return
}
if (typeof document.taskCenter.updateData === 'function') {
return document.taskCenter.updateData(componentId, newData... | javascript | function updateComponentData (
componentId,
newData,
callback
) {
if (!document || !document.taskCenter) {
warn("Can't find available \"document\" or \"taskCenter\".");
return
}
if (typeof document.taskCenter.updateData === 'function') {
return document.taskCenter.updateData(componentId, newData... | [
"function",
"updateComponentData",
"(",
"componentId",
",",
"newData",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"document",
"||",
"!",
"document",
".",
"taskCenter",
")",
"{",
"warn",
"(",
"\"Can't find available \\\"document\\\" or \\\"taskCenter\\\".\"",
")",
";... | Updates the state of the component to weex native render engine. | [
"Updates",
"the",
"state",
"of",
"the",
"component",
"to",
"weex",
"native",
"render",
"engine",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4099-L4112 |
8,229 | kaola-fed/megalo | packages/weex-vue-framework/factory.js | initVirtualComponent | function initVirtualComponent (options) {
if ( options === void 0 ) options = {};
var vm = this;
var componentId = options.componentId;
// virtual component uid
vm._uid = "virtual-component-" + (uid$2++);
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && optio... | javascript | function initVirtualComponent (options) {
if ( options === void 0 ) options = {};
var vm = this;
var componentId = options.componentId;
// virtual component uid
vm._uid = "virtual-component-" + (uid$2++);
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && optio... | [
"function",
"initVirtualComponent",
"(",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"options",
"=",
"{",
"}",
";",
"var",
"vm",
"=",
"this",
";",
"var",
"componentId",
"=",
"options",
".",
"componentId",
";",
"// virtual component ... | override Vue.prototype._init | [
"override",
"Vue",
".",
"prototype",
".",
"_init"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4121-L4187 |
8,230 | kaola-fed/megalo | packages/weex-vue-framework/factory.js | updateVirtualComponent | function updateVirtualComponent (vnode) {
var vm = this;
var componentId = vm.$options.componentId;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
vm._vnode = vnode;
if (vm._isMounted && componentId) {
// TODO: data should be filtered and without bindings
var data = Object.assign({}, vm._d... | javascript | function updateVirtualComponent (vnode) {
var vm = this;
var componentId = vm.$options.componentId;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
vm._vnode = vnode;
if (vm._isMounted && componentId) {
// TODO: data should be filtered and without bindings
var data = Object.assign({}, vm._d... | [
"function",
"updateVirtualComponent",
"(",
"vnode",
")",
"{",
"var",
"vm",
"=",
"this",
";",
"var",
"componentId",
"=",
"vm",
".",
"$options",
".",
"componentId",
";",
"if",
"(",
"vm",
".",
"_isMounted",
")",
"{",
"callHook",
"(",
"vm",
",",
"'beforeUpda... | override Vue.prototype._update | [
"override",
"Vue",
".",
"prototype",
".",
"_update"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4190-L4204 |
8,231 | kaola-fed/megalo | packages/weex-vue-framework/factory.js | resolveVirtualComponent | function resolveVirtualComponent (vnode) {
var BaseCtor = vnode.componentOptions.Ctor;
var VirtualComponent = BaseCtor.extend({});
var cid = VirtualComponent.cid;
VirtualComponent.prototype._init = initVirtualComponent;
VirtualComponent.prototype._update = updateVirtualComponent;
vnode.componentOptions.Cto... | javascript | function resolveVirtualComponent (vnode) {
var BaseCtor = vnode.componentOptions.Ctor;
var VirtualComponent = BaseCtor.extend({});
var cid = VirtualComponent.cid;
VirtualComponent.prototype._init = initVirtualComponent;
VirtualComponent.prototype._update = updateVirtualComponent;
vnode.componentOptions.Cto... | [
"function",
"resolveVirtualComponent",
"(",
"vnode",
")",
"{",
"var",
"BaseCtor",
"=",
"vnode",
".",
"componentOptions",
".",
"Ctor",
";",
"var",
"VirtualComponent",
"=",
"BaseCtor",
".",
"extend",
"(",
"{",
"}",
")",
";",
"var",
"cid",
"=",
"VirtualComponen... | listening on native callback | [
"listening",
"on",
"native",
"callback"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4207-L4239 |
8,232 | kaola-fed/megalo | packages/weex-vue-framework/index.js | createInstanceContext | function createInstanceContext (
instanceId,
runtimeContext,
data
) {
if ( data === void 0 ) data = {};
var weex = runtimeContext.weex;
var instance = instanceOptions[instanceId] = {
instanceId: instanceId,
config: weex.config,
document: weex.document,
data: data
};
// Each instance ha... | javascript | function createInstanceContext (
instanceId,
runtimeContext,
data
) {
if ( data === void 0 ) data = {};
var weex = runtimeContext.weex;
var instance = instanceOptions[instanceId] = {
instanceId: instanceId,
config: weex.config,
document: weex.document,
data: data
};
// Each instance ha... | [
"function",
"createInstanceContext",
"(",
"instanceId",
",",
"runtimeContext",
",",
"data",
")",
"{",
"if",
"(",
"data",
"===",
"void",
"0",
")",
"data",
"=",
"{",
"}",
";",
"var",
"weex",
"=",
"runtimeContext",
".",
"weex",
";",
"var",
"instance",
"=",
... | Create instance context. | [
"Create",
"instance",
"context",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/index.js#L16-L40 |
8,233 | kaola-fed/megalo | packages/weex-vue-framework/index.js | getInstanceTimer | function getInstanceTimer (
instanceId,
moduleGetter
) {
var instance = instanceOptions[instanceId];
var timer = moduleGetter('timer');
var timerAPIs = {
setTimeout: function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var handler = functi... | javascript | function getInstanceTimer (
instanceId,
moduleGetter
) {
var instance = instanceOptions[instanceId];
var timer = moduleGetter('timer');
var timerAPIs = {
setTimeout: function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var handler = functi... | [
"function",
"getInstanceTimer",
"(",
"instanceId",
",",
"moduleGetter",
")",
"{",
"var",
"instance",
"=",
"instanceOptions",
"[",
"instanceId",
"]",
";",
"var",
"timer",
"=",
"moduleGetter",
"(",
"'timer'",
")",
";",
"var",
"timerAPIs",
"=",
"{",
"setTimeout",... | DEPRECATED
Generate HTML5 Timer APIs. An important point is that the callback
will be converted into callback id when sent to native. So the
framework can make sure no side effect of the callback happened after
an instance destroyed. | [
"DEPRECATED",
"Generate",
"HTML5",
"Timer",
"APIs",
".",
"An",
"important",
"point",
"is",
"that",
"the",
"callback",
"will",
"be",
"converted",
"into",
"callback",
"id",
"when",
"sent",
"to",
"native",
".",
"So",
"the",
"framework",
"can",
"make",
"sure",
... | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/index.js#L162-L199 |
8,234 | kaola-fed/megalo | packages/vue-server-renderer/build.dev.js | applyModelTransform | function applyModelTransform (el, state) {
if (el.directives) {
for (var i = 0; i < el.directives.length; i++) {
var dir = el.directives[i];
if (dir.name === 'model') {
state.directives.model(el, dir, state.warn);
// remove value for textarea as its converted to text
if (el.tag... | javascript | function applyModelTransform (el, state) {
if (el.directives) {
for (var i = 0; i < el.directives.length; i++) {
var dir = el.directives[i];
if (dir.name === 'model') {
state.directives.model(el, dir, state.warn);
// remove value for textarea as its converted to text
if (el.tag... | [
"function",
"applyModelTransform",
"(",
"el",
",",
"state",
")",
"{",
"if",
"(",
"el",
".",
"directives",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"el",
".",
"directives",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"dir",
... | let the model AST transform translate v-model into appropriate props bindings | [
"let",
"the",
"model",
"AST",
"transform",
"translate",
"v",
"-",
"model",
"into",
"appropriate",
"props",
"bindings"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/vue-server-renderer/build.dev.js#L5489-L5503 |
8,235 | kaola-fed/megalo | dist/vue.esm.browser.js | isValidArrayIndex | function isValidArrayIndex (val) {
const n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val)
} | javascript | function isValidArrayIndex (val) {
const n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val)
} | [
"function",
"isValidArrayIndex",
"(",
"val",
")",
"{",
"const",
"n",
"=",
"parseFloat",
"(",
"String",
"(",
"val",
")",
")",
";",
"return",
"n",
">=",
"0",
"&&",
"Math",
".",
"floor",
"(",
"n",
")",
"===",
"n",
"&&",
"isFinite",
"(",
"val",
")",
... | Check if val is a valid array index. | [
"Check",
"if",
"val",
"is",
"a",
"valid",
"array",
"index",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L74-L77 |
8,236 | kaola-fed/megalo | dist/vue.esm.browser.js | makeMap | function makeMap (
str,
expectsLowerCase
) {
const map = Object.create(null);
const list = str.split(',');
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? val => map[val.toLowerCase()]
: val => map[val]
} | javascript | function makeMap (
str,
expectsLowerCase
) {
const map = Object.create(null);
const list = str.split(',');
for (let i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? val => map[val.toLowerCase()]
: val => map[val]
} | [
"function",
"makeMap",
"(",
"str",
",",
"expectsLowerCase",
")",
"{",
"const",
"map",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"const",
"list",
"=",
"str",
".",
"split",
"(",
"','",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i"... | Make a map and return a function for checking if a key
is in that map. | [
"Make",
"a",
"map",
"and",
"return",
"a",
"function",
"for",
"checking",
"if",
"a",
"key",
"is",
"in",
"that",
"map",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L111-L123 |
8,237 | kaola-fed/megalo | dist/vue.esm.browser.js | toArray | function toArray (list, start) {
start = start || 0;
let i = list.length - start;
const ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
} | javascript | function toArray (list, start) {
start = start || 0;
let i = list.length - start;
const ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
} | [
"function",
"toArray",
"(",
"list",
",",
"start",
")",
"{",
"start",
"=",
"start",
"||",
"0",
";",
"let",
"i",
"=",
"list",
".",
"length",
"-",
"start",
";",
"const",
"ret",
"=",
"new",
"Array",
"(",
"i",
")",
";",
"while",
"(",
"i",
"--",
")",... | Convert an Array-like object to a real Array. | [
"Convert",
"an",
"Array",
"-",
"like",
"object",
"to",
"a",
"real",
"Array",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L223-L231 |
8,238 | kaola-fed/megalo | dist/vue.esm.browser.js | cloneVNode | function cloneVNode (vnode) {
const cloned = new VNode(
vnode.tag,
vnode.data,
// #7975
// clone children array to avoid mutating original in case of cloning
// a child.
vnode.children && vnode.children.slice(),
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
... | javascript | function cloneVNode (vnode) {
const cloned = new VNode(
vnode.tag,
vnode.data,
// #7975
// clone children array to avoid mutating original in case of cloning
// a child.
vnode.children && vnode.children.slice(),
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
... | [
"function",
"cloneVNode",
"(",
"vnode",
")",
"{",
"const",
"cloned",
"=",
"new",
"VNode",
"(",
"vnode",
".",
"tag",
",",
"vnode",
".",
"data",
",",
"// #7975",
"// clone children array to avoid mutating original in case of cloning",
"// a child.",
"vnode",
".",
"chi... | optimized shallow clone used for static nodes and slot nodes because they may be reused across multiple renders, cloning them avoids errors when DOM manipulations rely on their elm reference. | [
"optimized",
"shallow",
"clone",
"used",
"for",
"static",
"nodes",
"and",
"slot",
"nodes",
"because",
"they",
"may",
"be",
"reused",
"across",
"multiple",
"renders",
"cloning",
"them",
"avoids",
"errors",
"when",
"DOM",
"manipulations",
"rely",
"on",
"their",
... | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L856-L880 |
8,239 | kaola-fed/megalo | dist/vue.esm.browser.js | normalizeProps | function normalizeProps (options, vm) {
const props = options.props;
if (!props) return
const res = {};
let i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: nul... | javascript | function normalizeProps (options, vm) {
const props = options.props;
if (!props) return
const res = {};
let i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: nul... | [
"function",
"normalizeProps",
"(",
"options",
",",
"vm",
")",
"{",
"const",
"props",
"=",
"options",
".",
"props",
";",
"if",
"(",
"!",
"props",
")",
"return",
"const",
"res",
"=",
"{",
"}",
";",
"let",
"i",
",",
"val",
",",
"name",
";",
"if",
"(... | Ensure all props option syntax are normalized into the
Object-based format. | [
"Ensure",
"all",
"props",
"option",
"syntax",
"are",
"normalized",
"into",
"the",
"Object",
"-",
"based",
"format",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L1461-L1493 |
8,240 | kaola-fed/megalo | dist/vue.esm.browser.js | assertProp | function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
let type = prop.type;
let valid = !type || type === true;
const expecte... | javascript | function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
let type = prop.type;
let valid = !type || type === true;
const expecte... | [
"function",
"assertProp",
"(",
"prop",
",",
"name",
",",
"value",
",",
"vm",
",",
"absent",
")",
"{",
"if",
"(",
"prop",
".",
"required",
"&&",
"absent",
")",
"{",
"warn",
"(",
"'Missing required prop: \"'",
"+",
"name",
"+",
"'\"'",
",",
"vm",
")",
... | Assert whether a prop is valid. | [
"Assert",
"whether",
"a",
"prop",
"is",
"valid",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L1712-L1759 |
8,241 | kaola-fed/megalo | dist/vue.esm.browser.js | checkKeyCodes | function checkKeyCodes (
eventKeyCode,
key,
builtInKeyCode,
eventKeyName,
builtInKeyName
) {
const mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
return isKeyNotMatch(builtInKeyName, eventKeyName)
} else if (mappedKeyCode) {
... | javascript | function checkKeyCodes (
eventKeyCode,
key,
builtInKeyCode,
eventKeyName,
builtInKeyName
) {
const mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
return isKeyNotMatch(builtInKeyName, eventKeyName)
} else if (mappedKeyCode) {
... | [
"function",
"checkKeyCodes",
"(",
"eventKeyCode",
",",
"key",
",",
"builtInKeyCode",
",",
"eventKeyName",
",",
"builtInKeyName",
")",
"{",
"const",
"mappedKeyCode",
"=",
"config",
".",
"keyCodes",
"[",
"key",
"]",
"||",
"builtInKeyCode",
";",
"if",
"(",
"built... | Runtime helper for checking keyCodes from config.
exposed as Vue.prototype._k
passing in eventKeyName as last argument separately for backwards compat | [
"Runtime",
"helper",
"for",
"checking",
"keyCodes",
"from",
"config",
".",
"exposed",
"as",
"Vue",
".",
"prototype",
".",
"_k",
"passing",
"in",
"eventKeyName",
"as",
"last",
"argument",
"separately",
"for",
"backwards",
"compat"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L2735-L2750 |
8,242 | kaola-fed/megalo | dist/vue.esm.browser.js | markOnce | function markOnce (
tree,
index,
key
) {
markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true);
return tree
} | javascript | function markOnce (
tree,
index,
key
) {
markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true);
return tree
} | [
"function",
"markOnce",
"(",
"tree",
",",
"index",
",",
"key",
")",
"{",
"markStatic",
"(",
"tree",
",",
"`",
"${",
"index",
"}",
"${",
"key",
"?",
"`",
"${",
"key",
"}",
"`",
":",
"`",
"`",
"}",
"`",
",",
"true",
")",
";",
"return",
"tree",
... | Runtime helper for v-once.
Effectively it means marking the node as static with a unique key. | [
"Runtime",
"helper",
"for",
"v",
"-",
"once",
".",
"Effectively",
"it",
"means",
"marking",
"the",
"node",
"as",
"static",
"with",
"a",
"unique",
"key",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L2835-L2842 |
8,243 | kaola-fed/megalo | dist/vue.esm.browser.js | getOuterHTML | function getOuterHTML (el) {
if (el.outerHTML) {
return el.outerHTML
} else {
const container = document.createElement('div');
container.appendChild(el.cloneNode(true));
return container.innerHTML
}
} | javascript | function getOuterHTML (el) {
if (el.outerHTML) {
return el.outerHTML
} else {
const container = document.createElement('div');
container.appendChild(el.cloneNode(true));
return container.innerHTML
}
} | [
"function",
"getOuterHTML",
"(",
"el",
")",
"{",
"if",
"(",
"el",
".",
"outerHTML",
")",
"{",
"return",
"el",
".",
"outerHTML",
"}",
"else",
"{",
"const",
"container",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"container",
".",
"ap... | Get outerHTML of elements, taking care
of SVG elements in IE as well. | [
"Get",
"outerHTML",
"of",
"elements",
"taking",
"care",
"of",
"SVG",
"elements",
"in",
"IE",
"as",
"well",
"."
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L11892-L11900 |
8,244 | kaola-fed/megalo | packages/megalo-template-compiler/build.js | mpify | function mpify (node, options) {
var target = options.target; if ( target === void 0 ) target = 'wechat';
var imports = options.imports; if ( imports === void 0 ) imports = {};
var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {};
var scopeId = option... | javascript | function mpify (node, options) {
var target = options.target; if ( target === void 0 ) target = 'wechat';
var imports = options.imports; if ( imports === void 0 ) imports = {};
var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {};
var scopeId = option... | [
"function",
"mpify",
"(",
"node",
",",
"options",
")",
"{",
"var",
"target",
"=",
"options",
".",
"target",
";",
"if",
"(",
"target",
"===",
"void",
"0",
")",
"target",
"=",
"'wechat'",
";",
"var",
"imports",
"=",
"options",
".",
"imports",
";",
"if"... | walk and modify ast before render function is generated | [
"walk",
"and",
"modify",
"ast",
"before",
"render",
"function",
"is",
"generated"
] | c5d971837c3467430469351084e0df9e4da34c4d | https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/megalo-template-compiler/build.js#L5227-L5246 |
8,245 | apache/cordova-plugin-statusbar | src/windows/StatusBarProxy.js | isSupported | function isSupported() {
// if not checked before, run check
if (_supported === null) {
var viewMan = Windows.UI.ViewManagement;
_supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView);
}
return _supported;
} | javascript | function isSupported() {
// if not checked before, run check
if (_supported === null) {
var viewMan = Windows.UI.ViewManagement;
_supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView);
}
return _supported;
} | [
"function",
"isSupported",
"(",
")",
"{",
"// if not checked before, run check",
"if",
"(",
"_supported",
"===",
"null",
")",
"{",
"var",
"viewMan",
"=",
"Windows",
".",
"UI",
".",
"ViewManagement",
";",
"_supported",
"=",
"(",
"viewMan",
".",
"StatusBar",
"&&... | set to null so we can check first time | [
"set",
"to",
"null",
"so",
"we",
"can",
"check",
"first",
"time"
] | 003fa610307f0d2b68aed2cebdc04a939d77912f | https://github.com/apache/cordova-plugin-statusbar/blob/003fa610307f0d2b68aed2cebdc04a939d77912f/src/windows/StatusBarProxy.js#L25-L32 |
8,246 | aholstenson/miio | lib/devices/gateway.js | generateKey | function generateKey() {
let result = '';
for(let i=0; i<16; i++) {
let idx = Math.floor(Math.random() * CHARS.length);
result += CHARS[idx];
}
return result;
} | javascript | function generateKey() {
let result = '';
for(let i=0; i<16; i++) {
let idx = Math.floor(Math.random() * CHARS.length);
result += CHARS[idx];
}
return result;
} | [
"function",
"generateKey",
"(",
")",
"{",
"let",
"result",
"=",
"''",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"16",
";",
"i",
"++",
")",
"{",
"let",
"idx",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
... | Generate a key for use with the local developer API. This does not generate
a secure key, but the Mi Home app does not seem to do that either. | [
"Generate",
"a",
"key",
"for",
"use",
"with",
"the",
"local",
"developer",
"API",
".",
"This",
"does",
"not",
"generate",
"a",
"secure",
"key",
"but",
"the",
"Mi",
"Home",
"app",
"does",
"not",
"seem",
"to",
"do",
"that",
"either",
"."
] | dbd66fd9c6ebe7a206eb202624c268a1d77424d0 | https://github.com/aholstenson/miio/blob/dbd66fd9c6ebe7a206eb202624c268a1d77424d0/lib/devices/gateway.js#L20-L27 |
8,247 | aholstenson/miio | lib/devices/capabilities/sensor.js | mixin | function mixin(device, options) {
if(device.capabilities.indexOf('sensor') < 0) {
device.capabilities.push('sensor');
}
device.capabilities.push(options.name);
Object.defineProperty(device, options.name, {
get: function() {
return this.property(options.name);
}
});
} | javascript | function mixin(device, options) {
if(device.capabilities.indexOf('sensor') < 0) {
device.capabilities.push('sensor');
}
device.capabilities.push(options.name);
Object.defineProperty(device, options.name, {
get: function() {
return this.property(options.name);
}
});
} | [
"function",
"mixin",
"(",
"device",
",",
"options",
")",
"{",
"if",
"(",
"device",
".",
"capabilities",
".",
"indexOf",
"(",
"'sensor'",
")",
"<",
"0",
")",
"{",
"device",
".",
"capabilities",
".",
"push",
"(",
"'sensor'",
")",
";",
"}",
"device",
".... | Setup sensor support for a device. | [
"Setup",
"sensor",
"support",
"for",
"a",
"device",
"."
] | dbd66fd9c6ebe7a206eb202624c268a1d77424d0 | https://github.com/aholstenson/miio/blob/dbd66fd9c6ebe7a206eb202624c268a1d77424d0/lib/devices/capabilities/sensor.js#L37-L48 |
8,248 | bpmn-io/diagram-js | lib/features/grid-snapping/GridSnapping.js | getSnapOffset | function getSnapOffset(event, axis) {
var context = event.context,
shape = event.shape,
gridSnappingContext = context.gridSnappingContext || {},
snapLocation = gridSnappingContext.snapLocation;
if (!shape || !snapLocation) {
return 0;
}
if (axis === 'x') {
if (/left/.test(... | javascript | function getSnapOffset(event, axis) {
var context = event.context,
shape = event.shape,
gridSnappingContext = context.gridSnappingContext || {},
snapLocation = gridSnappingContext.snapLocation;
if (!shape || !snapLocation) {
return 0;
}
if (axis === 'x') {
if (/left/.test(... | [
"function",
"getSnapOffset",
"(",
"event",
",",
"axis",
")",
"{",
"var",
"context",
"=",
"event",
".",
"context",
",",
"shape",
"=",
"event",
".",
"shape",
",",
"gridSnappingContext",
"=",
"context",
".",
"gridSnappingContext",
"||",
"{",
"}",
",",
"snapLo... | Get snap offset assuming that event is at center of shape.
@param {Object} event
@param {string} axis
@returns {number} | [
"Get",
"snap",
"offset",
"assuming",
"that",
"event",
"is",
"at",
"center",
"of",
"shape",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/grid-snapping/GridSnapping.js#L253-L282 |
8,249 | bpmn-io/diagram-js | lib/features/attach-support/AttachSupport.js | removeAttached | function removeAttached(elements) {
var ids = groupBy(elements, 'id');
return filter(elements, function(element) {
while (element) {
// host in selection
if (element.host && ids[element.host.id]) {
return false;
}
element = element.parent;
}
return true;
});
} | javascript | function removeAttached(elements) {
var ids = groupBy(elements, 'id');
return filter(elements, function(element) {
while (element) {
// host in selection
if (element.host && ids[element.host.id]) {
return false;
}
element = element.parent;
}
return true;
});
} | [
"function",
"removeAttached",
"(",
"elements",
")",
"{",
"var",
"ids",
"=",
"groupBy",
"(",
"elements",
",",
"'id'",
")",
";",
"return",
"filter",
"(",
"elements",
",",
"function",
"(",
"element",
")",
"{",
"while",
"(",
"element",
")",
"{",
"// host in ... | Return a filtered list of elements that do not
contain attached elements with hosts being part
of the selection.
@param {Array<djs.model.Base>} elements
@return {Array<djs.model.Base>} filtered | [
"Return",
"a",
"filtered",
"list",
"of",
"elements",
"that",
"do",
"not",
"contain",
"attached",
"elements",
"with",
"hosts",
"being",
"part",
"of",
"the",
"selection",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/attach-support/AttachSupport.js#L309-L326 |
8,250 | bpmn-io/diagram-js | lib/features/move/Move.js | start | function start(event, element, activate, context) {
if (isObject(activate)) {
context = activate;
activate = false;
}
// do not move connections or the root element
if (element.waypoints || !element.parent) {
return;
}
var referencePoint = mid(element);
dragging.init(eve... | javascript | function start(event, element, activate, context) {
if (isObject(activate)) {
context = activate;
activate = false;
}
// do not move connections or the root element
if (element.waypoints || !element.parent) {
return;
}
var referencePoint = mid(element);
dragging.init(eve... | [
"function",
"start",
"(",
"event",
",",
"element",
",",
"activate",
",",
"context",
")",
"{",
"if",
"(",
"isObject",
"(",
"activate",
")",
")",
"{",
"context",
"=",
"activate",
";",
"activate",
"=",
"false",
";",
"}",
"// do not move connections or the root ... | Start move.
@param {MouseEvent} event
@param {djs.model.Shape} shape
@param {boolean} [activate]
@param {Object} [context] | [
"Start",
"move",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/Move.js#L180-L204 |
8,251 | bpmn-io/diagram-js | lib/features/move/Move.js | removeNested | function removeNested(elements) {
var ids = groupBy(elements, 'id');
return filter(elements, function(element) {
while ((element = element.parent)) {
// parent in selection
if (ids[element.id]) {
return false;
}
}
return true;
});
} | javascript | function removeNested(elements) {
var ids = groupBy(elements, 'id');
return filter(elements, function(element) {
while ((element = element.parent)) {
// parent in selection
if (ids[element.id]) {
return false;
}
}
return true;
});
} | [
"function",
"removeNested",
"(",
"elements",
")",
"{",
"var",
"ids",
"=",
"groupBy",
"(",
"elements",
",",
"'id'",
")",
";",
"return",
"filter",
"(",
"elements",
",",
"function",
"(",
"element",
")",
"{",
"while",
"(",
"(",
"element",
"=",
"element",
"... | Return a filtered list of elements that do not contain
those nested into others.
@param {Array<djs.model.Base>} elements
@return {Array<djs.model.Base>} filtered | [
"Return",
"a",
"filtered",
"list",
"of",
"elements",
"that",
"do",
"not",
"contain",
"those",
"nested",
"into",
"others",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/Move.js#L228-L243 |
8,252 | bpmn-io/diagram-js | lib/features/move/MovePreview.js | setMarker | function setMarker(element, marker) {
[ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {
if (m === marker) {
canvas.addMarker(element, m);
} else {
canvas.removeMarker(element, m);
}
});
} | javascript | function setMarker(element, marker) {
[ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {
if (m === marker) {
canvas.addMarker(element, m);
} else {
canvas.removeMarker(element, m);
}
});
} | [
"function",
"setMarker",
"(",
"element",
",",
"marker",
")",
"{",
"[",
"MARKER_ATTACH",
",",
"MARKER_OK",
",",
"MARKER_NOT_OK",
",",
"MARKER_NEW_PARENT",
"]",
".",
"forEach",
"(",
"function",
"(",
"m",
")",
"{",
"if",
"(",
"m",
"===",
"marker",
")",
"{",... | Sets drop marker on an element. | [
"Sets",
"drop",
"marker",
"on",
"an",
"element",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/MovePreview.js#L66-L76 |
8,253 | bpmn-io/diagram-js | lib/features/move/MovePreview.js | makeDraggable | function makeDraggable(context, element, addMarker) {
previewSupport.addDragger(element, context.dragGroup);
if (addMarker) {
canvas.addMarker(element, MARKER_DRAGGING);
}
if (context.allDraggedElements) {
context.allDraggedElements.push(element);
} else {
context.allDraggedElem... | javascript | function makeDraggable(context, element, addMarker) {
previewSupport.addDragger(element, context.dragGroup);
if (addMarker) {
canvas.addMarker(element, MARKER_DRAGGING);
}
if (context.allDraggedElements) {
context.allDraggedElements.push(element);
} else {
context.allDraggedElem... | [
"function",
"makeDraggable",
"(",
"context",
",",
"element",
",",
"addMarker",
")",
"{",
"previewSupport",
".",
"addDragger",
"(",
"element",
",",
"context",
".",
"dragGroup",
")",
";",
"if",
"(",
"addMarker",
")",
"{",
"canvas",
".",
"addMarker",
"(",
"el... | Make an element draggable.
@param {Object} context
@param {djs.model.Base} element
@param {Boolean} addMarker | [
"Make",
"an",
"element",
"draggable",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/MovePreview.js#L85-L98 |
8,254 | bpmn-io/diagram-js | lib/features/search-pad/SearchPad.js | constructOverlay | function constructOverlay(box) {
var offset = 6;
var w = box.width + offset * 2;
var h = box.height + offset * 2;
var styles = [
'width: '+ w +'px',
'height: '+ h + 'px'
].join('; ');
return {
position: {
bottom: h - offset,
right: w - offset
},
show: true,
html: '<div... | javascript | function constructOverlay(box) {
var offset = 6;
var w = box.width + offset * 2;
var h = box.height + offset * 2;
var styles = [
'width: '+ w +'px',
'height: '+ h + 'px'
].join('; ');
return {
position: {
bottom: h - offset,
right: w - offset
},
show: true,
html: '<div... | [
"function",
"constructOverlay",
"(",
"box",
")",
"{",
"var",
"offset",
"=",
"6",
";",
"var",
"w",
"=",
"box",
".",
"width",
"+",
"offset",
"*",
"2",
";",
"var",
"h",
"=",
"box",
".",
"height",
"+",
"offset",
"*",
"2",
";",
"var",
"styles",
"=",
... | Construct overlay object for the given bounding box.
@param {BoundingBox} box
@return {Object} | [
"Construct",
"overlay",
"object",
"for",
"the",
"given",
"bounding",
"box",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L462-L481 |
8,255 | bpmn-io/diagram-js | lib/features/search-pad/SearchPad.js | createInnerTextNode | function createInnerTextNode(parentNode, tokens, template) {
var text = createHtmlText(tokens);
var childNode = domify(template);
childNode.innerHTML = text;
parentNode.appendChild(childNode);
} | javascript | function createInnerTextNode(parentNode, tokens, template) {
var text = createHtmlText(tokens);
var childNode = domify(template);
childNode.innerHTML = text;
parentNode.appendChild(childNode);
} | [
"function",
"createInnerTextNode",
"(",
"parentNode",
",",
"tokens",
",",
"template",
")",
"{",
"var",
"text",
"=",
"createHtmlText",
"(",
"tokens",
")",
";",
"var",
"childNode",
"=",
"domify",
"(",
"template",
")",
";",
"childNode",
".",
"innerHTML",
"=",
... | Creates and appends child node from result tokens and HTML template.
@param {Element} node
@param {Array<Object>} tokens
@param {String} template | [
"Creates",
"and",
"appends",
"child",
"node",
"from",
"result",
"tokens",
"and",
"HTML",
"template",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L491-L496 |
8,256 | bpmn-io/diagram-js | lib/features/search-pad/SearchPad.js | createHtmlText | function createHtmlText(tokens) {
var htmlText = '';
tokens.forEach(function(t) {
if (t.matched) {
htmlText += '<strong class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + t.matched + '</strong>';
} else {
htmlText += t.normal;
}
});
return htmlText !== '' ? htmlText : null;
} | javascript | function createHtmlText(tokens) {
var htmlText = '';
tokens.forEach(function(t) {
if (t.matched) {
htmlText += '<strong class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + t.matched + '</strong>';
} else {
htmlText += t.normal;
}
});
return htmlText !== '' ? htmlText : null;
} | [
"function",
"createHtmlText",
"(",
"tokens",
")",
"{",
"var",
"htmlText",
"=",
"''",
";",
"tokens",
".",
"forEach",
"(",
"function",
"(",
"t",
")",
"{",
"if",
"(",
"t",
".",
"matched",
")",
"{",
"htmlText",
"+=",
"'<strong class=\"'",
"+",
"SearchPad",
... | Create internal HTML markup from result tokens.
Caters for highlighting pattern matched tokens.
@param {Array<Object>} tokens
@return {String} | [
"Create",
"internal",
"HTML",
"markup",
"from",
"result",
"tokens",
".",
"Caters",
"for",
"highlighting",
"pattern",
"matched",
"tokens",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L505-L517 |
8,257 | bpmn-io/diagram-js | lib/util/Text.js | layoutNext | function layoutNext(lines, maxWidth, fakeText) {
var originalLine = lines.shift(),
fitLine = originalLine;
var textBBox;
for (;;) {
textBBox = getTextBBox(fitLine, fakeText);
textBBox.width = fitLine ? textBBox.width : 0;
// try to fit
if (fitLine === ' ' || fitLine === '' || textBBox.w... | javascript | function layoutNext(lines, maxWidth, fakeText) {
var originalLine = lines.shift(),
fitLine = originalLine;
var textBBox;
for (;;) {
textBBox = getTextBBox(fitLine, fakeText);
textBBox.width = fitLine ? textBBox.width : 0;
// try to fit
if (fitLine === ' ' || fitLine === '' || textBBox.w... | [
"function",
"layoutNext",
"(",
"lines",
",",
"maxWidth",
",",
"fakeText",
")",
"{",
"var",
"originalLine",
"=",
"lines",
".",
"shift",
"(",
")",
",",
"fitLine",
"=",
"originalLine",
";",
"var",
"textBBox",
";",
"for",
"(",
";",
";",
")",
"{",
"textBBox... | Layout the next line and return the layouted element.
Alters the lines passed.
@param {Array<String>} lines
@return {Object} the line descriptor, an object { width, height, text } | [
"Layout",
"the",
"next",
"line",
"and",
"return",
"the",
"layouted",
"element",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/util/Text.js#L90-L109 |
8,258 | bpmn-io/diagram-js | lib/util/Text.js | semanticShorten | function semanticShorten(line, maxLength) {
var parts = line.split(/(\s|-)/g),
part,
shortenedParts = [],
length = 0;
// try to shorten via spaces + hyphens
if (parts.length > 1) {
while ((part = parts.shift())) {
if (part.length + length < maxLength) {
shortenedParts.push(par... | javascript | function semanticShorten(line, maxLength) {
var parts = line.split(/(\s|-)/g),
part,
shortenedParts = [],
length = 0;
// try to shorten via spaces + hyphens
if (parts.length > 1) {
while ((part = parts.shift())) {
if (part.length + length < maxLength) {
shortenedParts.push(par... | [
"function",
"semanticShorten",
"(",
"line",
",",
"maxLength",
")",
"{",
"var",
"parts",
"=",
"line",
".",
"split",
"(",
"/",
"(\\s|-)",
"/",
"g",
")",
",",
"part",
",",
"shortenedParts",
"=",
"[",
"]",
",",
"length",
"=",
"0",
";",
"// try to shorten v... | Shortens a line based on spacing and hyphens.
Returns the shortened result on success.
@param {String} line
@param {Number} maxLength the maximum characters of the string
@return {String} the shortened string | [
"Shortens",
"a",
"line",
"based",
"on",
"spacing",
"and",
"hyphens",
".",
"Returns",
"the",
"shortened",
"result",
"on",
"success",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/util/Text.js#L134-L158 |
8,259 | bpmn-io/diagram-js | lib/layout/ManhattanLayout.js | getSimpleBendpoints | function getSimpleBendpoints(a, b, directions) {
var xmid = round((b.x - a.x) / 2 + a.x),
ymid = round((b.y - a.y) / 2 + a.y);
// one point, right or left from a
if (directions === 'h:v') {
return [ { x: b.x, y: a.y } ];
}
// one point, above or below a
if (directions === 'v:h') {
return [ ... | javascript | function getSimpleBendpoints(a, b, directions) {
var xmid = round((b.x - a.x) / 2 + a.x),
ymid = round((b.y - a.y) / 2 + a.y);
// one point, right or left from a
if (directions === 'h:v') {
return [ { x: b.x, y: a.y } ];
}
// one point, above or below a
if (directions === 'v:h') {
return [ ... | [
"function",
"getSimpleBendpoints",
"(",
"a",
",",
"b",
",",
"directions",
")",
"{",
"var",
"xmid",
"=",
"round",
"(",
"(",
"b",
".",
"x",
"-",
"a",
".",
"x",
")",
"/",
"2",
"+",
"a",
".",
"x",
")",
",",
"ymid",
"=",
"round",
"(",
"(",
"b",
... | Handle simple layouts with maximum two bendpoints. | [
"Handle",
"simple",
"layouts",
"with",
"maximum",
"two",
"bendpoints",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L161-L193 |
8,260 | bpmn-io/diagram-js | lib/layout/ManhattanLayout.js | getBendpoints | function getBendpoints(a, b, directions) {
directions = directions || 'h:h';
if (!isValidDirections(directions)) {
throw new Error(
'unknown directions: <' + directions + '>: ' +
'must be specified as <start>:<end> ' +
'with start/end in { h,v,t,r,b,l }'
);
}
// compute explicit dire... | javascript | function getBendpoints(a, b, directions) {
directions = directions || 'h:h';
if (!isValidDirections(directions)) {
throw new Error(
'unknown directions: <' + directions + '>: ' +
'must be specified as <start>:<end> ' +
'with start/end in { h,v,t,r,b,l }'
);
}
// compute explicit dire... | [
"function",
"getBendpoints",
"(",
"a",
",",
"b",
",",
"directions",
")",
"{",
"directions",
"=",
"directions",
"||",
"'h:h'",
";",
"if",
"(",
"!",
"isValidDirections",
"(",
"directions",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'unknown directions: <'",... | Returns the mid points for a manhattan connection between two points.
@example h:h (horizontal:horizontal)
[a]----[x]
|
[x]----[b]
@example h:v (horizontal:vertical)
[a]----[x]
|
[b]
@example h:r (horizontal:right)
[a]----[x]
|
[b]-[x]
@param {Point} a
@param {Point} b
@param {String} directions
@return {Arr... | [
"Returns",
"the",
"mid",
"points",
"for",
"a",
"manhattan",
"connection",
"between",
"two",
"points",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L223-L250 |
8,261 | bpmn-io/diagram-js | lib/layout/ManhattanLayout.js | tryRepairConnectionStart | function tryRepairConnectionStart(moved, other, newDocking, points) {
return _tryRepairConnectionSide(moved, other, newDocking, points);
} | javascript | function tryRepairConnectionStart(moved, other, newDocking, points) {
return _tryRepairConnectionSide(moved, other, newDocking, points);
} | [
"function",
"tryRepairConnectionStart",
"(",
"moved",
",",
"other",
",",
"newDocking",
",",
"points",
")",
"{",
"return",
"_tryRepairConnectionSide",
"(",
"moved",
",",
"other",
",",
"newDocking",
",",
"points",
")",
";",
"}"
] | Repair a connection from start.
@param {Bounds} moved
@param {Bounds} other
@param {Point} newDocking
@param {Array<Point>} points originalPoints from moved to other
@return {Array<Point>|null} the repaired points between the two rectangles | [
"Repair",
"a",
"connection",
"from",
"start",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L488-L490 |
8,262 | bpmn-io/diagram-js | lib/layout/ManhattanLayout.js | tryRepairConnectionEnd | function tryRepairConnectionEnd(moved, other, newDocking, points) {
var waypoints = points.slice().reverse();
waypoints = _tryRepairConnectionSide(moved, other, newDocking, waypoints);
return waypoints ? waypoints.reverse() : null;
} | javascript | function tryRepairConnectionEnd(moved, other, newDocking, points) {
var waypoints = points.slice().reverse();
waypoints = _tryRepairConnectionSide(moved, other, newDocking, waypoints);
return waypoints ? waypoints.reverse() : null;
} | [
"function",
"tryRepairConnectionEnd",
"(",
"moved",
",",
"other",
",",
"newDocking",
",",
"points",
")",
"{",
"var",
"waypoints",
"=",
"points",
".",
"slice",
"(",
")",
".",
"reverse",
"(",
")",
";",
"waypoints",
"=",
"_tryRepairConnectionSide",
"(",
"moved"... | Repair a connection from end.
@param {Bounds} moved
@param {Bounds} other
@param {Point} newDocking
@param {Array<Point>} points originalPoints from moved to other
@return {Array<Point>|null} the repaired points between the two rectangles | [
"Repair",
"a",
"connection",
"from",
"end",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L502-L508 |
8,263 | bpmn-io/diagram-js | lib/layout/ManhattanLayout.js | _tryRepairConnectionSide | function _tryRepairConnectionSide(moved, other, newDocking, points) {
function needsRelayout(moved, other, points) {
if (points.length < 3) {
return true;
}
if (points.length > 4) {
return false;
}
// relayout if two points overlap
// this is most likely due to
return !!fin... | javascript | function _tryRepairConnectionSide(moved, other, newDocking, points) {
function needsRelayout(moved, other, points) {
if (points.length < 3) {
return true;
}
if (points.length > 4) {
return false;
}
// relayout if two points overlap
// this is most likely due to
return !!fin... | [
"function",
"_tryRepairConnectionSide",
"(",
"moved",
",",
"other",
",",
"newDocking",
",",
"points",
")",
"{",
"function",
"needsRelayout",
"(",
"moved",
",",
"other",
",",
"points",
")",
"{",
"if",
"(",
"points",
".",
"length",
"<",
"3",
")",
"{",
"ret... | Repair a connection from one side that moved.
@param {Bounds} moved
@param {Bounds} other
@param {Point} newDocking
@param {Array<Point>} points originalPoints from moved to other
@return {Array<Point>} the repaired points between the two rectangles | [
"Repair",
"a",
"connection",
"from",
"one",
"side",
"that",
"moved",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L520-L604 |
8,264 | bpmn-io/diagram-js | lib/core/Canvas.js | createContainer | function createContainer(options) {
options = assign({}, { width: '100%', height: '100%' }, options);
var container = options.container || document.body;
// create a <div> around the svg element with the respective size
// this way we can always get the correct container size
// (this is impossible for <sv... | javascript | function createContainer(options) {
options = assign({}, { width: '100%', height: '100%' }, options);
var container = options.container || document.body;
// create a <div> around the svg element with the respective size
// this way we can always get the correct container size
// (this is impossible for <sv... | [
"function",
"createContainer",
"(",
"options",
")",
"{",
"options",
"=",
"assign",
"(",
"{",
"}",
",",
"{",
"width",
":",
"'100%'",
",",
"height",
":",
"'100%'",
"}",
",",
"options",
")",
";",
"var",
"container",
"=",
"options",
".",
"container",
"||",... | Creates a HTML container element for a SVG element with
the given configuration
@param {Object} options
@return {HTMLElement} the container element | [
"Creates",
"a",
"HTML",
"container",
"element",
"for",
"a",
"SVG",
"element",
"with",
"the",
"given",
"configuration"
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/core/Canvas.js#L46-L68 |
8,265 | bpmn-io/diagram-js | lib/features/resize/Resize.js | handleMove | function handleMove(context, delta) {
var shape = context.shape,
direction = context.direction,
resizeConstraints = context.resizeConstraints,
newBounds;
context.delta = delta;
newBounds = resizeBounds(shape, direction, delta);
// ensure constraints during resize
context.... | javascript | function handleMove(context, delta) {
var shape = context.shape,
direction = context.direction,
resizeConstraints = context.resizeConstraints,
newBounds;
context.delta = delta;
newBounds = resizeBounds(shape, direction, delta);
// ensure constraints during resize
context.... | [
"function",
"handleMove",
"(",
"context",
",",
"delta",
")",
"{",
"var",
"shape",
"=",
"context",
".",
"shape",
",",
"direction",
"=",
"context",
".",
"direction",
",",
"resizeConstraints",
"=",
"context",
".",
"resizeConstraints",
",",
"newBounds",
";",
"co... | Handle resize move by specified delta.
@param {Object} context
@param {Point} delta | [
"Handle",
"resize",
"move",
"by",
"specified",
"delta",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L72-L88 |
8,266 | bpmn-io/diagram-js | lib/features/resize/Resize.js | handleStart | function handleStart(context) {
var resizeConstraints = context.resizeConstraints,
// evaluate minBounds for backwards compatibility
minBounds = context.minBounds;
if (resizeConstraints !== undefined) {
return;
}
if (minBounds === undefined) {
minBounds = self.computeMinRe... | javascript | function handleStart(context) {
var resizeConstraints = context.resizeConstraints,
// evaluate minBounds for backwards compatibility
minBounds = context.minBounds;
if (resizeConstraints !== undefined) {
return;
}
if (minBounds === undefined) {
minBounds = self.computeMinRe... | [
"function",
"handleStart",
"(",
"context",
")",
"{",
"var",
"resizeConstraints",
"=",
"context",
".",
"resizeConstraints",
",",
"// evaluate minBounds for backwards compatibility",
"minBounds",
"=",
"context",
".",
"minBounds",
";",
"if",
"(",
"resizeConstraints",
"!=="... | Handle resize start.
@param {Object} context | [
"Handle",
"resize",
"start",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L95-L112 |
8,267 | bpmn-io/diagram-js | lib/features/resize/Resize.js | handleEnd | function handleEnd(context) {
var shape = context.shape,
canExecute = context.canExecute,
newBounds = context.newBounds;
if (canExecute) {
// ensure we have actual pixel values for new bounds
// (important when zoom level was > 1 during move)
newBounds = roundBounds(newBounds)... | javascript | function handleEnd(context) {
var shape = context.shape,
canExecute = context.canExecute,
newBounds = context.newBounds;
if (canExecute) {
// ensure we have actual pixel values for new bounds
// (important when zoom level was > 1 during move)
newBounds = roundBounds(newBounds)... | [
"function",
"handleEnd",
"(",
"context",
")",
"{",
"var",
"shape",
"=",
"context",
".",
"shape",
",",
"canExecute",
"=",
"context",
".",
"canExecute",
",",
"newBounds",
"=",
"context",
".",
"newBounds",
";",
"if",
"(",
"canExecute",
")",
"{",
"// ensure we... | Handle resize end.
@param {Object} context | [
"Handle",
"resize",
"end",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L119-L132 |
8,268 | bpmn-io/diagram-js | lib/Diagram.js | bootstrap | function bootstrap(bootstrapModules) {
var modules = [],
components = [];
function hasModule(m) {
return modules.indexOf(m) >= 0;
}
function addModule(m) {
modules.push(m);
}
function visit(m) {
if (hasModule(m)) {
return;
}
(m.__depends__ || []).forEach(visit);
if ... | javascript | function bootstrap(bootstrapModules) {
var modules = [],
components = [];
function hasModule(m) {
return modules.indexOf(m) >= 0;
}
function addModule(m) {
modules.push(m);
}
function visit(m) {
if (hasModule(m)) {
return;
}
(m.__depends__ || []).forEach(visit);
if ... | [
"function",
"bootstrap",
"(",
"bootstrapModules",
")",
"{",
"var",
"modules",
"=",
"[",
"]",
",",
"components",
"=",
"[",
"]",
";",
"function",
"hasModule",
"(",
"m",
")",
"{",
"return",
"modules",
".",
"indexOf",
"(",
"m",
")",
">=",
"0",
";",
"}",
... | Bootstrap an injector from a list of modules, instantiating a number of default components
@ignore
@param {Array<didi.Module>} bootstrapModules
@return {didi.Injector} a injector to use to access the components | [
"Bootstrap",
"an",
"injector",
"from",
"a",
"list",
"of",
"modules",
"instantiating",
"a",
"number",
"of",
"default",
"components"
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/Diagram.js#L14-L63 |
8,269 | bpmn-io/diagram-js | lib/Diagram.js | createInjector | function createInjector(options) {
options = options || {};
var configModule = {
'config': ['value', options]
};
var modules = [ configModule, CoreModule ].concat(options.modules || []);
return bootstrap(modules);
} | javascript | function createInjector(options) {
options = options || {};
var configModule = {
'config': ['value', options]
};
var modules = [ configModule, CoreModule ].concat(options.modules || []);
return bootstrap(modules);
} | [
"function",
"createInjector",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"configModule",
"=",
"{",
"'config'",
":",
"[",
"'value'",
",",
"options",
"]",
"}",
";",
"var",
"modules",
"=",
"[",
"configModule",
",",
"C... | Creates an injector from passed options.
@ignore
@param {Object} options
@return {didi.Injector} | [
"Creates",
"an",
"injector",
"from",
"passed",
"options",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/Diagram.js#L72-L83 |
8,270 | bpmn-io/diagram-js | lib/features/dragging/Dragging.js | trapClickAndEnd | function trapClickAndEnd(event) {
var untrap;
// trap the click in case we are part of an active
// drag operation. This will effectively prevent
// the ghost click that cannot be canceled otherwise.
if (context.active) {
untrap = installClickTrap(eventBus);
// remove trap after mini... | javascript | function trapClickAndEnd(event) {
var untrap;
// trap the click in case we are part of an active
// drag operation. This will effectively prevent
// the ghost click that cannot be canceled otherwise.
if (context.active) {
untrap = installClickTrap(eventBus);
// remove trap after mini... | [
"function",
"trapClickAndEnd",
"(",
"event",
")",
"{",
"var",
"untrap",
";",
"// trap the click in case we are part of an active",
"// drag operation. This will effectively prevent",
"// the ghost click that cannot be canceled otherwise.",
"if",
"(",
"context",
".",
"active",
")",
... | prevent ghost click that might occur after a finished drag and drop session | [
"prevent",
"ghost",
"click",
"that",
"might",
"occur",
"after",
"a",
"finished",
"drag",
"and",
"drop",
"session"
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L289-L308 |
8,271 | bpmn-io/diagram-js | lib/features/dragging/Dragging.js | cancel | function cancel(restore) {
var previousContext;
if (!context) {
return;
}
var wasActive = context.active;
if (wasActive) {
fire('cancel');
}
previousContext = cleanup(restore);
if (wasActive) {
// last event to be fired when all drag operations are done
// at... | javascript | function cancel(restore) {
var previousContext;
if (!context) {
return;
}
var wasActive = context.active;
if (wasActive) {
fire('cancel');
}
previousContext = cleanup(restore);
if (wasActive) {
// last event to be fired when all drag operations are done
// at... | [
"function",
"cancel",
"(",
"restore",
")",
"{",
"var",
"previousContext",
";",
"if",
"(",
"!",
"context",
")",
"{",
"return",
";",
"}",
"var",
"wasActive",
"=",
"context",
".",
"active",
";",
"if",
"(",
"wasActive",
")",
"{",
"fire",
"(",
"'cancel'",
... | life-cycle methods | [
"life",
"-",
"cycle",
"methods"
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L339-L359 |
8,272 | bpmn-io/diagram-js | lib/features/dragging/Dragging.js | init | function init(event, relativeTo, prefix, options) {
// only one drag operation may be active, at a time
if (context) {
cancel(false);
}
if (typeof relativeTo === 'string') {
options = prefix;
prefix = relativeTo;
relativeTo = null;
}
options = assign({}, defaultOptions... | javascript | function init(event, relativeTo, prefix, options) {
// only one drag operation may be active, at a time
if (context) {
cancel(false);
}
if (typeof relativeTo === 'string') {
options = prefix;
prefix = relativeTo;
relativeTo = null;
}
options = assign({}, defaultOptions... | [
"function",
"init",
"(",
"event",
",",
"relativeTo",
",",
"prefix",
",",
"options",
")",
"{",
"// only one drag operation may be active, at a time",
"if",
"(",
"context",
")",
"{",
"cancel",
"(",
"false",
")",
";",
"}",
"if",
"(",
"typeof",
"relativeTo",
"==="... | Initialize a drag operation.
If `localPosition` is given, drag events will be emitted
relative to it.
@param {MouseEvent|TouchEvent} [event]
@param {Point} [localPosition] actual diagram local position this drag operation should start at
@param {String} prefix
@param {Object} [options] | [
"Initialize",
"a",
"drag",
"operation",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L423-L518 |
8,273 | bpmn-io/diagram-js | lib/features/bendpoints/ConnectionSegmentMove.js | getDocking | function getDocking(point, referenceElement, moveAxis) {
var referenceMid,
inverseAxis;
if (point.original) {
return point.original;
} else {
referenceMid = getMid(referenceElement);
inverseAxis = flipAxis(moveAxis);
return axisSet(point, inverseAxis, referenceMid[inverseAxis]);
}
} | javascript | function getDocking(point, referenceElement, moveAxis) {
var referenceMid,
inverseAxis;
if (point.original) {
return point.original;
} else {
referenceMid = getMid(referenceElement);
inverseAxis = flipAxis(moveAxis);
return axisSet(point, inverseAxis, referenceMid[inverseAxis]);
}
} | [
"function",
"getDocking",
"(",
"point",
",",
"referenceElement",
",",
"moveAxis",
")",
"{",
"var",
"referenceMid",
",",
"inverseAxis",
";",
"if",
"(",
"point",
".",
"original",
")",
"{",
"return",
"point",
".",
"original",
";",
"}",
"else",
"{",
"reference... | Get the docking point on the given element.
Compute a reasonable docking, if non exists.
@param {Point} point
@param {djs.model.Shape} referenceElement
@param {String} moveAxis (x|y)
@return {Point} | [
"Get",
"the",
"docking",
"point",
"on",
"the",
"given",
"element",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/bendpoints/ConnectionSegmentMove.js#L66-L79 |
8,274 | bpmn-io/diagram-js | lib/features/bendpoints/ConnectionSegmentMove.js | cropConnection | function cropConnection(connection, newWaypoints) {
// crop connection, if docking service is provided only
if (!connectionDocking) {
return newWaypoints;
}
var oldWaypoints = connection.waypoints,
croppedWaypoints;
// temporary set new waypoints
connection.waypoints = newWaypoi... | javascript | function cropConnection(connection, newWaypoints) {
// crop connection, if docking service is provided only
if (!connectionDocking) {
return newWaypoints;
}
var oldWaypoints = connection.waypoints,
croppedWaypoints;
// temporary set new waypoints
connection.waypoints = newWaypoi... | [
"function",
"cropConnection",
"(",
"connection",
",",
"newWaypoints",
")",
"{",
"// crop connection, if docking service is provided only",
"if",
"(",
"!",
"connectionDocking",
")",
"{",
"return",
"newWaypoints",
";",
"}",
"var",
"oldWaypoints",
"=",
"connection",
".",
... | Crop connection if connection cropping is provided.
@param {Connection} connection
@param {Array<Point>} newWaypoints
@return {Array<Point>} cropped connection waypoints | [
"Crop",
"connection",
"if",
"connection",
"cropping",
"is",
"provided",
"."
] | fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde | https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/bendpoints/ConnectionSegmentMove.js#L155-L174 |
8,275 | Akryum/v-tooltip | dist/v-tooltip.esm.js | addClasses | function addClasses(el, classes) {
var newClasses = convertToArray(classes);
var classList;
if (el.className instanceof SVGAnimatedString) {
classList = convertToArray(el.className.baseVal);
} else {
classList = convertToArray(el.className);
}
newClasses.forEach(function (newClass) {
if (class... | javascript | function addClasses(el, classes) {
var newClasses = convertToArray(classes);
var classList;
if (el.className instanceof SVGAnimatedString) {
classList = convertToArray(el.className.baseVal);
} else {
classList = convertToArray(el.className);
}
newClasses.forEach(function (newClass) {
if (class... | [
"function",
"addClasses",
"(",
"el",
",",
"classes",
")",
"{",
"var",
"newClasses",
"=",
"convertToArray",
"(",
"classes",
")",
";",
"var",
"classList",
";",
"if",
"(",
"el",
".",
"className",
"instanceof",
"SVGAnimatedString",
")",
"{",
"classList",
"=",
... | Add classes to an element.
This method checks to ensure that the classes don't already exist before adding them.
It uses el.className rather than classList in order to be IE friendly.
@param {object} el - The element to add the classes to.
@param {classes} string - List of space separated classes to be added to the ele... | [
"Add",
"classes",
"to",
"an",
"element",
".",
"This",
"method",
"checks",
"to",
"ensure",
"that",
"the",
"classes",
"don",
"t",
"already",
"exist",
"before",
"adding",
"them",
".",
"It",
"uses",
"el",
".",
"className",
"rather",
"than",
"classList",
"in",
... | d60513c64c266f0c1e926e2e583a5733819138bd | https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L95-L116 |
8,276 | Akryum/v-tooltip | dist/v-tooltip.esm.js | removeClasses | function removeClasses(el, classes) {
var newClasses = convertToArray(classes);
var classList;
if (el.className instanceof SVGAnimatedString) {
classList = convertToArray(el.className.baseVal);
} else {
classList = convertToArray(el.className);
}
newClasses.forEach(function (newClass) {
var in... | javascript | function removeClasses(el, classes) {
var newClasses = convertToArray(classes);
var classList;
if (el.className instanceof SVGAnimatedString) {
classList = convertToArray(el.className.baseVal);
} else {
classList = convertToArray(el.className);
}
newClasses.forEach(function (newClass) {
var in... | [
"function",
"removeClasses",
"(",
"el",
",",
"classes",
")",
"{",
"var",
"newClasses",
"=",
"convertToArray",
"(",
"classes",
")",
";",
"var",
"classList",
";",
"if",
"(",
"el",
".",
"className",
"instanceof",
"SVGAnimatedString",
")",
"{",
"classList",
"=",... | Remove classes from an element.
It uses el.className rather than classList in order to be IE friendly.
@export
@param {any} el The element to remove the classes from.
@param {any} classes List of space separated classes to be removed from the element. | [
"Remove",
"classes",
"from",
"an",
"element",
".",
"It",
"uses",
"el",
".",
"className",
"rather",
"than",
"classList",
"in",
"order",
"to",
"be",
"IE",
"friendly",
"."
] | d60513c64c266f0c1e926e2e583a5733819138bd | https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L125-L148 |
8,277 | Akryum/v-tooltip | dist/v-tooltip.esm.js | Tooltip | function Tooltip(_reference, _options) {
var _this = this;
_classCallCheck(this, Tooltip);
_defineProperty(this, "_events", []);
_defineProperty(this, "_setTooltipNodeEvent", function (evt, reference, delay, options) {
var relatedreference = evt.relatedreference || evt.toElement || evt.relatedT... | javascript | function Tooltip(_reference, _options) {
var _this = this;
_classCallCheck(this, Tooltip);
_defineProperty(this, "_events", []);
_defineProperty(this, "_setTooltipNodeEvent", function (evt, reference, delay, options) {
var relatedreference = evt.relatedreference || evt.toElement || evt.relatedT... | [
"function",
"Tooltip",
"(",
"_reference",
",",
"_options",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"_classCallCheck",
"(",
"this",
",",
"Tooltip",
")",
";",
"_defineProperty",
"(",
"this",
",",
"\"_events\"",
",",
"[",
"]",
")",
";",
"_defineProperty",... | Create a new Tooltip.js instance
@class Tooltip
@param {HTMLElement} reference - The DOM node used as reference of the tooltip (it can be a jQuery element).
@param {Object} options
@param {String} options.placement=bottom
Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -... | [
"Create",
"a",
"new",
"Tooltip",
".",
"js",
"instance"
] | d60513c64c266f0c1e926e2e583a5733819138bd | https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L212-L256 |
8,278 | IonicaBizau/scrape-it | lib/index.js | scrapeIt | function scrapeIt (url, opts, cb) {
cb = assured(cb)
req(url, (err, $, res, body) => {
if (err) { return cb(err) }
try {
let scrapedData = scrapeIt.scrapeHTML($, opts)
cb(null, {
data: scrapedData,
$,
response: res,
... | javascript | function scrapeIt (url, opts, cb) {
cb = assured(cb)
req(url, (err, $, res, body) => {
if (err) { return cb(err) }
try {
let scrapedData = scrapeIt.scrapeHTML($, opts)
cb(null, {
data: scrapedData,
$,
response: res,
... | [
"function",
"scrapeIt",
"(",
"url",
",",
"opts",
",",
"cb",
")",
"{",
"cb",
"=",
"assured",
"(",
"cb",
")",
"req",
"(",
"url",
",",
"(",
"err",
",",
"$",
",",
"res",
",",
"body",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"cb",
"... | scrapeIt
A scraping module for humans.
@name scrapeIt
@function
@param {String|Object} url The page url or request options.
@param {Object} opts The options passed to `scrapeHTML` method.
@param {Function} cb The callback function.
@return {Promise} A promise object resolving with:
- `data` (Object): The scraped data... | [
"scrapeIt",
"A",
"scraping",
"module",
"for",
"humans",
"."
] | 596191dfdbd5613ba88a58c9ee5a39f061c5b395 | https://github.com/IonicaBizau/scrape-it/blob/596191dfdbd5613ba88a58c9ee5a39f061c5b395/lib/index.js#L29-L47 |
8,279 | instea/react-native-popup-menu | build/rnpm.js | measure | function measure(ref) {
return new Promise(function (resolve) {
ref.measure(function (x, y, width, height, pageX, pageY) {
resolve({
x: pageX,
y: pageY,
width: width,
height: height
});
});
});
} | javascript | function measure(ref) {
return new Promise(function (resolve) {
ref.measure(function (x, y, width, height, pageX, pageY) {
resolve({
x: pageX,
y: pageY,
width: width,
height: height
});
});
});
} | [
"function",
"measure",
"(",
"ref",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"ref",
".",
"measure",
"(",
"function",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"pageX",
",",
"pageY",
")",
"{",
"reso... | Promisifies measure's callback function and returns layout object. | [
"Promisifies",
"measure",
"s",
"callback",
"function",
"and",
"returns",
"layout",
"object",
"."
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L178-L189 |
8,280 | instea/react-native-popup-menu | build/rnpm.js | makeTouchable | function makeTouchable(TouchableComponent) {
var Touchable = TouchableComponent || reactNative.Platform.select({
android: reactNative.TouchableNativeFeedback,
ios: reactNative.TouchableHighlight,
default: reactNative.TouchableHighlight
});
var defaultTouchableProps = {};
if (Touchable... | javascript | function makeTouchable(TouchableComponent) {
var Touchable = TouchableComponent || reactNative.Platform.select({
android: reactNative.TouchableNativeFeedback,
ios: reactNative.TouchableHighlight,
default: reactNative.TouchableHighlight
});
var defaultTouchableProps = {};
if (Touchable... | [
"function",
"makeTouchable",
"(",
"TouchableComponent",
")",
"{",
"var",
"Touchable",
"=",
"TouchableComponent",
"||",
"reactNative",
".",
"Platform",
".",
"select",
"(",
"{",
"android",
":",
"reactNative",
".",
"TouchableNativeFeedback",
",",
"ios",
":",
"reactNa... | Create touchable component based on passed parameter and platform.
It also returns default props for specific touchable types. | [
"Create",
"touchable",
"component",
"based",
"on",
"passed",
"parameter",
"and",
"platform",
".",
"It",
"also",
"returns",
"default",
"props",
"for",
"specific",
"touchable",
"types",
"."
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L205-L223 |
8,281 | instea/react-native-popup-menu | build/rnpm.js | iterator2array | function iterator2array(it) {
// workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127
var arr = [];
for (var next = it.next(); !next.done; next = it.next()) {
arr.push(next.value);
}
return arr;
} | javascript | function iterator2array(it) {
// workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127
var arr = [];
for (var next = it.next(); !next.done; next = it.next()) {
arr.push(next.value);
}
return arr;
} | [
"function",
"iterator2array",
"(",
"it",
")",
"{",
"// workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127",
"var",
"arr",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"next",
"=",
"it",
".",
"next",
"(",
")",
";",
"!",
"ne... | Converts iterator to array | [
"Converts",
"iterator",
"to",
"array"
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L228-L237 |
8,282 | instea/react-native-popup-menu | build/rnpm.js | deprecatedComponent | function deprecatedComponent(message) {
var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function deprecatedComponentHOC(Component) {
var _temp;
return _temp =
/*#__PURE__*/
function (_React$Component) {
_inherits(DeprecatedComponent, ... | javascript | function deprecatedComponent(message) {
var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function deprecatedComponentHOC(Component) {
var _temp;
return _temp =
/*#__PURE__*/
function (_React$Component) {
_inherits(DeprecatedComponent, ... | [
"function",
"deprecatedComponent",
"(",
"message",
")",
"{",
"var",
"methods",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"[",
"]",
";",
"return",
"function",
"... | Higher order component to deprecate usage of component.
message - deprecate warning message
methods - array of method names to be delegated to deprecated component | [
"Higher",
"order",
"component",
"to",
"deprecate",
"usage",
"of",
"component",
".",
"message",
"-",
"deprecate",
"warning",
"message",
"methods",
"-",
"array",
"of",
"method",
"names",
"to",
"be",
"delegated",
"to",
"deprecated",
"component"
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L244-L299 |
8,283 | instea/react-native-popup-menu | build/rnpm.js | isAsyncMode | function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true;
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMod... | javascript | function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true;
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMod... | [
"function",
"isAsyncMode",
"(",
"object",
")",
"{",
"{",
"if",
"(",
"!",
"hasWarnedAboutDeprecatedIsAsyncMode",
")",
"{",
"hasWarnedAboutDeprecatedIsAsyncMode",
"=",
"true",
";",
"lowPriorityWarning$1",
"(",
"false",
",",
"'The ReactIs.isAsyncMode() alias has been deprecate... | AsyncMode should be deprecated | [
"AsyncMode",
"should",
"be",
"deprecated"
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L450-L458 |
8,284 | instea/react-native-popup-menu | build/rnpm.js | makeMenuRegistry | function makeMenuRegistry() {
var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
/**
* Subscribes menu instance.
*/
function subscribe(instance) {
var name = instance.getName();
if (menus.get(name)) {
console.warn("incorrect usage of po... | javascript | function makeMenuRegistry() {
var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
/**
* Subscribes menu instance.
*/
function subscribe(instance) {
var name = instance.getName();
if (menus.get(name)) {
console.warn("incorrect usage of po... | [
"function",
"makeMenuRegistry",
"(",
")",
"{",
"var",
"menus",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"new",
"Map",
"(",
")",
";",
"/**\n * Subscribes men... | Registry to subscribe, unsubscribe and update data of menus.
menu data: {
instance: react instance
triggerLayout: Object - layout of menu trigger if known
optionsLayout: Object - layout of menu options if known
optionsCustomStyles: Object - custom styles of options
} | [
"Registry",
"to",
"subscribe",
"unsubscribe",
"and",
"update",
"data",
"of",
"menus",
"."
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1415-L1502 |
8,285 | instea/react-native-popup-menu | build/rnpm.js | subscribe | function subscribe(instance) {
var name = instance.getName();
if (menus.get(name)) {
console.warn("incorrect usage of popup menu - menu with name ".concat(name, " already exists"));
}
menus.set(name, {
name: name,
instance: instance
});
} | javascript | function subscribe(instance) {
var name = instance.getName();
if (menus.get(name)) {
console.warn("incorrect usage of popup menu - menu with name ".concat(name, " already exists"));
}
menus.set(name, {
name: name,
instance: instance
});
} | [
"function",
"subscribe",
"(",
"instance",
")",
"{",
"var",
"name",
"=",
"instance",
".",
"getName",
"(",
")",
";",
"if",
"(",
"menus",
".",
"get",
"(",
"name",
")",
")",
"{",
"console",
".",
"warn",
"(",
"\"incorrect usage of popup menu - menu with name \"",... | Subscribes menu instance. | [
"Subscribes",
"menu",
"instance",
"."
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1421-L1432 |
8,286 | instea/react-native-popup-menu | build/rnpm.js | updateLayoutInfo | function updateLayoutInfo(name) {
var layouts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!menus.has(name)) {
return;
}
var menu = Object.assign({}, menus.get(name));
if (layouts.hasOwnProperty('triggerLayout')) {
menu.triggerLayout = la... | javascript | function updateLayoutInfo(name) {
var layouts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!menus.has(name)) {
return;
}
var menu = Object.assign({}, menus.get(name));
if (layouts.hasOwnProperty('triggerLayout')) {
menu.triggerLayout = la... | [
"function",
"updateLayoutInfo",
"(",
"name",
")",
"{",
"var",
"layouts",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"{",
"}",
";",
"if",
"(",
"!",
"menus",
... | Updates layout infomration. | [
"Updates",
"layout",
"infomration",
"."
] | 46197a3a72a2031c040b6c1c5971199bb53f938b | https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1446-L1464 |
8,287 | elastic/apm-agent-rum-js | packages/rum-core/src/common/utils.js | setTag | function setTag(key, value, obj) {
if (!obj || !key) return
var skey = removeInvalidChars(key)
if (value) {
value = String(value)
}
obj[skey] = value
return obj
} | javascript | function setTag(key, value, obj) {
if (!obj || !key) return
var skey = removeInvalidChars(key)
if (value) {
value = String(value)
}
obj[skey] = value
return obj
} | [
"function",
"setTag",
"(",
"key",
",",
"value",
",",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"!",
"key",
")",
"return",
"var",
"skey",
"=",
"removeInvalidChars",
"(",
"key",
")",
"if",
"(",
"value",
")",
"{",
"value",
"=",
"String",
"(",
"v... | Convert values of the tag to be string to be compatible
with the apm server prior to <6.7 version
TODO: Remove string conversion in the next major release since
support for boolean and number in the APM server has landed in 6.7
https://github.com/elastic/apm-server/pull/1712/ | [
"Convert",
"values",
"of",
"the",
"tag",
"to",
"be",
"string",
"to",
"be",
"compatible",
"with",
"the",
"apm",
"server",
"prior",
"to",
"<6",
".",
"7",
"version"
] | b877fa9e8ee8255e2f5d91e2d5dae61ff489fcd4 | https://github.com/elastic/apm-agent-rum-js/blob/b877fa9e8ee8255e2f5d91e2d5dae61ff489fcd4/packages/rum-core/src/common/utils.js#L145-L153 |
8,288 | mauron85/react-native-background-geolocation | index.js | function (successFn, errorFn) {
successFn = successFn || emptyFn;
errorFn = errorFn || emptyFn;
RNBackgroundGeolocation.getStationaryLocation(successFn, errorFn);
} | javascript | function (successFn, errorFn) {
successFn = successFn || emptyFn;
errorFn = errorFn || emptyFn;
RNBackgroundGeolocation.getStationaryLocation(successFn, errorFn);
} | [
"function",
"(",
"successFn",
",",
"errorFn",
")",
"{",
"successFn",
"=",
"successFn",
"||",
"emptyFn",
";",
"errorFn",
"=",
"errorFn",
"||",
"emptyFn",
";",
"RNBackgroundGeolocation",
".",
"getStationaryLocation",
"(",
"successFn",
",",
"errorFn",
")",
";",
"... | Returns current stationaryLocation if available. null if not | [
"Returns",
"current",
"stationaryLocation",
"if",
"available",
".",
"null",
"if",
"not"
] | 6bdedbee827f698b91d81c2b8db91663e3260462 | https://github.com/mauron85/react-native-background-geolocation/blob/6bdedbee827f698b91d81c2b8db91663e3260462/index.js#L120-L124 | |
8,289 | Shopify/theme-scripts | packages/theme-product/theme-product.js | _validateProductStructure | function _validateProductStructure(product) {
if (typeof product !== 'object') {
throw new TypeError(product + ' is not an object.');
}
if (Object.keys(product).length === 0 && product.constructor === Object) {
throw new Error(product + ' is empty.');
}
} | javascript | function _validateProductStructure(product) {
if (typeof product !== 'object') {
throw new TypeError(product + ' is not an object.');
}
if (Object.keys(product).length === 0 && product.constructor === Object) {
throw new Error(product + ' is empty.');
}
} | [
"function",
"_validateProductStructure",
"(",
"product",
")",
"{",
"if",
"(",
"typeof",
"product",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"product",
"+",
"' is not an object.'",
")",
";",
"}",
"if",
"(",
"Object",
".",
"keys",
"(",
... | Check if the product data is a valid JS object
Error will be thrown if type is invalid
@param {object} product Product JSON object | [
"Check",
"if",
"the",
"product",
"data",
"is",
"a",
"valid",
"JS",
"object",
"Error",
"will",
"be",
"thrown",
"if",
"type",
"is",
"invalid"
] | b2fb8f43db5f2115786051f3941207b65794c3d5 | https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-product/theme-product.js#L94-L102 |
8,290 | Shopify/theme-scripts | packages/theme-addresses/theme-addresses.js | buildOptions | function buildOptions (provinceNodeElement, provinces) {
var defaultValue = provinceNodeElement.getAttribute('data-default');
provinces.forEach(function (option) {
var optionElement = document.createElement('option');
optionElement.value = option[0];
optionElement.textContent = option[1];
province... | javascript | function buildOptions (provinceNodeElement, provinces) {
var defaultValue = provinceNodeElement.getAttribute('data-default');
provinces.forEach(function (option) {
var optionElement = document.createElement('option');
optionElement.value = option[0];
optionElement.textContent = option[1];
province... | [
"function",
"buildOptions",
"(",
"provinceNodeElement",
",",
"provinces",
")",
"{",
"var",
"defaultValue",
"=",
"provinceNodeElement",
".",
"getAttribute",
"(",
"'data-default'",
")",
";",
"provinces",
".",
"forEach",
"(",
"function",
"(",
"option",
")",
"{",
"v... | Builds the options for province selector | [
"Builds",
"the",
"options",
"for",
"province",
"selector"
] | b2fb8f43db5f2115786051f3941207b65794c3d5 | https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-addresses/theme-addresses.js#L78-L92 |
8,291 | Shopify/theme-scripts | packages/theme-addresses/theme-addresses.js | buildProvince | function buildProvince (countryNodeElement, provinceNodeElement, selectedValue) {
var selectedOption = getOption(countryNodeElement, selectedValue);
var provinces = JSON.parse(selectedOption.getAttribute('data-provinces'));
provinceNodeElement.options.length = 0;
if (provinces.length) {
buildOptions(provi... | javascript | function buildProvince (countryNodeElement, provinceNodeElement, selectedValue) {
var selectedOption = getOption(countryNodeElement, selectedValue);
var provinces = JSON.parse(selectedOption.getAttribute('data-provinces'));
provinceNodeElement.options.length = 0;
if (provinces.length) {
buildOptions(provi... | [
"function",
"buildProvince",
"(",
"countryNodeElement",
",",
"provinceNodeElement",
",",
"selectedValue",
")",
"{",
"var",
"selectedOption",
"=",
"getOption",
"(",
"countryNodeElement",
",",
"selectedValue",
")",
";",
"var",
"provinces",
"=",
"JSON",
".",
"parse",
... | Builds the province selector | [
"Builds",
"the",
"province",
"selector"
] | b2fb8f43db5f2115786051f3941207b65794c3d5 | https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-addresses/theme-addresses.js#L97-L108 |
8,292 | jenkinsci/blueocean-plugin | blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js | appendApiUrlParam | function appendApiUrlParam(fullUrl, apiUrl) {
let appendedUrl = fullUrl;
if (typeof apiUrl === 'string') {
if (fullUrl.indexOf('?') === -1) {
appendedUrl += '?';
} else {
appendedUrl += '&';
}
appendedUrl += 'apiUrl=';
// trim trailing slash from... | javascript | function appendApiUrlParam(fullUrl, apiUrl) {
let appendedUrl = fullUrl;
if (typeof apiUrl === 'string') {
if (fullUrl.indexOf('?') === -1) {
appendedUrl += '?';
} else {
appendedUrl += '&';
}
appendedUrl += 'apiUrl=';
// trim trailing slash from... | [
"function",
"appendApiUrlParam",
"(",
"fullUrl",
",",
"apiUrl",
")",
"{",
"let",
"appendedUrl",
"=",
"fullUrl",
";",
"if",
"(",
"typeof",
"apiUrl",
"===",
"'string'",
")",
"{",
"if",
"(",
"fullUrl",
".",
"indexOf",
"(",
"'?'",
")",
"===",
"-",
"1",
")"... | Append the GitHub "apiUrl" param onto the URL if necessary.
@param fullUrl
@param apiUrl
@returns {String} | [
"Append",
"the",
"GitHub",
"apiUrl",
"param",
"onto",
"the",
"URL",
"if",
"necessary",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js#L7-L23 |
8,293 | jenkinsci/blueocean-plugin | blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js | extractProtocolHost | function extractProtocolHost(url) {
const urlNoQuery = url.split('?')[0];
const [protocol, hostAndPath] = urlNoQuery.split('//');
const host = hostAndPath.split('/')[0];
return `${protocol}//${host}`;
} | javascript | function extractProtocolHost(url) {
const urlNoQuery = url.split('?')[0];
const [protocol, hostAndPath] = urlNoQuery.split('//');
const host = hostAndPath.split('/')[0];
return `${protocol}//${host}`;
} | [
"function",
"extractProtocolHost",
"(",
"url",
")",
"{",
"const",
"urlNoQuery",
"=",
"url",
".",
"split",
"(",
"'?'",
")",
"[",
"0",
"]",
";",
"const",
"[",
"protocol",
",",
"hostAndPath",
"]",
"=",
"urlNoQuery",
".",
"split",
"(",
"'//'",
")",
";",
... | Extract the protocol and host from a URL.
Will not include the trailing slash.
@param url
@returns {string} | [
"Extract",
"the",
"protocol",
"and",
"host",
"from",
"a",
"URL",
".",
"Will",
"not",
"include",
"the",
"trailing",
"slash",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js#L32-L37 |
8,294 | jenkinsci/blueocean-plugin | blueocean-core-js/src/js/LoadingIndicator.js | setLoaderClass | function setLoaderClass(c, t) {
timeouts.push(
setTimeout(() => {
loadbar.classList.add(c);
}, t)
);
} | javascript | function setLoaderClass(c, t) {
timeouts.push(
setTimeout(() => {
loadbar.classList.add(c);
}, t)
);
} | [
"function",
"setLoaderClass",
"(",
"c",
",",
"t",
")",
"{",
"timeouts",
".",
"push",
"(",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"loadbar",
".",
"classList",
".",
"add",
"(",
"c",
")",
";",
"}",
",",
"t",
")",
")",
";",
"}"
] | Add a timeout to transition the loading animation differently | [
"Add",
"a",
"timeout",
"to",
"transition",
"the",
"loading",
"animation",
"differently"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-core-js/src/js/LoadingIndicator.js#L26-L32 |
8,295 | jenkinsci/blueocean-plugin | js-extensions/@jenkins-cd/subs/extensions-bundle.js | findExtensionsYAMLFile | function findExtensionsYAMLFile() {
for (var i = 0; i < paths.srcPaths.length; i++) {
var srcPath = path.resolve(cwd, paths.srcPaths[i]);
var extFile = path.resolve(srcPath, 'jenkins-js-extension.yaml');
if (fs.existsSync(extFile)) {
return extFile;
}
}
return un... | javascript | function findExtensionsYAMLFile() {
for (var i = 0; i < paths.srcPaths.length; i++) {
var srcPath = path.resolve(cwd, paths.srcPaths[i]);
var extFile = path.resolve(srcPath, 'jenkins-js-extension.yaml');
if (fs.existsSync(extFile)) {
return extFile;
}
}
return un... | [
"function",
"findExtensionsYAMLFile",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"paths",
".",
"srcPaths",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"srcPath",
"=",
"path",
".",
"resolve",
"(",
"cwd",
",",
"paths",
".",
... | Find the jenkins-js-extension.yaml file in the src paths. | [
"Find",
"the",
"jenkins",
"-",
"js",
"-",
"extension",
".",
"yaml",
"file",
"in",
"the",
"src",
"paths",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/js-extensions/@jenkins-cd/subs/extensions-bundle.js#L90-L100 |
8,296 | jenkinsci/blueocean-plugin | bin/pretty.js | loadSource | function loadSource(sourcePath) {
return new Promise((fulfil, reject) => {
fs.readFile(sourcePath, 'utf8', (err, data) => {
if (err) {
reject(err);
} else {
fulfil(data);
}
});
});
} | javascript | function loadSource(sourcePath) {
return new Promise((fulfil, reject) => {
fs.readFile(sourcePath, 'utf8', (err, data) => {
if (err) {
reject(err);
} else {
fulfil(data);
}
});
});
} | [
"function",
"loadSource",
"(",
"sourcePath",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"fulfil",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readFile",
"(",
"sourcePath",
",",
"'utf8'",
",",
"(",
"err",
",",
"data",
")",
"=>",
"{",
"if",
"(",
... | Load w promise | [
"Load",
"w",
"promise"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L87-L97 |
8,297 | jenkinsci/blueocean-plugin | bin/pretty.js | saveSource | function saveSource(sourcePath, data) {
return new Promise((fulfil, reject) => {
fs.writeFile(sourcePath, data, 'utf8', err => {
if (err) {
reject(err);
} else {
fulfil(true);
}
});
});
} | javascript | function saveSource(sourcePath, data) {
return new Promise((fulfil, reject) => {
fs.writeFile(sourcePath, data, 'utf8', err => {
if (err) {
reject(err);
} else {
fulfil(true);
}
});
});
} | [
"function",
"saveSource",
"(",
"sourcePath",
",",
"data",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"fulfil",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"writeFile",
"(",
"sourcePath",
",",
"data",
",",
"'utf8'",
",",
"err",
"=>",
"{",
"if",
"("... | Save w promise | [
"Save",
"w",
"promise"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L100-L110 |
8,298 | jenkinsci/blueocean-plugin | bin/pretty.js | getSourceFilesFromGlob | function getSourceFilesFromGlob(globPattern, ignoreGlobs) {
return new Promise((fulfil, reject) => {
glob(globPattern, { ignore: ignoreGlobs }, (err, files) => {
if (err) {
reject(err);
} else {
fulfil(files);
}
});
});
} | javascript | function getSourceFilesFromGlob(globPattern, ignoreGlobs) {
return new Promise((fulfil, reject) => {
glob(globPattern, { ignore: ignoreGlobs }, (err, files) => {
if (err) {
reject(err);
} else {
fulfil(files);
}
});
});
} | [
"function",
"getSourceFilesFromGlob",
"(",
"globPattern",
",",
"ignoreGlobs",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"fulfil",
",",
"reject",
")",
"=>",
"{",
"glob",
"(",
"globPattern",
",",
"{",
"ignore",
":",
"ignoreGlobs",
"}",
",",
"(",
"err",... | Calls out to glob, but returns a promise | [
"Calls",
"out",
"to",
"glob",
"but",
"returns",
"a",
"promise"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L113-L123 |
8,299 | jenkinsci/blueocean-plugin | bin/pretty.js | filterFiles | function filterFiles(files, validExtensions) {
const accepted = [];
for (const fileName of files) {
if (accepted.indexOf(fileName) === -1 && fileMatchesExtension(fileName, validExtensions)) {
accepted.push(fileName);
}
}
return accepted;
} | javascript | function filterFiles(files, validExtensions) {
const accepted = [];
for (const fileName of files) {
if (accepted.indexOf(fileName) === -1 && fileMatchesExtension(fileName, validExtensions)) {
accepted.push(fileName);
}
}
return accepted;
} | [
"function",
"filterFiles",
"(",
"files",
",",
"validExtensions",
")",
"{",
"const",
"accepted",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"fileName",
"of",
"files",
")",
"{",
"if",
"(",
"accepted",
".",
"indexOf",
"(",
"fileName",
")",
"===",
"-",
"1",
... | Make sure we only use valid extensions, and each fileName appears only once | [
"Make",
"sure",
"we",
"only",
"use",
"valid",
"extensions",
"and",
"each",
"fileName",
"appears",
"only",
"once"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L126-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.