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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Microsoft/vscode | build/lib/treeshaking.js | discoverAndReadFiles | function discoverAndReadFiles(options) {
const FILES = {};
const in_queue = Object.create(null);
const queue = [];
const enqueue = (moduleId) => {
if (in_queue[moduleId]) {
return;
}
in_queue[moduleId] = true;
queue.push(moduleId);
};
options.entryPoin... | javascript | function discoverAndReadFiles(options) {
const FILES = {};
const in_queue = Object.create(null);
const queue = [];
const enqueue = (moduleId) => {
if (in_queue[moduleId]) {
return;
}
in_queue[moduleId] = true;
queue.push(moduleId);
};
options.entryPoin... | [
"function",
"discoverAndReadFiles",
"(",
"options",
")",
"{",
"const",
"FILES",
"=",
"{",
"}",
";",
"const",
"in_queue",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"const",
"queue",
"=",
"[",
"]",
";",
"const",
"enqueue",
"=",
"(",
"moduleId"... | Read imports and follow them until all files have been handled | [
"Read",
"imports",
"and",
"follow",
"them",
"until",
"all",
"files",
"have",
"been",
"handled"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L79-L128 |
1 | Microsoft/vscode | build/lib/watch/index.js | handleDeletions | function handleDeletions() {
return es.mapSync(f => {
if (/\.ts$/.test(f.relative) && !f.contents) {
f.contents = Buffer.from('');
f.stat = { mtime: new Date() };
}
return f;
});
} | javascript | function handleDeletions() {
return es.mapSync(f => {
if (/\.ts$/.test(f.relative) && !f.contents) {
f.contents = Buffer.from('');
f.stat = { mtime: new Date() };
}
return f;
});
} | [
"function",
"handleDeletions",
"(",
")",
"{",
"return",
"es",
".",
"mapSync",
"(",
"f",
"=>",
"{",
"if",
"(",
"/",
"\\.ts$",
"/",
".",
"test",
"(",
"f",
".",
"relative",
")",
"&&",
"!",
"f",
".",
"contents",
")",
"{",
"f",
".",
"contents",
"=",
... | Ugly hack for gulp-tsb | [
"Ugly",
"hack",
"for",
"gulp",
"-",
"tsb"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/watch/index.js#L9-L18 |
2 | Microsoft/vscode | build/lib/optimize.js | uglifyWithCopyrights | function uglifyWithCopyrights() {
const preserveComments = (f) => {
return (_node, comment) => {
const text = comment.value;
const type = comment.type;
if (/@minifier_do_not_preserve/.test(text)) {
return false;
}
const isOurCopyrig... | javascript | function uglifyWithCopyrights() {
const preserveComments = (f) => {
return (_node, comment) => {
const text = comment.value;
const type = comment.type;
if (/@minifier_do_not_preserve/.test(text)) {
return false;
}
const isOurCopyrig... | [
"function",
"uglifyWithCopyrights",
"(",
")",
"{",
"const",
"preserveComments",
"=",
"(",
"f",
")",
"=>",
"{",
"return",
"(",
"_node",
",",
"comment",
")",
"=>",
"{",
"const",
"text",
"=",
"comment",
".",
"value",
";",
"const",
"type",
"=",
"comment",
... | Wrap around uglify and allow the preserveComments function
to have a file "context" to include our copyright only once per file. | [
"Wrap",
"around",
"uglify",
"and",
"allow",
"the",
"preserveComments",
"function",
"to",
"have",
"a",
"file",
"context",
"to",
"include",
"our",
"copyright",
"only",
"once",
"per",
"file",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/optimize.js#L169-L207 |
3 | Microsoft/vscode | build/lib/extensions.js | sequence | function sequence(streamProviders) {
const result = es.through();
function pop() {
if (streamProviders.length === 0) {
result.emit('end');
}
else {
const fn = streamProviders.shift();
fn()
.on('end', function () { setTimeout(pop, 0); })... | javascript | function sequence(streamProviders) {
const result = es.through();
function pop() {
if (streamProviders.length === 0) {
result.emit('end');
}
else {
const fn = streamProviders.shift();
fn()
.on('end', function () { setTimeout(pop, 0); })... | [
"function",
"sequence",
"(",
"streamProviders",
")",
"{",
"const",
"result",
"=",
"es",
".",
"through",
"(",
")",
";",
"function",
"pop",
"(",
")",
"{",
"if",
"(",
"streamProviders",
".",
"length",
"===",
"0",
")",
"{",
"result",
".",
"emit",
"(",
"'... | We're doing way too much stuff at once, with webpack et al. So much stuff
that while downloading extensions from the marketplace, node js doesn't get enough
stack frames to complete the download in under 2 minutes, at which point the
marketplace server cuts off the http request. So, we sequentialize the extensino tasks... | [
"We",
"re",
"doing",
"way",
"too",
"much",
"stuff",
"at",
"once",
"with",
"webpack",
"et",
"al",
".",
"So",
"much",
"stuff",
"that",
"while",
"downloading",
"extensions",
"from",
"the",
"marketplace",
"node",
"js",
"doesn",
"t",
"get",
"enough",
"stack",
... | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/extensions.js#L194-L209 |
4 | Microsoft/vscode | src/vs/loader.js | function (what) {
moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
try {
return _nodeRequire_1(what);
}
finally {
moduleManager.getRecorder().record(34 /* NodeEndNati... | javascript | function (what) {
moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
try {
return _nodeRequire_1(what);
}
finally {
moduleManager.getRecorder().record(34 /* NodeEndNati... | [
"function",
"(",
"what",
")",
"{",
"moduleManager",
".",
"getRecorder",
"(",
")",
".",
"record",
"(",
"33",
"/* NodeBeginNativeRequire */",
",",
"what",
")",
";",
"try",
"{",
"return",
"_nodeRequire_1",
"(",
"what",
")",
";",
"}",
"finally",
"{",
"moduleMa... | re-expose node's require function | [
"re",
"-",
"expose",
"node",
"s",
"require",
"function"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/vs/loader.js#L1705-L1713 | |
5 | Microsoft/vscode | build/lib/nls.js | nls | function nls() {
const input = event_stream_1.through();
const output = input.pipe(event_stream_1.through(function (f) {
if (!f.sourceMap) {
return this.emit('error', new Error(`File ${f.relative} does not have sourcemaps.`));
}
let source = f.sourceMap.sources[0];
if... | javascript | function nls() {
const input = event_stream_1.through();
const output = input.pipe(event_stream_1.through(function (f) {
if (!f.sourceMap) {
return this.emit('error', new Error(`File ${f.relative} does not have sourcemaps.`));
}
let source = f.sourceMap.sources[0];
if... | [
"function",
"nls",
"(",
")",
"{",
"const",
"input",
"=",
"event_stream_1",
".",
"through",
"(",
")",
";",
"const",
"output",
"=",
"input",
".",
"pipe",
"(",
"event_stream_1",
".",
"through",
"(",
"function",
"(",
"f",
")",
"{",
"if",
"(",
"!",
"f",
... | Returns a stream containing the patched JavaScript and source maps. | [
"Returns",
"a",
"stream",
"containing",
"the",
"patched",
"JavaScript",
"and",
"source",
"maps",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/nls.js#L54-L75 |
6 | Microsoft/vscode | build/lib/bundle.js | bundle | function bundle(entryPoints, config, callback) {
const entryPointsMap = {};
entryPoints.forEach((module) => {
entryPointsMap[module.name] = module;
});
const allMentionedModulesMap = {};
entryPoints.forEach((module) => {
allMentionedModulesMap[module.name] = true;
(module.inc... | javascript | function bundle(entryPoints, config, callback) {
const entryPointsMap = {};
entryPoints.forEach((module) => {
entryPointsMap[module.name] = module;
});
const allMentionedModulesMap = {};
entryPoints.forEach((module) => {
allMentionedModulesMap[module.name] = true;
(module.inc... | [
"function",
"bundle",
"(",
"entryPoints",
",",
"config",
",",
"callback",
")",
"{",
"const",
"entryPointsMap",
"=",
"{",
"}",
";",
"entryPoints",
".",
"forEach",
"(",
"(",
"module",
")",
"=>",
"{",
"entryPointsMap",
"[",
"module",
".",
"name",
"]",
"=",
... | Bundle `entryPoints` given config `config`. | [
"Bundle",
"entryPoints",
"given",
"config",
"config",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L13-L70 |
7 | Microsoft/vscode | build/lib/bundle.js | visit | function visit(rootNodes, graph) {
const result = {};
const queue = rootNodes;
rootNodes.forEach((node) => {
result[node] = true;
});
while (queue.length > 0) {
const el = queue.shift();
const myEdges = graph[el] || [];
myEdges.forEach((toNode) => {
if (!r... | javascript | function visit(rootNodes, graph) {
const result = {};
const queue = rootNodes;
rootNodes.forEach((node) => {
result[node] = true;
});
while (queue.length > 0) {
const el = queue.shift();
const myEdges = graph[el] || [];
myEdges.forEach((toNode) => {
if (!r... | [
"function",
"visit",
"(",
"rootNodes",
",",
"graph",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"const",
"queue",
"=",
"rootNodes",
";",
"rootNodes",
".",
"forEach",
"(",
"(",
"node",
")",
"=>",
"{",
"result",
"[",
"node",
"]",
"=",
"true",
"... | Return a set of reachable nodes in `graph` starting from `rootNodes` | [
"Return",
"a",
"set",
"of",
"reachable",
"nodes",
"in",
"graph",
"starting",
"from",
"rootNodes"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L404-L421 |
8 | Microsoft/vscode | build/lib/bundle.js | topologicalSort | function topologicalSort(graph) {
const allNodes = {}, outgoingEdgeCount = {}, inverseEdges = {};
Object.keys(graph).forEach((fromNode) => {
allNodes[fromNode] = true;
outgoingEdgeCount[fromNode] = graph[fromNode].length;
graph[fromNode].forEach((toNode) => {
allNodes[toNode]... | javascript | function topologicalSort(graph) {
const allNodes = {}, outgoingEdgeCount = {}, inverseEdges = {};
Object.keys(graph).forEach((fromNode) => {
allNodes[fromNode] = true;
outgoingEdgeCount[fromNode] = graph[fromNode].length;
graph[fromNode].forEach((toNode) => {
allNodes[toNode]... | [
"function",
"topologicalSort",
"(",
"graph",
")",
"{",
"const",
"allNodes",
"=",
"{",
"}",
",",
"outgoingEdgeCount",
"=",
"{",
"}",
",",
"inverseEdges",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"graph",
")",
".",
"forEach",
"(",
"(",
"fromNode",... | Perform a topological sort on `graph` | [
"Perform",
"a",
"topological",
"sort",
"on",
"graph"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L425-L463 |
9 | Microsoft/vscode | build/lib/git.js | getVersion | function getVersion(repo) {
const git = path.join(repo, '.git');
const headPath = path.join(git, 'HEAD');
let head;
try {
head = fs.readFileSync(headPath, 'utf8').trim();
}
catch (e) {
return undefined;
}
if (/^[0-9a-f]{40}$/i.test(head)) {
return head;
}
... | javascript | function getVersion(repo) {
const git = path.join(repo, '.git');
const headPath = path.join(git, 'HEAD');
let head;
try {
head = fs.readFileSync(headPath, 'utf8').trim();
}
catch (e) {
return undefined;
}
if (/^[0-9a-f]{40}$/i.test(head)) {
return head;
}
... | [
"function",
"getVersion",
"(",
"repo",
")",
"{",
"const",
"git",
"=",
"path",
".",
"join",
"(",
"repo",
",",
"'.git'",
")",
";",
"const",
"headPath",
"=",
"path",
".",
"join",
"(",
"git",
",",
"'HEAD'",
")",
";",
"let",
"head",
";",
"try",
"{",
"... | Returns the sha1 commit version of a repository or undefined in case of failure. | [
"Returns",
"the",
"sha1",
"commit",
"version",
"of",
"a",
"repository",
"or",
"undefined",
"in",
"case",
"of",
"failure",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/git.js#L12-L52 |
10 | Microsoft/vscode | src/bootstrap-fork.js | safeToArray | function safeToArray(args) {
const seen = [];
const argsArray = [];
let res;
// Massage some arguments with special treatment
if (args.length) {
for (let i = 0; i < args.length; i++) {
// Any argument of type 'undefined' needs to be specially treated because
// JSON.stringify will simply ignore ... | javascript | function safeToArray(args) {
const seen = [];
const argsArray = [];
let res;
// Massage some arguments with special treatment
if (args.length) {
for (let i = 0; i < args.length; i++) {
// Any argument of type 'undefined' needs to be specially treated because
// JSON.stringify will simply ignore ... | [
"function",
"safeToArray",
"(",
"args",
")",
"{",
"const",
"seen",
"=",
"[",
"]",
";",
"const",
"argsArray",
"=",
"[",
"]",
";",
"let",
"res",
";",
"// Massage some arguments with special treatment",
"if",
"(",
"args",
".",
"length",
")",
"{",
"for",
"(",
... | Prevent circular stringify and convert arguments to real array | [
"Prevent",
"circular",
"stringify",
"and",
"convert",
"arguments",
"to",
"real",
"array"
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/bootstrap-fork.js#L50-L112 |
11 | Microsoft/vscode | build/gulpfile.vscode.js | computeChecksums | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | javascript | function computeChecksums(out, filenames) {
var result = {};
filenames.forEach(function (filename) {
var fullPath = path.join(process.cwd(), out, filename);
result[filename] = computeChecksum(fullPath);
});
return result;
} | [
"function",
"computeChecksums",
"(",
"out",
",",
"filenames",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"filenames",
".",
"forEach",
"(",
"function",
"(",
"filename",
")",
"{",
"var",
"fullPath",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd... | Compute checksums for some files.
@param {string} out The out folder to read the file from.
@param {string[]} filenames The paths to compute a checksum for.
@return {Object} A map of paths to checksums. | [
"Compute",
"checksums",
"for",
"some",
"files",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L230-L237 |
12 | Microsoft/vscode | build/gulpfile.vscode.js | computeChecksum | function computeChecksum(filename) {
var contents = fs.readFileSync(filename);
var hash = crypto
.createHash('md5')
.update(contents)
.digest('base64')
.replace(/=+$/, '');
return hash;
} | javascript | function computeChecksum(filename) {
var contents = fs.readFileSync(filename);
var hash = crypto
.createHash('md5')
.update(contents)
.digest('base64')
.replace(/=+$/, '');
return hash;
} | [
"function",
"computeChecksum",
"(",
"filename",
")",
"{",
"var",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
";",
"var",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
".",
"update",
"(",
"contents",
")",
".",
"digest"... | Compute checksum for a file.
@param {string} filename The absolute path to a filename.
@return {string} The checksum for `filename`. | [
"Compute",
"checksum",
"for",
"a",
"file",
"."
] | 693a13cd32c5be798051edc0cb43e1e39fc456d9 | https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L245-L255 |
13 | angular/angular | aio/tools/transforms/angular-base-package/rendering/hasValues.js | readProperty | function readProperty(obj, propertySegments, index) {
const value = obj[propertySegments[index]];
return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1));
} | javascript | function readProperty(obj, propertySegments, index) {
const value = obj[propertySegments[index]];
return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1));
} | [
"function",
"readProperty",
"(",
"obj",
",",
"propertySegments",
",",
"index",
")",
"{",
"const",
"value",
"=",
"obj",
"[",
"propertySegments",
"[",
"index",
"]",
"]",
";",
"return",
"!",
"!",
"value",
"&&",
"(",
"index",
"===",
"propertySegments",
".",
... | Search deeply into an object via a collection of property segments, starting at the
indexed segment.
E.g. if `obj = { a: { b: { c: 10 }}}` then
`readProperty(obj, ['a', 'b', 'c'], 0)` will return true;
but
`readProperty(obj, ['a', 'd'], 0)` will return false; | [
"Search",
"deeply",
"into",
"an",
"object",
"via",
"a",
"collection",
"of",
"property",
"segments",
"starting",
"at",
"the",
"indexed",
"segment",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-base-package/rendering/hasValues.js#L20-L23 |
14 | angular/angular | tools/gulp-tasks/cldr/extract.js | generateLocale | function generateLocale(locale, localeData, baseCurrencies) {
// [ localeId, dateTime, number, currency, pluralCase ]
let data = stringify([
locale,
...getDateTimeTranslations(localeData),
...getDateTimeSettings(localeData),
...getNumberSettings(localeData),
...getCurrencySettings(locale, locale... | javascript | function generateLocale(locale, localeData, baseCurrencies) {
// [ localeId, dateTime, number, currency, pluralCase ]
let data = stringify([
locale,
...getDateTimeTranslations(localeData),
...getDateTimeSettings(localeData),
...getNumberSettings(localeData),
...getCurrencySettings(locale, locale... | [
"function",
"generateLocale",
"(",
"locale",
",",
"localeData",
",",
"baseCurrencies",
")",
"{",
"// [ localeId, dateTime, number, currency, pluralCase ]",
"let",
"data",
"=",
"stringify",
"(",
"[",
"locale",
",",
"...",
"getDateTimeTranslations",
"(",
"localeData",
")"... | Generate file that contains basic locale data | [
"Generate",
"file",
"that",
"contains",
"basic",
"locale",
"data"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L94-L117 |
15 | angular/angular | tools/gulp-tasks/cldr/extract.js | generateLocaleCurrencies | function generateLocaleCurrencies(localeData, baseCurrencies) {
const currenciesData = localeData.main('numbers/currencies');
const currencies = {};
Object.keys(currenciesData).forEach(code => {
let symbolsArray = [];
const symbol = currenciesData[code].symbol;
const symbolNarrow = currenciesData[code... | javascript | function generateLocaleCurrencies(localeData, baseCurrencies) {
const currenciesData = localeData.main('numbers/currencies');
const currencies = {};
Object.keys(currenciesData).forEach(code => {
let symbolsArray = [];
const symbol = currenciesData[code].symbol;
const symbolNarrow = currenciesData[code... | [
"function",
"generateLocaleCurrencies",
"(",
"localeData",
",",
"baseCurrencies",
")",
"{",
"const",
"currenciesData",
"=",
"localeData",
".",
"main",
"(",
"'numbers/currencies'",
")",
";",
"const",
"currencies",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
... | To minimize the file even more, we only output the differences compared to the base currency | [
"To",
"minimize",
"the",
"file",
"even",
"more",
"we",
"only",
"output",
"the",
"differences",
"compared",
"to",
"the",
"base",
"currency"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L201-L225 |
16 | angular/angular | tools/gulp-tasks/cldr/extract.js | getDayPeriods | function getDayPeriods(localeData, dayPeriodsList) {
const dayPeriods = localeData.main(`dates/calendars/gregorian/dayPeriods`);
const result = {};
// cleaning up unused keys
Object.keys(dayPeriods).forEach(key1 => { // format / stand-alone
result[key1] = {};
Object.keys(dayPeriods[key1]).forEa... | javascript | function getDayPeriods(localeData, dayPeriodsList) {
const dayPeriods = localeData.main(`dates/calendars/gregorian/dayPeriods`);
const result = {};
// cleaning up unused keys
Object.keys(dayPeriods).forEach(key1 => { // format / stand-alone
result[key1] = {};
Object.keys(dayPeriods[key1]).forEa... | [
"function",
"getDayPeriods",
"(",
"localeData",
",",
"dayPeriodsList",
")",
"{",
"const",
"dayPeriods",
"=",
"localeData",
".",
"main",
"(",
"`",
"`",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
"// cleaning up unused keys",
"Object",
".",
"keys",
"(",
... | Returns data for the chosen day periods
@returns {format: {narrow / abbreviated / wide: [...]}, stand-alone: {narrow / abbreviated / wide: [...]}} | [
"Returns",
"data",
"for",
"the",
"chosen",
"day",
"periods"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L245-L262 |
17 | angular/angular | tools/gulp-tasks/cldr/extract.js | getDateTimeTranslations | function getDateTimeTranslations(localeData) {
const dayNames = localeData.main(`dates/calendars/gregorian/days`);
const monthNames = localeData.main(`dates/calendars/gregorian/months`);
const erasNames = localeData.main(`dates/calendars/gregorian/eras`);
const dayPeriods = getDayPeriodsAmPm(localeData);
con... | javascript | function getDateTimeTranslations(localeData) {
const dayNames = localeData.main(`dates/calendars/gregorian/days`);
const monthNames = localeData.main(`dates/calendars/gregorian/months`);
const erasNames = localeData.main(`dates/calendars/gregorian/eras`);
const dayPeriods = getDayPeriodsAmPm(localeData);
con... | [
"function",
"getDateTimeTranslations",
"(",
"localeData",
")",
"{",
"const",
"dayNames",
"=",
"localeData",
".",
"main",
"(",
"`",
"`",
")",
";",
"const",
"monthNames",
"=",
"localeData",
".",
"main",
"(",
"`",
"`",
")",
";",
"const",
"erasNames",
"=",
"... | Returns date-related translations for a locale
@returns [ dayPeriodsFormat, dayPeriodsStandalone, daysFormat, dayStandalone, monthsFormat, monthsStandalone, eras ]
each value: [ narrow, abbreviated, wide, short? ] | [
"Returns",
"date",
"-",
"related",
"translations",
"for",
"a",
"locale"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L284-L342 |
18 | angular/angular | tools/gulp-tasks/cldr/extract.js | getDateTimeFormats | function getDateTimeFormats(localeData) {
function getFormats(data) {
return removeDuplicates([
data.short._value || data.short,
data.medium._value || data.medium,
data.long._value || data.long,
data.full._value || data.full
]);
}
const dateFormats = localeData.main('dates/calenda... | javascript | function getDateTimeFormats(localeData) {
function getFormats(data) {
return removeDuplicates([
data.short._value || data.short,
data.medium._value || data.medium,
data.long._value || data.long,
data.full._value || data.full
]);
}
const dateFormats = localeData.main('dates/calenda... | [
"function",
"getDateTimeFormats",
"(",
"localeData",
")",
"{",
"function",
"getFormats",
"(",
"data",
")",
"{",
"return",
"removeDuplicates",
"(",
"[",
"data",
".",
"short",
".",
"_value",
"||",
"data",
".",
"short",
",",
"data",
".",
"medium",
".",
"_valu... | Returns date, time and dateTime formats for a locale
@returns [dateFormats, timeFormats, dateTimeFormats]
each format: [ short, medium, long, full ] | [
"Returns",
"date",
"time",
"and",
"dateTime",
"formats",
"for",
"a",
"locale"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L349-L368 |
19 | angular/angular | tools/gulp-tasks/cldr/extract.js | getDayPeriodRules | function getDayPeriodRules(localeData) {
const dayPeriodRules = localeData.get(`supplemental/dayPeriodRuleSet/${localeData.attributes.language}`);
const rules = {};
if (dayPeriodRules) {
Object.keys(dayPeriodRules).forEach(key => {
if (dayPeriodRules[key]._at) {
rules[key] = dayPeriodRules[key].... | javascript | function getDayPeriodRules(localeData) {
const dayPeriodRules = localeData.get(`supplemental/dayPeriodRuleSet/${localeData.attributes.language}`);
const rules = {};
if (dayPeriodRules) {
Object.keys(dayPeriodRules).forEach(key => {
if (dayPeriodRules[key]._at) {
rules[key] = dayPeriodRules[key].... | [
"function",
"getDayPeriodRules",
"(",
"localeData",
")",
"{",
"const",
"dayPeriodRules",
"=",
"localeData",
".",
"get",
"(",
"`",
"${",
"localeData",
".",
"attributes",
".",
"language",
"}",
"`",
")",
";",
"const",
"rules",
"=",
"{",
"}",
";",
"if",
"(",... | Returns day period rules for a locale
@returns string[] | [
"Returns",
"day",
"period",
"rules",
"for",
"a",
"locale"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L374-L388 |
20 | angular/angular | tools/gulp-tasks/cldr/extract.js | getWeekendRange | function getWeekendRange(localeData) {
const startDay =
localeData.get(`supplemental/weekData/weekendStart/${localeData.attributes.territory}`) ||
localeData.get('supplemental/weekData/weekendStart/001');
const endDay =
localeData.get(`supplemental/weekData/weekendEnd/${localeData.attributes.territory}`... | javascript | function getWeekendRange(localeData) {
const startDay =
localeData.get(`supplemental/weekData/weekendStart/${localeData.attributes.territory}`) ||
localeData.get('supplemental/weekData/weekendStart/001');
const endDay =
localeData.get(`supplemental/weekData/weekendEnd/${localeData.attributes.territory}`... | [
"function",
"getWeekendRange",
"(",
"localeData",
")",
"{",
"const",
"startDay",
"=",
"localeData",
".",
"get",
"(",
"`",
"${",
"localeData",
".",
"attributes",
".",
"territory",
"}",
"`",
")",
"||",
"localeData",
".",
"get",
"(",
"'supplemental/weekData/weeke... | Returns week-end range for a locale, based on US week days
@returns [number, number] | [
"Returns",
"week",
"-",
"end",
"range",
"for",
"a",
"locale",
"based",
"on",
"US",
"week",
"days"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L402-L410 |
21 | angular/angular | tools/gulp-tasks/cldr/extract.js | getNumberSettings | function getNumberSettings(localeData) {
const decimalFormat = localeData.main('numbers/decimalFormats-numberSystem-latn/standard');
const percentFormat = localeData.main('numbers/percentFormats-numberSystem-latn/standard');
const scientificFormat = localeData.main('numbers/scientificFormats-numberSystem-latn/sta... | javascript | function getNumberSettings(localeData) {
const decimalFormat = localeData.main('numbers/decimalFormats-numberSystem-latn/standard');
const percentFormat = localeData.main('numbers/percentFormats-numberSystem-latn/standard');
const scientificFormat = localeData.main('numbers/scientificFormats-numberSystem-latn/sta... | [
"function",
"getNumberSettings",
"(",
"localeData",
")",
"{",
"const",
"decimalFormat",
"=",
"localeData",
".",
"main",
"(",
"'numbers/decimalFormats-numberSystem-latn/standard'",
")",
";",
"const",
"percentFormat",
"=",
"localeData",
".",
"main",
"(",
"'numbers/percent... | Returns the number symbols and formats for a locale
@returns [ symbols, formats ]
symbols: [ decimal, group, list, percentSign, plusSign, minusSign, exponential, superscriptingExponent, perMille, infinity, nan, timeSeparator, currencyDecimal?, currencyGroup? ]
formats: [ currency, decimal, percent, scientific ] | [
"Returns",
"the",
"number",
"symbols",
"and",
"formats",
"for",
"a",
"locale"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L426-L459 |
22 | angular/angular | tools/gulp-tasks/cldr/extract.js | getCurrencySettings | function getCurrencySettings(locale, localeData) {
const currencyInfo = localeData.main(`numbers/currencies`);
let currentCurrency = '';
// find the currency currently used in this country
const currencies =
localeData.get(`supplemental/currencyData/region/${localeData.attributes.territory}`) ||
locale... | javascript | function getCurrencySettings(locale, localeData) {
const currencyInfo = localeData.main(`numbers/currencies`);
let currentCurrency = '';
// find the currency currently used in this country
const currencies =
localeData.get(`supplemental/currencyData/region/${localeData.attributes.territory}`) ||
locale... | [
"function",
"getCurrencySettings",
"(",
"locale",
",",
"localeData",
")",
"{",
"const",
"currencyInfo",
"=",
"localeData",
".",
"main",
"(",
"`",
"`",
")",
";",
"let",
"currentCurrency",
"=",
"''",
";",
"// find the currency currently used in this country",
"const",... | Returns the currency symbol and name for a locale
@returns [ symbol, name ] | [
"Returns",
"the",
"currency",
"symbol",
"and",
"name",
"for",
"a",
"locale"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L465-L496 |
23 | angular/angular | tools/npm/check-node-modules.js | _deleteDir | function _deleteDir(path) {
if (fs.existsSync(path)) {
var subpaths = fs.readdirSync(path);
subpaths.forEach(function(subpath) {
var curPath = path + '/' + subpath;
if (fs.lstatSync(curPath).isDirectory()) {
_deleteDir(curPath);
} else {
fs.unlinkSync(curPath);
}
})... | javascript | function _deleteDir(path) {
if (fs.existsSync(path)) {
var subpaths = fs.readdirSync(path);
subpaths.forEach(function(subpath) {
var curPath = path + '/' + subpath;
if (fs.lstatSync(curPath).isDirectory()) {
_deleteDir(curPath);
} else {
fs.unlinkSync(curPath);
}
})... | [
"function",
"_deleteDir",
"(",
"path",
")",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"path",
")",
")",
"{",
"var",
"subpaths",
"=",
"fs",
".",
"readdirSync",
"(",
"path",
")",
";",
"subpaths",
".",
"forEach",
"(",
"function",
"(",
"subpath",
")"... | Custom implementation of recursive `rm` because we can't rely on the state of node_modules to
pull in existing module. | [
"Custom",
"implementation",
"of",
"recursive",
"rm",
"because",
"we",
"can",
"t",
"rely",
"on",
"the",
"state",
"of",
"node_modules",
"to",
"pull",
"in",
"existing",
"module",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/npm/check-node-modules.js#L41-L54 |
24 | angular/angular | tools/gulp-tasks/cldr/closure.js | generateAllLocalesFile | function generateAllLocalesFile(LOCALES, ALIASES) {
const existingLocalesAliases = {};
const existingLocalesData = {};
// for each locale, get the data and the list of equivalent locales
LOCALES.forEach(locale => {
const eqLocales = new Set();
eqLocales.add(locale);
if (locale.match(/-/)) {
e... | javascript | function generateAllLocalesFile(LOCALES, ALIASES) {
const existingLocalesAliases = {};
const existingLocalesData = {};
// for each locale, get the data and the list of equivalent locales
LOCALES.forEach(locale => {
const eqLocales = new Set();
eqLocales.add(locale);
if (locale.match(/-/)) {
e... | [
"function",
"generateAllLocalesFile",
"(",
"LOCALES",
",",
"ALIASES",
")",
"{",
"const",
"existingLocalesAliases",
"=",
"{",
"}",
";",
"const",
"existingLocalesData",
"=",
"{",
"}",
";",
"// for each locale, get the data and the list of equivalent locales",
"LOCALES",
"."... | Generate a file that contains all locale to import for closure.
Tree shaking will only keep the data for the `goog.LOCALE` locale. | [
"Generate",
"a",
"file",
"that",
"contains",
"all",
"locale",
"to",
"import",
"for",
"closure",
".",
"Tree",
"shaking",
"will",
"only",
"keep",
"the",
"data",
"for",
"the",
"goog",
".",
"LOCALE",
"locale",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/closure.js#L71-L163 |
25 | angular/angular | aio/tools/transforms/remark-package/services/renderMarkdown.js | inlineTagDefs | function inlineTagDefs() {
const Parser = this.Parser;
const inlineTokenizers = Parser.prototype.inlineTokenizers;
const inlineMethods = Parser.prototype.inlineMethods;
const blockTokenizers = Parser.prototype.blockTokenizers;
const blockMethods = Parser.prototype.blockMethods;
blockTokenizers.... | javascript | function inlineTagDefs() {
const Parser = this.Parser;
const inlineTokenizers = Parser.prototype.inlineTokenizers;
const inlineMethods = Parser.prototype.inlineMethods;
const blockTokenizers = Parser.prototype.blockTokenizers;
const blockMethods = Parser.prototype.blockMethods;
blockTokenizers.... | [
"function",
"inlineTagDefs",
"(",
")",
"{",
"const",
"Parser",
"=",
"this",
".",
"Parser",
";",
"const",
"inlineTokenizers",
"=",
"Parser",
".",
"prototype",
".",
"inlineTokenizers",
";",
"const",
"inlineMethods",
"=",
"Parser",
".",
"prototype",
".",
"inlineM... | Teach remark about inline tags, so that it neither wraps block level
tags in paragraphs nor processes the text within the tag. | [
"Teach",
"remark",
"about",
"inline",
"tags",
"so",
"that",
"it",
"neither",
"wraps",
"block",
"level",
"tags",
"in",
"paragraphs",
"nor",
"processes",
"the",
"text",
"within",
"the",
"tag",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/remark-package/services/renderMarkdown.js#L43-L75 |
26 | angular/angular | aio/tools/transforms/remark-package/services/renderMarkdown.js | plainHTMLBlocks | function plainHTMLBlocks() {
const plainBlocks = ['code-example', 'code-tabs'];
// Create matchers for each block
const anyBlockMatcher = new RegExp('^' + createOpenMatcher(`(${plainBlocks.join('|')})`));
const Parser = this.Parser;
const blockTokenizers = Parser.prototype.blockTokenizers;
co... | javascript | function plainHTMLBlocks() {
const plainBlocks = ['code-example', 'code-tabs'];
// Create matchers for each block
const anyBlockMatcher = new RegExp('^' + createOpenMatcher(`(${plainBlocks.join('|')})`));
const Parser = this.Parser;
const blockTokenizers = Parser.prototype.blockTokenizers;
co... | [
"function",
"plainHTMLBlocks",
"(",
")",
"{",
"const",
"plainBlocks",
"=",
"[",
"'code-example'",
",",
"'code-tabs'",
"]",
";",
"// Create matchers for each block",
"const",
"anyBlockMatcher",
"=",
"new",
"RegExp",
"(",
"'^'",
"+",
"createOpenMatcher",
"(",
"`",
"... | Teach remark that some HTML blocks never include markdown | [
"Teach",
"remark",
"that",
"some",
"HTML",
"blocks",
"never",
"include",
"markdown"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/remark-package/services/renderMarkdown.js#L80-L113 |
27 | angular/angular | packages/bazel/src/protractor/protractor.conf.js | setConf | function setConf(conf, name, value, msg) {
if (conf[name] && conf[name] !== value) {
console.warn(
`Your protractor configuration specifies an option which is overwritten by Bazel: '${name}' ${msg}`);
}
conf[name] = value;
} | javascript | function setConf(conf, name, value, msg) {
if (conf[name] && conf[name] !== value) {
console.warn(
`Your protractor configuration specifies an option which is overwritten by Bazel: '${name}' ${msg}`);
}
conf[name] = value;
} | [
"function",
"setConf",
"(",
"conf",
",",
"name",
",",
"value",
",",
"msg",
")",
"{",
"if",
"(",
"conf",
"[",
"name",
"]",
"&&",
"conf",
"[",
"name",
"]",
"!==",
"value",
")",
"{",
"console",
".",
"warn",
"(",
"`",
"${",
"name",
"}",
"${",
"msg"... | Helper function to warn when a user specified value is being overwritten | [
"Helper",
"function",
"to",
"warn",
"when",
"a",
"user",
"specified",
"value",
"is",
"being",
"overwritten"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/packages/bazel/src/protractor/protractor.conf.js#L24-L30 |
28 | angular/angular | aio/tools/examples/run-example-e2e.js | runProtractorAoT | function runProtractorAoT(appDir, outputFile) {
fs.appendFileSync(outputFile, '++ AoT version ++\n');
const aotBuildSpawnInfo = spawnExt('yarn', ['build:aot'], {cwd: appDir});
let promise = aotBuildSpawnInfo.promise;
const copyFileCmd = 'copy-dist-files.js';
if (fs.existsSync(appDir + '/' + copyFileCmd)) {
... | javascript | function runProtractorAoT(appDir, outputFile) {
fs.appendFileSync(outputFile, '++ AoT version ++\n');
const aotBuildSpawnInfo = spawnExt('yarn', ['build:aot'], {cwd: appDir});
let promise = aotBuildSpawnInfo.promise;
const copyFileCmd = 'copy-dist-files.js';
if (fs.existsSync(appDir + '/' + copyFileCmd)) {
... | [
"function",
"runProtractorAoT",
"(",
"appDir",
",",
"outputFile",
")",
"{",
"fs",
".",
"appendFileSync",
"(",
"outputFile",
",",
"'++ AoT version ++\\n'",
")",
";",
"const",
"aotBuildSpawnInfo",
"=",
"spawnExt",
"(",
"'yarn'",
",",
"[",
"'build:aot'",
"]",
",",
... | Run e2e tests over the AOT build for projects that examples it. | [
"Run",
"e2e",
"tests",
"over",
"the",
"AOT",
"build",
"for",
"projects",
"that",
"examples",
"it",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L223-L234 |
29 | angular/angular | aio/tools/examples/run-example-e2e.js | loadExampleConfig | function loadExampleConfig(exampleFolder) {
// Default config.
let config = {build: 'build', run: 'serve:e2e'};
try {
const exampleConfig = fs.readJsonSync(`${exampleFolder}/${EXAMPLE_CONFIG_FILENAME}`);
Object.assign(config, exampleConfig);
} catch (e) {
}
return config;
} | javascript | function loadExampleConfig(exampleFolder) {
// Default config.
let config = {build: 'build', run: 'serve:e2e'};
try {
const exampleConfig = fs.readJsonSync(`${exampleFolder}/${EXAMPLE_CONFIG_FILENAME}`);
Object.assign(config, exampleConfig);
} catch (e) {
}
return config;
} | [
"function",
"loadExampleConfig",
"(",
"exampleFolder",
")",
"{",
"// Default config.",
"let",
"config",
"=",
"{",
"build",
":",
"'build'",
",",
"run",
":",
"'serve:e2e'",
"}",
";",
"try",
"{",
"const",
"exampleConfig",
"=",
"fs",
".",
"readJsonSync",
"(",
"`... | Load configuration for an example. Used for SystemJS | [
"Load",
"configuration",
"for",
"an",
"example",
".",
"Used",
"for",
"SystemJS"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L373-L384 |
30 | angular/angular | aio/tools/examples/shared/protractor.config.js | formatOutput | function formatOutput(output) {
var indent = ' ';
var pad = ' ';
var results = [];
results.push('AppDir:' + output.appDir);
output.suites.forEach(function(suite) {
results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
pad+=indent;
suite.specs.forEach(function... | javascript | function formatOutput(output) {
var indent = ' ';
var pad = ' ';
var results = [];
results.push('AppDir:' + output.appDir);
output.suites.forEach(function(suite) {
results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
pad+=indent;
suite.specs.forEach(function... | [
"function",
"formatOutput",
"(",
"output",
")",
"{",
"var",
"indent",
"=",
"' '",
";",
"var",
"pad",
"=",
"' '",
";",
"var",
"results",
"=",
"[",
"]",
";",
"results",
".",
"push",
"(",
"'AppDir:'",
"+",
"output",
".",
"appDir",
")",
";",
"output",
... | for output file output | [
"for",
"output",
"file",
"output"
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/shared/protractor.config.js#L122-L145 |
31 | angular/angular | tools/gulp-tasks/format.js | gulpStatus | function gulpStatus() {
const Vinyl = require('vinyl');
const path = require('path');
const gulpGit = require('gulp-git');
const through = require('through2');
const srcStream = through.obj();
const opt = {cwd: process.cwd()};
// https://git-scm.com/docs/git-status#_short_format
const RE_STATUS = /((\... | javascript | function gulpStatus() {
const Vinyl = require('vinyl');
const path = require('path');
const gulpGit = require('gulp-git');
const through = require('through2');
const srcStream = through.obj();
const opt = {cwd: process.cwd()};
// https://git-scm.com/docs/git-status#_short_format
const RE_STATUS = /((\... | [
"function",
"gulpStatus",
"(",
")",
"{",
"const",
"Vinyl",
"=",
"require",
"(",
"'vinyl'",
")",
";",
"const",
"path",
"=",
"require",
"(",
"'path'",
")",
";",
"const",
"gulpGit",
"=",
"require",
"(",
"'gulp-git'",
")",
";",
"const",
"through",
"=",
"re... | Gulp stream that wraps the gulp-git status,
only returns untracked files, and converts
the stdout into a stream of files. | [
"Gulp",
"stream",
"that",
"wraps",
"the",
"gulp",
"-",
"git",
"status",
"only",
"returns",
"untracked",
"files",
"and",
"converts",
"the",
"stdout",
"into",
"a",
"stream",
"of",
"files",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/format.js#L37-L83 |
32 | facebook/create-react-app | packages/react-scripts/config/modules.js | getAdditionalModulePaths | function getAdditionalModulePaths(options = {}) {
const baseUrl = options.baseUrl;
// We need to explicitly check for null and undefined (and not a falsy value) because
// TypeScript treats an empty string as `.`.
if (baseUrl == null) {
// If there's no baseUrl set we respect NODE_PATH
// Note that NOD... | javascript | function getAdditionalModulePaths(options = {}) {
const baseUrl = options.baseUrl;
// We need to explicitly check for null and undefined (and not a falsy value) because
// TypeScript treats an empty string as `.`.
if (baseUrl == null) {
// If there's no baseUrl set we respect NODE_PATH
// Note that NOD... | [
"function",
"getAdditionalModulePaths",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"baseUrl",
"=",
"options",
".",
"baseUrl",
";",
"// We need to explicitly check for null and undefined (and not a falsy value) because",
"// TypeScript treats an empty string as `.`.",
"if",... | Get the baseUrl of a compilerOptions object.
@param {Object} options | [
"Get",
"the",
"baseUrl",
"of",
"a",
"compilerOptions",
"object",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-scripts/config/modules.js#L21-L55 |
33 | facebook/create-react-app | packages/react-dev-utils/webpackHotDevClient.js | handleSuccess | function handleSuccess() {
clearOutdatedErrors();
var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
hasCompileErrors = false;
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onHotUpdateSuccess() {
// Only dismiss it when we're sure it's a h... | javascript | function handleSuccess() {
clearOutdatedErrors();
var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
hasCompileErrors = false;
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onHotUpdateSuccess() {
// Only dismiss it when we're sure it's a h... | [
"function",
"handleSuccess",
"(",
")",
"{",
"clearOutdatedErrors",
"(",
")",
";",
"var",
"isHotUpdate",
"=",
"!",
"isFirstCompilation",
";",
"isFirstCompilation",
"=",
"false",
";",
"hasCompileErrors",
"=",
"false",
";",
"// Attempt to apply hot updates or reload.",
"... | Successful compilation. | [
"Successful",
"compilation",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/webpackHotDevClient.js#L97-L112 |
34 | facebook/create-react-app | packages/react-dev-utils/FileSizeReporter.js | printFileSizesAfterBuild | function printFileSizesAfterBuild(
webpackStats,
previousSizeMap,
buildFolder,
maxBundleGzipSize,
maxChunkGzipSize
) {
var root = previousSizeMap.root;
var sizes = previousSizeMap.sizes;
var assets = (webpackStats.stats || [webpackStats])
.map(stats =>
stats
.toJson({ all: false, asset... | javascript | function printFileSizesAfterBuild(
webpackStats,
previousSizeMap,
buildFolder,
maxBundleGzipSize,
maxChunkGzipSize
) {
var root = previousSizeMap.root;
var sizes = previousSizeMap.sizes;
var assets = (webpackStats.stats || [webpackStats])
.map(stats =>
stats
.toJson({ all: false, asset... | [
"function",
"printFileSizesAfterBuild",
"(",
"webpackStats",
",",
"previousSizeMap",
",",
"buildFolder",
",",
"maxBundleGzipSize",
",",
"maxChunkGzipSize",
")",
"{",
"var",
"root",
"=",
"previousSizeMap",
".",
"root",
";",
"var",
"sizes",
"=",
"previousSizeMap",
"."... | Prints a detailed summary of build files. | [
"Prints",
"a",
"detailed",
"summary",
"of",
"build",
"files",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/FileSizeReporter.js#L27-L104 |
35 | facebook/create-react-app | packages/react-dev-utils/openBrowser.js | openBrowser | function openBrowser(url) {
const { action, value } = getBrowserEnv();
switch (action) {
case Actions.NONE:
// Special case: BROWSER="none" will prevent opening completely.
return false;
case Actions.SCRIPT:
return executeNodeScript(value, url);
case Actions.BROWSER:
return start... | javascript | function openBrowser(url) {
const { action, value } = getBrowserEnv();
switch (action) {
case Actions.NONE:
// Special case: BROWSER="none" will prevent opening completely.
return false;
case Actions.SCRIPT:
return executeNodeScript(value, url);
case Actions.BROWSER:
return start... | [
"function",
"openBrowser",
"(",
"url",
")",
"{",
"const",
"{",
"action",
",",
"value",
"}",
"=",
"getBrowserEnv",
"(",
")",
";",
"switch",
"(",
"action",
")",
"{",
"case",
"Actions",
".",
"NONE",
":",
"// Special case: BROWSER=\"none\" will prevent opening compl... | Reads the BROWSER environment variable and decides what to do with it. Returns
true if it opened a browser or ran a node.js script, otherwise false. | [
"Reads",
"the",
"BROWSER",
"environment",
"variable",
"and",
"decides",
"what",
"to",
"do",
"with",
"it",
".",
"Returns",
"true",
"if",
"it",
"opened",
"a",
"browser",
"or",
"ran",
"a",
"node",
".",
"js",
"script",
"otherwise",
"false",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/openBrowser.js#L111-L124 |
36 | facebook/create-react-app | packages/react-dev-utils/WebpackDevServerUtils.js | onProxyError | function onProxyError(proxy) {
return (err, req, res) => {
const host = req.headers && req.headers.host;
console.log(
chalk.red('Proxy error:') +
' Could not proxy request ' +
chalk.cyan(req.url) +
' from ' +
chalk.cyan(host) +
' to ' +
chalk.cyan(proxy) +... | javascript | function onProxyError(proxy) {
return (err, req, res) => {
const host = req.headers && req.headers.host;
console.log(
chalk.red('Proxy error:') +
' Could not proxy request ' +
chalk.cyan(req.url) +
' from ' +
chalk.cyan(host) +
' to ' +
chalk.cyan(proxy) +... | [
"function",
"onProxyError",
"(",
"proxy",
")",
"{",
"return",
"(",
"err",
",",
"req",
",",
"res",
")",
"=>",
"{",
"const",
"host",
"=",
"req",
".",
"headers",
"&&",
"req",
".",
"headers",
".",
"host",
";",
"console",
".",
"log",
"(",
"chalk",
".",
... | We need to provide a custom onError function for httpProxyMiddleware. It allows us to log custom error messages on the console. | [
"We",
"need",
"to",
"provide",
"a",
"custom",
"onError",
"function",
"for",
"httpProxyMiddleware",
".",
"It",
"allows",
"us",
"to",
"log",
"custom",
"error",
"messages",
"on",
"the",
"console",
"."
] | 57ef103440c24e41b0d7dc82b7ad7fc1dc817eca | https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/WebpackDevServerUtils.js#L307-L344 |
37 | ant-design/ant-design | .antd-tools.config.js | finalizeCompile | function finalizeCompile() {
if (fs.existsSync(path.join(__dirname, './lib'))) {
// Build package.json version to lib/version/index.js
// prevent json-loader needing in user-side
const versionFilePath = path.join(process.cwd(), 'lib', 'version', 'index.js');
const versionFileContent = fs.readFileSync(... | javascript | function finalizeCompile() {
if (fs.existsSync(path.join(__dirname, './lib'))) {
// Build package.json version to lib/version/index.js
// prevent json-loader needing in user-side
const versionFilePath = path.join(process.cwd(), 'lib', 'version', 'index.js');
const versionFileContent = fs.readFileSync(... | [
"function",
"finalizeCompile",
"(",
")",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'./lib'",
")",
")",
")",
"{",
"// Build package.json version to lib/version/index.js",
"// prevent json-loader needing in user-side",
"c... | We need compile additional content for antd user | [
"We",
"need",
"compile",
"additional",
"content",
"for",
"antd",
"user"
] | 6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7 | https://github.com/ant-design/ant-design/blob/6d845f60efe9bd50a25c0ce29eb1fee895b9c7b7/.antd-tools.config.js#L6-L48 |
38 | 30-seconds/30-seconds-of-code | scripts/module.js | build | async function build() {
console.time('Packager');
let requires = [];
let esmExportString = '';
let cjsExportString = '';
try {
if (!fs.existsSync(DIST_PATH)) fs.mkdirSync(DIST_PATH);
fs.writeFileSync(ROLLUP_INPUT_FILE, '');
fs.writeFileSync(TEST_MODULE_FILE, '');
// All the snippets that a... | javascript | async function build() {
console.time('Packager');
let requires = [];
let esmExportString = '';
let cjsExportString = '';
try {
if (!fs.existsSync(DIST_PATH)) fs.mkdirSync(DIST_PATH);
fs.writeFileSync(ROLLUP_INPUT_FILE, '');
fs.writeFileSync(TEST_MODULE_FILE, '');
// All the snippets that a... | [
"async",
"function",
"build",
"(",
")",
"{",
"console",
".",
"time",
"(",
"'Packager'",
")",
";",
"let",
"requires",
"=",
"[",
"]",
";",
"let",
"esmExportString",
"=",
"''",
";",
"let",
"cjsExportString",
"=",
"''",
";",
"try",
"{",
"if",
"(",
"!",
... | Starts the build process. | [
"Starts",
"the",
"build",
"process",
"."
] | 5ef18713903aaaa5ff5409ef3a6de31dbd878d0c | https://github.com/30-seconds/30-seconds-of-code/blob/5ef18713903aaaa5ff5409ef3a6de31dbd878d0c/scripts/module.js#L74-L165 |
39 | electron/electron | lib/browser/guest-view-manager.js | function (embedder, params) {
if (webViewManager == null) {
webViewManager = process.electronBinding('web_view_manager')
}
const guest = webContents.create({
isGuest: true,
partition: params.partition,
embedder: embedder
})
const guestInstanceId = guest.id
guestInstances[guestInstanceId] = ... | javascript | function (embedder, params) {
if (webViewManager == null) {
webViewManager = process.electronBinding('web_view_manager')
}
const guest = webContents.create({
isGuest: true,
partition: params.partition,
embedder: embedder
})
const guestInstanceId = guest.id
guestInstances[guestInstanceId] = ... | [
"function",
"(",
"embedder",
",",
"params",
")",
"{",
"if",
"(",
"webViewManager",
"==",
"null",
")",
"{",
"webViewManager",
"=",
"process",
".",
"electronBinding",
"(",
"'web_view_manager'",
")",
"}",
"const",
"guest",
"=",
"webContents",
".",
"create",
"("... | Create a new guest instance. | [
"Create",
"a",
"new",
"guest",
"instance",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L56-L161 | |
40 | electron/electron | lib/browser/guest-view-manager.js | function (embedder, guestInstanceId) {
const guestInstance = guestInstances[guestInstanceId]
if (embedder !== guestInstance.embedder) {
return
}
webViewManager.removeGuest(embedder, guestInstanceId)
delete guestInstances[guestInstanceId]
const key = `${embedder.id}-${guestInstance.elementInstanceId}`
... | javascript | function (embedder, guestInstanceId) {
const guestInstance = guestInstances[guestInstanceId]
if (embedder !== guestInstance.embedder) {
return
}
webViewManager.removeGuest(embedder, guestInstanceId)
delete guestInstances[guestInstanceId]
const key = `${embedder.id}-${guestInstance.elementInstanceId}`
... | [
"function",
"(",
"embedder",
",",
"guestInstanceId",
")",
"{",
"const",
"guestInstance",
"=",
"guestInstances",
"[",
"guestInstanceId",
"]",
"if",
"(",
"embedder",
"!==",
"guestInstance",
".",
"embedder",
")",
"{",
"return",
"}",
"webViewManager",
".",
"removeGu... | Remove an guest-embedder relationship. | [
"Remove",
"an",
"guest",
"-",
"embedder",
"relationship",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L276-L287 | |
41 | electron/electron | lib/browser/guest-view-manager.js | function (visibilityState) {
for (const guestInstanceId in guestInstances) {
const guestInstance = guestInstances[guestInstanceId]
guestInstance.visibilityState = visibilityState
if (guestInstance.embedder === embedder) {
guestInstance.guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILIT... | javascript | function (visibilityState) {
for (const guestInstanceId in guestInstances) {
const guestInstance = guestInstances[guestInstanceId]
guestInstance.visibilityState = visibilityState
if (guestInstance.embedder === embedder) {
guestInstance.guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILIT... | [
"function",
"(",
"visibilityState",
")",
"{",
"for",
"(",
"const",
"guestInstanceId",
"in",
"guestInstances",
")",
"{",
"const",
"guestInstance",
"=",
"guestInstances",
"[",
"guestInstanceId",
"]",
"guestInstance",
".",
"visibilityState",
"=",
"visibilityState",
"if... | Forward embedder window visiblity change events to guest | [
"Forward",
"embedder",
"window",
"visiblity",
"change",
"events",
"to",
"guest"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L299-L307 | |
42 | electron/electron | lib/browser/guest-view-manager.js | function (guestInstanceId, contents) {
const guest = getGuest(guestInstanceId)
if (!guest) {
throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`)
}
if (guest.hostWebContents !== contents) {
throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`)
}
return guest
} | javascript | function (guestInstanceId, contents) {
const guest = getGuest(guestInstanceId)
if (!guest) {
throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`)
}
if (guest.hostWebContents !== contents) {
throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`)
}
return guest
} | [
"function",
"(",
"guestInstanceId",
",",
"contents",
")",
"{",
"const",
"guest",
"=",
"getGuest",
"(",
"guestInstanceId",
")",
"if",
"(",
"!",
"guest",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"guestInstanceId",
"}",
"`",
")",
"}",
"if",
"(",... | Returns WebContents from its guest id hosted in given webContents. | [
"Returns",
"WebContents",
"from",
"its",
"guest",
"id",
"hosted",
"in",
"given",
"webContents",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L395-L404 | |
43 | electron/electron | script/prepare-release.js | changesToRelease | async function changesToRelease () {
const lastCommitWasRelease = new RegExp(`^Bump v[0-9.]*(-beta[0-9.]*)?(-nightly[0-9.]*)?$`, 'g')
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], gitDir)
return !lastCommitWasRelease.test(lastCommit.stdout)
} | javascript | async function changesToRelease () {
const lastCommitWasRelease = new RegExp(`^Bump v[0-9.]*(-beta[0-9.]*)?(-nightly[0-9.]*)?$`, 'g')
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], gitDir)
return !lastCommitWasRelease.test(lastCommit.stdout)
} | [
"async",
"function",
"changesToRelease",
"(",
")",
"{",
"const",
"lastCommitWasRelease",
"=",
"new",
"RegExp",
"(",
"`",
"`",
",",
"'g'",
")",
"const",
"lastCommit",
"=",
"await",
"GitProcess",
".",
"exec",
"(",
"[",
"'log'",
",",
"'-n'",
",",
"'1'",
","... | function to determine if there have been commits to master since the last release | [
"function",
"to",
"determine",
"if",
"there",
"have",
"been",
"commits",
"to",
"master",
"since",
"the",
"last",
"release"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/prepare-release.js#L184-L188 |
44 | electron/electron | script/release-notes/notes.js | runRetryable | async function runRetryable (fn, maxRetries) {
let lastError
for (let i = 0; i < maxRetries; i++) {
try {
return await fn()
} catch (error) {
await new Promise((resolve, reject) => setTimeout(resolve, CHECK_INTERVAL))
lastError = error
}
}
// Silently eat 404s.
if (lastError.stat... | javascript | async function runRetryable (fn, maxRetries) {
let lastError
for (let i = 0; i < maxRetries; i++) {
try {
return await fn()
} catch (error) {
await new Promise((resolve, reject) => setTimeout(resolve, CHECK_INTERVAL))
lastError = error
}
}
// Silently eat 404s.
if (lastError.stat... | [
"async",
"function",
"runRetryable",
"(",
"fn",
",",
"maxRetries",
")",
"{",
"let",
"lastError",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"maxRetries",
";",
"i",
"++",
")",
"{",
"try",
"{",
"return",
"await",
"fn",
"(",
")",
"}",
"catch",
... | helper function to add some resiliency to volatile GH api endpoints | [
"helper",
"function",
"to",
"add",
"some",
"resiliency",
"to",
"volatile",
"GH",
"api",
"endpoints"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/release-notes/notes.js#L305-L317 |
45 | electron/electron | lib/renderer/api/remote.js | wrapArgs | function wrapArgs (args, visited = new Set()) {
const valueToMeta = (value) => {
// Check for circular reference.
if (visited.has(value)) {
return {
type: 'value',
value: null
}
}
if (Array.isArray(value)) {
visited.add(value)
const meta = {
type: 'arra... | javascript | function wrapArgs (args, visited = new Set()) {
const valueToMeta = (value) => {
// Check for circular reference.
if (visited.has(value)) {
return {
type: 'value',
value: null
}
}
if (Array.isArray(value)) {
visited.add(value)
const meta = {
type: 'arra... | [
"function",
"wrapArgs",
"(",
"args",
",",
"visited",
"=",
"new",
"Set",
"(",
")",
")",
"{",
"const",
"valueToMeta",
"=",
"(",
"value",
")",
"=>",
"{",
"// Check for circular reference.",
"if",
"(",
"visited",
".",
"has",
"(",
"value",
")",
")",
"{",
"r... | Convert the arguments object into an array of meta data. | [
"Convert",
"the",
"arguments",
"object",
"into",
"an",
"array",
"of",
"meta",
"data",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L28-L105 |
46 | electron/electron | lib/renderer/api/remote.js | setObjectMembers | function setObjectMembers (ref, object, metaId, members) {
if (!Array.isArray(members)) return
for (const member of members) {
if (object.hasOwnProperty(member.name)) continue
const descriptor = { enumerable: member.enumerable }
if (member.type === 'method') {
const remoteMemberFunction = functi... | javascript | function setObjectMembers (ref, object, metaId, members) {
if (!Array.isArray(members)) return
for (const member of members) {
if (object.hasOwnProperty(member.name)) continue
const descriptor = { enumerable: member.enumerable }
if (member.type === 'method') {
const remoteMemberFunction = functi... | [
"function",
"setObjectMembers",
"(",
"ref",
",",
"object",
",",
"metaId",
",",
"members",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"members",
")",
")",
"return",
"for",
"(",
"const",
"member",
"of",
"members",
")",
"{",
"if",
"(",
"obj... | Populate object's members from descriptors. The |ref| will be kept referenced by |members|. This matches |getObjectMemebers| in rpc-server. | [
"Populate",
"object",
"s",
"members",
"from",
"descriptors",
".",
"The",
"|ref|",
"will",
"be",
"kept",
"referenced",
"by",
"|members|",
".",
"This",
"matches",
"|getObjectMemebers|",
"in",
"rpc",
"-",
"server",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L110-L161 |
47 | electron/electron | lib/renderer/api/remote.js | setObjectPrototype | function setObjectPrototype (ref, object, metaId, descriptor) {
if (descriptor === null) return
const proto = {}
setObjectMembers(ref, proto, metaId, descriptor.members)
setObjectPrototype(ref, proto, metaId, descriptor.proto)
Object.setPrototypeOf(object, proto)
} | javascript | function setObjectPrototype (ref, object, metaId, descriptor) {
if (descriptor === null) return
const proto = {}
setObjectMembers(ref, proto, metaId, descriptor.members)
setObjectPrototype(ref, proto, metaId, descriptor.proto)
Object.setPrototypeOf(object, proto)
} | [
"function",
"setObjectPrototype",
"(",
"ref",
",",
"object",
",",
"metaId",
",",
"descriptor",
")",
"{",
"if",
"(",
"descriptor",
"===",
"null",
")",
"return",
"const",
"proto",
"=",
"{",
"}",
"setObjectMembers",
"(",
"ref",
",",
"proto",
",",
"metaId",
... | Populate object's prototype from descriptor. This matches |getObjectPrototype| in rpc-server. | [
"Populate",
"object",
"s",
"prototype",
"from",
"descriptor",
".",
"This",
"matches",
"|getObjectPrototype|",
"in",
"rpc",
"-",
"server",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L165-L171 |
48 | electron/electron | lib/renderer/api/remote.js | proxyFunctionProperties | function proxyFunctionProperties (remoteMemberFunction, metaId, name) {
let loaded = false
// Lazily load function properties
const loadRemoteProperties = () => {
if (loaded) return
loaded = true
const command = 'ELECTRON_BROWSER_MEMBER_GET'
const meta = ipcRendererInternal.sendSync(command, cont... | javascript | function proxyFunctionProperties (remoteMemberFunction, metaId, name) {
let loaded = false
// Lazily load function properties
const loadRemoteProperties = () => {
if (loaded) return
loaded = true
const command = 'ELECTRON_BROWSER_MEMBER_GET'
const meta = ipcRendererInternal.sendSync(command, cont... | [
"function",
"proxyFunctionProperties",
"(",
"remoteMemberFunction",
",",
"metaId",
",",
"name",
")",
"{",
"let",
"loaded",
"=",
"false",
"// Lazily load function properties",
"const",
"loadRemoteProperties",
"=",
"(",
")",
"=>",
"{",
"if",
"(",
"loaded",
")",
"ret... | Wrap function in Proxy for accessing remote properties | [
"Wrap",
"function",
"in",
"Proxy",
"for",
"accessing",
"remote",
"properties"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L174-L211 |
49 | electron/electron | lib/renderer/api/remote.js | metaToValue | function metaToValue (meta) {
const types = {
value: () => meta.value,
array: () => meta.members.map((member) => metaToValue(member)),
buffer: () => bufferUtils.metaToBuffer(meta.value),
promise: () => resolvePromise({ then: metaToValue(meta.then) }),
error: () => metaToPlainObject(meta),
date... | javascript | function metaToValue (meta) {
const types = {
value: () => meta.value,
array: () => meta.members.map((member) => metaToValue(member)),
buffer: () => bufferUtils.metaToBuffer(meta.value),
promise: () => resolvePromise({ then: metaToValue(meta.then) }),
error: () => metaToPlainObject(meta),
date... | [
"function",
"metaToValue",
"(",
"meta",
")",
"{",
"const",
"types",
"=",
"{",
"value",
":",
"(",
")",
"=>",
"meta",
".",
"value",
",",
"array",
":",
"(",
")",
"=>",
"meta",
".",
"members",
".",
"map",
"(",
"(",
"member",
")",
"=>",
"metaToValue",
... | Convert meta data from browser into real value. | [
"Convert",
"meta",
"data",
"from",
"browser",
"into",
"real",
"value",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L214-L262 |
50 | electron/electron | lib/renderer/api/remote.js | metaToPlainObject | function metaToPlainObject (meta) {
const obj = (() => meta.type === 'error' ? new Error() : {})()
for (let i = 0; i < meta.members.length; i++) {
const { name, value } = meta.members[i]
obj[name] = value
}
return obj
} | javascript | function metaToPlainObject (meta) {
const obj = (() => meta.type === 'error' ? new Error() : {})()
for (let i = 0; i < meta.members.length; i++) {
const { name, value } = meta.members[i]
obj[name] = value
}
return obj
} | [
"function",
"metaToPlainObject",
"(",
"meta",
")",
"{",
"const",
"obj",
"=",
"(",
"(",
")",
"=>",
"meta",
".",
"type",
"===",
"'error'",
"?",
"new",
"Error",
"(",
")",
":",
"{",
"}",
")",
"(",
")",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
... | Construct a plain object from the meta. | [
"Construct",
"a",
"plain",
"object",
"from",
"the",
"meta",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L265-L272 |
51 | electron/electron | lib/browser/chrome-extension.js | function (srcDirectory) {
let manifest
let manifestContent
try {
manifestContent = fs.readFileSync(path.join(srcDirectory, 'manifest.json'))
} catch (readError) {
console.warn(`Reading ${path.join(srcDirectory, 'manifest.json')} failed.`)
console.warn(readError.stack || readError)
throw readErr... | javascript | function (srcDirectory) {
let manifest
let manifestContent
try {
manifestContent = fs.readFileSync(path.join(srcDirectory, 'manifest.json'))
} catch (readError) {
console.warn(`Reading ${path.join(srcDirectory, 'manifest.json')} failed.`)
console.warn(readError.stack || readError)
throw readErr... | [
"function",
"(",
"srcDirectory",
")",
"{",
"let",
"manifest",
"let",
"manifestContent",
"try",
"{",
"manifestContent",
"=",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"join",
"(",
"srcDirectory",
",",
"'manifest.json'",
")",
")",
"}",
"catch",
"(",
"readEr... | Create or get manifest object from |srcDirectory|. | [
"Create",
"or",
"get",
"manifest",
"object",
"from",
"|srcDirectory|",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/chrome-extension.js#L33-L73 | |
52 | electron/electron | lib/browser/chrome-extension.js | function (webContents) {
const tabId = webContents.id
sendToBackgroundPages('CHROME_TABS_ONCREATED')
webContents.on('will-navigate', (event, url) => {
sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', {
frameId: 0,
parentFrameId: -1,
processId: webContents.getProcessId(),
... | javascript | function (webContents) {
const tabId = webContents.id
sendToBackgroundPages('CHROME_TABS_ONCREATED')
webContents.on('will-navigate', (event, url) => {
sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', {
frameId: 0,
parentFrameId: -1,
processId: webContents.getProcessId(),
... | [
"function",
"(",
"webContents",
")",
"{",
"const",
"tabId",
"=",
"webContents",
".",
"id",
"sendToBackgroundPages",
"(",
"'CHROME_TABS_ONCREATED'",
")",
"webContents",
".",
"on",
"(",
"'will-navigate'",
",",
"(",
"event",
",",
"url",
")",
"=>",
"{",
"sendToBac... | Dispatch web contents events to Chrome APIs | [
"Dispatch",
"web",
"contents",
"events",
"to",
"Chrome",
"APIs"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/chrome-extension.js#L123-L153 | |
53 | electron/electron | lib/browser/chrome-extension.js | function (manifest) {
return {
startPage: manifest.startPage,
srcDirectory: manifest.srcDirectory,
name: manifest.name,
exposeExperimentalAPIs: true
}
} | javascript | function (manifest) {
return {
startPage: manifest.startPage,
srcDirectory: manifest.srcDirectory,
name: manifest.name,
exposeExperimentalAPIs: true
}
} | [
"function",
"(",
"manifest",
")",
"{",
"return",
"{",
"startPage",
":",
"manifest",
".",
"startPage",
",",
"srcDirectory",
":",
"manifest",
".",
"srcDirectory",
",",
"name",
":",
"manifest",
".",
"name",
",",
"exposeExperimentalAPIs",
":",
"true",
"}",
"}"
] | Transfer the |manifest| to a format that can be recognized by the |DevToolsAPI.addExtensions|. | [
"Transfer",
"the",
"|manifest|",
"to",
"a",
"format",
"that",
"can",
"be",
"recognized",
"by",
"the",
"|DevToolsAPI",
".",
"addExtensions|",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/chrome-extension.js#L357-L364 | |
54 | electron/electron | lib/sandboxed_renderer/init.js | preloadRequire | function preloadRequire (module) {
if (loadedModules.has(module)) {
return loadedModules.get(module)
}
throw new Error(`module not found: ${module}`)
} | javascript | function preloadRequire (module) {
if (loadedModules.has(module)) {
return loadedModules.get(module)
}
throw new Error(`module not found: ${module}`)
} | [
"function",
"preloadRequire",
"(",
"module",
")",
"{",
"if",
"(",
"loadedModules",
".",
"has",
"(",
"module",
")",
")",
"{",
"return",
"loadedModules",
".",
"get",
"(",
"module",
")",
"}",
"throw",
"new",
"Error",
"(",
"`",
"${",
"module",
"}",
"`",
... | This is the `require` function that will be visible to the preload script | [
"This",
"is",
"the",
"require",
"function",
"that",
"will",
"be",
"visible",
"to",
"the",
"preload",
"script"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/sandboxed_renderer/init.js#L99-L104 |
55 | electron/electron | lib/browser/api/menu.js | generateGroupId | function generateGroupId (items, pos) {
if (pos > 0) {
for (let idx = pos - 1; idx >= 0; idx--) {
if (items[idx].type === 'radio') return items[idx].groupId
if (items[idx].type === 'separator') break
}
} else if (pos < items.length) {
for (let idx = pos; idx <= items.length - 1; idx++) {
... | javascript | function generateGroupId (items, pos) {
if (pos > 0) {
for (let idx = pos - 1; idx >= 0; idx--) {
if (items[idx].type === 'radio') return items[idx].groupId
if (items[idx].type === 'separator') break
}
} else if (pos < items.length) {
for (let idx = pos; idx <= items.length - 1; idx++) {
... | [
"function",
"generateGroupId",
"(",
"items",
",",
"pos",
")",
"{",
"if",
"(",
"pos",
">",
"0",
")",
"{",
"for",
"(",
"let",
"idx",
"=",
"pos",
"-",
"1",
";",
"idx",
">=",
"0",
";",
"idx",
"--",
")",
"{",
"if",
"(",
"items",
"[",
"idx",
"]",
... | Search between separators to find a radio menu item and return its group id | [
"Search",
"between",
"separators",
"to",
"find",
"a",
"radio",
"menu",
"item",
"and",
"return",
"its",
"group",
"id"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/menu.js#L213-L227 |
56 | electron/electron | lib/browser/api/auto-updater/squirrel-update-win.js | function (args, detached, callback) {
let error, errorEmitted, stderr, stdout
try {
// Ensure we don't spawn multiple squirrel processes
// Process spawned, same args: Attach events to alread running process
// Process spawned, different args: Return with error
// No process spawned: ... | javascript | function (args, detached, callback) {
let error, errorEmitted, stderr, stdout
try {
// Ensure we don't spawn multiple squirrel processes
// Process spawned, same args: Attach events to alread running process
// Process spawned, different args: Return with error
// No process spawned: ... | [
"function",
"(",
"args",
",",
"detached",
",",
"callback",
")",
"{",
"let",
"error",
",",
"errorEmitted",
",",
"stderr",
",",
"stdout",
"try",
"{",
"// Ensure we don't spawn multiple squirrel processes",
"// Process spawned, same args: Attach events to alread running p... | Spawn a command and invoke the callback when it completes with an error and the output from standard out. | [
"Spawn",
"a",
"command",
"and",
"invoke",
"the",
"callback",
"when",
"it",
"completes",
"with",
"an",
"error",
"and",
"the",
"output",
"from",
"standard",
"out",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/auto-updater/squirrel-update-win.js#L20-L79 | |
57 | electron/electron | lib/browser/api/menu-utils.js | sortTopologically | function sortTopologically (originalOrder, edgesById) {
const sorted = []
const marked = new Set()
const visit = (mark) => {
if (marked.has(mark)) return
marked.add(mark)
const edges = edgesById.get(mark)
if (edges != null) {
edges.forEach(visit)
}
sorted.push(mark)
}
originalO... | javascript | function sortTopologically (originalOrder, edgesById) {
const sorted = []
const marked = new Set()
const visit = (mark) => {
if (marked.has(mark)) return
marked.add(mark)
const edges = edgesById.get(mark)
if (edges != null) {
edges.forEach(visit)
}
sorted.push(mark)
}
originalO... | [
"function",
"sortTopologically",
"(",
"originalOrder",
",",
"edgesById",
")",
"{",
"const",
"sorted",
"=",
"[",
"]",
"const",
"marked",
"=",
"new",
"Set",
"(",
")",
"const",
"visit",
"=",
"(",
"mark",
")",
"=>",
"{",
"if",
"(",
"marked",
".",
"has",
... | Sort nodes topologically using a depth-first approach. Encountered cycles are broken. | [
"Sort",
"nodes",
"topologically",
"using",
"a",
"depth",
"-",
"first",
"approach",
".",
"Encountered",
"cycles",
"are",
"broken",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/api/menu-utils.js#L53-L69 |
58 | electron/electron | lib/browser/rpc-server.js | function (object) {
const proto = Object.getPrototypeOf(object)
if (proto === null || proto === Object.prototype) return null
return {
members: getObjectMembers(proto),
proto: getObjectPrototype(proto)
}
} | javascript | function (object) {
const proto = Object.getPrototypeOf(object)
if (proto === null || proto === Object.prototype) return null
return {
members: getObjectMembers(proto),
proto: getObjectPrototype(proto)
}
} | [
"function",
"(",
"object",
")",
"{",
"const",
"proto",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"object",
")",
"if",
"(",
"proto",
"===",
"null",
"||",
"proto",
"===",
"Object",
".",
"prototype",
")",
"return",
"null",
"return",
"{",
"members",
":",
... | Return the description of object's prototype. | [
"Return",
"the",
"description",
"of",
"object",
"s",
"prototype",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/rpc-server.js#L61-L68 | |
59 | electron/electron | lib/browser/rpc-server.js | function (sender, contextId, value, optimizeSimpleObject = false) {
// Determine the type of value.
const meta = { type: typeof value }
if (meta.type === 'object') {
// Recognize certain types of objects.
if (value === null) {
meta.type = 'value'
} else if (bufferUtils.isBuffer(value)) {
m... | javascript | function (sender, contextId, value, optimizeSimpleObject = false) {
// Determine the type of value.
const meta = { type: typeof value }
if (meta.type === 'object') {
// Recognize certain types of objects.
if (value === null) {
meta.type = 'value'
} else if (bufferUtils.isBuffer(value)) {
m... | [
"function",
"(",
"sender",
",",
"contextId",
",",
"value",
",",
"optimizeSimpleObject",
"=",
"false",
")",
"{",
"// Determine the type of value.",
"const",
"meta",
"=",
"{",
"type",
":",
"typeof",
"value",
"}",
"if",
"(",
"meta",
".",
"type",
"===",
"'object... | Convert a real value into meta data. | [
"Convert",
"a",
"real",
"value",
"into",
"meta",
"data",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/rpc-server.js#L71-L134 | |
60 | electron/electron | lib/browser/rpc-server.js | function (obj) {
return Object.getOwnPropertyNames(obj).map(function (name) {
return {
name: name,
value: obj[name]
}
})
} | javascript | function (obj) {
return Object.getOwnPropertyNames(obj).map(function (name) {
return {
name: name,
value: obj[name]
}
})
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"Object",
".",
"getOwnPropertyNames",
"(",
"obj",
")",
".",
"map",
"(",
"function",
"(",
"name",
")",
"{",
"return",
"{",
"name",
":",
"name",
",",
"value",
":",
"obj",
"[",
"name",
"]",
"}",
"}",
")",
... | Convert object to meta by value. | [
"Convert",
"object",
"to",
"meta",
"by",
"value",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/rpc-server.js#L137-L144 | |
61 | electron/electron | lib/browser/rpc-server.js | function (sender, frameId, contextId, args) {
const metaToValue = function (meta) {
switch (meta.type) {
case 'value':
return meta.value
case 'remote-object':
return objectsRegistry.get(meta.id)
case 'array':
return unwrapArgs(sender, frameId, contextId, meta.value)
... | javascript | function (sender, frameId, contextId, args) {
const metaToValue = function (meta) {
switch (meta.type) {
case 'value':
return meta.value
case 'remote-object':
return objectsRegistry.get(meta.id)
case 'array':
return unwrapArgs(sender, frameId, contextId, meta.value)
... | [
"function",
"(",
"sender",
",",
"frameId",
",",
"contextId",
",",
"args",
")",
"{",
"const",
"metaToValue",
"=",
"function",
"(",
"meta",
")",
"{",
"switch",
"(",
"meta",
".",
"type",
")",
"{",
"case",
"'value'",
":",
"return",
"meta",
".",
"value",
... | Convert array of meta data from renderer into array of real values. | [
"Convert",
"array",
"of",
"meta",
"data",
"from",
"renderer",
"into",
"array",
"of",
"real",
"values",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/rpc-server.js#L183-L245 | |
62 | electron/electron | lib/renderer/api/desktop-capturer.js | isValid | function isValid (options) {
const types = options ? options.types : undefined
return Array.isArray(types)
} | javascript | function isValid (options) {
const types = options ? options.types : undefined
return Array.isArray(types)
} | [
"function",
"isValid",
"(",
"options",
")",
"{",
"const",
"types",
"=",
"options",
"?",
"options",
".",
"types",
":",
"undefined",
"return",
"Array",
".",
"isArray",
"(",
"types",
")",
"}"
] | |options.types| can't be empty and must be an array | [
"|options",
".",
"types|",
"can",
"t",
"be",
"empty",
"and",
"must",
"be",
"an",
"array"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/desktop-capturer.js#L7-L10 |
63 | electron/electron | script/bump-version.js | updateVersion | async function updateVersion (version) {
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
await writeFile(versionPath, version, 'utf8')
} | javascript | async function updateVersion (version) {
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
await writeFile(versionPath, version, 'utf8')
} | [
"async",
"function",
"updateVersion",
"(",
"version",
")",
"{",
"const",
"versionPath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"'ELECTRON_VERSION'",
")",
"await",
"writeFile",
"(",
"versionPath",
",",
"version",
",",
"'utf8'",
")",
... | update VERSION file with latest release info | [
"update",
"VERSION",
"file",
"with",
"latest",
"release",
"info"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L107-L110 |
64 | electron/electron | script/bump-version.js | updatePackageJSON | async function updatePackageJSON (version) {
['package.json'].forEach(async fileName => {
const filePath = path.resolve(__dirname, '..', fileName)
const file = require(filePath)
file.version = version
await writeFile(filePath, JSON.stringify(file, null, 2))
})
} | javascript | async function updatePackageJSON (version) {
['package.json'].forEach(async fileName => {
const filePath = path.resolve(__dirname, '..', fileName)
const file = require(filePath)
file.version = version
await writeFile(filePath, JSON.stringify(file, null, 2))
})
} | [
"async",
"function",
"updatePackageJSON",
"(",
"version",
")",
"{",
"[",
"'package.json'",
"]",
".",
"forEach",
"(",
"async",
"fileName",
"=>",
"{",
"const",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"fileName",
")",
"con... | update package metadata files with new version | [
"update",
"package",
"metadata",
"files",
"with",
"new",
"version"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L113-L120 |
65 | electron/electron | script/bump-version.js | commitVersionBump | async function commitVersionBump (version) {
const gitDir = path.resolve(__dirname, '..')
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
await GitProcess.exec(gitArgs, gitDir)
} | javascript | async function commitVersionBump (version) {
const gitDir = path.resolve(__dirname, '..')
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
await GitProcess.exec(gitArgs, gitDir)
} | [
"async",
"function",
"commitVersionBump",
"(",
"version",
")",
"{",
"const",
"gitDir",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
")",
"const",
"gitArgs",
"=",
"[",
"'commit'",
",",
"'-a'",
",",
"'-m'",
",",
"`",
"${",
"version",
"}",
... | push bump commit to release branch | [
"push",
"bump",
"commit",
"to",
"release",
"branch"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L135-L139 |
66 | electron/electron | script/bump-version.js | updateWinRC | async function updateWinRC (components) {
const filePath = path.resolve(__dirname, '..', 'atom', 'browser', 'resources', 'win', 'atom.rc')
const data = await readFile(filePath, 'utf8')
const arr = data.split('\n')
arr.forEach((line, idx) => {
if (line.includes('FILEVERSION')) {
arr[idx] = ` FILEVERSIO... | javascript | async function updateWinRC (components) {
const filePath = path.resolve(__dirname, '..', 'atom', 'browser', 'resources', 'win', 'atom.rc')
const data = await readFile(filePath, 'utf8')
const arr = data.split('\n')
arr.forEach((line, idx) => {
if (line.includes('FILEVERSION')) {
arr[idx] = ` FILEVERSIO... | [
"async",
"function",
"updateWinRC",
"(",
"components",
")",
"{",
"const",
"filePath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"'atom'",
",",
"'browser'",
",",
"'resources'",
",",
"'win'",
",",
"'atom.rc'",
")",
"const",
"data",
"="... | updates atom.rc file with new semver values | [
"updates",
"atom",
".",
"rc",
"file",
"with",
"new",
"semver",
"values"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L161-L175 |
67 | electron/electron | lib/browser/guest-window-manager.js | function (child, parent, visited) {
// Check for circular reference.
if (visited == null) visited = new Set()
if (visited.has(parent)) return
visited.add(parent)
for (const key in parent) {
if (key === 'isBrowserView') continue
if (!hasProp.call(parent, key)) continue
if (key in child && key !== ... | javascript | function (child, parent, visited) {
// Check for circular reference.
if (visited == null) visited = new Set()
if (visited.has(parent)) return
visited.add(parent)
for (const key in parent) {
if (key === 'isBrowserView') continue
if (!hasProp.call(parent, key)) continue
if (key in child && key !== ... | [
"function",
"(",
"child",
",",
"parent",
",",
"visited",
")",
"{",
"// Check for circular reference.",
"if",
"(",
"visited",
"==",
"null",
")",
"visited",
"=",
"new",
"Set",
"(",
")",
"if",
"(",
"visited",
".",
"has",
"(",
"parent",
")",
")",
"return",
... | Copy attribute of |parent| to |child| if it is not defined in |child|. | [
"Copy",
"attribute",
"of",
"|parent|",
"to",
"|child|",
"if",
"it",
"is",
"not",
"defined",
"in",
"|child|",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L24-L45 | |
68 | electron/electron | lib/browser/guest-window-manager.js | function (embedder, options) {
if (options.webPreferences == null) {
options.webPreferences = {}
}
if (embedder.browserWindowOptions != null) {
let parentOptions = embedder.browserWindowOptions
// if parent's visibility is available, that overrides 'show' flag (#12125)
const win = BrowserWindow.f... | javascript | function (embedder, options) {
if (options.webPreferences == null) {
options.webPreferences = {}
}
if (embedder.browserWindowOptions != null) {
let parentOptions = embedder.browserWindowOptions
// if parent's visibility is available, that overrides 'show' flag (#12125)
const win = BrowserWindow.f... | [
"function",
"(",
"embedder",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"webPreferences",
"==",
"null",
")",
"{",
"options",
".",
"webPreferences",
"=",
"{",
"}",
"}",
"if",
"(",
"embedder",
".",
"browserWindowOptions",
"!=",
"null",
")",
"{",
... | Merge |options| with the |embedder|'s window's options. | [
"Merge",
"|options|",
"with",
"the",
"|embedder|",
"s",
"window",
"s",
"options",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L48-L80 | |
69 | electron/electron | lib/browser/guest-window-manager.js | function (embedder, frameName, guest, options) {
// When |embedder| is destroyed we should also destroy attached guest, and if
// guest is closed by user then we should prevent |embedder| from double
// closing guest.
const guestId = guest.webContents.id
const closedByEmbedder = function () {
guest.remove... | javascript | function (embedder, frameName, guest, options) {
// When |embedder| is destroyed we should also destroy attached guest, and if
// guest is closed by user then we should prevent |embedder| from double
// closing guest.
const guestId = guest.webContents.id
const closedByEmbedder = function () {
guest.remove... | [
"function",
"(",
"embedder",
",",
"frameName",
",",
"guest",
",",
"options",
")",
"{",
"// When |embedder| is destroyed we should also destroy attached guest, and if",
"// guest is closed by user then we should prevent |embedder| from double",
"// closing guest.",
"const",
"guestId",
... | Setup a new guest with |embedder| | [
"Setup",
"a",
"new",
"guest",
"with",
"|embedder|"
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L83-L106 | |
70 | electron/electron | lib/browser/guest-window-manager.js | function (embedder, url, referrer, frameName, options, postData) {
let guest = frameToGuest.get(frameName)
if (frameName && (guest != null)) {
guest.loadURL(url)
return guest.webContents.id
}
// Remember the embedder window's id.
if (options.webPreferences == null) {
options.webPreferences = {}
... | javascript | function (embedder, url, referrer, frameName, options, postData) {
let guest = frameToGuest.get(frameName)
if (frameName && (guest != null)) {
guest.loadURL(url)
return guest.webContents.id
}
// Remember the embedder window's id.
if (options.webPreferences == null) {
options.webPreferences = {}
... | [
"function",
"(",
"embedder",
",",
"url",
",",
"referrer",
",",
"frameName",
",",
"options",
",",
"postData",
")",
"{",
"let",
"guest",
"=",
"frameToGuest",
".",
"get",
"(",
"frameName",
")",
"if",
"(",
"frameName",
"&&",
"(",
"guest",
"!=",
"null",
")"... | Create a new guest created by |embedder| with |options|. | [
"Create",
"a",
"new",
"guest",
"created",
"by",
"|embedder|",
"with",
"|options|",
"."
] | 6e29611788277729647acf465f10db1ea6f15788 | https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-window-manager.js#L109-L146 | |
71 | storybooks/storybook | addons/storyshots/storyshots-core/src/frameworks/svelte/renderTree.js | getRenderedTree | function getRenderedTree(story) {
const { Component, props } = story.render();
const DefaultCompatComponent = Component.default || Component;
// We need to create a target to mount onto.
const target = document.createElement('section');
new DefaultCompatComponent({ target, props }); // eslint-disable-line
... | javascript | function getRenderedTree(story) {
const { Component, props } = story.render();
const DefaultCompatComponent = Component.default || Component;
// We need to create a target to mount onto.
const target = document.createElement('section');
new DefaultCompatComponent({ target, props }); // eslint-disable-line
... | [
"function",
"getRenderedTree",
"(",
"story",
")",
"{",
"const",
"{",
"Component",
",",
"props",
"}",
"=",
"story",
".",
"render",
"(",
")",
";",
"const",
"DefaultCompatComponent",
"=",
"Component",
".",
"default",
"||",
"Component",
";",
"// We need to create ... | Provides functionality to convert your raw story to the resulting markup.
Storybook snapshots need the rendered markup that svelte outputs,
but since we only have the story config data ({ Component, data }) in
the Svelte stories, we need to mount the component, and then return the
resulting HTML.
If we don't render t... | [
"Provides",
"functionality",
"to",
"convert",
"your",
"raw",
"story",
"to",
"the",
"resulting",
"markup",
"."
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/addons/storyshots/storyshots-core/src/frameworks/svelte/renderTree.js#L14-L29 |
72 | storybooks/storybook | lib/core/src/client/preview/start.js | showException | function showException(exception) {
addons.getChannel().emit(Events.STORY_THREW_EXCEPTION, exception);
showErrorDisplay(exception);
// Log the stack to the console. So, user could check the source code.
logger.error(exception.stack);
} | javascript | function showException(exception) {
addons.getChannel().emit(Events.STORY_THREW_EXCEPTION, exception);
showErrorDisplay(exception);
// Log the stack to the console. So, user could check the source code.
logger.error(exception.stack);
} | [
"function",
"showException",
"(",
"exception",
")",
"{",
"addons",
".",
"getChannel",
"(",
")",
".",
"emit",
"(",
"Events",
".",
"STORY_THREW_EXCEPTION",
",",
"exception",
")",
";",
"showErrorDisplay",
"(",
"exception",
")",
";",
"// Log the stack to the console. ... | showException is used if we fail to render the story and it is uncaught by the app layer | [
"showException",
"is",
"used",
"if",
"we",
"fail",
"to",
"render",
"the",
"story",
"and",
"it",
"is",
"uncaught",
"by",
"the",
"app",
"layer"
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/lib/core/src/client/preview/start.js#L50-L56 |
73 | storybooks/storybook | lib/core/src/server/utils/load-custom-babel-config.js | loadFromPath | function loadFromPath(babelConfigPath) {
let config;
if (fs.existsSync(babelConfigPath)) {
const content = fs.readFileSync(babelConfigPath, 'utf-8');
try {
config = JSON5.parse(content);
config.babelrc = false;
logger.info('=> Loading custom .babelrc');
} catch (e) {
logger.error... | javascript | function loadFromPath(babelConfigPath) {
let config;
if (fs.existsSync(babelConfigPath)) {
const content = fs.readFileSync(babelConfigPath, 'utf-8');
try {
config = JSON5.parse(content);
config.babelrc = false;
logger.info('=> Loading custom .babelrc');
} catch (e) {
logger.error... | [
"function",
"loadFromPath",
"(",
"babelConfigPath",
")",
"{",
"let",
"config",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"babelConfigPath",
")",
")",
"{",
"const",
"content",
"=",
"fs",
".",
"readFileSync",
"(",
"babelConfigPath",
",",
"'utf-8'",
")",
... | Tries to load a .babelrc and returns the parsed object if successful | [
"Tries",
"to",
"load",
"a",
".",
"babelrc",
"and",
"returns",
"the",
"parsed",
"object",
"if",
"successful"
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/lib/core/src/server/utils/load-custom-babel-config.js#L17-L47 |
74 | storybooks/storybook | examples/official-storybook/config.js | importAll | function importAll(context) {
const storyStore = window.__STORYBOOK_CLIENT_API__._storyStore; // eslint-disable-line no-undef, no-underscore-dangle
context.keys().forEach(filename => {
const fileExports = context(filename);
// A old-style story file
if (!fileExports.default) {
return;
}
... | javascript | function importAll(context) {
const storyStore = window.__STORYBOOK_CLIENT_API__._storyStore; // eslint-disable-line no-undef, no-underscore-dangle
context.keys().forEach(filename => {
const fileExports = context(filename);
// A old-style story file
if (!fileExports.default) {
return;
}
... | [
"function",
"importAll",
"(",
"context",
")",
"{",
"const",
"storyStore",
"=",
"window",
".",
"__STORYBOOK_CLIENT_API__",
".",
"_storyStore",
";",
"// eslint-disable-line no-undef, no-underscore-dangle",
"context",
".",
"keys",
"(",
")",
".",
"forEach",
"(",
"filename... | The simplest version of examples would just export this function for users to use | [
"The",
"simplest",
"version",
"of",
"examples",
"would",
"just",
"export",
"this",
"function",
"for",
"users",
"to",
"use"
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/examples/official-storybook/config.js#L72-L118 |
75 | ColorlibHQ/AdminLTE | bower_components/Flot/jquery.flot.selection.js | extractRange | function extractRange(ranges, coord) {
var axis, from, to, key, axes = plot.getAxes();
for (var k in axes) {
axis = axes[k];
if (axis.direction == coord) {
key = coord + axis.n + "axis";
if (!ranges[key] && axis.n == 1)
... | javascript | function extractRange(ranges, coord) {
var axis, from, to, key, axes = plot.getAxes();
for (var k in axes) {
axis = axes[k];
if (axis.direction == coord) {
key = coord + axis.n + "axis";
if (!ranges[key] && axis.n == 1)
... | [
"function",
"extractRange",
"(",
"ranges",
",",
"coord",
")",
"{",
"var",
"axis",
",",
"from",
",",
"to",
",",
"key",
",",
"axes",
"=",
"plot",
".",
"getAxes",
"(",
")",
";",
"for",
"(",
"var",
"k",
"in",
"axes",
")",
"{",
"axis",
"=",
"axes",
... | function taken from markings support in Flot | [
"function",
"taken",
"from",
"markings",
"support",
"in",
"Flot"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/Flot/jquery.flot.selection.js#L225-L257 |
76 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/data-series.js | function(values) {
var max = Number.MIN_VALUE,
min = Number.MAX_VALUE,
val,
cc,
attrs = {};
if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
if (!this.params.min || !this.params.max) {
for (cc in values) {
val =... | javascript | function(values) {
var max = Number.MIN_VALUE,
min = Number.MAX_VALUE,
val,
cc,
attrs = {};
if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
if (!this.params.min || !this.params.max) {
for (cc in values) {
val =... | [
"function",
"(",
"values",
")",
"{",
"var",
"max",
"=",
"Number",
".",
"MIN_VALUE",
",",
"min",
"=",
"Number",
".",
"MAX_VALUE",
",",
"val",
",",
"cc",
",",
"attrs",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"this",
".",
"scale",
"instanceof",
"jv... | Set values for the data set.
@param {Object} values Object which maps codes of regions or markers to values. | [
"Set",
"values",
"for",
"the",
"data",
"set",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/data-series.js#L60-L103 | |
77 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(node) {
assertRangeValid(this);
var parent = node.parentNode;
var nodeIndex = getNodeIndex(node);
if (!parent) {
throw new DOMException("NOT_FOUND_ERR");
}
var startComparison = this.comparePo... | javascript | function(node) {
assertRangeValid(this);
var parent = node.parentNode;
var nodeIndex = getNodeIndex(node);
if (!parent) {
throw new DOMException("NOT_FOUND_ERR");
}
var startComparison = this.comparePo... | [
"function",
"(",
"node",
")",
"{",
"assertRangeValid",
"(",
"this",
")",
";",
"var",
"parent",
"=",
"node",
".",
"parentNode",
";",
"var",
"nodeIndex",
"=",
"getNodeIndex",
"(",
"node",
")",
";",
"if",
"(",
"!",
"parent",
")",
"{",
"throw",
"new",
"D... | The methods below are all non-standard. The following batch were introduced by Mozilla but have since been removed from Mozilla. | [
"The",
"methods",
"below",
"are",
"all",
"non",
"-",
"standard",
".",
"The",
"following",
"batch",
"were",
"introduced",
"by",
"Mozilla",
"but",
"have",
"since",
"been",
"removed",
"from",
"Mozilla",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L1622-L1640 | |
78 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(sel, range) {
var ranges = sel.getAllRanges();
sel.removeAllRanges();
for (var i = 0, len = ranges.length; i < len; ++i) {
if (!rangesEqual(range, ranges[i])) {
sel.addRange(ranges[i]);
}
}
if (!sel.... | javascript | function(sel, range) {
var ranges = sel.getAllRanges();
sel.removeAllRanges();
for (var i = 0, len = ranges.length; i < len; ++i) {
if (!rangesEqual(range, ranges[i])) {
sel.addRange(ranges[i]);
}
}
if (!sel.... | [
"function",
"(",
"sel",
",",
"range",
")",
"{",
"var",
"ranges",
"=",
"sel",
".",
"getAllRanges",
"(",
")",
";",
"sel",
".",
"removeAllRanges",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"ranges",
".",
"length",
";",
"i",
... | Removal of a single range | [
"Removal",
"of",
"a",
"single",
"range"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L3480-L3491 | |
79 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(context) {
var element = context.createElement("div"),
html5 = "<article>foo</article>";
element.innerHTML = html5;
return element.innerHTML.toLowerCase() === html5;
} | javascript | function(context) {
var element = context.createElement("div"),
html5 = "<article>foo</article>";
element.innerHTML = html5;
return element.innerHTML.toLowerCase() === html5;
} | [
"function",
"(",
"context",
")",
"{",
"var",
"element",
"=",
"context",
".",
"createElement",
"(",
"\"div\"",
")",
",",
"html5",
"=",
"\"<article>foo</article>\"",
";",
"element",
".",
"innerHTML",
"=",
"html5",
";",
"return",
"element",
".",
"innerHTML",
".... | Everything below IE9 doesn't know how to treat HTML5 tags
@param {Object} context The document object on which to check HTML5 support
@example
wysihtml5.browser.supportsHTML5Tags(document); | [
"Everything",
"below",
"IE9",
"doesn",
"t",
"know",
"how",
"to",
"treat",
"HTML5",
"tags"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4345-L4350 | |
80 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var clonedTestElement = testElement.cloneNode(false),
returnValue,
innerHTML;
clonedTestElement.innerHTML = "<p><div></div>";
innerHTML = clonedTestElement.innerHTML.toLowerCase();
returnValue = innerHTML === "<p></p><div></div>... | javascript | function() {
var clonedTestElement = testElement.cloneNode(false),
returnValue,
innerHTML;
clonedTestElement.innerHTML = "<p><div></div>";
innerHTML = clonedTestElement.innerHTML.toLowerCase();
returnValue = innerHTML === "<p></p><div></div>... | [
"function",
"(",
")",
"{",
"var",
"clonedTestElement",
"=",
"testElement",
".",
"cloneNode",
"(",
"false",
")",
",",
"returnValue",
",",
"innerHTML",
";",
"clonedTestElement",
".",
"innerHTML",
"=",
"\"<p><div></div>\"",
";",
"innerHTML",
"=",
"clonedTestElement",... | Check whether the browser automatically closes tags that don't need to be opened | [
"Check",
"whether",
"the",
"browser",
"automatically",
"closes",
"tags",
"that",
"don",
"t",
"need",
"to",
"be",
"opened"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4455-L4468 | |
81 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(needle) {
if (Array.isArray(needle)) {
for (var i = needle.length; i--;) {
if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) {
return true;
}
}
return false;
} else {
return wysihtml5.lang.array(arr).indexOf(needle) !== -1;
... | javascript | function(needle) {
if (Array.isArray(needle)) {
for (var i = needle.length; i--;) {
if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) {
return true;
}
}
return false;
} else {
return wysihtml5.lang.array(arr).indexOf(needle) !== -1;
... | [
"function",
"(",
"needle",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"needle",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"needle",
".",
"length",
";",
"i",
"--",
";",
")",
"{",
"if",
"(",
"wysihtml5",
".",
"lang",
".",
"array",
"(",
... | Check whether a given object exists in an array
@example
wysihtml5.lang.array([1, 2]).contains(1);
// => true
Can be used to match array with array. If intersection is found true is returned | [
"Check",
"whether",
"a",
"given",
"object",
"exists",
"in",
"an",
"array"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4588-L4599 | |
82 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(needle) {
if (arr.indexOf) {
return arr.indexOf(needle);
} else {
for (var i=0, length=arr.length; i<length; i++) {
if (arr[i] === needle) { return i; }
}
return -1;
}
} | javascript | function(needle) {
if (arr.indexOf) {
return arr.indexOf(needle);
} else {
for (var i=0, length=arr.length; i<length; i++) {
if (arr[i] === needle) { return i; }
}
return -1;
}
} | [
"function",
"(",
"needle",
")",
"{",
"if",
"(",
"arr",
".",
"indexOf",
")",
"{",
"return",
"arr",
".",
"indexOf",
"(",
"needle",
")",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"arr",
".",
"length",
";",
"i",
... | Check whether a given object exists in an array and return index
If no elelemt found returns -1
@example
wysihtml5.lang.array([1, 2]).indexOf(2);
// => 1 | [
"Check",
"whether",
"a",
"given",
"object",
"exists",
"in",
"an",
"array",
"and",
"return",
"index",
"If",
"no",
"elelemt",
"found",
"returns",
"-",
"1"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4609-L4618 | |
83 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(arrayToSubstract) {
arrayToSubstract = wysihtml5.lang.array(arrayToSubstract);
var newArr = [],
i = 0,
length = arr.length;
for (; i<length; i++) {
if (!arrayToSubstract.contains(arr[i])) {
newArr.push(arr[i]);
}
}
return newAr... | javascript | function(arrayToSubstract) {
arrayToSubstract = wysihtml5.lang.array(arrayToSubstract);
var newArr = [],
i = 0,
length = arr.length;
for (; i<length; i++) {
if (!arrayToSubstract.contains(arr[i])) {
newArr.push(arr[i]);
}
}
return newAr... | [
"function",
"(",
"arrayToSubstract",
")",
"{",
"arrayToSubstract",
"=",
"wysihtml5",
".",
"lang",
".",
"array",
"(",
"arrayToSubstract",
")",
";",
"var",
"newArr",
"=",
"[",
"]",
",",
"i",
"=",
"0",
",",
"length",
"=",
"arr",
".",
"length",
";",
"for",... | Substract one array from another
@example
wysihtml5.lang.array([1, 2, 3, 4]).without([3, 4]);
// => [1, 2] | [
"Substract",
"one",
"array",
"from",
"another"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4627-L4638 | |
84 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var i = 0,
length = arr.length,
newArray = [];
for (; i<length; i++) {
newArray.push(arr[i]);
}
return newArray;
} | javascript | function() {
var i = 0,
length = arr.length,
newArray = [];
for (; i<length; i++) {
newArray.push(arr[i]);
}
return newArray;
} | [
"function",
"(",
")",
"{",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"arr",
".",
"length",
",",
"newArray",
"=",
"[",
"]",
";",
"for",
"(",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"newArray",
".",
"push",
"(",
"arr",
"[",
"i",
"]... | Return a clean native array
Following will convert a Live NodeList to a proper Array
@example
var childNodes = wysihtml5.lang.array(document.body.childNodes).get(); | [
"Return",
"a",
"clean",
"native",
"array"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4647-L4655 | |
85 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(callback, thisArg) {
if (Array.prototype.map) {
return arr.map(callback, thisArg);
} else {
var len = arr.length >>> 0,
A = new Array(len),
i = 0;
for (; i < len; i++) {
A[i] = callback.call(thisArg, arr[i], i, arr);
}
retur... | javascript | function(callback, thisArg) {
if (Array.prototype.map) {
return arr.map(callback, thisArg);
} else {
var len = arr.length >>> 0,
A = new Array(len),
i = 0;
for (; i < len; i++) {
A[i] = callback.call(thisArg, arr[i], i, arr);
}
retur... | [
"function",
"(",
"callback",
",",
"thisArg",
")",
"{",
"if",
"(",
"Array",
".",
"prototype",
".",
"map",
")",
"{",
"return",
"arr",
".",
"map",
"(",
"callback",
",",
"thisArg",
")",
";",
"}",
"else",
"{",
"var",
"len",
"=",
"arr",
".",
"length",
... | Creates a new array with the results of calling a provided function on every element in this array.
optionally this can be provided as second argument
@example
var childNodes = wysihtml5.lang.array([1,2,3,4]).map(function (value, index, array) {
return value * 2;
});
// => [2,4,6,8] | [
"Creates",
"a",
"new",
"array",
"with",
"the",
"results",
"of",
"calling",
"a",
"provided",
"function",
"on",
"every",
"element",
"in",
"this",
"array",
".",
"optionally",
"this",
"can",
"be",
"provided",
"as",
"second",
"argument"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4667-L4679 | |
86 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _convertUrlsToLinks | function _convertUrlsToLinks(str) {
return str.replace(URL_REG_EXP, function(match, url) {
var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || "",
opening = BRACKETS[punctuation];
url = url.replace(TRAILING_CHAR_REG_EXP, "");
if (url.split(opening).length > url.split(pu... | javascript | function _convertUrlsToLinks(str) {
return str.replace(URL_REG_EXP, function(match, url) {
var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || "",
opening = BRACKETS[punctuation];
url = url.replace(TRAILING_CHAR_REG_EXP, "");
if (url.split(opening).length > url.split(pu... | [
"function",
"_convertUrlsToLinks",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"URL_REG_EXP",
",",
"function",
"(",
"match",
",",
"url",
")",
"{",
"var",
"punctuation",
"=",
"(",
"url",
".",
"match",
"(",
"TRAILING_CHAR_REG_EXP",
")",
"||",... | This is basically a rebuild of
the rails auto_link_urls text helper | [
"This",
"is",
"basically",
"a",
"rebuild",
"of",
"the",
"rails",
"auto_link_urls",
"text",
"helper"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4933-L4955 |
87 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _wrapMatchesInNode | function _wrapMatchesInNode(textNode) {
var parentNode = textNode.parentNode,
nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(),
tempElement = _getTempElement(parentNode.ownerDocument);
// We need to insert an empty/temporary <span /> to fix IE quirks
// Elsewise IE would str... | javascript | function _wrapMatchesInNode(textNode) {
var parentNode = textNode.parentNode,
nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(),
tempElement = _getTempElement(parentNode.ownerDocument);
// We need to insert an empty/temporary <span /> to fix IE quirks
// Elsewise IE would str... | [
"function",
"_wrapMatchesInNode",
"(",
"textNode",
")",
"{",
"var",
"parentNode",
"=",
"textNode",
".",
"parentNode",
",",
"nodeValue",
"=",
"wysihtml5",
".",
"lang",
".",
"string",
"(",
"textNode",
".",
"data",
")",
".",
"escapeHTML",
"(",
")",
",",
"temp... | Replaces the original text nodes with the newly auto-linked dom tree | [
"Replaces",
"the",
"original",
"text",
"nodes",
"with",
"the",
"newly",
"auto",
"-",
"linked",
"dom",
"tree"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4972-L4987 |
88 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(context) {
if (context._wysihtml5_supportsHTML5Tags) {
return;
}
for (var i=0, length=HTML5_ELEMENTS.length; i<length; i++) {
context.createElement(HTML5_ELEMENTS[i]);
}
context._wysihtml5_supportsHTML5Tags = true;
} | javascript | function(context) {
if (context._wysihtml5_supportsHTML5Tags) {
return;
}
for (var i=0, length=HTML5_ELEMENTS.length; i<length; i++) {
context.createElement(HTML5_ELEMENTS[i]);
}
context._wysihtml5_supportsHTML5Tags = true;
} | [
"function",
"(",
"context",
")",
"{",
"if",
"(",
"context",
".",
"_wysihtml5_supportsHTML5Tags",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"HTML5_ELEMENTS",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"... | Make sure IE supports HTML5 tags, which is accomplished by simply creating one instance of each element | [
"Make",
"sure",
"IE",
"supports",
"HTML5",
"tags",
"which",
"is",
"accomplished",
"by",
"simply",
"creating",
"one",
"instance",
"of",
"each",
"element"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L5405-L5413 | |
89 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | parse | function parse(elementOrHtml, config) {
wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get();
var context = config.context || elementOrHtml.ownerDocument || document,
fragment = context.createDocumentFragment(),
isString = typeof(elementOrHtml) === "... | javascript | function parse(elementOrHtml, config) {
wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get();
var context = config.context || elementOrHtml.ownerDocument || document,
fragment = context.createDocumentFragment(),
isString = typeof(elementOrHtml) === "... | [
"function",
"parse",
"(",
"elementOrHtml",
",",
"config",
")",
"{",
"wysihtml5",
".",
"lang",
".",
"object",
"(",
"currentRules",
")",
".",
"merge",
"(",
"defaultRules",
")",
".",
"merge",
"(",
"config",
".",
"rules",
")",
".",
"get",
"(",
")",
";",
... | Iterates over all childs of the element, recreates them, appends them into a document fragment
which later replaces the entire body content | [
"Iterates",
"over",
"all",
"childs",
"of",
"the",
"element",
"recreates",
"them",
"appends",
"them",
"into",
"a",
"document",
"fragment",
"which",
"later",
"replaces",
"the",
"entire",
"body",
"content"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L5888-L5939 |
90 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var that = this,
iframe = doc.createElement("iframe");
iframe.className = "wysihtml5-sandbox";
wysihtml5.dom.setAttributes({
"security": "restricted",
"allowtransparency": "true",
"frameborder": 0,
"width": 0,
... | javascript | function() {
var that = this,
iframe = doc.createElement("iframe");
iframe.className = "wysihtml5-sandbox";
wysihtml5.dom.setAttributes({
"security": "restricted",
"allowtransparency": "true",
"frameborder": 0,
"width": 0,
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
",",
"iframe",
"=",
"doc",
".",
"createElement",
"(",
"\"iframe\"",
")",
";",
"iframe",
".",
"className",
"=",
"\"wysihtml5-sandbox\"",
";",
"wysihtml5",
".",
"dom",
".",
"setAttributes",
"(",
"{",
"... | Creates the sandbox iframe
Some important notes:
- We can't use HTML5 sandbox for now:
setting it causes that the iframe's dom can't be accessed from the outside
Therefore we need to set the "allow-same-origin" flag which enables accessing the iframe's dom
But then there's another problem, DOM events (focus, blur, cha... | [
"Creates",
"the",
"sandbox",
"iframe"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L6933-L6965 | |
91 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(contentEditable) {
contentEditable.className = (contentEditable.className && contentEditable.className != '') ? contentEditable.className + " wysihtml5-sandbox" : "wysihtml5-sandbox";
this._loadElement(contentEditable, true);
return contentEditable;
} | javascript | function(contentEditable) {
contentEditable.className = (contentEditable.className && contentEditable.className != '') ? contentEditable.className + " wysihtml5-sandbox" : "wysihtml5-sandbox";
this._loadElement(contentEditable, true);
return contentEditable;
} | [
"function",
"(",
"contentEditable",
")",
"{",
"contentEditable",
".",
"className",
"=",
"(",
"contentEditable",
".",
"className",
"&&",
"contentEditable",
".",
"className",
"!=",
"''",
")",
"?",
"contentEditable",
".",
"className",
"+",
"\" wysihtml5-sandbox\"",
"... | initiates an allready existent contenteditable | [
"initiates",
"an",
"allready",
"existent",
"contenteditable"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L7111-L7115 | |
92 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(cell) {
if (cell.isColspan) {
var colspan = parseInt(api.getAttribute(cell.el, 'colspan') || 1, 10),
cType = cell.el.tagName.toLowerCase();
if (colspan > 1) {
var newCells = this.createCells(cType, colspan -1);
... | javascript | function(cell) {
if (cell.isColspan) {
var colspan = parseInt(api.getAttribute(cell.el, 'colspan') || 1, 10),
cType = cell.el.tagName.toLowerCase();
if (colspan > 1) {
var newCells = this.createCells(cType, colspan -1);
... | [
"function",
"(",
"cell",
")",
"{",
"if",
"(",
"cell",
".",
"isColspan",
")",
"{",
"var",
"colspan",
"=",
"parseInt",
"(",
"api",
".",
"getAttribute",
"(",
"cell",
".",
"el",
",",
"'colspan'",
")",
"||",
"1",
",",
"10",
")",
",",
"cType",
"=",
"ce... | Splits merged cell on row to unique cells | [
"Splits",
"merged",
"cell",
"on",
"row",
"to",
"unique",
"cells"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L7615-L7625 | |
93 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var oldRow = api.getParentElement(this.cell, { nodeName: ["TR"] });
if (oldRow) {
this.setTableMap();
this.idx = this.getMapIndex(this.cell);
if (this.idx !== false) {
var modRow = this.map[this.idx.row];
... | javascript | function() {
var oldRow = api.getParentElement(this.cell, { nodeName: ["TR"] });
if (oldRow) {
this.setTableMap();
this.idx = this.getMapIndex(this.cell);
if (this.idx !== false) {
var modRow = this.map[this.idx.row];
... | [
"function",
"(",
")",
"{",
"var",
"oldRow",
"=",
"api",
".",
"getParentElement",
"(",
"this",
".",
"cell",
",",
"{",
"nodeName",
":",
"[",
"\"TR\"",
"]",
"}",
")",
";",
"if",
"(",
"oldRow",
")",
"{",
"this",
".",
"setTableMap",
"(",
")",
";",
"th... | Removes the row of selected cell | [
"Removes",
"the",
"row",
"of",
"selected",
"cell"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L7935-L7951 | |
94 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | removeCellSelections | function removeCellSelections () {
if (editable) {
var selectedCells = editable.querySelectorAll('.' + selection_class);
if (selectedCells.length > 0) {
for (var i = 0; i < selectedCells.length; i++) {
dom.removeClass(selectedCells[i], selection_class);
... | javascript | function removeCellSelections () {
if (editable) {
var selectedCells = editable.querySelectorAll('.' + selection_class);
if (selectedCells.length > 0) {
for (var i = 0; i < selectedCells.length; i++) {
dom.removeClass(selectedCells[i], selection_class);
... | [
"function",
"removeCellSelections",
"(",
")",
"{",
"if",
"(",
"editable",
")",
"{",
"var",
"selectedCells",
"=",
"editable",
".",
"querySelectorAll",
"(",
"'.'",
"+",
"selection_class",
")",
";",
"if",
"(",
"selectedCells",
".",
"length",
">",
"0",
")",
"{... | remove all selection classes | [
"remove",
"all",
"selection",
"classes"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8538-L8547 |
95 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | getDepth | function getDepth(ancestor, descendant) {
var ret = 0;
while (descendant !== ancestor) {
ret++;
descendant = descendant.parentNode;
if (!descendant)
throw new Error("not a descendant of ancestor!");
}
return ret;
} | javascript | function getDepth(ancestor, descendant) {
var ret = 0;
while (descendant !== ancestor) {
ret++;
descendant = descendant.parentNode;
if (!descendant)
throw new Error("not a descendant of ancestor!");
}
return ret;
} | [
"function",
"getDepth",
"(",
"ancestor",
",",
"descendant",
")",
"{",
"var",
"ret",
"=",
"0",
";",
"while",
"(",
"descendant",
"!==",
"ancestor",
")",
"{",
"ret",
"++",
";",
"descendant",
"=",
"descendant",
".",
"parentNode",
";",
"if",
"(",
"!",
"desc... | Provides the depth of ``descendant`` relative to ``ancestor`` | [
"Provides",
"the",
"depth",
"of",
"descendant",
"relative",
"to",
"ancestor"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8719-L8728 |
96 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | expandRangeToSurround | function expandRangeToSurround(range) {
if (range.canSurroundContents()) return;
var common = range.commonAncestorContainer,
start_depth = getDepth(common, range.startContainer),
end_depth = getDepth(common, range.endContainer);
while(!range.canSurroundContents()) {
// In... | javascript | function expandRangeToSurround(range) {
if (range.canSurroundContents()) return;
var common = range.commonAncestorContainer,
start_depth = getDepth(common, range.startContainer),
end_depth = getDepth(common, range.endContainer);
while(!range.canSurroundContents()) {
// In... | [
"function",
"expandRangeToSurround",
"(",
"range",
")",
"{",
"if",
"(",
"range",
".",
"canSurroundContents",
"(",
")",
")",
"return",
";",
"var",
"common",
"=",
"range",
".",
"commonAncestorContainer",
",",
"start_depth",
"=",
"getDepth",
"(",
"common",
",",
... | Should fix the obtained ranges that cannot surrond contents normally to apply changes upon Being considerate to firefox that sets range start start out of span and end inside on doubleclick initiated selection | [
"Should",
"fix",
"the",
"obtained",
"ranges",
"that",
"cannot",
"surrond",
"contents",
"normally",
"to",
"apply",
"changes",
"upon",
"Being",
"considerate",
"to",
"firefox",
"that",
"sets",
"range",
"start",
"start",
"out",
"of",
"span",
"and",
"end",
"inside"... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8732-L8750 |
97 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(node) {
var range = rangy.createRange(this.doc);
range.setStartBefore(node);
range.setEndBefore(node);
return this.setSelection(range);
} | javascript | function(node) {
var range = rangy.createRange(this.doc);
range.setStartBefore(node);
range.setEndBefore(node);
return this.setSelection(range);
} | [
"function",
"(",
"node",
")",
"{",
"var",
"range",
"=",
"rangy",
".",
"createRange",
"(",
"this",
".",
"doc",
")",
";",
"range",
".",
"setStartBefore",
"(",
"node",
")",
";",
"range",
".",
"setEndBefore",
"(",
"node",
")",
";",
"return",
"this",
".",... | Set the caret in front of the given node
@param {Object} node The element or text node where to position the caret in front of
@example
selection.setBefore(myElement); | [
"Set",
"the",
"caret",
"in",
"front",
"of",
"the",
"given",
"node"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8796-L8801 | |
98 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(node) {
var range = rangy.createRange(this.doc);
range.setStartAfter(node);
range.setEndAfter(node);
return this.setSelection(range);
} | javascript | function(node) {
var range = rangy.createRange(this.doc);
range.setStartAfter(node);
range.setEndAfter(node);
return this.setSelection(range);
} | [
"function",
"(",
"node",
")",
"{",
"var",
"range",
"=",
"rangy",
".",
"createRange",
"(",
"this",
".",
"doc",
")",
";",
"range",
".",
"setStartAfter",
"(",
"node",
")",
";",
"range",
".",
"setEndAfter",
"(",
"node",
")",
";",
"return",
"this",
".",
... | Set the caret after the given node
@param {Object} node The element or text node where to position the caret in front of
@example
selection.setBefore(myElement); | [
"Set",
"the",
"caret",
"after",
"the",
"given",
"node"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8810-L8816 | |
99 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(controlRange) {
var selection,
range;
if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
range = this.doc.selection.createRange();
if (range && range.length) {
return range.item(0);
}
}
selection = this.getSel... | javascript | function(controlRange) {
var selection,
range;
if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
range = this.doc.selection.createRange();
if (range && range.length) {
return range.item(0);
}
}
selection = this.getSel... | [
"function",
"(",
"controlRange",
")",
"{",
"var",
"selection",
",",
"range",
";",
"if",
"(",
"controlRange",
"&&",
"this",
".",
"doc",
".",
"selection",
"&&",
"this",
".",
"doc",
".",
"selection",
".",
"type",
"===",
"\"Control\"",
")",
"{",
"range",
"... | Get the node which contains the selection
@param {Boolean} [controlRange] (only IE) Whether it should return the selected ControlRange element when the selection type is a "ControlRange"
@return {Object} The node that contains the caret
@example
var nodeThatContainsCaret = selection.getSelectedNode(); | [
"Get",
"the",
"node",
"which",
"contains",
"the",
"selection"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L8863-L8881 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.