Datasets:
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 |
End of preview. Expand in Data Studio
CodeSearchNet JavaScript — permissive licences only
Working copy (2026-12-05). Derived from the official
code-search-net/code_search_net
javascript configuration, keeping only repositories whose audited SPDX licence is
permissive.
- 98,988 rows, 4,417 repositories
- 116,755,904 characters, 28,073,645 tokens
(tiktoken
cl100k_base) - parquet
73,146,482bytes (zstd), 20 columns - splits: train 89,241 · validation 5,321 · test 4,426
- removed 7,480 non-permissive rows and 32,136 rows without a detected licence.
- audit cap: 5,000 repos audited (83.1% of rows); 0 selected repos (0 rows) not audited and dropped.
Full datasheet: datasheet.md.
Licences (rows)
| SPDX | rows | % |
|---|---|---|
MIT |
75,733 | 76.5% |
Apache-2.0 |
17,226 | 17.4% |
BSD-3-Clause |
2,979 | 3.0% |
ISC |
1,630 | 1.6% |
BSD-2-Clause |
1,128 | 1.1% |
Artistic-2.0 |
86 | 0.1% |
CC0-1.0 |
77 | 0.1% |
Zlib |
66 | 0.1% |
WTFPL |
41 | 0.0% |
BSL-1.0 |
15 | 0.0% |
0BSD |
7 | 0.0% |
Schema
id, repo, path, func_name, url, split, language, docstring, code, text,
token_count, doc_chars, code_chars, license_basis, source, added,
record_sha256, license, license_class, license_source
text = docstring + \n\n + code. id is unique. record_sha256 is the
canonical per-row SHA-256.
Rights
- Every retained row has an audited permissive SPDX licence in
license(license_class == "permissive",license_source= GitHub licence URL). - No copyleft and no
NOASSERTION/unknown. - Permissive is not obligation-free: Apache-2.0 requires NOTICE/attribution; MIT/BSD require the copyright notice. This is not legal advice.
Not checked
- Whether GitHub's LICENSE-file detection matches the repo's actual terms.
- Notice/attribution preservation for Apache-2.0/BSD rows.
- Cross-corpus dedup against other code corpora.
- PII in code/docstrings; no scrubber was run.
Authors
Piotr Styła (SlayerLab / Fabryka AI), 2026. See CITATION.cff.
Citation
If you use this dataset, cite it via CITATION.cff (or the Hugging Face
dataset page). Upstream code should be cited/attributed via the repo and
url fields.
Dataset licence
Curation, selection and metadata: CC-BY-4.0 (see LICENSE). Code and
documentation remain under their upstream licences, recorded per row in
license / license_source; see NOTICE, ATTRIBUTION.md and LICENSES/.
- Downloads last month
- -