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,300 | jenkinsci/blueocean-plugin | bin/pretty.js | splitFilesIntoBatches | function splitFilesIntoBatches(files, config) {
// We need to specifiy a different parser for TS files
const configTS = Object.assign({}, config);
configTS.parser = 'typescript';
const batches = [];
batches.push({
files: files.filter(fileName => fileMatchesExtension(fileName, EXTENSIONS.js... | javascript | function splitFilesIntoBatches(files, config) {
// We need to specifiy a different parser for TS files
const configTS = Object.assign({}, config);
configTS.parser = 'typescript';
const batches = [];
batches.push({
files: files.filter(fileName => fileMatchesExtension(fileName, EXTENSIONS.js... | [
"function",
"splitFilesIntoBatches",
"(",
"files",
",",
"config",
")",
"{",
"// We need to specifiy a different parser for TS files",
"const",
"configTS",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"config",
")",
";",
"configTS",
".",
"parser",
"=",
"'types... | Takes a list of files and initial config, and splits into two batches, each consisting of a subset of files and
the specific config for that batch. | [
"Takes",
"a",
"list",
"of",
"files",
"and",
"initial",
"config",
"and",
"splits",
"into",
"two",
"batches",
"each",
"consisting",
"of",
"a",
"subset",
"of",
"files",
"and",
"the",
"specific",
"config",
"for",
"that",
"batch",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L157-L175 |
8,301 | jenkinsci/blueocean-plugin | bin/pretty.js | prettifyBatches | function prettifyBatches(batches) {
return Promise.all(batches.map(({ files, config }) => prettifyFiles(files, config)));
} | javascript | function prettifyBatches(batches) {
return Promise.all(batches.map(({ files, config }) => prettifyFiles(files, config)));
} | [
"function",
"prettifyBatches",
"(",
"batches",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"batches",
".",
"map",
"(",
"(",
"{",
"files",
",",
"config",
"}",
")",
"=>",
"prettifyFiles",
"(",
"files",
",",
"config",
")",
")",
")",
";",
"}"
] | Runs prettifyFiles for each batch. | [
"Runs",
"prettifyFiles",
"for",
"each",
"batch",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L219-L221 |
8,302 | jenkinsci/blueocean-plugin | bin/pretty.js | mergeBatchResults | function mergeBatchResults(batches) {
let files = [];
let unformattedFiles = [];
let formattedFiles = [];
let errors = [];
batches.forEach(batch => {
files.push(...batch.files);
unformattedFiles.push(...batch.unformattedFiles);
formattedFiles.push(...batch.formattedFiles);
... | javascript | function mergeBatchResults(batches) {
let files = [];
let unformattedFiles = [];
let formattedFiles = [];
let errors = [];
batches.forEach(batch => {
files.push(...batch.files);
unformattedFiles.push(...batch.unformattedFiles);
formattedFiles.push(...batch.formattedFiles);
... | [
"function",
"mergeBatchResults",
"(",
"batches",
")",
"{",
"let",
"files",
"=",
"[",
"]",
";",
"let",
"unformattedFiles",
"=",
"[",
"]",
";",
"let",
"formattedFiles",
"=",
"[",
"]",
";",
"let",
"errors",
"=",
"[",
"]",
";",
"batches",
".",
"forEach",
... | Merge the results from each batch into a single result of the same format | [
"Merge",
"the",
"results",
"from",
"each",
"batch",
"into",
"a",
"single",
"result",
"of",
"the",
"same",
"format"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L226-L240 |
8,303 | jenkinsci/blueocean-plugin | bin/pretty.js | showResults | function showResults(files, formattedFiles, unformattedFiles, errors) {
const formattedCount = formattedFiles.length;
const unformattedCount = unformattedFiles.length;
const errorCount = errors.length;
const filesCount = files.length;
const okCount = filesCount - formattedCount - unformattedCount - ... | javascript | function showResults(files, formattedFiles, unformattedFiles, errors) {
const formattedCount = formattedFiles.length;
const unformattedCount = unformattedFiles.length;
const errorCount = errors.length;
const filesCount = files.length;
const okCount = filesCount - formattedCount - unformattedCount - ... | [
"function",
"showResults",
"(",
"files",
",",
"formattedFiles",
",",
"unformattedFiles",
",",
"errors",
")",
"{",
"const",
"formattedCount",
"=",
"formattedFiles",
".",
"length",
";",
"const",
"unformattedCount",
"=",
"unformattedFiles",
".",
"length",
";",
"const... | Display results to user | [
"Display",
"results",
"to",
"user"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L243-L282 |
8,304 | jenkinsci/blueocean-plugin | blueocean-dashboard/src/main/js/util/PromiseDelayUtils.js | delayReject | function delayReject(delay = 1000) {
const begin = time();
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
if (promise.payload) {
reject(promise.payload);
}
}, delay);
});
return function proceed(error) {
// if we ha... | javascript | function delayReject(delay = 1000) {
const begin = time();
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
if (promise.payload) {
reject(promise.payload);
}
}, delay);
});
return function proceed(error) {
// if we ha... | [
"function",
"delayReject",
"(",
"delay",
"=",
"1000",
")",
"{",
"const",
"begin",
"=",
"time",
"(",
")",
";",
"const",
"promise",
"=",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"if... | Returns a function that should be chained to a promise to reject it after the delay.
@param {number} [delay] millis to delay
@returns {function} rejection function to pass to 'then()' | [
"Returns",
"a",
"function",
"that",
"should",
"be",
"chained",
"to",
"a",
"promise",
"to",
"reject",
"it",
"after",
"the",
"delay",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/util/PromiseDelayUtils.js#L63-L84 |
8,305 | jenkinsci/blueocean-plugin | js-extensions/src/ExtensionUtils.js | sortByOrdinal | function sortByOrdinal(extensions, done) {
const sorted = extensions.sort((a, b) => {
if (a.ordinal || b.ordinal) {
if (!a.ordinal) return 1;
if (!b.ordinal) return -1;
if (a.ordinal < b.ordinal) return -1;
return 1;
}
return a.pluginId.localeC... | javascript | function sortByOrdinal(extensions, done) {
const sorted = extensions.sort((a, b) => {
if (a.ordinal || b.ordinal) {
if (!a.ordinal) return 1;
if (!b.ordinal) return -1;
if (a.ordinal < b.ordinal) return -1;
return 1;
}
return a.pluginId.localeC... | [
"function",
"sortByOrdinal",
"(",
"extensions",
",",
"done",
")",
"{",
"const",
"sorted",
"=",
"extensions",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"if",
"(",
"a",
".",
"ordinal",
"||",
"b",
".",
"ordinal",
")",
"{",
"if",
"(",
"!"... | Sort extensions by ordinal if defined, then fallback to pluginId.
@param extensions
@param [done] | [
"Sort",
"extensions",
"by",
"ordinal",
"if",
"defined",
"then",
"fallback",
"to",
"pluginId",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/js-extensions/src/ExtensionUtils.js#L6-L22 |
8,306 | jenkinsci/blueocean-plugin | blueocean-core-js/src/js/parameter/rest/ParameterApi.js | prepareOptions | function prepareOptions(body) {
const fetchOptions = Object.assign({}, fetchOptionsCommon);
if (body) {
try {
fetchOptions.body = JSON.stringify(body);
} catch (e) {
console.warn('The form body are not added. Could not extract data from the body element', body);
}... | javascript | function prepareOptions(body) {
const fetchOptions = Object.assign({}, fetchOptionsCommon);
if (body) {
try {
fetchOptions.body = JSON.stringify(body);
} catch (e) {
console.warn('The form body are not added. Could not extract data from the body element', body);
}... | [
"function",
"prepareOptions",
"(",
"body",
")",
"{",
"const",
"fetchOptions",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"fetchOptionsCommon",
")",
";",
"if",
"(",
"body",
")",
"{",
"try",
"{",
"fetchOptions",
".",
"body",
"=",
"JSON",
".",
"str... | Helper method to clone and prepare the body if attached
@param body - JSON object that we want to sent to the server
@returns {*} fetchOptions | [
"Helper",
"method",
"to",
"clone",
"and",
"prepare",
"the",
"body",
"if",
"attached"
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-core-js/src/js/parameter/rest/ParameterApi.js#L18-L28 |
8,307 | jenkinsci/blueocean-plugin | jenkins-design-language/bin/import-material-icons.js | validateSourcePath | function validateSourcePath(sourcePath) {
const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json');
return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' })
.then(materialPackageJSONString => {
const package = JSON.parse(materialPackageJSONString);
... | javascript | function validateSourcePath(sourcePath) {
const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json');
return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' })
.then(materialPackageJSONString => {
const package = JSON.parse(materialPackageJSONString);
... | [
"function",
"validateSourcePath",
"(",
"sourcePath",
")",
"{",
"const",
"materialPackageJSONPath",
"=",
"pathUtils",
".",
"resolve",
"(",
"sourcePath",
",",
"'package.json'",
")",
";",
"return",
"fs",
".",
"readFileAsync",
"(",
"materialPackageJSONPath",
",",
"{",
... | Make sure the source path is correct in that it exists and appears to point to the root of the repo we want. | [
"Make",
"sure",
"the",
"source",
"path",
"is",
"correct",
"in",
"that",
"it",
"exists",
"and",
"appears",
"to",
"point",
"to",
"the",
"root",
"of",
"the",
"repo",
"we",
"want",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/jenkins-design-language/bin/import-material-icons.js#L119-L130 |
8,308 | jenkinsci/blueocean-plugin | jenkins-design-language/bin/import-material-icons.js | findSourceFiles | function findSourceFiles(sourceIconsRoot) {
let visitedDirectories = [];
let allSourceFiles = [];
function recurseDir(dir, depth) {
// Don't get in any loops
if (visitedDirectories.indexOf(dir) !== -1) {
return;
}
if (depth > 3) {
throw new Error('fi... | javascript | function findSourceFiles(sourceIconsRoot) {
let visitedDirectories = [];
let allSourceFiles = [];
function recurseDir(dir, depth) {
// Don't get in any loops
if (visitedDirectories.indexOf(dir) !== -1) {
return;
}
if (depth > 3) {
throw new Error('fi... | [
"function",
"findSourceFiles",
"(",
"sourceIconsRoot",
")",
"{",
"let",
"visitedDirectories",
"=",
"[",
"]",
";",
"let",
"allSourceFiles",
"=",
"[",
"]",
";",
"function",
"recurseDir",
"(",
"dir",
",",
"depth",
")",
"{",
"// Don't get in any loops",
"if",
"(",... | Traverse the tree starting at sourcePath, and find all the .js files.
Only goes 3 levels deep, will throw if it gives up due to tree depth.
Kind of ugly, but better than pulling in some npm module with 45 transitive dependencies. Please let me know if
there's a nicer way to do this! - JM | [
"Traverse",
"the",
"tree",
"starting",
"at",
"sourcePath",
"and",
"find",
"all",
"the",
".",
"js",
"files",
"."
] | 6e87cc0e76449669a942d66a9391cd7a46a943e0 | https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/jenkins-design-language/bin/import-material-icons.js#L140-L196 |
8,309 | toji/gl-matrix | spec/helpers/spec-helper.js | function(a, epsilon) {
if(epsilon == undefined) epsilon = EPSILON;
let allSignsFlipped = false;
if (e.length != a.length)
expected(e, "to have the same length as", a);
for (let i = 0; i < e.length; i++) {
if (isNaN(e... | javascript | function(a, epsilon) {
if(epsilon == undefined) epsilon = EPSILON;
let allSignsFlipped = false;
if (e.length != a.length)
expected(e, "to have the same length as", a);
for (let i = 0; i < e.length; i++) {
if (isNaN(e... | [
"function",
"(",
"a",
",",
"epsilon",
")",
"{",
"if",
"(",
"epsilon",
"==",
"undefined",
")",
"epsilon",
"=",
"EPSILON",
";",
"let",
"allSignsFlipped",
"=",
"false",
";",
"if",
"(",
"e",
".",
"length",
"!=",
"a",
".",
"length",
")",
"expected",
"(",
... | Dual quaternions are very special & unique snowflakes | [
"Dual",
"quaternions",
"are",
"very",
"special",
"&",
"unique",
"snowflakes"
] | 9ea87effc0ca32feb8511a01685ee596c6160fcc | https://github.com/toji/gl-matrix/blob/9ea87effc0ca32feb8511a01685ee596c6160fcc/spec/helpers/spec-helper.js#L86-L106 | |
8,310 | optimizely/nuclear-js | examples/rest-api/src/modules/rest-api/create-api-actions.js | onDeleteSuccess | function onDeleteSuccess(model, params, result) {
Flux.dispatch(actionTypes.API_DELETE_SUCCESS, {
model: model,
params: params,
result: result,
})
return result
} | javascript | function onDeleteSuccess(model, params, result) {
Flux.dispatch(actionTypes.API_DELETE_SUCCESS, {
model: model,
params: params,
result: result,
})
return result
} | [
"function",
"onDeleteSuccess",
"(",
"model",
",",
"params",
",",
"result",
")",
"{",
"Flux",
".",
"dispatch",
"(",
"actionTypes",
".",
"API_DELETE_SUCCESS",
",",
"{",
"model",
":",
"model",
",",
"params",
":",
"params",
",",
"result",
":",
"result",
",",
... | Handler for API delete success, dispatches flux action to remove the instance from the stores
@param {Model} model
@param {*} params used to call the `model.delete(params)`
@param {Object} result
@return {Object} | [
"Handler",
"for",
"API",
"delete",
"success",
"dispatches",
"flux",
"action",
"to",
"remove",
"the",
"instance",
"from",
"the",
"stores"
] | 102fe399c8730375dece7711c66f1d46c860f5ae | https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/rest-api/src/modules/rest-api/create-api-actions.js#L140-L147 |
8,311 | optimizely/nuclear-js | examples/rest-api/src/modules/rest-api/create-api-actions.js | onDeleteFail | function onDeleteFail(model, params, reason) {
Flux.dispatch(actionTypes.API_DELETE_FAIL, {
model: model,
params: params,
reason: reason,
})
return Promise.reject(reason)
} | javascript | function onDeleteFail(model, params, reason) {
Flux.dispatch(actionTypes.API_DELETE_FAIL, {
model: model,
params: params,
reason: reason,
})
return Promise.reject(reason)
} | [
"function",
"onDeleteFail",
"(",
"model",
",",
"params",
",",
"reason",
")",
"{",
"Flux",
".",
"dispatch",
"(",
"actionTypes",
".",
"API_DELETE_FAIL",
",",
"{",
"model",
":",
"model",
",",
"params",
":",
"params",
",",
"reason",
":",
"reason",
",",
"}",
... | Handler for API delete fail
@param {Model} model
@param {*} params used to call the `model.delete(params)`
@param {Object} result
@return {Object} | [
"Handler",
"for",
"API",
"delete",
"fail"
] | 102fe399c8730375dece7711c66f1d46c860f5ae | https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/rest-api/src/modules/rest-api/create-api-actions.js#L156-L163 |
8,312 | optimizely/nuclear-js | src/getter.js | getFlattenedDeps | function getFlattenedDeps(getter, existing) {
if (!existing) {
existing = Immutable.Set()
}
const toAdd = Immutable.Set().withMutations(set => {
if (!isGetter(getter)) {
throw new Error('getFlattenedDeps must be passed a Getter')
}
getDeps(getter).forEach(dep => {
if (isKeyPath(dep))... | javascript | function getFlattenedDeps(getter, existing) {
if (!existing) {
existing = Immutable.Set()
}
const toAdd = Immutable.Set().withMutations(set => {
if (!isGetter(getter)) {
throw new Error('getFlattenedDeps must be passed a Getter')
}
getDeps(getter).forEach(dep => {
if (isKeyPath(dep))... | [
"function",
"getFlattenedDeps",
"(",
"getter",
",",
"existing",
")",
"{",
"if",
"(",
"!",
"existing",
")",
"{",
"existing",
"=",
"Immutable",
".",
"Set",
"(",
")",
"}",
"const",
"toAdd",
"=",
"Immutable",
".",
"Set",
"(",
")",
".",
"withMutations",
"("... | Returns an array of deps from a getter and all its deps
@param {Getter} getter
@param {Immutable.Set} existing
@return {Immutable.Set} | [
"Returns",
"an",
"array",
"of",
"deps",
"from",
"a",
"getter",
"and",
"all",
"its",
"deps"
] | 102fe399c8730375dece7711c66f1d46c860f5ae | https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/src/getter.js#L45-L67 |
8,313 | optimizely/nuclear-js | src/reactor/fns.js | createCacheEntry | function createCacheEntry(reactorState, getter) {
// evaluate dependencies
const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result)
const value = getComputeFn(getter).apply(null, args)
const storeDeps = getStoreDeps(getter)
const storeStates = toImmutable({}).withMutations(map => {
sto... | javascript | function createCacheEntry(reactorState, getter) {
// evaluate dependencies
const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result)
const value = getComputeFn(getter).apply(null, args)
const storeDeps = getStoreDeps(getter)
const storeStates = toImmutable({}).withMutations(map => {
sto... | [
"function",
"createCacheEntry",
"(",
"reactorState",
",",
"getter",
")",
"{",
"// evaluate dependencies",
"const",
"args",
"=",
"getDeps",
"(",
"getter",
")",
".",
"map",
"(",
"dep",
"=>",
"evaluate",
"(",
"reactorState",
",",
"dep",
")",
".",
"result",
")",... | Evaluates getter for given reactorState and returns CacheEntry
@param {ReactorState} reactorState
@param {Getter} getter
@return {CacheEntry} | [
"Evaluates",
"getter",
"for",
"given",
"reactorState",
"and",
"returns",
"CacheEntry"
] | 102fe399c8730375dece7711c66f1d46c860f5ae | https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/src/reactor/fns.js#L408-L426 |
8,314 | optimizely/nuclear-js | examples/flux-chat/js/modules/chat/stores/thread-store.js | setMessagesRead | function setMessagesRead(state, { threadID }) {
return state.updateIn([threadID, 'messages'], messages => {
return messages.map(msg => msg.set('isRead', true))
})
} | javascript | function setMessagesRead(state, { threadID }) {
return state.updateIn([threadID, 'messages'], messages => {
return messages.map(msg => msg.set('isRead', true))
})
} | [
"function",
"setMessagesRead",
"(",
"state",
",",
"{",
"threadID",
"}",
")",
"{",
"return",
"state",
".",
"updateIn",
"(",
"[",
"threadID",
",",
"'messages'",
"]",
",",
"messages",
"=>",
"{",
"return",
"messages",
".",
"map",
"(",
"msg",
"=>",
"msg",
"... | Mark all messages for a thread as "read"
@param {Immutable.Map}
@param {Object} payload
@param {GUID} payload.threadID | [
"Mark",
"all",
"messages",
"for",
"a",
"thread",
"as",
"read"
] | 102fe399c8730375dece7711c66f1d46c860f5ae | https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/flux-chat/js/modules/chat/stores/thread-store.js#L66-L70 |
8,315 | mipengine/mip2 | packages/mip/src/performance.js | removeFsElement | function removeFsElement (element) {
let index = fsElements.indexOf(element)
if (index !== -1) {
fsElements.splice(index, 1)
}
} | javascript | function removeFsElement (element) {
let index = fsElements.indexOf(element)
if (index !== -1) {
fsElements.splice(index, 1)
}
} | [
"function",
"removeFsElement",
"(",
"element",
")",
"{",
"let",
"index",
"=",
"fsElements",
".",
"indexOf",
"(",
"element",
")",
"if",
"(",
"index",
"!==",
"-",
"1",
")",
"{",
"fsElements",
".",
"splice",
"(",
"index",
",",
"1",
")",
"}",
"}"
] | Remove element from fsElements.
@param {HTMLElement} element html element | [
"Remove",
"element",
"from",
"fsElements",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L66-L71 |
8,316 | mipengine/mip2 | packages/mip/src/performance.js | getTiming | function getTiming () {
let nativeTiming
let performance = window.performance
if (performance && performance.timing) {
nativeTiming = performance.timing.toJSON
? performance.timing.toJSON()
: util.fn.extend({}, performance.timing)
} else {
nativeTiming = {}
}
return util.fn.extend(native... | javascript | function getTiming () {
let nativeTiming
let performance = window.performance
if (performance && performance.timing) {
nativeTiming = performance.timing.toJSON
? performance.timing.toJSON()
: util.fn.extend({}, performance.timing)
} else {
nativeTiming = {}
}
return util.fn.extend(native... | [
"function",
"getTiming",
"(",
")",
"{",
"let",
"nativeTiming",
"let",
"performance",
"=",
"window",
".",
"performance",
"if",
"(",
"performance",
"&&",
"performance",
".",
"timing",
")",
"{",
"nativeTiming",
"=",
"performance",
".",
"timing",
".",
"toJSON",
... | Get the timings.
@return {Object} | [
"Get",
"the",
"timings",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L78-L89 |
8,317 | mipengine/mip2 | packages/mip/src/performance.js | recordTiming | function recordTiming (name, timing) {
recorder[name] = parseInt(timing, 10) || Date.now()
performanceEvent.trigger('update', getTiming())
} | javascript | function recordTiming (name, timing) {
recorder[name] = parseInt(timing, 10) || Date.now()
performanceEvent.trigger('update', getTiming())
} | [
"function",
"recordTiming",
"(",
"name",
",",
"timing",
")",
"{",
"recorder",
"[",
"name",
"]",
"=",
"parseInt",
"(",
"timing",
",",
"10",
")",
"||",
"Date",
".",
"now",
"(",
")",
"performanceEvent",
".",
"trigger",
"(",
"'update'",
",",
"getTiming",
"... | Record timing by name.
@param {string} name Name of the timing.
@param {?number} timing timing | [
"Record",
"timing",
"by",
"name",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L97-L100 |
8,318 | mipengine/mip2 | packages/mip/src/performance.js | lockFirstScreen | function lockFirstScreen () {
// when is prerendering, iframe container display none,
// all elements are not in viewport.
if (prerender.isPrerendering) {
return
}
let viewportRect = viewport.getRect()
fsElements = fsElements.filter((element) => {
if (prerender.isPrerendered) {
return element.... | javascript | function lockFirstScreen () {
// when is prerendering, iframe container display none,
// all elements are not in viewport.
if (prerender.isPrerendering) {
return
}
let viewportRect = viewport.getRect()
fsElements = fsElements.filter((element) => {
if (prerender.isPrerendered) {
return element.... | [
"function",
"lockFirstScreen",
"(",
")",
"{",
"// when is prerendering, iframe container display none,",
"// all elements are not in viewport.",
"if",
"(",
"prerender",
".",
"isPrerendering",
")",
"{",
"return",
"}",
"let",
"viewportRect",
"=",
"viewport",
".",
"getRect",
... | Lock the fsElements. No longer add fsElements. | [
"Lock",
"the",
"fsElements",
".",
"No",
"longer",
"add",
"fsElements",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L115-L134 |
8,319 | mipengine/mip2 | packages/mip/src/register-element.js | loadCss | function loadCss (css, name) {
if (css) {
cssLoader.insertStyleElement(document, document.head, css, name, false)
}
} | javascript | function loadCss (css, name) {
if (css) {
cssLoader.insertStyleElement(document, document.head, css, name, false)
}
} | [
"function",
"loadCss",
"(",
"css",
",",
"name",
")",
"{",
"if",
"(",
"css",
")",
"{",
"cssLoader",
".",
"insertStyleElement",
"(",
"document",
",",
"document",
".",
"head",
",",
"css",
",",
"name",
",",
"false",
")",
"}",
"}"
] | Add a style tag to head by csstext
@param {string} css Css code
@param {string} name name | [
"Add",
"a",
"style",
"tag",
"to",
"head",
"by",
"csstext"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/register-element.js#L16-L20 |
8,320 | mipengine/mip2 | packages/mip/src/util/hash.js | ssEnabled | function ssEnabled () {
let support = false
try {
window.sessionStorage.setItem('_t', 1)
window.sessionStorage.removeItem('_t')
support = true
} catch (e) {}
return support
} | javascript | function ssEnabled () {
let support = false
try {
window.sessionStorage.setItem('_t', 1)
window.sessionStorage.removeItem('_t')
support = true
} catch (e) {}
return support
} | [
"function",
"ssEnabled",
"(",
")",
"{",
"let",
"support",
"=",
"false",
"try",
"{",
"window",
".",
"sessionStorage",
".",
"setItem",
"(",
"'_t'",
",",
"1",
")",
"window",
".",
"sessionStorage",
".",
"removeItem",
"(",
"'_t'",
")",
"support",
"=",
"true",... | test ss is available
@return {boolean} whether enabled or not | [
"test",
"ss",
"is",
"available"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/hash.js#L150-L159 |
8,321 | mipengine/mip2 | packages/mip/src/vue/core/observer/index.js | dependArray | function dependArray (value) {
for (let e, i = 0, l = value.length; i < l; i++) {
e = value[i]
e && e.__ob__ && e.__ob__.dep.depend()
if (Array.isArray(e)) {
dependArray(e)
}
}
} | javascript | function dependArray (value) {
for (let e, i = 0, l = value.length; i < l; i++) {
e = value[i]
e && e.__ob__ && e.__ob__.dep.depend()
if (Array.isArray(e)) {
dependArray(e)
}
}
} | [
"function",
"dependArray",
"(",
"value",
")",
"{",
"for",
"(",
"let",
"e",
",",
"i",
"=",
"0",
",",
"l",
"=",
"value",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"e",
"=",
"value",
"[",
"i",
"]",
"e",
"&&",
"e",
".",
"__... | Collect dependencies on array elements when the array is touched, since
we cannot intercept array element access like property getters. | [
"Collect",
"dependencies",
"on",
"array",
"elements",
"when",
"the",
"array",
"is",
"touched",
"since",
"we",
"cannot",
"intercept",
"array",
"element",
"access",
"like",
"property",
"getters",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/vue/core/observer/index.js#L268-L276 |
8,322 | mipengine/mip2 | packages/mip/src/mip1-polyfill/customElement.js | function () {
function impl (element) {
customElement.call(this, element)
}
impl.prototype = Object.create(customElement.prototype)
return impl
} | javascript | function () {
function impl (element) {
customElement.call(this, element)
}
impl.prototype = Object.create(customElement.prototype)
return impl
} | [
"function",
"(",
")",
"{",
"function",
"impl",
"(",
"element",
")",
"{",
"customElement",
".",
"call",
"(",
"this",
",",
"element",
")",
"}",
"impl",
".",
"prototype",
"=",
"Object",
".",
"create",
"(",
"customElement",
".",
"prototype",
")",
"return",
... | Create a class of a new type mip element
@return {Function} | [
"Create",
"a",
"class",
"of",
"a",
"new",
"type",
"mip",
"element"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/customElement.js#L155-L161 | |
8,323 | mipengine/mip2 | packages/mip/src/components/mip-shell/switchPage.js | forwardTransitionAndCreate | function forwardTransitionAndCreate (shell, options) {
let {sourcePageId, targetPageId, targetPageMeta, onComplete} = options
let loading = getLoading(targetPageMeta, {transitionContainsHeader: shell.transitionContainsHeader})
loading.classList.add('slide-enter', 'slide-enter-active')
css(loading, 'display', 'b... | javascript | function forwardTransitionAndCreate (shell, options) {
let {sourcePageId, targetPageId, targetPageMeta, onComplete} = options
let loading = getLoading(targetPageMeta, {transitionContainsHeader: shell.transitionContainsHeader})
loading.classList.add('slide-enter', 'slide-enter-active')
css(loading, 'display', 'b... | [
"function",
"forwardTransitionAndCreate",
"(",
"shell",
",",
"options",
")",
"{",
"let",
"{",
"sourcePageId",
",",
"targetPageId",
",",
"targetPageMeta",
",",
"onComplete",
"}",
"=",
"options",
"let",
"loading",
"=",
"getLoading",
"(",
"targetPageMeta",
",",
"{"... | Forward transition and create new iframe
@param {Object} shell shell instance
@param {Object} options
@param {string} options.targetPageId targetPageId
@param {Object} options.targetPageMeta pageMeta of target page
@param {string} options.sourcePageId sourcePageId
@param {Object} options.sourcePageMeta pageMeta of sou... | [
"Forward",
"transition",
"and",
"create",
"new",
"iframe"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L72-L112 |
8,324 | mipengine/mip2 | packages/mip/src/components/mip-shell/switchPage.js | backwardTransitionAndCreate | function backwardTransitionAndCreate (shell, options) {
let {
targetPageId,
targetPageMeta,
sourcePageId,
sourcePageMeta,
onComplete
} = options
// Goto root page, resume scroll position (Only appears in backward)
let rootPageScrollPosition = 0
fixRootPageScroll(shell, {targetPageId})
if... | javascript | function backwardTransitionAndCreate (shell, options) {
let {
targetPageId,
targetPageMeta,
sourcePageId,
sourcePageMeta,
onComplete
} = options
// Goto root page, resume scroll position (Only appears in backward)
let rootPageScrollPosition = 0
fixRootPageScroll(shell, {targetPageId})
if... | [
"function",
"backwardTransitionAndCreate",
"(",
"shell",
",",
"options",
")",
"{",
"let",
"{",
"targetPageId",
",",
"targetPageMeta",
",",
"sourcePageId",
",",
"sourcePageMeta",
",",
"onComplete",
"}",
"=",
"options",
"// Goto root page, resume scroll position (Only appea... | Backward transition and create new iframe
@param {Object} shell shell instance
@param {Object} options
@param {string} options.targetPageId targetPageId
@param {Object} options.targetPageMeta pageMeta of target page
@param {string} options.sourcePageId sourcePageId
@param {Object} options.sourcePageMeta pageMeta of so... | [
"Backward",
"transition",
"and",
"create",
"new",
"iframe"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L127-L228 |
8,325 | mipengine/mip2 | packages/mip/src/components/mip-shell/switchPage.js | skipTransitionAndCreate | function skipTransitionAndCreate (shell, options) {
let {sourcePageId, targetPageId, onComplete} = options
hideAllIFrames()
fixRootPageScroll(shell, {sourcePageId, targetPageId})
onComplete && onComplete()
let iframe = getIFrame(targetPageId)
css(iframe, 'z-index', activeZIndex++)
shell.afterSwitchPage... | javascript | function skipTransitionAndCreate (shell, options) {
let {sourcePageId, targetPageId, onComplete} = options
hideAllIFrames()
fixRootPageScroll(shell, {sourcePageId, targetPageId})
onComplete && onComplete()
let iframe = getIFrame(targetPageId)
css(iframe, 'z-index', activeZIndex++)
shell.afterSwitchPage... | [
"function",
"skipTransitionAndCreate",
"(",
"shell",
",",
"options",
")",
"{",
"let",
"{",
"sourcePageId",
",",
"targetPageId",
",",
"onComplete",
"}",
"=",
"options",
"hideAllIFrames",
"(",
")",
"fixRootPageScroll",
"(",
"shell",
",",
"{",
"sourcePageId",
",",
... | Skip transition and create new iframe
@param {Object} shell shell instance
@param {Object} options
@param {string} options.targetPageId targetPageId
@param {Object} options.targetPageMeta pageMeta of target page
@param {string} options.sourcePageId sourcePageId
@param {Object} options.sourcePageMeta pageMeta of source... | [
"Skip",
"transition",
"and",
"create",
"new",
"iframe"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L418-L429 |
8,326 | mipengine/mip2 | packages/mip/src/mip1-polyfill/element.js | createBaseElementProto | function createBaseElementProto () {
if (baseElementProto) {
return baseElementProto
}
// Base element inherits from HTMLElement
let proto = Object.create(HTMLElement.prototype)
/**
* Created callback of MIPElement. It will initialize the element.
*/
proto.createdCallback = function () {
// ... | javascript | function createBaseElementProto () {
if (baseElementProto) {
return baseElementProto
}
// Base element inherits from HTMLElement
let proto = Object.create(HTMLElement.prototype)
/**
* Created callback of MIPElement. It will initialize the element.
*/
proto.createdCallback = function () {
// ... | [
"function",
"createBaseElementProto",
"(",
")",
"{",
"if",
"(",
"baseElementProto",
")",
"{",
"return",
"baseElementProto",
"}",
"// Base element inherits from HTMLElement",
"let",
"proto",
"=",
"Object",
".",
"create",
"(",
"HTMLElement",
".",
"prototype",
")",
"/*... | Create a basic prototype of mip elements classes
@return {Object} | [
"Create",
"a",
"basic",
"prototype",
"of",
"mip",
"elements",
"classes"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/element.js#L28-L188 |
8,327 | mipengine/mip2 | packages/mip/src/mip1-polyfill/element.js | createMipElementProto | function createMipElementProto (name) {
let proto = Object.create(createBaseElementProto())
proto.name = name
return proto
} | javascript | function createMipElementProto (name) {
let proto = Object.create(createBaseElementProto())
proto.name = name
return proto
} | [
"function",
"createMipElementProto",
"(",
"name",
")",
"{",
"let",
"proto",
"=",
"Object",
".",
"create",
"(",
"createBaseElementProto",
"(",
")",
")",
"proto",
".",
"name",
"=",
"name",
"return",
"proto",
"}"
] | Create a mip element prototype by name
@param {string} name The mip element's name
@return {Object} | [
"Create",
"a",
"mip",
"element",
"prototype",
"by",
"name"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/element.js#L196-L200 |
8,328 | mipengine/mip2 | packages/mip/src/util/custom-storage.js | getErrorMess | function getErrorMess (code, name) {
let mess
switch (code) {
case eCode.siteExceed:
mess = 'storage space need less than 4k'
break
case eCode.lsExceed:
mess = 'Uncaught DOMException: Failed to execute setItem on Storage: Setting the value of ' +
name + ' exceeded the quota at ' + ... | javascript | function getErrorMess (code, name) {
let mess
switch (code) {
case eCode.siteExceed:
mess = 'storage space need less than 4k'
break
case eCode.lsExceed:
mess = 'Uncaught DOMException: Failed to execute setItem on Storage: Setting the value of ' +
name + ' exceeded the quota at ' + ... | [
"function",
"getErrorMess",
"(",
"code",
",",
"name",
")",
"{",
"let",
"mess",
"switch",
"(",
"code",
")",
"{",
"case",
"eCode",
".",
"siteExceed",
":",
"mess",
"=",
"'storage space need less than 4k'",
"break",
"case",
"eCode",
".",
"lsExceed",
":",
"mess",... | Get error message with error code
@param {string} code error code
@param {string} name error name
@return {string} error message | [
"Get",
"error",
"message",
"with",
"error",
"code"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/custom-storage.js#L506-L517 |
8,329 | mipengine/mip2 | packages/mip/src/util/dom/dom.js | matches | function matches (element, selector) {
if (!element || element.nodeType !== 1) {
return false
}
return nativeMatches.call(element, selector)
} | javascript | function matches (element, selector) {
if (!element || element.nodeType !== 1) {
return false
}
return nativeMatches.call(element, selector)
} | [
"function",
"matches",
"(",
"element",
",",
"selector",
")",
"{",
"if",
"(",
"!",
"element",
"||",
"element",
".",
"nodeType",
"!==",
"1",
")",
"{",
"return",
"false",
"}",
"return",
"nativeMatches",
".",
"call",
"(",
"element",
",",
"selector",
")",
"... | Support for matches. Check whether a element matches a selector.
@param {HTMLElement} element target element
@param {string} selector element selector
@return {boolean} | [
"Support",
"for",
"matches",
".",
"Check",
"whether",
"a",
"element",
"matches",
"a",
"selector",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L34-L39 |
8,330 | mipengine/mip2 | packages/mip/src/util/dom/dom.js | closestTo | function closestTo (element, selector, target) {
let closestElement = closest(element, selector)
return contains(target, closestElement) ? closestElement : null
} | javascript | function closestTo (element, selector, target) {
let closestElement = closest(element, selector)
return contains(target, closestElement) ? closestElement : null
} | [
"function",
"closestTo",
"(",
"element",
",",
"selector",
",",
"target",
")",
"{",
"let",
"closestElement",
"=",
"closest",
"(",
"element",
",",
"selector",
")",
"return",
"contains",
"(",
"target",
",",
"closestElement",
")",
"?",
"closestElement",
":",
"nu... | Find the nearest element that matches the selector from current element to target element.
@param {HTMLElement} element element
@param {string} selector element selector
@param {HTMLElement} target target element
@return {?HTMLElement} | [
"Find",
"the",
"nearest",
"element",
"that",
"matches",
"the",
"selector",
"from",
"current",
"element",
"to",
"target",
"element",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L92-L95 |
8,331 | mipengine/mip2 | packages/mip/src/util/dom/dom.js | create | function create (str) {
createTmpElement.innerHTML = str
if (!createTmpElement.children.length) {
return null
}
let children = Array.prototype.slice.call(createTmpElement.children)
createTmpElement.innerHTML = ''
return children.length > 1 ? children : children[0]
} | javascript | function create (str) {
createTmpElement.innerHTML = str
if (!createTmpElement.children.length) {
return null
}
let children = Array.prototype.slice.call(createTmpElement.children)
createTmpElement.innerHTML = ''
return children.length > 1 ? children : children[0]
} | [
"function",
"create",
"(",
"str",
")",
"{",
"createTmpElement",
".",
"innerHTML",
"=",
"str",
"if",
"(",
"!",
"createTmpElement",
".",
"children",
".",
"length",
")",
"{",
"return",
"null",
"}",
"let",
"children",
"=",
"Array",
".",
"prototype",
".",
"sl... | Create a element by string
@param {string} str Html string
@return {HTMLElement} | [
"Create",
"a",
"element",
"by",
"string"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L110-L118 |
8,332 | mipengine/mip2 | packages/mip/src/util/dom/dom.js | onDocumentState | function onDocumentState (doc, stateFn, callback) {
let ready = stateFn(doc)
if (ready) {
callback(doc)
return
}
const readyListener = () => {
if (!stateFn(doc)) {
return
}
if (!ready) {
ready = true
callback(doc)
}
doc.removeEventListener('readystatechange', r... | javascript | function onDocumentState (doc, stateFn, callback) {
let ready = stateFn(doc)
if (ready) {
callback(doc)
return
}
const readyListener = () => {
if (!stateFn(doc)) {
return
}
if (!ready) {
ready = true
callback(doc)
}
doc.removeEventListener('readystatechange', r... | [
"function",
"onDocumentState",
"(",
"doc",
",",
"stateFn",
",",
"callback",
")",
"{",
"let",
"ready",
"=",
"stateFn",
"(",
"doc",
")",
"if",
"(",
"ready",
")",
"{",
"callback",
"(",
"doc",
")",
"return",
"}",
"const",
"readyListener",
"=",
"(",
")",
... | Calls the callback when document's state satisfies the stateFn.
@param {!Document} doc
@param {(doc: Document) => boolean} stateFn
@param {(doc: Document) => void} callback | [
"Calls",
"the",
"callback",
"when",
"document",
"s",
"state",
"satisfies",
"the",
"stateFn",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L205-L228 |
8,333 | mipengine/mip2 | packages/mip/src/util/dom/dom.js | insert | function insert (parent, children) {
if (!parent || !children) {
return
}
let nodes = Array.prototype.slice.call(children)
if (nodes.length === 0) {
nodes.push(children)
}
for (let i = 0; i < nodes.length; i++) {
if (this.contains(nodes[i], parent)) {
continue
}
if (nodes[i] !== pa... | javascript | function insert (parent, children) {
if (!parent || !children) {
return
}
let nodes = Array.prototype.slice.call(children)
if (nodes.length === 0) {
nodes.push(children)
}
for (let i = 0; i < nodes.length; i++) {
if (this.contains(nodes[i], parent)) {
continue
}
if (nodes[i] !== pa... | [
"function",
"insert",
"(",
"parent",
",",
"children",
")",
"{",
"if",
"(",
"!",
"parent",
"||",
"!",
"children",
")",
"{",
"return",
"}",
"let",
"nodes",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"children",
")",
"if",
"(",
"n... | Insert dom list to a node
@param {HTMLElement} parent the node will be inserted
@param {Array} children node list which will insert into parent | [
"Insert",
"dom",
"list",
"to",
"a",
"node"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L246-L262 |
8,334 | mipengine/mip2 | packages/mip/src/util/dom/css.js | prefixProperty | function prefixProperty (property) {
property = property.replace(camelReg, (match, first, char) => (first ? char : char.toUpperCase()))
if (prefixCache[property]) {
return prefixCache[property]
}
let prop
if (!(property in supportElement.style)) {
for (let i = 0; i < PREFIX_TYPE.length; i++) {
... | javascript | function prefixProperty (property) {
property = property.replace(camelReg, (match, first, char) => (first ? char : char.toUpperCase()))
if (prefixCache[property]) {
return prefixCache[property]
}
let prop
if (!(property in supportElement.style)) {
for (let i = 0; i < PREFIX_TYPE.length; i++) {
... | [
"function",
"prefixProperty",
"(",
"property",
")",
"{",
"property",
"=",
"property",
".",
"replace",
"(",
"camelReg",
",",
"(",
"match",
",",
"first",
",",
"char",
")",
"=>",
"(",
"first",
"?",
"char",
":",
"char",
".",
"toUpperCase",
"(",
")",
")",
... | Make sure a property is supported by adding prefix.
@param {string} property A property to be checked
@return {string} the property or its prefixed version | [
"Make",
"sure",
"a",
"property",
"is",
"supported",
"by",
"adding",
"prefix",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/css.js#L26-L50 |
8,335 | mipengine/mip2 | packages/mip/src/util/dom/css.js | unitProperty | function unitProperty (property, value) {
if (value !== +value) {
return value
}
if (unitCache[property]) {
return value + unitCache[property]
}
supportElement.style[property] = 0
let propValue = supportElement.style[property]
let match = propValue.match && propValue.match(UNIT_REG)
if (matc... | javascript | function unitProperty (property, value) {
if (value !== +value) {
return value
}
if (unitCache[property]) {
return value + unitCache[property]
}
supportElement.style[property] = 0
let propValue = supportElement.style[property]
let match = propValue.match && propValue.match(UNIT_REG)
if (matc... | [
"function",
"unitProperty",
"(",
"property",
",",
"value",
")",
"{",
"if",
"(",
"value",
"!==",
"+",
"value",
")",
"{",
"return",
"value",
"}",
"if",
"(",
"unitCache",
"[",
"property",
"]",
")",
"{",
"return",
"value",
"+",
"unitCache",
"[",
"property"... | Obtain the unit of a property and add it to the value has no unit if exists.
@param {string} property property
@param {(string|number)} value A value maybe needs unit.
@return {(string|number)} | [
"Obtain",
"the",
"unit",
"of",
"a",
"property",
"and",
"add",
"it",
"to",
"the",
"value",
"has",
"no",
"unit",
"if",
"exists",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/css.js#L66-L85 |
8,336 | mipengine/mip2 | packages/mip/src/layout.js | isLayoutSizeDefined | function isLayoutSizeDefined (layout) {
return (
layout === LAYOUT.FIXED ||
layout === LAYOUT.FIXED_HEIGHT ||
layout === LAYOUT.RESPONSIVE ||
layout === LAYOUT.FILL ||
layout === LAYOUT.FLEX_ITEM ||
layout === LAYOUT.INTRINSIC
)
} | javascript | function isLayoutSizeDefined (layout) {
return (
layout === LAYOUT.FIXED ||
layout === LAYOUT.FIXED_HEIGHT ||
layout === LAYOUT.RESPONSIVE ||
layout === LAYOUT.FILL ||
layout === LAYOUT.FLEX_ITEM ||
layout === LAYOUT.INTRINSIC
)
} | [
"function",
"isLayoutSizeDefined",
"(",
"layout",
")",
"{",
"return",
"(",
"layout",
"===",
"LAYOUT",
".",
"FIXED",
"||",
"layout",
"===",
"LAYOUT",
".",
"FIXED_HEIGHT",
"||",
"layout",
"===",
"LAYOUT",
".",
"RESPONSIVE",
"||",
"layout",
"===",
"LAYOUT",
"."... | Whether an element with this layout inherently defines the size.
@param {Layout} layout layout name
@return {boolean} | [
"Whether",
"an",
"element",
"with",
"this",
"layout",
"inherently",
"defines",
"the",
"size",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/layout.js#L79-L88 |
8,337 | mipengine/mip2 | packages/mip/src/vue/core/util/options.js | checkComponents | function checkComponents (options) {
for (const key in options.components) {
const lower = key.toLowerCase()
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
)
}
}
} | javascript | function checkComponents (options) {
for (const key in options.components) {
const lower = key.toLowerCase()
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
)
}
}
} | [
"function",
"checkComponents",
"(",
"options",
")",
"{",
"for",
"(",
"const",
"key",
"in",
"options",
".",
"components",
")",
"{",
"const",
"lower",
"=",
"key",
".",
"toLowerCase",
"(",
")",
"if",
"(",
"isBuiltInTag",
"(",
"lower",
")",
"||",
"config",
... | Validate component names | [
"Validate",
"component",
"names"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/vue/core/util/options.js#L277-L287 |
8,338 | mipengine/mip2 | packages/mip/src/base-element.js | lastChildElement | function lastChildElement (parent, callback) {
for (let child = parent.lastElementChild; child; child = child.previousElementSibling) {
if (callback(child)) {
return child
}
}
return null
} | javascript | function lastChildElement (parent, callback) {
for (let child = parent.lastElementChild; child; child = child.previousElementSibling) {
if (callback(child)) {
return child
}
}
return null
} | [
"function",
"lastChildElement",
"(",
"parent",
",",
"callback",
")",
"{",
"for",
"(",
"let",
"child",
"=",
"parent",
".",
"lastElementChild",
";",
"child",
";",
"child",
"=",
"child",
".",
"previousElementSibling",
")",
"{",
"if",
"(",
"callback",
"(",
"ch... | Finds the last child element that satisfies the callback.
@param {!Element} parent
@param {function(!Element):boolean} callback
@return {?Element} | [
"Finds",
"the",
"last",
"child",
"element",
"that",
"satisfies",
"the",
"callback",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/base-element.js#L26-L33 |
8,339 | mipengine/mip2 | packages/mip/src/base-element.js | isInternalNode | function isInternalNode (node) {
let tagName = (typeof node === 'string') ? node : node.tagName
if (tagName && tagName.toLowerCase().indexOf('mip-i-') === 0) {
return true
}
if (node.tagName && (node.hasAttribute('placeholder') ||
node.hasAttribute('fallback') ||
node.hasAttribute('overflow')))... | javascript | function isInternalNode (node) {
let tagName = (typeof node === 'string') ? node : node.tagName
if (tagName && tagName.toLowerCase().indexOf('mip-i-') === 0) {
return true
}
if (node.tagName && (node.hasAttribute('placeholder') ||
node.hasAttribute('fallback') ||
node.hasAttribute('overflow')))... | [
"function",
"isInternalNode",
"(",
"node",
")",
"{",
"let",
"tagName",
"=",
"(",
"typeof",
"node",
"===",
"'string'",
")",
"?",
"node",
":",
"node",
".",
"tagName",
"if",
"(",
"tagName",
"&&",
"tagName",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(... | Returns "true" for internal MIP nodes or for placeholder elements.
@param {!Node} node
@return {boolean} | [
"Returns",
"true",
"for",
"internal",
"MIP",
"nodes",
"or",
"for",
"placeholder",
"elements",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/base-element.js#L40-L52 |
8,340 | mipengine/mip2 | packages/mip/src/util/gesture/index.js | touchHandler | function touchHandler (event) {
let opt = this._opt
opt.preventDefault && event.preventDefault()
opt.stopPropagation && event.stopPropagation()
// 如果 touchstart 没有被触发(可能被子元素的 touchstart 回调触发了 stopPropagation),
// 那么后续的手势将取消计算
if (event.type !== 'touchstart' && !dataProcessor.startTime) {
return
}
... | javascript | function touchHandler (event) {
let opt = this._opt
opt.preventDefault && event.preventDefault()
opt.stopPropagation && event.stopPropagation()
// 如果 touchstart 没有被触发(可能被子元素的 touchstart 回调触发了 stopPropagation),
// 那么后续的手势将取消计算
if (event.type !== 'touchstart' && !dataProcessor.startTime) {
return
}
... | [
"function",
"touchHandler",
"(",
"event",
")",
"{",
"let",
"opt",
"=",
"this",
".",
"_opt",
"opt",
".",
"preventDefault",
"&&",
"event",
".",
"preventDefault",
"(",
")",
"opt",
".",
"stopPropagation",
"&&",
"event",
".",
"stopPropagation",
"(",
")",
"// 如果... | Handle touch event.
@inner
@param {Event} event event | [
"Handle",
"touch",
"event",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/gesture/index.js#L153-L167 |
8,341 | mipengine/mip2 | packages/mip/src/util/gesture/index.js | listenersHelp | function listenersHelp (element, events, handler, method) {
let list = events.split(' ')
for (let i = 0, len = list.length; i < len; i++) {
let item = list[i]
if (method === false) {
element.removeEventListener(item, handler)
} else {
element.addEventListener(item, handler, false)
}
}
... | javascript | function listenersHelp (element, events, handler, method) {
let list = events.split(' ')
for (let i = 0, len = list.length; i < len; i++) {
let item = list[i]
if (method === false) {
element.removeEventListener(item, handler)
} else {
element.addEventListener(item, handler, false)
}
}
... | [
"function",
"listenersHelp",
"(",
"element",
",",
"events",
",",
"handler",
",",
"method",
")",
"{",
"let",
"list",
"=",
"events",
".",
"split",
"(",
"' '",
")",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"len",
"=",
"list",
".",
"length",
";",
"i",
... | Add or remove listeners from an element.
@inner
@param {HTMLElement} element element
@param {string} events Events' name that are splitted by space
@param {Function} handler Event handler
@param {?boolean} method Add or remove. | [
"Add",
"or",
"remove",
"listeners",
"from",
"an",
"element",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/gesture/index.js#L178-L188 |
8,342 | mipengine/mip2 | packages/mip/src/components/mip-bind/watcher.js | flushWatcherQueue | function flushWatcherQueue () {
flushing = true
let watcher
let id
queue.sort((a, b) => a.id - b.id)
for (index = 0; index < queue.length; index++) {
watcher = queue[index]
id = watcher.id
has[id] = null
watcher.run()
// in dev build, check and stop circular updates.
if (process.env.... | javascript | function flushWatcherQueue () {
flushing = true
let watcher
let id
queue.sort((a, b) => a.id - b.id)
for (index = 0; index < queue.length; index++) {
watcher = queue[index]
id = watcher.id
has[id] = null
watcher.run()
// in dev build, check and stop circular updates.
if (process.env.... | [
"function",
"flushWatcherQueue",
"(",
")",
"{",
"flushing",
"=",
"true",
"let",
"watcher",
"let",
"id",
"queue",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"a",
".",
"id",
"-",
"b",
".",
"id",
")",
"for",
"(",
"index",
"=",
"0",
";",
"ind... | Flush queues and run the watchers. | [
"Flush",
"queues",
"and",
"run",
"the",
"watchers",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-bind/watcher.js#L139-L164 |
8,343 | mipengine/mip2 | packages/mip/src/util/dom/event.js | createEvent | function createEvent (type, data) {
let event = document.createEvent(specialEvents[type] || 'Event')
event.initEvent(type, true, true)
data && (event.data = data)
return event
} | javascript | function createEvent (type, data) {
let event = document.createEvent(specialEvents[type] || 'Event')
event.initEvent(type, true, true)
data && (event.data = data)
return event
} | [
"function",
"createEvent",
"(",
"type",
",",
"data",
")",
"{",
"let",
"event",
"=",
"document",
".",
"createEvent",
"(",
"specialEvents",
"[",
"type",
"]",
"||",
"'Event'",
")",
"event",
".",
"initEvent",
"(",
"type",
",",
"true",
",",
"true",
")",
"da... | Create a event object to dispatch
@param {string} type Event name
@param {?Object} data Custom data
@return {Event} | [
"Create",
"a",
"event",
"object",
"to",
"dispatch"
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L42-L47 |
8,344 | mipengine/mip2 | packages/mip/src/util/dom/event.js | listenOnce | function listenOnce (element, eventType, listener, optEvtListenerOpts) {
let unlisten = listen(element, eventType, event => {
unlisten()
listener(event)
}, optEvtListenerOpts)
return unlisten
} | javascript | function listenOnce (element, eventType, listener, optEvtListenerOpts) {
let unlisten = listen(element, eventType, event => {
unlisten()
listener(event)
}, optEvtListenerOpts)
return unlisten
} | [
"function",
"listenOnce",
"(",
"element",
",",
"eventType",
",",
"listener",
",",
"optEvtListenerOpts",
")",
"{",
"let",
"unlisten",
"=",
"listen",
"(",
"element",
",",
"eventType",
",",
"event",
"=>",
"{",
"unlisten",
"(",
")",
"listener",
"(",
"event",
"... | Listens for the specified event on the element and removes the listener
as soon as event has been received.
@param {!EventTarget} element
@param {string} eventType
@param {function(!Event)} listener
@param {Object=} optEvtListenerOpts
@return {!UnlistenDef} | [
"Listens",
"for",
"the",
"specified",
"event",
"on",
"the",
"element",
"and",
"removes",
"the",
"listener",
"as",
"soon",
"as",
"event",
"has",
"been",
"received",
"."
] | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L63-L69 |
8,345 | mipengine/mip2 | packages/mip/src/util/dom/event.js | loadPromise | function loadPromise (eleOrWindow) {
if (isLoaded(eleOrWindow)) {
return Promise.resolve(eleOrWindow)
}
let loadingPromise = new Promise((resolve, reject) => {
// Listen once since IE 5/6/7 fire the onload event continuously for
// animated GIFs.
let {tagName} = eleOrWindow
if (tagName === 'A... | javascript | function loadPromise (eleOrWindow) {
if (isLoaded(eleOrWindow)) {
return Promise.resolve(eleOrWindow)
}
let loadingPromise = new Promise((resolve, reject) => {
// Listen once since IE 5/6/7 fire the onload event continuously for
// animated GIFs.
let {tagName} = eleOrWindow
if (tagName === 'A... | [
"function",
"loadPromise",
"(",
"eleOrWindow",
")",
"{",
"if",
"(",
"isLoaded",
"(",
"eleOrWindow",
")",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"eleOrWindow",
")",
"}",
"let",
"loadingPromise",
"=",
"new",
"Promise",
"(",
"(",
"resolve",
",",
... | Returns a promise that will resolve or fail based on the eleOrWindow's 'load'
and 'error' events. Optionally this method takes a timeout, which will reject
the promise if the resource has not loaded by then.
@param {T} eleOrWindow Supports both Elements and as a special case Windows.
@return {!Promise<T>}
@template T | [
"Returns",
"a",
"promise",
"that",
"will",
"resolve",
"or",
"fail",
"based",
"on",
"the",
"eleOrWindow",
"s",
"load",
"and",
"error",
"events",
".",
"Optionally",
"this",
"method",
"takes",
"a",
"timeout",
"which",
"will",
"reject",
"the",
"promise",
"if",
... | f46dfdd628795d04054667ccd0e89f94e3c73821 | https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L90-L111 |
8,346 | cubehouse/themeparks | lib/merlinparks/chessingtonworldofadventures.js | ParseArea | function ParseArea(obj) {
if (!obj) return;
if (obj.areas) {
for (var i in obj.areas) {
AddRideName(obj.areas[i]);
ParseArea(obj.areas[i]);
}
}
if (obj.items) {
for (var j in obj.items) {
AddRideName(obj.items[j]);
ParseArea(obj.i... | javascript | function ParseArea(obj) {
if (!obj) return;
if (obj.areas) {
for (var i in obj.areas) {
AddRideName(obj.areas[i]);
ParseArea(obj.areas[i]);
}
}
if (obj.items) {
for (var j in obj.items) {
AddRideName(obj.items[j]);
ParseArea(obj.i... | [
"function",
"ParseArea",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
";",
"if",
"(",
"obj",
".",
"areas",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"obj",
".",
"areas",
")",
"{",
"AddRideName",
"(",
"obj",
".",
"areas",
"[",
"i",
... | parse ride names from manually extracted JSON file | [
"parse",
"ride",
"names",
"from",
"manually",
"extracted",
"JSON",
"file"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/lib/merlinparks/chessingtonworldofadventures.js#L14-L31 |
8,347 | cubehouse/themeparks | docs/scripts/sunlight.js | function(context) {
var evaluate = function(rules, createRule) {
var i;
rules = rules || [];
for (i = 0; i < rules.length; i++) {
if (typeof(rules[i]) === "function") {
if (rules[i](context)) {
return defaultHandleToken("named-ident")(context);
}
} else if (createRul... | javascript | function(context) {
var evaluate = function(rules, createRule) {
var i;
rules = rules || [];
for (i = 0; i < rules.length; i++) {
if (typeof(rules[i]) === "function") {
if (rules[i](context)) {
return defaultHandleToken("named-ident")(context);
}
} else if (createRul... | [
"function",
"(",
"context",
")",
"{",
"var",
"evaluate",
"=",
"function",
"(",
"rules",
",",
"createRule",
")",
"{",
"var",
"i",
";",
"rules",
"=",
"rules",
"||",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"rules",
".",
"length",
... | this handles the named ident mayhem | [
"this",
"handles",
"the",
"named",
"ident",
"mayhem"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L65-L87 | |
8,348 | cubehouse/themeparks | docs/scripts/sunlight.js | last | function last(thing) {
return thing.charAt ? thing.charAt(thing.length - 1) : thing[thing.length - 1];
} | javascript | function last(thing) {
return thing.charAt ? thing.charAt(thing.length - 1) : thing[thing.length - 1];
} | [
"function",
"last",
"(",
"thing",
")",
"{",
"return",
"thing",
".",
"charAt",
"?",
"thing",
".",
"charAt",
"(",
"thing",
".",
"length",
"-",
"1",
")",
":",
"thing",
"[",
"thing",
".",
"length",
"-",
"1",
"]",
";",
"}"
] | gets the last character in a string or the last element in an array | [
"gets",
"the",
"last",
"character",
"in",
"a",
"string",
"or",
"the",
"last",
"element",
"in",
"an",
"array"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L254-L256 |
8,349 | cubehouse/themeparks | docs/scripts/sunlight.js | merge | function merge(defaultObject, objectToMerge) {
var key;
if (!objectToMerge) {
return defaultObject;
}
for (key in objectToMerge) {
defaultObject[key] = objectToMerge[key];
}
return defaultObject;
} | javascript | function merge(defaultObject, objectToMerge) {
var key;
if (!objectToMerge) {
return defaultObject;
}
for (key in objectToMerge) {
defaultObject[key] = objectToMerge[key];
}
return defaultObject;
} | [
"function",
"merge",
"(",
"defaultObject",
",",
"objectToMerge",
")",
"{",
"var",
"key",
";",
"if",
"(",
"!",
"objectToMerge",
")",
"{",
"return",
"defaultObject",
";",
"}",
"for",
"(",
"key",
"in",
"objectToMerge",
")",
"{",
"defaultObject",
"[",
"key",
... | non-recursively merges one object into the other | [
"non",
"-",
"recursively",
"merges",
"one",
"object",
"into",
"the",
"other"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L279-L290 |
8,350 | cubehouse/themeparks | docs/scripts/sunlight.js | getNextWhile | function getNextWhile(tokens, index, direction, matcher) {
var count = 1,
token;
direction = direction || 1;
while (token = tokens[index + (direction * count++)]) {
if (!matcher(token)) {
return token;
}
}
return undefined;
} | javascript | function getNextWhile(tokens, index, direction, matcher) {
var count = 1,
token;
direction = direction || 1;
while (token = tokens[index + (direction * count++)]) {
if (!matcher(token)) {
return token;
}
}
return undefined;
} | [
"function",
"getNextWhile",
"(",
"tokens",
",",
"index",
",",
"direction",
",",
"matcher",
")",
"{",
"var",
"count",
"=",
"1",
",",
"token",
";",
"direction",
"=",
"direction",
"||",
"1",
";",
"while",
"(",
"token",
"=",
"tokens",
"[",
"index",
"+",
... | gets the next token in the specified direction while matcher matches the current token | [
"gets",
"the",
"next",
"token",
"in",
"the",
"specified",
"direction",
"while",
"matcher",
"matches",
"the",
"current",
"token"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L424-L436 |
8,351 | cubehouse/themeparks | docs/scripts/sunlight.js | createHashMap | function createHashMap(wordMap, boundary, caseInsensitive) {
//creates a hash table where the hash is the first character of the word
var newMap = { },
i,
word,
firstChar;
for (i = 0; i < wordMap.length; i++) {
word = caseInsensitive ? wordMap[i].toUpperCase() : wordMap[i];
firstChar = word.char... | javascript | function createHashMap(wordMap, boundary, caseInsensitive) {
//creates a hash table where the hash is the first character of the word
var newMap = { },
i,
word,
firstChar;
for (i = 0; i < wordMap.length; i++) {
word = caseInsensitive ? wordMap[i].toUpperCase() : wordMap[i];
firstChar = word.char... | [
"function",
"createHashMap",
"(",
"wordMap",
",",
"boundary",
",",
"caseInsensitive",
")",
"{",
"//creates a hash table where the hash is the first character of the word",
"var",
"newMap",
"=",
"{",
"}",
",",
"i",
",",
"word",
",",
"firstChar",
";",
"for",
"(",
"i",... | this is crucial for performance | [
"this",
"is",
"crucial",
"for",
"performance"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L439-L457 |
8,352 | cubehouse/themeparks | docs/scripts/sunlight.js | switchToEmbeddedLanguageIfNecessary | function switchToEmbeddedLanguageIfNecessary(context) {
var i,
embeddedLanguage;
for (i = 0; i < context.language.embeddedLanguages.length; i++) {
if (!languages[context.language.embeddedLanguages[i].language]) {
//unregistered language
continue;
}
embeddedLanguage = clone(conte... | javascript | function switchToEmbeddedLanguageIfNecessary(context) {
var i,
embeddedLanguage;
for (i = 0; i < context.language.embeddedLanguages.length; i++) {
if (!languages[context.language.embeddedLanguages[i].language]) {
//unregistered language
continue;
}
embeddedLanguage = clone(conte... | [
"function",
"switchToEmbeddedLanguageIfNecessary",
"(",
"context",
")",
"{",
"var",
"i",
",",
"embeddedLanguage",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"context",
".",
"language",
".",
"embeddedLanguages",
".",
"length",
";",
"i",
"++",
")",
"{",
... | called before processing the current | [
"called",
"before",
"processing",
"the",
"current"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L724-L744 |
8,353 | cubehouse/themeparks | docs/scripts/sunlight.js | switchBackFromEmbeddedLanguageIfNecessary | function switchBackFromEmbeddedLanguageIfNecessary(context) {
var current = last(context.embeddedLanguageStack),
lang;
if (current && current.switchBack(context)) {
context.language = languages[current.parentLanguage];
lang = context.embeddedLanguageStack.pop();
//restore old items
co... | javascript | function switchBackFromEmbeddedLanguageIfNecessary(context) {
var current = last(context.embeddedLanguageStack),
lang;
if (current && current.switchBack(context)) {
context.language = languages[current.parentLanguage];
lang = context.embeddedLanguageStack.pop();
//restore old items
co... | [
"function",
"switchBackFromEmbeddedLanguageIfNecessary",
"(",
"context",
")",
"{",
"var",
"current",
"=",
"last",
"(",
"context",
".",
"embeddedLanguageStack",
")",
",",
"lang",
";",
"if",
"(",
"current",
"&&",
"current",
".",
"switchBack",
"(",
"context",
")",
... | called after processing the current | [
"called",
"after",
"processing",
"the",
"current"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L747-L759 |
8,354 | cubehouse/themeparks | docs/scripts/sunlight.js | highlightRecursive | function highlightRecursive(node) {
var match,
languageId,
currentNodeCount,
j,
nodes,
k,
partialContext,
container,
codeContainer;
if (this.isAlreadyHighlighted(node) || (match = this.matchSunlightNode(node)) === null) {
return;
}
languageId = match[1]... | javascript | function highlightRecursive(node) {
var match,
languageId,
currentNodeCount,
j,
nodes,
k,
partialContext,
container,
codeContainer;
if (this.isAlreadyHighlighted(node) || (match = this.matchSunlightNode(node)) === null) {
return;
}
languageId = match[1]... | [
"function",
"highlightRecursive",
"(",
"node",
")",
"{",
"var",
"match",
",",
"languageId",
",",
"currentNodeCount",
",",
"j",
",",
"nodes",
",",
"k",
",",
"partialContext",
",",
"container",
",",
"codeContainer",
";",
"if",
"(",
"this",
".",
"isAlreadyHighl... | recursively highlights a DOM node | [
"recursively",
"highlights",
"a",
"DOM",
"node"
] | 0667da6b5c2e178d66257f0090f6cd5a77a003c6 | https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L994-L1064 |
8,355 | leaflet-extras/leaflet-providers | leaflet-providers.js | function (attr) {
if (attr.indexOf('{attribution.') === -1) {
return attr;
}
return attr.replace(/\{attribution.(\w*)\}/,
function (match, attributionName) {
return attributionReplacer(providers[attributionName].options.attribution);
}
);
} | javascript | function (attr) {
if (attr.indexOf('{attribution.') === -1) {
return attr;
}
return attr.replace(/\{attribution.(\w*)\}/,
function (match, attributionName) {
return attributionReplacer(providers[attributionName].options.attribution);
}
);
} | [
"function",
"(",
"attr",
")",
"{",
"if",
"(",
"attr",
".",
"indexOf",
"(",
"'{attribution.'",
")",
"===",
"-",
"1",
")",
"{",
"return",
"attr",
";",
"}",
"return",
"attr",
".",
"replace",
"(",
"/",
"\\{attribution.(\\w*)\\}",
"/",
",",
"function",
"(",... | replace attribution placeholders with their values from toplevel provider attribution, recursively | [
"replace",
"attribution",
"placeholders",
"with",
"their",
"values",
"from",
"toplevel",
"provider",
"attribution",
"recursively"
] | 2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4 | https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/leaflet-providers.js#L55-L64 | |
8,356 | leaflet-extras/leaflet-providers | preview/vendor/leaflet.draw-src.js | function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x);
} | javascript | function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x);
} | [
"function",
"(",
"/*Point*/",
"p",
",",
"/*Point*/",
"p1",
",",
"/*Point*/",
"p2",
")",
"{",
"return",
"(",
"p2",
".",
"y",
"-",
"p",
".",
"y",
")",
"*",
"(",
"p1",
".",
"x",
"-",
"p",
".",
"x",
")",
">",
"(",
"p1",
".",
"y",
"-",
"p",
".... | check to see if points are in counterclockwise order | [
"check",
"to",
"see",
"if",
"points",
"are",
"in",
"counterclockwise",
"order"
] | 2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4 | https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L1847-L1849 | |
8,357 | leaflet-extras/leaflet-providers | preview/vendor/leaflet.draw-src.js | function (p, p1, maxIndex, minIndex) {
var points = this._originalPoints,
p2, p3;
minIndex = minIndex || 0;
// Check all previous line segments (beside the immediately previous) for intersections
for (var j = maxIndex; j > minIndex; j--) {
p2 = points[j - 1];
p3 = points[j];
if (L.LineUtil.segmen... | javascript | function (p, p1, maxIndex, minIndex) {
var points = this._originalPoints,
p2, p3;
minIndex = minIndex || 0;
// Check all previous line segments (beside the immediately previous) for intersections
for (var j = maxIndex; j > minIndex; j--) {
p2 = points[j - 1];
p3 = points[j];
if (L.LineUtil.segmen... | [
"function",
"(",
"p",
",",
"p1",
",",
"maxIndex",
",",
"minIndex",
")",
"{",
"var",
"points",
"=",
"this",
".",
"_originalPoints",
",",
"p2",
",",
"p3",
";",
"minIndex",
"=",
"minIndex",
"||",
"0",
";",
"// Check all previous line segments (beside the immediat... | Checks a line segment intersections with any line segments before its predecessor. Don't need to check the predecessor as will never intersect. | [
"Checks",
"a",
"line",
"segment",
"intersections",
"with",
"any",
"line",
"segments",
"before",
"its",
"predecessor",
".",
"Don",
"t",
"need",
"to",
"check",
"the",
"predecessor",
"as",
"will",
"never",
"intersect",
"."
] | 2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4 | https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L1918-L1935 | |
8,358 | leaflet-extras/leaflet-providers | preview/vendor/leaflet.draw-src.js | function (handler) {
return [
{
enabled: handler.deleteLastVertex,
title: L.drawLocal.draw.toolbar.undo.title,
text: L.drawLocal.draw.toolbar.undo.text,
callback: handler.deleteLastVertex,
context: handler
},
{
title: L.drawLocal.draw.toolbar.actions.title,
text: L.drawLocal.draw.... | javascript | function (handler) {
return [
{
enabled: handler.deleteLastVertex,
title: L.drawLocal.draw.toolbar.undo.title,
text: L.drawLocal.draw.toolbar.undo.text,
callback: handler.deleteLastVertex,
context: handler
},
{
title: L.drawLocal.draw.toolbar.actions.title,
text: L.drawLocal.draw.... | [
"function",
"(",
"handler",
")",
"{",
"return",
"[",
"{",
"enabled",
":",
"handler",
".",
"deleteLastVertex",
",",
"title",
":",
"L",
".",
"drawLocal",
".",
"draw",
".",
"toolbar",
".",
"undo",
".",
"title",
",",
"text",
":",
"L",
".",
"drawLocal",
"... | Get the actions part of the toolbar | [
"Get",
"the",
"actions",
"part",
"of",
"the",
"toolbar"
] | 2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4 | https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L2444-L2460 | |
8,359 | leaflet-extras/leaflet-providers | preview/preview.js | function (providerName) {
if (providerName === 'ignored') {
return true;
}
// reduce the number of layers previewed for some providers
if (providerName.startsWith('HERE') || providerName.startsWith('OpenWeatherMap') || providerName.startsWith('MapBox')) {
var whitelist = [
// API threshold almost reac... | javascript | function (providerName) {
if (providerName === 'ignored') {
return true;
}
// reduce the number of layers previewed for some providers
if (providerName.startsWith('HERE') || providerName.startsWith('OpenWeatherMap') || providerName.startsWith('MapBox')) {
var whitelist = [
// API threshold almost reac... | [
"function",
"(",
"providerName",
")",
"{",
"if",
"(",
"providerName",
"===",
"'ignored'",
")",
"{",
"return",
"true",
";",
"}",
"// reduce the number of layers previewed for some providers",
"if",
"(",
"providerName",
".",
"startsWith",
"(",
"'HERE'",
")",
"||",
"... | Ignore some providers in the preview | [
"Ignore",
"some",
"providers",
"in",
"the",
"preview"
] | 2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4 | https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/preview.js#L76-L92 | |
8,360 | MMF-FE/vue-svgicon | dist/lib/build.js | compile | function compile(content, data) {
return content.replace(/\${(\w+)}/gi, function (match, name) {
return data[name] ? data[name] : '';
});
} | javascript | function compile(content, data) {
return content.replace(/\${(\w+)}/gi, function (match, name) {
return data[name] ? data[name] : '';
});
} | [
"function",
"compile",
"(",
"content",
",",
"data",
")",
"{",
"return",
"content",
".",
"replace",
"(",
"/",
"\\${(\\w+)}",
"/",
"gi",
",",
"function",
"(",
"match",
",",
"name",
")",
"{",
"return",
"data",
"[",
"name",
"]",
"?",
"data",
"[",
"name",... | simple template compile | [
"simple",
"template",
"compile"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L84-L88 |
8,361 | MMF-FE/vue-svgicon | dist/lib/build.js | getFilePath | function getFilePath(sourcePath, filename, subDir) {
if (subDir === void 0) { subDir = ''; }
var filePath = filename
.replace(path.resolve(sourcePath), '')
.replace(path.basename(filename), '');
if (subDir) {
filePath = filePath.replace(subDir + path.sep, '');
}
if (/^[\/\\]/... | javascript | function getFilePath(sourcePath, filename, subDir) {
if (subDir === void 0) { subDir = ''; }
var filePath = filename
.replace(path.resolve(sourcePath), '')
.replace(path.basename(filename), '');
if (subDir) {
filePath = filePath.replace(subDir + path.sep, '');
}
if (/^[\/\\]/... | [
"function",
"getFilePath",
"(",
"sourcePath",
",",
"filename",
",",
"subDir",
")",
"{",
"if",
"(",
"subDir",
"===",
"void",
"0",
")",
"{",
"subDir",
"=",
"''",
";",
"}",
"var",
"filePath",
"=",
"filename",
".",
"replace",
"(",
"path",
".",
"resolve",
... | get file path by filename | [
"get",
"file",
"path",
"by",
"filename"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L90-L102 |
8,362 | MMF-FE/vue-svgicon | dist/lib/build.js | generateIndex | function generateIndex(opts, files, subDir) {
if (subDir === void 0) { subDir = ''; }
var shouldExport = opts.export;
var isES6 = opts.es6;
var content = '';
var dirMap = {};
switch (opts.ext) {
case 'js':
content += '/* eslint-disable */\n';
break;
case '... | javascript | function generateIndex(opts, files, subDir) {
if (subDir === void 0) { subDir = ''; }
var shouldExport = opts.export;
var isES6 = opts.es6;
var content = '';
var dirMap = {};
switch (opts.ext) {
case 'js':
content += '/* eslint-disable */\n';
break;
case '... | [
"function",
"generateIndex",
"(",
"opts",
",",
"files",
",",
"subDir",
")",
"{",
"if",
"(",
"subDir",
"===",
"void",
"0",
")",
"{",
"subDir",
"=",
"''",
";",
"}",
"var",
"shouldExport",
"=",
"opts",
".",
"export",
";",
"var",
"isES6",
"=",
"opts",
... | generate index.js, which import all icons | [
"generate",
"index",
".",
"js",
"which",
"import",
"all",
"icons"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L104-L163 |
8,363 | MMF-FE/vue-svgicon | dist/lib/build.js | getSvgoConfig | function getSvgoConfig(svgo) {
if (!svgo) {
return require('../../default/svgo');
}
else if (typeof svgo === 'string') {
return require(path.join(process.cwd(), svgo));
}
else {
return svgo;
}
} | javascript | function getSvgoConfig(svgo) {
if (!svgo) {
return require('../../default/svgo');
}
else if (typeof svgo === 'string') {
return require(path.join(process.cwd(), svgo));
}
else {
return svgo;
}
} | [
"function",
"getSvgoConfig",
"(",
"svgo",
")",
"{",
"if",
"(",
"!",
"svgo",
")",
"{",
"return",
"require",
"(",
"'../../default/svgo'",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"svgo",
"===",
"'string'",
")",
"{",
"return",
"require",
"(",
"path",
"... | get svgo config | [
"get",
"svgo",
"config"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L165-L175 |
8,364 | MMF-FE/vue-svgicon | dist/lib/build.js | getViewBox | function getViewBox(svgoResult) {
var viewBoxMatch = svgoResult.data.match(/viewBox="([-\d\.]+\s[-\d\.]+\s[-\d\.]+\s[-\d\.]+)"/);
var viewBox = '0 0 200 200';
if (viewBoxMatch && viewBoxMatch.length > 1) {
viewBox = viewBoxMatch[1];
}
else if (svgoResult.info.height && svgoResult.info.width)... | javascript | function getViewBox(svgoResult) {
var viewBoxMatch = svgoResult.data.match(/viewBox="([-\d\.]+\s[-\d\.]+\s[-\d\.]+\s[-\d\.]+)"/);
var viewBox = '0 0 200 200';
if (viewBoxMatch && viewBoxMatch.length > 1) {
viewBox = viewBoxMatch[1];
}
else if (svgoResult.info.height && svgoResult.info.width)... | [
"function",
"getViewBox",
"(",
"svgoResult",
")",
"{",
"var",
"viewBoxMatch",
"=",
"svgoResult",
".",
"data",
".",
"match",
"(",
"/",
"viewBox=\"([-\\d\\.]+\\s[-\\d\\.]+\\s[-\\d\\.]+\\s[-\\d\\.]+)\"",
"/",
")",
";",
"var",
"viewBox",
"=",
"'0 0 200 200'",
";",
"if",... | get svg viewbox | [
"get",
"svg",
"viewbox"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L177-L187 |
8,365 | MMF-FE/vue-svgicon | dist/lib/build.js | addPid | function addPid(content) {
var shapeReg = /<(path|rect|circle|polygon|line|polyline|ellipse)\s/gi;
var id = 0;
content = content.replace(shapeReg, function (match) {
return match + ("pid=\"" + id++ + "\" ");
});
return content;
} | javascript | function addPid(content) {
var shapeReg = /<(path|rect|circle|polygon|line|polyline|ellipse)\s/gi;
var id = 0;
content = content.replace(shapeReg, function (match) {
return match + ("pid=\"" + id++ + "\" ");
});
return content;
} | [
"function",
"addPid",
"(",
"content",
")",
"{",
"var",
"shapeReg",
"=",
"/",
"<(path|rect|circle|polygon|line|polyline|ellipse)\\s",
"/",
"gi",
";",
"var",
"id",
"=",
"0",
";",
"content",
"=",
"content",
".",
"replace",
"(",
"shapeReg",
",",
"function",
"(",
... | add pid attr, for css | [
"add",
"pid",
"attr",
"for",
"css"
] | 1c5bc46d2e869acd0f962491fea267c086cbc3ce | https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L189-L196 |
8,366 | GoogleChrome/accessibility-developer-tools | src/js/AccessibilityUtils.js | getHtmlInfo | function getHtmlInfo(element) {
if (!element)
return null;
var tagName = element.tagName;
if (!tagName)
return null;
tagName = tagName.toUpperCase();
var infos = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[tagName];
if (!infos || !infos.length)
... | javascript | function getHtmlInfo(element) {
if (!element)
return null;
var tagName = element.tagName;
if (!tagName)
return null;
tagName = tagName.toUpperCase();
var infos = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[tagName];
if (!infos || !infos.length)
... | [
"function",
"getHtmlInfo",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
")",
"return",
"null",
";",
"var",
"tagName",
"=",
"element",
".",
"tagName",
";",
"if",
"(",
"!",
"tagName",
")",
"return",
"null",
";",
"tagName",
"=",
"tagName",
".",
... | Helper for implicit semantic functionality.
Can be made part of the public API if need be.
@param {Element} element
@return {?axs.constants.HtmlInfo} | [
"Helper",
"for",
"implicit",
"semantic",
"functionality",
".",
"Can",
"be",
"made",
"part",
"of",
"the",
"public",
"API",
"if",
"need",
"be",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/AccessibilityUtils.js#L667-L688 |
8,367 | GoogleChrome/accessibility-developer-tools | src/audits/RequiredOwnedAriaRoleMissing.js | getRequired | function getRequired(element) {
var elementRole = axs.utils.getRoles(element);
if (!elementRole || !elementRole.applied)
return [];
var appliedRole = elementRole.applied;
if (!appliedRole.valid)
return [];
return appliedRole.details['mustcontain'] || [];
... | javascript | function getRequired(element) {
var elementRole = axs.utils.getRoles(element);
if (!elementRole || !elementRole.applied)
return [];
var appliedRole = elementRole.applied;
if (!appliedRole.valid)
return [];
return appliedRole.details['mustcontain'] || [];
... | [
"function",
"getRequired",
"(",
"element",
")",
"{",
"var",
"elementRole",
"=",
"axs",
".",
"utils",
".",
"getRoles",
"(",
"element",
")",
";",
"if",
"(",
"!",
"elementRole",
"||",
"!",
"elementRole",
".",
"applied",
")",
"return",
"[",
"]",
";",
"var"... | Get a list of the roles this element must contain, if any, based on its ARIA role.
@param {Element} element A DOM element.
@return {Array.<string>} The roles this element must contain. | [
"Get",
"a",
"list",
"of",
"the",
"roles",
"this",
"element",
"must",
"contain",
"if",
"any",
"based",
"on",
"its",
"ARIA",
"role",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/RequiredOwnedAriaRoleMissing.js#L75-L83 |
8,368 | GoogleChrome/accessibility-developer-tools | src/audits/TableHasAppropriateHeaders.js | tableDoesNotHaveHeaderRow | function tableDoesNotHaveHeaderRow(rows) {
var headerRow = rows[0];
var headerCells = headerRow.children;
for (var i = 0; i < headerCells.length; i++) {
if (headerCells[i].tagName != 'TH') {
return true;
}
}
return false;
} | javascript | function tableDoesNotHaveHeaderRow(rows) {
var headerRow = rows[0];
var headerCells = headerRow.children;
for (var i = 0; i < headerCells.length; i++) {
if (headerCells[i].tagName != 'TH') {
return true;
}
}
return false;
} | [
"function",
"tableDoesNotHaveHeaderRow",
"(",
"rows",
")",
"{",
"var",
"headerRow",
"=",
"rows",
"[",
"0",
"]",
";",
"var",
"headerCells",
"=",
"headerRow",
".",
"children",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"headerCells",
".",
"len... | Checks for a header row in a table.
@param {NodeList} rows tr elements
@returns {boolean} Table does not have a complete header row | [
"Checks",
"for",
"a",
"header",
"row",
"in",
"a",
"table",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L26-L37 |
8,369 | GoogleChrome/accessibility-developer-tools | src/audits/TableHasAppropriateHeaders.js | tableDoesNotHaveHeaderColumn | function tableDoesNotHaveHeaderColumn(rows) {
for (var i = 0; i < rows.length; i++) {
if (rows[i].children[0].tagName != 'TH') {
return true;
}
}
return false;
} | javascript | function tableDoesNotHaveHeaderColumn(rows) {
for (var i = 0; i < rows.length; i++) {
if (rows[i].children[0].tagName != 'TH') {
return true;
}
}
return false;
} | [
"function",
"tableDoesNotHaveHeaderColumn",
"(",
"rows",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"rows",
"[",
"i",
"]",
".",
"children",
"[",
"0",
"]",
".",
"tagName",... | Checks for a header column in a table.
@param {NodeList} rows tr elements
@returns {boolean} Table does not have a complete header column | [
"Checks",
"for",
"a",
"header",
"column",
"in",
"a",
"table",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L45-L52 |
8,370 | GoogleChrome/accessibility-developer-tools | src/audits/TableHasAppropriateHeaders.js | tableDoesNotHaveGridLayout | function tableDoesNotHaveGridLayout(rows) {
var headerCells = rows[0].children;
for (var i = 1; i < headerCells.length; i++) {
if (headerCells[i].tagName != 'TH') {
return true;
}
}
for (var i = 1; i < rows.length; i++) {
if (rows[i].... | javascript | function tableDoesNotHaveGridLayout(rows) {
var headerCells = rows[0].children;
for (var i = 1; i < headerCells.length; i++) {
if (headerCells[i].tagName != 'TH') {
return true;
}
}
for (var i = 1; i < rows.length; i++) {
if (rows[i].... | [
"function",
"tableDoesNotHaveGridLayout",
"(",
"rows",
")",
"{",
"var",
"headerCells",
"=",
"rows",
"[",
"0",
"]",
".",
"children",
";",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"headerCells",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
... | Checks whether a table has grid layout with both row and column headers.
@param {NodeList} rows tr elements
@returns {boolean} Table does not have a complete grid layout | [
"Checks",
"whether",
"a",
"table",
"has",
"grid",
"layout",
"with",
"both",
"row",
"and",
"column",
"headers",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L60-L75 |
8,371 | GoogleChrome/accessibility-developer-tools | src/audits/TableHasAppropriateHeaders.js | isLayoutTable | function isLayoutTable(element) {
if (element.childElementCount == 0) {
return true;
}
if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') {
return false;
}
if (element.getAttribute('role') == 'presentation') {
... | javascript | function isLayoutTable(element) {
if (element.childElementCount == 0) {
return true;
}
if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') {
return false;
}
if (element.getAttribute('role') == 'presentation') {
... | [
"function",
"isLayoutTable",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"childElementCount",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"element",
".",
"hasAttribute",
"(",
"'role'",
")",
"&&",
"element",
".",
"getAttribute",
"... | Checks whether a table is a layout table.
@returns {boolean} Table is a layout table | [
"Checks",
"whether",
"a",
"table",
"is",
"a",
"layout",
"table",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L82-L105 |
8,372 | GoogleChrome/accessibility-developer-tools | src/js/Properties.js | hasDirectTextDescendantXpath | function hasDirectTextDescendantXpath() {
var selectorResults = ownerDocument.evaluate(axs.properties.TEXT_CONTENT_XPATH,
element,
null,
XPathResult.ANY_... | javascript | function hasDirectTextDescendantXpath() {
var selectorResults = ownerDocument.evaluate(axs.properties.TEXT_CONTENT_XPATH,
element,
null,
XPathResult.ANY_... | [
"function",
"hasDirectTextDescendantXpath",
"(",
")",
"{",
"var",
"selectorResults",
"=",
"ownerDocument",
".",
"evaluate",
"(",
"axs",
".",
"properties",
".",
"TEXT_CONTENT_XPATH",
",",
"element",
",",
"null",
",",
"XPathResult",
".",
"ANY_TYPE",
",",
"null",
"... | Determines whether element has a text node as a direct descendant.
This method uses XPath on HTML DOM which is not universally supported.
@return {boolean} | [
"Determines",
"whether",
"element",
"has",
"a",
"text",
"node",
"as",
"a",
"direct",
"descendant",
".",
"This",
"method",
"uses",
"XPath",
"on",
"HTML",
"DOM",
"which",
"is",
"not",
"universally",
"supported",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Properties.js#L148-L162 |
8,373 | GoogleChrome/accessibility-developer-tools | src/js/Audit.js | function(auditRuleName, selectors) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
if (!('ignore' in this.rules_[auditRuleName]))
this.rules_[auditRuleName].ignore = [];
Array.prototype.push.call(this.rules_[auditRuleName].ignore, selectors);
} | javascript | function(auditRuleName, selectors) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
if (!('ignore' in this.rules_[auditRuleName]))
this.rules_[auditRuleName].ignore = [];
Array.prototype.push.call(this.rules_[auditRuleName].ignore, selectors);
} | [
"function",
"(",
"auditRuleName",
",",
"selectors",
")",
"{",
"if",
"(",
"!",
"(",
"auditRuleName",
"in",
"this",
".",
"rules_",
")",
")",
"this",
".",
"rules_",
"[",
"auditRuleName",
"]",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"'ignore'",
"in",
... | Add the given selectors to the ignore list for the given audit rule.
@param {string} auditRuleName The name of the audit rule
@param {Array.<string>} selectors Query selectors to match nodes to
ignore | [
"Add",
"the",
"given",
"selectors",
"to",
"the",
"ignore",
"list",
"for",
"the",
"given",
"audit",
"rule",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L134-L140 | |
8,374 | GoogleChrome/accessibility-developer-tools | src/js/Audit.js | function(auditRuleName, severity) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
this.rules_[auditRuleName].severity = severity;
} | javascript | function(auditRuleName, severity) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
this.rules_[auditRuleName].severity = severity;
} | [
"function",
"(",
"auditRuleName",
",",
"severity",
")",
"{",
"if",
"(",
"!",
"(",
"auditRuleName",
"in",
"this",
".",
"rules_",
")",
")",
"this",
".",
"rules_",
"[",
"auditRuleName",
"]",
"=",
"{",
"}",
";",
"this",
".",
"rules_",
"[",
"auditRuleName",... | Sets the user-specified severity for the given audit rule. This will
replace the default severity for that audit rule in the audit results.
@param {string} auditRuleName
@param {axs.constants.Severity} severity | [
"Sets",
"the",
"user",
"-",
"specified",
"severity",
"for",
"the",
"given",
"audit",
"rule",
".",
"This",
"will",
"replace",
"the",
"default",
"severity",
"for",
"that",
"audit",
"rule",
"in",
"the",
"audit",
"results",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L163-L167 | |
8,375 | GoogleChrome/accessibility-developer-tools | src/js/Audit.js | function(auditRuleName, config) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
this.rules_[auditRuleName].config = config;
} | javascript | function(auditRuleName, config) {
if (!(auditRuleName in this.rules_))
this.rules_[auditRuleName] = {};
this.rules_[auditRuleName].config = config;
} | [
"function",
"(",
"auditRuleName",
",",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"auditRuleName",
"in",
"this",
".",
"rules_",
")",
")",
"this",
".",
"rules_",
"[",
"auditRuleName",
"]",
"=",
"{",
"}",
";",
"this",
".",
"rules_",
"[",
"auditRuleName",
... | Sets the user-specified configuration for the given audit rule. This will
vary in structure from rule to rule; see individual rules for
configuration options.
@param {string} auditRuleName
@param {Object} config | [
"Sets",
"the",
"user",
"-",
"specified",
"configuration",
"for",
"the",
"given",
"audit",
"rule",
".",
"This",
"will",
"vary",
"in",
"structure",
"from",
"rule",
"to",
"rule",
";",
"see",
"individual",
"rules",
"for",
"configuration",
"options",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L184-L188 | |
8,376 | GoogleChrome/accessibility-developer-tools | src/js/Audit.js | function(auditRuleName) {
if (!(auditRuleName in this.rules_))
return null;
if (!('config' in this.rules_[auditRuleName]))
return null;
return this.rules_[auditRuleName].config;
} | javascript | function(auditRuleName) {
if (!(auditRuleName in this.rules_))
return null;
if (!('config' in this.rules_[auditRuleName]))
return null;
return this.rules_[auditRuleName].config;
} | [
"function",
"(",
"auditRuleName",
")",
"{",
"if",
"(",
"!",
"(",
"auditRuleName",
"in",
"this",
".",
"rules_",
")",
")",
"return",
"null",
";",
"if",
"(",
"!",
"(",
"'config'",
"in",
"this",
".",
"rules_",
"[",
"auditRuleName",
"]",
")",
")",
"return... | Gets the user-specified configuration for the given audit rule.
@param {string} auditRuleName
@return {Object?} The configuration object for the given audit rule. | [
"Gets",
"the",
"user",
"-",
"specified",
"configuration",
"for",
"the",
"given",
"audit",
"rule",
"."
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L195-L201 | |
8,377 | GoogleChrome/accessibility-developer-tools | src/audits/UncontrolledTabpanel.js | labeledByATab | function labeledByATab(element) {
if (element.hasAttribute('aria-labelledby')) {
var labelingElements = document.querySelectorAll('#' + element.getAttribute('aria-labelledby'));
return labelingElements.length === 1 && labelingElements[0].getAttribute('role') === 'tab';
}
... | javascript | function labeledByATab(element) {
if (element.hasAttribute('aria-labelledby')) {
var labelingElements = document.querySelectorAll('#' + element.getAttribute('aria-labelledby'));
return labelingElements.length === 1 && labelingElements[0].getAttribute('role') === 'tab';
}
... | [
"function",
"labeledByATab",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"hasAttribute",
"(",
"'aria-labelledby'",
")",
")",
"{",
"var",
"labelingElements",
"=",
"document",
".",
"querySelectorAll",
"(",
"'#'",
"+",
"element",
".",
"getAttribute",
"("... | Checks if the tabpanel is labeled by a tab
@param {Element} element the tabpanel element
@returns {boolean} the tabpanel has an aria-labelledby with the id of a tab | [
"Checks",
"if",
"the",
"tabpanel",
"is",
"labeled",
"by",
"a",
"tab"
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/UncontrolledTabpanel.js#L26-L32 |
8,378 | GoogleChrome/accessibility-developer-tools | src/audits/UncontrolledTabpanel.js | controlledByATab | function controlledByATab(element) {
var controlledBy = document.querySelectorAll('[role="tab"][aria-controls="' + element.id + '"]')
return element.id && (controlledBy.length === 1);
} | javascript | function controlledByATab(element) {
var controlledBy = document.querySelectorAll('[role="tab"][aria-controls="' + element.id + '"]')
return element.id && (controlledBy.length === 1);
} | [
"function",
"controlledByATab",
"(",
"element",
")",
"{",
"var",
"controlledBy",
"=",
"document",
".",
"querySelectorAll",
"(",
"'[role=\"tab\"][aria-controls=\"'",
"+",
"element",
".",
"id",
"+",
"'\"]'",
")",
"return",
"element",
".",
"id",
"&&",
"(",
"control... | Checks if the tabpanel is controlled by a tab
@param {Element} element the tabpanel element
@returns {*|boolean} | [
"Checks",
"if",
"the",
"tabpanel",
"is",
"controlled",
"by",
"a",
"tab"
] | 3d7c96bf34b3146f40aeb2720e0927f221ad8725 | https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/UncontrolledTabpanel.js#L39-L42 |
8,379 | NekR/offline-plugin | lib/misc/utils.js | arrowFnToNormalFn | function arrowFnToNormalFn(string) {
var match = string.match(/^([\s\S]+?)=\>(\s*{)?([\s\S]*?)(}\s*)?$/);
if (!match) {
return string;
}
var args = match[1];
var body = match[3];
var needsReturn = !(match[2] && match[4]);
args = args.replace(/^(\s*\(\s*)([\s\S]*?)(\s*\)\s*)$/, '$2');
if (needsR... | javascript | function arrowFnToNormalFn(string) {
var match = string.match(/^([\s\S]+?)=\>(\s*{)?([\s\S]*?)(}\s*)?$/);
if (!match) {
return string;
}
var args = match[1];
var body = match[3];
var needsReturn = !(match[2] && match[4]);
args = args.replace(/^(\s*\(\s*)([\s\S]*?)(\s*\)\s*)$/, '$2');
if (needsR... | [
"function",
"arrowFnToNormalFn",
"(",
"string",
")",
"{",
"var",
"match",
"=",
"string",
".",
"match",
"(",
"/",
"^([\\s\\S]+?)=\\>(\\s*{)?([\\s\\S]*?)(}\\s*)?$",
"/",
")",
";",
"if",
"(",
"!",
"match",
")",
"{",
"return",
"string",
";",
"}",
"var",
"args",
... | Migrate to separate npm-package with full tests | [
"Migrate",
"to",
"separate",
"npm",
"-",
"package",
"with",
"full",
"tests"
] | 71fb6f79da114125e6cb852fa00bb39645349afd | https://github.com/NekR/offline-plugin/blob/71fb6f79da114125e6cb852fa00bb39645349afd/lib/misc/utils.js#L98-L117 |
8,380 | embark-framework/embark | packages/embark/src/lib/utils/debug_util.js | extend | function extend(filename, async) {
if (async._waterfall !== undefined) {
return;
}
async._waterfall = async.waterfall;
async.waterfall = function (_tasks, callback) {
let tasks = _tasks.map(function (t) {
let fn = function () {
console.log("async " + filename + ": " + t.name);
t.ap... | javascript | function extend(filename, async) {
if (async._waterfall !== undefined) {
return;
}
async._waterfall = async.waterfall;
async.waterfall = function (_tasks, callback) {
let tasks = _tasks.map(function (t) {
let fn = function () {
console.log("async " + filename + ": " + t.name);
t.ap... | [
"function",
"extend",
"(",
"filename",
",",
"async",
")",
"{",
"if",
"(",
"async",
".",
"_waterfall",
"!==",
"undefined",
")",
"{",
"return",
";",
"}",
"async",
".",
"_waterfall",
"=",
"async",
".",
"waterfall",
";",
"async",
".",
"waterfall",
"=",
"fu... | util to map async method names | [
"util",
"to",
"map",
"async",
"method",
"names"
] | 8b9441967012aefb2349a65623237923c99ec9dc | https://github.com/embark-framework/embark/blob/8b9441967012aefb2349a65623237923c99ec9dc/packages/embark/src/lib/utils/debug_util.js#L3-L18 |
8,381 | googleapis/nodejs-pubsub | samples/subscriptions.js | worker | function worker(message) {
console.log(`Processing "${message.message.data}"...`);
setTimeout(() => {
console.log(`Finished procesing "${message.message.data}".`);
isProcessed = true;
}, 30000);
} | javascript | function worker(message) {
console.log(`Processing "${message.message.data}"...`);
setTimeout(() => {
console.log(`Finished procesing "${message.message.data}".`);
isProcessed = true;
}, 30000);
} | [
"function",
"worker",
"(",
"message",
")",
"{",
"console",
".",
"log",
"(",
"`",
"${",
"message",
".",
"message",
".",
"data",
"}",
"`",
")",
";",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"console",
".",
"log",
"(",
"`",
"${",
"message",
".",
"mes... | The worker function is meant to be non-blocking. It starts a long- running process, such as writing the message to a table, which may take longer than the default 10-sec acknowledge deadline. | [
"The",
"worker",
"function",
"is",
"meant",
"to",
"be",
"non",
"-",
"blocking",
".",
"It",
"starts",
"a",
"long",
"-",
"running",
"process",
"such",
"as",
"writing",
"the",
"message",
"to",
"a",
"table",
"which",
"may",
"take",
"longer",
"than",
"the",
... | 22dc668ec16a26b4807ab12afd35356e118e34d1 | https://github.com/googleapis/nodejs-pubsub/blob/22dc668ec16a26b4807ab12afd35356e118e34d1/samples/subscriptions.js#L299-L306 |
8,382 | woocommerce/FlexSlider | bower_components/jquery/src/manipulation.js | setGlobalEval | function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
} | javascript | function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
} | [
"function",
"setGlobalEval",
"(",
"elems",
",",
"refElements",
")",
"{",
"var",
"elem",
",",
"i",
"=",
"0",
";",
"for",
"(",
";",
"(",
"elem",
"=",
"elems",
"[",
"i",
"]",
")",
"!=",
"null",
";",
"i",
"++",
")",
"{",
"jQuery",
".",
"_data",
"("... | Mark scripts as having already been evaluated | [
"Mark",
"scripts",
"as",
"having",
"already",
"been",
"evaluated"
] | 690832b7f972298e76e2965714657a2beec9e35c | https://github.com/woocommerce/FlexSlider/blob/690832b7f972298e76e2965714657a2beec9e35c/bower_components/jquery/src/manipulation.js#L126-L132 |
8,383 | apiaryio/dredd | lib/childProcess.js | signalKill | function signalKill(childProcess, callback) {
childProcess.emit('signalKill');
if (IS_WINDOWS) {
const taskkill = spawn('taskkill', ['/F', '/T', '/PID', childProcess.pid]);
taskkill.on('exit', (exitStatus) => {
if (exitStatus) {
return callback(
new Error(`Unable to forcefully termin... | javascript | function signalKill(childProcess, callback) {
childProcess.emit('signalKill');
if (IS_WINDOWS) {
const taskkill = spawn('taskkill', ['/F', '/T', '/PID', childProcess.pid]);
taskkill.on('exit', (exitStatus) => {
if (exitStatus) {
return callback(
new Error(`Unable to forcefully termin... | [
"function",
"signalKill",
"(",
"childProcess",
",",
"callback",
")",
"{",
"childProcess",
".",
"emit",
"(",
"'signalKill'",
")",
";",
"if",
"(",
"IS_WINDOWS",
")",
"{",
"const",
"taskkill",
"=",
"spawn",
"(",
"'taskkill'",
",",
"[",
"'/F'",
",",
"'/T'",
... | Signals the child process to forcefully terminate | [
"Signals",
"the",
"child",
"process",
"to",
"forcefully",
"terminate"
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L14-L30 |
8,384 | apiaryio/dredd | lib/childProcess.js | signalTerm | function signalTerm(childProcess, callback) {
childProcess.emit('signalTerm');
if (IS_WINDOWS) {
// On Windows, there is no such way as SIGTERM or SIGINT. The closest
// thing is to interrupt the process with Ctrl+C. Under the hood, that
// generates '\u0003' character on stdin of the process and if
... | javascript | function signalTerm(childProcess, callback) {
childProcess.emit('signalTerm');
if (IS_WINDOWS) {
// On Windows, there is no such way as SIGTERM or SIGINT. The closest
// thing is to interrupt the process with Ctrl+C. Under the hood, that
// generates '\u0003' character on stdin of the process and if
... | [
"function",
"signalTerm",
"(",
"childProcess",
",",
"callback",
")",
"{",
"childProcess",
".",
"emit",
"(",
"'signalTerm'",
")",
";",
"if",
"(",
"IS_WINDOWS",
")",
"{",
"// On Windows, there is no such way as SIGTERM or SIGINT. The closest",
"// thing is to interrupt the pr... | Signals the child process to gracefully terminate | [
"Signals",
"the",
"child",
"process",
"to",
"gracefully",
"terminate"
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L34-L59 |
8,385 | apiaryio/dredd | lib/childProcess.js | check | function check() {
if (terminated) {
// Successfully terminated
clearTimeout(t);
return callback();
}
if ((Date.now() - start) < timeout) {
// Still not terminated, try again
signalTerm(childProcess, (err) => {
if (err) { return callback(err); }
t = setTimeout(c... | javascript | function check() {
if (terminated) {
// Successfully terminated
clearTimeout(t);
return callback();
}
if ((Date.now() - start) < timeout) {
// Still not terminated, try again
signalTerm(childProcess, (err) => {
if (err) { return callback(err); }
t = setTimeout(c... | [
"function",
"check",
"(",
")",
"{",
"if",
"(",
"terminated",
")",
"{",
"// Successfully terminated",
"clearTimeout",
"(",
"t",
")",
";",
"return",
"callback",
"(",
")",
";",
"}",
"if",
"(",
"(",
"Date",
".",
"now",
"(",
")",
"-",
"start",
")",
"<",
... | A function representing one check, whether the process already ended or not. It is repeatedly called until the timeout has passed. | [
"A",
"function",
"representing",
"one",
"check",
"whether",
"the",
"process",
"already",
"ended",
"or",
"not",
".",
"It",
"is",
"repeatedly",
"called",
"until",
"the",
"timeout",
"has",
"passed",
"."
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L98-L122 |
8,386 | apiaryio/dredd | lib/configuration/applyLoggingOptions.js | applyLoggingOptions | function applyLoggingOptions(config) {
if (config.color === false) {
logger.transports.console.colorize = false;
reporterOutputLogger.transports.console.colorize = false;
}
// TODO https://github.com/apiaryio/dredd/issues/1346
if (config.loglevel) {
const loglevel = config.loglevel.toLowerCase();
... | javascript | function applyLoggingOptions(config) {
if (config.color === false) {
logger.transports.console.colorize = false;
reporterOutputLogger.transports.console.colorize = false;
}
// TODO https://github.com/apiaryio/dredd/issues/1346
if (config.loglevel) {
const loglevel = config.loglevel.toLowerCase();
... | [
"function",
"applyLoggingOptions",
"(",
"config",
")",
"{",
"if",
"(",
"config",
".",
"color",
"===",
"false",
")",
"{",
"logger",
".",
"transports",
".",
"console",
".",
"colorize",
"=",
"false",
";",
"reporterOutputLogger",
".",
"transports",
".",
"console... | Applies logging options from the given configuration.
Operates on the validated normalized config. | [
"Applies",
"logging",
"options",
"from",
"the",
"given",
"configuration",
".",
"Operates",
"on",
"the",
"validated",
"normalized",
"config",
"."
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/configuration/applyLoggingOptions.js#L8-L34 |
8,387 | apiaryio/dredd | lib/performRequest.js | performRequest | function performRequest(uri, transactionReq, options, callback) {
if (typeof options === 'function') { [options, callback] = [{}, options]; }
const logger = options.logger || defaultLogger;
const request = options.request || defaultRequest;
const httpOptions = Object.assign({}, options.http || {});
httpOptio... | javascript | function performRequest(uri, transactionReq, options, callback) {
if (typeof options === 'function') { [options, callback] = [{}, options]; }
const logger = options.logger || defaultLogger;
const request = options.request || defaultRequest;
const httpOptions = Object.assign({}, options.http || {});
httpOptio... | [
"function",
"performRequest",
"(",
"uri",
",",
"transactionReq",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"[",
"options",
",",
"callback",
"]",
"=",
"[",
"{",
"}",
",",
"options",
"]",
";... | Performs the HTTP request as described in the 'transaction.request' object
In future we should introduce a 'real' request object as well so user has
access to the modifications made on the way.
@param {string} uri
@param {Object} transactionReq
@param {Object} [options]
@param {Object} [options.logger] Custom logger
... | [
"Performs",
"the",
"HTTP",
"request",
"as",
"described",
"in",
"the",
"transaction",
".",
"request",
"object"
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L21-L52 |
8,388 | apiaryio/dredd | lib/performRequest.js | getBodyAsBuffer | function getBodyAsBuffer(body, encoding) {
return body instanceof Buffer
? body
: Buffer.from(`${body || ''}`, normalizeBodyEncoding(encoding));
} | javascript | function getBodyAsBuffer(body, encoding) {
return body instanceof Buffer
? body
: Buffer.from(`${body || ''}`, normalizeBodyEncoding(encoding));
} | [
"function",
"getBodyAsBuffer",
"(",
"body",
",",
"encoding",
")",
"{",
"return",
"body",
"instanceof",
"Buffer",
"?",
"body",
":",
"Buffer",
".",
"from",
"(",
"`",
"${",
"body",
"||",
"''",
"}",
"`",
",",
"normalizeBodyEncoding",
"(",
"encoding",
")",
")... | Coerces the HTTP request body to a Buffer
@param {string|Buffer} body
@param {*} encoding | [
"Coerces",
"the",
"HTTP",
"request",
"body",
"to",
"a",
"Buffer"
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L61-L65 |
8,389 | apiaryio/dredd | lib/performRequest.js | normalizeContentLengthHeader | function normalizeContentLengthHeader(headers, body, options = {}) {
const logger = options.logger || defaultLogger;
const modifiedHeaders = Object.assign({}, headers);
const calculatedValue = Buffer.byteLength(body);
const name = caseless(modifiedHeaders).has('Content-Length');
if (name) {
const value =... | javascript | function normalizeContentLengthHeader(headers, body, options = {}) {
const logger = options.logger || defaultLogger;
const modifiedHeaders = Object.assign({}, headers);
const calculatedValue = Buffer.byteLength(body);
const name = caseless(modifiedHeaders).has('Content-Length');
if (name) {
const value =... | [
"function",
"normalizeContentLengthHeader",
"(",
"headers",
",",
"body",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"logger",
"=",
"options",
".",
"logger",
"||",
"defaultLogger",
";",
"const",
"modifiedHeaders",
"=",
"Object",
".",
"assign",
"(",
"{"... | Detects an existing Content-Length header and overrides the user-provided
header value in case it's out of sync with the real length of the body.
@param {Object} headers HTTP request headers
@param {Buffer} body HTTP request body
@param {Object} [options]
@param {Object} [options.logger] Custom logger | [
"Detects",
"an",
"existing",
"Content",
"-",
"Length",
"header",
"and",
"overrides",
"the",
"user",
"-",
"provided",
"header",
"value",
"in",
"case",
"it",
"s",
"out",
"of",
"sync",
"with",
"the",
"real",
"length",
"of",
"the",
"body",
"."
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L99-L116 |
8,390 | apiaryio/dredd | lib/performRequest.js | createTransactionResponse | function createTransactionResponse(response, body) {
const transactionRes = {
statusCode: response.statusCode,
headers: Object.assign({}, response.headers),
};
if (Buffer.byteLength(body || '')) {
transactionRes.bodyEncoding = detectBodyEncoding(body);
transactionRes.body = body.toString(transacti... | javascript | function createTransactionResponse(response, body) {
const transactionRes = {
statusCode: response.statusCode,
headers: Object.assign({}, response.headers),
};
if (Buffer.byteLength(body || '')) {
transactionRes.bodyEncoding = detectBodyEncoding(body);
transactionRes.body = body.toString(transacti... | [
"function",
"createTransactionResponse",
"(",
"response",
",",
"body",
")",
"{",
"const",
"transactionRes",
"=",
"{",
"statusCode",
":",
"response",
".",
"statusCode",
",",
"headers",
":",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"response",
".",
"header... | Real transaction response object factory. Serializes binary responses
to string using Base64 encoding.
@param {Object} response Node.js HTTP response
@param {Buffer} body HTTP response body as Buffer | [
"Real",
"transaction",
"response",
"object",
"factory",
".",
"Serializes",
"binary",
"responses",
"to",
"string",
"using",
"Base64",
"encoding",
"."
] | 8d2764f71072072b1417732300b50b0b388788c1 | https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L126-L136 |
8,391 | LeaVerou/awesomplete | awesomplete.js | function(evt) {
var li = evt.target;
if (li !== this) {
while (li && !/li/i.test(li.nodeName)) {
li = li.parentNode;
}
if (li && evt.button === 0) { // Only select on left click
evt.preventDefault();
me.select(li, evt.target, evt);
}
}
} | javascript | function(evt) {
var li = evt.target;
if (li !== this) {
while (li && !/li/i.test(li.nodeName)) {
li = li.parentNode;
}
if (li && evt.button === 0) { // Only select on left click
evt.preventDefault();
me.select(li, evt.target, evt);
}
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"li",
"=",
"evt",
".",
"target",
";",
"if",
"(",
"li",
"!==",
"this",
")",
"{",
"while",
"(",
"li",
"&&",
"!",
"/",
"li",
"/",
"i",
".",
"test",
"(",
"li",
".",
"nodeName",
")",
")",
"{",
"li",
"=",
... | The click event is fired even if the corresponding mousedown event has called preventDefault | [
"The",
"click",
"event",
"is",
"fired",
"even",
"if",
"the",
"corresponding",
"mousedown",
"event",
"has",
"called",
"preventDefault"
] | f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa | https://github.com/LeaVerou/awesomplete/blob/f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa/awesomplete.js#L106-L120 | |
8,392 | LeaVerou/awesomplete | awesomplete.js | function (i) {
var lis = this.ul.children;
if (this.selected) {
lis[this.index].setAttribute("aria-selected", "false");
}
this.index = i;
if (i > -1 && lis.length > 0) {
lis[i].setAttribute("aria-selected", "true");
this.status.textContent = lis[i].textContent + ", list item " + (i + 1) + " of " ... | javascript | function (i) {
var lis = this.ul.children;
if (this.selected) {
lis[this.index].setAttribute("aria-selected", "false");
}
this.index = i;
if (i > -1 && lis.length > 0) {
lis[i].setAttribute("aria-selected", "true");
this.status.textContent = lis[i].textContent + ", list item " + (i + 1) + " of " ... | [
"function",
"(",
"i",
")",
"{",
"var",
"lis",
"=",
"this",
".",
"ul",
".",
"children",
";",
"if",
"(",
"this",
".",
"selected",
")",
"{",
"lis",
"[",
"this",
".",
"index",
"]",
".",
"setAttribute",
"(",
"\"aria-selected\"",
",",
"\"false\"",
")",
"... | Should not be used, highlights specific item without any checks! | [
"Should",
"not",
"be",
"used",
"highlights",
"specific",
"item",
"without",
"any",
"checks!"
] | f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa | https://github.com/LeaVerou/awesomplete/blob/f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa/awesomplete.js#L247-L270 | |
8,393 | thlorenz/doctoc | lib/transform.js | determineTitle | function determineTitle(title, notitle, lines, info) {
var defaultTitle = '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*';
if (notitle) return '';
if (title) return title;
return info.hasStart ? lines[info.startIdx + 2] : defaultTitle;
} | javascript | function determineTitle(title, notitle, lines, info) {
var defaultTitle = '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*';
if (notitle) return '';
if (title) return title;
return info.hasStart ? lines[info.startIdx + 2] : defaultTitle;
} | [
"function",
"determineTitle",
"(",
"title",
",",
"notitle",
",",
"lines",
",",
"info",
")",
"{",
"var",
"defaultTitle",
"=",
"'**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*'",
";",
"if",
"(",
"notitle",
")",
"return",
"''",
";",
... | Use document context as well as command line args to infer the title | [
"Use",
"document",
"context",
"as",
"well",
"as",
"command",
"line",
"args",
"to",
"infer",
"the",
"title"
] | e4c74ae7b1346e3e42972562a440d94b2a561aa3 | https://github.com/thlorenz/doctoc/blob/e4c74ae7b1346e3e42972562a440d94b2a561aa3/lib/transform.js#L101-L107 |
8,394 | webhintio/hint | packages/formatter-html/src/assets/js/scan/scanner-common.js | function (element, closeAll) {
var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element);
if (expanded) {
element.textContent = 'close all';
element.classList.remove('closed');
element.classList.add('expanded');
} else {
... | javascript | function (element, closeAll) {
var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element);
if (expanded) {
element.textContent = 'close all';
element.classList.remove('closed');
element.classList.add('expanded');
} else {
... | [
"function",
"(",
"element",
",",
"closeAll",
")",
"{",
"var",
"expanded",
"=",
"typeof",
"closeAll",
"!==",
"'undefined'",
"?",
"closeAll",
":",
"childRulesExpanded",
"(",
"element",
")",
";",
"if",
"(",
"expanded",
")",
"{",
"element",
".",
"textContent",
... | if all rules are closed, toggle button to 'expand all'.
if any rule is open, toggle button to 'close all'. | [
"if",
"all",
"rules",
"are",
"closed",
"toggle",
"button",
"to",
"expand",
"all",
".",
"if",
"any",
"rule",
"is",
"open",
"toggle",
"button",
"to",
"close",
"all",
"."
] | 2e15dbe6997d46f377d095b4178ab5dc36146a61 | https://github.com/webhintio/hint/blob/2e15dbe6997d46f377d095b4178ab5dc36146a61/packages/formatter-html/src/assets/js/scan/scanner-common.js#L56-L68 | |
8,395 | dollarshaveclub/postmate | build/postmate.es.js | resolveOrigin | function resolveOrigin(url) {
var a = document.createElement('a');
a.href = url;
var protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol;
var host = a.host.length ? a.port === '80' || a.port === '443' ? a.hostname : a.host : window.location.host;
return a.origin || protocol + "//" + host;... | javascript | function resolveOrigin(url) {
var a = document.createElement('a');
a.href = url;
var protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol;
var host = a.host.length ? a.port === '80' || a.port === '443' ? a.hostname : a.host : window.location.host;
return a.origin || protocol + "//" + host;... | [
"function",
"resolveOrigin",
"(",
"url",
")",
"{",
"var",
"a",
"=",
"document",
".",
"createElement",
"(",
"'a'",
")",
";",
"a",
".",
"href",
"=",
"url",
";",
"var",
"protocol",
"=",
"a",
".",
"protocol",
".",
"length",
">",
"4",
"?",
"a",
".",
"... | eslint-disable-line no-console
Takes a URL and returns the origin
@param {String} url The full URL being requested
@return {String} The URLs origin | [
"eslint",
"-",
"disable",
"-",
"line",
"no",
"-",
"console",
"Takes",
"a",
"URL",
"and",
"returns",
"the",
"origin"
] | 6e8fc1193f09ef0acbba55b6b89e8e2dae3af057 | https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L50-L56 |
8,396 | dollarshaveclub/postmate | build/postmate.es.js | resolveValue | function resolveValue(model, property) {
var unwrappedContext = typeof model[property] === 'function' ? model[property]() : model[property];
return Postmate.Promise.resolve(unwrappedContext);
} | javascript | function resolveValue(model, property) {
var unwrappedContext = typeof model[property] === 'function' ? model[property]() : model[property];
return Postmate.Promise.resolve(unwrappedContext);
} | [
"function",
"resolveValue",
"(",
"model",
",",
"property",
")",
"{",
"var",
"unwrappedContext",
"=",
"typeof",
"model",
"[",
"property",
"]",
"===",
"'function'",
"?",
"model",
"[",
"property",
"]",
"(",
")",
":",
"model",
"[",
"property",
"]",
";",
"ret... | Takes a model, and searches for a value by the property
@param {Object} model The dictionary to search against
@param {String} property A path within a dictionary (i.e. 'window.location.href')
@param {Object} data Additional information from the get request that is
passed to functions in the child model
@r... | [
"Takes",
"a",
"model",
"and",
"searches",
"for",
"a",
"value",
"by",
"the",
"property"
] | 6e8fc1193f09ef0acbba55b6b89e8e2dae3af057 | https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L89-L92 |
8,397 | dollarshaveclub/postmate | build/postmate.es.js | Postmate | function Postmate(_ref2) {
var _ref2$container = _ref2.container,
container = _ref2$container === void 0 ? typeof container !== 'undefined' ? container : document.body : _ref2$container,
model = _ref2.model,
url = _ref2.url,
_ref2$classListArray = _ref2.classListArray,
classL... | javascript | function Postmate(_ref2) {
var _ref2$container = _ref2.container,
container = _ref2$container === void 0 ? typeof container !== 'undefined' ? container : document.body : _ref2$container,
model = _ref2.model,
url = _ref2.url,
_ref2$classListArray = _ref2.classListArray,
classL... | [
"function",
"Postmate",
"(",
"_ref2",
")",
"{",
"var",
"_ref2$container",
"=",
"_ref2",
".",
"container",
",",
"container",
"=",
"_ref2$container",
"===",
"void",
"0",
"?",
"typeof",
"container",
"!==",
"'undefined'",
"?",
"container",
":",
"document",
".",
... | eslint-disable-line no-undef Internet Explorer craps itself
Sets options related to the Parent
@param {Object} object The element to inject the frame into, and the url
@return {Promise} | [
"eslint",
"-",
"disable",
"-",
"line",
"no",
"-",
"undef",
"Internet",
"Explorer",
"craps",
"itself",
"Sets",
"options",
"related",
"to",
"the",
"Parent"
] | 6e8fc1193f09ef0acbba55b6b89e8e2dae3af057 | https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L287-L302 |
8,398 | dollarshaveclub/postmate | build/postmate.es.js | Model | function Model(model) {
this.child = window;
this.model = model;
this.parent = this.child.parent;
return this.sendHandshakeReply();
} | javascript | function Model(model) {
this.child = window;
this.model = model;
this.parent = this.child.parent;
return this.sendHandshakeReply();
} | [
"function",
"Model",
"(",
"model",
")",
"{",
"this",
".",
"child",
"=",
"window",
";",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"parent",
"=",
"this",
".",
"child",
".",
"parent",
";",
"return",
"this",
".",
"sendHandshakeReply",
"(",
")... | Initializes the child, model, parent, and responds to the Parents handshake
@param {Object} model Hash of values, functions, or promises
@return {Promise} The Promise that resolves when the handshake has been received | [
"Initializes",
"the",
"child",
"model",
"parent",
"and",
"responds",
"to",
"the",
"Parents",
"handshake"
] | 6e8fc1193f09ef0acbba55b6b89e8e2dae3af057 | https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L418-L423 |
8,399 | node-inspector/node-inspector | front-end/profiler/CPUProfileBottomUpDataGrid.js | function(profileDataGridNode)
{
if (!profileDataGridNode)
return;
this.save();
var currentNode = profileDataGridNode;
var focusNode = profileDataGridNode;
while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) {
curr... | javascript | function(profileDataGridNode)
{
if (!profileDataGridNode)
return;
this.save();
var currentNode = profileDataGridNode;
var focusNode = profileDataGridNode;
while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) {
curr... | [
"function",
"(",
"profileDataGridNode",
")",
"{",
"if",
"(",
"!",
"profileDataGridNode",
")",
"return",
";",
"this",
".",
"save",
"(",
")",
";",
"var",
"currentNode",
"=",
"profileDataGridNode",
";",
"var",
"focusNode",
"=",
"profileDataGridNode",
";",
"while"... | When focusing, we keep the entire callstack up to this ancestor.
@param {!WebInspector.ProfileDataGridNode} profileDataGridNode | [
"When",
"focusing",
"we",
"keep",
"the",
"entire",
"callstack",
"up",
"to",
"this",
"ancestor",
"."
] | 79e01c049286374f86dd560742a614019c02402f | https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/profiler/CPUProfileBottomUpDataGrid.js#L253-L275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.