repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(fn, mOptions) {
// Functionality taken from lodash open source library and adapted as needed
mOptions = Object.assign({
wait: 0,
leading: true
}, mOptions);
mOptions.maxWait = mOptions.wait;
mOptions.trailing = true;
mOptions.requestAnimationFrame = false;
return TableUtils.debounce(fn, mOptions);
} | javascript | function(fn, mOptions) {
// Functionality taken from lodash open source library and adapted as needed
mOptions = Object.assign({
wait: 0,
leading: true
}, mOptions);
mOptions.maxWait = mOptions.wait;
mOptions.trailing = true;
mOptions.requestAnimationFrame = false;
return TableUtils.debounce(fn, mOptions);
} | [
"function",
"(",
"fn",
",",
"mOptions",
")",
"{",
"// Functionality taken from lodash open source library and adapted as needed",
"mOptions",
"=",
"Object",
".",
"assign",
"(",
"{",
"wait",
":",
"0",
",",
"leading",
":",
"true",
"}",
",",
"mOptions",
")",
";",
"... | Invokes a method in a certain interval, regardless of how many times it was called.
@param {Function} fn The method to throttle.
@param {Object} [mOptions] The options that influence when the throttled method will be invoked.
@param {int} [mOptions.wait=0] The amount of milliseconds to wait until actually invoking the method.
@param {boolean} [mOptions.leading=true] Whether the method should be invoked on the first call.
@param {boolean} [mOptions.asyncLeading=false] Whether the leading invocation should be asynchronous.
@returns {Function} Returns the throttled method. | [
"Invokes",
"a",
"method",
"in",
"a",
"certain",
"interval",
"regardless",
"of",
"how",
"many",
"times",
"it",
"was",
"called",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1238-L1250 | train | Returns a function that will call fn after a specified number of milliseconds. | [
30522,
3853,
1006,
1042,
2078,
1010,
9587,
16790,
2015,
1007,
1063,
1013,
1013,
15380,
2579,
2013,
8840,
8883,
2232,
2330,
3120,
3075,
1998,
5967,
2004,
2734,
9587,
16790,
2015,
1027,
4874,
1012,
23911,
1006,
1063,
3524,
1024,
1014,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/config/config-file.js | loadFromDisk | function loadFromDisk(configInfo, configContext) {
const config = loadConfigFile(configInfo);
// loadConfigFile will return null for a `package.json` file that does not have an `eslintConfig` property.
if (config) {
return loadObject(configContext, { config, filePath: configInfo.filePath, configFullName: configInfo.configFullName });
}
return null;
} | javascript | function loadFromDisk(configInfo, configContext) {
const config = loadConfigFile(configInfo);
// loadConfigFile will return null for a `package.json` file that does not have an `eslintConfig` property.
if (config) {
return loadObject(configContext, { config, filePath: configInfo.filePath, configFullName: configInfo.configFullName });
}
return null;
} | [
"function",
"loadFromDisk",
"(",
"configInfo",
",",
"configContext",
")",
"{",
"const",
"config",
"=",
"loadConfigFile",
"(",
"configInfo",
")",
";",
"// loadConfigFile will return null for a `package.json` file that does not have an `eslintConfig` property.",
"if",
"(",
"confi... | Loads a configuration file from the given file path.
@param {Object} configInfo The value from calling resolve() on a filename or package name.
@param {Config} configContext Config context
@returns {Object} The configuration information. | [
"Loads",
"a",
"configuration",
"file",
"from",
"the",
"given",
"file",
"path",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L524-L533 | train | Load the config from disk | [
30522,
3853,
7170,
19699,
5358,
10521,
2243,
1006,
9530,
8873,
11528,
14876,
1010,
9530,
8873,
18195,
28040,
18413,
1007,
1063,
9530,
3367,
9530,
8873,
2290,
1027,
7170,
8663,
8873,
25708,
9463,
1006,
9530,
8873,
11528,
14876,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function () {
var i,
sPath = "",
sSegment;
for (i = 0; i < arguments.length; i += 1) {
sSegment = arguments[i];
if (sSegment || sSegment === 0) {
if (sPath && sPath !== "/" && sSegment[0] !== "(") {
sPath += "/";
}
sPath += sSegment;
}
}
return sPath;
} | javascript | function () {
var i,
sPath = "",
sSegment;
for (i = 0; i < arguments.length; i += 1) {
sSegment = arguments[i];
if (sSegment || sSegment === 0) {
if (sPath && sPath !== "/" && sSegment[0] !== "(") {
sPath += "/";
}
sPath += sSegment;
}
}
return sPath;
} | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"sPath",
"=",
"\"\"",
",",
"sSegment",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"sSegment",
"=",
"arguments",
"[",
"i",
"]",
";",
"if... | Builds a relative path from the given arguments. Iterates over the arguments and appends
them to the path if defined and non-empty. The arguments are expected to be strings or
integers, but this is not checked.
Examples:
buildPath() --> ""
buildPath("base", "relative") --> "base/relative"
buildPath("base", "") --> "base"
buildPath("", "relative") --> "relative"
buildPath("base", undefined, "relative") --> "base/relative"
buildPath("base", 42, "relative") --> "base/42/relative"
buildPath("base", 0, "relative") --> "base/0/relative"
buildPath("base", "('predicate')") --> "base('predicate')"
@returns {string} a composite path built from all arguments | [
"Builds",
"a",
"relative",
"path",
"from",
"the",
"given",
"arguments",
".",
"Iterates",
"over",
"the",
"arguments",
"and",
"appends",
"them",
"to",
"the",
"path",
"if",
"defined",
"and",
"non",
"-",
"empty",
".",
"The",
"arguments",
"are",
"expected",
"to... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L113-L128 | train | Returns the path of the path segment | [
30522,
3853,
1006,
1007,
1063,
13075,
1045,
1010,
14690,
2232,
1027,
1000,
1000,
1010,
7020,
13910,
3672,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
9918,
1012,
3091,
1025,
1045,
1009,
1027,
1015,
1007,
1063,
7020,
13910,
3672,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
KaTeX/KaTeX | webpack.common.js | createConfig | function createConfig(target /*: Target */, dev /*: boolean */,
minimize /*: boolean */) /*: Object */ {
const cssLoaders /*: Array<Object> */ = [{loader: 'css-loader'}];
if (minimize) {
cssLoaders[0].options = {importLoaders: 1};
cssLoaders.push({
loader: 'postcss-loader',
options: {plugins: [require('cssnano')()]},
});
}
const lessOptions = {modifyVars: {
version: `"${version}"`,
}};
// use only necessary fonts, overridable by environment variables
let isCovered = false;
for (const font of fonts) {
const override = process.env[`USE_${font.toUpperCase()}`];
const useFont = override === "true" || override !== "false" && !isCovered;
lessOptions.modifyVars[`use-${font}`] = useFont;
const support = caniuse.feature(caniuse.features[font]).stats;
isCovered = isCovered || useFont && browserslist.every(browser => {
const [name, version] = browser.split(' ');
return !support[name] || support[name][version] === 'y';
});
}
return {
mode: dev ? 'development' : 'production',
context: __dirname,
entry: {
[target.name]: target.entry,
},
output: {
filename: minimize ? '[name].min.js' : '[name].js',
library: target.library,
libraryTarget: 'umd',
libraryExport: 'default',
// Enable output modules to be used in browser or Node.
// See: https://github.com/webpack/webpack/issues/6522
globalObject: "(typeof self !== 'undefined' ? self : this)",
path: path.resolve(__dirname, 'dist'),
publicPath: dev ? '/' : '',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
use: [
dev ? 'style-loader' : MiniCssExtractPlugin.loader,
...cssLoaders,
],
},
{
test: /\.less$/,
use: [
dev ? 'style-loader' : MiniCssExtractPlugin.loader,
...cssLoaders,
{
loader: 'less-loader',
options: lessOptions,
},
],
},
{
test: /\.(ttf|woff|woff2)$/,
use: [{
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
}],
},
],
},
externals: 'katex',
plugins: [
!dev && new MiniCssExtractPlugin({
filename: minimize ? '[name].min.css' : '[name].css',
}),
].filter(Boolean),
devtool: dev && 'inline-source-map',
optimization: {
minimize,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
ascii_only: true,
},
},
}),
],
},
performance: {
hints: false,
},
};
} | javascript | function createConfig(target /*: Target */, dev /*: boolean */,
minimize /*: boolean */) /*: Object */ {
const cssLoaders /*: Array<Object> */ = [{loader: 'css-loader'}];
if (minimize) {
cssLoaders[0].options = {importLoaders: 1};
cssLoaders.push({
loader: 'postcss-loader',
options: {plugins: [require('cssnano')()]},
});
}
const lessOptions = {modifyVars: {
version: `"${version}"`,
}};
// use only necessary fonts, overridable by environment variables
let isCovered = false;
for (const font of fonts) {
const override = process.env[`USE_${font.toUpperCase()}`];
const useFont = override === "true" || override !== "false" && !isCovered;
lessOptions.modifyVars[`use-${font}`] = useFont;
const support = caniuse.feature(caniuse.features[font]).stats;
isCovered = isCovered || useFont && browserslist.every(browser => {
const [name, version] = browser.split(' ');
return !support[name] || support[name][version] === 'y';
});
}
return {
mode: dev ? 'development' : 'production',
context: __dirname,
entry: {
[target.name]: target.entry,
},
output: {
filename: minimize ? '[name].min.js' : '[name].js',
library: target.library,
libraryTarget: 'umd',
libraryExport: 'default',
// Enable output modules to be used in browser or Node.
// See: https://github.com/webpack/webpack/issues/6522
globalObject: "(typeof self !== 'undefined' ? self : this)",
path: path.resolve(__dirname, 'dist'),
publicPath: dev ? '/' : '',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
use: [
dev ? 'style-loader' : MiniCssExtractPlugin.loader,
...cssLoaders,
],
},
{
test: /\.less$/,
use: [
dev ? 'style-loader' : MiniCssExtractPlugin.loader,
...cssLoaders,
{
loader: 'less-loader',
options: lessOptions,
},
],
},
{
test: /\.(ttf|woff|woff2)$/,
use: [{
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
}],
},
],
},
externals: 'katex',
plugins: [
!dev && new MiniCssExtractPlugin({
filename: minimize ? '[name].min.css' : '[name].css',
}),
].filter(Boolean),
devtool: dev && 'inline-source-map',
optimization: {
minimize,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
ascii_only: true,
},
},
}),
],
},
performance: {
hints: false,
},
};
} | [
"function",
"createConfig",
"(",
"target",
"/*: Target */",
",",
"dev",
"/*: boolean */",
",",
"minimize",
"/*: boolean */",
")",
"/*: Object */",
"{",
"const",
"cssLoaders",
"/*: Array<Object> */",
"=",
"[",
"{",
"loader",
":",
"'css-loader'",
"}",
"]",
";",
"if"... | Create a webpack config for given target | [
"Create",
"a",
"webpack",
"config",
"for",
"given",
"target"
] | 17bfb247b88070267f3e5c7b21fe4a360fdf49d9 | https://github.com/KaTeX/KaTeX/blob/17bfb247b88070267f3e5c7b21fe4a360fdf49d9/webpack.common.js#L53-L158 | train | Create webpack config object | [
30522,
3853,
3443,
8663,
8873,
2290,
1006,
4539,
1013,
1008,
1024,
4539,
1008,
1013,
1010,
16475,
1013,
1008,
1024,
22017,
20898,
1008,
1013,
1010,
18478,
1013,
1008,
1024,
22017,
20898,
1008,
1013,
1007,
1013,
1008,
1024,
4874,
1008,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
badges/shields | gatsby-node.js | createPages | async function createPages({ actions: { createPage } }) {
if (includeDevPages) {
createPage({
path: '/dev/logos',
component: require.resolve('./frontend/components/development/logo-page'),
})
}
categories.forEach(category => {
const { id } = category
createPage({
path: `/category/${id}`,
component: require.resolve('./frontend/components/main'),
// `context` provided here becomes `props.pageContext` on the page.
context: { category },
})
})
} | javascript | async function createPages({ actions: { createPage } }) {
if (includeDevPages) {
createPage({
path: '/dev/logos',
component: require.resolve('./frontend/components/development/logo-page'),
})
}
categories.forEach(category => {
const { id } = category
createPage({
path: `/category/${id}`,
component: require.resolve('./frontend/components/main'),
// `context` provided here becomes `props.pageContext` on the page.
context: { category },
})
})
} | [
"async",
"function",
"createPages",
"(",
"{",
"actions",
":",
"{",
"createPage",
"}",
"}",
")",
"{",
"if",
"(",
"includeDevPages",
")",
"{",
"createPage",
"(",
"{",
"path",
":",
"'/dev/logos'",
",",
"component",
":",
"require",
".",
"resolve",
"(",
"'./f... | Often in Gatsby context gets piped through GraphQL, but GraphQL adds unnecessary complexity here, so this uses the programmatic API. https://www.gatsbyjs.org/docs/using-gatsby-without-graphql/#the-approach-fetch-data-and-use-gatsbys-createpages-api | [
"Often",
"in",
"Gatsby",
"context",
"gets",
"piped",
"through",
"GraphQL",
"but",
"GraphQL",
"adds",
"unnecessary",
"complexity",
"here",
"so",
"this",
"uses",
"the",
"programmatic",
"API",
".",
"https",
":",
"//",
"www",
".",
"gatsbyjs",
".",
"org",
"/",
... | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/gatsby-node.js#L22-L39 | train | Create pages for each category | [
30522,
2004,
6038,
2278,
3853,
3443,
13704,
2015,
1006,
1063,
4506,
1024,
1063,
3443,
13704,
1065,
1065,
1007,
1063,
2065,
1006,
2443,
6777,
13704,
2015,
1007,
1063,
3443,
13704,
1006,
1063,
4130,
1024,
1005,
1013,
16475,
1013,
25571,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
feross/simple-peer | index.js | Peer | function Peer (opts) {
var self = this
if (!(self instanceof Peer)) return new Peer(opts)
self._id = randombytes(4).toString('hex').slice(0, 7)
self._debug('new peer %o', opts)
opts = Object.assign({
allowHalfOpen: false
}, opts)
stream.Duplex.call(self, opts)
self.channelName = opts.initiator
? opts.channelName || randombytes(20).toString('hex')
: null
self.initiator = opts.initiator || false
self.channelConfig = opts.channelConfig || Peer.channelConfig
self.config = Object.assign({}, Peer.config, opts.config)
self.offerOptions = opts.offerOptions || {}
self.answerOptions = opts.answerOptions || {}
self.sdpTransform = opts.sdpTransform || function (sdp) { return sdp }
self.streams = opts.streams || (opts.stream ? [opts.stream] : []) // support old "stream" option
self.trickle = opts.trickle !== undefined ? opts.trickle : true
self.allowHalfTrickle = opts.allowHalfTrickle !== undefined ? opts.allowHalfTrickle : false
self.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT
self.destroyed = false
self.connected = false
self.remoteAddress = undefined
self.remoteFamily = undefined
self.remotePort = undefined
self.localAddress = undefined
self.localFamily = undefined
self.localPort = undefined
self._wrtc = (opts.wrtc && typeof opts.wrtc === 'object')
? opts.wrtc
: getBrowserRTC()
if (!self._wrtc) {
if (typeof window === 'undefined') {
throw makeError('No WebRTC support: Specify `opts.wrtc` option in this environment', 'ERR_WEBRTC_SUPPORT')
} else {
throw makeError('No WebRTC support: Not a supported browser', 'ERR_WEBRTC_SUPPORT')
}
}
self._pcReady = false
self._channelReady = false
self._iceComplete = false // ice candidate trickle done (got null candidate)
self._iceCompleteTimer = null // send an offer/answer anyway after some timeout
self._channel = null
self._pendingCandidates = []
self._isNegotiating = !self.initiator // is this peer waiting for negotiation to complete?
self._batchedNegotiation = false // batch synchronous negotiations
self._queuedNegotiation = false // is there a queued negotiation request?
self._sendersAwaitingStable = []
self._senderMap = new Map()
self._firstStable = true
self._closingInterval = null
self._remoteTracks = []
self._remoteStreams = []
self._chunk = null
self._cb = null
self._interval = null
try {
self._pc = new (self._wrtc.RTCPeerConnection)(self.config)
} catch (err) {
self.destroy(err)
}
// We prefer feature detection whenever possible, but sometimes that's not
// possible for certain implementations.
self._isReactNativeWebrtc = typeof self._pc._peerConnectionId === 'number'
self._pc.oniceconnectionstatechange = function () {
self._onIceStateChange()
}
self._pc.onicegatheringstatechange = function () {
self._onIceStateChange()
}
self._pc.onsignalingstatechange = function () {
self._onSignalingStateChange()
}
self._pc.onicecandidate = function (event) {
self._onIceCandidate(event)
}
// Other spec events, unused by this implementation:
// - onconnectionstatechange
// - onicecandidateerror
// - onfingerprintfailure
// - onnegotiationneeded
if (self.initiator) {
self._setupData({
channel: self._pc.createDataChannel(self.channelName, self.channelConfig)
})
} else {
self._pc.ondatachannel = function (event) {
self._setupData(event)
}
}
if (self.streams) {
self.streams.forEach(function (stream) {
self.addStream(stream)
})
}
self._pc.ontrack = function (event) {
self._onTrack(event)
}
if (self.initiator) {
self._needsNegotiation()
}
self._onFinishBound = function () {
self._onFinish()
}
self.once('finish', self._onFinishBound)
} | javascript | function Peer (opts) {
var self = this
if (!(self instanceof Peer)) return new Peer(opts)
self._id = randombytes(4).toString('hex').slice(0, 7)
self._debug('new peer %o', opts)
opts = Object.assign({
allowHalfOpen: false
}, opts)
stream.Duplex.call(self, opts)
self.channelName = opts.initiator
? opts.channelName || randombytes(20).toString('hex')
: null
self.initiator = opts.initiator || false
self.channelConfig = opts.channelConfig || Peer.channelConfig
self.config = Object.assign({}, Peer.config, opts.config)
self.offerOptions = opts.offerOptions || {}
self.answerOptions = opts.answerOptions || {}
self.sdpTransform = opts.sdpTransform || function (sdp) { return sdp }
self.streams = opts.streams || (opts.stream ? [opts.stream] : []) // support old "stream" option
self.trickle = opts.trickle !== undefined ? opts.trickle : true
self.allowHalfTrickle = opts.allowHalfTrickle !== undefined ? opts.allowHalfTrickle : false
self.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT
self.destroyed = false
self.connected = false
self.remoteAddress = undefined
self.remoteFamily = undefined
self.remotePort = undefined
self.localAddress = undefined
self.localFamily = undefined
self.localPort = undefined
self._wrtc = (opts.wrtc && typeof opts.wrtc === 'object')
? opts.wrtc
: getBrowserRTC()
if (!self._wrtc) {
if (typeof window === 'undefined') {
throw makeError('No WebRTC support: Specify `opts.wrtc` option in this environment', 'ERR_WEBRTC_SUPPORT')
} else {
throw makeError('No WebRTC support: Not a supported browser', 'ERR_WEBRTC_SUPPORT')
}
}
self._pcReady = false
self._channelReady = false
self._iceComplete = false // ice candidate trickle done (got null candidate)
self._iceCompleteTimer = null // send an offer/answer anyway after some timeout
self._channel = null
self._pendingCandidates = []
self._isNegotiating = !self.initiator // is this peer waiting for negotiation to complete?
self._batchedNegotiation = false // batch synchronous negotiations
self._queuedNegotiation = false // is there a queued negotiation request?
self._sendersAwaitingStable = []
self._senderMap = new Map()
self._firstStable = true
self._closingInterval = null
self._remoteTracks = []
self._remoteStreams = []
self._chunk = null
self._cb = null
self._interval = null
try {
self._pc = new (self._wrtc.RTCPeerConnection)(self.config)
} catch (err) {
self.destroy(err)
}
// We prefer feature detection whenever possible, but sometimes that's not
// possible for certain implementations.
self._isReactNativeWebrtc = typeof self._pc._peerConnectionId === 'number'
self._pc.oniceconnectionstatechange = function () {
self._onIceStateChange()
}
self._pc.onicegatheringstatechange = function () {
self._onIceStateChange()
}
self._pc.onsignalingstatechange = function () {
self._onSignalingStateChange()
}
self._pc.onicecandidate = function (event) {
self._onIceCandidate(event)
}
// Other spec events, unused by this implementation:
// - onconnectionstatechange
// - onicecandidateerror
// - onfingerprintfailure
// - onnegotiationneeded
if (self.initiator) {
self._setupData({
channel: self._pc.createDataChannel(self.channelName, self.channelConfig)
})
} else {
self._pc.ondatachannel = function (event) {
self._setupData(event)
}
}
if (self.streams) {
self.streams.forEach(function (stream) {
self.addStream(stream)
})
}
self._pc.ontrack = function (event) {
self._onTrack(event)
}
if (self.initiator) {
self._needsNegotiation()
}
self._onFinishBound = function () {
self._onFinish()
}
self.once('finish', self._onFinishBound)
} | [
"function",
"Peer",
"(",
"opts",
")",
"{",
"var",
"self",
"=",
"this",
"if",
"(",
"!",
"(",
"self",
"instanceof",
"Peer",
")",
")",
"return",
"new",
"Peer",
"(",
"opts",
")",
"self",
".",
"_id",
"=",
"randombytes",
"(",
"4",
")",
".",
"toString",
... | WebRTC peer connection. Same API as node core `net.Socket`, plus a few extra methods.
Duplex stream.
@param {Object} opts | [
"WebRTC",
"peer",
"connection",
".",
"Same",
"API",
"as",
"node",
"core",
"net",
".",
"Socket",
"plus",
"a",
"few",
"extra",
"methods",
".",
"Duplex",
"stream",
"."
] | 3ed91bf631c4bf9c3b4bf5a85d004bb70d621707 | https://github.com/feross/simple-peer/blob/3ed91bf631c4bf9c3b4bf5a85d004bb70d621707/index.js#L20-L148 | train | Creates a new peer | [
30522,
3853,
8152,
1006,
23569,
2015,
1007,
1063,
13075,
2969,
1027,
2023,
2065,
1006,
999,
1006,
2969,
6013,
11253,
8152,
1007,
1007,
2709,
2047,
8152,
1006,
23569,
2015,
1007,
2969,
1012,
1035,
8909,
1027,
6721,
3762,
4570,
1006,
1018,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ccxt/ccxt | examples/js/fetch-all-tickers-to-files.js | async function () {
// while the array of all exchanges is not empty
while (exchanges.length > 0) {
// pop one exchange from the array
const exchange = exchanges.pop ()
// check if it has the necessary method implemented
if (exchange.has['fetchTickers']) {
// try to do "the work" and handle errors if any
try {
// fetch the response for all tickers from the exchange
const tickers = await exchange.fetchTickers ()
// make a filename from exchange id
const filename = exchange.id + '.json'
// save the response to a file
fs.writeFileSync (filename, JSON.stringify ({ tickers }));
// print out a message on success
log.green (exchange.id, 'tickers saved to', filename)
} catch (e) {
// in case of error - print it out and ignore it further
log.red (e.constructor.name, e.message)
}
} else {
log.red (exchange.id, "has['fetchTickers'] = false");
}
}
} | javascript | async function () {
// while the array of all exchanges is not empty
while (exchanges.length > 0) {
// pop one exchange from the array
const exchange = exchanges.pop ()
// check if it has the necessary method implemented
if (exchange.has['fetchTickers']) {
// try to do "the work" and handle errors if any
try {
// fetch the response for all tickers from the exchange
const tickers = await exchange.fetchTickers ()
// make a filename from exchange id
const filename = exchange.id + '.json'
// save the response to a file
fs.writeFileSync (filename, JSON.stringify ({ tickers }));
// print out a message on success
log.green (exchange.id, 'tickers saved to', filename)
} catch (e) {
// in case of error - print it out and ignore it further
log.red (e.constructor.name, e.message)
}
} else {
log.red (exchange.id, "has['fetchTickers'] = false");
}
}
} | [
"async",
"function",
"(",
")",
"{",
"// while the array of all exchanges is not empty",
"while",
"(",
"exchanges",
".",
"length",
">",
"0",
")",
"{",
"// pop one exchange from the array",
"const",
"exchange",
"=",
"exchanges",
".",
"pop",
"(",
")",
"// check if it has... | the worker function for each "async thread" | [
"the",
"worker",
"function",
"for",
"each",
"async",
"thread"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/examples/js/fetch-all-tickers-to-files.js#L31-L68 | train | fetch all the exchanges from the array | [
30522,
2004,
6038,
2278,
3853,
1006,
1007,
1063,
1013,
1013,
2096,
1996,
9140,
1997,
2035,
15800,
2003,
2025,
4064,
2096,
1006,
15800,
1012,
3091,
1028,
1014,
1007,
1063,
1013,
1013,
3769,
2028,
3863,
2013,
1996,
9140,
9530,
3367,
3863,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/sunburst/sunburstLayout.js | function (node, startAngle) {
if (!node) {
return;
}
var endAngle = startAngle;
// Render self
if (node !== virtualRoot) {
// Tree node is virtual, so it doesn't need to be drawn
var value = node.getValue();
var angle = (sum === 0 && stillShowZeroSum)
? unitRadian : (value * unitRadian);
if (angle < minAngle) {
angle = minAngle;
restAngle -= minAngle;
}
else {
valueSumLargerThanMinAngle += value;
}
endAngle = startAngle + dir * angle;
var depth = node.depth - rootDepth
- (renderRollupNode ? -1 : 1);
var rStart = r0 + rPerLevel * depth;
var rEnd = r0 + rPerLevel * (depth + 1);
var itemModel = node.getModel();
if (itemModel.get('r0') != null) {
rStart = parsePercent(itemModel.get('r0'), size / 2);
}
if (itemModel.get('r') != null) {
rEnd = parsePercent(itemModel.get('r'), size / 2);
}
node.setLayout({
angle: angle,
startAngle: startAngle,
endAngle: endAngle,
clockwise: clockwise,
cx: cx,
cy: cy,
r0: rStart,
r: rEnd
});
}
// Render children
if (node.children && node.children.length) {
// currentAngle = startAngle;
var siblingAngle = 0;
zrUtil.each(node.children, function (node) {
siblingAngle += renderNode(node, startAngle + siblingAngle);
});
}
return endAngle - startAngle;
} | javascript | function (node, startAngle) {
if (!node) {
return;
}
var endAngle = startAngle;
// Render self
if (node !== virtualRoot) {
// Tree node is virtual, so it doesn't need to be drawn
var value = node.getValue();
var angle = (sum === 0 && stillShowZeroSum)
? unitRadian : (value * unitRadian);
if (angle < minAngle) {
angle = minAngle;
restAngle -= minAngle;
}
else {
valueSumLargerThanMinAngle += value;
}
endAngle = startAngle + dir * angle;
var depth = node.depth - rootDepth
- (renderRollupNode ? -1 : 1);
var rStart = r0 + rPerLevel * depth;
var rEnd = r0 + rPerLevel * (depth + 1);
var itemModel = node.getModel();
if (itemModel.get('r0') != null) {
rStart = parsePercent(itemModel.get('r0'), size / 2);
}
if (itemModel.get('r') != null) {
rEnd = parsePercent(itemModel.get('r'), size / 2);
}
node.setLayout({
angle: angle,
startAngle: startAngle,
endAngle: endAngle,
clockwise: clockwise,
cx: cx,
cy: cy,
r0: rStart,
r: rEnd
});
}
// Render children
if (node.children && node.children.length) {
// currentAngle = startAngle;
var siblingAngle = 0;
zrUtil.each(node.children, function (node) {
siblingAngle += renderNode(node, startAngle + siblingAngle);
});
}
return endAngle - startAngle;
} | [
"function",
"(",
"node",
",",
"startAngle",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"return",
";",
"}",
"var",
"endAngle",
"=",
"startAngle",
";",
"// Render self",
"if",
"(",
"node",
"!==",
"virtualRoot",
")",
"{",
"// Tree node is virtual, so it doesn'... | Render a tree
@return increased angle | [
"Render",
"a",
"tree"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sunburst/sunburstLayout.js#L86-L145 | train | Render node | [
30522,
3853,
1006,
13045,
1010,
2707,
5654,
2571,
1007,
1063,
2065,
1006,
999,
13045,
1007,
1063,
2709,
1025,
1065,
13075,
2203,
5654,
2571,
1027,
2707,
5654,
2571,
1025,
1013,
1013,
17552,
2969,
2065,
1006,
30524,
1005,
1056,
2342,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/language/LanguageManager.js | _setLanguageForMode | function _setLanguageForMode(mode, language) {
if (_modeToLanguageMap[mode]) {
console.warn("CodeMirror mode \"" + mode + "\" is already used by language " + _modeToLanguageMap[mode]._name + " - cannot fully register language " + language._name +
" using the same mode. Some features will treat all content with this mode as language " + _modeToLanguageMap[mode]._name);
return;
}
_modeToLanguageMap[mode] = language;
} | javascript | function _setLanguageForMode(mode, language) {
if (_modeToLanguageMap[mode]) {
console.warn("CodeMirror mode \"" + mode + "\" is already used by language " + _modeToLanguageMap[mode]._name + " - cannot fully register language " + language._name +
" using the same mode. Some features will treat all content with this mode as language " + _modeToLanguageMap[mode]._name);
return;
}
_modeToLanguageMap[mode] = language;
} | [
"function",
"_setLanguageForMode",
"(",
"mode",
",",
"language",
")",
"{",
"if",
"(",
"_modeToLanguageMap",
"[",
"mode",
"]",
")",
"{",
"console",
".",
"warn",
"(",
"\"CodeMirror mode \\\"\"",
"+",
"mode",
"+",
"\"\\\" is already used by language \"",
"+",
"_modeT... | Adds a global mode-to-language association.
@param {!string} mode The mode to associate the language with
@param {!Language} language The language to associate with the mode | [
"Adds",
"a",
"global",
"mode",
"-",
"to",
"-",
"language",
"association",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/LanguageManager.js#L225-L233 | train | Sets the language for a mode | [
30522,
3853,
1035,
2275,
25023,
6692,
3351,
14192,
10244,
1006,
5549,
1010,
2653,
1007,
1063,
2065,
1006,
1035,
5549,
3406,
30524,
2109,
2011,
2653,
1000,
1009,
1035,
5549,
3406,
25023,
6692,
3351,
2863,
2361,
1031,
5549,
1033,
1012,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/NavigationAndHistory/NavigationProvider.js | _backupLiveMarkers | function _backupLiveMarkers(frames, editor) {
var index, frame;
for (index in frames) {
frame = frames[index];
if (frame.cm === editor._codeMirror) {
frame._handleEditorDestroy();
}
}
} | javascript | function _backupLiveMarkers(frames, editor) {
var index, frame;
for (index in frames) {
frame = frames[index];
if (frame.cm === editor._codeMirror) {
frame._handleEditorDestroy();
}
}
} | [
"function",
"_backupLiveMarkers",
"(",
"frames",
",",
"editor",
")",
"{",
"var",
"index",
",",
"frame",
";",
"for",
"(",
"index",
"in",
"frames",
")",
"{",
"frame",
"=",
"frames",
"[",
"index",
"]",
";",
"if",
"(",
"frame",
".",
"cm",
"===",
"editor"... | Create snapshot of last known live markers.
@private | [
"Create",
"snapshot",
"of",
"last",
"known",
"live",
"markers",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/NavigationAndHistory/NavigationProvider.js#L448-L456 | train | Backup live markers | [
30522,
3853,
1035,
10200,
3669,
3726,
10665,
2545,
1006,
11048,
1010,
3559,
1007,
1063,
13075,
5950,
1010,
4853,
1025,
2005,
1006,
5950,
1999,
11048,
1007,
1063,
4853,
1027,
11048,
1031,
5950,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/gesture/gesture.js | updatePointerState | function updatePointerState(ev, pointer) {
var point = getEventPoint(ev);
var x = pointer.x = point.pageX;
var y = pointer.y = point.pageY;
pointer.distanceX = x - pointer.startX;
pointer.distanceY = y - pointer.startY;
pointer.distance = Math.sqrt(
pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY
);
pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : '';
pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : '';
pointer.duration = +Date.now() - pointer.startTime;
pointer.velocityX = pointer.distanceX / pointer.duration;
pointer.velocityY = pointer.distanceY / pointer.duration;
} | javascript | function updatePointerState(ev, pointer) {
var point = getEventPoint(ev);
var x = pointer.x = point.pageX;
var y = pointer.y = point.pageY;
pointer.distanceX = x - pointer.startX;
pointer.distanceY = y - pointer.startY;
pointer.distance = Math.sqrt(
pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY
);
pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : '';
pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : '';
pointer.duration = +Date.now() - pointer.startTime;
pointer.velocityX = pointer.distanceX / pointer.duration;
pointer.velocityY = pointer.distanceY / pointer.duration;
} | [
"function",
"updatePointerState",
"(",
"ev",
",",
"pointer",
")",
"{",
"var",
"point",
"=",
"getEventPoint",
"(",
"ev",
")",
";",
"var",
"x",
"=",
"pointer",
".",
"x",
"=",
"point",
".",
"pageX",
";",
"var",
"y",
"=",
"pointer",
".",
"y",
"=",
"poi... | /*
Update the given pointer based upon the given DOMEvent.
Distance, velocity, direction, duration, etc | [
"/",
"*",
"Update",
"the",
"given",
"pointer",
"based",
"upon",
"the",
"given",
"DOMEvent",
".",
"Distance",
"velocity",
"direction",
"duration",
"etc"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L751-L768 | train | Update the pointer state based on the event | [
30522,
3853,
10651,
8400,
2545,
12259,
1006,
23408,
1010,
20884,
1007,
1063,
13075,
2391,
1027,
2131,
18697,
3372,
8400,
1006,
23408,
1007,
1025,
13075,
1060,
1027,
20884,
1012,
1060,
1027,
2391,
1012,
3931,
2595,
1025,
13075,
30524,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | _parseCell | function _parseCell(cell, rowIndex, colIndex) {
const $cell = $(cell);
const colspan = $cell.attr('colspan');
const rowspan = $cell.attr('rowspan');
const {nodeName} = cell;
if (nodeName !== 'TH' && nodeName !== 'TD') {
return null;
}
const cellData = {
nodeName: cell.nodeName,
colspan: colspan ? parseInt(colspan, 10) : 1,
rowspan: rowspan ? parseInt(rowspan, 10) : 1,
content: $cell.html(),
elementIndex: {
rowIndex,
colIndex
}
};
if (cell.nodeName === 'TH' && cell.align) {
cellData.align = cell.align;
}
return cellData;
} | javascript | function _parseCell(cell, rowIndex, colIndex) {
const $cell = $(cell);
const colspan = $cell.attr('colspan');
const rowspan = $cell.attr('rowspan');
const {nodeName} = cell;
if (nodeName !== 'TH' && nodeName !== 'TD') {
return null;
}
const cellData = {
nodeName: cell.nodeName,
colspan: colspan ? parseInt(colspan, 10) : 1,
rowspan: rowspan ? parseInt(rowspan, 10) : 1,
content: $cell.html(),
elementIndex: {
rowIndex,
colIndex
}
};
if (cell.nodeName === 'TH' && cell.align) {
cellData.align = cell.align;
}
return cellData;
} | [
"function",
"_parseCell",
"(",
"cell",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"$cell",
"=",
"$",
"(",
"cell",
")",
";",
"const",
"colspan",
"=",
"$cell",
".",
"attr",
"(",
"'colspan'",
")",
";",
"const",
"rowspan",
"=",
"$cell",
".",
"a... | Parse cell like td or th.
@param {HTMLElement} cell - cell element like td or th
@param {number} rowIndex - row index
@param {number} colIndex - column index
@returns {{
nodeName: string,
colspan: number,
rowspan: number,
content: string,
align: ?string
}}
@private | [
"Parse",
"cell",
"like",
"td",
"or",
"th",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L22-L48 | train | Parse cell data | [
30522,
3853,
1035,
11968,
3366,
29109,
2140,
1006,
3526,
1010,
5216,
22254,
10288,
1010,
6972,
3207,
2595,
1007,
1063,
9530,
3367,
1002,
3526,
1027,
1002,
1006,
3526,
1007,
1025,
9530,
3367,
8902,
13102,
2319,
1027,
1002,
3526,
1012,
2012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/output/ebook/onFinish.js | runEbookConvert | function runEbookConvert(output) {
var logger = output.getLogger();
var options = output.getOptions();
var format = options.get('format');
var outputFolder = output.getRoot();
if (!format) {
return Promise(output);
}
return getConvertOptions(output)
.then(function(options) {
var cmd = [
'ebook-convert',
path.resolve(outputFolder, SUMMARY_FILE),
path.resolve(outputFolder, 'index.' + format),
command.optionsToShellArgs(options)
].join(' ');
return command.exec(cmd)
.progress(function(data) {
logger.debug(data);
})
.fail(function(err) {
if (err.code == 127) {
throw error.RequireInstallError({
cmd: 'ebook-convert',
install: 'Install it from Calibre: https://calibre-ebook.com'
});
}
throw error.EbookError(err);
});
})
.thenResolve(output);
} | javascript | function runEbookConvert(output) {
var logger = output.getLogger();
var options = output.getOptions();
var format = options.get('format');
var outputFolder = output.getRoot();
if (!format) {
return Promise(output);
}
return getConvertOptions(output)
.then(function(options) {
var cmd = [
'ebook-convert',
path.resolve(outputFolder, SUMMARY_FILE),
path.resolve(outputFolder, 'index.' + format),
command.optionsToShellArgs(options)
].join(' ');
return command.exec(cmd)
.progress(function(data) {
logger.debug(data);
})
.fail(function(err) {
if (err.code == 127) {
throw error.RequireInstallError({
cmd: 'ebook-convert',
install: 'Install it from Calibre: https://calibre-ebook.com'
});
}
throw error.EbookError(err);
});
})
.thenResolve(output);
} | [
"function",
"runEbookConvert",
"(",
"output",
")",
"{",
"var",
"logger",
"=",
"output",
".",
"getLogger",
"(",
")",
";",
"var",
"options",
"=",
"output",
".",
"getOptions",
"(",
")",
";",
"var",
"format",
"=",
"options",
".",
"get",
"(",
"'format'",
")... | Generate the ebook file as "index.pdf"
@param {Output}
@return {Output} | [
"Generate",
"the",
"ebook",
"file",
"as",
"index",
".",
"pdf"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/ebook/onFinish.js#L43-L78 | train | Runs ebook - convert | [
30522,
3853,
23276,
30524,
1025,
13075,
6434,
10371,
2121,
1027,
6434,
1012,
2131,
3217,
4140,
1006,
1007,
1025,
2065,
1006,
999,
4289,
1007,
1063,
2709,
4872,
1006,
6434,
1007,
1025,
1065,
2709,
2131,
8663,
16874,
7361,
9285,
1006,
6434,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/api/encodeSummary.js | function (iter) {
summary.getArticle(function(article) {
var jsonArticle = encodeSummaryArticle(article, false);
return iter(jsonArticle);
});
} | javascript | function (iter) {
summary.getArticle(function(article) {
var jsonArticle = encodeSummaryArticle(article, false);
return iter(jsonArticle);
});
} | [
"function",
"(",
"iter",
")",
"{",
"summary",
".",
"getArticle",
"(",
"function",
"(",
"article",
")",
"{",
"var",
"jsonArticle",
"=",
"encodeSummaryArticle",
"(",
"article",
",",
"false",
")",
";",
"return",
"iter",
"(",
"jsonArticle",
")",
";",
"}",
")... | Iterate over the summary, it stops when the "iter" returns false
@param {Function} iter | [
"Iterate",
"over",
"the",
"summary",
"it",
"stops",
"when",
"the",
"iter",
"returns",
"false"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeSummary.js#L17-L23 | train | iter is a function that returns an array of objects | [
30522,
3853,
1006,
2009,
2121,
1007,
1063,
12654,
1012,
2131,
8445,
25128,
1006,
3853,
1006,
3720,
1007,
1063,
13075,
1046,
3385,
8445,
25128,
1027,
4372,
23237,
2819,
7849,
13380,
4588,
2571,
1006,
3720,
1010,
6270,
1007,
1025,
2709,
2009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/project/FileTreeView.js | _getName | function _getName(fullname, extension) {
return extension !== "" ? fullname.substring(0, fullname.length - extension.length - 1) : fullname;
} | javascript | function _getName(fullname, extension) {
return extension !== "" ? fullname.substring(0, fullname.length - extension.length - 1) : fullname;
} | [
"function",
"_getName",
"(",
"fullname",
",",
"extension",
")",
"{",
"return",
"extension",
"!==",
"\"\"",
"?",
"fullname",
".",
"substring",
"(",
"0",
",",
"fullname",
".",
"length",
"-",
"extension",
".",
"length",
"-",
"1",
")",
":",
"fullname",
";",
... | @private
Returns the name of a file without its extension.
@param {string} fullname The complete name of the file (not including the rest of the path)
@param {string} extension The file extension
@return {string} The fullname without the extension | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeView.js#L82-L84 | train | Get the name of the file | [
30522,
3853,
1035,
2131,
18442,
1006,
2440,
18442,
1010,
5331,
1007,
1063,
2709,
5331,
999,
1027,
1027,
1000,
1000,
1029,
2440,
18442,
1012,
4942,
3367,
4892,
1006,
1014,
1010,
2440,
18442,
1012,
3091,
1011,
5331,
1012,
3091,
1011,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ccxt/ccxt | build/transpile.js | copyFile | function copyFile (oldName, newName) {
let contents = fs.readFileSync (oldName, 'utf8')
fs.truncateSync (newName)
fs.writeFileSync (newName, contents)
} | javascript | function copyFile (oldName, newName) {
let contents = fs.readFileSync (oldName, 'utf8')
fs.truncateSync (newName)
fs.writeFileSync (newName, contents)
} | [
"function",
"copyFile",
"(",
"oldName",
",",
"newName",
")",
"{",
"let",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"oldName",
",",
"'utf8'",
")",
"fs",
".",
"truncateSync",
"(",
"newName",
")",
"fs",
".",
"writeFileSync",
"(",
"newName",
",",
"con... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 8168069b9180a465532905e225586215e115a565 | https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/transpile.js#L750-L754 | train | Copy a file from another file to another file | [
30522,
3853,
6100,
8873,
2571,
1006,
2214,
18442,
1010,
2047,
18442,
1007,
1063,
2292,
8417,
1027,
1042,
2015,
1012,
30524,
4609,
16280,
6508,
12273,
1006,
2047,
18442,
1007,
1042,
2015,
1012,
4339,
8873,
4244,
6038,
2278,
1006,
2047,
18442... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | extras/noUiSlider/nouislider.js | eventEnd | function eventEnd ( event, data ) {
// The handle is no longer active, so remove the class.
if ( scope_ActiveHandle ) {
removeClass(scope_ActiveHandle, options.cssClasses.active);
scope_ActiveHandle = false;
}
// Remove cursor styles and text-selection events bound to the body.
if ( event.cursor ) {
document.body.style.cursor = '';
document.body.removeEventListener('selectstart', document.body.noUiListener);
}
// Unbind the move and end events, which are added on 'start'.
document.documentElement.noUiListeners.forEach(function( c ) {
document.documentElement.removeEventListener(c[0], c[1]);
});
// Remove dragging class.
removeClass(scope_Target, options.cssClasses.drag);
setZindex();
data.handleNumbers.forEach(function(handleNumber){
fireEvent('set', handleNumber);
fireEvent('change', handleNumber);
fireEvent('end', handleNumber);
});
} | javascript | function eventEnd ( event, data ) {
// The handle is no longer active, so remove the class.
if ( scope_ActiveHandle ) {
removeClass(scope_ActiveHandle, options.cssClasses.active);
scope_ActiveHandle = false;
}
// Remove cursor styles and text-selection events bound to the body.
if ( event.cursor ) {
document.body.style.cursor = '';
document.body.removeEventListener('selectstart', document.body.noUiListener);
}
// Unbind the move and end events, which are added on 'start'.
document.documentElement.noUiListeners.forEach(function( c ) {
document.documentElement.removeEventListener(c[0], c[1]);
});
// Remove dragging class.
removeClass(scope_Target, options.cssClasses.drag);
setZindex();
data.handleNumbers.forEach(function(handleNumber){
fireEvent('set', handleNumber);
fireEvent('change', handleNumber);
fireEvent('end', handleNumber);
});
} | [
"function",
"eventEnd",
"(",
"event",
",",
"data",
")",
"{",
"// The handle is no longer active, so remove the class.",
"if",
"(",
"scope_ActiveHandle",
")",
"{",
"removeClass",
"(",
"scope_ActiveHandle",
",",
"options",
".",
"cssClasses",
".",
"active",
")",
";",
"... | Unbind move events on document, call callbacks. | [
"Unbind",
"move",
"events",
"on",
"document",
"call",
"callbacks",
"."
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L1505-L1534 | train | End event handler for the handle | [
30522,
3853,
2724,
10497,
1006,
2724,
1010,
2951,
1007,
1063,
1013,
1013,
1996,
5047,
2003,
2053,
2936,
3161,
1010,
2061,
6366,
1996,
2465,
1012,
2065,
1006,
9531,
1035,
3161,
11774,
2571,
1007,
1063,
6366,
26266,
1006,
9531,
1035,
3161,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js | function (oView) {
var oController = oView.getController();
// Add the sub view to the current one
this._oContainerPage.addContent(oView);
this._oContainerPage.setBusy(false);
// Init the sub view and controller with the needed references.The view's are nested and work in a
// mimic way so they need to share some references.
oController.initiate({
sTopicId: this._sTopicid,
oModel: this._oModel,
aApiIndex: this._aApiIndex,
aAllowedMembers: this._aAllowedMembers,
oEntityData: this._oEntityData,
sEntityType: this._sEntityType,
sEntityId: this._sEntityId,
oOwnerComponent: this.getOwnerComponent(),
oContainerView: this.getView(),
oContainerController: this
});
} | javascript | function (oView) {
var oController = oView.getController();
// Add the sub view to the current one
this._oContainerPage.addContent(oView);
this._oContainerPage.setBusy(false);
// Init the sub view and controller with the needed references.The view's are nested and work in a
// mimic way so they need to share some references.
oController.initiate({
sTopicId: this._sTopicid,
oModel: this._oModel,
aApiIndex: this._aApiIndex,
aAllowedMembers: this._aAllowedMembers,
oEntityData: this._oEntityData,
sEntityType: this._sEntityType,
sEntityId: this._sEntityId,
oOwnerComponent: this.getOwnerComponent(),
oContainerView: this.getView(),
oContainerController: this
});
} | [
"function",
"(",
"oView",
")",
"{",
"var",
"oController",
"=",
"oView",
".",
"getController",
"(",
")",
";",
"// Add the sub view to the current one",
"this",
".",
"_oContainerPage",
".",
"addContent",
"(",
"oView",
")",
";",
"this",
".",
"_oContainerPage",
".",... | Init the Sub View and controller
@param {sap.ui.view} oView the pre-processed sub view
@private | [
"Init",
"the",
"Sub",
"View",
"and",
"controller"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L100-L121 | train | Adds the sub view to the container page | [
30522,
3853,
1006,
1051,
8584,
1007,
1063,
13075,
1051,
8663,
13181,
10820,
1027,
1051,
8584,
1012,
2131,
8663,
13181,
10820,
1006,
1007,
1025,
1013,
1013,
5587,
1996,
4942,
3193,
2000,
1996,
2783,
2028,
2023,
1012,
1035,
1051,
8663,
18249,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
transloadit/uppy | packages/@uppy/companion/src/server/helpers/utils.js | createSecret | function createSecret (secret) {
const hash = crypto.createHash('sha256')
hash.update(secret)
return hash.digest()
} | javascript | function createSecret (secret) {
const hash = crypto.createHash('sha256')
hash.update(secret)
return hash.digest()
} | [
"function",
"createSecret",
"(",
"secret",
")",
"{",
"const",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'sha256'",
")",
"hash",
".",
"update",
"(",
"secret",
")",
"return",
"hash",
".",
"digest",
"(",
")",
"}"
] | Ensure that a user-provided `secret` is 32 bytes long (the length required
for an AES256 key) by hashing it with SHA256.
@param {string|Buffer} secret | [
"Ensure",
"that",
"a",
"user",
"-",
"provided",
"secret",
"is",
"32",
"bytes",
"long",
"(",
"the",
"length",
"required",
"for",
"an",
"AES256",
"key",
")",
"by",
"hashing",
"it",
"with",
"SHA256",
"."
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/companion/src/server/helpers/utils.js#L110-L114 | train | Creates a secret | [
30522,
3853,
9005,
8586,
13465,
1006,
3595,
1007,
1063,
9530,
3367,
23325,
1027,
19888,
2080,
1012,
3443,
14949,
2232,
1006,
1005,
21146,
17788,
2575,
1005,
1007,
23325,
1012,
10651,
1006,
3595,
1007,
2709,
23325,
1012,
17886,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/core/shader.js | function (data) {
this.attributes = this.initVariables(data, 'attribute');
this.uniforms = this.initVariables(data, 'uniform');
this.material = new (this.raw ? THREE.RawShaderMaterial : THREE.ShaderMaterial)({
// attributes: this.attributes,
uniforms: this.uniforms,
vertexShader: this.vertexShader,
fragmentShader: this.fragmentShader
});
return this.material;
} | javascript | function (data) {
this.attributes = this.initVariables(data, 'attribute');
this.uniforms = this.initVariables(data, 'uniform');
this.material = new (this.raw ? THREE.RawShaderMaterial : THREE.ShaderMaterial)({
// attributes: this.attributes,
uniforms: this.uniforms,
vertexShader: this.vertexShader,
fragmentShader: this.fragmentShader
});
return this.material;
} | [
"function",
"(",
"data",
")",
"{",
"this",
".",
"attributes",
"=",
"this",
".",
"initVariables",
"(",
"data",
",",
"'attribute'",
")",
";",
"this",
".",
"uniforms",
"=",
"this",
".",
"initVariables",
"(",
"data",
",",
"'uniform'",
")",
";",
"this",
"."... | Init handler. Similar to attachedCallback.
Called during shader initialization and is only run once. | [
"Init",
"handler",
".",
"Similar",
"to",
"attachedCallback",
".",
"Called",
"during",
"shader",
"initialization",
"and",
"is",
"only",
"run",
"once",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/shader.js#L52-L62 | train | Initialize the shader material | [
30522,
3853,
1006,
2951,
1007,
1063,
2023,
1012,
12332,
1027,
2023,
1012,
1999,
4183,
10755,
19210,
2015,
1006,
2951,
1010,
1005,
17961,
1005,
1007,
1025,
2023,
1012,
11408,
1027,
2023,
1012,
1999,
4183,
10755,
19210,
2015,
1006,
2951,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | deliver | function deliver(curr, state, name, value) {
if (curr.state === STATE_PENDING) {
curr.state = state;
/* [Promises/A+ 2.1.2.1, 2.1.3.1] */
curr[name] = value;
/* [Promises/A+ 2.1.2.2, 2.1.3.2] */
execute(curr);
}
return curr;
} | javascript | function deliver(curr, state, name, value) {
if (curr.state === STATE_PENDING) {
curr.state = state;
/* [Promises/A+ 2.1.2.1, 2.1.3.1] */
curr[name] = value;
/* [Promises/A+ 2.1.2.2, 2.1.3.2] */
execute(curr);
}
return curr;
} | [
"function",
"deliver",
"(",
"curr",
",",
"state",
",",
"name",
",",
"value",
")",
"{",
"if",
"(",
"curr",
".",
"state",
"===",
"STATE_PENDING",
")",
"{",
"curr",
".",
"state",
"=",
"state",
";",
"/* [Promises/A+ 2.1.2.1, 2.1.3.1] */",
"curr",
"[",
"name"... | /* deliver an action | [
"/",
"*",
"deliver",
"an",
"action"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L5292-L5304 | train | Deliver a new value to the next node in the chain | [
30522,
3853,
8116,
1006,
12731,
12171,
1010,
2110,
1010,
2171,
1010,
3643,
1007,
1063,
2065,
1006,
12731,
12171,
1012,
2110,
1027,
1027,
1027,
2110,
1035,
14223,
1007,
1063,
12731,
12171,
1012,
2110,
1027,
2110,
1025,
1013,
1008,
1031,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
elastic/elasticsearch-js | api/api/msearch.js | buildMsearch | function buildMsearch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request
*
* @param {list} index - A comma-separated list of index names to use as default
* @param {list} type - A comma-separated list of document types to use as default
* @param {enum} search_type - Search operation type
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
* @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
* @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
* @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response
* @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
* @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines
*/
const acceptedQuerystring = [
'search_type',
'max_concurrent_searches',
'typed_keys',
'pre_filter_shard_size',
'max_concurrent_shard_requests',
'rest_total_hits_as_int',
'ccs_minimize_roundtrips',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
searchType: 'search_type',
maxConcurrentSearches: 'max_concurrent_searches',
typedKeys: 'typed_keys',
preFilterShardSize: 'pre_filter_shard_size',
maxConcurrentShardRequests: 'max_concurrent_shard_requests',
restTotalHitsAsInt: 'rest_total_hits_as_int',
ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function msearch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
} else {
path = '/' + '_msearch'
}
// build request object
const request = {
method,
path,
bulkBody: body,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | javascript | function buildMsearch (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request
*
* @param {list} index - A comma-separated list of index names to use as default
* @param {list} type - A comma-separated list of document types to use as default
* @param {enum} search_type - Search operation type
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
* @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
* @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
* @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response
* @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
* @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines
*/
const acceptedQuerystring = [
'search_type',
'max_concurrent_searches',
'typed_keys',
'pre_filter_shard_size',
'max_concurrent_shard_requests',
'rest_total_hits_as_int',
'ccs_minimize_roundtrips',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
searchType: 'search_type',
maxConcurrentSearches: 'max_concurrent_searches',
typedKeys: 'typed_keys',
preFilterShardSize: 'pre_filter_shard_size',
maxConcurrentShardRequests: 'max_concurrent_shard_requests',
restTotalHitsAsInt: 'rest_total_hits_as_int',
ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function msearch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
return handleError(err, callback)
}
// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
} else {
path = '/' + '_msearch'
}
// build request object
const request = {
method,
path,
bulkBody: body,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
} | [
"function",
"buildMsearch",
"(",
"opts",
")",
"{",
"// eslint-disable-next-line no-unused-vars",
"const",
"{",
"makeRequest",
",",
"ConfigurationError",
",",
"handleError",
",",
"snakeCaseKeys",
"}",
"=",
"opts",
"/**\n * Perform a [msearch](http://www.elastic.co/guide/en/ela... | /* eslint camelcase: 0 /* eslint no-unused-vars: 0 | [
"/",
"*",
"eslint",
"camelcase",
":",
"0",
"/",
"*",
"eslint",
"no",
"-",
"unused",
"-",
"vars",
":",
"0"
] | 4fc4699a4d4474d7887bc7757e0269218a859294 | https://github.com/elastic/elasticsearch-js/blob/4fc4699a4d4474d7887bc7757e0269218a859294/api/api/msearch.js#L25-L134 | train | Build a multi - search request | [
30522,
3853,
3857,
5244,
14644,
2818,
1006,
23569,
2015,
1007,
1063,
1013,
1013,
9686,
4115,
2102,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
2053,
1011,
15171,
1011,
13075,
2015,
9530,
3367,
1063,
9338,
2063,
15500,
1010,
9563,
2121,
29165... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(element) {
if (element.setActive) {
// Following line could cause a js error when the textarea is invisible
// See https://github.com/xing/wysihtml5/issues/9
try { element.setActive(); } catch(e) {}
} else {
var elementStyle = element.style,
originalScrollTop = doc.documentElement.scrollTop || doc.body.scrollTop,
originalScrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft,
originalStyles = {
position: elementStyle.position,
top: elementStyle.top,
left: elementStyle.left,
WebkitUserSelect: elementStyle.WebkitUserSelect
};
dom.setStyles({
position: "absolute",
top: "-99999px",
left: "-99999px",
// Don't ask why but temporarily setting -webkit-user-select to none makes the whole thing performing smoother
WebkitUserSelect: "none"
}).on(element);
element.focus();
dom.setStyles(originalStyles).on(element);
if (win.scrollTo) {
// Some browser extensions unset this method to prevent annoyances
// "Better PopUp Blocker" for Chrome http://code.google.com/p/betterpopupblocker/source/browse/trunk/blockStart.js#100
// Issue: http://code.google.com/p/betterpopupblocker/issues/detail?id=1
win.scrollTo(originalScrollLeft, originalScrollTop);
}
}
} | javascript | function(element) {
if (element.setActive) {
// Following line could cause a js error when the textarea is invisible
// See https://github.com/xing/wysihtml5/issues/9
try { element.setActive(); } catch(e) {}
} else {
var elementStyle = element.style,
originalScrollTop = doc.documentElement.scrollTop || doc.body.scrollTop,
originalScrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft,
originalStyles = {
position: elementStyle.position,
top: elementStyle.top,
left: elementStyle.left,
WebkitUserSelect: elementStyle.WebkitUserSelect
};
dom.setStyles({
position: "absolute",
top: "-99999px",
left: "-99999px",
// Don't ask why but temporarily setting -webkit-user-select to none makes the whole thing performing smoother
WebkitUserSelect: "none"
}).on(element);
element.focus();
dom.setStyles(originalStyles).on(element);
if (win.scrollTo) {
// Some browser extensions unset this method to prevent annoyances
// "Better PopUp Blocker" for Chrome http://code.google.com/p/betterpopupblocker/source/browse/trunk/blockStart.js#100
// Issue: http://code.google.com/p/betterpopupblocker/issues/detail?id=1
win.scrollTo(originalScrollLeft, originalScrollTop);
}
}
} | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"setActive",
")",
"{",
"// Following line could cause a js error when the textarea is invisible",
"// See https://github.com/xing/wysihtml5/issues/9",
"try",
"{",
"element",
".",
"setActive",
"(",
")",
";",
... | With "setActive" IE offers a smart way of focusing elements without scrolling them into view:
http://msdn.microsoft.com/en-us/library/ms536738(v=vs.85).aspx
Other browsers need a more hacky way: (pssst don't tell my mama)
In order to prevent the element being scrolled into view when focusing it, we simply
move it out of the scrollable area, focus it, and reset it's position | [
"With",
"setActive",
"IE",
"offers",
"a",
"smart",
"way",
"of",
"focusing",
"elements",
"without",
"scrolling",
"them",
"into",
"view",
":",
"http",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"ms536738",
... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L12543-L12578 | train | Set the active state of the element | [
30522,
3853,
1006,
5783,
1007,
1063,
2065,
1006,
5783,
1012,
2275,
19620,
1007,
1063,
1013,
1013,
2206,
2240,
2071,
3426,
1037,
1046,
2015,
7561,
2043,
1996,
3793,
12069,
2050,
2003,
8841,
1013,
1013,
30524,
1012,
2275,
19620,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/dialog/dialog.js | walkDOM | function walkDOM(element) {
var elements = getParents(element);
for (var i = 0; i < elements.length; i++) {
elements[i].setAttribute('aria-hidden', isHidden);
}
} | javascript | function walkDOM(element) {
var elements = getParents(element);
for (var i = 0; i < elements.length; i++) {
elements[i].setAttribute('aria-hidden', isHidden);
}
} | [
"function",
"walkDOM",
"(",
"element",
")",
"{",
"var",
"elements",
"=",
"getParents",
"(",
"element",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"elements",
"[",
"i",
"]",
".",... | Walk DOM to apply or remove aria-hidden on sibling nodes
and parent sibling nodes | [
"Walk",
"DOM",
"to",
"apply",
"or",
"remove",
"aria",
"-",
"hidden",
"on",
"sibling",
"nodes",
"and",
"parent",
"sibling",
"nodes"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1184-L1189 | train | Walk DOM tree to find all parent elements | [
30522,
3853,
3328,
9527,
1006,
5783,
1007,
1063,
13075,
3787,
1027,
2131,
19362,
11187,
1006,
5783,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
3787,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
3787,
1031,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/reporters/dot.js | Dot | function Dot(runner, options) {
Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;
var n = -1;
runner.on(EVENT_RUN_BEGIN, function() {
process.stdout.write('\n');
});
runner.on(EVENT_TEST_PENDING, function() {
if (++n % width === 0) {
process.stdout.write('\n ');
}
process.stdout.write(Base.color('pending', Base.symbols.comma));
});
runner.on(EVENT_TEST_PASS, function(test) {
if (++n % width === 0) {
process.stdout.write('\n ');
}
if (test.speed === 'slow') {
process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
} else {
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
}
});
runner.on(EVENT_TEST_FAIL, function() {
if (++n % width === 0) {
process.stdout.write('\n ');
}
process.stdout.write(Base.color('fail', Base.symbols.bang));
});
runner.once(EVENT_RUN_END, function() {
console.log();
self.epilogue();
});
} | javascript | function Dot(runner, options) {
Base.call(this, runner, options);
var self = this;
var width = (Base.window.width * 0.75) | 0;
var n = -1;
runner.on(EVENT_RUN_BEGIN, function() {
process.stdout.write('\n');
});
runner.on(EVENT_TEST_PENDING, function() {
if (++n % width === 0) {
process.stdout.write('\n ');
}
process.stdout.write(Base.color('pending', Base.symbols.comma));
});
runner.on(EVENT_TEST_PASS, function(test) {
if (++n % width === 0) {
process.stdout.write('\n ');
}
if (test.speed === 'slow') {
process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
} else {
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
}
});
runner.on(EVENT_TEST_FAIL, function() {
if (++n % width === 0) {
process.stdout.write('\n ');
}
process.stdout.write(Base.color('fail', Base.symbols.bang));
});
runner.once(EVENT_RUN_END, function() {
console.log();
self.epilogue();
});
} | [
"function",
"Dot",
"(",
"runner",
",",
"options",
")",
"{",
"Base",
".",
"call",
"(",
"this",
",",
"runner",
",",
"options",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"width",
"=",
"(",
"Base",
".",
"window",
".",
"width",
"*",
"0.75",
")... | Constructs a new `Dot` reporter instance.
@public
@class
@memberof Mocha.reporters
@extends Mocha.reporters.Base
@param {Runner} runner - Instance triggers reporter actions.
@param {Object} [options] - runner options | [
"Constructs",
"a",
"new",
"Dot",
"reporter",
"instance",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/dot.js#L34-L74 | train | Dot test suite. | [
30522,
3853,
11089,
1006,
5479,
1010,
7047,
1007,
1063,
2918,
1012,
2655,
1006,
2023,
1010,
5479,
1010,
7047,
1007,
1025,
13075,
2969,
1027,
2023,
1025,
13075,
9381,
1027,
1006,
2918,
1012,
3332,
1012,
9381,
1008,
1014,
1012,
4293,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/ViewCommandHandlers.js | restoreFontSize | function restoreFontSize() {
var fsStyle = prefs.get("fontSize"),
fsAdjustment = PreferencesManager.getViewState("fontSizeAdjustment");
if (fsAdjustment) {
// Always remove the old view state even if we also have the new view state.
PreferencesManager.setViewState("fontSizeAdjustment");
if (!fsStyle) {
// Migrate the old view state to the new one.
fsStyle = (DEFAULT_FONT_SIZE + fsAdjustment) + "px";
prefs.set("fontSize", fsStyle);
}
}
if (fsStyle) {
_removeDynamicFontSize();
_addDynamicFontSize(fsStyle);
}
} | javascript | function restoreFontSize() {
var fsStyle = prefs.get("fontSize"),
fsAdjustment = PreferencesManager.getViewState("fontSizeAdjustment");
if (fsAdjustment) {
// Always remove the old view state even if we also have the new view state.
PreferencesManager.setViewState("fontSizeAdjustment");
if (!fsStyle) {
// Migrate the old view state to the new one.
fsStyle = (DEFAULT_FONT_SIZE + fsAdjustment) + "px";
prefs.set("fontSize", fsStyle);
}
}
if (fsStyle) {
_removeDynamicFontSize();
_addDynamicFontSize(fsStyle);
}
} | [
"function",
"restoreFontSize",
"(",
")",
"{",
"var",
"fsStyle",
"=",
"prefs",
".",
"get",
"(",
"\"fontSize\"",
")",
",",
"fsAdjustment",
"=",
"PreferencesManager",
".",
"getViewState",
"(",
"\"fontSizeAdjustment\"",
")",
";",
"if",
"(",
"fsAdjustment",
")",
"{... | Restores the font size using the saved style and migrates the old fontSizeAdjustment
view state to the new fontSize, when required | [
"Restores",
"the",
"font",
"size",
"using",
"the",
"saved",
"style",
"and",
"migrates",
"the",
"old",
"fontSizeAdjustment",
"view",
"state",
"to",
"the",
"new",
"fontSize",
"when",
"required"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ViewCommandHandlers.js#L405-L424 | train | Restore font size | [
30522,
3853,
9239,
14876,
7666,
4697,
1006,
1007,
1063,
13075,
1042,
4757,
27983,
1027,
3653,
10343,
1012,
2131,
1006,
1000,
15489,
5332,
4371,
1000,
1007,
1010,
1042,
3736,
2094,
29427,
3672,
1027,
18394,
24805,
4590,
1012,
2131,
8584,
915... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/AnnotationHelper.js | function (vRawValue, oDetails) {
var aMatches,
oModel = oDetails.context.getModel(),
sPath = oDetails.context.getPath();
function getExpression(sPrefix) {
if (sPath.slice(-1) === "/") {
// cut off trailing slash, happens with computed annotations
sPath = sPath.slice(0, -1);
}
return Expression.getExpression({
asExpression : false,
complexBinding : true,
model : oModel,
path : sPath,
prefix : sPrefix, // prefix for computing paths
value : vRawValue,
// ensure that type information is available in sub paths of the
// expression even if for that sub path no complex binding is needed,
// e.g. see sap.ui.model.odata.v4_AnnotationHelperExpression.operator
$$valueAsPromise : true
});
}
aMatches = rUnsupportedPathSegments.exec(sPath);
if (aMatches) {
throw new Error("Unsupported path segment " + aMatches[0] + " in " + sPath);
}
// aMatches[0] - sPath, e.g. "/Equipments/@UI.LineItem/4/Value/$Path@Common.Label"
// aMatches[1] - prefix of sPath including $Path or $AnnotationPath, e.g.
// "/Equipments/@UI.LineItem/4/Value/$Path"
// aMatches[2] - "$AnnotationPath" or "$Path"
// aMatches[3] - optional "/" after "$AnnotationPath" or "$Path"
// aMatches[4] - rest of sPath, e.g. "@Common.Label"
aMatches = rSplitPathSegment.exec(sPath);
if (aMatches && sPath.length > aMatches[1].length) {
if (rSplitPathSegment.test(aMatches[4])) {
throw new Error("Only one $Path or $AnnotationPath segment is supported: "
+ sPath);
}
return oModel.fetchObject(aMatches[1]).then(function (sPathValue) {
var i,
bIsAnnotationPath = aMatches[2] === "$AnnotationPath",
sPrefix = bIsAnnotationPath
? sPathValue.split("@")[0]
: sPathValue;
if (!bIsAnnotationPath && aMatches[3]) {
sPrefix = sPrefix + "/";
}
if (!sPrefix.endsWith("/")) {
i = sPrefix.lastIndexOf("/");
sPrefix = i < 0 ? "" : sPrefix.slice(0, i + 1);
}
return getExpression(sPrefix);
});
}
return getExpression("");
} | javascript | function (vRawValue, oDetails) {
var aMatches,
oModel = oDetails.context.getModel(),
sPath = oDetails.context.getPath();
function getExpression(sPrefix) {
if (sPath.slice(-1) === "/") {
// cut off trailing slash, happens with computed annotations
sPath = sPath.slice(0, -1);
}
return Expression.getExpression({
asExpression : false,
complexBinding : true,
model : oModel,
path : sPath,
prefix : sPrefix, // prefix for computing paths
value : vRawValue,
// ensure that type information is available in sub paths of the
// expression even if for that sub path no complex binding is needed,
// e.g. see sap.ui.model.odata.v4_AnnotationHelperExpression.operator
$$valueAsPromise : true
});
}
aMatches = rUnsupportedPathSegments.exec(sPath);
if (aMatches) {
throw new Error("Unsupported path segment " + aMatches[0] + " in " + sPath);
}
// aMatches[0] - sPath, e.g. "/Equipments/@UI.LineItem/4/Value/$Path@Common.Label"
// aMatches[1] - prefix of sPath including $Path or $AnnotationPath, e.g.
// "/Equipments/@UI.LineItem/4/Value/$Path"
// aMatches[2] - "$AnnotationPath" or "$Path"
// aMatches[3] - optional "/" after "$AnnotationPath" or "$Path"
// aMatches[4] - rest of sPath, e.g. "@Common.Label"
aMatches = rSplitPathSegment.exec(sPath);
if (aMatches && sPath.length > aMatches[1].length) {
if (rSplitPathSegment.test(aMatches[4])) {
throw new Error("Only one $Path or $AnnotationPath segment is supported: "
+ sPath);
}
return oModel.fetchObject(aMatches[1]).then(function (sPathValue) {
var i,
bIsAnnotationPath = aMatches[2] === "$AnnotationPath",
sPrefix = bIsAnnotationPath
? sPathValue.split("@")[0]
: sPathValue;
if (!bIsAnnotationPath && aMatches[3]) {
sPrefix = sPrefix + "/";
}
if (!sPrefix.endsWith("/")) {
i = sPrefix.lastIndexOf("/");
sPrefix = i < 0 ? "" : sPrefix.slice(0, i + 1);
}
return getExpression(sPrefix);
});
}
return getExpression("");
} | [
"function",
"(",
"vRawValue",
",",
"oDetails",
")",
"{",
"var",
"aMatches",
",",
"oModel",
"=",
"oDetails",
".",
"context",
".",
"getModel",
"(",
")",
",",
"sPath",
"=",
"oDetails",
".",
"context",
".",
"getPath",
"(",
")",
";",
"function",
"getExpressio... | A function that helps to interpret OData V4 annotations. It knows about the following
expressions:
<ul>
<li>"14.4 Constant Expressions" for "edm:Bool", "edm:Date",
"edm:DateTimeOffset", "edm:Decimal", "edm:Float", "edm:Guid", "edm:Int",
"edm:TimeOfDay".
<li>constant "14.4.11 Expression edm:String": This is turned into a fixed
text (e.g. <code>"Width"</code>). String constants that contain a simple binding
<code>"{@i18n>...}"</code> to the hard-coded model name "@i18n" with arbitrary path
are not turned into a fixed text, but kept as a data binding expression; this
allows local annotation files to refer to a resource bundle for
internationalization.
<li>dynamic "14.5.1 Comparison and Logical Operators": These are turned into
expression bindings to perform the operations at runtime.
<li>dynamic "14.5.3 Expression edm:Apply":
<ul>
<li>"14.5.3.1.1 Function odata.concat": This is turned into a data binding
expression relative to an entity.
<li>"14.5.3.1.2 Function odata.fillUriTemplate": This is turned into an
expression binding to fill the template at runtime.
<li>"14.5.3.1.3 Function odata.uriEncode": This is turned into an expression
binding to encode the parameter at runtime.
<li>Apply functions may be nested arbitrarily.
</ul>
<li>dynamic "14.5.6 Expression edm:If": This is turned into an expression
binding to be evaluated at runtime. The expression is a conditional expression
like <code>"{=condition ? expression1 : expression2}"</code>.
<li>dynamic "14.5.10 Expression edm:Null": This is turned into a
<code>null</code> value. It is ignored in <code>odata.concat</code>.
<li>dynamic "14.5.12 Expression edm:Path" and "14.5.13 Expression
edm:PropertyPath": This is turned into a data binding relative to an entity,
including type information and constraints as available from metadata,
e.g. <code>"{path : 'Name', type : 'sap.ui.model.odata.type.String',
constraints : {'maxLength':'255'}}"</code>.
Depending on the used type, some additional constraints of this type are set:
<ul>
<li>Edm.DateTime: The "displayFormat" constraint is set to the value of the
"sap:display-format" annotation of the referenced property.
<li>Edm.Decimal: The "precision" and "scale" constraints are set to the values
of the corresponding attributes of the referenced property. The "minimum",
"maximum", "minimumExclusive" and "maximumExlusive" constraints are set to the
values of the corresponding "Org.OData.Validation.V1" annotation of the
referenced property; note that in this case only constant expressions are
supported to determine the annotation value.
<li>Edm.String: The "maxLength" constraint is set to the value of the
corresponding attribute of the referenced property, and the "isDigitSequence"
constraint is set to the value of the
"com.sap.vocabularies.Common.v1.IsDigitSequence" annotation of the referenced
property; note that in this case only constant expressions are supported to
determine the annotation value.
</ul>
</ul>
If <code>oDetails.context.getPath()</code> contains a single "$AnnotationPath" or
"$Path" segment, the value corresponding to that segment is considered as a data
binding path prefix whenever a dynamic "14.5.12 Expression edm:Path" or
"14.5.13 Expression edm:PropertyPath" is turned into a data binding. Use
{@link sap.ui.model.odata.v4.AnnotationHelper.resolve$Path} to avoid these prefixes
in cases where they are not applicable.
Unsupported or incorrect values are turned into a string nevertheless, but indicated
as such. Proper escaping is used to make sure that data binding syntax is not
corrupted. In such a case, an error describing the problem is logged to the console.
Example:
<pre>
<Text text="{meta>Value/@@sap.ui.model.odata.v4.AnnotationHelper.format}" />
</pre>
Example for "$Path" in the context's path:
<pre>
<Annotations Target="com.sap.gateway.default.iwbep.tea_busi.v0001.EQUIPMENT">
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="EQUIPMENT_2_PRODUCT/Name" />
</Record>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="com.sap.gateway.default.iwbep.tea_busi_product.v0001.Product/Name">
<Annotation Term="com.sap.vocabularies.Common.v1.QuickInfo" Path="PRODUCT_2_SUPPLIER/Supplier_Name" />
</Annotations>
</pre>
<pre>
<Text text="{meta>/Equipments/@com.sap.vocabularies.UI.v1.LineItem/0/Value/$Path@com.sap.vocabularies.Common.v1.QuickInfo@@sap.ui.model.odata.v4.AnnotationHelper.format}" />
</pre>
<code>format</code> returns a binding with path
"EQUIPMENT_2_PRODUCT/PRODUCT_2_SUPPLIER/Supplier_Name".
Example for "$AnnotationPath" in the context's path:
<pre>
<Annotations Target="com.sap.gateway.default.iwbep.tea_busi.v0001.EQUIPMENT">
<Annotation Term="com.sap.vocabularies.UI.v1.Facets">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.ReferenceFacet">
<PropertyValue Property="Target" AnnotationPath="EQUIPMENT_2_PRODUCT/@com.sap.vocabularies.Common.v1.QuickInfo" />
</Record>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="com.sap.gateway.default.iwbep.tea_busi_product.v0001.Product">
<Annotation Term="com.sap.vocabularies.Common.v1.QuickInfo" Path="Name" />
</Annotations>
</pre>
<pre>
<Text text="{meta>/Equipments/@com.sap.vocabularies.UI.v1.Facets/0/Target/$AnnotationPath/@@sap.ui.model.odata.v4.AnnotationHelper.format}" />
</pre>
<code>format</code> returns a binding with path "EQUIPMENT_2_PRODUCT/Name".
@param {any} vRawValue
The raw value from the meta model
@param {object} oDetails
The details object
@param {sap.ui.model.Context} oDetails.context
Points to the given raw value, that is
<code>oDetails.context.getProperty("") === vRawValue</code>
@returns {string|Promise}
A data binding, or a fixed text, or a sequence thereof, or a <code>Promise</code>
resolving with that string, for example if not all type information is already
available
@throws {Error}
If <code>oDetails.context.getPath()</code> contains a "$PropertyPath" or a
"$NavigationPropertyPath" segment, or if it contains more than one
"$AnnotationPath" or "$Path" segment
@public
@see sap.ui.model.odata.v4.AnnotationHelper.resolve$Path
@since 1.63.0 | [
"A",
"function",
"that",
"helps",
"to",
"interpret",
"OData",
"V4",
"annotations",
".",
"It",
"knows",
"about",
"the",
"following",
"expressions",
":",
"<ul",
">",
"<li",
">",
"14",
".",
"4",
"Constant",
"Expressions",
"for",
"edm",
":",
"Bool",
"edm",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/AnnotationHelper.js#L161-L221 | train | Returns the expression for the given value. | [
30522,
3853,
1006,
27830,
10376,
10175,
5657,
1010,
30524,
6123,
1012,
2131,
15069,
1006,
1007,
1025,
3853,
2131,
10288,
20110,
3258,
1006,
11867,
2890,
8873,
2595,
1007,
1063,
2065,
1006,
14690,
2232,
1012,
14704,
1006,
1011,
1015,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
wix/Detox | detox/src/utils/exec.js | _logExecOutput | function _logExecOutput(log, process) {
let stdout = process.stdout || '';
let stderr = process.stderr || '';
if (process.platform === 'win32') {
stdout = stdout.replace(/\r\n/g, '\n');
stderr = stderr.replace(/\r\n/g, '\n');
}
if (stdout) {
log.trace({ event: 'EXEC_SUCCESS', stdout: true }, stdout);
}
if (stderr) {
log.trace({ event: 'EXEC_SUCCESS', stderr: true }, stderr);
}
if (!stdout && !stderr) {
log.trace({ event: 'EXEC_SUCCESS' }, '');
}
} | javascript | function _logExecOutput(log, process) {
let stdout = process.stdout || '';
let stderr = process.stderr || '';
if (process.platform === 'win32') {
stdout = stdout.replace(/\r\n/g, '\n');
stderr = stderr.replace(/\r\n/g, '\n');
}
if (stdout) {
log.trace({ event: 'EXEC_SUCCESS', stdout: true }, stdout);
}
if (stderr) {
log.trace({ event: 'EXEC_SUCCESS', stderr: true }, stderr);
}
if (!stdout && !stderr) {
log.trace({ event: 'EXEC_SUCCESS' }, '');
}
} | [
"function",
"_logExecOutput",
"(",
"log",
",",
"process",
")",
"{",
"let",
"stdout",
"=",
"process",
".",
"stdout",
"||",
"''",
";",
"let",
"stderr",
"=",
"process",
".",
"stderr",
"||",
"''",
";",
"if",
"(",
"process",
".",
"platform",
"===",
"'win32'... | /* istanbul ignore next | [
"/",
"*",
"istanbul",
"ignore",
"next"
] | 0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9 | https://github.com/wix/Detox/blob/0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9/detox/src/utils/exec.js#L69-L89 | train | Logs the exec output to the log | [
30522,
3853,
1035,
8833,
10288,
8586,
5833,
18780,
1006,
8833,
1010,
2832,
1007,
1063,
2292,
2358,
26797,
2102,
1027,
2832,
1012,
2358,
26797,
2102,
1064,
1064,
1005,
1005,
1025,
2292,
2358,
4063,
2099,
1027,
2832,
1012,
2358,
4063,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/HTMLDOMDiff.js | function (delta) {
edits.push.apply(edits, delta.edits);
moves.push.apply(moves, delta.moves);
queue.push.apply(queue, delta.newElements);
} | javascript | function (delta) {
edits.push.apply(edits, delta.edits);
moves.push.apply(moves, delta.moves);
queue.push.apply(queue, delta.newElements);
} | [
"function",
"(",
"delta",
")",
"{",
"edits",
".",
"push",
".",
"apply",
"(",
"edits",
",",
"delta",
".",
"edits",
")",
";",
"moves",
".",
"push",
".",
"apply",
"(",
"moves",
",",
"delta",
".",
"moves",
")",
";",
"queue",
".",
"push",
".",
"apply"... | Aggregates the child edits in the proper data structures.
@param {Object} delta edits, moves and newElements to add | [
"Aggregates",
"the",
"child",
"edits",
"in",
"the",
"proper",
"data",
"structures",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/HTMLDOMDiff.js#L561-L565 | train | Add an entry to the array of edits moves and newElements | [
30522,
3853,
1006,
7160,
1007,
1063,
10086,
2015,
1012,
5245,
1012,
6611,
1006,
10086,
2015,
1010,
7160,
1012,
10086,
2015,
1007,
1025,
5829,
1012,
5245,
1012,
6611,
1006,
5829,
1010,
7160,
1012,
5829,
1007,
1025,
24240,
1012,
5245,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/core/util/animation/animate.js | function (transform, addTransition, transition) {
var css = {};
angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) {
css[key] = transform;
});
if (addTransition) {
transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important";
css.transition = transition;
}
return css;
} | javascript | function (transform, addTransition, transition) {
var css = {};
angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) {
css[key] = transform;
});
if (addTransition) {
transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important";
css.transition = transition;
}
return css;
} | [
"function",
"(",
"transform",
",",
"addTransition",
",",
"transition",
")",
"{",
"var",
"css",
"=",
"{",
"}",
";",
"angular",
".",
"forEach",
"(",
"$mdConstant",
".",
"CSS",
".",
"TRANSFORM",
".",
"split",
"(",
"' '",
")",
",",
"function",
"(",
"key",
... | Convert the translate CSS value to key/value pair(s). | [
"Convert",
"the",
"translate",
"CSS",
"value",
"to",
"key",
"/",
"value",
"pair",
"(",
"s",
")",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L203-L215 | train | Returns a new CSS object with the given transform and transition | [
30522,
3853,
1006,
10938,
1010,
5587,
6494,
3619,
22753,
1010,
6653,
1007,
1063,
13075,
20116,
2015,
1027,
1063,
1065,
1025,
16108,
1012,
18921,
6776,
1006,
1002,
9108,
8663,
12693,
2102,
1012,
20116,
2015,
1012,
10938,
1012,
3975,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/jsunit/app/jsUnitCore.js | _trueTypeOf | function _trueTypeOf(something) {
var result = typeof something;
try {
switch (result) {
case 'string':
case 'boolean':
case 'number':
break;
case 'object':
case 'function':
switch (something.constructor)
{
case String:
result = 'String';
break;
case Boolean:
result = 'Boolean';
break;
case Number:
result = 'Number';
break;
case Array:
result = 'Array';
break;
case RegExp:
result = 'RegExp';
break;
case Function:
result = 'Function';
break;
default:
var m = something.constructor.toString().match(/function\s*([^( ]+)\(/);
if (m)
result = m[1];
else
break;
}
break;
}
}
finally {
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
} | javascript | function _trueTypeOf(something) {
var result = typeof something;
try {
switch (result) {
case 'string':
case 'boolean':
case 'number':
break;
case 'object':
case 'function':
switch (something.constructor)
{
case String:
result = 'String';
break;
case Boolean:
result = 'Boolean';
break;
case Number:
result = 'Number';
break;
case Array:
result = 'Array';
break;
case RegExp:
result = 'RegExp';
break;
case Function:
result = 'Function';
break;
default:
var m = something.constructor.toString().match(/function\s*([^( ]+)\(/);
if (m)
result = m[1];
else
break;
}
break;
}
}
finally {
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
} | [
"function",
"_trueTypeOf",
"(",
"something",
")",
"{",
"var",
"result",
"=",
"typeof",
"something",
";",
"try",
"{",
"switch",
"(",
"result",
")",
"{",
"case",
"'string'",
":",
"case",
"'boolean'",
":",
"case",
"'number'",
":",
"break",
";",
"case",
"'ob... | + * A more functional typeof
+ * @param Object o
+ * @return String
+ | [
"+",
"*",
"A",
"more",
"functional",
"typeof",
"+",
"*"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/jsunit/app/jsUnitCore.js#L31-L75 | train | Returns true type of something | [
30522,
3853,
1035,
2995,
13874,
11253,
1006,
2242,
1007,
1063,
13075,
2765,
1027,
2828,
11253,
2242,
1025,
3046,
1063,
6942,
1006,
2765,
1007,
1063,
2553,
1005,
5164,
1005,
1024,
2553,
1005,
22017,
20898,
1005,
1024,
2553,
1005,
2193,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(deep) {
var newObj = {},
i;
if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) {
return obj;
}
for (i in obj) {
if(obj.hasOwnProperty(i)) {
if (deep) {
newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep);
} else {
newObj[i] = obj[i];
}
}
}
return newObj;
} | javascript | function(deep) {
var newObj = {},
i;
if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) {
return obj;
}
for (i in obj) {
if(obj.hasOwnProperty(i)) {
if (deep) {
newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep);
} else {
newObj[i] = obj[i];
}
}
}
return newObj;
} | [
"function",
"(",
"deep",
")",
"{",
"var",
"newObj",
"=",
"{",
"}",
",",
"i",
";",
"if",
"(",
"obj",
"===",
"null",
"||",
"!",
"wysihtml5",
".",
"lang",
".",
"object",
"(",
"obj",
")",
".",
"isPlainObject",
"(",
")",
")",
"{",
"return",
"obj",
"... | @example
wysihtml5.lang.object({ foo: 1 }).clone();
// => { foo: 1 }
v0.4.14 adds options for deep clone : wysihtml5.lang.object({ foo: 1 }).clone(true); | [
"@example",
"wysihtml5",
".",
"lang",
".",
"object",
"(",
"{",
"foo",
":",
"1",
"}",
")",
".",
"clone",
"()",
";",
"//",
"=",
">",
"{",
"foo",
":",
"1",
"}"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4778-L4796 | train | Clone the object | [
30522,
3853,
1006,
2784,
1007,
1063,
13075,
2047,
16429,
3501,
1027,
1063,
1065,
1010,
1045,
1025,
2065,
1006,
27885,
3501,
1027,
1027,
1027,
19701,
1064,
1064,
999,
1059,
7274,
19190,
21246,
2140,
2629,
1012,
11374,
1012,
4874,
1006,
27885... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/js/highlight-query-terms.js | makeQueryInfo | function makeQueryInfo() {
var rparam = /[^?#]*\?([^#]*&)?q=([^&#]*)(&|#|$)/,
rquote = /[.?*+|(){}\[\]\\]/g,
match = rparam.exec(document.URL) || rparam.exec(document.referrer),
qterms = match && decodeURIComponent(match[2].replace(/\+/g, " ")).split(/\s+/g),
classes,i,t;
if ( qterms ) {
// create a styles map and regexp from the non-empty query terms
classes = {};
for (i = 0; i < qterms.length; ) {
t = qterms[i].toLowerCase();
if ( t && !classes.hasOwnProperty(t) ) { // ignore duplicates and empty terms
classes[t] = 'queryterm' + (1 + i % N_STYLES);
qterms[i] = t.replace(rquote, "\\$&"); // quote special regex chars;
i++;
} else {
// remove empty or redundant search terms
qterms.splice(i, 1);
}
}
// if there are terms, return an info object with regex and style map
if ( qterms.length > 0 ) {
return {
regexp: new RegExp(qterms.join("|"), 'gi'),
classes: classes
};
}
}
// return undefined
} | javascript | function makeQueryInfo() {
var rparam = /[^?#]*\?([^#]*&)?q=([^&#]*)(&|#|$)/,
rquote = /[.?*+|(){}\[\]\\]/g,
match = rparam.exec(document.URL) || rparam.exec(document.referrer),
qterms = match && decodeURIComponent(match[2].replace(/\+/g, " ")).split(/\s+/g),
classes,i,t;
if ( qterms ) {
// create a styles map and regexp from the non-empty query terms
classes = {};
for (i = 0; i < qterms.length; ) {
t = qterms[i].toLowerCase();
if ( t && !classes.hasOwnProperty(t) ) { // ignore duplicates and empty terms
classes[t] = 'queryterm' + (1 + i % N_STYLES);
qterms[i] = t.replace(rquote, "\\$&"); // quote special regex chars;
i++;
} else {
// remove empty or redundant search terms
qterms.splice(i, 1);
}
}
// if there are terms, return an info object with regex and style map
if ( qterms.length > 0 ) {
return {
regexp: new RegExp(qterms.join("|"), 'gi'),
classes: classes
};
}
}
// return undefined
} | [
"function",
"makeQueryInfo",
"(",
")",
"{",
"var",
"rparam",
"=",
"/",
"[^?#]*\\?([^#]*&)?q=([^&#]*)(&|#|$)",
"/",
",",
"rquote",
"=",
"/",
"[.?*+|(){}\\[\\]\\\\]",
"/",
"g",
",",
"match",
"=",
"rparam",
".",
"exec",
"(",
"document",
".",
"URL",
")",
"||",
... | /*
Search the query parameters of the document URL and the referrer URL for Google-like query terms
(parameter name 'q'). If found, create a regular expression to find occurrences of any of the terms
and a map of CSS classes to be applied to each match. The map uses the lower case version of each term as key.
@returns {{regexp:RegExp, classes:object}} info object | [
"/",
"*",
"Search",
"the",
"query",
"parameters",
"of",
"the",
"document",
"URL",
"and",
"the",
"referrer",
"URL",
"for",
"Google",
"-",
"like",
"query",
"terms",
"(",
"parameter",
"name",
"q",
")",
".",
"If",
"found",
"create",
"a",
"regular",
"expressi... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/js/highlight-query-terms.js#L16-L51 | train | This function is used to make a query info object from a query string | [
30522,
3853,
2191,
4226,
2854,
2378,
14876,
1006,
1007,
1063,
13075,
1054,
28689,
2213,
1027,
1013,
1031,
1034,
1029,
1001,
1033,
1008,
1032,
1029,
1006,
1031,
30524,
1033,
1032,
1032,
1033,
1013,
1043,
1010,
2674,
1027,
1054,
28689,
2213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function (oEvent) {
// early out if already open
if (this._oAssistantPopover && this._oAssistantPopover.isOpen()) {
return;
}
// create dialog lazily
if (!this._oAssistantPopover) {
this._oAssistantPopover = sap.ui.xmlfragment(this._SUPPORT_ASSISTANT_POPOVER_ID, "sap.ui.core.support.techinfo.TechnicalInfoAssistantPopover", this);
this._oAssistantPopover.attachAfterOpen(this._onAssistantPopoverOpened, this);
this._oDialog.addDependent(this._oAssistantPopover);
syncStyleClass(this._getContentDensityClass(), this._oDialog, this._oAssistantPopover);
// register message validation and trigger it once to validate the value coming from local storage
var oCustomBootstrapURL = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID);
sap.ui.getCore().getMessageManager().registerObject(oCustomBootstrapURL, true);
}
// enable or disable default option for version >= 1.48
var oCurrentItem = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID).getItems()[0];
if (this._isVersionBiggerThanMinSupported()) {
var sAppVersion = sap.ui.getCore().getConfiguration().getVersion().toString();
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", sAppVersion));
oCurrentItem.setEnabled(true);
} else {
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", "not supported"));
oCurrentItem.setEnabled(false);
}
var oModel = this._oDialog.getModel("view"),
sSelectedLocation = oModel.getProperty("/SelectedLocation");
this._setActiveLocations(sSelectedLocation);
var oSupportAssistantSettingsButton = this._getControl("supportAssistantSettingsButton", this._TECHNICAL_INFO_DIALOG_ID);
this._oAssistantPopover.openBy(oSupportAssistantSettingsButton);
} | javascript | function (oEvent) {
// early out if already open
if (this._oAssistantPopover && this._oAssistantPopover.isOpen()) {
return;
}
// create dialog lazily
if (!this._oAssistantPopover) {
this._oAssistantPopover = sap.ui.xmlfragment(this._SUPPORT_ASSISTANT_POPOVER_ID, "sap.ui.core.support.techinfo.TechnicalInfoAssistantPopover", this);
this._oAssistantPopover.attachAfterOpen(this._onAssistantPopoverOpened, this);
this._oDialog.addDependent(this._oAssistantPopover);
syncStyleClass(this._getContentDensityClass(), this._oDialog, this._oAssistantPopover);
// register message validation and trigger it once to validate the value coming from local storage
var oCustomBootstrapURL = this._getControl("customBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID);
sap.ui.getCore().getMessageManager().registerObject(oCustomBootstrapURL, true);
}
// enable or disable default option for version >= 1.48
var oCurrentItem = this._getControl("standardBootstrapURL", this._SUPPORT_ASSISTANT_POPOVER_ID).getItems()[0];
if (this._isVersionBiggerThanMinSupported()) {
var sAppVersion = sap.ui.getCore().getConfiguration().getVersion().toString();
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", sAppVersion));
oCurrentItem.setEnabled(true);
} else {
oCurrentItem.setText(oCurrentItem.getText().replace("[[version]]", "not supported"));
oCurrentItem.setEnabled(false);
}
var oModel = this._oDialog.getModel("view"),
sSelectedLocation = oModel.getProperty("/SelectedLocation");
this._setActiveLocations(sSelectedLocation);
var oSupportAssistantSettingsButton = this._getControl("supportAssistantSettingsButton", this._TECHNICAL_INFO_DIALOG_ID);
this._oAssistantPopover.openBy(oSupportAssistantSettingsButton);
} | [
"function",
"(",
"oEvent",
")",
"{",
"// early out if already open",
"if",
"(",
"this",
".",
"_oAssistantPopover",
"&&",
"this",
".",
"_oAssistantPopover",
".",
"isOpen",
"(",
")",
")",
"{",
"return",
";",
"}",
"// create dialog lazily",
"if",
"(",
"!",
"this"... | Opens a popover with extended configuration options
@param {sap.ui.base.Event} oEvent The button press event | [
"Opens",
"a",
"popover",
"with",
"extended",
"configuration",
"options"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L394-L430 | train | Opens the assistant popup | [
30522,
3853,
1006,
1051,
18697,
3372,
1007,
1063,
1013,
1013,
2220,
2041,
2065,
2525,
2330,
2065,
1006,
2023,
1012,
1035,
1051,
12054,
30524,
28431,
2065,
1006,
999,
2023,
1012,
1035,
1051,
12054,
23137,
25856,
7361,
7840,
1007,
1063,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
exceljs/exceljs | lib/doc/defined-names.js | vGrow | function vGrow(yy, edge) {
const c = matrix.findCellAt(sheetName, yy, cell.col);
if (!c || !c.mark) { return false; }
range[edge] = yy;
c.mark = false;
return true;
} | javascript | function vGrow(yy, edge) {
const c = matrix.findCellAt(sheetName, yy, cell.col);
if (!c || !c.mark) { return false; }
range[edge] = yy;
c.mark = false;
return true;
} | [
"function",
"vGrow",
"(",
"yy",
",",
"edge",
")",
"{",
"const",
"c",
"=",
"matrix",
".",
"findCellAt",
"(",
"sheetName",
",",
"yy",
",",
"cell",
".",
"col",
")",
";",
"if",
"(",
"!",
"c",
"||",
"!",
"c",
".",
"mark",
")",
"{",
"return",
"false"... | grow vertical - only one col to worry about | [
"grow",
"vertical",
"-",
"only",
"one",
"col",
"to",
"worry",
"about"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/doc/defined-names.js#L87-L93 | train | grow the v - axis | [
30522,
3853,
1058,
16523,
5004,
1006,
1061,
2100,
1010,
3341,
1007,
1063,
9530,
3367,
1039,
1027,
8185,
1012,
2424,
29109,
20051,
1006,
7123,
18442,
1010,
1061,
2100,
1010,
3526,
1012,
8902,
1007,
1025,
2065,
1006,
999,
1039,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/bootstrap/js/collapse.js | function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
} | javascript | function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
} | [
"function",
"(",
"element",
",",
"options",
")",
"{",
"this",
".",
"$element",
"=",
"$",
"(",
"element",
")",
"this",
".",
"options",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"Collapse",
".",
"DEFAULTS",
",",
"options",
")",
"this",
".",
"$trig... | COLLAPSE PUBLIC CLASS DEFINITION ================================ | [
"COLLAPSE",
"PUBLIC",
"CLASS",
"DEFINITION",
"================================"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/bootstrap/js/collapse.js#L17-L31 | train | Constructor for Collapse | [
30522,
3853,
1006,
5783,
1010,
7047,
1007,
1063,
2023,
1012,
1002,
5783,
1027,
1002,
1006,
5783,
1007,
2023,
1012,
7047,
1027,
1002,
1012,
7949,
1006,
1063,
1065,
1010,
7859,
1012,
12398,
2015,
1010,
7047,
1007,
2023,
1012,
1002,
9495,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
zloirock/core-js | packages/core-js/modules/web.url-search-params.js | append | function append(name, value) {
validateArgumentsLength(arguments.length, 2);
var state = getInternalParamsState(this);
state.entries.push({ key: name + '', value: value + '' });
if (state.updateURL) state.updateURL();
} | javascript | function append(name, value) {
validateArgumentsLength(arguments.length, 2);
var state = getInternalParamsState(this);
state.entries.push({ key: name + '', value: value + '' });
if (state.updateURL) state.updateURL();
} | [
"function",
"append",
"(",
"name",
",",
"value",
")",
"{",
"validateArgumentsLength",
"(",
"arguments",
".",
"length",
",",
"2",
")",
";",
"var",
"state",
"=",
"getInternalParamsState",
"(",
"this",
")",
";",
"state",
".",
"entries",
".",
"push",
"(",
"{... | `URLSearchParams.prototype.appent` method https://url.spec.whatwg.org/#dom-urlsearchparams-append | [
"URLSearchParams",
".",
"prototype",
".",
"appent",
"method",
"https",
":",
"//",
"url",
".",
"spec",
".",
"whatwg",
".",
"org",
"/",
"#dom",
"-",
"urlsearchparams",
"-",
"append"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L150-L155 | train | Append a parameter to the end of the parameters array. | [
30522,
3853,
10439,
10497,
1006,
2171,
1010,
3643,
1007,
1063,
9398,
3686,
2906,
22850,
11187,
7770,
13512,
2232,
1006,
9918,
1012,
3091,
1010,
1016,
1007,
1025,
13075,
2110,
1027,
2131,
18447,
11795,
2389,
28689,
5244,
9153,
2618,
1006,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_BrtCellBool | function parse_BrtCellBool(data) {
var cell = parse_XLSBCell(data);
var fBool = data.read_shift(1);
return [cell, fBool, 'b'];
} | javascript | function parse_BrtCellBool(data) {
var cell = parse_XLSBCell(data);
var fBool = data.read_shift(1);
return [cell, fBool, 'b'];
} | [
"function",
"parse_BrtCellBool",
"(",
"data",
")",
"{",
"var",
"cell",
"=",
"parse_XLSBCell",
"(",
"data",
")",
";",
"var",
"fBool",
"=",
"data",
".",
"read_shift",
"(",
"1",
")",
";",
"return",
"[",
"cell",
",",
"fBool",
",",
"'b'",
"]",
";",
"}"
] | /* [MS-XLSB] 2.4.307 BrtCellBool | [
"/",
"*",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"4",
".",
"307",
"BrtCellBool"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L13491-L13495 | train | Parse a BrtCellBool | [
30522,
3853,
11968,
3366,
1035,
7987,
13535,
5349,
5092,
4747,
1006,
2951,
1007,
1063,
13075,
3526,
1027,
11968,
3366,
1035,
28712,
19022,
29109,
2140,
1006,
2951,
1007,
1025,
13075,
1042,
5092,
4747,
1027,
2951,
1012,
3191,
1035,
5670,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function(target, date) {
var inst = this._getInst(target);
if (inst) {
this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
} | javascript | function(target, date) {
var inst = this._getInst(target);
if (inst) {
this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
} | [
"function",
"(",
"target",
",",
"date",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"target",
")",
";",
"if",
"(",
"inst",
")",
"{",
"this",
".",
"_setDate",
"(",
"inst",
",",
"date",
")",
";",
"this",
".",
"_updateDatepicker",
"(",... | /* Set the dates for a jQuery selection.
@param target element - the target input field or division or span
@param date Date - the new date | [
"/",
"*",
"Set",
"the",
"dates",
"for",
"a",
"jQuery",
"selection",
"."
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L8138-L8145 | train | Sets the date of the specified datepicker. | [
30522,
3853,
1006,
4539,
1010,
3058,
1007,
1063,
13075,
16021,
2102,
1027,
2023,
1012,
1035,
2131,
7076,
2102,
1006,
4539,
1007,
1025,
2065,
1006,
16021,
2102,
1007,
1063,
2023,
1012,
1035,
2275,
13701,
1006,
16021,
2102,
1010,
3058,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aws/aws-sdk-js | lib/discover_endpoint.js | addApiVersionHeader | function addApiVersionHeader(endpointRequest) {
var api = endpointRequest.service.api;
var apiVersion = api.apiVersion;
if (apiVersion && !endpointRequest.httpRequest.headers['x-amz-api-version']) {
endpointRequest.httpRequest.headers['x-amz-api-version'] = apiVersion;
}
} | javascript | function addApiVersionHeader(endpointRequest) {
var api = endpointRequest.service.api;
var apiVersion = api.apiVersion;
if (apiVersion && !endpointRequest.httpRequest.headers['x-amz-api-version']) {
endpointRequest.httpRequest.headers['x-amz-api-version'] = apiVersion;
}
} | [
"function",
"addApiVersionHeader",
"(",
"endpointRequest",
")",
"{",
"var",
"api",
"=",
"endpointRequest",
".",
"service",
".",
"api",
";",
"var",
"apiVersion",
"=",
"api",
".",
"apiVersion",
";",
"if",
"(",
"apiVersion",
"&&",
"!",
"endpointRequest",
".",
"... | add api version header to endpoint operation
@api private | [
"add",
"api",
"version",
"header",
"to",
"endpoint",
"operation"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L210-L216 | train | Add the x - amz - api - version header to the request if it doesn t already exist | [
30522,
3853,
5587,
9331,
16402,
10992,
4974,
2121,
1006,
2203,
8400,
2890,
15500,
1007,
1063,
13075,
17928,
1027,
2203,
8400,
2890,
15500,
1012,
2326,
1012,
17928,
1025,
13075,
17928,
27774,
1027,
17928,
1012,
17928,
27774,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/node/TernNodeDomain.js | _reportError | function _reportError(e, file) {
if (e instanceof Infer.TimedOut) {
// Post a message back to the main thread with timedout info
self.postMessage({
type: MessageIds.TERN_INFERENCE_TIMEDOUT,
file: file
});
} else {
_log("Error thrown in tern_node domain:" + e.message + "\n" + e.stack);
}
} | javascript | function _reportError(e, file) {
if (e instanceof Infer.TimedOut) {
// Post a message back to the main thread with timedout info
self.postMessage({
type: MessageIds.TERN_INFERENCE_TIMEDOUT,
file: file
});
} else {
_log("Error thrown in tern_node domain:" + e.message + "\n" + e.stack);
}
} | [
"function",
"_reportError",
"(",
"e",
",",
"file",
")",
"{",
"if",
"(",
"e",
"instanceof",
"Infer",
".",
"TimedOut",
")",
"{",
"// Post a message back to the main thread with timedout info",
"self",
".",
"postMessage",
"(",
"{",
"type",
":",
"MessageIds",
".",
"... | Report exception
@private
@param {Error} e - the error object | [
"Report",
"exception"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L73-L83 | train | Report an error to the log | [
30522,
3853,
1035,
6398,
29165,
1006,
1041,
1010,
5371,
1007,
1063,
2065,
1006,
1041,
6013,
11253,
1999,
7512,
1012,
22313,
5833,
1007,
1063,
1013,
1013,
2695,
1037,
4471,
2067,
2000,
1996,
2364,
11689,
2007,
22313,
5833,
18558,
2969,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
showdownjs/showdown | src/subParsers/makehtml/lists.js | processListItems | function processListItems (listStr, trimTrailing) {
// The $g_list_level global keeps track of when we're inside a list.
// Each time we enter a list, we increment it; when we leave a list,
// we decrement. If it's zero, we're not in a list anymore.
//
// We do this because when we're not inside a list, we want to treat
// something like this:
//
// I recommend upgrading to version
// 8. Oops, now this line is treated
// as a sub-list.
//
// As a single paragraph, despite the fact that the second line starts
// with a digit-period-space sequence.
//
// Whereas when we're inside a list (or sub-list), that line will be
// treated as the start of a sub-list. What a kludge, huh? This is
// an aspect of Markdown's syntax that's hard to parse perfectly
// without resorting to mind-reading. Perhaps the solution is to
// change the syntax rules such that sub-lists must start with a
// starting cardinal number; e.g. "1." or "a.".
globals.gListLevel++;
// trim trailing blank lines:
listStr = listStr.replace(/\n{2,}$/, '\n');
// attacklab: add sentinel to emulate \z
listStr += '¨0';
var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
// which is a syntax breaking change
// activating this option reverts to old behavior
// This will be removed in version 2.0
if (options.disableForced4SpacesIndentedSublists) {
rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
}
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
checked = (checked && checked.trim() !== '');
var item = showdown.subParser('makehtml.outdent')(m4, options, globals),
bulletStyle = '';
// Support for github tasklists
if (taskbtn && options.tasklists) {
bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
if (checked) {
otp += ' checked';
}
otp += '>';
return otp;
});
}
// ISSUE #312
// This input: - - - a
// causes trouble to the parser, since it interprets it as:
// <ul><li><li><li>a</li></li></li></ul>
// instead of:
// <ul><li>- - a</li></ul>
// So, to prevent it, we will put a marker (¨A)in the beginning of the line
// Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
return '¨A' + wm2;
});
// SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
// or/nor indented. ex:
//
// - # foo
// bar is great
//
// While this does now follow the spec per se, not allowing for this might cause confusion since
// header blocks don't need double newlines after
if (/^#+.+\n.+/.test(item)) {
item = item.replace(/^(#+.+)$/m, '$1\n');
}
// m1 - Leading line or
// Has a double return (multi paragraph)
if (m1 || (item.search(/\n{2,}/) > -1)) {
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
} else {
// Recursion for sub-lists:
item = showdown.subParser('makehtml.lists')(item, options, globals);
item = item.replace(/\n$/, ''); // chomp(item)
item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
// Colapse double linebreaks
item = item.replace(/\n\n+/g, '\n\n');
if (isParagraphed) {
item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
} else {
item = showdown.subParser('makehtml.spanGamut')(item, options, globals);
}
}
// now we need to remove the marker (¨A)
item = item.replace('¨A', '');
// we can finally wrap the line in list item tags
item = '<li' + bulletStyle + '>' + item + '</li>\n';
return item;
});
// attacklab: strip sentinel
listStr = listStr.replace(/¨0/g, '');
globals.gListLevel--;
if (trimTrailing) {
listStr = listStr.replace(/\s+$/, '');
}
return listStr;
} | javascript | function processListItems (listStr, trimTrailing) {
// The $g_list_level global keeps track of when we're inside a list.
// Each time we enter a list, we increment it; when we leave a list,
// we decrement. If it's zero, we're not in a list anymore.
//
// We do this because when we're not inside a list, we want to treat
// something like this:
//
// I recommend upgrading to version
// 8. Oops, now this line is treated
// as a sub-list.
//
// As a single paragraph, despite the fact that the second line starts
// with a digit-period-space sequence.
//
// Whereas when we're inside a list (or sub-list), that line will be
// treated as the start of a sub-list. What a kludge, huh? This is
// an aspect of Markdown's syntax that's hard to parse perfectly
// without resorting to mind-reading. Perhaps the solution is to
// change the syntax rules such that sub-lists must start with a
// starting cardinal number; e.g. "1." or "a.".
globals.gListLevel++;
// trim trailing blank lines:
listStr = listStr.replace(/\n{2,}$/, '\n');
// attacklab: add sentinel to emulate \z
listStr += '¨0';
var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
// which is a syntax breaking change
// activating this option reverts to old behavior
// This will be removed in version 2.0
if (options.disableForced4SpacesIndentedSublists) {
rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
}
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
checked = (checked && checked.trim() !== '');
var item = showdown.subParser('makehtml.outdent')(m4, options, globals),
bulletStyle = '';
// Support for github tasklists
if (taskbtn && options.tasklists) {
bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
if (checked) {
otp += ' checked';
}
otp += '>';
return otp;
});
}
// ISSUE #312
// This input: - - - a
// causes trouble to the parser, since it interprets it as:
// <ul><li><li><li>a</li></li></li></ul>
// instead of:
// <ul><li>- - a</li></ul>
// So, to prevent it, we will put a marker (¨A)in the beginning of the line
// Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
return '¨A' + wm2;
});
// SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
// or/nor indented. ex:
//
// - # foo
// bar is great
//
// While this does now follow the spec per se, not allowing for this might cause confusion since
// header blocks don't need double newlines after
if (/^#+.+\n.+/.test(item)) {
item = item.replace(/^(#+.+)$/m, '$1\n');
}
// m1 - Leading line or
// Has a double return (multi paragraph)
if (m1 || (item.search(/\n{2,}/) > -1)) {
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
} else {
// Recursion for sub-lists:
item = showdown.subParser('makehtml.lists')(item, options, globals);
item = item.replace(/\n$/, ''); // chomp(item)
item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
// Colapse double linebreaks
item = item.replace(/\n\n+/g, '\n\n');
if (isParagraphed) {
item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
} else {
item = showdown.subParser('makehtml.spanGamut')(item, options, globals);
}
}
// now we need to remove the marker (¨A)
item = item.replace('¨A', '');
// we can finally wrap the line in list item tags
item = '<li' + bulletStyle + '>' + item + '</li>\n';
return item;
});
// attacklab: strip sentinel
listStr = listStr.replace(/¨0/g, '');
globals.gListLevel--;
if (trimTrailing) {
listStr = listStr.replace(/\s+$/, '');
}
return listStr;
} | [
"function",
"processListItems",
"(",
"listStr",
",",
"trimTrailing",
")",
"{",
"// The $g_list_level global keeps track of when we're inside a list.",
"// Each time we enter a list, we increment it; when we leave a list,",
"// we decrement. If it's zero, we're not in a list anymore.",
"//",
... | Process the contents of a single ordered or unordered list, splitting it
into individual list items.
@param {string} listStr
@param {boolean} trimTrailing
@returns {string} | [
"Process",
"the",
"contents",
"of",
"a",
"single",
"ordered",
"or",
"unordered",
"list",
"splitting",
"it",
"into",
"individual",
"list",
"items",
"."
] | 33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9 | https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/src/subParsers/makehtml/lists.js#L14-L137 | train | Process a list of items | [
30522,
3853,
2832,
9863,
4221,
5244,
1006,
7201,
16344,
1010,
12241,
6494,
16281,
1007,
1063,
1013,
1013,
1996,
1002,
1043,
1035,
2862,
1035,
2504,
3795,
7906,
2650,
1997,
2043,
2057,
1005,
2128,
2503,
1037,
2862,
1012,
1013,
1013,
2169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/web/shared/middlewares/serve-public-file.js | servePublicFile | function servePublicFile(file, type, maxAge) {
const publicFileMiddleware = createPublicFileMiddleware(file, type, maxAge);
return function servePublicFile(req, res, next) {
if (req.path === '/' + file) {
return publicFileMiddleware(req, res, next);
} else {
return next();
}
};
} | javascript | function servePublicFile(file, type, maxAge) {
const publicFileMiddleware = createPublicFileMiddleware(file, type, maxAge);
return function servePublicFile(req, res, next) {
if (req.path === '/' + file) {
return publicFileMiddleware(req, res, next);
} else {
return next();
}
};
} | [
"function",
"servePublicFile",
"(",
"file",
",",
"type",
",",
"maxAge",
")",
"{",
"const",
"publicFileMiddleware",
"=",
"createPublicFileMiddleware",
"(",
"file",
",",
"type",
",",
"maxAge",
")",
";",
"return",
"function",
"servePublicFile",
"(",
"req",
",",
"... | ### servePublicFile Middleware Handles requests to robots.txt and favicon.ico (and caches them) | [
"###",
"servePublicFile",
"Middleware",
"Handles",
"requests",
"to",
"robots",
".",
"txt",
"and",
"favicon",
".",
"ico",
"(",
"and",
"caches",
"them",
")"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/web/shared/middlewares/serve-public-file.js#L48-L58 | train | servePublicFile - Creates a middleware that will serve public files | [
30522,
3853,
3710,
14289,
16558,
2594,
8873,
2571,
1006,
5371,
1010,
2828,
1010,
4098,
4270,
1007,
1063,
9530,
3367,
2270,
8873,
16930,
3593,
10362,
8059,
1027,
3443,
14289,
16558,
2594,
8873,
16930,
3593,
10362,
8059,
1006,
5371,
1010,
282... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/layout/layout.js | attributeWithObserve | function attributeWithObserve(className) {
return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) {
$mdUtil = _$mdUtil_;
$interpolate = _$interpolate_;
$log = _$log_;
return {
restrict: 'A',
compile: function(element, attr) {
var linkFn;
if (config.enabled) {
// immediately replace static (non-interpolated) invalid values...
validateAttributeUsage(className, attr, element, $log);
validateAttributeValue(className,
getNormalizedAttrValue(className, attr, ""),
buildUpdateFn(element, className, attr)
);
linkFn = translateWithValueToCssClass;
}
// Use for postLink to account for transforms after ng-transclude.
return linkFn || angular.noop;
}
};
}];
/**
* Add as transformed class selector(s), then
* remove the deprecated attribute selector
*/
function translateWithValueToCssClass(scope, element, attrs) {
var updateFn = updateClassWithValue(element, className, attrs);
var unwatch = attrs.$observe(attrs.$normalize(className), updateFn);
updateFn(getNormalizedAttrValue(className, attrs, ""));
scope.$on("$destroy", function() { unwatch(); });
}
} | javascript | function attributeWithObserve(className) {
return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) {
$mdUtil = _$mdUtil_;
$interpolate = _$interpolate_;
$log = _$log_;
return {
restrict: 'A',
compile: function(element, attr) {
var linkFn;
if (config.enabled) {
// immediately replace static (non-interpolated) invalid values...
validateAttributeUsage(className, attr, element, $log);
validateAttributeValue(className,
getNormalizedAttrValue(className, attr, ""),
buildUpdateFn(element, className, attr)
);
linkFn = translateWithValueToCssClass;
}
// Use for postLink to account for transforms after ng-transclude.
return linkFn || angular.noop;
}
};
}];
/**
* Add as transformed class selector(s), then
* remove the deprecated attribute selector
*/
function translateWithValueToCssClass(scope, element, attrs) {
var updateFn = updateClassWithValue(element, className, attrs);
var unwatch = attrs.$observe(attrs.$normalize(className), updateFn);
updateFn(getNormalizedAttrValue(className, attrs, ""));
scope.$on("$destroy", function() { unwatch(); });
}
} | [
"function",
"attributeWithObserve",
"(",
"className",
")",
"{",
"return",
"[",
"'$mdUtil'",
",",
"'$interpolate'",
",",
"\"$log\"",
",",
"function",
"(",
"_$mdUtil_",
",",
"_$interpolate_",
",",
"_$log_",
")",
"{",
"$mdUtil",
"=",
"_$mdUtil_",
";",
"$interpolate... | ********************************************************************************* These functions create registration functions for AngularJS Material Layout attribute directives This provides easy translation to switch AngularJS Material attribute selectors to CLASS selectors and directives; which has huge performance implications for IE Browsers *********************************************************************************
Creates a directive registration function where a possible dynamic attribute
value will be observed/watched.
@param {string} className attribute name; eg `layout-gt-md` with value ="row" | [
"*********************************************************************************",
"These",
"functions",
"create",
"registration",
"functions",
"for",
"AngularJS",
"Material",
"Layout",
"attribute",
"directives",
"This",
"provides",
"easy",
"translation",
"to",
"switch",
"Angul... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L254-L295 | train | Adds an attribute with observe function to the element. | [
30522,
3853,
17961,
24415,
16429,
8043,
3726,
1006,
2465,
18442,
1007,
1063,
2709,
1031,
1005,
1002,
9108,
21823,
2140,
1005,
1010,
1005,
1002,
6970,
18155,
3686,
1005,
1010,
1000,
1002,
8833,
1000,
1010,
3853,
1006,
1035,
1002,
9108,
21823... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/sankey/sankeyLayout.js | scaleNodeBreadths | function scaleNodeBreadths(nodes, kx, orient) {
zrUtil.each(nodes, function (node) {
var nodeDepth = node.getLayout().depth * kx;
orient === 'vertical'
? node.setLayout({y: nodeDepth}, true)
: node.setLayout({x: nodeDepth}, true);
});
} | javascript | function scaleNodeBreadths(nodes, kx, orient) {
zrUtil.each(nodes, function (node) {
var nodeDepth = node.getLayout().depth * kx;
orient === 'vertical'
? node.setLayout({y: nodeDepth}, true)
: node.setLayout({x: nodeDepth}, true);
});
} | [
"function",
"scaleNodeBreadths",
"(",
"nodes",
",",
"kx",
",",
"orient",
")",
"{",
"zrUtil",
".",
"each",
"(",
"nodes",
",",
"function",
"(",
"node",
")",
"{",
"var",
"nodeDepth",
"=",
"node",
".",
"getLayout",
"(",
")",
".",
"depth",
"*",
"kx",
";",... | Scale node x-position to the width
@param {module:echarts/data/Graph~Node} nodes node of sankey view
@param {number} kx multiple used to scale nodes | [
"Scale",
"node",
"x",
"-",
"position",
"to",
"the",
"width"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sankey/sankeyLayout.js#L239-L246 | train | Scale the nodes breadths | [
30522,
3853,
4094,
3630,
3207,
27035,
26830,
1006,
14164,
1010,
1047,
2595,
1010,
16865,
1007,
1063,
1062,
22134,
4014,
1012,
2169,
1006,
14164,
1010,
3853,
1006,
13045,
1007,
1063,
13075,
13045,
3207,
13876,
2232,
1027,
13045,
1012,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BrainJS/brain.js | dist/neural-network-gpu.js | mse | function mse(errors) {
var sum = 0;
for (var i = 0; i < this.constants.size; i++) {
sum += Math.pow(errors[i], 2);
}
return sum / this.constants.size;
} | javascript | function mse(errors) {
var sum = 0;
for (var i = 0; i < this.constants.size; i++) {
sum += Math.pow(errors[i], 2);
}
return sum / this.constants.size;
} | [
"function",
"mse",
"(",
"errors",
")",
"{",
"var",
"sum",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"constants",
".",
"size",
";",
"i",
"++",
")",
"{",
"sum",
"+=",
"Math",
".",
"pow",
"(",
"errors",
"[",
... | mean squared error, reimplemented for GPU | [
"mean",
"squared",
"error",
"reimplemented",
"for",
"GPU"
] | ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef | https://github.com/BrainJS/brain.js/blob/ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef/dist/neural-network-gpu.js#L521-L527 | train | Returns the error in ms | [
30522,
3853,
5796,
2063,
1006,
10697,
1007,
1063,
13075,
7680,
1027,
1014,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
5377,
2015,
1012,
2946,
1025,
1045,
1009,
1009,
1007,
1063,
7680,
1009,
1027,
8785,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/NodeConnection.js | success | function success() {
self._ws.onclose = function () {
if (self._autoReconnect) {
var $promise = self.connect(true);
self.trigger("close", $promise);
} else {
self._cleanup();
self.trigger("close");
}
};
deferred.resolve();
} | javascript | function success() {
self._ws.onclose = function () {
if (self._autoReconnect) {
var $promise = self.connect(true);
self.trigger("close", $promise);
} else {
self._cleanup();
self.trigger("close");
}
};
deferred.resolve();
} | [
"function",
"success",
"(",
")",
"{",
"self",
".",
"_ws",
".",
"onclose",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"self",
".",
"_autoReconnect",
")",
"{",
"var",
"$promise",
"=",
"self",
".",
"connect",
"(",
"true",
")",
";",
"self",
".",
"trigg... | Called if we succeed at the final setup | [
"Called",
"if",
"we",
"succeed",
"at",
"the",
"final",
"setup"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/NodeConnection.js#L258-L269 | train | Called when the connection is successful | [
30522,
3853,
3112,
1006,
1007,
1063,
2969,
1012,
1035,
1059,
2015,
1012,
2006,
20464,
9232,
1027,
3853,
1006,
1007,
1063,
2065,
1006,
2969,
1012,
1035,
8285,
2890,
8663,
2638,
6593,
1007,
1063,
13075,
1002,
4872,
1027,
2969,
1012,
7532,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileTreeViewModel.js | _closeSubtree | function _closeSubtree(directory) {
directory = directory.delete("open");
var children = directory.get("children");
if (children) {
children.keySeq().forEach(function (name) {
var subdir = children.get(name);
if (!isFile(subdir)) {
subdir = _closeSubtree(subdir);
children = children.set(name, subdir);
}
});
}
directory = directory.set("children", children);
return directory;
} | javascript | function _closeSubtree(directory) {
directory = directory.delete("open");
var children = directory.get("children");
if (children) {
children.keySeq().forEach(function (name) {
var subdir = children.get(name);
if (!isFile(subdir)) {
subdir = _closeSubtree(subdir);
children = children.set(name, subdir);
}
});
}
directory = directory.set("children", children);
return directory;
} | [
"function",
"_closeSubtree",
"(",
"directory",
")",
"{",
"directory",
"=",
"directory",
".",
"delete",
"(",
"\"open\"",
")",
";",
"var",
"children",
"=",
"directory",
".",
"get",
"(",
"\"children\"",
")",
";",
"if",
"(",
"children",
")",
"{",
"children",
... | Closes a subtree path, given by an object path.
@param {Immutable.Map} directory Current directory
@return {Immutable.Map} new directory | [
"Closes",
"a",
"subtree",
"path",
"given",
"by",
"an",
"object",
"path",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L597-L613 | train | Close the subtree of a directory | [
30522,
3853,
1035,
14572,
12083,
13334,
1006,
14176,
1007,
1063,
14176,
1027,
14176,
1012,
3972,
12870,
1006,
1000,
2330,
1000,
1007,
1025,
13075,
2336,
1027,
14176,
1012,
2131,
1006,
1000,
2336,
1000,
1007,
1025,
2065,
1006,
2336,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js | function (oModelData, oPage, sContentSuffix, oData) {
var that = this;
oModelData.data = DataUtils.formatData(oData, oModelData.fileType);
if (oModelData.fileType) {
return LRepConnector.getContent(oModelData.layer, sContentSuffix, true).then(
that._onContentMetadataReceived.bind(that, oModelData, oPage),
function () {
oPage.setBusy(false);
}
);
} else {
return Promise().resolve();
}
} | javascript | function (oModelData, oPage, sContentSuffix, oData) {
var that = this;
oModelData.data = DataUtils.formatData(oData, oModelData.fileType);
if (oModelData.fileType) {
return LRepConnector.getContent(oModelData.layer, sContentSuffix, true).then(
that._onContentMetadataReceived.bind(that, oModelData, oPage),
function () {
oPage.setBusy(false);
}
);
} else {
return Promise().resolve();
}
} | [
"function",
"(",
"oModelData",
",",
"oPage",
",",
"sContentSuffix",
",",
"oData",
")",
"{",
"var",
"that",
"=",
"this",
";",
"oModelData",
".",
"data",
"=",
"DataUtils",
".",
"formatData",
"(",
"oData",
",",
"oModelData",
".",
"fileType",
")",
";",
"if",... | Handler if content data was received;
Formats the received data into the correct file type and requests the file metadata.
@param {Object} oModelData - model data of current page
@param {Object} oPage - current page used to set display busy mode on/off
@param {Object} sContentSuffix - content suffix for sending the metadata request
@param {Object} oData - data which is received from <code>LRepConnector</code> "getContent" promise
@returns {Promise} - <code>LRepConnector</code> "getContent" promise
@private | [
"Handler",
"if",
"content",
"data",
"was",
"received",
";",
"Formats",
"the",
"received",
"data",
"into",
"the",
"correct",
"file",
"type",
"and",
"requests",
"the",
"file",
"metadata",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L100-L114 | train | This function is called when the content is received from the server | [
30522,
3853,
1006,
18168,
10244,
15150,
2696,
1010,
6728,
4270,
1010,
8040,
28040,
7666,
16093,
8873,
2595,
1010,
1051,
2850,
2696,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
18168,
10244,
15150,
2696,
1012,
2951,
1027,
2951,
21823,
4877,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function(aPromiseQueue, bThrowError, bAsync) {
if (aPromiseQueue.length === 0) {
if (bAsync) {
return Promise.resolve();
}
return new Utils.FakePromise();
}
var fnPromise = aPromiseQueue.shift();
if (typeof fnPromise === "function") {
try {
var vResult = fnPromise();
} catch (e) {
vResult = Promise.reject(e);
}
return vResult.then(function() {
if (!bAsync && vResult instanceof Promise) {
bAsync = true;
}
})
.catch(function(e) {
var sErrorMessage = "Error during execPromiseQueueSequentially processing occured";
sErrorMessage += e ? ": " + e.message : "";
this.log.error(sErrorMessage);
if (bThrowError) {
throw new Error(sErrorMessage);
}
}.bind(this))
.then(function() {
return this.execPromiseQueueSequentially(aPromiseQueue, bThrowError, bAsync);
}.bind(this));
} else {
this.log.error("Changes could not be applied, promise not wrapped inside function.");
return this.execPromiseQueueSequentially(aPromiseQueue, bThrowError, bAsync);
}
} | javascript | function(aPromiseQueue, bThrowError, bAsync) {
if (aPromiseQueue.length === 0) {
if (bAsync) {
return Promise.resolve();
}
return new Utils.FakePromise();
}
var fnPromise = aPromiseQueue.shift();
if (typeof fnPromise === "function") {
try {
var vResult = fnPromise();
} catch (e) {
vResult = Promise.reject(e);
}
return vResult.then(function() {
if (!bAsync && vResult instanceof Promise) {
bAsync = true;
}
})
.catch(function(e) {
var sErrorMessage = "Error during execPromiseQueueSequentially processing occured";
sErrorMessage += e ? ": " + e.message : "";
this.log.error(sErrorMessage);
if (bThrowError) {
throw new Error(sErrorMessage);
}
}.bind(this))
.then(function() {
return this.execPromiseQueueSequentially(aPromiseQueue, bThrowError, bAsync);
}.bind(this));
} else {
this.log.error("Changes could not be applied, promise not wrapped inside function.");
return this.execPromiseQueueSequentially(aPromiseQueue, bThrowError, bAsync);
}
} | [
"function",
"(",
"aPromiseQueue",
",",
"bThrowError",
",",
"bAsync",
")",
"{",
"if",
"(",
"aPromiseQueue",
".",
"length",
"===",
"0",
")",
"{",
"if",
"(",
"bAsync",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
")",
";",
"}",
"return",
"new",
"... | Execute the passed asynchronous / synchronous (Utils.FakePromise) functions serialized - one after the other.
By default errors do not break the sequential execution of the queue, but this can be changed with the parameter bThrowError.
Error message will be written in any case.
@param {array.<function>} aPromiseQueue - List of asynchronous functions that returns promises
@param {boolean} bThrowError - true: errors will be rethrown and therefore break the execution
@param {boolean} bAsync - true: asynchronous processing with Promise, false: synchronous processing with FakePromise
@returns {Promise} Returns empty resolved Promise or FakePromise when all passed promises inside functions have been executed | [
"Execute",
"the",
"passed",
"asynchronous",
"/",
"synchronous",
"(",
"Utils",
".",
"FakePromise",
")",
"functions",
"serialized",
"-",
"one",
"after",
"the",
"other",
".",
"By",
"default",
"errors",
"do",
"not",
"break",
"the",
"sequential",
"execution",
"of",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1287-L1326 | train | Execute a promise queue | [
30522,
3853,
1006,
19804,
20936,
3366,
4226,
5657,
1010,
18411,
8093,
25114,
29165,
1010,
19021,
6038,
2278,
1007,
1063,
2065,
1006,
19804,
20936,
3366,
4226,
5657,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2065,
1006,
19021,
6038,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/extensions/table/table.js | _changeWysiwygManagers | function _changeWysiwygManagers(wwComponentManager) {
wwComponentManager.removeManager('table');
wwComponentManager.removeManager('tableSelection');
wwComponentManager.addManager(WwMergedTableManager);
wwComponentManager.addManager(WwMergedTableSelectionManager);
} | javascript | function _changeWysiwygManagers(wwComponentManager) {
wwComponentManager.removeManager('table');
wwComponentManager.removeManager('tableSelection');
wwComponentManager.addManager(WwMergedTableManager);
wwComponentManager.addManager(WwMergedTableSelectionManager);
} | [
"function",
"_changeWysiwygManagers",
"(",
"wwComponentManager",
")",
"{",
"wwComponentManager",
".",
"removeManager",
"(",
"'table'",
")",
";",
"wwComponentManager",
".",
"removeManager",
"(",
"'tableSelection'",
")",
";",
"wwComponentManager",
".",
"addManager",
"(",
... | Change wysiwyg component managers.
@param {object} wwComponentManager - componentMananger instance
@private | [
"Change",
"wysiwyg",
"component",
"managers",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L65-L71 | train | Change the Wysiwyg Manager | [
30522,
3853,
1035,
2689,
18418,
5332,
18418,
25494,
17325,
2015,
1006,
1059,
16526,
25377,
5643,
3372,
24805,
4590,
1007,
1063,
1059,
16526,
25377,
5643,
3372,
24805,
4590,
1012,
6366,
24805,
4590,
1006,
1005,
2795,
1005,
1007,
1025,
1059,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js | _isComplexType | function _isComplexType (mProperty) {
if (mProperty && mProperty.type) {
if (mProperty.type.toLowerCase().indexOf("edm") !== 0) {
return true;
}
}
return false;
} | javascript | function _isComplexType (mProperty) {
if (mProperty && mProperty.type) {
if (mProperty.type.toLowerCase().indexOf("edm") !== 0) {
return true;
}
}
return false;
} | [
"function",
"_isComplexType",
"(",
"mProperty",
")",
"{",
"if",
"(",
"mProperty",
"&&",
"mProperty",
".",
"type",
")",
"{",
"if",
"(",
"mProperty",
".",
"type",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(",
"\"edm\"",
")",
"!==",
"0",
")",
"{",
... | Is field using a complex type
@param {Object} mProperty - property from entityType
@returns {Boolean} - Returns true if property is using a complex type | [
"Is",
"field",
"using",
"a",
"complex",
"type"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L52-L59 | train | Check if the property is a complex type | [
30522,
3853,
1035,
2003,
9006,
19386,
13874,
1006,
6131,
18981,
15010,
1007,
1063,
2065,
1006,
6131,
18981,
15010,
1004,
1004,
6131,
18981,
15010,
1012,
2828,
1007,
1063,
2065,
1006,
6131,
18981,
15010,
1012,
2828,
1012,
2000,
27663,
18992,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Freeboard/freeboard | js/freeboard.thirdparty.js | function(event) {
var date,
inst = $.datepicker._getInst(event.target);
if (inst.input.val() !== inst.lastVal) {
try {
date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}
}
catch (err) {
}
}
return true;
} | javascript | function(event) {
var date,
inst = $.datepicker._getInst(event.target);
if (inst.input.val() !== inst.lastVal) {
try {
date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}
}
catch (err) {
}
}
return true;
} | [
"function",
"(",
"event",
")",
"{",
"var",
"date",
",",
"inst",
"=",
"$",
".",
"datepicker",
".",
"_getInst",
"(",
"event",
".",
"target",
")",
";",
"if",
"(",
"inst",
".",
"input",
".",
"val",
"(",
")",
"!==",
"inst",
".",
"lastVal",
")",
"{",
... | /* Synchronise manual entry and field/alternate field. | [
"/",
"*",
"Synchronise",
"manual",
"entry",
"and",
"field",
"/",
"alternate",
"field",
"."
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L8271-L8291 | train | This function is called when the date field is changed | [
30522,
3853,
1006,
2724,
1007,
1063,
13075,
3058,
1010,
16021,
2102,
1027,
1002,
1012,
3058,
24330,
5484,
1012,
1035,
2131,
7076,
2102,
1006,
2724,
1012,
4539,
1007,
1025,
2065,
1006,
16021,
2102,
1012,
7953,
1012,
11748,
1006,
1007,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/components/raycaster.js | function () {
var data = this.data;
var els;
// If objects not defined, intersect with everything.
els = data.objects
? this.el.sceneEl.querySelectorAll(data.objects)
: this.el.sceneEl.querySelectorAll('*');
this.objects = this.flattenObject3DMaps(els);
this.dirty = false;
} | javascript | function () {
var data = this.data;
var els;
// If objects not defined, intersect with everything.
els = data.objects
? this.el.sceneEl.querySelectorAll(data.objects)
: this.el.sceneEl.querySelectorAll('*');
this.objects = this.flattenObject3DMaps(els);
this.dirty = false;
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"els",
";",
"// If objects not defined, intersect with everything.",
"els",
"=",
"data",
".",
"objects",
"?",
"this",
".",
"el",
".",
"sceneEl",
".",
"querySelectorAll",
"(",
"da... | Update list of objects to test for intersection. | [
"Update",
"list",
"of",
"objects",
"to",
"test",
"for",
"intersection",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/raycaster.js#L172-L182 | train | flatten objects in the object3D map | [
30522,
3853,
1006,
1007,
1063,
13075,
2951,
1027,
2023,
1012,
2951,
1025,
13075,
3449,
2015,
1025,
1013,
1013,
2065,
5200,
2025,
4225,
1010,
29261,
2007,
2673,
1012,
3449,
2015,
1027,
2951,
1012,
30524,
2023,
1012,
3449,
1012,
3496,
2884,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
lovell/sharp | lib/output.js | _pipeline | function _pipeline (callback) {
const that = this;
if (typeof callback === 'function') {
// output=file/buffer
if (this._isStreamInput()) {
// output=file/buffer, input=stream
this.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, callback);
});
} else {
// output=file/buffer, input=file/buffer
sharp.pipeline(this.options, callback);
}
return this;
} else if (this.options.streamOut) {
// output=stream
if (this._isStreamInput()) {
// output=stream, input=stream
if (this.streamInFinished) {
this._flattenBufferIn();
sharp.pipeline(this.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
} else {
this.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
});
}
} else {
// output=stream, input=file/buffer
sharp.pipeline(this.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
}
return this;
} else {
// output=promise
if (this._isStreamInput()) {
// output=promise, input=stream
return new Promise(function (resolve, reject) {
that.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
reject(err);
} else {
if (that.options.resolveWithObject) {
resolve({ data: data, info: info });
} else {
resolve(data);
}
}
});
});
});
} else {
// output=promise, input=file/buffer
return new Promise(function (resolve, reject) {
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
reject(err);
} else {
if (that.options.resolveWithObject) {
resolve({ data: data, info: info });
} else {
resolve(data);
}
}
});
});
}
}
} | javascript | function _pipeline (callback) {
const that = this;
if (typeof callback === 'function') {
// output=file/buffer
if (this._isStreamInput()) {
// output=file/buffer, input=stream
this.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, callback);
});
} else {
// output=file/buffer, input=file/buffer
sharp.pipeline(this.options, callback);
}
return this;
} else if (this.options.streamOut) {
// output=stream
if (this._isStreamInput()) {
// output=stream, input=stream
if (this.streamInFinished) {
this._flattenBufferIn();
sharp.pipeline(this.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
} else {
this.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
});
}
} else {
// output=stream, input=file/buffer
sharp.pipeline(this.options, function (err, data, info) {
if (err) {
that.emit('error', err);
} else {
that.emit('info', info);
that.push(data);
}
that.push(null);
});
}
return this;
} else {
// output=promise
if (this._isStreamInput()) {
// output=promise, input=stream
return new Promise(function (resolve, reject) {
that.on('finish', function () {
that._flattenBufferIn();
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
reject(err);
} else {
if (that.options.resolveWithObject) {
resolve({ data: data, info: info });
} else {
resolve(data);
}
}
});
});
});
} else {
// output=promise, input=file/buffer
return new Promise(function (resolve, reject) {
sharp.pipeline(that.options, function (err, data, info) {
if (err) {
reject(err);
} else {
if (that.options.resolveWithObject) {
resolve({ data: data, info: info });
} else {
resolve(data);
}
}
});
});
}
}
} | [
"function",
"_pipeline",
"(",
"callback",
")",
"{",
"const",
"that",
"=",
"this",
";",
"if",
"(",
"typeof",
"callback",
"===",
"'function'",
")",
"{",
"// output=file/buffer",
"if",
"(",
"this",
".",
"_isStreamInput",
"(",
")",
")",
"{",
"// output=file/buff... | Invoke the C++ image processing pipeline
Supports callback, stream and promise variants
@private | [
"Invoke",
"the",
"C",
"++",
"image",
"processing",
"pipeline",
"Supports",
"callback",
"stream",
"and",
"promise",
"variants"
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L613-L707 | train | Pipes the image into a single file | [
30522,
3853,
1035,
13117,
1006,
2655,
5963,
1007,
1063,
9530,
3367,
2008,
1027,
2023,
1025,
2065,
1006,
2828,
11253,
2655,
5963,
1027,
1027,
1027,
1005,
3853,
1005,
1007,
1063,
1013,
1013,
6434,
1027,
5371,
1013,
17698,
2065,
1006,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/services/apps/loader.js | function (name) {
const {app, proxy} = getAppByName(name);
// Check for an activate() method on the app.
if (!_.isFunction(app.activate)) {
return Promise.reject(new Error(common.i18n.t('errors.apps.noActivateMethodLoadingApp.error', {name: name})));
}
// Wrapping the activate() with a when because it's possible
// to not return a promise from it.
return Promise.resolve(app.activate(proxy)).return(app);
} | javascript | function (name) {
const {app, proxy} = getAppByName(name);
// Check for an activate() method on the app.
if (!_.isFunction(app.activate)) {
return Promise.reject(new Error(common.i18n.t('errors.apps.noActivateMethodLoadingApp.error', {name: name})));
}
// Wrapping the activate() with a when because it's possible
// to not return a promise from it.
return Promise.resolve(app.activate(proxy)).return(app);
} | [
"function",
"(",
"name",
")",
"{",
"const",
"{",
"app",
",",
"proxy",
"}",
"=",
"getAppByName",
"(",
"name",
")",
";",
"// Check for an activate() method on the app.",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"app",
".",
"activate",
")",
")",
"{",
"r... | Activate a app and return it | [
"Activate",
"a",
"app",
"and",
"return",
"it"
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/apps/loader.js#L33-L44 | train | Load an app | [
30522,
3853,
1006,
2171,
1007,
1063,
9530,
3367,
1063,
10439,
1010,
24540,
1065,
1027,
2131,
29098,
3762,
18442,
1006,
2171,
1007,
1025,
1013,
1013,
4638,
2005,
2019,
20544,
1006,
1007,
4118,
2006,
1996,
10439,
1012,
2065,
1006,
999,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/addons.js | addonsManager_getAddonRadiogroup | function addonsManager_getAddonRadiogroup(aSpec) {
var spec = aSpec || { };
var addon = spec.addon;
var radiogroup = spec.radiogroup;
if (!radiogroup)
throw new Error(arguments.callee.name + ": Radiogroup not specified.");
return this.getAddonChildElement({addon: addon, type: radiogroup + "Radiogroup"});
} | javascript | function addonsManager_getAddonRadiogroup(aSpec) {
var spec = aSpec || { };
var addon = spec.addon;
var radiogroup = spec.radiogroup;
if (!radiogroup)
throw new Error(arguments.callee.name + ": Radiogroup not specified.");
return this.getAddonChildElement({addon: addon, type: radiogroup + "Radiogroup"});
} | [
"function",
"addonsManager_getAddonRadiogroup",
"(",
"aSpec",
")",
"{",
"var",
"spec",
"=",
"aSpec",
"||",
"{",
"}",
";",
"var",
"addon",
"=",
"spec",
".",
"addon",
";",
"var",
"radiogroup",
"=",
"spec",
".",
"radiogroup",
";",
"if",
"(",
"!",
"radiogrou... | Returns the element of the specified add-ons radio group
@param {object} aSpec
Information on which add-on to operate on
Elements: addon - Add-on element
radiogroup - Radiogroup
Detail View (autoUpdate)
@returns Add-on radiogroup
@type {ElemBase} | [
"Returns",
"the",
"element",
"of",
"the",
"specified",
"add",
"-",
"ons",
"radio",
"group"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L507-L516 | train | Get the element of the specified add - ons radiogroup | [
30522,
3853,
5587,
5644,
24805,
4590,
1035,
2131,
4215,
5280,
12173,
3695,
17058,
1006,
2004,
5051,
2278,
1007,
1063,
13075,
28699,
1027,
2004,
5051,
2278,
1064,
1064,
1063,
1065,
1025,
13075,
5587,
2239,
1027,
28699,
1012,
5587,
2239,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fex-team/webuploader | dist/webuploader.withoutimage.js | WUFile | function WUFile( source ) {
/**
* 文件名,包括扩展名(后缀)
* @property name
* @type {string}
*/
this.name = source.name || 'Untitled';
/**
* 文件体积(字节)
* @property size
* @type {uint}
* @default 0
*/
this.size = source.size || 0;
/**
* 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny)
* @property type
* @type {string}
* @default 'application/octet-stream'
*/
this.type = source.type || 'application/octet-stream';
/**
* 文件最后修改日期
* @property lastModifiedDate
* @type {int}
* @default 当前时间戳
*/
this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1);
/**
* 文件ID,每个对象具有唯一ID,与文件名无关
* @property id
* @type {string}
*/
this.id = gid();
/**
* 文件扩展名,通过文件名获取,例如test.png的扩展名为png
* @property ext
* @type {string}
*/
this.ext = rExt.exec( this.name ) ? RegExp.$1 : '';
/**
* 状态文字说明。在不同的status语境下有不同的用途。
* @property statusText
* @type {string}
*/
this.statusText = '';
// 存储文件状态,防止通过属性直接修改
statusMap[ this.id ] = WUFile.Status.INITED;
this.source = source;
this.loaded = 0;
this.on( 'error', function( msg ) {
this.setStatus( WUFile.Status.ERROR, msg );
});
} | javascript | function WUFile( source ) {
/**
* 文件名,包括扩展名(后缀)
* @property name
* @type {string}
*/
this.name = source.name || 'Untitled';
/**
* 文件体积(字节)
* @property size
* @type {uint}
* @default 0
*/
this.size = source.size || 0;
/**
* 文件MIMETYPE类型,与文件类型的对应关系请参考[http://t.cn/z8ZnFny](http://t.cn/z8ZnFny)
* @property type
* @type {string}
* @default 'application/octet-stream'
*/
this.type = source.type || 'application/octet-stream';
/**
* 文件最后修改日期
* @property lastModifiedDate
* @type {int}
* @default 当前时间戳
*/
this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1);
/**
* 文件ID,每个对象具有唯一ID,与文件名无关
* @property id
* @type {string}
*/
this.id = gid();
/**
* 文件扩展名,通过文件名获取,例如test.png的扩展名为png
* @property ext
* @type {string}
*/
this.ext = rExt.exec( this.name ) ? RegExp.$1 : '';
/**
* 状态文字说明。在不同的status语境下有不同的用途。
* @property statusText
* @type {string}
*/
this.statusText = '';
// 存储文件状态,防止通过属性直接修改
statusMap[ this.id ] = WUFile.Status.INITED;
this.source = source;
this.loaded = 0;
this.on( 'error', function( msg ) {
this.setStatus( WUFile.Status.ERROR, msg );
});
} | [
"function",
"WUFile",
"(",
"source",
")",
"{",
"/**\n * 文件名,包括扩展名(后缀)\n * @property name\n * @type {string}\n */",
"this",
".",
"name",
"=",
"source",
".",
"name",
"||",
"'Untitled'",
";",
"/**\n * 文件体积(字节)\n *... | 文件类
@class File
@constructor 构造函数
@grammar new File( source ) => File
@param {Lib.File} source [lib.File](#Lib.File)实例, 此source对象是带有Runtime信息的。 | [
"文件类"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L1978-L2042 | train | WUFile constructor. | [
30522,
3853,
8814,
8873,
2571,
1006,
3120,
1007,
1063,
1013,
1008,
1008,
1008,
1861,
100,
1795,
1989,
100,
100,
100,
100,
1795,
1987,
100,
100,
1988,
1008,
1030,
3200,
2171,
1008,
1030,
2828,
1063,
5164,
1065,
1008,
1013,
2023,
1012,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | examples/node/static_codegen/greeter_server.js | sayHello | function sayHello(call, callback) {
var reply = new messages.HelloReply();
reply.setMessage('Hello ' + call.request.getName());
callback(null, reply);
} | javascript | function sayHello(call, callback) {
var reply = new messages.HelloReply();
reply.setMessage('Hello ' + call.request.getName());
callback(null, reply);
} | [
"function",
"sayHello",
"(",
"call",
",",
"callback",
")",
"{",
"var",
"reply",
"=",
"new",
"messages",
".",
"HelloReply",
"(",
")",
";",
"reply",
".",
"setMessage",
"(",
"'Hello '",
"+",
"call",
".",
"request",
".",
"getName",
"(",
")",
")",
";",
"c... | Implements the SayHello RPC method. | [
"Implements",
"the",
"SayHello",
"RPC",
"method",
"."
] | cc75d93818410e2b0edd0fa3009a6def9ac403ca | https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/static_codegen/greeter_server.js#L27-L31 | train | sayHello - Sends a message to the client | [
30522,
3853,
2360,
18223,
2080,
1006,
2655,
1010,
2655,
5963,
1007,
1063,
13075,
7514,
1027,
2047,
7696,
1012,
7592,
2890,
22086,
1006,
1007,
1025,
7514,
1012,
2275,
7834,
3736,
3351,
1006,
1005,
7592,
1005,
1009,
2655,
1012,
5227,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
postcss/autoprefixer | lib/prefixer.js | clone | function clone (obj, parent) {
let cloned = new obj.constructor()
for (let i of Object.keys(obj || {})) {
let value = obj[i]
if (i === 'parent' && typeof value === 'object') {
if (parent) {
cloned[i] = parent
}
} else if (i === 'source' || i === null) {
cloned[i] = value
} else if (value instanceof Array) {
cloned[i] = value.map(x => clone(x, cloned))
} else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
if (typeof value === 'object' && value !== null) {
value = clone(value, cloned)
}
cloned[i] = value
}
}
return cloned
} | javascript | function clone (obj, parent) {
let cloned = new obj.constructor()
for (let i of Object.keys(obj || {})) {
let value = obj[i]
if (i === 'parent' && typeof value === 'object') {
if (parent) {
cloned[i] = parent
}
} else if (i === 'source' || i === null) {
cloned[i] = value
} else if (value instanceof Array) {
cloned[i] = value.map(x => clone(x, cloned))
} else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
if (typeof value === 'object' && value !== null) {
value = clone(value, cloned)
}
cloned[i] = value
}
}
return cloned
} | [
"function",
"clone",
"(",
"obj",
",",
"parent",
")",
"{",
"let",
"cloned",
"=",
"new",
"obj",
".",
"constructor",
"(",
")",
"for",
"(",
"let",
"i",
"of",
"Object",
".",
"keys",
"(",
"obj",
"||",
"{",
"}",
")",
")",
"{",
"let",
"value",
"=",
"ob... | Recursively clone objects | [
"Recursively",
"clone",
"objects"
] | 24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32 | https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/prefixer.js#L9-L31 | train | Clone an object | [
30522,
3853,
17598,
1006,
27885,
3501,
1010,
6687,
1007,
1063,
2292,
17598,
2094,
1027,
2047,
27885,
3501,
1012,
9570,
2953,
1006,
1007,
2005,
1006,
2292,
1045,
1997,
4874,
1012,
6309,
1006,
27885,
3501,
1064,
1064,
1063,
1065,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/library.support.js | checkColumnTemplate | function checkColumnTemplate(fnDoCheck, oScope, sType) {
var aTables = SupportHelper.find(oScope, true, "sap.ui.table.Table");
var aColumns, oTemplate;
for (var i = 0; i < aTables.length; i++) {
aColumns = aTables[i].getColumns();
for (var k = 0; k < aColumns.length; k++) {
oTemplate = aColumns[k].getTemplate();
if (oTemplate && oTemplate.isA(sType)) {
fnDoCheck(aTables[i], aColumns[k], oTemplate);
}
}
}
} | javascript | function checkColumnTemplate(fnDoCheck, oScope, sType) {
var aTables = SupportHelper.find(oScope, true, "sap.ui.table.Table");
var aColumns, oTemplate;
for (var i = 0; i < aTables.length; i++) {
aColumns = aTables[i].getColumns();
for (var k = 0; k < aColumns.length; k++) {
oTemplate = aColumns[k].getTemplate();
if (oTemplate && oTemplate.isA(sType)) {
fnDoCheck(aTables[i], aColumns[k], oTemplate);
}
}
}
} | [
"function",
"checkColumnTemplate",
"(",
"fnDoCheck",
",",
"oScope",
",",
"sType",
")",
"{",
"var",
"aTables",
"=",
"SupportHelper",
".",
"find",
"(",
"oScope",
",",
"true",
",",
"\"sap.ui.table.Table\"",
")",
";",
"var",
"aColumns",
",",
"oTemplate",
";",
"f... | ********************************************************** Helpers related to sap.ui.table Controls **********************************************************
Loops over all columns of all visible tables and calls the given callback with the following parameters:
table instance, column instance, column template instance.
If the column does not have a template or a type is given and the template is not of this type the callback is not called.
@param {function} fnDoCheck Callback
@param {object} oScope The scope as given in the rule check function.
@param {string} [sType] If given an additional type check is performed. | [
"**********************************************************",
"Helpers",
"related",
"to",
"sap",
".",
"ui",
".",
"table",
"Controls",
"**********************************************************",
"Loops",
"over",
"all",
"columns",
"of",
"all",
"visible",
"tables",
"and",
"cal... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/library.support.js#L53-L65 | train | Checks if the template of the columns of the table is a type | [
30522,
3853,
4638,
25778,
2819,
10111,
8737,
13806,
1006,
1042,
15482,
5403,
3600,
1010,
9808,
16186,
1010,
2358,
18863,
1007,
1063,
13075,
29533,
13510,
1027,
2490,
16001,
4842,
1012,
2424,
1006,
9808,
16186,
1010,
2995,
1010,
1000,
20066,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/KeyBindingManager.js | _handleKeyEvent | function _handleKeyEvent(event) {
var i, handled = false;
for (i = _globalKeydownHooks.length - 1; i >= 0; i--) {
if (_globalKeydownHooks[i](event)) {
handled = true;
break;
}
}
_detectAltGrKeyDown(event);
if (!handled && _handleKey(_translateKeyboardEvent(event))) {
event.stopPropagation();
event.preventDefault();
}
} | javascript | function _handleKeyEvent(event) {
var i, handled = false;
for (i = _globalKeydownHooks.length - 1; i >= 0; i--) {
if (_globalKeydownHooks[i](event)) {
handled = true;
break;
}
}
_detectAltGrKeyDown(event);
if (!handled && _handleKey(_translateKeyboardEvent(event))) {
event.stopPropagation();
event.preventDefault();
}
} | [
"function",
"_handleKeyEvent",
"(",
"event",
")",
"{",
"var",
"i",
",",
"handled",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"_globalKeydownHooks",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"_globalKeydownHooks... | Handles a given keydown event, checking global hooks first before
deciding to handle it ourselves.
@param {Event} The keydown event to handle. | [
"Handles",
"a",
"given",
"keydown",
"event",
"checking",
"global",
"hooks",
"first",
"before",
"deciding",
"to",
"handle",
"it",
"ourselves",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L976-L989 | train | Handle keydown events | [
30522,
3853,
1035,
5047,
14839,
18697,
3372,
1006,
2724,
1007,
1063,
13075,
1045,
1010,
8971,
1027,
6270,
1025,
2005,
1006,
1045,
1027,
1035,
3795,
14839,
7698,
6806,
6559,
2015,
1012,
3091,
1011,
1015,
1025,
1045,
1028,
1027,
1014,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/menu/js/menuServiceProvider.js | showBackdrop | function showBackdrop(scope, element, options) {
if (options.nestLevel) return angular.noop;
// If we are not within a dialog...
if (options.disableParentScroll && !$mdUtil.getClosest(options.target, 'MD-DIALOG')) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(options.element, options.parent);
} else {
options.disableParentScroll = false;
}
if (options.hasBackdrop) {
options.backdrop = $mdUtil.createBackdrop(scope, "md-menu-backdrop md-click-catcher");
$animate.enter(options.backdrop, $document[0].body);
}
/**
* Hide and destroys the backdrop created by showBackdrop()
*/
return function hideBackdrop() {
if (options.backdrop) options.backdrop.remove();
if (options.disableParentScroll) options.restoreScroll();
};
} | javascript | function showBackdrop(scope, element, options) {
if (options.nestLevel) return angular.noop;
// If we are not within a dialog...
if (options.disableParentScroll && !$mdUtil.getClosest(options.target, 'MD-DIALOG')) {
// !! DO this before creating the backdrop; since disableScrollAround()
// configures the scroll offset; which is used by mdBackDrop postLink()
options.restoreScroll = $mdUtil.disableScrollAround(options.element, options.parent);
} else {
options.disableParentScroll = false;
}
if (options.hasBackdrop) {
options.backdrop = $mdUtil.createBackdrop(scope, "md-menu-backdrop md-click-catcher");
$animate.enter(options.backdrop, $document[0].body);
}
/**
* Hide and destroys the backdrop created by showBackdrop()
*/
return function hideBackdrop() {
if (options.backdrop) options.backdrop.remove();
if (options.disableParentScroll) options.restoreScroll();
};
} | [
"function",
"showBackdrop",
"(",
"scope",
",",
"element",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"nestLevel",
")",
"return",
"angular",
".",
"noop",
";",
"// If we are not within a dialog...",
"if",
"(",
"options",
".",
"disableParentScroll",
"&&",... | Show modal backdrop element...
@returns {function(): void} A function that removes this backdrop | [
"Show",
"modal",
"backdrop",
"element",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L47-L72 | train | Show the backdrop | [
30522,
3853,
2265,
5963,
25711,
1006,
9531,
1010,
5783,
1010,
7047,
1007,
1063,
2065,
1006,
7047,
1012,
9089,
20414,
2884,
1007,
2709,
16108,
1012,
2053,
7361,
1025,
1013,
1013,
2065,
2057,
2024,
2025,
2306,
1037,
13764,
8649,
1012,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/custom.js | style | function style(extra, dataIndexInside) {
dataIndexInside == null && (dataIndexInside = currDataIndexInside);
updateCache(dataIndexInside);
var itemStyle = currItemModel.getModel(ITEM_STYLE_NORMAL_PATH).getItemStyle();
currVisualColor != null && (itemStyle.fill = currVisualColor);
var opacity = data.getItemVisual(dataIndexInside, 'opacity');
opacity != null && (itemStyle.opacity = opacity);
graphicUtil.setTextStyle(itemStyle, currLabelNormalModel, null, {
autoColor: currVisualColor,
isRectText: true
});
itemStyle.text = currLabelNormalModel.getShallow('show')
? zrUtil.retrieve2(
customSeries.getFormattedLabel(dataIndexInside, 'normal'),
getDefaultLabel(data, dataIndexInside)
)
: null;
extra && zrUtil.extend(itemStyle, extra);
return itemStyle;
} | javascript | function style(extra, dataIndexInside) {
dataIndexInside == null && (dataIndexInside = currDataIndexInside);
updateCache(dataIndexInside);
var itemStyle = currItemModel.getModel(ITEM_STYLE_NORMAL_PATH).getItemStyle();
currVisualColor != null && (itemStyle.fill = currVisualColor);
var opacity = data.getItemVisual(dataIndexInside, 'opacity');
opacity != null && (itemStyle.opacity = opacity);
graphicUtil.setTextStyle(itemStyle, currLabelNormalModel, null, {
autoColor: currVisualColor,
isRectText: true
});
itemStyle.text = currLabelNormalModel.getShallow('show')
? zrUtil.retrieve2(
customSeries.getFormattedLabel(dataIndexInside, 'normal'),
getDefaultLabel(data, dataIndexInside)
)
: null;
extra && zrUtil.extend(itemStyle, extra);
return itemStyle;
} | [
"function",
"style",
"(",
"extra",
",",
"dataIndexInside",
")",
"{",
"dataIndexInside",
"==",
"null",
"&&",
"(",
"dataIndexInside",
"=",
"currDataIndexInside",
")",
";",
"updateCache",
"(",
"dataIndexInside",
")",
";",
"var",
"itemStyle",
"=",
"currItemModel",
"... | By default, `visual` is applied to style (to support visualMap).
`visual.color` is applied at `fill`. If user want apply visual.color on `stroke`,
it can be implemented as:
`api.style({stroke: api.visual('color'), fill: null})`;
@public
@param {Object} [extra]
@param {number} [dataIndexInside=currDataIndexInside] | [
"By",
"default",
"visual",
"is",
"applied",
"to",
"style",
"(",
"to",
"support",
"visualMap",
")",
".",
"visual",
".",
"color",
"is",
"applied",
"at",
"fill",
".",
"If",
"user",
"want",
"apply",
"visual",
".",
"color",
"on",
"stroke",
"it",
"can",
"be"... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/custom.js#L444-L468 | train | Returns the style for the item | [
30522,
3853,
2806,
1006,
4469,
1010,
2951,
22254,
10288,
7076,
5178,
1007,
1063,
2951,
22254,
10288,
7076,
5178,
1027,
1027,
19701,
1004,
1004,
1006,
2951,
22254,
10288,
7076,
5178,
1027,
12731,
12171,
2850,
18249,
3207,
20303,
7363,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MithrilJS/mithril.js | render/render.js | updateNodes | function updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {
if (old === vnodes || old == null && vnodes == null) return
else if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
else if (vnodes == null || vnodes.length === 0) removeNodes(old, 0, old.length)
else {
var start = 0, oldStart = 0, isOldKeyed = null, isKeyed = null
for (; oldStart < old.length; oldStart++) {
if (old[oldStart] != null) {
isOldKeyed = old[oldStart].key != null
break
}
}
for (; start < vnodes.length; start++) {
if (vnodes[start] != null) {
isKeyed = vnodes[start].key != null
break
}
}
if (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls
if (isOldKeyed !== isKeyed) {
removeNodes(old, oldStart, old.length)
createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
} else if (!isKeyed) {
// Don't index past the end of either list (causes deopts).
var commonLength = old.length < vnodes.length ? old.length : vnodes.length
// Rewind if necessary to the first non-null index on either side.
// We could alternatively either explicitly create or remove nodes when `start !== oldStart`
// but that would be optimizing for sparse lists which are more rare than dense ones.
start = start < oldStart ? start : oldStart
for (; start < commonLength; start++) {
o = old[start]
v = vnodes[start]
if (o === v || o == null && v == null) continue
else if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))
else if (v == null) removeNode(o)
else updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)
}
if (old.length > commonLength) removeNodes(old, start, old.length)
if (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
} else {
// keyed diff
var oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling
// bottom-up
while (oldEnd >= oldStart && end >= start) {
oe = old[oldEnd]
ve = vnodes[end]
if (oe == null) oldEnd--
else if (ve == null) end--
else if (oe.key === ve.key) {
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldEnd--, end--
} else {
break
}
}
// top-down
while (oldEnd >= oldStart && end >= start) {
o = old[oldStart]
v = vnodes[start]
if (o == null) oldStart++
else if (v == null) start++
else if (o.key === v.key) {
oldStart++, start++
if (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)
} else {
break
}
}
// swaps and list reversals
while (oldEnd >= oldStart && end >= start) {
if (o == null) oldStart++
else if (v == null) start++
else if (oe == null) oldEnd--
else if (ve == null) end--
else if (start === end) break
else {
if (o.key !== ve.key || oe.key !== v.key) break
topSibling = getNextSibling(old, oldStart, nextSibling)
insertNode(parent, toFragment(oe), topSibling)
if (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)
if (++start <= --end) insertNode(parent, toFragment(o), nextSibling)
if (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldStart++; oldEnd--
}
oe = old[oldEnd]
ve = vnodes[end]
o = old[oldStart]
v = vnodes[start]
}
// bottom up once again
while (oldEnd >= oldStart && end >= start) {
if (oe == null) oldEnd--
else if (ve == null) end--
else if (oe.key === ve.key) {
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldEnd--, end--
} else {
break
}
oe = old[oldEnd]
ve = vnodes[end]
}
if (start > end) removeNodes(old, oldStart, oldEnd + 1)
else if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
else {
// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul
var originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices
for (i = 0; i < vnodesLength; i++) oldIndices[i] = -1
for (i = end; i >= start; i--) {
if (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)
ve = vnodes[i]
if (ve != null) {
var oldIndex = map[ve.key]
if (oldIndex != null) {
pos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered
oldIndices[i-start] = oldIndex
oe = old[oldIndex]
old[oldIndex] = null
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
matched++
}
}
}
nextSibling = originalNextSibling
if (matched !== oldEnd - oldStart + 1) removeNodes(old, oldStart, oldEnd + 1)
if (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
else {
if (pos === -1) {
// the indices of the indices of the items that are part of the
// longest increasing subsequence in the oldIndices list
lisIndices = makeLisIndices(oldIndices)
li = lisIndices.length - 1
for (i = end; i >= start; i--) {
v = vnodes[i]
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
else {
if (lisIndices[li] === i - start) li--
else insertNode(parent, toFragment(v), nextSibling)
}
if (v.dom != null) nextSibling = vnodes[i].dom
}
} else {
for (i = end; i >= start; i--) {
v = vnodes[i]
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
if (v.dom != null) nextSibling = vnodes[i].dom
}
}
}
}
}
}
} | javascript | function updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {
if (old === vnodes || old == null && vnodes == null) return
else if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)
else if (vnodes == null || vnodes.length === 0) removeNodes(old, 0, old.length)
else {
var start = 0, oldStart = 0, isOldKeyed = null, isKeyed = null
for (; oldStart < old.length; oldStart++) {
if (old[oldStart] != null) {
isOldKeyed = old[oldStart].key != null
break
}
}
for (; start < vnodes.length; start++) {
if (vnodes[start] != null) {
isKeyed = vnodes[start].key != null
break
}
}
if (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls
if (isOldKeyed !== isKeyed) {
removeNodes(old, oldStart, old.length)
createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
} else if (!isKeyed) {
// Don't index past the end of either list (causes deopts).
var commonLength = old.length < vnodes.length ? old.length : vnodes.length
// Rewind if necessary to the first non-null index on either side.
// We could alternatively either explicitly create or remove nodes when `start !== oldStart`
// but that would be optimizing for sparse lists which are more rare than dense ones.
start = start < oldStart ? start : oldStart
for (; start < commonLength; start++) {
o = old[start]
v = vnodes[start]
if (o === v || o == null && v == null) continue
else if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))
else if (v == null) removeNode(o)
else updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)
}
if (old.length > commonLength) removeNodes(old, start, old.length)
if (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)
} else {
// keyed diff
var oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling
// bottom-up
while (oldEnd >= oldStart && end >= start) {
oe = old[oldEnd]
ve = vnodes[end]
if (oe == null) oldEnd--
else if (ve == null) end--
else if (oe.key === ve.key) {
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldEnd--, end--
} else {
break
}
}
// top-down
while (oldEnd >= oldStart && end >= start) {
o = old[oldStart]
v = vnodes[start]
if (o == null) oldStart++
else if (v == null) start++
else if (o.key === v.key) {
oldStart++, start++
if (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)
} else {
break
}
}
// swaps and list reversals
while (oldEnd >= oldStart && end >= start) {
if (o == null) oldStart++
else if (v == null) start++
else if (oe == null) oldEnd--
else if (ve == null) end--
else if (start === end) break
else {
if (o.key !== ve.key || oe.key !== v.key) break
topSibling = getNextSibling(old, oldStart, nextSibling)
insertNode(parent, toFragment(oe), topSibling)
if (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)
if (++start <= --end) insertNode(parent, toFragment(o), nextSibling)
if (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldStart++; oldEnd--
}
oe = old[oldEnd]
ve = vnodes[end]
o = old[oldStart]
v = vnodes[start]
}
// bottom up once again
while (oldEnd >= oldStart && end >= start) {
if (oe == null) oldEnd--
else if (ve == null) end--
else if (oe.key === ve.key) {
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
oldEnd--, end--
} else {
break
}
oe = old[oldEnd]
ve = vnodes[end]
}
if (start > end) removeNodes(old, oldStart, oldEnd + 1)
else if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
else {
// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul
var originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices
for (i = 0; i < vnodesLength; i++) oldIndices[i] = -1
for (i = end; i >= start; i--) {
if (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)
ve = vnodes[i]
if (ve != null) {
var oldIndex = map[ve.key]
if (oldIndex != null) {
pos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered
oldIndices[i-start] = oldIndex
oe = old[oldIndex]
old[oldIndex] = null
if (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)
if (ve.dom != null) nextSibling = ve.dom
matched++
}
}
}
nextSibling = originalNextSibling
if (matched !== oldEnd - oldStart + 1) removeNodes(old, oldStart, oldEnd + 1)
if (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)
else {
if (pos === -1) {
// the indices of the indices of the items that are part of the
// longest increasing subsequence in the oldIndices list
lisIndices = makeLisIndices(oldIndices)
li = lisIndices.length - 1
for (i = end; i >= start; i--) {
v = vnodes[i]
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
else {
if (lisIndices[li] === i - start) li--
else insertNode(parent, toFragment(v), nextSibling)
}
if (v.dom != null) nextSibling = vnodes[i].dom
}
} else {
for (i = end; i >= start; i--) {
v = vnodes[i]
if (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)
if (v.dom != null) nextSibling = vnodes[i].dom
}
}
}
}
}
}
} | [
"function",
"updateNodes",
"(",
"parent",
",",
"old",
",",
"vnodes",
",",
"hooks",
",",
"nextSibling",
",",
"ns",
")",
"{",
"if",
"(",
"old",
"===",
"vnodes",
"||",
"old",
"==",
"null",
"&&",
"vnodes",
"==",
"null",
")",
"return",
"else",
"if",
"(",
... | ## DOM node moves In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However, this is not the case if the node moved (second and fourth part of the diff algo). We move the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling` variable rather than fetching it using `getNextSibling()`. The fourth part of the diff currently inserts nodes unconditionally, leading to issues like #1791 and #1999. We need to be smarter about those situations where adjascent old nodes remain together in the new list in a way that isn't covered by parts one and three of the diff algo. | [
"##",
"DOM",
"node",
"moves",
"In",
"most",
"scenarios",
"updateNode",
"()",
"and",
"createNode",
"()",
"perform",
"the",
"DOM",
"operations",
".",
"However",
"this",
"is",
"not",
"the",
"case",
"if",
"the",
"node",
"moved",
"(",
"second",
"and",
"fourth",... | 6d36fe09d129928c6b460720e08d9ed321fcd62b | https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/render/render.js#L277-L434 | train | Updates the nodes in the node list. | [
30522,
3853,
10651,
3630,
6155,
1006,
6687,
1010,
2214,
1010,
1058,
3630,
6155,
1010,
18008,
1010,
2279,
5332,
9709,
1010,
24978,
1007,
1063,
2065,
1006,
2214,
1027,
1027,
1027,
1058,
3630,
6155,
1064,
1064,
2214,
1027,
1027,
19701,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
heyui/heyui | src/plugins/popper/index.js | setAttributes | function setAttributes(element, attributes) {
Object.keys(attributes).forEach(function (prop) {
var value = attributes[prop];
if (value !== false) {
element.setAttribute(prop, attributes[prop]);
} else {
element.removeAttribute(prop);
}
});
} | javascript | function setAttributes(element, attributes) {
Object.keys(attributes).forEach(function (prop) {
var value = attributes[prop];
if (value !== false) {
element.setAttribute(prop, attributes[prop]);
} else {
element.removeAttribute(prop);
}
});
} | [
"function",
"setAttributes",
"(",
"element",
",",
"attributes",
")",
"{",
"Object",
".",
"keys",
"(",
"attributes",
")",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
"{",
"var",
"value",
"=",
"attributes",
"[",
"prop",
"]",
";",
"if",
"(",
"value... | Set the attributes to the given popper
@method
@memberof Popper.Utils
@argument {Element} element - Element to apply the attributes to
@argument {Object} styles
Object with a list of properties and values which will be applied to the element | [
"Set",
"the",
"attributes",
"to",
"the",
"given",
"popper"
] | d5405d27d994151b676eb91c12b389316d7f6679 | https://github.com/heyui/heyui/blob/d5405d27d994151b676eb91c12b389316d7f6679/src/plugins/popper/index.js#L1192-L1201 | train | Set attributes on an element | [
30522,
30524,
19321,
3089,
8569,
2618,
1006,
17678,
1010,
12332,
1031,
17678,
1033,
1007,
1025,
1065,
2842,
1063,
5783,
1012,
6366,
19321,
3089,
8569,
2618,
1006,
17678,
1007,
1025,
1065,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ngrx/platform | projects/ngrx.io/tools/examples/run-example-e2e.js | spawnExt | function spawnExt(command, args, options, ignoreClose = false) {
let proc;
const promise = new Promise((resolve, reject) => {
let descr = command + ' ' + args.join(' ');
console.log('running: ' + descr);
try {
proc = xSpawn.spawn(command, args, options);
} catch (e) {
console.log(e);
reject(e);
return { proc: null, promise };
}
proc.stdout.on('data', function (data) {
process.stdout.write(data.toString());
});
proc.stderr.on('data', function (data) {
process.stdout.write(data.toString());
});
proc.on('close', function (returnCode) {
console.log(`completed: ${descr} \n`);
// Many tasks (e.g., tsc) complete but are actually errors;
// Confirm return code is zero.
returnCode === 0 || ignoreClose ? resolve(0) : reject(returnCode);
});
proc.on('error', function (data) {
console.log(`completed with error: ${descr} \n`);
console.log(data.toString());
reject(data);
});
});
return { proc, promise };
} | javascript | function spawnExt(command, args, options, ignoreClose = false) {
let proc;
const promise = new Promise((resolve, reject) => {
let descr = command + ' ' + args.join(' ');
console.log('running: ' + descr);
try {
proc = xSpawn.spawn(command, args, options);
} catch (e) {
console.log(e);
reject(e);
return { proc: null, promise };
}
proc.stdout.on('data', function (data) {
process.stdout.write(data.toString());
});
proc.stderr.on('data', function (data) {
process.stdout.write(data.toString());
});
proc.on('close', function (returnCode) {
console.log(`completed: ${descr} \n`);
// Many tasks (e.g., tsc) complete but are actually errors;
// Confirm return code is zero.
returnCode === 0 || ignoreClose ? resolve(0) : reject(returnCode);
});
proc.on('error', function (data) {
console.log(`completed with error: ${descr} \n`);
console.log(data.toString());
reject(data);
});
});
return { proc, promise };
} | [
"function",
"spawnExt",
"(",
"command",
",",
"args",
",",
"options",
",",
"ignoreClose",
"=",
"false",
")",
"{",
"let",
"proc",
";",
"const",
"promise",
"=",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"descr",
"=",
"... | Returns both a promise and the spawned process so that it can be killed if needed. | [
"Returns",
"both",
"a",
"promise",
"and",
"the",
"spawned",
"process",
"so",
"that",
"it",
"can",
"be",
"killed",
"if",
"needed",
"."
] | eec9cc615440526ddedac04ae0082bfecef13d50 | https://github.com/ngrx/platform/blob/eec9cc615440526ddedac04ae0082bfecef13d50/projects/ngrx.io/tools/examples/run-example-e2e.js#L246-L277 | train | Spawns an external process | [
30522,
3853,
25645,
10288,
2102,
1006,
3094,
1010,
12098,
5620,
1010,
7047,
1010,
8568,
20464,
9232,
1027,
6270,
1007,
1063,
2292,
4013,
2278,
1025,
9530,
3367,
4872,
1027,
2047,
4872,
1006,
1006,
10663,
1010,
15454,
1007,
1027,
1028,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(basename, lan)
{
if (mxClient.languages == null || !this.isLanguageSupported(lan))
{
var dash = lan.indexOf('-');
if (dash > 0)
{
lan = lan.substring(0, dash);
}
}
if (mxResources.loadSpecialBundle && mxResources.isLanguageSupported(lan) && lan != mxClient.defaultLanguage)
{
return basename + '_' + lan + mxResources.extension;
}
else
{
return null;
}
} | javascript | function(basename, lan)
{
if (mxClient.languages == null || !this.isLanguageSupported(lan))
{
var dash = lan.indexOf('-');
if (dash > 0)
{
lan = lan.substring(0, dash);
}
}
if (mxResources.loadSpecialBundle && mxResources.isLanguageSupported(lan) && lan != mxClient.defaultLanguage)
{
return basename + '_' + lan + mxResources.extension;
}
else
{
return null;
}
} | [
"function",
"(",
"basename",
",",
"lan",
")",
"{",
"if",
"(",
"mxClient",
".",
"languages",
"==",
"null",
"||",
"!",
"this",
".",
"isLanguageSupported",
"(",
"lan",
")",
")",
"{",
"var",
"dash",
"=",
"lan",
".",
"indexOf",
"(",
"'-'",
")",
";",
"if... | Function: getSpecialBundle
Hook for subclassers to return the URL for the special bundle. This
implementation returns basename + '_' + lan + <extension> or null if
<loadSpecialBundle> is false or lan equals <mxClient.defaultLanguage>.
If <mxResources.languages> is not null and <mxClient.language> contains
a dash, then this method checks if <isLanguageSupported> returns true
for the full language (including the dash). If that returns false the
first part of the language (up to the dash) will be tried as an extension.
If <mxResources.language> is null then the first part of the language is
used to maintain backwards compatibility.
Parameters:
basename - The basename for which the file should be loaded.
lan - The language for which the file should be loaded. | [
"Function",
":",
"getSpecialBundle"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1401-L1421 | train | Returns the name of the bundle for the given language | [
30522,
3853,
1006,
2918,
18442,
1010,
17595,
1007,
1063,
2065,
1006,
25630,
20464,
11638,
1012,
4155,
1027,
1027,
19701,
1064,
1064,
999,
2023,
1012,
25340,
3070,
6692,
8449,
6279,
6442,
2098,
1006,
17595,
1007,
1007,
1063,
13075,
11454,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ReactTraining/react-router | packages/react-router-dom/modules/NavLink.js | NavLink | function NavLink({
"aria-current": ariaCurrent = "page",
activeClassName = "active",
activeStyle,
className: classNameProp,
exact,
isActive: isActiveProp,
location,
strict,
style: styleProp,
to,
...rest
}) {
const path = typeof to === "object" ? to.pathname : to;
// Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
const escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
return (
<Route
path={escapedPath}
exact={exact}
strict={strict}
location={location}
children={({ location, match }) => {
const isActive = !!(isActiveProp
? isActiveProp(match, location)
: match);
const className = isActive
? joinClassnames(classNameProp, activeClassName)
: classNameProp;
const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;
return (
<Link
aria-current={(isActive && ariaCurrent) || null}
className={className}
style={style}
to={to}
{...rest}
/>
);
}}
/>
);
} | javascript | function NavLink({
"aria-current": ariaCurrent = "page",
activeClassName = "active",
activeStyle,
className: classNameProp,
exact,
isActive: isActiveProp,
location,
strict,
style: styleProp,
to,
...rest
}) {
const path = typeof to === "object" ? to.pathname : to;
// Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
const escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
return (
<Route
path={escapedPath}
exact={exact}
strict={strict}
location={location}
children={({ location, match }) => {
const isActive = !!(isActiveProp
? isActiveProp(match, location)
: match);
const className = isActive
? joinClassnames(classNameProp, activeClassName)
: classNameProp;
const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;
return (
<Link
aria-current={(isActive && ariaCurrent) || null}
className={className}
style={style}
to={to}
{...rest}
/>
);
}}
/>
);
} | [
"function",
"NavLink",
"(",
"{",
"\"aria-current\"",
":",
"ariaCurrent",
"=",
"\"page\"",
",",
"activeClassName",
"=",
"\"active\"",
",",
"activeStyle",
",",
"className",
":",
"classNameProp",
",",
"exact",
",",
"isActive",
":",
"isActiveProp",
",",
"location",
... | A <Link> wrapper that knows if it's "active" or not. | [
"A",
"<Link",
">",
"wrapper",
"that",
"knows",
"if",
"it",
"s",
"active",
"or",
"not",
"."
] | 82ce94c3b4e74f71018d104df6dc999801fa9ab2 | https://github.com/ReactTraining/react-router/blob/82ce94c3b4e74f71018d104df6dc999801fa9ab2/packages/react-router-dom/modules/NavLink.js#L14-L60 | train | Link to a page | [
30522,
3853,
6583,
2615,
13767,
1006,
1063,
1000,
9342,
1011,
2783,
1000,
1024,
9342,
10841,
14343,
3372,
1027,
1000,
3931,
1000,
1010,
3161,
26266,
18442,
1027,
1000,
3161,
1000,
1010,
3161,
21756,
2571,
1010,
2465,
18442,
1024,
2465,
1844... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/CodeFolding/main.js | saveLineFolds | function saveLineFolds(editor) {
var saveFolds = prefs.getSetting("saveFoldStates");
if (!editor || !saveFolds) {
return;
}
var folds = editor._codeMirror._lineFolds || {};
var path = editor.document.file.fullPath;
if (Object.keys(folds).length) {
prefs.setFolds(path, folds);
} else {
prefs.setFolds(path, undefined);
}
} | javascript | function saveLineFolds(editor) {
var saveFolds = prefs.getSetting("saveFoldStates");
if (!editor || !saveFolds) {
return;
}
var folds = editor._codeMirror._lineFolds || {};
var path = editor.document.file.fullPath;
if (Object.keys(folds).length) {
prefs.setFolds(path, folds);
} else {
prefs.setFolds(path, undefined);
}
} | [
"function",
"saveLineFolds",
"(",
"editor",
")",
"{",
"var",
"saveFolds",
"=",
"prefs",
".",
"getSetting",
"(",
"\"saveFoldStates\"",
")",
";",
"if",
"(",
"!",
"editor",
"||",
"!",
"saveFolds",
")",
"{",
"return",
";",
"}",
"var",
"folds",
"=",
"editor",... | Saves the line folds in the editor using the preference storage
@param {Editor} editor the editor whose line folds should be saved | [
"Saves",
"the",
"line",
"folds",
"in",
"the",
"editor",
"using",
"the",
"preference",
"storage"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/main.js#L159-L171 | train | Save line folds to the editor | [
30522,
3853,
3828,
4179,
10371,
2015,
1006,
3559,
1007,
1063,
13075,
3828,
10371,
2015,
1027,
3653,
10343,
1012,
4152,
18319,
3070,
1006,
1000,
3828,
10371,
9153,
4570,
1000,
1007,
1025,
2065,
1006,
999,
3559,
1064,
1064,
999,
3828,
10371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/component/axis/ParallelAxisView.js | function (
builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
) {
// After filtering, axis may change, select area needs to be update.
var extent = axisModel.axis.getExtent();
var extentLen = extent[1] - extent[0];
var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value.
// width/height might be negative, which will be
// normalized in BoundingRect.
var rect = graphic.BoundingRect.create({
x: extent[0],
y: -areaWidth / 2,
width: extentLen,
height: areaWidth
});
rect.x -= extra;
rect.width += 2 * extra;
this._brushController
.mount({
enableGlobalPan: true,
rotation: builderOpt.rotation,
position: builderOpt.position
})
.setPanels([{
panelId: 'pl',
clipPath: brushHelper.makeRectPanelClipPath(rect),
isTargetByCursor: brushHelper.makeRectIsTargetByCursor(rect, api, coordSysModel),
getLinearBrushOtherExtent: brushHelper.makeLinearBrushOtherExtent(rect, 0)
}])
.enableBrush({
brushType: 'lineX',
brushStyle: areaSelectStyle,
removeOnClick: true
})
.updateCovers(getCoverInfoList(axisModel));
} | javascript | function (
builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
) {
// After filtering, axis may change, select area needs to be update.
var extent = axisModel.axis.getExtent();
var extentLen = extent[1] - extent[0];
var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value.
// width/height might be negative, which will be
// normalized in BoundingRect.
var rect = graphic.BoundingRect.create({
x: extent[0],
y: -areaWidth / 2,
width: extentLen,
height: areaWidth
});
rect.x -= extra;
rect.width += 2 * extra;
this._brushController
.mount({
enableGlobalPan: true,
rotation: builderOpt.rotation,
position: builderOpt.position
})
.setPanels([{
panelId: 'pl',
clipPath: brushHelper.makeRectPanelClipPath(rect),
isTargetByCursor: brushHelper.makeRectIsTargetByCursor(rect, api, coordSysModel),
getLinearBrushOtherExtent: brushHelper.makeLinearBrushOtherExtent(rect, 0)
}])
.enableBrush({
brushType: 'lineX',
brushStyle: areaSelectStyle,
removeOnClick: true
})
.updateCovers(getCoverInfoList(axisModel));
} | [
"function",
"(",
"builderOpt",
",",
"areaSelectStyle",
",",
"axisModel",
",",
"coordSysModel",
",",
"areaWidth",
",",
"api",
")",
"{",
"// After filtering, axis may change, select area needs to be update.",
"var",
"extent",
"=",
"axisModel",
".",
"axis",
".",
"getExtent... | /** * @override updateVisual: function (axisModel, ecModel, api, payload) { this._brushController && this._brushController .updateCovers(getCoverInfoList(axisModel)); }, | [
"/",
"**",
"*"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/axis/ParallelAxisView.js#L103-L140 | train | Update the region of the region | [
30522,
3853,
1006,
12508,
7361,
2102,
1010,
2752,
12260,
16649,
27983,
1010,
8123,
5302,
9247,
1010,
2522,
8551,
6508,
25855,
9247,
1010,
2181,
9148,
11927,
2232,
1010,
17928,
1007,
1063,
1013,
1013,
2044,
22910,
1010,
8123,
2089,
2689,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
cypress-io/cypress | packages/server/lib/util/net_profiler.js | NetProfiler | function NetProfiler (options = {}) {
if (!(this instanceof NetProfiler)) return new NetProfiler(options)
if (!options.net) {
options.net = require('net')
}
this.net = options.net
this.proxies = {}
this.activeConnections = []
this.startTs = new Date() / 1000
this.tickMs = options.tickMs || 1000
this.tickWhenNoneActive = options.tickWhenNoneActive || false
this.logPath = getLogPath(options.logPath)
debug('logging to ', this.logPath)
this.startProfiling()
} | javascript | function NetProfiler (options = {}) {
if (!(this instanceof NetProfiler)) return new NetProfiler(options)
if (!options.net) {
options.net = require('net')
}
this.net = options.net
this.proxies = {}
this.activeConnections = []
this.startTs = new Date() / 1000
this.tickMs = options.tickMs || 1000
this.tickWhenNoneActive = options.tickWhenNoneActive || false
this.logPath = getLogPath(options.logPath)
debug('logging to ', this.logPath)
this.startProfiling()
} | [
"function",
"NetProfiler",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"NetProfiler",
")",
")",
"return",
"new",
"NetProfiler",
"(",
"options",
")",
"if",
"(",
"!",
"options",
".",
"net",
")",
"{",
"options",
"... | Tracks all incoming and outgoing network connections and logs a timeline of network traffic to a file.
@param options.net the `net` object to stub, default: nodejs net object
@param options.tickMs the number of milliseconds between ticks in the profile, default: 1000
@param options.tickWhenNoneActive should ticks be recorded when no connections are active, default: false
@param options.logPath path to the file to append to, default: new file in your temp directory | [
"Tracks",
"all",
"incoming",
"and",
"outgoing",
"network",
"connections",
"and",
"logs",
"a",
"timeline",
"of",
"network",
"traffic",
"to",
"a",
"file",
"."
] | bf1a942944f0e99684ff7fe0e18314332e46f83e | https://github.com/cypress-io/cypress/blob/bf1a942944f0e99684ff7fe0e18314332e46f83e/packages/server/lib/util/net_profiler.js#L61-L79 | train | NetProfiler constructor. | [
30522,
3853,
5658,
21572,
8873,
3917,
1006,
7047,
1027,
1063,
1065,
1007,
1063,
2065,
1006,
999,
1006,
2023,
6013,
11253,
5658,
21572,
8873,
3917,
1007,
1007,
2709,
2047,
5658,
21572,
8873,
3917,
1006,
7047,
1007,
2065,
1006,
999,
7047,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SheetJS/js-xlsx | xlsx.js | parse_PtgNameX | function parse_PtgNameX(blob, length, opts) {
if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts);
var type = (blob.read_shift(1) >>> 5) & 0x03;
var ixti = blob.read_shift(2); // XtiIndex
var nameindex = blob.read_shift(4);
return [type, ixti, nameindex];
} | javascript | function parse_PtgNameX(blob, length, opts) {
if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts);
var type = (blob.read_shift(1) >>> 5) & 0x03;
var ixti = blob.read_shift(2); // XtiIndex
var nameindex = blob.read_shift(4);
return [type, ixti, nameindex];
} | [
"function",
"parse_PtgNameX",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"if",
"(",
"opts",
".",
"biff",
"==",
"5",
")",
"return",
"parse_PtgNameX_BIFF5",
"(",
"blob",
",",
"length",
",",
"opts",
")",
";",
"var",
"type",
"=",
"(",
"blob",
"."... | /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"198",
".",
"77",
";",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"97",
".",
"61"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10565-L10571 | train | Parse a PTG name | [
30522,
3853,
11968,
3366,
1035,
13866,
16989,
4168,
2595,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
2065,
1006,
23569,
2015,
1012,
12170,
4246,
1027,
1027,
1019,
1007,
2709,
11968,
3366,
1035,
13866,
16989,
4168,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/base/rule.js | findAfterChecks | function findAfterChecks(rule) {
'use strict';
return axe.utils
.getAllChecks(rule)
.map(function(c) {
var check = rule._audit.checks[c.id || c];
return check && typeof check.after === 'function' ? check : null;
})
.filter(Boolean);
} | javascript | function findAfterChecks(rule) {
'use strict';
return axe.utils
.getAllChecks(rule)
.map(function(c) {
var check = rule._audit.checks[c.id || c];
return check && typeof check.after === 'function' ? check : null;
})
.filter(Boolean);
} | [
"function",
"findAfterChecks",
"(",
"rule",
")",
"{",
"'use strict'",
";",
"return",
"axe",
".",
"utils",
".",
"getAllChecks",
"(",
"rule",
")",
".",
"map",
"(",
"function",
"(",
"c",
")",
"{",
"var",
"check",
"=",
"rule",
".",
"_audit",
".",
"checks",... | Iterates the rule's Checks looking for ones that have an after function
@private
@param {Rule} rule The rule to check for after checks
@return {Array} Checks that have an after function | [
"Iterates",
"the",
"rule",
"s",
"Checks",
"looking",
"for",
"ones",
"that",
"have",
"an",
"after",
"function"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/base/rule.js#L297-L307 | train | Find all checks after a rule | [
30522,
3853,
2424,
10354,
3334,
5403,
10603,
1006,
3627,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
2709,
12946,
1012,
21183,
12146,
1012,
2131,
8095,
5403,
10603,
1006,
3627,
1007,
1012,
4949,
1006,
3853,
1006,
1039,
1007,
1063,
13075,
4638... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js | function(descriptor) {
var newDescriptor = {
get: descriptor.get,
set: function(val) {
if (fnIsACBUrl(val)) {
val = fnConvertUrl(val);
}
descriptor.set.call(this, val);
},
enumerable: descriptor.enumerable,
configurable: descriptor.configurable
};
newDescriptor.set._sapUiCoreACB = true;
return newDescriptor;
} | javascript | function(descriptor) {
var newDescriptor = {
get: descriptor.get,
set: function(val) {
if (fnIsACBUrl(val)) {
val = fnConvertUrl(val);
}
descriptor.set.call(this, val);
},
enumerable: descriptor.enumerable,
configurable: descriptor.configurable
};
newDescriptor.set._sapUiCoreACB = true;
return newDescriptor;
} | [
"function",
"(",
"descriptor",
")",
"{",
"var",
"newDescriptor",
"=",
"{",
"get",
":",
"descriptor",
".",
"get",
",",
"set",
":",
"function",
"(",
"val",
")",
"{",
"if",
"(",
"fnIsACBUrl",
"(",
"val",
")",
")",
"{",
"val",
"=",
"fnConvertUrl",
"(",
... | create an interceptor description which validates the value of the setter whether to rewrite the URL or not | [
"create",
"an",
"interceptor",
"description",
"which",
"validates",
"the",
"value",
"of",
"the",
"setter",
"whether",
"to",
"rewrite",
"the",
"URL",
"or",
"not"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L389-L403 | train | Returns a new descriptor that can be used to set a value in the configuration | [
30522,
3853,
1006,
4078,
23235,
2953,
1007,
1063,
13075,
2047,
6155,
23235,
2953,
1027,
1063,
2131,
1024,
4078,
23235,
2953,
1012,
2131,
1010,
2275,
1024,
3853,
1006,
11748,
1007,
1063,
2065,
1006,
1042,
8977,
6305,
8569,
12190,
1006,
11748... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
MithrilJS/mithril.js | render/render.js | createNodes | function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
for (var i = start; i < end; i++) {
var vnode = vnodes[i]
if (vnode != null) {
createNode(parent, vnode, hooks, ns, nextSibling)
}
}
} | javascript | function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
for (var i = start; i < end; i++) {
var vnode = vnodes[i]
if (vnode != null) {
createNode(parent, vnode, hooks, ns, nextSibling)
}
}
} | [
"function",
"createNodes",
"(",
"parent",
",",
"vnodes",
",",
"start",
",",
"end",
",",
"hooks",
",",
"nextSibling",
",",
"ns",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"var",
"vnode",
"=",
... | create | [
"create"
] | 6d36fe09d129928c6b460720e08d9ed321fcd62b | https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/render/render.js#L48-L55 | train | Creates nodes from a list of vnodes | [
30522,
3853,
3443,
3630,
6155,
1006,
6687,
1010,
1058,
3630,
6155,
1010,
2707,
1010,
2203,
1010,
18008,
1010,
2279,
5332,
9709,
1010,
24978,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
2707,
1025,
1045,
1026,
2203,
1025,
1045,
1009,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js | function(bAsKeyUser) {
var oDescriptor = fnGetDescriptor();
return new Promise(function(resolve) {
var fnCancel = function() {
AppVariantUtils.closeOverviewDialog();
};
sap.ui.require(["sap/ui/rta/appVariant/AppVariantOverviewDialog"], function(AppVariantOverviewDialog) {
if (!oAppVariantOverviewDialog) {
oAppVariantOverviewDialog = new AppVariantOverviewDialog({
idRunningApp: oDescriptor["sap.app"].id,
isOverviewForKeyUser: bAsKeyUser
});
}
oAppVariantOverviewDialog.attachCancel(fnCancel);
oAppVariantOverviewDialog.oPopup.attachOpened(function() {
resolve(oAppVariantOverviewDialog);
});
oAppVariantOverviewDialog.open();
});
});
} | javascript | function(bAsKeyUser) {
var oDescriptor = fnGetDescriptor();
return new Promise(function(resolve) {
var fnCancel = function() {
AppVariantUtils.closeOverviewDialog();
};
sap.ui.require(["sap/ui/rta/appVariant/AppVariantOverviewDialog"], function(AppVariantOverviewDialog) {
if (!oAppVariantOverviewDialog) {
oAppVariantOverviewDialog = new AppVariantOverviewDialog({
idRunningApp: oDescriptor["sap.app"].id,
isOverviewForKeyUser: bAsKeyUser
});
}
oAppVariantOverviewDialog.attachCancel(fnCancel);
oAppVariantOverviewDialog.oPopup.attachOpened(function() {
resolve(oAppVariantOverviewDialog);
});
oAppVariantOverviewDialog.open();
});
});
} | [
"function",
"(",
"bAsKeyUser",
")",
"{",
"var",
"oDescriptor",
"=",
"fnGetDescriptor",
"(",
")",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"fnCancel",
"=",
"function",
"(",
")",
"{",
"AppVariantUtils",
".",
"closeOv... | To see the overview of app variants, a key user has created from an app | [
"To",
"see",
"the",
"overview",
"of",
"app",
"variants",
"a",
"key",
"user",
"has",
"created",
"from",
"an",
"app"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js#L98-L122 | train | Opens the App Variant overview dialog | [
30522,
3853,
1006,
19021,
14839,
20330,
1007,
1063,
13075,
24040,
22483,
2953,
1027,
1042,
15465,
2102,
6155,
23235,
2953,
1006,
1007,
1025,
2709,
2047,
4872,
1006,
3853,
1006,
10663,
1007,
1063,
13075,
1042,
20909,
5897,
2140,
1027,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/language/JSUtils.js | findMatchingFunctions | function findMatchingFunctions(functionName, fileInfos, keepAllFiles) {
var result = new $.Deferred(),
jsFiles = [];
if (!keepAllFiles) {
// Filter fileInfos for .js files
jsFiles = fileInfos.filter(function (fileInfo) {
return FileUtils.getFileExtension(fileInfo.fullPath).toLowerCase() === "js";
});
} else {
jsFiles = fileInfos;
}
// RegExp search (or cache lookup) for all functions in the project
_getFunctionsInFiles(jsFiles).done(function (docEntries) {
// Compute offsets for all matched functions
_getOffsetsForFunction(docEntries, functionName).done(function (rangeResults) {
result.resolve(rangeResults);
});
});
return result.promise();
} | javascript | function findMatchingFunctions(functionName, fileInfos, keepAllFiles) {
var result = new $.Deferred(),
jsFiles = [];
if (!keepAllFiles) {
// Filter fileInfos for .js files
jsFiles = fileInfos.filter(function (fileInfo) {
return FileUtils.getFileExtension(fileInfo.fullPath).toLowerCase() === "js";
});
} else {
jsFiles = fileInfos;
}
// RegExp search (or cache lookup) for all functions in the project
_getFunctionsInFiles(jsFiles).done(function (docEntries) {
// Compute offsets for all matched functions
_getOffsetsForFunction(docEntries, functionName).done(function (rangeResults) {
result.resolve(rangeResults);
});
});
return result.promise();
} | [
"function",
"findMatchingFunctions",
"(",
"functionName",
",",
"fileInfos",
",",
"keepAllFiles",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"jsFiles",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"keepAllFiles",
")",
"{",
"// Filt... | Return all functions that have the specified name, searching across all the given files.
@param {!String} functionName The name to match.
@param {!Array.<File>} fileInfos The array of files to search.
@param {boolean=} keepAllFiles If true, don't ignore non-javascript files.
@return {$.Promise} that will be resolved with an Array of objects containing the
source document, start line, and end line (0-based, inclusive range) for each matching function list.
Does not addRef() the documents returned in the array. | [
"Return",
"all",
"functions",
"that",
"have",
"the",
"specified",
"name",
"searching",
"across",
"all",
"the",
"given",
"files",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L455-L477 | train | Find all matching functions in the project | [
30522,
3853,
2424,
18900,
8450,
11263,
27989,
2015,
1006,
3853,
18442,
1010,
5371,
2378,
14876,
2015,
1010,
2562,
8095,
8873,
4244,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
1046,
22747,
9463,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/events/F6Navigation.js | findTabbables | function findTabbables(oRef, aScopes, bNext) {
var $Ref = jQuery(oRef),
$All, $Tabbables;
if (bNext) {
$All = jQuery.merge($Ref.find("*"), jQuery.merge($Ref.nextAll(), $Ref.parents().nextAll()));
$Tabbables = $All.find(':sapTabbable').addBack(':sapTabbable');
} else {
$All = jQuery.merge($Ref.prevAll(), $Ref.parents().prevAll());
$Tabbables = jQuery.merge($Ref.parents(':sapTabbable'), $All.find(':sapTabbable').addBack(':sapTabbable'));
}
var $Tabbables = jQuery.unique($Tabbables);
return $Tabbables.filter(function() {
return isContained(aScopes, this);
});
} | javascript | function findTabbables(oRef, aScopes, bNext) {
var $Ref = jQuery(oRef),
$All, $Tabbables;
if (bNext) {
$All = jQuery.merge($Ref.find("*"), jQuery.merge($Ref.nextAll(), $Ref.parents().nextAll()));
$Tabbables = $All.find(':sapTabbable').addBack(':sapTabbable');
} else {
$All = jQuery.merge($Ref.prevAll(), $Ref.parents().prevAll());
$Tabbables = jQuery.merge($Ref.parents(':sapTabbable'), $All.find(':sapTabbable').addBack(':sapTabbable'));
}
var $Tabbables = jQuery.unique($Tabbables);
return $Tabbables.filter(function() {
return isContained(aScopes, this);
});
} | [
"function",
"findTabbables",
"(",
"oRef",
",",
"aScopes",
",",
"bNext",
")",
"{",
"var",
"$Ref",
"=",
"jQuery",
"(",
"oRef",
")",
",",
"$All",
",",
"$Tabbables",
";",
"if",
"(",
"bNext",
")",
"{",
"$All",
"=",
"jQuery",
".",
"merge",
"(",
"$Ref",
"... | Returns a jQuery object which contains all next/previous (bNext) tabbable DOM elements of the given starting point (oRef) within the given scopes (DOMRefs) | [
"Returns",
"a",
"jQuery",
"object",
"which",
"contains",
"all",
"next",
"/",
"previous",
"(",
"bNext",
")",
"tabbable",
"DOM",
"elements",
"of",
"the",
"given",
"starting",
"point",
"(",
"oRef",
")",
"within",
"the",
"given",
"scopes",
"(",
"DOMRefs",
")"
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/F6Navigation.js#L73-L89 | train | Find all tabbables in aScopes | [
30522,
3853,
2424,
2696,
22414,
13510,
1006,
10848,
2546,
1010,
2004,
16186,
2015,
1010,
24869,
10288,
2102,
1007,
1063,
13075,
1002,
25416,
1027,
1046,
4226,
2854,
1006,
10848,
2546,
1007,
1010,
1002,
2035,
1010,
1002,
21628,
3676,
13510,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Tonejs/Tone.js | scripts/collect_deps.js | collectDependencies | function collectDependencies(){
const files = glob.sync(posix.resolve(__dirname, "../Tone/!(shim)/!(Tone).js"));
const modules = files.map(f => f.slice(0, -3));
let reqString = modules.map(r => {
const relativePath = posix.relative(posix.resolve(__dirname, "../Tone"), r);
// const exportName = r.split("/")[r.split("/").length - 1];
// return `export { default as ${exportName} } from "./${relativePath}";`;
// return `import "./${relativePath}";`;
return `require("./${relativePath}");`;
}).join("\n");
// reqString += "\nexport { default } from \"./core/Tone\";\n";
reqString += "\nmodule.exports = require(\"./core/Tone\").default;\n";
fs.writeFileSync(posix.resolve(__dirname, "../Tone/index.js"), reqString);
} | javascript | function collectDependencies(){
const files = glob.sync(posix.resolve(__dirname, "../Tone/!(shim)/!(Tone).js"));
const modules = files.map(f => f.slice(0, -3));
let reqString = modules.map(r => {
const relativePath = posix.relative(posix.resolve(__dirname, "../Tone"), r);
// const exportName = r.split("/")[r.split("/").length - 1];
// return `export { default as ${exportName} } from "./${relativePath}";`;
// return `import "./${relativePath}";`;
return `require("./${relativePath}");`;
}).join("\n");
// reqString += "\nexport { default } from \"./core/Tone\";\n";
reqString += "\nmodule.exports = require(\"./core/Tone\").default;\n";
fs.writeFileSync(posix.resolve(__dirname, "../Tone/index.js"), reqString);
} | [
"function",
"collectDependencies",
"(",
")",
"{",
"const",
"files",
"=",
"glob",
".",
"sync",
"(",
"posix",
".",
"resolve",
"(",
"__dirname",
",",
"\"../Tone/!(shim)/!(Tone).js\"",
")",
")",
";",
"const",
"modules",
"=",
"files",
".",
"map",
"(",
"f",
"=>"... | COLLECT DEPENDENCIES | [
"COLLECT",
"DEPENDENCIES"
] | bb67e9c83d5553dfaa3c10babc147600aa14c147 | https://github.com/Tonejs/Tone.js/blob/bb67e9c83d5553dfaa3c10babc147600aa14c147/scripts/collect_deps.js#L8-L21 | train | collect dependencies from the core | [
30522,
3853,
8145,
3207,
11837,
4181,
9243,
1006,
1007,
1063,
9530,
3367,
6764,
1027,
1043,
4135,
2497,
1012,
26351,
1006,
13433,
5332,
2595,
1012,
10663,
1006,
1035,
1035,
16101,
18442,
1010,
1000,
1012,
1012,
1013,
4309,
1013,
999,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/utils/reducedObject.js | reducedObject | function reducedObject(defaultVersion, currentVersion) {
if(defaultVersion === undefined) {
return currentVersion;
}
return currentVersion.reduce(function(result, value, key) {
var defaultValue = defaultVersion.get(key);
if (Immutable.Map.isMap(value)) {
var diffs = reducedObject(defaultValue, value);
if (diffs.size > 0) {
return result.set(key, diffs);
}
}
if (Immutable.is(defaultValue, value)) {
return result;
}
return result.set(key, value);
}, Immutable.Map());
} | javascript | function reducedObject(defaultVersion, currentVersion) {
if(defaultVersion === undefined) {
return currentVersion;
}
return currentVersion.reduce(function(result, value, key) {
var defaultValue = defaultVersion.get(key);
if (Immutable.Map.isMap(value)) {
var diffs = reducedObject(defaultValue, value);
if (diffs.size > 0) {
return result.set(key, diffs);
}
}
if (Immutable.is(defaultValue, value)) {
return result;
}
return result.set(key, value);
}, Immutable.Map());
} | [
"function",
"reducedObject",
"(",
"defaultVersion",
",",
"currentVersion",
")",
"{",
"if",
"(",
"defaultVersion",
"===",
"undefined",
")",
"{",
"return",
"currentVersion",
";",
"}",
"return",
"currentVersion",
".",
"reduce",
"(",
"function",
"(",
"result",
",",
... | Reduce the difference between a map and its default version
@param {Map} defaultVersion
@param {Map} currentVersion
@return {Map} The properties of currentVersion that differs from defaultVersion | [
"Reduce",
"the",
"difference",
"between",
"a",
"map",
"and",
"its",
"default",
"version"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/reducedObject.js#L9-L31 | train | reducedObject - reduce the current object to the new object | [
30522,
3853,
4359,
16429,
20614,
1006,
12398,
27774,
1010,
2783,
27774,
1007,
1063,
2065,
1006,
12398,
27774,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
2709,
2783,
27774,
1025,
1065,
2709,
2783,
27774,
1012,
5547,
1006,
3853,
1006,
2765,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
feathericons/feather | src/replace.js | getAttrs | function getAttrs(element) {
return Array.from(element.attributes).reduce((attrs, attr) => {
attrs[attr.name] = attr.value;
return attrs;
}, {});
} | javascript | function getAttrs(element) {
return Array.from(element.attributes).reduce((attrs, attr) => {
attrs[attr.name] = attr.value;
return attrs;
}, {});
} | [
"function",
"getAttrs",
"(",
"element",
")",
"{",
"return",
"Array",
".",
"from",
"(",
"element",
".",
"attributes",
")",
".",
"reduce",
"(",
"(",
"attrs",
",",
"attr",
")",
"=>",
"{",
"attrs",
"[",
"attr",
".",
"name",
"]",
"=",
"attr",
".",
"valu... | Get the attributes of an HTML element.
@param {HTMLElement} element
@returns {Object} | [
"Get",
"the",
"attributes",
"of",
"an",
"HTML",
"element",
"."
] | 8f658193d25e943b196a2367319b5d9e85ee9f9f | https://github.com/feathericons/feather/blob/8f658193d25e943b196a2367319b5d9e85ee9f9f/src/replace.js#L53-L58 | train | Get the attributes of an element | [
30522,
3853,
2131,
19321,
2869,
1006,
5783,
1007,
1063,
2709,
9140,
1012,
2013,
1006,
5783,
1012,
12332,
1007,
1012,
5547,
1006,
1006,
2012,
16344,
2015,
1010,
2012,
16344,
1007,
1027,
1028,
1063,
2012,
16344,
2015,
1031,
2012,
16344,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/model/Series.js | function (option, ecModel) {
var layoutMode = this.layoutMode;
var inputPositionParams = layoutMode
? getLayoutParams(option) : {};
// Backward compat: using subType on theme.
// But if name duplicate between series subType
// (for example: parallel) add component mainType,
// add suffix 'Series'.
var themeSubType = this.subType;
if (ComponentModel.hasClass(themeSubType)) {
themeSubType += 'Series';
}
zrUtil.merge(
option,
ecModel.getTheme().get(this.subType)
);
zrUtil.merge(option, this.getDefaultOption());
// Default label emphasis `show`
modelUtil.defaultEmphasis(option, 'label', ['show']);
this.fillDataTextStyle(option.data);
if (layoutMode) {
mergeLayoutParam(option, inputPositionParams, layoutMode);
}
} | javascript | function (option, ecModel) {
var layoutMode = this.layoutMode;
var inputPositionParams = layoutMode
? getLayoutParams(option) : {};
// Backward compat: using subType on theme.
// But if name duplicate between series subType
// (for example: parallel) add component mainType,
// add suffix 'Series'.
var themeSubType = this.subType;
if (ComponentModel.hasClass(themeSubType)) {
themeSubType += 'Series';
}
zrUtil.merge(
option,
ecModel.getTheme().get(this.subType)
);
zrUtil.merge(option, this.getDefaultOption());
// Default label emphasis `show`
modelUtil.defaultEmphasis(option, 'label', ['show']);
this.fillDataTextStyle(option.data);
if (layoutMode) {
mergeLayoutParam(option, inputPositionParams, layoutMode);
}
} | [
"function",
"(",
"option",
",",
"ecModel",
")",
"{",
"var",
"layoutMode",
"=",
"this",
".",
"layoutMode",
";",
"var",
"inputPositionParams",
"=",
"layoutMode",
"?",
"getLayoutParams",
"(",
"option",
")",
":",
"{",
"}",
";",
"// Backward compat: using subType on ... | Util for merge default and theme to option
@param {Object} option
@param {module:echarts/model/Global} ecModel | [
"Util",
"for",
"merge",
"default",
"and",
"theme",
"to",
"option"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Series.js#L137-L164 | train | Merge the options with the current options | [
30522,
3853,
1006,
5724,
1010,
14925,
5302,
9247,
1007,
1063,
13075,
9621,
5302,
3207,
1027,
2023,
1012,
9621,
5302,
3207,
1025,
13075,
7953,
26994,
28689,
5244,
1027,
9621,
5302,
3207,
1029,
2131,
8485,
5833,
28689,
5244,
1006,
5724,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GeekyAnts/vue-native-core | packages/vue-native-core/build.js | initEvents | function initEvents (vm) {
vm._events = Object.create(null);
/**
* react-vue change
*/
if (Array.isArray(vm.$options.reactVueCustomEvent)) {
vm.$options.reactVueCustomEvent.forEach(function (v) {
vm.$on(v.name, v.handle);
});
}
// vm._hasHookEvent = false
// // init parent attached events
// const listeners = vm.$options._parentListeners
// if (listeners) {
// updateComponentListeners(vm, listeners)
// }
} | javascript | function initEvents (vm) {
vm._events = Object.create(null);
/**
* react-vue change
*/
if (Array.isArray(vm.$options.reactVueCustomEvent)) {
vm.$options.reactVueCustomEvent.forEach(function (v) {
vm.$on(v.name, v.handle);
});
}
// vm._hasHookEvent = false
// // init parent attached events
// const listeners = vm.$options._parentListeners
// if (listeners) {
// updateComponentListeners(vm, listeners)
// }
} | [
"function",
"initEvents",
"(",
"vm",
")",
"{",
"vm",
".",
"_events",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"/**\n * react-vue change\n */",
"if",
"(",
"Array",
".",
"isArray",
"(",
"vm",
".",
"$options",
".",
"reactVueCustomEvent",
")",
... | /* /* | [
"/",
"*",
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-core/build.js#L1968-L1985 | train | init events | [
30522,
3853,
1999,
4221,
15338,
2015,
1006,
1058,
2213,
1007,
1063,
1058,
2213,
1012,
1035,
2824,
1027,
4874,
1012,
3443,
1006,
19701,
1007,
1025,
1013,
1008,
1008,
1008,
10509,
1011,
24728,
2063,
2689,
1008,
1013,
2065,
1006,
9140,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/input.js | _flattenBufferIn | function _flattenBufferIn () {
if (this._isStreamInput()) {
this.options.input.buffer = Buffer.concat(this.options.input.buffer);
}
} | javascript | function _flattenBufferIn () {
if (this._isStreamInput()) {
this.options.input.buffer = Buffer.concat(this.options.input.buffer);
}
} | [
"function",
"_flattenBufferIn",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_isStreamInput",
"(",
")",
")",
"{",
"this",
".",
"options",
".",
"input",
".",
"buffer",
"=",
"Buffer",
".",
"concat",
"(",
"this",
".",
"options",
".",
"input",
".",
"buffer",
... | Flattens the array of chunks accumulated in input.buffer.
@private | [
"Flattens",
"the",
"array",
"of",
"chunks",
"accumulated",
"in",
"input",
".",
"buffer",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/input.js#L137-L141 | train | Flatten buffer in input | [
30522,
3853,
1035,
4257,
6528,
8569,
12494,
2378,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
26354,
25379,
2378,
18780,
1006,
1007,
1007,
1063,
2023,
1012,
7047,
1012,
7953,
1012,
17698,
1027,
17698,
1012,
9530,
11266,
1006,
2023,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oExtension) {
var oTable = oExtension.getTable(),
oIN = oTable._getItemNavigation(),
bIsRowChanged = false,
bIsColChanged = false,
bIsInitial = false;
if (oIN) {
var iColumnNumber = ExtensionHelper.getColumnIndexOfFocusedCell(oExtension) + 1; // +1 -> we want to announce a count and not the
// index, the action column is handled like a normal
// column
var iRowNumber = TableUtils.getRowIndexOfFocusedCell(oTable) + oTable._getFirstRenderedRowIndex() + 1; // same here + take
// virtualization
// into account
var iColCount = TableUtils.getVisibleColumnCount(oTable) + (TableUtils.hasRowActions(oTable) ? 1 : 0);
var iRowCount = TableUtils.isNoDataVisible(oTable) ? 0 : TableUtils.getTotalRowCount(oTable, true);
bIsRowChanged = oExtension._iLastRowNumber != iRowNumber || (oExtension._iLastRowNumber == iRowNumber
&& oExtension._iLastColumnNumber == iColumnNumber);
bIsColChanged = oExtension._iLastColumnNumber != iColumnNumber;
bIsInitial = !oExtension._iLastRowNumber && !oExtension._iLastColumnNumber;
oTable.$("rownumberofrows").text(bIsRowChanged ? TableUtils.getResourceText("TBL_ROW_ROWCOUNT", [iRowNumber, iRowCount]) : " ");
oTable.$("colnumberofcols").text(bIsColChanged ? TableUtils.getResourceText("TBL_COL_COLCOUNT", [iColumnNumber, iColCount]) : " ");
oTable.$("ariacount").text(bIsInitial ? TableUtils.getResourceText("TBL_DATA_ROWS_COLS", [iRowCount, iColCount]) : " ");
oExtension._iLastRowNumber = iRowNumber;
oExtension._iLastColumnNumber = iColumnNumber;
}
return {
rowChange: bIsRowChanged,
colChange: bIsColChanged,
initial: bIsInitial
};
} | javascript | function(oExtension) {
var oTable = oExtension.getTable(),
oIN = oTable._getItemNavigation(),
bIsRowChanged = false,
bIsColChanged = false,
bIsInitial = false;
if (oIN) {
var iColumnNumber = ExtensionHelper.getColumnIndexOfFocusedCell(oExtension) + 1; // +1 -> we want to announce a count and not the
// index, the action column is handled like a normal
// column
var iRowNumber = TableUtils.getRowIndexOfFocusedCell(oTable) + oTable._getFirstRenderedRowIndex() + 1; // same here + take
// virtualization
// into account
var iColCount = TableUtils.getVisibleColumnCount(oTable) + (TableUtils.hasRowActions(oTable) ? 1 : 0);
var iRowCount = TableUtils.isNoDataVisible(oTable) ? 0 : TableUtils.getTotalRowCount(oTable, true);
bIsRowChanged = oExtension._iLastRowNumber != iRowNumber || (oExtension._iLastRowNumber == iRowNumber
&& oExtension._iLastColumnNumber == iColumnNumber);
bIsColChanged = oExtension._iLastColumnNumber != iColumnNumber;
bIsInitial = !oExtension._iLastRowNumber && !oExtension._iLastColumnNumber;
oTable.$("rownumberofrows").text(bIsRowChanged ? TableUtils.getResourceText("TBL_ROW_ROWCOUNT", [iRowNumber, iRowCount]) : " ");
oTable.$("colnumberofcols").text(bIsColChanged ? TableUtils.getResourceText("TBL_COL_COLCOUNT", [iColumnNumber, iColCount]) : " ");
oTable.$("ariacount").text(bIsInitial ? TableUtils.getResourceText("TBL_DATA_ROWS_COLS", [iRowCount, iColCount]) : " ");
oExtension._iLastRowNumber = iRowNumber;
oExtension._iLastColumnNumber = iColumnNumber;
}
return {
rowChange: bIsRowChanged,
colChange: bIsColChanged,
initial: bIsInitial
};
} | [
"function",
"(",
"oExtension",
")",
"{",
"var",
"oTable",
"=",
"oExtension",
".",
"getTable",
"(",
")",
",",
"oIN",
"=",
"oTable",
".",
"_getItemNavigation",
"(",
")",
",",
"bIsRowChanged",
"=",
"false",
",",
"bIsColChanged",
"=",
"false",
",",
"bIsInitial... | /*
Determines the current row and column and updates the hidden description texts of the table accordingly. | [
"/",
"*",
"Determines",
"the",
"current",
"row",
"and",
"column",
"and",
"updates",
"the",
"hidden",
"description",
"texts",
"of",
"the",
"table",
"accordingly",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L240-L275 | train | Updates the pager pager | [
30522,
3853,
1006,
1051,
10288,
29048,
1007,
1063,
13075,
27178,
3085,
1027,
1051,
10288,
29048,
1012,
2131,
10880,
1006,
1007,
1010,
1051,
2378,
1027,
27178,
3085,
1012,
1035,
2131,
4221,
2213,
2532,
5737,
12540,
1006,
1007,
1010,
20377,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/editor/EditorManager.js | _handleRemoveFromPaneView | function _handleRemoveFromPaneView(e, removedFiles) {
var handleFileRemoved = function (file) {
var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
if (doc) {
MainViewManager._destroyEditorIfNotNeeded(doc);
}
};
// when files are removed from a pane then
// we should destroy any unnecssary views
if ($.isArray(removedFiles)) {
removedFiles.forEach(function (removedFile) {
handleFileRemoved(removedFile);
});
} else {
handleFileRemoved(removedFiles);
}
} | javascript | function _handleRemoveFromPaneView(e, removedFiles) {
var handleFileRemoved = function (file) {
var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
if (doc) {
MainViewManager._destroyEditorIfNotNeeded(doc);
}
};
// when files are removed from a pane then
// we should destroy any unnecssary views
if ($.isArray(removedFiles)) {
removedFiles.forEach(function (removedFile) {
handleFileRemoved(removedFile);
});
} else {
handleFileRemoved(removedFiles);
}
} | [
"function",
"_handleRemoveFromPaneView",
"(",
"e",
",",
"removedFiles",
")",
"{",
"var",
"handleFileRemoved",
"=",
"function",
"(",
"file",
")",
"{",
"var",
"doc",
"=",
"DocumentManager",
".",
"getOpenDocumentForPath",
"(",
"file",
".",
"fullPath",
")",
";",
"... | file removed from pane handler.
@param {jQuery.Event} e
@param {File|Array.<File>} removedFiles - file, path or array of files or paths that are being removed | [
"file",
"removed",
"from",
"pane",
"handler",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L691-L709 | train | handleRemoveFromPaneView - handles file removed from pane | [
30522,
3853,
1035,
28213,
6633,
21818,
19699,
25377,
7231,
8584,
1006,
1041,
1010,
3718,
8873,
4244,
1007,
1063,
13075,
5047,
8873,
3917,
6633,
21818,
2094,
1027,
3853,
1006,
5371,
1007,
1063,
13075,
9986,
1027,
6254,
24805,
4590,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/event-stream/int64.js | Int64 | function Int64(bytes) {
if (bytes.length !== 8) {
throw new Error('Int64 buffers must be exactly 8 bytes');
}
if (!util.Buffer.isBuffer(bytes)) bytes = toBuffer(bytes);
this.bytes = bytes;
} | javascript | function Int64(bytes) {
if (bytes.length !== 8) {
throw new Error('Int64 buffers must be exactly 8 bytes');
}
if (!util.Buffer.isBuffer(bytes)) bytes = toBuffer(bytes);
this.bytes = bytes;
} | [
"function",
"Int64",
"(",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
"!==",
"8",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Int64 buffers must be exactly 8 bytes'",
")",
";",
"}",
"if",
"(",
"!",
"util",
".",
"Buffer",
".",
"isBuffer",
"(",
"... | A lossless representation of a signed, 64-bit integer. Instances of this
class may be used in arithmetic expressions as if they were numeric
primitives, but the binary representation will be preserved unchanged as the
`bytes` property of the object. The bytes should be encoded as big-endian,
two's complement integers.
@param {Buffer} bytes
@api private | [
"A",
"lossless",
"representation",
"of",
"a",
"signed",
"64",
"-",
"bit",
"integer",
".",
"Instances",
"of",
"this",
"class",
"may",
"be",
"used",
"in",
"arithmetic",
"expressions",
"as",
"if",
"they",
"were",
"numeric",
"primitives",
"but",
"the",
"binary",... | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/event-stream/int64.js#L14-L21 | train | Int64 constructor. | [
30522,
3853,
20014,
21084,
1006,
27507,
1007,
1063,
2065,
1006,
27507,
1012,
3091,
999,
1027,
1027,
1022,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
20014,
21084,
17698,
2015,
2442,
2022,
3599,
1022,
27507,
1005,
1007,
1025,
1065,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js | function(oStep){
var sTooltip = oStep.getTooltip_AsString();
if (!sTooltip && !oStep.getTooltip() && sap.ui.getCore().getConfiguration().getAccessibility()) {
sTooltip = getText("RDMP_DEFAULT_STEP_TOOLTIP", [oStep.__stepName]);
}
return sTooltip || "";
} | javascript | function(oStep){
var sTooltip = oStep.getTooltip_AsString();
if (!sTooltip && !oStep.getTooltip() && sap.ui.getCore().getConfiguration().getAccessibility()) {
sTooltip = getText("RDMP_DEFAULT_STEP_TOOLTIP", [oStep.__stepName]);
}
return sTooltip || "";
} | [
"function",
"(",
"oStep",
")",
"{",
"var",
"sTooltip",
"=",
"oStep",
".",
"getTooltip_AsString",
"(",
")",
";",
"if",
"(",
"!",
"sTooltip",
"&&",
"!",
"oStep",
".",
"getTooltip",
"(",
")",
"&&",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"get... | Returns the tooltip of the given step | [
"Returns",
"the",
"tooltip",
"of",
"the",
"given",
"step"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L628-L634 | train | Returns the tooltip of the given step | [
30522,
3853,
1006,
9808,
2618,
2361,
1007,
1063,
13075,
14708,
25101,
30524,
11514,
1006,
1007,
1004,
1004,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
2131,
8663,
8873,
27390,
3370,
1006,
1007,
1012,
2131,
6305,
9623,
28255,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/code-path-analysis/code-path-analyzer.js | postprocess | function postprocess(analyzer, node) {
switch (node.type) {
case "Program":
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression": {
let codePath = analyzer.codePath;
// Mark the current path as the final node.
CodePath.getState(codePath).makeFinal();
// Emits onCodePathSegmentEnd event of the current segments.
leaveFromCurrentSegment(analyzer, node);
// Emits onCodePathEnd event of this code path.
debug.dump(`onCodePathEnd ${codePath.id}`);
analyzer.emitter.emit("onCodePathEnd", codePath, node);
debug.dumpDot(codePath);
codePath = analyzer.codePath = analyzer.codePath.upper;
if (codePath) {
debug.dumpState(node, CodePath.getState(codePath), true);
}
break;
}
default:
break;
}
} | javascript | function postprocess(analyzer, node) {
switch (node.type) {
case "Program":
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression": {
let codePath = analyzer.codePath;
// Mark the current path as the final node.
CodePath.getState(codePath).makeFinal();
// Emits onCodePathSegmentEnd event of the current segments.
leaveFromCurrentSegment(analyzer, node);
// Emits onCodePathEnd event of this code path.
debug.dump(`onCodePathEnd ${codePath.id}`);
analyzer.emitter.emit("onCodePathEnd", codePath, node);
debug.dumpDot(codePath);
codePath = analyzer.codePath = analyzer.codePath.upper;
if (codePath) {
debug.dumpState(node, CodePath.getState(codePath), true);
}
break;
}
default:
break;
}
} | [
"function",
"postprocess",
"(",
"analyzer",
",",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"\"Program\"",
":",
"case",
"\"FunctionDeclaration\"",
":",
"case",
"\"FunctionExpression\"",
":",
"case",
"\"ArrowFunctionExpression\"",
":",
... | Updates the code path to finalize the current code path.
@param {CodePathAnalyzer} analyzer - The instance.
@param {ASTNode} node - The current AST node.
@returns {void} | [
"Updates",
"the",
"code",
"path",
"to",
"finalize",
"the",
"current",
"code",
"path",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-analyzer.js#L557-L586 | train | Post - process the node. | [
30522,
3853,
2695,
21572,
9623,
2015,
1006,
17908,
2099,
1010,
13045,
1007,
1063,
6942,
1006,
13045,
1012,
2828,
1007,
1063,
2553,
1000,
2565,
1000,
1024,
2553,
1000,
3853,
3207,
20464,
25879,
3258,
1000,
1024,
2553,
1000,
3853,
10288,
2011... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/selenium-core/xpath/util.js | copyArray | function copyArray(dst, src) {
if (!src) return;
var dstLength = dst.length;
for (var i = src.length - 1; i >= 0; --i) {
dst[i+dstLength] = src[i];
}
} | javascript | function copyArray(dst, src) {
if (!src) return;
var dstLength = dst.length;
for (var i = src.length - 1; i >= 0; --i) {
dst[i+dstLength] = src[i];
}
} | [
"function",
"copyArray",
"(",
"dst",
",",
"src",
")",
"{",
"if",
"(",
"!",
"src",
")",
"return",
";",
"var",
"dstLength",
"=",
"dst",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"src",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"... | Shallow-copies an array to the end of another array Basically Array.concat, but works with other non-array collections | [
"Shallow",
"-",
"copies",
"an",
"array",
"to",
"the",
"end",
"of",
"another",
"array",
"Basically",
"Array",
".",
"concat",
"but",
"works",
"with",
"other",
"non",
"-",
"array",
"collections"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/xpath/util.js#L221-L227 | train | Copy an array of words to a destination array | [
30522,
3853,
6100,
2906,
9447,
1006,
16233,
2102,
1010,
5034,
2278,
1007,
1063,
2065,
1006,
999,
5034,
2278,
1007,
2709,
1025,
13075,
16233,
9286,
3070,
2705,
1027,
16233,
2102,
1012,
3091,
1025,
2005,
1006,
13075,
1045,
1027,
5034,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exceljs/exceljs | lib/utils/zip-stream.js | function(options) {
this.count = 0;
this.jsZip = new JSZip();
this.stream = new StreamBuf();
this.stream.on('finish', () => {
this._process();
});
this.getEntryType = options.getEntryType || (() => 'string');
} | javascript | function(options) {
this.count = 0;
this.jsZip = new JSZip();
this.stream = new StreamBuf();
this.stream.on('finish', () => {
this._process();
});
this.getEntryType = options.getEntryType || (() => 'string');
} | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"count",
"=",
"0",
";",
"this",
".",
"jsZip",
"=",
"new",
"JSZip",
"(",
")",
";",
"this",
".",
"stream",
"=",
"new",
"StreamBuf",
"(",
")",
";",
"this",
".",
"stream",
".",
"on",
"(",
"'finish'",... | ============================================================================= The ZipReader class Unpacks an incoming zip stream | [
"=============================================================================",
"The",
"ZipReader",
"class",
"Unpacks",
"an",
"incoming",
"zip",
"stream"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/utils/zip-stream.js#L19-L27 | train | A class that represents a single entry in the zip file. | [
30522,
3853,
1006,
7047,
1007,
1063,
2023,
1012,
4175,
1027,
1014,
1025,
2023,
1012,
1046,
17112,
11514,
1027,
2047,
1046,
17112,
11514,
1006,
1007,
1025,
2023,
1012,
5460,
1027,
2047,
5460,
8569,
2546,
1006,
1007,
1025,
2023,
1012,
5460,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js | function () {
var that = this;
return Promise.resolve().then(function () {
var oCfg = sap.ui.getCore().getConfiguration();
if (!oCfg.isUI5CacheOn()) {
safeClearInstance(that);
sap.ui.getCore().getConfiguration().setUI5CacheOn(true);
}
return Promise.resolve();
});
} | javascript | function () {
var that = this;
return Promise.resolve().then(function () {
var oCfg = sap.ui.getCore().getConfiguration();
if (!oCfg.isUI5CacheOn()) {
safeClearInstance(that);
sap.ui.getCore().getConfiguration().setUI5CacheOn(true);
}
return Promise.resolve();
});
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"Promise",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"oCfg",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getConfiguration",
"(",
... | Starts the Cache Manager (all next calls to it will work against real cache data)
Usages are meant for testing purposes. If its already on, nothing will happen
@returns {*}
@protected | [
"Starts",
"the",
"Cache",
"Manager",
"(",
"all",
"next",
"calls",
"to",
"it",
"will",
"work",
"against",
"real",
"cache",
"data",
")",
"Usages",
"are",
"meant",
"for",
"testing",
"purposes",
".",
"If",
"its",
"already",
"on",
"nothing",
"will",
"happen"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L260-L270 | train | Clear all the cache instances | [
30522,
3853,
1006,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
2709,
4872,
1012,
10663,
1006,
1007,
1012,
2059,
1006,
3853,
1006,
1007,
1063,
13075,
1051,
2278,
2546,
2290,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (mChangeListeners, sPropertyPath, vValue) {
var aListeners = mChangeListeners[sPropertyPath],
i;
if (aListeners) {
for (i = 0; i < aListeners.length; i += 1) {
aListeners[i].onChange(vValue);
}
}
} | javascript | function (mChangeListeners, sPropertyPath, vValue) {
var aListeners = mChangeListeners[sPropertyPath],
i;
if (aListeners) {
for (i = 0; i < aListeners.length; i += 1) {
aListeners[i].onChange(vValue);
}
}
} | [
"function",
"(",
"mChangeListeners",
",",
"sPropertyPath",
",",
"vValue",
")",
"{",
"var",
"aListeners",
"=",
"mChangeListeners",
"[",
"sPropertyPath",
"]",
",",
"i",
";",
"if",
"(",
"aListeners",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aL... | Fires a change event to all listeners for the given path in mChangeListeners.
@param {object} mChangeListeners A map of change listeners by path
@param {string} sPropertyPath The path
@param {any} vValue The value to report to the listeners | [
"Fires",
"a",
"change",
"event",
"to",
"all",
"listeners",
"for",
"the",
"given",
"path",
"in",
"mChangeListeners",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L395-L404 | train | Call all listeners | [
30522,
3853,
1006,
11338,
18003,
29282,
6528,
2545,
1010,
11867,
18981,
15010,
15069,
1010,
1058,
10175,
5657,
1007,
1063,
13075,
4862,
16173,
2545,
1027,
11338,
18003,
29282,
6528,
2545,
1031,
11867,
18981,
15010,
15069,
1033,
1010,
1045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/DOMHelpers.js | _findTag | function _findTag(src, skip) {
var from, to, inc;
from = _find(src, [/<[a-z!\/]/i, 2], skip);
if (from < 0) {
return null;
}
if (src.substr(from, 4) === "<!--") {
// html comments
to = _find(src, "-->", from + 4);
inc = 3;
} else if (src.substr(from, 7).toLowerCase() === "<script") {
// script tag
to = _find(src.toLowerCase(), "</script>", from + 7);
inc = 9;
} else if (src.substr(from, 6).toLowerCase() === "<style") {
// style tag
to = _find(src.toLowerCase(), "</style>", from + 6);
inc = 8;
} else {
to = _find(src, ">", from + 1, true);
inc = 1;
}
if (to < 0) {
return null;
}
return {from: from, length: to + inc - from};
} | javascript | function _findTag(src, skip) {
var from, to, inc;
from = _find(src, [/<[a-z!\/]/i, 2], skip);
if (from < 0) {
return null;
}
if (src.substr(from, 4) === "<!--") {
// html comments
to = _find(src, "-->", from + 4);
inc = 3;
} else if (src.substr(from, 7).toLowerCase() === "<script") {
// script tag
to = _find(src.toLowerCase(), "</script>", from + 7);
inc = 9;
} else if (src.substr(from, 6).toLowerCase() === "<style") {
// style tag
to = _find(src.toLowerCase(), "</style>", from + 6);
inc = 8;
} else {
to = _find(src, ">", from + 1, true);
inc = 1;
}
if (to < 0) {
return null;
}
return {from: from, length: to + inc - from};
} | [
"function",
"_findTag",
"(",
"src",
",",
"skip",
")",
"{",
"var",
"from",
",",
"to",
",",
"inc",
";",
"from",
"=",
"_find",
"(",
"src",
",",
"[",
"/",
"<[a-z!\\/]",
"/",
"i",
",",
"2",
"]",
",",
"skip",
")",
";",
"if",
"(",
"from",
"<",
"0",
... | Find the next tag
@param {string} source string
@param {integer} ignore characters before this offset | [
"Find",
"the",
"next",
"tag"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L116-L142 | train | find tag in src | [
30522,
3853,
1035,
2424,
15900,
1006,
5034,
2278,
1010,
13558,
1007,
1063,
13075,
2013,
1010,
2000,
1010,
4297,
1025,
2013,
1027,
1035,
2424,
1006,
5034,
2278,
1010,
1031,
1013,
1026,
1031,
1037,
1011,
1062,
999,
1032,
1013,
1033,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-bitwise.js | report | function report(node) {
context.report({ node, messageId: "unexpected", data: { operator: node.operator } });
} | javascript | function report(node) {
context.report({ node, messageId: "unexpected", data: { operator: node.operator } });
} | [
"function",
"report",
"(",
"node",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"messageId",
":",
"\"unexpected\"",
",",
"data",
":",
"{",
"operator",
":",
"node",
".",
"operator",
"}",
"}",
")",
";",
"}"
] | Reports an unexpected use of a bitwise operator.
@param {ASTNode} node Node which contains the bitwise operator.
@returns {void} | [
"Reports",
"an",
"unexpected",
"use",
"of",
"a",
"bitwise",
"operator",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-bitwise.js#L69-L71 | train | Reports an unexpected operator. | [
30522,
3853,
3189,
1006,
13045,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
4471,
3593,
1024,
1000,
9223,
1000,
1010,
2951,
1024,
1063,
6872,
1024,
13045,
1012,
6872,
1065,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/localization.js | checkDimensions | function checkDimensions(child) {
if (!child.boxObject)
return [];
var childBox = child.boxObject;
var parent = childBox.parentBox;
// toplevel element or hidden elements, like script tags
if (!parent || parent == child.element || !parent.boxObject) {
return [];
}
var parentBox = parent.boxObject;
var badRects = [];
// check width
if (childBox.height && childBox.screenX < parentBox.screenX) {
badRects.push([childBox.x, childBox.y, parentBox.x - childBox.x,
childBox.height]);
jumlib.assert(false, 'Node is cut off at the left: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
if (childBox.height && childBox.screenX + childBox.width >
parentBox.screenX + parentBox.width) {
badRects.push([parentBox.x + parentBox.width, childBox.y,
childBox.x + childBox.width - parentBox.x - parentBox.width,
childBox.height]);
jumlib.assert(false, 'Node is cut off at the right: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
// check height
// We don't want to test menupopup's, as they always report the full height
// of all items in the popup
if (child.nodeName != 'menupopup' && parent.nodeName != 'menupopup') {
if (childBox.width && childBox.screenY < parentBox.screenY) {
badRects.push([childBox.x, childBox.y, parentBox.y - childBox.y,
childBox.width]);
jumlib.assert(false, 'Node is cut off at the top: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
if (childBox.width && childBox.screenY + childBox.height >
parentBox.screenY + parentBox.height) {
badRects.push([childBox.x, parentBox.y + parentBox.height,
childBox.width,
childBox.y + childBox.height - parentBox.y - parentBox.height]);
jumlib.assert(false, 'Node is cut off at the bottom: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
}
return badRects;
} | javascript | function checkDimensions(child) {
if (!child.boxObject)
return [];
var childBox = child.boxObject;
var parent = childBox.parentBox;
// toplevel element or hidden elements, like script tags
if (!parent || parent == child.element || !parent.boxObject) {
return [];
}
var parentBox = parent.boxObject;
var badRects = [];
// check width
if (childBox.height && childBox.screenX < parentBox.screenX) {
badRects.push([childBox.x, childBox.y, parentBox.x - childBox.x,
childBox.height]);
jumlib.assert(false, 'Node is cut off at the left: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
if (childBox.height && childBox.screenX + childBox.width >
parentBox.screenX + parentBox.width) {
badRects.push([parentBox.x + parentBox.width, childBox.y,
childBox.x + childBox.width - parentBox.x - parentBox.width,
childBox.height]);
jumlib.assert(false, 'Node is cut off at the right: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
// check height
// We don't want to test menupopup's, as they always report the full height
// of all items in the popup
if (child.nodeName != 'menupopup' && parent.nodeName != 'menupopup') {
if (childBox.width && childBox.screenY < parentBox.screenY) {
badRects.push([childBox.x, childBox.y, parentBox.y - childBox.y,
childBox.width]);
jumlib.assert(false, 'Node is cut off at the top: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
if (childBox.width && childBox.screenY + childBox.height >
parentBox.screenY + parentBox.height) {
badRects.push([childBox.x, parentBox.y + parentBox.height,
childBox.width,
childBox.y + childBox.height - parentBox.y - parentBox.height]);
jumlib.assert(false, 'Node is cut off at the bottom: ' +
_reportNode(child) + '. Parent node: ' + _reportNode(parent));
}
}
return badRects;
} | [
"function",
"checkDimensions",
"(",
"child",
")",
"{",
"if",
"(",
"!",
"child",
".",
"boxObject",
")",
"return",
"[",
"]",
";",
"var",
"childBox",
"=",
"child",
".",
"boxObject",
";",
"var",
"parent",
"=",
"childBox",
".",
"parentBox",
";",
"// toplevel ... | Callback function for testing for cropped elements.
Checks if the XUL boxObject has screen coordinates outside of
the screen coordinates of its parent. If there's no parent, return.
@param {node} child
@returns List of boxes that can be highlighted on a screenshot
@type {array of array of int} | [
"Callback",
"function",
"for",
"testing",
"for",
"cropped",
"elements",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/localization.js#L130-L181 | train | Check dimensions of a node | [
30522,
3853,
4638,
22172,
6132,
8496,
1006,
2775,
1007,
1063,
2065,
1006,
999,
2775,
1012,
3482,
16429,
20614,
1007,
2709,
1031,
1033,
1025,
13075,
2775,
8758,
1027,
2775,
1012,
3482,
16429,
20614,
1025,
13075,
6687,
1027,
2775,
8758,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/scale/Time.js | function (a, x, lo, hi) {
while (lo < hi) {
var mid = lo + hi >>> 1;
if (a[mid][1] < x) {
lo = mid + 1;
}
else {
hi = mid;
}
}
return lo;
} | javascript | function (a, x, lo, hi) {
while (lo < hi) {
var mid = lo + hi >>> 1;
if (a[mid][1] < x) {
lo = mid + 1;
}
else {
hi = mid;
}
}
return lo;
} | [
"function",
"(",
"a",
",",
"x",
",",
"lo",
",",
"hi",
")",
"{",
"while",
"(",
"lo",
"<",
"hi",
")",
"{",
"var",
"mid",
"=",
"lo",
"+",
"hi",
">>>",
"1",
";",
"if",
"(",
"a",
"[",
"mid",
"]",
"[",
"1",
"]",
"<",
"x",
")",
"{",
"lo",
"=... | FIXME 公用? | [
"FIXME",
"公用?"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/scale/Time.js#L57-L68 | train | returns the index of the first element of a array that is less than x | [
30522,
3853,
1006,
1037,
1010,
1060,
1010,
8840,
1010,
7632,
1007,
1063,
2096,
1006,
8840,
1026,
7632,
1007,
1063,
13075,
3054,
1027,
8840,
1009,
7632,
1028,
1028,
1028,
1015,
1025,
2065,
1006,
1037,
1031,
3054,
1033,
1031,
1015,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | parse_TransformInfoHeader | function parse_TransformInfoHeader(blob) {
var o = {};
/*var len = */blob.read_shift(4);
blob.l += 4; // must be 0x1
o.id = blob.read_shift(0, 'lpp4');
o.name = blob.read_shift(0, 'lpp4');
o.R = parse_CRYPTOVersion(blob, 4);
o.U = parse_CRYPTOVersion(blob, 4);
o.W = parse_CRYPTOVersion(blob, 4);
return o;
} | javascript | function parse_TransformInfoHeader(blob) {
var o = {};
/*var len = */blob.read_shift(4);
blob.l += 4; // must be 0x1
o.id = blob.read_shift(0, 'lpp4');
o.name = blob.read_shift(0, 'lpp4');
o.R = parse_CRYPTOVersion(blob, 4);
o.U = parse_CRYPTOVersion(blob, 4);
o.W = parse_CRYPTOVersion(blob, 4);
return o;
} | [
"function",
"parse_TransformInfoHeader",
"(",
"blob",
")",
"{",
"var",
"o",
"=",
"{",
"}",
";",
"/*var len = */",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"blob",
".",
"l",
"+=",
"4",
";",
"// must be 0x1",
"o",
".",
"id",
"=",
"blob",
".",
"re... | /* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition | [
"/",
"*",
"[",
"MS",
"-",
"OFFCRYPTO",
"]",
"2",
".",
"1",
".",
"8",
"DataSpaceDefinition"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8174-L8184 | train | Parse a transform info header | [
30522,
3853,
11968,
3366,
1035,
10938,
2378,
14876,
4974,
2121,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
1051,
1027,
1063,
1065,
1025,
1013,
1008,
13075,
18798,
1027,
1008,
1013,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1018,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (sSemantics, sTypesList, oProperty, oType) {
var aResult = [],
oV4TypeInfo = mV2SemanticsToV4TypeInfo[sSemantics];
if (oV4TypeInfo) {
sTypesList.split(",").forEach(function (sType) {
var sTargetType = oV4TypeInfo.typeMapping[sType];
if (sTargetType) {
aResult.push(oV4TypeInfo.v4EnumType + "/" + sTargetType);
} else if (Log.isLoggable(iWARNING, sLoggingModule)) {
Log.warning("Unsupported type for sap:semantics: " + sType,
oType.name + "." + oProperty.name, sLoggingModule);
}
});
}
return aResult.join(" ");
} | javascript | function (sSemantics, sTypesList, oProperty, oType) {
var aResult = [],
oV4TypeInfo = mV2SemanticsToV4TypeInfo[sSemantics];
if (oV4TypeInfo) {
sTypesList.split(",").forEach(function (sType) {
var sTargetType = oV4TypeInfo.typeMapping[sType];
if (sTargetType) {
aResult.push(oV4TypeInfo.v4EnumType + "/" + sTargetType);
} else if (Log.isLoggable(iWARNING, sLoggingModule)) {
Log.warning("Unsupported type for sap:semantics: " + sType,
oType.name + "." + oProperty.name, sLoggingModule);
}
});
}
return aResult.join(" ");
} | [
"function",
"(",
"sSemantics",
",",
"sTypesList",
",",
"oProperty",
",",
"oType",
")",
"{",
"var",
"aResult",
"=",
"[",
"]",
",",
"oV4TypeInfo",
"=",
"mV2SemanticsToV4TypeInfo",
"[",
"sSemantics",
"]",
";",
"if",
"(",
"oV4TypeInfo",
")",
"{",
"sTypesList",
... | Compute a space-separated list of V4 annotation enumeration values for the given
sap:semantics "tel" and "email".
E.g. for <code>sap:semantics="tel;type=fax"</code> this function returns
"com.sap.vocabularies.Communication.v1.PhoneType/fax".
@param {string} sSemantics
the sap:semantics value ("tel" or "email")
@param {string} sTypesList
the comma-separated list of types for sap:semantics
@param {object} oProperty
the property
@param {object} oType
the type
@returns {string}
the corresponding space-separated list of V4 annotation enumeration values;
returns an empty string if the sap:semantics value is not supported; unsupported types
are logged and skipped; | [
"Compute",
"a",
"space",
"-",
"separated",
"list",
"of",
"V4",
"annotation",
"enumeration",
"values",
"for",
"the",
"given",
"sap",
":",
"semantics",
"tel",
"and",
"email",
".",
"E",
".",
"g",
".",
"for",
"<code",
">",
"sap",
":",
"semantics",
"=",
"te... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L761-L777 | train | Returns the type of the target type for the given semantic and property. | [
30522,
3853,
1006,
7020,
16704,
14606,
1010,
2358,
18863,
14540,
2923,
1010,
6728,
18981,
15010,
1010,
27178,
18863,
1007,
1063,
13075,
23631,
11314,
1027,
1031,
1033,
1010,
1051,
2615,
2549,
13874,
2378,
14876,
1027,
19842,
2475,
3366,
2386,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.