id
stringlengths
24
24
repo
stringlengths
5
63
path
stringlengths
4
127
func_name
stringlengths
0
63
url
stringlengths
86
226
split
stringclasses
3 values
language
stringclasses
1 value
docstring
stringlengths
1
22.1k
code
stringlengths
61
1.92M
text
stringlengths
100
1.92M
token_count
int32
24
871k
doc_chars
int32
1
22.1k
code_chars
int32
61
1.92M
license_basis
stringclasses
1 value
source
stringclasses
1 value
added
stringdate
2026-12-05 00:00:00
2026-12-05 00:00:00
record_sha256
stringlengths
64
64
license
stringclasses
11 values
license_class
stringclasses
1 value
license_source
stringlengths
44
110
81ec999df40c10347dab0c25
Microsoft/vscode
build/lib/treeshaking.js
createTypeScriptLanguageService
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L54-L75
train
javascript
#region Discovery, LanguageService & Setup
function createTypeScriptLanguageService(options) { // Discover referenced files const FILES = discoverAndReadFiles(options); // Add fake usage files options.inlineEntryPoints.forEach((inlineEntryPoint, index) => { FILES[`inlineEntryPoint.${index}.ts`] = inlineEntryPoint; }); // Add addi...
#region Discovery, LanguageService & Setup function createTypeScriptLanguageService(options) { // Discover referenced files const FILES = discoverAndReadFiles(options); // Add fake usage files options.inlineEntryPoints.forEach((inlineEntryPoint, index) => { FILES[`inlineEntryPoint.${index}.ts`]...
223
42
1,020
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a6f2a6a52606129fedea27f5b4c3c76fc56acd77190cb73279e77e184e054b97
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
9ec8c71cc7325fef1774c9a7
Microsoft/vscode
build/lib/treeshaking.js
discoverAndReadFiles
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L79-L128
train
javascript
Read imports and follow them until all files have been handled
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...
Read imports and follow them until all files have been handled function discoverAndReadFiles(options) { const FILES = {}; const in_queue = Object.create(null); const queue = []; const enqueue = (moduleId) => { if (in_queue[moduleId]) { return; } in_queue[moduleId] = ...
440
62
1,984
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d29486fc111ccd2a31d186fefe49a607a1fc98baaecbde4c3712c748c6417774
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
e47ecbb474d949aa6d9c8e3a
Microsoft/vscode
build/lib/treeshaking.js
getRealNodeSymbol
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L552-L661
train
javascript
#endregion #region Utils Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
function getRealNodeSymbol(checker, node) { const getPropertySymbolsFromContextualType = ts.getPropertySymbolsFromContextualType; const getContainingObjectLiteralElement = ts.getContainingObjectLiteralElement; const getNameFromPropertyName = ts.getNameFromPropertyName; // Go to the original declaration ...
#endregion #region Utils Returns the node's symbol and the `import` node (if the symbol resolved from a different module) function getRealNodeSymbol(checker, node) { const getPropertySymbolsFromContextualType = ts.getPropertySymbolsFromContextualType; const getContainingObjectLiteralElement = ts.getContaining...
1,094
122
5,221
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f7cd341e3724185f6772c2c296a76d1790b1499f41b7621d67314536f426ea29
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
8daa5c51c6b1849be0f6b0f2
Microsoft/vscode
build/lib/treeshaking.js
shouldSkipAlias
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L561-L577
train
javascript
Go to the original declaration for cases: (1) when the aliased symbol was declared in the location(parent). (2) when the aliased symbol is originating from an import.
function shouldSkipAlias(node, declaration) { if (node.kind !== ts.SyntaxKind.Identifier) { return false; } if (node.parent === declaration) { return true; } switch (declaration.kind) { case ts.SyntaxKind.ImportClause: case ts.Synta...
Go to the original declaration for cases: (1) when the aliased symbol was declared in the location(parent). (2) when the aliased symbol is originating from an import. function shouldSkipAlias(node, declaration) { if (node.kind !== ts.SyntaxKind.Identifier) { return false; } if (nod...
139
167
573
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
15a00cbb17ced2fd5fd11809fcd569d3ee588d8937ccaaf4e877638e9538dea2
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
1052df6d4284284efbe4102e
Microsoft/vscode
build/lib/treeshaking.js
getTokenAtPosition
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L663-L681
train
javascript
Get the token whose text contains the position
function getTokenAtPosition(sourceFile, position, allowPositionInLeadingTrivia, includeEndPosition) { let current = sourceFile; outer: while (true) { // find the child that contains 'position' for (const child of current.getChildren()) { const start = allowPositionInLeadingTrivia ? c...
Get the token whose text contains the position function getTokenAtPosition(sourceFile, position, allowPositionInLeadingTrivia, includeEndPosition) { let current = sourceFile; outer: while (true) { // find the child that contains 'position' for (const child of current.getChildren()) { ...
177
46
852
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
682b83f9fa326a703ab2467e9b48a1d3171517f7962e966314928433043f5122
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
2a456da96428474acdb37353
Microsoft/vscode
build/lib/watch/index.js
handleDeletions
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/watch/index.js#L9-L18
train
javascript
Ugly hack for gulp-tsb
function handleDeletions() { return es.mapSync(f => { if (/\.ts$/.test(f.relative) && !f.contents) { f.contents = Buffer.from(''); f.stat = { mtime: new Date() }; } return f; }); }
Ugly hack for gulp-tsb function handleDeletions() { return es.mapSync(f => { if (/\.ts$/.test(f.relative) && !f.contents) { f.contents = Buffer.from(''); f.stat = { mtime: new Date() }; } return f; }); }
68
22
195
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
429339a51240ab5b13c3849ef65df24a66ca380f9423884558d42d45d0718b0d
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
b3867b331f31d5298db192e6
Microsoft/vscode
build/lib/optimize.js
uglifyWithCopyrights
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/optimize.js#L169-L207
train
javascript
Wrap around uglify and allow the preserveComments function to have a file "context" to include our copyright only once per file.
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...
Wrap around uglify and allow the preserveComments function to have a file "context" to include our copyright only once per file. function uglifyWithCopyrights() { const preserveComments = (f) => { return (_node, comment) => { const text = comment.value; const type = comment.type; ...
313
128
1,326
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2c644a0fe58793d6e5497aef86f0e0cc521dad9a559fc4d8752f5defa0c44ea1
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
9d7fc31efeba4a8e563187d3
Microsoft/vscode
build/lib/extensions.js
sequence
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/extensions.js#L194-L209
train
javascript
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...
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); })...
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...
161
321
415
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
58ecdfebdfccea98e172528ca9fa5417b17287e0ddb95d2d8107d3ec9743e862
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
873139f7220fc1cbcfa7dd75
Microsoft/vscode
extensions/php/build/update-grammar.js
fixBadRegex
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/extensions/php/build/update-grammar.js#L25-L36
train
javascript
Workaround for https://github.com/Microsoft/vscode/issues/40279 and https://github.com/Microsoft/vscode-textmate/issues/59
function fixBadRegex(grammar) { const scopeResolution = grammar.repository['scope-resolution']; if (scopeResolution) { const match = scopeResolution.patterns[0].match; if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') { scopeResolution.patterns[0].match = '([A-...
Workaround for https://github.com/Microsoft/vscode/issues/40279 and https://github.com/Microsoft/vscode-textmate/issues/59 function fixBadRegex(grammar) { const scopeResolution = grammar.repository['scope-resolution']; if (scopeResolution) { const match = scopeResolution.patterns[0].match; if (match === '(?i)([a...
210
122
510
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9d6dbb6fe04305e8db070f03003ac80af3591bdb0e2c8ad49cee35d026a74347
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
7825ed3341ab2ed22aa9d2cf
Microsoft/vscode
src/vs/loader.js
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/vs/loader.js#L1705-L1713
train
javascript
re-expose node's require function
function (what) { moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what); try { return _nodeRequire_1(what); } finally { moduleManager.getRecorder().record(34 /* NodeEndNati...
re-expose node's require function function (what) { moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what); try { return _nodeRequire_1(what); } finally { moduleManager.get...
69
33
380
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c684a981dfc94f7ffe18de7080e56dc151fa01ad8fe92d563d5883854a876730
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6b7bc34a643e6e97f630f9d0
Microsoft/vscode
build/gulpfile.editor.js
createTscCompileTask
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.editor.js#L322-L370
train
javascript
#region monaco type checking
function createTscCompileTask(watch) { return () => { const createReporter = require('./lib/reporter').createReporter; return new Promise((resolve, reject) => { const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit']; if (watch) { args.push('-w'); } const child = c...
#region monaco type checking function createTscCompileTask(watch) { return () => { const createReporter = require('./lib/reporter').createReporter; return new Promise((resolve, reject) => { const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit']; if (watch) { args.push(...
503
28
1,652
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
21bd84f12f34a79eb2b7de02e35ad1bbd954267e55b8aacdc06d4bcb0f05a220
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
4247461445c3aa26eb70a326
Microsoft/vscode
build/lib/nls.js
nls
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/nls.js#L54-L75
train
javascript
Returns a stream containing the patched JavaScript and source maps.
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...
Returns a stream containing the patched JavaScript and source maps. 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.`...
232
67
932
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
bf6d7befd70f120f643b90c128acd9346953db6f943501989903a3bd2a022ce9
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
612aa4e27406401e1534bd3c
Microsoft/vscode
src/bootstrap-window.js
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/bootstrap-window.js#L184-L191
train
javascript
mac: Cmd-R, rest: Ctrl-R
function (e) { const key = extractKey(e); if (key === TOGGLE_DEV_TOOLS_KB || key === TOGGLE_DEV_TOOLS_KB_ALT) { ipc.send('vscode:toggleDevTools'); } else if (key === RELOAD_KB) { ipc.send('vscode:reloadWindow'); } }
mac: Cmd-R, rest: Ctrl-R function (e) { const key = extractKey(e); if (key === TOGGLE_DEV_TOOLS_KB || key === TOGGLE_DEV_TOOLS_KB_ALT) { ipc.send('vscode:toggleDevTools'); } else if (key === RELOAD_KB) { ipc.send('vscode:reloadWindow'); } }
90
24
230
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
38e8518320ad7b1cf0cdc1522977fa639213def6c1ded4800932fb4d0afda886
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
391167b0291b402a750223eb
Microsoft/vscode
build/lib/bundle.js
bundle
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L13-L70
train
javascript
Bundle `entryPoints` given config `config`.
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...
Bundle `entryPoints` given config `config`. function bundle(entryPoints, config, callback) { const entryPointsMap = {}; entryPoints.forEach((module) => { entryPointsMap[module.name] = module; }); const allMentionedModulesMap = {}; entryPoints.forEach((module) => { allMentionedModule...
530
43
2,300
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ebc3d0ff6b0dcc28e7b121bb8a8fa5ca5e83e9f2a587c0f9828b29f53e7d89a1
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
4012654506beb360baf88725
Microsoft/vscode
build/lib/bundle.js
positionToOffset
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L386-L400
train
javascript
Convert a position (line:col) to (offset) in string `str`
function positionToOffset(str, desiredLine, desiredCol) { if (desiredLine === 1) { return desiredCol - 1; } let line = 1; let lastNewLineOffset = -1; do { if (desiredLine === line) { return lastNewLineOffset + 1 + desiredCol - 1; } lastNewLineOffset = str....
Convert a position (line:col) to (offset) in string `str` function positionToOffset(str, desiredLine, desiredCol) { if (desiredLine === 1) { return desiredCol - 1; } let line = 1; let lastNewLineOffset = -1; do { if (desiredLine === line) { return lastNewLineOffset + 1 +...
137
57
428
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7b047789a5966bdef5c8aacd4cba2ac0aafd6450d7e779e0d925b93877c4549f
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
cfd063ba64259c1fa6a2f8fd
Microsoft/vscode
build/lib/bundle.js
visit
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L404-L421
train
javascript
Return a set of reachable nodes in `graph` starting from `rootNodes`
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...
Return a set of reachable nodes in `graph` starting from `rootNodes` 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 = gra...
125
68
464
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
deee7e11815eaa683702f357635899752627e5979c053b962ef9b70097ed732f
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
25d5aba53eb50576fdeb31f7
Microsoft/vscode
build/lib/bundle.js
topologicalSort
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L425-L463
train
javascript
Perform a topological sort on `graph`
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]...
Perform a topological sort on `graph` function topologicalSort(graph) { const allNodes = {}, outgoingEdgeCount = {}, inverseEdges = {}; Object.keys(graph).forEach((fromNode) => { allNodes[fromNode] = true; outgoingEdgeCount[fromNode] = graph[fromNode].length; graph[fromNode].forEach((to...
347
37
1,438
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
96ddf0b4f23b6bfbba66dc632afc53eeede0416138424f8da17c3ceff740ff93
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
94d25b6ed84c9a4407d35631
Microsoft/vscode
build/lib/i18n.js
updateResource
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/i18n.js#L861-L897
train
javascript
The following link provides information about how Transifex handles updates of a resource file: https://dev.befoolish.co/tx-docs/public/projects/updating-content#what-happens-when-you-update-files
function updateResource(project, slug, xlfFile, apiHostname, credentials) { return new Promise((resolve, reject) => { const data = JSON.stringify({ content: xlfFile.contents.toString() }); const options = { hostname: apiHostname, path: `/api/2/project/${project}/resource/${sl...
The following link provides information about how Transifex handles updates of a resource file: https://dev.befoolish.co/tx-docs/public/projects/updating-content#what-happens-when-you-update-files function updateResource(project, slug, xlfFile, apiHostname, credentials) { return new Promise((resolve, reject) => { ...
346
196
1,567
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0f9e52d87be32f3dc2f709edff39ab65b60804a401922a48c686fbf8d6436116
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
d9864836b0f7cc5116702b2b
Microsoft/vscode
build/lib/git.js
getVersion
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/git.js#L12-L52
train
javascript
Returns the sha1 commit version of a repository or undefined in case of failure.
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; } ...
Returns the sha1 commit version of a repository or undefined in case of failure. 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 undefi...
306
80
1,012
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fdc4411905ade81ddd3b3965b7f19a355bec2d3e63e616931207c36ca253859f
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
c945a41e7a92eec76813e6f5
Microsoft/vscode
src/bootstrap-fork.js
pipeLoggingToParent
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/bootstrap-fork.js#L46-L142
train
javascript
#region Helpers
function pipeLoggingToParent() { const MAX_LENGTH = 100000; // Prevent circular stringify and convert arguments to real array function safeToArray(args) { const seen = []; const argsArray = []; let res; // Massage some arguments with special treatment if (args.length) { for (let i = 0; i < args.lengt...
#region Helpers function pipeLoggingToParent() { const MAX_LENGTH = 100000; // Prevent circular stringify and convert arguments to real array function safeToArray(args) { const seen = []; const argsArray = []; let res; // Massage some arguments with special treatment if (args.length) { for (let i = ...
777
15
3,020
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f93a647f51c1b3110b1950f3045de733bf6629b0eb56fc66849ccc715bcdac3a
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
b1ed2bedd9d48b9f101a3ebf
Microsoft/vscode
src/bootstrap-fork.js
safeToArray
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/bootstrap-fork.js#L50-L112
train
javascript
Prevent circular stringify and convert arguments to real array
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 ...
Prevent circular stringify and convert arguments to real array 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 spe...
482
62
1,805
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
33f7f6fa69d6edf0b9a1f61c3444d71213dec6175b637dbbc305c0a5fa1d24d2
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
f7b4855a22b61ee560e8bdc2
Microsoft/vscode
src/vs/code/electron-browser/workbench/workbench.js
showPartsSplash
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/vs/code/electron-browser/workbench/workbench.js#L61-L122
train
javascript
// configuration: IWindowConfiguration @param {{ partsSplashPath?: string, highContrast?: boolean, extensionDevelopmentPath?: string | string[], folderUri?: object, workspace?: object }} configuration
function showPartsSplash(configuration) { perf.mark('willShowPartsSplash'); let data; if (typeof configuration.partsSplashPath === 'string') { try { data = JSON.parse(require('fs').readFileSync(configuration.partsSplashPath, 'utf8')); } catch (e) { // ignore } } // high contrast mode has been turned ...
// configuration: IWindowConfiguration @param {{ partsSplashPath?: string, highContrast?: boolean, extensionDevelopmentPath?: string | string[], folderUri?: object, workspace?: object }} configuration function showPartsSplash(configuration) { perf.mark('willShowPartsSplash'); let data; if (typeof configuration.par...
924
200
3,548
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1a070a3d7373e2c6e6132c7d82ae6ca935706498cfe3a4ca5fb820f7312efa1b
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
9fc53808097f214d5d32aaa8
Microsoft/vscode
build/gulpfile.vscode.js
computeChecksums
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L230-L237
train
javascript
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.
function computeChecksums(out, filenames) { var result = {}; filenames.forEach(function (filename) { var fullPath = path.join(process.cwd(), out, filename); result[filename] = computeChecksum(fullPath); }); return result; }
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. function computeChecksums(out, filenames) { var result = {}; filenames.forEach(function (filename) { var fullPa...
97
203
231
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ab46514422a7fceb1cff335be234183b2cfe8f695f8d289830c8825cea841028
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
b8b67f5318bd16b978dba3a2
Microsoft/vscode
build/gulpfile.vscode.js
computeChecksum
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/gulpfile.vscode.js#L245-L255
train
javascript
Compute checksum for a file. @param {string} filename The absolute path to a filename. @return {string} The checksum for `filename`.
function computeChecksum(filename) { var contents = fs.readFileSync(filename); var hash = crypto .createHash('md5') .update(contents) .digest('base64') .replace(/=+$/, ''); return hash; }
Compute checksum for a file. @param {string} filename The absolute path to a filename. @return {string} The checksum for `filename`. function computeChecksum(filename) { var contents = fs.readFileSync(filename); var hash = crypto .createHash('md5') .update(contents) .digest('base64') .replace(/=+$/, ''); ...
78
133
200
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6f859a68da25a7ea39f7468590204ebf287f8c598753e038ca7062482a0fefe0
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
a76d1c7b826af26e0171ff54
Microsoft/vscode
src/main.js
configureCommandlineSwitches
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L139-L154
train
javascript
@typedef {import('minimist').ParsedArgs} ParsedArgs @param {ParsedArgs} cliArgs @param {{ jsFlags: () => string }} nodeCachedDataDir
function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) { // Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791) app.commandLine.appendSwitch('disable-color-correct-rendering'); // Support JS Flags const jsFlags = resolveJSFlags(cliArgs, nodeCachedDataDir.js...
@typedef {import('minimist').ParsedArgs} ParsedArgs @param {ParsedArgs} cliArgs @param {{ jsFlags: () => string }} nodeCachedDataDir function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) { // Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791) app.commandLi...
175
133
555
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fffda2c4186ba22aa5f2c8a371adae69302f9fbffca0728f5036dc52d033fd77
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6c4ef85479f80e3ad605eb1e
Microsoft/vscode
src/main.js
getUserDataPath
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L181-L187
train
javascript
@param {ParsedArgs} cliArgs @returns {string}
function getUserDataPath(cliArgs) { if (portable.isPortable) { return path.join(portable.portableDataPath, 'user-data'); } return path.resolve(cliArgs['user-data-dir'] || paths.getDefaultUserDataPath(process.platform)); }
@param {ParsedArgs} cliArgs @returns {string} function getUserDataPath(cliArgs) { if (portable.isPortable) { return path.join(portable.portableDataPath, 'user-data'); } return path.resolve(cliArgs['user-data-dir'] || paths.getDefaultUserDataPath(process.platform)); }
65
46
227
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
39b9cc70e4aa69a90c2c518eafb179b1ebb53a8002424357b490c5c0461abee7
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
bee5e700a54754a9b4f9ee9d
Microsoft/vscode
src/main.js
stripComments
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L300-L322
train
javascript
#region NLS Support @param {string} content @returns {string}
function stripComments(content) { const regexp = /("(?:[^\\"]*(?:\\.)?)*")|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; return content.replace(regexp, function (match, m1, m2, m3, m4) { // Only one of m1, m2, m3, m4 matches if (m3) { // A block comment. Replace with nothing ...
#region NLS Support @param {string} content @returns {string} function stripComments(content) { const regexp = /("(?:[^\\"]*(?:\\.)?)*")|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; return content.replace(regexp, function (match, m1, m2, m3, m4) { // Only one of m1, m2, m3, m4 m...
270
62
642
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4e52e73fcfe36a4b4ab389764aef3d23b5d852fe0d6d5c5d6c2ac3b9da00b4a7
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
1025de2baa817635db41aa1f
Microsoft/vscode
src/main.js
getUserDefinedLocale
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L331-L349
train
javascript
Language tags are case insensitive however an amd loader is case sensitive To make this work on case preserving & insensitive FS we do the following: the language bundles have lower case language tags and we always lower case the locale we receive from the user or OS. @returns {Promise<string>}
function getUserDefinedLocale() { const locale = args['locale']; if (locale) { return Promise.resolve(locale.toLowerCase()); } const localeConfig = path.join(userDataPath, 'User', 'locale.json'); return bootstrap.readFile(localeConfig).then(content => { content = stripComments(content); try { const value...
Language tags are case insensitive however an amd loader is case sensitive To make this work on case preserving & insensitive FS we do the following: the language bundles have lower case language tags and we always lower case the locale we receive from the user or OS. @returns {Promise<string>} function getUserDefine...
175
296
510
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4b06e38e08919358cdd1f57e4bf5e43d35289a494d7de6fafa829a75ec6d0180
MIT
permissive
https://github.com/microsoft/vscode/blob/main/LICENSE.txt
e7eedb45e4a9e3b0e2c805f0
angular/angular
shims_for_IE.js
$TypedArray$
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/shims_for_IE.js#L403-L496
train
javascript
5 The Typed Array View Types
function $TypedArray$() { // %TypedArray% ( length ) if (!arguments.length || typeof arguments[0] !== 'object') { return (function(length) { length = ToInt32(length); if (length < 0) throw RangeError('length is not a small enough positive integer.'); Object.definePrope...
5 The Typed Array View Types function $TypedArray$() { // %TypedArray% ( length ) if (!arguments.length || typeof arguments[0] !== 'object') { return (function(length) { length = ToInt32(length); if (length < 0) throw RangeError('length is not a small enough positive integer.')...
891
28
4,049
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
39a7987937a5119cc5449643de9621f1b7d3146d1742fdaccc370c55adfcf526
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
db633465a2030ea55b0aae16
angular/angular
shims_for_IE.js
makeTypedArray
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/shims_for_IE.js#L993-L1020
train
javascript
%TypedArray%.prototype.toLocaleString ( ) %TypedArray%.prototype.toString ( ) %TypedArray%.prototype.values ( ) %TypedArray%.prototype [ @@iterator ] ( ) get %TypedArray%.prototype [ @@toStringTag ] -- defined in es6.js to shim browsers w/ native TypedArrays
function makeTypedArray(elementSize, pack, unpack) { // Each TypedArray type requires a distinct constructor instance with // identical logic, which this produces. var TypedArray = function() { Object.defineProperty(this, 'constructor', {value: TypedArray}); $TypedArray$.apply(this, ar...
%TypedArray%.prototype.toLocaleString ( ) %TypedArray%.prototype.toString ( ) %TypedArray%.prototype.values ( ) %TypedArray%.prototype [ @@iterator ] ( ) get %TypedArray%.prototype [ @@toStringTag ] -- defined in es6.js to shim browsers w/ native TypedArrays function makeTypedArray(elementSize, pack, unpack) { /...
290
258
1,063
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f46202a08b8d23b54fd2f4971de1457ffb3af40d0295e8b4599efaadf0f1deba
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
7cf375aff6d268f063449c33
angular/angular
shims_for_IE.js
DataView
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/shims_for_IE.js#L1062-L1080
train
javascript
DataView(buffer, byteOffset=0, byteLength=undefined) WebIDL: Constructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength)
function DataView(buffer, byteOffset, byteLength) { if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError(); byteOffset = ToUint32(byteOffset); if (byteOffset > buffer.byteLength) throw RangeError('byteOffset out of range'); if (byteLength === undefin...
DataView(buffer, byteOffset=0, byteLength=undefined) WebIDL: Constructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength) function DataView(buffer, byteOffset, byteLength) { if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError(); ...
204
162
795
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
13753b20759331992edd8c991718be67b8d524ebdd325b165275e61cddf31ec4
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
62bf026b43b231ae1e1ad861
angular/angular
aio/scripts/check-environment.js
checkEnvironment
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/check-environment.js#L48-L75
train
javascript
Helpers
function checkEnvironment(expected) { exec('yarn --version', function(yarnErr, yarnStdout) { var actualNodeVersion = process.version; var actualYarnVersion = !yarnErr && semver.clean(yarnStdout); var issues = []; // Check Node version. if (!semver.satisfies(actualNodeVersion, expected.nodeVersion...
Helpers function checkEnvironment(expected) { exec('yarn --version', function(yarnErr, yarnStdout) { var actualNodeVersion = process.version; var actualYarnVersion = !yarnErr && semver.clean(yarnStdout); var issues = []; // Check Node version. if (!semver.satisfies(actualNodeVersion, expected.no...
271
7
1,145
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9754c7497c183960f3a1c535bbf2587581ac760f58a094a991cfa522e6d4e24f
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
14737f3ec2150c11eda79ac3
angular/angular
aio/tools/transforms/angular-api-package/content-rules/noMarkdownHeadings.js
listify
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-api-package/content-rules/noMarkdownHeadings.js#L45-L50
train
javascript
Convert an array of strings in to a human list - e.g separated by commas and the word `and`. @param {string[]} values The strings to convert to a list
function listify(values) { if (values.length <= 1) return values; const last = values[values.length - 1]; const rest = values.slice(0, values.length - 1); return [rest.join(', '), last].join(' and '); }
Convert an array of strings in to a human list - e.g separated by commas and the word `and`. @param {string[]} values The strings to convert to a list function listify(values) { if (values.length <= 1) return values; const last = values[values.length - 1]; const rest = values.slice(0, values.length - 1); retur...
94
150
210
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fddb95fa7a0002d8699439871e9023a444f8e598bb87b8bed805069f524f7ad2
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
8736a5bdb99469b441ec5923
angular/angular
aio/tools/transforms/angular-base-package/processors/generateKeywords.js
tokenize
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-base-package/processors/generateKeywords.js#L135-L154
train
javascript
If the heading contains a name starting with ng, e.g. "ngController", then add the name without the ng to the text, e.g. "controller".
function tokenize(text) { const rawTokens = text.split(/[\s\/]+/mg); const tokens = []; rawTokens.forEach(token => { // Strip off unwanted trivial characters token = token .trim() .replace(/^[_\-"'`({[<$*)}\]>.]+/, '') .replace(/[_\-"'`({[<$*)}\]>.]+$/, ''); // Ignore tokens th...
If the heading contains a name starting with ng, e.g. "ngController", then add the name without the ng to the text, e.g. "controller". function tokenize(text) { const rawTokens = text.split(/[\s\/]+/mg); const tokens = []; rawTokens.forEach(token => { // Strip off unwanted trivial characters token = toke...
200
134
599
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
616347c844b69feecb3e60f43c58dc927afc87d7afeaf40781780c41743eb6d7
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
583591f3d8572f4723af264b
angular/angular
tools/build/watch.spec.js
mockTimeout
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/build/watch.spec.js#L141-L179
train
javascript
setTimeout/clearTimeout mocking, mostly stolen from angular-mocks.js
function mockTimeout() { var events = []; var id = 0; var now = 0; return { mocks: {setTimeout: mockSetTimeout, clearTimeout: mockClearTimeout}, flush: flush, get pending() { return events.length; } }; function mockSetTimeout(fn, delay) { delay = delay || 0; events.push({time: now + delay,...
setTimeout/clearTimeout mocking, mostly stolen from angular-mocks.js function mockTimeout() { var events = []; var id = 0; var now = 0; return { mocks: {setTimeout: mockSetTimeout, clearTimeout: mockClearTimeout}, flush: flush, get pending() { return events.length; } }; function mockSetTimeout(fn...
263
68
899
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3b8e74f0b4630a4a31975f6cb1eff776a936e598e0f602e66ace50b423ccf43a
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
34ff1a0816645c39a62ac222
angular/angular
.circleci/trigger-webhook.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/.circleci/trigger-webhook.js#L62-L71
train
javascript
Helpers
function _main(args) { triggerWebhook(...args). then(({statusCode, responseText}) => (200 <= statusCode && statusCode < 400) ? console.log(`Status: ${statusCode}\n${responseText}`) : Promise.reject(new Error(`Request failed (status: ${statusCode}): ${responseText}`))). catch(err => { console...
Helpers function _main(args) { triggerWebhook(...args). then(({statusCode, responseText}) => (200 <= statusCode && statusCode < 400) ? console.log(`Status: ${statusCode}\n${responseText}`) : Promise.reject(new Error(`Request failed (status: ${statusCode}): ${responseText}`))). catch(err => { ...
90
7
365
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
96b6e65a81d759c801985f628f454fff186c12d75ae91ac3dfdd678d00f6e148
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
9ba5d307c956d59b801bee2b
angular/angular
aio/scripts/contributors/check-pictures.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/contributors/check-pictures.js#L16-L28
train
javascript
Functions - Definitions
function _main() { const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); const expectedImages = Object.keys(contributors) .filter(key => !!contributors[key].picture) .map(key => join(IMAGES_DIR, contributors[key].picture)); const missingImages = expectedImages.filter(path => !exist...
Functions - Definitions function _main() { const contributors = JSON.parse(readFileSync(CONTRIBUTORS_PATH, 'utf8')); const expectedImages = Object.keys(contributors) .filter(key => !!contributors[key].picture) .map(key => join(IMAGES_DIR, contributors[key].picture)); const missingImages = expectedIma...
132
23
550
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7a367b033437e59e44f8650969527f9fa06ded68338597269149735702bb08d8
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
76cb0bc6dd76914d550f8472
angular/angular
aio/scripts/verify-guide-codeownership.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/verify-guide-codeownership.js#L19-L40
train
javascript
Functions - Definitions
function _main() { const {guides: acGuidePaths, images: acGuideImagesPaths, examples: acExamplePaths} = getPathsFromAioContent(); const {guides: coGuidePaths, images: coGuideImagesPaths, examples: coExamplePaths} = getPathsFromCodeowners(); const guidesDiff = arrayDiff(acGuidePaths, coGuidePaths); const images...
Functions - Definitions function _main() { const {guides: acGuidePaths, images: acGuideImagesPaths, examples: acExamplePaths} = getPathsFromAioContent(); const {guides: coGuidePaths, images: coGuideImagesPaths, examples: coExamplePaths} = getPathsFromCodeowners(); const guidesDiff = arrayDiff(acGuidePaths, coGu...
283
23
1,099
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e6b989933b61ea2af9ae26c0470b439b533745b508f874d5cc0caf596f908cc1
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
05c340c667a17eae1d3aeaaa
angular/angular
aio/tools/transforms/angular-base-package/rendering/hasValues.js
readProperty
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-base-package/rendering/hasValues.js#L20-L23
train
javascript
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;
function readProperty(obj, propertySegments, index) { const value = obj[propertySegments[index]]; return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1)); }
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; function readProperty(obj, propertySegments, index) { co...
130
260
214
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1ecffa43bcf90c82f87bd0c50275f1fbc308628f0098570c34af4b683c1d6542
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
fec0537f03365df343e0fd05
angular/angular
tools/gulp-tasks/cldr/extract.js
generateLocale
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L94-L117
train
javascript
Generate file that contains basic locale data
function generateLocale(locale, localeData, baseCurrencies) { // [ localeId, dateTime, number, currency, pluralCase ] let data = stringify([ locale, ...getDateTimeTranslations(localeData), ...getDateTimeSettings(localeData), ...getNumberSettings(localeData), ...getCurrencySettings(locale, locale...
Generate file that contains basic locale data function generateLocale(locale, localeData, baseCurrencies) { // [ localeId, dateTime, number, currency, pluralCase ] let data = stringify([ locale, ...getDateTimeTranslations(localeData), ...getDateTimeSettings(localeData), ...getNumberSettings(localeD...
181
45
743
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
39d364fa58e90e0cd737063050f68c281a1a091f083c212273220285fc860050
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
3150c8da96a4227d2297a9aa
angular/angular
tools/gulp-tasks/cldr/extract.js
generateLocaleExtra
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L122-L157
train
javascript
Generate a file that contains extra data (for now: day period rules, and extended day period data)
function generateLocaleExtra(locale, localeData) { const dayPeriods = getDayPeriodsNoAmPm(localeData); const dayPeriodRules = getDayPeriodRules(localeData); let dayPeriodsSupplemental = []; if (Object.keys(dayPeriods.format.narrow).length) { const keys = Object.keys(dayPeriods.format.narrow); if (key...
Generate a file that contains extra data (for now: day period rules, and extended day period data) function generateLocaleExtra(locale, localeData) { const dayPeriods = getDayPeriodsNoAmPm(localeData); const dayPeriodRules = getDayPeriodRules(localeData); let dayPeriodsSupplemental = []; if (Object.keys(dayP...
304
98
1,186
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b8a09b74e05a68899849f880d518b7eec83d99b1372dc7ae24795deee62b0970
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
00484c75907783171d5f92f2
angular/angular
tools/gulp-tasks/cldr/extract.js
generateBaseCurrencies
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L163-L196
train
javascript
Generate a list of currencies to be used as a based for other currencies e.g.: {'ARS': [, '$'], 'AUD': ['A$', '$'], ...}
function generateBaseCurrencies(localeData, addDigits) { const currenciesData = localeData.main('numbers/currencies'); const fractions = new cldrJs('en').get(`supplemental/currencyData/fractions`); const currencies = {}; Object.keys(currenciesData).forEach(key => { let symbolsArray = []; const symbol = ...
Generate a list of currencies to be used as a based for other currencies e.g.: {'ARS': [, '$'], 'AUD': ['A$', '$'], ...} function generateBaseCurrencies(localeData, addDigits) { const currenciesData = localeData.main('numbers/currencies'); const fractions = new cldrJs('en').get(`supplemental/currencyData/fractions...
321
120
1,200
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b19453662dee1b9f9eb85c38b42c7d00ffde8dcd7c9594f6e081c6f243a85546
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
3bf374921f5ca5e4184d94b2
angular/angular
tools/gulp-tasks/cldr/extract.js
generateLocaleCurrencies
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L201-L225
train
javascript
To minimize the file even more, we only output the differences compared to the base currency
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...
To minimize the file even more, we only output the differences compared to the base currency function generateLocaleCurrencies(localeData, baseCurrencies) { const currenciesData = localeData.main('numbers/currencies'); const currencies = {}; Object.keys(currenciesData).forEach(code => { let symbolsArray = []...
208
92
832
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
51e63368115fed482b9d3c8a7670eb63f4aede107aed10efd68ec9140436af86
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
cc3b2edc05fcb37a72255d05
angular/angular
tools/gulp-tasks/cldr/extract.js
getDayPeriods
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L245-L262
train
javascript
Returns data for the chosen day periods @returns {format: {narrow / abbreviated / wide: [...]}, stand-alone: {narrow / abbreviated / wide: [...]}}
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...
Returns data for the chosen day periods @returns {format: {narrow / abbreviated / wide: [...]}, stand-alone: {narrow / abbreviated / wide: [...]}} function getDayPeriods(localeData, dayPeriodsList) { const dayPeriods = localeData.main(`dates/calendars/gregorian/dayPeriods`); const result = {}; // cleaning up unu...
211
146
627
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
971d8f84c5c075f844666c5b700c66ac2b1f92372c6a81694f5a31484164efe1
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
aa11b21d0b946fab9a85aea3
angular/angular
tools/gulp-tasks/cldr/extract.js
getDateTimeTranslations
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L284-L342
train
javascript
Returns date-related translations for a locale @returns [ dayPeriodsFormat, dayPeriodsStandalone, daysFormat, dayStandalone, monthsFormat, monthsStandalone, eras ] each value: [ narrow, abbreviated, wide, short? ]
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...
Returns date-related translations for a locale @returns [ dayPeriodsFormat, dayPeriodsStandalone, daysFormat, dayStandalone, monthsFormat, monthsStandalone, eras ] each value: [ narrow, abbreviated, wide, short? ] function getDateTimeTranslations(localeData) { const dayNames = localeData.main(`dates/calendars/gregor...
541
213
2,048
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
620b25dafd1b222087a11467f67d54532382c62df972adc2652c58356374c473
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
95cbf62d12c422f93994fe08
angular/angular
tools/gulp-tasks/cldr/extract.js
getDateTimeFormats
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L349-L368
train
javascript
Returns date, time and dateTime formats for a locale @returns [dateFormats, timeFormats, dateTimeFormats] each format: [ short, medium, long, full ]
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...
Returns date, time and dateTime formats for a locale @returns [dateFormats, timeFormats, dateTimeFormats] each format: [ short, medium, long, full ] function getDateTimeFormats(localeData) { function getFormats(data) { return removeDuplicates([ data.short._value || data.short, data.medium._value || d...
174
148
624
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
46e327b6f4307117158af61766af1c042b700717dc1276d66cf980a732625811
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
a9d931821010ffe98bff2558
angular/angular
tools/gulp-tasks/cldr/extract.js
getDayPeriodRules
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L374-L388
train
javascript
Returns day period rules for a locale @returns string[]
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]....
Returns day period rules for a locale @returns string[] function getDayPeriodRules(localeData) { const dayPeriodRules = localeData.get(`supplemental/dayPeriodRuleSet/${localeData.attributes.language}`); const rules = {}; if (dayPeriodRules) { Object.keys(dayPeriodRules).forEach(key => { if (dayPeriodRu...
127
55
457
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9f97adbd29b73da4cc547489195c31126f7da512183a28f1cb291e15a5737fe0
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
7b468b0a02678ac875281d1e
angular/angular
tools/gulp-tasks/cldr/extract.js
getWeekendRange
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L402-L410
train
javascript
Returns week-end range for a locale, based on US week days @returns [number, number]
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}`...
Returns week-end range for a locale, based on US week days @returns [number, number] function getWeekendRange(localeData) { const startDay = localeData.get(`supplemental/weekData/weekendStart/${localeData.attributes.territory}`) || localeData.get('supplemental/weekData/weekendStart/001'); const endDay = ...
143
84
453
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
35e5f5c13009b8897d2a97f0de16d43c334f373b7a96065eecbfe8f7e081b3ca
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
056c24d115ef93211aaae149
angular/angular
tools/gulp-tasks/cldr/extract.js
getNumberSettings
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L426-L459
train
javascript
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 ]
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...
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 ] functi...
313
312
1,102
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
28d377bcbb34e9ff1f770a334a71a9000a1ac90f9f87b31a88a54b01f12e84fe
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
6f0baf3d00ad8acafcf96c82
angular/angular
tools/gulp-tasks/cldr/extract.js
getCurrencySettings
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L465-L496
train
javascript
Returns the currency symbol and name for a locale @returns [ symbol, name ]
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...
Returns the currency symbol and name for a locale @returns [ symbol, name ] function getCurrencySettings(locale, localeData) { const currencyInfo = localeData.main(`numbers/currencies`); let currentCurrency = ''; // find the currency currently used in this country const currencies = localeData.get(`supple...
231
75
995
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
32ab538dafc56e854e33fc56c82874025edf8b73b21b1a32a6c7f9c378b8e7ce
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
c990f274472211a08e0328eb
angular/angular
tools/gulp-tasks/cldr/extract.js
getPluralFunction
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L510-L534
train
javascript
Returns the plural function for a locale todo(ocombe): replace "cldr" extractPluralRuleFunction with our own extraction using "CldrJS" because the 2 libs can become out of sync if they use different versions of the cldr database
function getPluralFunction(locale) { let fn = cldr.extractPluralRuleFunction(locale).toString(); if (fn === EMPTY_RULE) { fn = DEFAULT_RULE; } fn = fn .replace( toRegExp('function anonymous(n\n/*``*/) {\n'), 'function plural(n: number): number {\n ') .replace(toRegExp('var'), 'let') ...
Returns the plural function for a locale todo(ocombe): replace "cldr" extractPluralRuleFunction with our own extraction using "CldrJS" because the 2 libs can become out of sync if they use different versions of the cldr database function getPluralFunction(locale) { let fn = cldr.extractPluralRuleFunction(locale).toS...
291
228
819
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1f0303e89699f8a8bde64431256b495ec9fd2704d931ca683735d3df2be6c062
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
3100ff7326416867b8b2a83a
angular/angular
tools/gulp-tasks/cldr/extract.js
removeDuplicates
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/extract.js#L560-L570
train
javascript
To create smaller locale files, we remove duplicated data. To be make this work we need to store similar data in arrays, if some value in an array is undefined, we can take the previous defined value instead, because it means that it has been deduplicated. e.g.: [x, y, undefined, z, undefined, undefined] The first unde...
function removeDuplicates(data) { const dedup = [data[0]]; for(let i = 1; i < data.length; i++) { if (stringify(data[i]) !== stringify(data[i - 1])) { dedup.push(data[i]); } else { dedup.push(undefined); } } return dedup; }
To create smaller locale files, we remove duplicated data. To be make this work we need to store similar data in arrays, if some value in an array is undefined, we can take the previous defined value instead, because it means that it has been deduplicated. e.g.: [x, y, undefined, z, undefined, undefined] The first unde...
287
911
255
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b3dca1a39db2876746bf1f686e33b0afb04a97037c54b4dd83539ad15ae6eb27
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
d970a5cc15b5b265f7d60a8b
angular/angular
aio/tools/transforms/angular-base-package/rendering/truncateCode.js
balance
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-base-package/rendering/truncateCode.js#L27-L49
train
javascript
Try to balance the brackets by adding closers on to the end of a string for every bracket that is left open. The chars at each index in the openers and closers should match (i.e openers = ['{', '('], closers = ['}', ')']) @param {string} str The string to balance @param {string[]} openers an array of chars that open a...
function balance(str, openers, closers) { const stack = []; // Add each open bracket to the stack, removing them when there is a matching closer str.split('').forEach(function(char) { const closerIndex = closers.indexOf(char); if (closerIndex !== -1 && stack[stack.length-1] === closerIndex) { stack...
Try to balance the brackets by adding closers on to the end of a string for every bracket that is left open. The chars at each index in the openers and closers should match (i.e openers = ['{', '('], closers = ['}', ')']) @param {string} str The string to balance @param {string[]} openers an array of chars that open a...
257
420
613
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ba9231c670187f00f1816e715d99715707fd5efa4989c8091d2aa5c7125c9b57
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
12c3f3a7d720e9d4585b5841
angular/angular
modules/angular1_router/src/module_template.js
getComponentConstructor
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/modules/angular1_router/src/module_template.js#L57-L68
train
javascript
When this file is processed, the line below is replaced with the contents of the compiled TypeScript classes. {{SHARED_CODE}}
function getComponentConstructor(name) { var serviceName = name + 'Directive'; if ($injector.has(serviceName)) { var definitions = $injector.get(serviceName); if (definitions.length > 1) { throw new Error('too many directives named "' + name + '"'); } return definitions[0].contro...
When this file is processed, the line below is replaced with the contents of the compiled TypeScript classes. {{SHARED_CODE}} function getComponentConstructor(name) { var serviceName = name + 'Directive'; if ($injector.has(serviceName)) { var definitions = $injector.get(serviceName); if (definition...
120
125
417
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6e03c2f9726964636fb7bac311cc49a14444f78f47e299d6c8b4a43ffc26c788
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
d3d85ccc43f4399b40cc6ded
angular/angular
tools/build/file2modulename.js
file2moduleName
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/build/file2modulename.js#L9-L22
train
javascript
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license
function file2moduleName(filePath) { return filePath .replace(/\\/g, '/') // module name should be relative to `modules` and `tools` folder .replace(/.*\/modules\//, '') // and 'dist' folder .replace(/.*\/dist\/js\/dev\/es5\//, '') // module name should not include `lib`, `web` fo...
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license function file2moduleName(filePath) { return filePath .replace(/\\/g, '/') // module name should be relative to `modules` and...
178
180
512
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
709085a83980347bc92368710c785f9fe0eb3e87723f9abc13a15868d5911caf
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
32946f016e01633c0a0b0bdb
angular/angular
aio/scripts/switch-to-ivy.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/switch-to-ivy.js#L26-L49
train
javascript
Functions - Definitions
function _main() { // Detect path to `tsconfig.app.json`. const ngConfig = parse(readFileSync(NG_JSON, 'utf8')); const tsConfigPath = join(ROOT_DIR, ngConfig.projects.site.architect.build.options.tsConfig); // Enable Ivy in TS config. console.log(`\nModifying \`${tsConfigPath}\`...`); const oldTsConfigStr ...
Functions - Definitions function _main() { // Detect path to `tsconfig.app.json`. const ngConfig = parse(readFileSync(NG_JSON, 'utf8')); const tsConfigPath = join(ROOT_DIR, ngConfig.projects.site.architect.build.options.tsConfig); // Enable Ivy in TS config. console.log(`\nModifying \`${tsConfigPath}\`...`)...
303
23
1,075
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
64d1e9b8c2583964c00b4329de9ef5ac3454a5607ba4d35862afdd5958e10727
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
98eca83cf185dcef144e53d2
angular/angular
gulpfile.js
loadTask
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/gulpfile.js#L23-L27
train
javascript
See `tools/gulp-tasks/README.md` for information about task loading.
function loadTask(fileName, taskName) { const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); }
See `tools/gulp-tasks/README.md` for information about task loading. function loadTask(fileName, taskName) { const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); }
65
68
187
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8dbb778a78f1b27f19cbfafe25313ede6bdecb3a4bbf9e5fc95bcec92b7721af
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
e9d3556e81926be05225a1ad
angular/angular
tools/npm/check-node-modules.js
checkNodeModules
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/npm/check-node-modules.js#L18-L34
train
javascript
tslint:disable:no-console
function checkNodeModules(logOutput, purgeIfStale) { var yarnCheck = childProcess.spawnSync( 'yarn check --integrity', {shell: true, cwd: path.resolve(__dirname, '../..')}); var nodeModulesOK = yarnCheck.status === 0; if (nodeModulesOK) { if (logOutput) console.log(':-) npm dependencies are looking goo...
tslint:disable:no-console function checkNodeModules(logOutput, purgeIfStale) { var yarnCheck = childProcess.spawnSync( 'yarn check --integrity', {shell: true, cwd: path.resolve(__dirname, '../..')}); var nodeModulesOK = yarnCheck.status === 0; if (nodeModulesOK) { if (logOutput) console.log(':-) npm d...
165
25
603
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
99c0dc6ad8ca66da57ac34d80bb9887ffab1417ba97d57802614ad426b74455b
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
860443dc67f920a7d4b8b016
angular/angular
tools/npm/check-node-modules.js
_deleteDir
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/npm/check-node-modules.js#L41-L54
train
javascript
Custom implementation of recursive `rm` because we can't rely on the state of node_modules to pull in existing module.
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); } })...
Custom implementation of recursive `rm` because we can't rely on the state of node_modules to pull in existing module. function _deleteDir(path) { if (fs.existsSync(path)) { var subpaths = fs.readdirSync(path); subpaths.forEach(function(subpath) { var curPath = path + '/' + subpath; if (fs.lstatS...
117
118
351
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
22eb063d3f3554a1d895a769c1edd79c9b120b547d832b88f9d9de1aec018fa8
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
d5429b983e82bbae501383f7
angular/angular
aio/tools/transforms/authors-package/getting-started-package.js
createPackage
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/authors-package/getting-started-package.js#L17-L44
train
javascript
/* eslint no-console: "off"
function createPackage(tutorialName) { const tutorialFilePath = `${CONTENTS_PATH}/getting-started/${tutorialName}.md`; const tutorialFile = readFileSync(tutorialFilePath, 'utf8'); const examples = []; tutorialFile.replace(/<code-(?:pane|example) [^>]*path="([^"]+)"/g, (_, path) => examples.push('examples/' + p...
/* eslint no-console: "off" function createPackage(tutorialName) { const tutorialFilePath = `${CONTENTS_PATH}/getting-started/${tutorialName}.md`; const tutorialFile = readFileSync(tutorialFilePath, 'utf8'); const examples = []; tutorialFile.replace(/<code-(?:pane|example) [^>]*path="([^"]+)"/g, (_, path) => ...
232
27
992
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c14a8f3e94769586044d28742f984ba931ff5b7793a566ae02c393c9dc60a849
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
6834e68d699c09e7191d3868
angular/angular
.circleci/get-commit-range.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/.circleci/get-commit-range.js#L100-L120
train
javascript
Helpers
async function _main([buildNumber, compareUrl = '', circleToken = '']) { try { if (!buildNumber || isNaN(buildNumber)) { throw new Error( 'Missing or invalid arguments.\n' + 'Expected: buildNumber (number), compareUrl? (string), circleToken? (string)'); } if (!compareUrl) { ...
Helpers async function _main([buildNumber, compareUrl = '', circleToken = '']) { try { if (!buildNumber || isNaN(buildNumber)) { throw new Error( 'Missing or invalid arguments.\n' + 'Expected: buildNumber (number), compareUrl? (string), circleToken? (string)'); } if (!compareUr...
153
7
618
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b319c159bf9c087fe216b46f8fea630497dca4434aa2511db4ce5a26fa5a705e
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
66bf05742fdf11c7647b40b0
angular/angular
tools/gulp-tasks/cldr/closure.js
generateAllLocalesFile
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/closure.js#L71-L163
train
javascript
Generate a file that contains all locale to import for closure. Tree shaking will only keep the data for the `goog.LOCALE` locale.
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...
Generate a file that contains all locale to import for closure. Tree shaking will only keep the data for the `goog.LOCALE` locale. function generateAllLocalesFile(LOCALES, ALIASES) { const existingLocalesAliases = {}; const existingLocalesData = {}; // for each locale, get the data and the list of equivalent lo...
774
130
2,824
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9ec52bf420eb16069f45c9bbe065be134fd0a314263b1bf1665a9157ebbed0d6
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
8e2822c6a1314bb1ef8cc3ca
angular/angular
tools/gulp-tasks/tools-build.js
tsc
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/tools-build.js#L9-L19
train
javascript
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license
function tsc(projectPath, done) { const path = require('path'); const platformScriptPath = require('./platform-script-path'); const childProcess = require('child_process'); childProcess .spawn( path.join(__dirname, platformScriptPath('../../node_modules/.bin/tsc')), ['-p', path.join(_...
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license function tsc(projectPath, done) { const path = require('path'); const platformScriptPath = require('./platform-script-path'); const ...
133
180
401
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
33077b1690d91b9c2c66c6b69eda96d22b6bff692d73001e2ccf72ffcf30fa4a
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
116d0ed5c432d183033cc2b2
angular/angular
aio/tools/transforms/remark-package/services/renderMarkdown.js
inlineTagDefs
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/remark-package/services/renderMarkdown.js#L43-L75
train
javascript
Teach remark about inline tags, so that it neither wraps block level tags in paragraphs nor processes the text within the tag.
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....
Teach remark about inline tags, so that it neither wraps block level tags in paragraphs nor processes the text within the tag. function inlineTagDefs() { const Parser = this.Parser; const inlineTokenizers = Parser.prototype.inlineTokenizers; const inlineMethods = Parser.prototype.inlineMethods; const b...
268
126
1,048
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
05578845017c5c73da1ae2bf69b3d0473ff24e364b595bde42f3d3e2f4d80762
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
36d2518a985a890b0d4a0b0a
angular/angular
aio/tools/transforms/remark-package/services/renderMarkdown.js
plainHTMLBlocks
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/remark-package/services/renderMarkdown.js#L80-L113
train
javascript
Teach remark that some HTML blocks never include markdown
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...
Teach remark that some HTML blocks never include markdown 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...
281
57
1,203
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9ac39c065f568f06ddb8d0c3231b1903bdc6fb792c977845686b1ec5be334590
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
35ac07210b509e81fdd08ded
angular/angular
packages/bazel/src/protractor/protractor.conf.js
setConf
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/packages/bazel/src/protractor/protractor.conf.js#L24-L30
train
javascript
Helper function to warn when a user specified value is being overwritten
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; }
Helper function to warn when a user specified value is being overwritten 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; }
75
72
242
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e6b07efaedc690a9493f31a1dd0f4dbf5b8ff6cde9b3e51f7c7b438f38a7d142
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
b5edfad0c59cab7335ae5784
angular/angular
tools/gulp-tasks/cldr/util.js
isArray
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/util.js#L48-L54
train
javascript
polyfills
function isArray(obj) { if (Array.isArray) { return Array.isArray(obj); } else { return Object.prototype.toString.call(obj) === '[object Array]'; } }
polyfills function isArray(obj) { if (Array.isArray) { return Array.isArray(obj); } else { return Object.prototype.toString.call(obj) === '[object Array]'; } }
42
9
175
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eff62482f8567cb43a93aa2b8e63c73b1cec7c6d52f8fae88040426d2ba885b6
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
b48058d87b507a5a01394d8e
angular/angular
tools/gulp-tasks/cldr/util.js
internalStringify
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/util.js#L95-L169
train
javascript
End
function internalStringify(holder, key) { var buffer, res; // Replace the value, if necessary var obj_part = getReplacedValueOrUndefined(holder, key); if (obj_part && !isDate(obj_part)) { // unbox objects // don't unbox dates, since will turn it into number obj_part = obj_part.valueO...
End function internalStringify(holder, key) { var buffer, res; // Replace the value, if necessary var obj_part = getReplacedValueOrUndefined(holder, key); if (obj_part && !isDate(obj_part)) { // unbox objects // don't unbox dates, since will turn it into number obj_part = obj_part.v...
496
3
2,258
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
699e675d05bbf3e3f93d7e3bfd9d31f468df48966a267d930416ef4fb9a76267
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
0f8dbb52fc2ff43dec8b8f7f
angular/angular
aio/tools/examples/run-example-e2e.js
runProtractorAoT
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L223-L234
train
javascript
Run e2e tests over the AOT build for projects that examples it.
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)) { ...
Run e2e tests over the AOT build for projects that examples it. 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-dis...
183
63
572
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
85496c15ff3c927087dcf4907efb786710ae8b9c459a26df9f0b28911081aaff
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
33c26d80a9d2c97ee9a65823
angular/angular
aio/tools/examples/run-example-e2e.js
reportStatus
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L283-L310
train
javascript
Report final status.
function reportStatus(status, outputFile) { let log = ['']; log.push('Suites ignored due to legacy guides:'); IGNORED_EXAMPLES.filter(example => !fixmeIvyExamples.find(ex => ex.startsWith(example))) .forEach(function(val) { log.push(' ' + val); }); if (argv.ivy) { log.push(''); log.push('Suites...
Report final status. function reportStatus(status, outputFile) { let log = ['']; log.push('Suites ignored due to legacy guides:'); IGNORED_EXAMPLES.filter(example => !fixmeIvyExamples.find(ex => ex.startsWith(example))) .forEach(function(val) { log.push(' ' + val); }); if (argv.ivy) { log.push('')...
236
20
880
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
18a7fad24b1c75cdbe0027fde2300f68ba1c9ee120cba1196bf16f2b71dc3e61
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
349f9afa5409933426ee118b
angular/angular
aio/tools/examples/run-example-e2e.js
spawnExt
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L313-L343
train
javascript
Returns both a promise and the spawned process so that it can be killed if needed.
function spawnExt(command, args, options, ignoreClose = false, printMessage = msg => process.stdout.write(msg)) { let proc; const promise = new Promise((resolve, reject) => { let descr = command + ' ' + args.join(' '); let processOutput = ''; printMessage(`running: ${descr}\n`); tr...
Returns both a promise and the spawned process so that it can be killed if needed. function spawnExt(command, args, options, ignoreClose = false, printMessage = msg => process.stdout.write(msg)) { let proc; const promise = new Promise((resolve, reject) => { let descr = command + ' ' + args.jo...
271
82
1,036
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
94a246c65f976c87aea94ee447bafbeb75cf1a641a3d520410d99b7f474db49b
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
0639d9349a31b885fc7e1512
angular/angular
aio/tools/examples/run-example-e2e.js
loadExampleConfig
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L373-L384
train
javascript
Load configuration for an example. Used for SystemJS
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; }
Load configuration for an example. Used for SystemJS 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...
85
52
296
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e0dc846e1505c43f22b29b9c54f70aebbd38f763714ec7718c56ad26362fe1c7
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
5a2ad45bad98884cd52a1466
angular/angular
aio/tools/examples/run-example-e2e.js
logSpecs
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L389-L396
train
javascript
Log the specs (for debugging purposes). `e2eSpecPaths` is of type: `{[type: string]: string[]}` (where `type` is `systemjs`, `cli, etc.)
function logSpecs(e2eSpecPaths) { Object.keys(e2eSpecPaths).forEach(type => { const paths = e2eSpecPaths[type]; console.log(` ${type.toUpperCase()}:`); console.log(paths.map(p => ` ${p}`).join('\n')); }); }
Log the specs (for debugging purposes). `e2eSpecPaths` is of type: `{[type: string]: string[]}` (where `type` is `systemjs`, `cli, etc.) function logSpecs(e2eSpecPaths) { Object.keys(e2eSpecPaths).forEach(type => { const paths = e2eSpecPaths[type]; console.log(` ${type.toUpperCase()}:`); console.log(pa...
108
136
227
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
54e8f5d62744fe4043e7ce6ae69471814ed0319a24d1c729e5db9b314ce4dd11
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
c91c878398f1ff79ba68aa7c
angular/angular
tools/symbol-extractor/symbol_extractor_spec/hello_world_min_debug.js
getNextLNodeWithProjection
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/symbol-extractor/symbol_extractor_spec/hello_world_min_debug.js#L179-L183
train
javascript
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license @license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the...
function getNextLNodeWithProjection(node) { var pNextOrParent = node.pNextOrParent; return pNextOrParent ? 1 == (3 & pNextOrParent.flags) ? null : pNextOrParent : node.next; }
@license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://angular.io/license @license Copyright Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the...
134
363
187
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6ba7efbf9b36d605c28a1c1b94d71f8ee589cfb66898f86417642d5a951b6fbc
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
1a7c8ab719605c7c1b2d1abb
angular/angular
tools/rebase-pr.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/rebase-pr.js#L61-L69
train
javascript
Helpers
async function _main(repository, prNumber) { console.log(`Determining target branch for PR ${prNumber} on ${repository}.`); const targetBranch = await determineTargetBranch(repository, prNumber); console.log(`Target branch is ${targetBranch}.`); await exec(`git fetch origin ${targetBranch}`); console.log(`Reb...
Helpers async function _main(repository, prNumber) { console.log(`Determining target branch for PR ${prNumber} on ${repository}.`); const targetBranch = await determineTargetBranch(repository, prNumber); console.log(`Target branch is ${targetBranch}.`); await exec(`git fetch origin ${targetBranch}`); console...
104
7
453
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d31f75cf0877d417709b8707b0c1a184bc79a5189143742dd0024c7d77bf98f9
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
f8b24e9dc6e00c5baf539f7c
angular/angular
aio/tools/examples/shared/protractor.config.js
Reporter
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/shared/protractor.config.js#L66-L160
train
javascript
See http://jasmine.github.io/2.1/custom_reporter.html
function Reporter(options) { var _defaultOutputFile = path.resolve(__dirname, '../../protractor-results.txt'); options.outputFile = options.outputFile || _defaultOutputFile; var _root = { appDir: options.appDir, suites: [] }; log('AppDir: ' + options.appDir, +1); var _currentSuite; this.suiteStarted = fun...
See http://jasmine.github.io/2.1/custom_reporter.html function Reporter(options) { var _defaultOutputFile = path.resolve(__dirname, '../../protractor-results.txt'); options.outputFile = options.outputFile || _defaultOutputFile; var _root = { appDir: options.appDir, suites: [] }; log('AppDir: ' + options.appDi...
695
53
2,740
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
98c9ce01d2945986de746418e334470421256dee321d020e7ba6d6e144cebc40
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
3fb4a2743d956ce56c6dc8ae
angular/angular
aio/tools/examples/shared/protractor.config.js
formatOutput
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/shared/protractor.config.js#L122-L145
train
javascript
for output file output
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...
for output file output 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; suit...
180
22
753
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e045c7ec19139f2448742675c2a293086be5be05079a25adc465a50c90e0c492
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
975767a7379236747f33b3ef
angular/angular
tools/gulp-tasks/format.js
gulpStatus
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/format.js#L37-L83
train
javascript
Gulp stream that wraps the gulp-git status, only returns untracked files, and converts the stdout into a stream of files.
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 = /((\...
Gulp stream that wraps the gulp-git status, only returns untracked files, and converts the stdout into a stream of files. function gulpStatus() { const Vinyl = require('vinyl'); const path = require('path'); const gulpGit = require('gulp-git'); const through = require('through2'); const srcStream = through.o...
368
121
1,270
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b31895ec2ba7251fa6644809cce4f91e385ba6f645989c005ecc0299a1a94d34
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
23a1dd824d0210c70e3ad1f8
angular/angular
aio/scripts/build-404-page.js
_main
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/scripts/build-404-page.js#L15-L31
train
javascript
Functions - Definitions
function _main() { const srcIndexPath = join(DIST_DIR, 'index.html'); const src404BodyPath = join(SRC_DIR, '404-body.html'); const dst404PagePath = join(DIST_DIR, '404.html'); const srcIndexContent = readFileSync(srcIndexPath, 'utf8'); const src404BodyContent = readFileSync(src404BodyPath, 'utf8'); const d...
Functions - Definitions function _main() { const srcIndexPath = join(DIST_DIR, 'index.html'); const src404BodyPath = join(SRC_DIR, '404-body.html'); const dst404PagePath = join(DIST_DIR, '404.html'); const srcIndexContent = readFileSync(srcIndexPath, 'utf8'); const src404BodyContent = readFileSync(src404Bod...
179
23
660
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
10f69cd09a4ad97369cf082e6cbfb930b340e029457d24228c7427b145d610af
MIT
permissive
https://github.com/angular/angular/blob/main/LICENSE
3f9c33821eb6b0cab24d93a1
facebook/create-react-app
packages/react-scripts/config/modules.js
getAdditionalModulePaths
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-scripts/config/modules.js#L21-L55
train
javascript
Get the baseUrl of a compilerOptions object. @param {Object} options
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...
Get the baseUrl of a compilerOptions object. @param {Object} options 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) { ...
297
69
1,172
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
723f48b15c56833af36fb988e3e43c1bf0692d0cca73e55e12050b60e3dc443d
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
0fedabc4f92039a067fdd59c
facebook/create-react-app
packages/create-react-app/createReactApp.js
isSafeToCreateProjectIn
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/create-react-app/createReactApp.js#L791-L849
train
javascript
If project only contains files generated by GH, it’s safe. Also, if project contains remnant error logs from a previous installation, lets remove them now. We also special case IJ-based products .idea because it integrates with CRA: https://github.com/facebook/create-react-app/pull/368#issuecomment-243446094
function isSafeToCreateProjectIn(root, name) { const validFiles = [ '.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE', '.hg', '.hgignore', '.hgcheck', '.npmignore', 'mkdocs.yml', 'docs', '.travis.yml', '.gitlab-ci.yml', '.gi...
If project only contains files generated by GH, it’s safe. Also, if project contains remnant error logs from a previous installation, lets remove them now. We also special case IJ-based products .idea because it integrates with CRA: https://github.com/facebook/create-react-app/pull/368#issuecomment-243446094 function ...
447
309
1,518
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
96c50670ae9469b782d40ce91d39549c59286dc34a4546bf5b3b3776e52a1da7
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
3c86dd8e0ba2e00a6c94d66b
facebook/create-react-app
packages/react-dev-utils/webpackHotDevClient.js
handleSuccess
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/webpackHotDevClient.js#L97-L112
train
javascript
Successful compilation.
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...
Successful compilation. 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...
105
23
437
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1c2cf10694fe6e5314dbf15179e5aa2c99b4207c3ec60484fd09f1f277b6fe14
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
eadbc7cd7142fa443a5b4f60
facebook/create-react-app
packages/react-dev-utils/FileSizeReporter.js
printFileSizesAfterBuild
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/FileSizeReporter.js#L27-L104
train
javascript
Prints a detailed summary of build files.
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...
Prints a detailed summary of build files. function printFileSizesAfterBuild( webpackStats, previousSizeMap, buildFolder, maxBundleGzipSize, maxChunkGzipSize ) { var root = previousSizeMap.root; var sizes = previousSizeMap.sizes; var assets = (webpackStats.stats || [webpackStats]) .map(stats => ...
595
41
2,474
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
754747e12b95c07dde741862caaee6b66f618e269f552034f9c629529f34ab56
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
19600187eabfb632e22e0e97
facebook/create-react-app
packages/react-dev-utils/openBrowser.js
openBrowser
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/openBrowser.js#L111-L124
train
javascript
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.
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...
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. function openBrowser(url) { const { action, value } = getBrowserEnv(); switch (action) { case Actions.NONE: // Special case: BROWSER="none" will prevent ope...
125
148
409
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2fa4a7385340ff40d6b12613aa6b836c4dce28447b7f7c725fabd260d04efeaa
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
c1eef8f6b9432532fb6ea189
facebook/create-react-app
packages/react-dev-utils/WebpackDevServerUtils.js
onProxyError
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/WebpackDevServerUtils.js#L307-L344
train
javascript
We need to provide a custom onError function for httpProxyMiddleware. It allows us to log custom error messages on the console.
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) +...
We need to provide a custom onError function for httpProxyMiddleware. It allows us to log custom error messages on the console. function onProxyError(proxy) { return (err, req, res) => { const host = req.headers && req.headers.host; console.log( chalk.red('Proxy error:') + ' Could not proxy req...
255
127
978
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c5a4b7ac8a3ed0842fc3beeda607df52fe929239befb31e7c0154f0c68df0749
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
b6d7b3f0e6cf0f973477038a
facebook/create-react-app
packages/react-dev-utils/WebpackDevServerUtils.js
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-dev-utils/WebpackDevServerUtils.js#L399-L406
train
javascript
For single page apps, we generally want to fallback to /index.html. However we also want to respect `proxy` for API calls. So if `proxy` is specified as a string, we need to decide which fallback to use. We use a heuristic: We want to proxy all the requests that are not meant for static assets and as all the requests f...
function(pathname, req) { return ( req.method !== 'GET' || (mayProxy(pathname) && req.headers.accept && req.headers.accept.indexOf('text/html') === -1) ); }
For single page apps, we generally want to fallback to /index.html. However we also want to respect `proxy` for API calls. So if `proxy` is specified as a string, we need to decide which fallback to use. We use a heuristic: We want to proxy all the requests that are not meant for static assets and as all the requests f...
206
683
222
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
16e54d0434de5aed1de5b129c92f76db21a0e5fc779f026104a153ca08f7c494
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
bb2df06768527044b7216db5
facebook/create-react-app
packages/react-scripts/config/paths.js
getServedPath
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/react-scripts/config/paths.js#L42-L47
train
javascript
We use `PUBLIC_URL` environment variable or "homepage" field to infer "public path" at which the app is served. Webpack needs to know it to put the right <script> hrefs into HTML even in single-page apps that may serve index.html for nested URLs like /todos/42. We can't use a relative path in HTML because we don't want...
function getServedPath(appPackageJson) { const publicUrl = getPublicUrl(appPackageJson); const servedUrl = envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/'); return ensureSlash(servedUrl, true); }
We use `PUBLIC_URL` environment variable or "homepage" field to infer "public path" at which the app is served. Webpack needs to know it to put the right <script> hrefs into HTML even in single-page apps that may serve index.html for nested URLs like /todos/42. We can't use a relative path in HTML because we don't want...
155
406
222
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
bc00ba7e60fdd24eeb43b92d949780a0a1069732909dac28cf7770d0d9cf2f58
MIT
permissive
https://github.com/react/create-react-app/blob/main/LICENSE
9dba8d2b31478adb2a501b4d
electron/electron
lib/browser/guest-view-manager.js
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L56-L161
train
javascript
Create a new guest instance.
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] = ...
Create a new guest instance. 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 gues...
843
28
3,422
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3e4a83d7849ea06322e7467f5c97830a0ca0d9738b7047cbd20584e14f731f6c
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
90c98eda7f24690b8395ef60
electron/electron
lib/browser/guest-view-manager.js
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L164-L273
train
javascript
Attach the guest to an element of embedder.
function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { const embedder = event.sender // Destroy the old guest when attaching. const key = `${embedder.id}-${elementInstanceId}` const oldGuestInstanceId = embedderElementsMap[key] if (oldGuestInstanceId != null) { // Reattachment to ...
Attach the guest to an element of embedder. function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { const embedder = event.sender // Destroy the old guest when attaching. const key = `${embedder.id}-${elementInstanceId}` const oldGuestInstanceId = embedderElementsMap[key] if (oldGuest...
904
43
3,902
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
682c17da8f59101b411d0b96514c3d5bd4837b1d1036fd581947071db0fd5d1e
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
796ce407596f76e3d6ac61ff
electron/electron
lib/browser/guest-view-manager.js
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L276-L287
train
javascript
Remove an guest-embedder relationship.
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}` ...
Remove an guest-embedder relationship. function (embedder, guestInstanceId) { const guestInstance = guestInstances[guestInstanceId] if (embedder !== guestInstance.embedder) { return } webViewManager.removeGuest(embedder, guestInstanceId) delete guestInstances[guestInstanceId] const key = `${embedder....
87
38
355
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
30d04c6cbd8093a0ad700fb180fc9d41c1c0efcad44605c16dd0935419d7eb29
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
59132415ed3e36b29b6d004a
electron/electron
lib/browser/guest-view-manager.js
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L299-L307
train
javascript
Forward embedder window visiblity change events to guest
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...
Forward embedder window visiblity change events to guest function (visibilityState) { for (const guestInstanceId in guestInstances) { const guestInstance = guestInstances[guestInstanceId] guestInstance.visibilityState = visibilityState if (guestInstance.embedder === embedder) { guestInsta...
90
56
365
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
33e5c85750eb9b46e03afdd04fb85e50193392ba8f1e110452cc9350c68d5de5
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
e5005accc79282295812ddba
electron/electron
lib/browser/guest-view-manager.js
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L395-L404
train
javascript
Returns WebContents from its guest id hosted in given webContents.
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 }
Returns WebContents from its guest id hosted in given webContents. 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 gu...
85
66
308
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
bd80025735c77f99071271c649f75c41977c8db167a87bca4e82d83a3c2b63bd
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
4592797d5bcf66b512de93fa
electron/electron
script/prepare-release.js
changesToRelease
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/prepare-release.js#L184-L188
train
javascript
function to determine if there have been commits to master since the last release
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) }
function to determine if there have been commits to master since the last release 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) retu...
109
81
287
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7fef7632f05812a13e4ab31c27d89f446c27af764cecbd624b88061ab577d25e
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
60c446dfc8f8877aeb525c59
electron/electron
script/release-notes/notes.js
runRetryable
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/release-notes/notes.js#L305-L317
train
javascript
helper function to add some resiliency to volatile GH api endpoints
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...
helper function to add some resiliency to volatile GH api endpoints 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)) las...
115
67
349
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ad5a232d1d6ddd8449f7566107fb8038d5ede30e354858a14a877673175f7655
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
0fecd714e1fc423632dbdad2
electron/electron
lib/renderer/api/remote.js
wrapArgs
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L28-L105
train
javascript
Convert the arguments object into an array of meta data.
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...
Convert the arguments object into an array of meta data. 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)) { v...
486
56
2,024
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
da46453e3349ee9bd6e94a020546fb8dcb7694a91b168d8ec786efad23536a50
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
104c3a3f1d3f7330ab2d93ab
electron/electron
lib/renderer/api/remote.js
setObjectMembers
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L110-L161
train
javascript
Populate object's members from descriptors. The |ref| will be kept referenced by |members|. This matches |getObjectMemebers| in rpc-server.
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...
Populate object's members from descriptors. The |ref| will be kept referenced by |members|. This matches |getObjectMemebers| in rpc-server. function setObjectMembers (ref, object, metaId, members) { if (!Array.isArray(members)) return for (const member of members) { if (object.hasOwnProperty(member.name)) con...
424
139
1,811
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c9fc0ed265a7e3bc69eab414ba8f1b8a622157df719293359dcf39a07f3216a7
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
f1d4642805bd86ee041b69d7
electron/electron
lib/renderer/api/remote.js
setObjectPrototype
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L165-L171
train
javascript
Populate object's prototype from descriptor. This matches |getObjectPrototype| in rpc-server.
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) }
Populate object's prototype from descriptor. This matches |getObjectPrototype| in rpc-server. function setObjectPrototype (ref, object, metaId, descriptor) { if (descriptor === null) return const proto = {} setObjectMembers(ref, proto, metaId, descriptor.members) setObjectPrototype(ref, proto, metaId, descript...
80
93
275
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
698792fb3430683f464fcd38bef610766d904ab6c4ec10cdd420e786da96af07
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
d8759b660e7673f3d1647433
electron/electron
lib/renderer/api/remote.js
proxyFunctionProperties
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L174-L211
train
javascript
Wrap function in Proxy for accessing remote properties
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...
Wrap function in Proxy for accessing remote properties 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' ...
288
54
1,303
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
55879e77c7c77106cc0c6793a3a4f3d450ff622fe743dd854cdd9c6506bbb46c
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
b6fb1229eb97cdba6b874174
electron/electron
lib/renderer/api/remote.js
metaToValue
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L214-L262
train
javascript
Convert meta data from browser into real value.
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...
Convert meta data from browser into real value. 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) }), ...
420
47
1,686
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
59728d161f23b974582f374db75581bb6976c0ed22f504e37d19cd6fd6b4d78b
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE
826efc35cd4836059ba78864
electron/electron
lib/renderer/api/remote.js
metaToPlainObject
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/renderer/api/remote.js#L265-L272
train
javascript
Construct a plain object from the meta.
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 }
Construct a plain object from the meta. 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 }
80
39
235
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1cbd1f3d47528029057c68df52b68977677a3d91651c043599f66dd6bc8da5cc
MIT
permissive
https://github.com/electron/electron/blob/main/LICENSE