repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
blackbaud/skyux-builder | e2e/shared/common.js | prepareBuild | function prepareBuild(config) {
function serve(exitCode) {
// Save our exitCode for testing
_exitCode = exitCode;
// Reset skyuxconfig.json
resetConfig();
return server.start('unused-root', tmp)
.then(port => browser.get(`https://localhost:${port}/dist/`));
}
writeConfig(config);
... | javascript | function prepareBuild(config) {
function serve(exitCode) {
// Save our exitCode for testing
_exitCode = exitCode;
// Reset skyuxconfig.json
resetConfig();
return server.start('unused-root', tmp)
.then(port => browser.get(`https://localhost:${port}/dist/`));
}
writeConfig(config);
... | [
"function",
"prepareBuild",
"(",
"config",
")",
"{",
"function",
"serve",
"(",
"exitCode",
")",
"{",
"// Save our exitCode for testing",
"_exitCode",
"=",
"exitCode",
";",
"// Reset skyuxconfig.json",
"resetConfig",
"(",
")",
";",
"return",
"server",
".",
"start",
... | Run build given the following skyuxconfig object.
Starts server and resolves when ready. | [
"Run",
"build",
"given",
"the",
"following",
"skyuxconfig",
"object",
".",
"Starts",
"server",
"and",
"resolves",
"when",
"ready",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L111-L134 | train |
blackbaud/skyux-builder | e2e/shared/common.js | prepareServe | function prepareServe() {
if (webpackServer) {
return bindServe();
} else {
return new Promise((resolve, reject) => {
portfinder.getPortPromise()
.then(writeConfigServe)
.then(bindServe)
.then(resolve)
.catch(err => reject(err));
});
}
} | javascript | function prepareServe() {
if (webpackServer) {
return bindServe();
} else {
return new Promise((resolve, reject) => {
portfinder.getPortPromise()
.then(writeConfigServe)
.then(bindServe)
.then(resolve)
.catch(err => reject(err));
});
}
} | [
"function",
"prepareServe",
"(",
")",
"{",
"if",
"(",
"webpackServer",
")",
"{",
"return",
"bindServe",
"(",
")",
";",
"}",
"else",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"portfinder",
".",
"getPortPromise",
... | Spawns `skyux serve` and resolves once webpack is ready. | [
"Spawns",
"skyux",
"serve",
"and",
"resolves",
"once",
"webpack",
"is",
"ready",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L139-L152 | train |
blackbaud/skyux-builder | e2e/shared/common.js | rimrafPromise | function rimrafPromise(dir) {
return new Promise((resolve, reject) => {
rimraf(dir, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
} | javascript | function rimrafPromise(dir) {
return new Promise((resolve, reject) => {
rimraf(dir, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
} | [
"function",
"rimrafPromise",
"(",
"dir",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"rimraf",
"(",
"dir",
",",
"err",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"reject",
"(",
"err",
")",
";",
"}",
"else... | Wraps the rimraf command in a promise. | [
"Wraps",
"the",
"rimraf",
"command",
"in",
"a",
"promise",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L164-L174 | train |
blackbaud/skyux-builder | e2e/shared/common.js | writeConfig | function writeConfig(json) {
if (!skyuxConfigOriginal) {
skyuxConfigOriginal = JSON.parse(fs.readFileSync(skyuxConfigPath));
}
fs.writeFileSync(skyuxConfigPath, JSON.stringify(json), 'utf8');
} | javascript | function writeConfig(json) {
if (!skyuxConfigOriginal) {
skyuxConfigOriginal = JSON.parse(fs.readFileSync(skyuxConfigPath));
}
fs.writeFileSync(skyuxConfigPath, JSON.stringify(json), 'utf8');
} | [
"function",
"writeConfig",
"(",
"json",
")",
"{",
"if",
"(",
"!",
"skyuxConfigOriginal",
")",
"{",
"skyuxConfigOriginal",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"skyuxConfigPath",
")",
")",
";",
"}",
"fs",
".",
"writeFileSync",
"("... | Writes the specified json to the skyuxconfig.json file | [
"Writes",
"the",
"specified",
"json",
"to",
"the",
"skyuxconfig",
".",
"json",
"file"
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L179-L185 | train |
blackbaud/skyux-builder | e2e/shared/common.js | writeConfigServe | function writeConfigServe(port) {
return new Promise(resolve => {
_port = port;
const skyuxConfigWithPort = merge(true, skyuxConfigOriginal, {
app: {
port: port
}
});
writeConfig(skyuxConfigWithPort);
const args = [cliPath, `serve`, `-l`, `none`, `--logFormat`, `none`];
we... | javascript | function writeConfigServe(port) {
return new Promise(resolve => {
_port = port;
const skyuxConfigWithPort = merge(true, skyuxConfigOriginal, {
app: {
port: port
}
});
writeConfig(skyuxConfigWithPort);
const args = [cliPath, `serve`, `-l`, `none`, `--logFormat`, `none`];
we... | [
"function",
"writeConfigServe",
"(",
"port",
")",
"{",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"_port",
"=",
"port",
";",
"const",
"skyuxConfigWithPort",
"=",
"merge",
"(",
"true",
",",
"skyuxConfigOriginal",
",",
"{",
"app",
":",
"{",
"port... | Write the config needed for serve | [
"Write",
"the",
"config",
"needed",
"for",
"serve"
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/e2e/shared/common.js#L190-L205 | train |
blackbaud/skyux-builder | cli/utils/server.js | start | function start(root, distPath) {
return new Promise((resolve, reject) => {
const dist = path.resolve(process.cwd(), distPath || 'dist');
logger.info('Creating web server');
app.use(cors());
logger.info(`Exposing static directory: ${dist}`);
app.use(express.static(dist));
if (root) {
l... | javascript | function start(root, distPath) {
return new Promise((resolve, reject) => {
const dist = path.resolve(process.cwd(), distPath || 'dist');
logger.info('Creating web server');
app.use(cors());
logger.info(`Exposing static directory: ${dist}`);
app.use(express.static(dist));
if (root) {
l... | [
"function",
"start",
"(",
"root",
",",
"distPath",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"dist",
"=",
"path",
".",
"resolve",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"distPath",
"||",
... | Starts the httpServer
@name start | [
"Starts",
"the",
"httpServer"
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/utils/server.js#L20-L56 | train |
blackbaud/skyux-builder | config/webpack/common.webpack.config.js | getWebpackConfig | function getWebpackConfig(skyPagesConfig, argv = {}) {
const resolves = [
process.cwd(),
spaPath('node_modules'),
outPath('node_modules')
];
let alias = aliasBuilder.buildAliasList(skyPagesConfig);
const outConfigMode = skyPagesConfig && skyPagesConfig.skyux && skyPagesConfig.skyux.mode;
const l... | javascript | function getWebpackConfig(skyPagesConfig, argv = {}) {
const resolves = [
process.cwd(),
spaPath('node_modules'),
outPath('node_modules')
];
let alias = aliasBuilder.buildAliasList(skyPagesConfig);
const outConfigMode = skyPagesConfig && skyPagesConfig.skyux && skyPagesConfig.skyux.mode;
const l... | [
"function",
"getWebpackConfig",
"(",
"skyPagesConfig",
",",
"argv",
"=",
"{",
"}",
")",
"{",
"const",
"resolves",
"=",
"[",
"process",
".",
"cwd",
"(",
")",
",",
"spaPath",
"(",
"'node_modules'",
")",
",",
"outPath",
"(",
"'node_modules'",
")",
"]",
";",... | Called when loaded via require.
@name getWebpackConfig
@param {SkyPagesConfig} skyPagesConfig
@returns {WebpackConfig} webpackConfig | [
"Called",
"when",
"loaded",
"via",
"require",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/config/webpack/common.webpack.config.js#L41-L178 | train |
blackbaud/skyux-builder | cli/version.js | version | function version() {
const packageJson = require(path.resolve(__dirname, '..', 'package.json'));
logger.info('@blackbaud/skyux-builder: %s', packageJson.version);
} | javascript | function version() {
const packageJson = require(path.resolve(__dirname, '..', 'package.json'));
logger.info('@blackbaud/skyux-builder: %s', packageJson.version);
} | [
"function",
"version",
"(",
")",
"{",
"const",
"packageJson",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"'package.json'",
")",
")",
";",
"logger",
".",
"info",
"(",
"'@blackbaud/skyux-builder: %s'",
",",
"packageJson",
... | Returns the version from package.json.
@name version | [
"Returns",
"the",
"version",
"from",
"package",
".",
"json",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/version.js#L11-L14 | train |
blackbaud/skyux-builder | cli/build-public-library.js | createBundle | function createBundle(skyPagesConfig, webpack) {
const webpackConfig = require('../config/webpack/build-public-library.webpack.config');
const config = webpackConfig.getWebpackConfig(skyPagesConfig);
return runCompiler(webpack, config);
} | javascript | function createBundle(skyPagesConfig, webpack) {
const webpackConfig = require('../config/webpack/build-public-library.webpack.config');
const config = webpackConfig.getWebpackConfig(skyPagesConfig);
return runCompiler(webpack, config);
} | [
"function",
"createBundle",
"(",
"skyPagesConfig",
",",
"webpack",
")",
"{",
"const",
"webpackConfig",
"=",
"require",
"(",
"'../config/webpack/build-public-library.webpack.config'",
")",
";",
"const",
"config",
"=",
"webpackConfig",
".",
"getWebpackConfig",
"(",
"skyPa... | Creates a UMD JavaScript bundle.
@param {*} skyPagesConfig
@param {*} webpack | [
"Creates",
"a",
"UMD",
"JavaScript",
"bundle",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/build-public-library.js#L128-L132 | train |
blackbaud/skyux-builder | cli/build-public-library.js | transpile | function transpile() {
return new Promise((resolve, reject) => {
const result = spawn.sync(
skyPagesConfigUtil.spaPath('node_modules', '.bin', 'ngc'),
[
'--project',
skyPagesConfigUtil.spaPathTemp('tsconfig.json')
],
{ stdio: 'inherit' }
);
// Catch ngc errors.
... | javascript | function transpile() {
return new Promise((resolve, reject) => {
const result = spawn.sync(
skyPagesConfigUtil.spaPath('node_modules', '.bin', 'ngc'),
[
'--project',
skyPagesConfigUtil.spaPathTemp('tsconfig.json')
],
{ stdio: 'inherit' }
);
// Catch ngc errors.
... | [
"function",
"transpile",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"result",
"=",
"spawn",
".",
"sync",
"(",
"skyPagesConfigUtil",
".",
"spaPath",
"(",
"'node_modules'",
",",
"'.bin'",
",",
"'... | Transpiles TypeScript files into JavaScript files
to be included with the NPM package. | [
"Transpiles",
"TypeScript",
"files",
"into",
"JavaScript",
"files",
"to",
"be",
"included",
"with",
"the",
"NPM",
"package",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/build-public-library.js#L138-L163 | train |
blackbaud/skyux-builder | lib/assets-processor.js | getAssetsUrl | function getAssetsUrl(skyPagesConfig, baseUrl, rel) {
return baseUrl + skyPagesConfig.runtime.app.base + (rel || '');
} | javascript | function getAssetsUrl(skyPagesConfig, baseUrl, rel) {
return baseUrl + skyPagesConfig.runtime.app.base + (rel || '');
} | [
"function",
"getAssetsUrl",
"(",
"skyPagesConfig",
",",
"baseUrl",
",",
"rel",
")",
"{",
"return",
"baseUrl",
"+",
"skyPagesConfig",
".",
"runtime",
".",
"app",
".",
"base",
"+",
"(",
"rel",
"||",
"''",
")",
";",
"}"
] | Gets the assets URL with the application's root directory appended to it.
@param {*} skyPagesConfig The SKY UX app config.
@param {*} baseUrl The base URL where the assets will be served.
@param {*} rel An additional relative path to append to the assets base URL
once the application's root directory has been appended. | [
"Gets",
"the",
"assets",
"URL",
"with",
"the",
"application",
"s",
"root",
"directory",
"appended",
"to",
"it",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/lib/assets-processor.js#L22-L24 | train |
blackbaud/skyux-builder | lib/assets-processor.js | processAssets | function processAssets(content, baseUrl, callback) {
let match = ASSETS_REGEX.exec(content);
while (match) {
const matchString = match[0];
let filePath;
let filePathWithHash;
if (isLocaleFile(matchString)) {
filePath = resolvePhysicalLocaleFilePath(matchString);
filePathWithHash = res... | javascript | function processAssets(content, baseUrl, callback) {
let match = ASSETS_REGEX.exec(content);
while (match) {
const matchString = match[0];
let filePath;
let filePathWithHash;
if (isLocaleFile(matchString)) {
filePath = resolvePhysicalLocaleFilePath(matchString);
filePathWithHash = res... | [
"function",
"processAssets",
"(",
"content",
",",
"baseUrl",
",",
"callback",
")",
"{",
"let",
"match",
"=",
"ASSETS_REGEX",
".",
"exec",
"(",
"content",
")",
";",
"while",
"(",
"match",
")",
"{",
"const",
"matchString",
"=",
"match",
"[",
"0",
"]",
";... | Finds referenced assets in a file and replaces occurrences in the file's
contents with the absolute URL.
@param {*} content The file contents.
@param {*} baseUrl The base URL where the assets will be served.
@param {*} callback A function to call for each found asset path. The function will be
provided the file path wi... | [
"Finds",
"referenced",
"assets",
"in",
"a",
"file",
"and",
"replaces",
"occurrences",
"in",
"the",
"file",
"s",
"contents",
"with",
"the",
"absolute",
"URL",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/lib/assets-processor.js#L35-L69 | train |
blackbaud/skyux-builder | lib/assets-processor.js | setSkyAssetsLoaderUrl | function setSkyAssetsLoaderUrl(webpackConfig, skyPagesConfig, baseUrl, rel) {
const rules = webpackConfig &&
webpackConfig.module &&
webpackConfig.module.rules;
if (rules) {
const assetsRule = rules.find(rule => /sky-assets$/.test(rule.loader));
assetsRule.options = assetsRule.options || {};
as... | javascript | function setSkyAssetsLoaderUrl(webpackConfig, skyPagesConfig, baseUrl, rel) {
const rules = webpackConfig &&
webpackConfig.module &&
webpackConfig.module.rules;
if (rules) {
const assetsRule = rules.find(rule => /sky-assets$/.test(rule.loader));
assetsRule.options = assetsRule.options || {};
as... | [
"function",
"setSkyAssetsLoaderUrl",
"(",
"webpackConfig",
",",
"skyPagesConfig",
",",
"baseUrl",
",",
"rel",
")",
"{",
"const",
"rules",
"=",
"webpackConfig",
"&&",
"webpackConfig",
".",
"module",
"&&",
"webpackConfig",
".",
"module",
".",
"rules",
";",
"if",
... | Sets the assets URL on Webpack loaders that reference it.
@param {*} webpackConfig The Webpack config object.
@param {*} skyPagesConfig The SKY UX app config.
@param {*} baseUrl The base URL where the assets will be served.
@param {*} rel An additional relative path to append to the assets base URL
once the application... | [
"Sets",
"the",
"assets",
"URL",
"on",
"Webpack",
"loaders",
"that",
"reference",
"it",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/lib/assets-processor.js#L79-L89 | train |
blackbaud/skyux-builder | utils/assets-utils.js | getFilePathWithHash | function getFilePathWithHash(filePath, rel) {
const indexOfLastDot = filePath.lastIndexOf('.');
let filePathWithHash = filePath.substr(0, indexOfLastDot) +
'.' +
hashFile.sync(skyPagesConfigUtil.spaPath('src', filePath)) +
'.' +
filePath.substr(indexOfLastDot + 1);
if (!rel) {
const srcPath ... | javascript | function getFilePathWithHash(filePath, rel) {
const indexOfLastDot = filePath.lastIndexOf('.');
let filePathWithHash = filePath.substr(0, indexOfLastDot) +
'.' +
hashFile.sync(skyPagesConfigUtil.spaPath('src', filePath)) +
'.' +
filePath.substr(indexOfLastDot + 1);
if (!rel) {
const srcPath ... | [
"function",
"getFilePathWithHash",
"(",
"filePath",
",",
"rel",
")",
"{",
"const",
"indexOfLastDot",
"=",
"filePath",
".",
"lastIndexOf",
"(",
"'.'",
")",
";",
"let",
"filePathWithHash",
"=",
"filePath",
".",
"substr",
"(",
"0",
",",
"indexOfLastDot",
")",
"... | Appends the hash of the specified file to the end of the file path.
@param {*} filePath The path to the file.
@param {*} rel Optional Boolean flag indicating whether the returned path should be relative
to the app's src path. | [
"Appends",
"the",
"hash",
"of",
"the",
"specified",
"file",
"to",
"the",
"end",
"of",
"the",
"file",
"path",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/utils/assets-utils.js#L13-L28 | train |
blackbaud/skyux-builder | utils/assets-utils.js | getUrl | function getUrl(baseUrl, filePath) {
const filePathWithHash = getFilePathWithHash(filePath);
const url = `${baseUrl}${filePathWithHash.replace(/\\/gi, '/')}`;
return url;
} | javascript | function getUrl(baseUrl, filePath) {
const filePathWithHash = getFilePathWithHash(filePath);
const url = `${baseUrl}${filePathWithHash.replace(/\\/gi, '/')}`;
return url;
} | [
"function",
"getUrl",
"(",
"baseUrl",
",",
"filePath",
")",
"{",
"const",
"filePathWithHash",
"=",
"getFilePathWithHash",
"(",
"filePath",
")",
";",
"const",
"url",
"=",
"`",
"${",
"baseUrl",
"}",
"${",
"filePathWithHash",
".",
"replace",
"(",
"/",
"\\\\",
... | Gets the URL to a hashed file name.
@param {*} baseUrl The base of the URL where the page is being served.
@param {*} filePath The path to the file. | [
"Gets",
"the",
"URL",
"to",
"a",
"hashed",
"file",
"name",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/utils/assets-utils.js#L35-L41 | train |
blackbaud/skyux-builder | cli/serve.js | getPort | function getPort(config, skyPagesConfig) {
return new Promise((resolve, reject) => {
const configPort = skyPagesConfig &&
skyPagesConfig.skyux &&
skyPagesConfig.skyux.app &&
skyPagesConfig.skyux.app.port;
if (configPort) {
resolve(configPort);
} else if (config.devServer && config... | javascript | function getPort(config, skyPagesConfig) {
return new Promise((resolve, reject) => {
const configPort = skyPagesConfig &&
skyPagesConfig.skyux &&
skyPagesConfig.skyux.app &&
skyPagesConfig.skyux.app.port;
if (configPort) {
resolve(configPort);
} else if (config.devServer && config... | [
"function",
"getPort",
"(",
"config",
",",
"skyPagesConfig",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"configPort",
"=",
"skyPagesConfig",
"&&",
"skyPagesConfig",
".",
"skyux",
"&&",
"skyPagesConfig",
... | Let users configure port via skyuxconfig.json first.
Else another plugin has specified devServer.port, use it.
Else, find us an available port.
@name getPort
@returns {Number} port | [
"Let",
"users",
"configure",
"port",
"via",
"skyuxconfig",
".",
"json",
"first",
".",
"Else",
"another",
"plugin",
"has",
"specified",
"devServer",
".",
"port",
"use",
"it",
".",
"Else",
"find",
"us",
"an",
"available",
"port",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/serve.js#L16-L33 | train |
blackbaud/skyux-builder | cli/serve.js | serve | function serve(argv, skyPagesConfig, webpack, WebpackDevServer) {
const webpackConfig = require('../config/webpack/serve.webpack.config');
let config = webpackConfig.getWebpackConfig(argv, skyPagesConfig);
getPort(config, skyPagesConfig).then(port => {
const localUrl = `https://localhost:${port}`;
asse... | javascript | function serve(argv, skyPagesConfig, webpack, WebpackDevServer) {
const webpackConfig = require('../config/webpack/serve.webpack.config');
let config = webpackConfig.getWebpackConfig(argv, skyPagesConfig);
getPort(config, skyPagesConfig).then(port => {
const localUrl = `https://localhost:${port}`;
asse... | [
"function",
"serve",
"(",
"argv",
",",
"skyPagesConfig",
",",
"webpack",
",",
"WebpackDevServer",
")",
"{",
"const",
"webpackConfig",
"=",
"require",
"(",
"'../config/webpack/serve.webpack.config'",
")",
";",
"let",
"config",
"=",
"webpackConfig",
".",
"getWebpackCo... | Executes the serve command.
@name serve
@name {Object} argv
@name {SkyPagesConfig} skyPagesConfig
@name {Webpack} webpack
@name {WebpackDevServer} WebpackDevServer
@returns null | [
"Executes",
"the",
"serve",
"command",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/cli/serve.js#L44-L86 | train |
blackbaud/skyux-builder | config/karma/shared.karma.conf.js | function (item) {
const resolvedPath = path.resolve(item);
const ignore = (resolvedPath.indexOf(srcPath) === -1);
return ignore;
} | javascript | function (item) {
const resolvedPath = path.resolve(item);
const ignore = (resolvedPath.indexOf(srcPath) === -1);
return ignore;
} | [
"function",
"(",
"item",
")",
"{",
"const",
"resolvedPath",
"=",
"path",
".",
"resolve",
"(",
"item",
")",
";",
"const",
"ignore",
"=",
"(",
"resolvedPath",
".",
"indexOf",
"(",
"srcPath",
")",
"===",
"-",
"1",
")",
";",
"return",
"ignore",
";",
"}"
... | Returning `true` means the file should be ignored. Fat-Arrow functions do not work as chokidar will inspect this method. | [
"Returning",
"true",
"means",
"the",
"file",
"should",
"be",
"ignored",
".",
"Fat",
"-",
"Arrow",
"functions",
"do",
"not",
"work",
"as",
"chokidar",
"will",
"inspect",
"this",
"method",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/config/karma/shared.karma.conf.js#L177-L181 | train | |
blackbaud/skyux-builder | config/sky-pages/sky-pages.config.js | resolve | function resolve(root, args) {
args = root.concat(Array.prototype.slice.call(args));
return path.resolve.apply(path, args);
} | javascript | function resolve(root, args) {
args = root.concat(Array.prototype.slice.call(args));
return path.resolve.apply(path, args);
} | [
"function",
"resolve",
"(",
"root",
",",
"args",
")",
"{",
"args",
"=",
"root",
".",
"concat",
"(",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"args",
")",
")",
";",
"return",
"path",
".",
"resolve",
".",
"apply",
"(",
"path",
",",
... | Resolves a path given a root path and an array-like arguments object.
@name resolve
@param {String} root The root path.
@param {Array} args An array or array-like object of additional path parts to add to the root.
@returns {String} The resolved path. | [
"Resolves",
"a",
"path",
"given",
"a",
"root",
"path",
"and",
"an",
"array",
"-",
"like",
"arguments",
"object",
"."
] | fe8c622f12817552f85940abe194ddcb262e7b44 | https://github.com/blackbaud/skyux-builder/blob/fe8c622f12817552f85940abe194ddcb262e7b44/config/sky-pages/sky-pages.config.js#L16-L19 | train |
feross/vlc-command | index.js | getInstallDir | function getInstallDir (cb) {
var key = new Registry({
hive: Registry.HKLM,
key: '\\Software\\VideoLAN\\VLC'
})
key.get('InstallDir', cb)
} | javascript | function getInstallDir (cb) {
var key = new Registry({
hive: Registry.HKLM,
key: '\\Software\\VideoLAN\\VLC'
})
key.get('InstallDir', cb)
} | [
"function",
"getInstallDir",
"(",
"cb",
")",
"{",
"var",
"key",
"=",
"new",
"Registry",
"(",
"{",
"hive",
":",
"Registry",
".",
"HKLM",
",",
"key",
":",
"'\\\\Software\\\\VideoLAN\\\\VLC'",
"}",
")",
"key",
".",
"get",
"(",
"'InstallDir'",
",",
"cb",
")"... | 32-bit Windows with 32-bit VLC, and 64-bit Windows with 64-bit VLC | [
"32",
"-",
"bit",
"Windows",
"with",
"32",
"-",
"bit",
"VLC",
"and",
"64",
"-",
"bit",
"Windows",
"with",
"64",
"-",
"bit",
"VLC"
] | ac71ecf65b67b5142ef0081776946ed029dbf0f1 | https://github.com/feross/vlc-command/blob/ac71ecf65b67b5142ef0081776946ed029dbf0f1/index.js#L30-L36 | train |
traveloka/javascript | packages/eslint-plugin-marlint/lib/rules/limited-danger.js | isAllowedTagName | function isAllowedTagName(name) {
const config = context.options[0] || {};
const allowedTagNames = config.allowedTagNames || DEFAULTS;
return allowedTagNames.indexOf(name) !== -1;
} | javascript | function isAllowedTagName(name) {
const config = context.options[0] || {};
const allowedTagNames = config.allowedTagNames || DEFAULTS;
return allowedTagNames.indexOf(name) !== -1;
} | [
"function",
"isAllowedTagName",
"(",
"name",
")",
"{",
"const",
"config",
"=",
"context",
".",
"options",
"[",
"0",
"]",
"||",
"{",
"}",
";",
"const",
"allowedTagNames",
"=",
"config",
".",
"allowedTagNames",
"||",
"DEFAULTS",
";",
"return",
"allowedTagNames... | Checks if a node name is allowed to have dangerous attribute.
@param {String} tagName - JSX tag name
@returns {boolean} Whether or not tag name is allowed to have dangerous attribute | [
"Checks",
"if",
"a",
"node",
"name",
"is",
"allowed",
"to",
"have",
"dangerous",
"attribute",
"."
] | ff72daaee5994b8a137b072e2595730583eaebbe | https://github.com/traveloka/javascript/blob/ff72daaee5994b8a137b072e2595730583eaebbe/packages/eslint-plugin-marlint/lib/rules/limited-danger.js#L62-L66 | train |
jscs-dev/grunt-jscs | tasks/lib/jscs.js | JSCS | function JSCS( options ) {
this.checker = new Checker();
this.options = options;
this._reporter = null;
this.checker.registerDefaultRules();
this.checker.configure( this.getConfig() );
this.registerReporter( options.reporter );
} | javascript | function JSCS( options ) {
this.checker = new Checker();
this.options = options;
this._reporter = null;
this.checker.registerDefaultRules();
this.checker.configure( this.getConfig() );
this.registerReporter( options.reporter );
} | [
"function",
"JSCS",
"(",
"options",
")",
"{",
"this",
".",
"checker",
"=",
"new",
"Checker",
"(",
")",
";",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"_reporter",
"=",
"null",
";",
"this",
".",
"checker",
".",
"registerDefaultRules",
"(... | Create new instance of jscs Checker module
@constructor
@param {Object} options
@return {JSCS} | [
"Create",
"new",
"instance",
"of",
"jscs",
"Checker",
"module"
] | efff3087a86296b4a6e8810a0f5e4c215be6210d | https://github.com/jscs-dev/grunt-jscs/blob/efff3087a86296b4a6e8810a0f5e4c215be6210d/tasks/lib/jscs.js#L35-L44 | train |
osk/node-webvtt | lib/parser.js | parseCue | function parseCue (cue, i) {
let identifier = '';
let start = 0;
let end = 0.01;
let text = '';
let styles = '';
// split and remove empty lines
const lines = cue.split('\n').filter(Boolean);
if (lines.length > 0 && lines[0].trim().startsWith('NOTE')) {
return null;
}
if (lines.length === 1 &... | javascript | function parseCue (cue, i) {
let identifier = '';
let start = 0;
let end = 0.01;
let text = '';
let styles = '';
// split and remove empty lines
const lines = cue.split('\n').filter(Boolean);
if (lines.length > 0 && lines[0].trim().startsWith('NOTE')) {
return null;
}
if (lines.length === 1 &... | [
"function",
"parseCue",
"(",
"cue",
",",
"i",
")",
"{",
"let",
"identifier",
"=",
"''",
";",
"let",
"start",
"=",
"0",
";",
"let",
"end",
"=",
"0.01",
";",
"let",
"text",
"=",
"''",
";",
"let",
"styles",
"=",
"''",
";",
"// split and remove empty lin... | Parse a single cue block.
@param {array} cue Array of content for the cue
@param {number} i Index of cue in array
@returns {object} cue Cue object with start, end, text and styles.
Null if it's a note | [
"Parse",
"a",
"single",
"cue",
"block",
"."
] | b75a4b9f9025030dde4f238ad043a1e33e9e703a | https://github.com/osk/node-webvtt/blob/b75a4b9f9025030dde4f238ad043a1e33e9e703a/lib/parser.js#L92-L151 | train |
osk/node-webvtt | lib/compiler.js | compileCue | function compileCue (cue) {
// TODO: check for malformed JSON
if (typeof cue !== 'object') {
throw new CompilerError('Cue malformed: not of type object');
}
if (typeof cue.identifier !== 'string' &&
typeof cue.identifier !== 'number' &&
cue.identifier !== null) {
throw new CompilerError(`Cu... | javascript | function compileCue (cue) {
// TODO: check for malformed JSON
if (typeof cue !== 'object') {
throw new CompilerError('Cue malformed: not of type object');
}
if (typeof cue.identifier !== 'string' &&
typeof cue.identifier !== 'number' &&
cue.identifier !== null) {
throw new CompilerError(`Cu... | [
"function",
"compileCue",
"(",
"cue",
")",
"{",
"// TODO: check for malformed JSON",
"if",
"(",
"typeof",
"cue",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"CompilerError",
"(",
"'Cue malformed: not of type object'",
")",
";",
"}",
"if",
"(",
"typeof",
"cue",
... | Compile a single cue block.
@param {array} cue Array of content for the cue
@returns {object} cue Cue object with start, end, text and styles.
Null if it's a note | [
"Compile",
"a",
"single",
"cue",
"block",
"."
] | b75a4b9f9025030dde4f238ad043a1e33e9e703a | https://github.com/osk/node-webvtt/blob/b75a4b9f9025030dde4f238ad043a1e33e9e703a/lib/compiler.js#L51-L103 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | drawSelectionRange | function drawSelectionRange(cm,range$$1,output){var display=cm.display,doc=cm.doc;var fragment=document.createDocumentFragment();var padding=paddingH(cm.display),leftSide=padding.left;var rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right;var docLTR=doc.direction=="ltr";funct... | javascript | function drawSelectionRange(cm,range$$1,output){var display=cm.display,doc=cm.doc;var fragment=document.createDocumentFragment();var padding=paddingH(cm.display),leftSide=padding.left;var rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right;var docLTR=doc.direction=="ltr";funct... | [
"function",
"drawSelectionRange",
"(",
"cm",
",",
"range$$1",
",",
"output",
")",
"{",
"var",
"display",
"=",
"cm",
".",
"display",
",",
"doc",
"=",
"cm",
".",
"doc",
";",
"var",
"fragment",
"=",
"document",
".",
"createDocumentFragment",
"(",
")",
";",
... | Draws the given range as a highlighted selection | [
"Draws",
"the",
"given",
"range",
"as",
"a",
"highlighted",
"selection"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L866-L868 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | doHandleBinding | function doHandleBinding(cm,bound,dropShift){if(typeof bound=="string"){bound=commands[bound];if(!bound){return false;}}// Ensure previous input has been read, so that the handler sees a
// consistent view of the document
cm.display.input.ensurePolled();var prevShift=cm.display.shift,done=false;try{if(cm.isReadOnly()){... | javascript | function doHandleBinding(cm,bound,dropShift){if(typeof bound=="string"){bound=commands[bound];if(!bound){return false;}}// Ensure previous input has been read, so that the handler sees a
// consistent view of the document
cm.display.input.ensurePolled();var prevShift=cm.display.shift,done=false;try{if(cm.isReadOnly()){... | [
"function",
"doHandleBinding",
"(",
"cm",
",",
"bound",
",",
"dropShift",
")",
"{",
"if",
"(",
"typeof",
"bound",
"==",
"\"string\"",
")",
"{",
"bound",
"=",
"commands",
"[",
"bound",
"]",
";",
"if",
"(",
"!",
"bound",
")",
"{",
"return",
"false",
";... | Run a handler that was bound to a key. | [
"Run",
"a",
"handler",
"that",
"was",
"bound",
"to",
"a",
"key",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L1296-L1298 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | bidiSimplify | function bidiSimplify(cm,range$$1){var anchor=range$$1.anchor;var head=range$$1.head;var anchorLine=getLine(cm.doc,anchor.line);if(cmp(anchor,head)==0&&anchor.sticky==head.sticky){return range$$1;}var order=getOrder(anchorLine);if(!order){return range$$1;}var index=getBidiPartAt(order,anchor.ch,anchor.sticky),part=orde... | javascript | function bidiSimplify(cm,range$$1){var anchor=range$$1.anchor;var head=range$$1.head;var anchorLine=getLine(cm.doc,anchor.line);if(cmp(anchor,head)==0&&anchor.sticky==head.sticky){return range$$1;}var order=getOrder(anchorLine);if(!order){return range$$1;}var index=getBidiPartAt(order,anchor.ch,anchor.sticky),part=orde... | [
"function",
"bidiSimplify",
"(",
"cm",
",",
"range$$1",
")",
"{",
"var",
"anchor",
"=",
"range$$1",
".",
"anchor",
";",
"var",
"head",
"=",
"range$$1",
".",
"head",
";",
"var",
"anchorLine",
"=",
"getLine",
"(",
"cm",
".",
"doc",
",",
"anchor",
".",
... | Used when mouse-selecting to adjust the anchor to the proper side of a bidi jump depending on the visual position of the head. | [
"Used",
"when",
"mouse",
"-",
"selecting",
"to",
"adjust",
"the",
"anchor",
"to",
"the",
"proper",
"side",
"of",
"a",
"bidi",
"jump",
"depending",
"on",
"the",
"visual",
"position",
"of",
"the",
"head",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L1329-L1331 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | prepareSelectAllHack | function prepareSelectAllHack(){if(te.selectionStart!=null){var selected=cm.somethingSelected();var extval='\u200B'+(selected?te.value:"");te.value='\u21DA';// Used to catch context-menu undo
te.value=extval;input.prevInput=selected?"":'\u200B';te.selectionStart=1;te.selectionEnd=extval.length;// Re-set this, in case s... | javascript | function prepareSelectAllHack(){if(te.selectionStart!=null){var selected=cm.somethingSelected();var extval='\u200B'+(selected?te.value:"");te.value='\u21DA';// Used to catch context-menu undo
te.value=extval;input.prevInput=selected?"":'\u200B';te.selectionStart=1;te.selectionEnd=extval.length;// Re-set this, in case s... | [
"function",
"prepareSelectAllHack",
"(",
")",
"{",
"if",
"(",
"te",
".",
"selectionStart",
"!=",
"null",
")",
"{",
"var",
"selected",
"=",
"cm",
".",
"somethingSelected",
"(",
")",
";",
"var",
"extval",
"=",
"'\\u200B'",
"+",
"(",
"selected",
"?",
"te",
... | Select-all will be greyed out if there's nothing to select, so this adds a zero-width space so that we can later check whether it got selected. | [
"Select",
"-",
"all",
"will",
"be",
"greyed",
"out",
"if",
"there",
"s",
"nothing",
"to",
"select",
"so",
"this",
"adds",
"a",
"zero",
"-",
"width",
"space",
"so",
"that",
"we",
"can",
"later",
"check",
"whether",
"it",
"got",
"selected",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L1473-L1476 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | getClosestInstanceFromNode | function getClosestInstanceFromNode(node) {
if (node[internalInstanceKey]) {
return node[internalInstanceKey];
}
// Walk up the tree until we find an ancestor whose instance we have cached.
var parents = [];
while (!node[internalInstanceKey]) {
parents.push(node);
if (node.parentNode) {
nod... | javascript | function getClosestInstanceFromNode(node) {
if (node[internalInstanceKey]) {
return node[internalInstanceKey];
}
// Walk up the tree until we find an ancestor whose instance we have cached.
var parents = [];
while (!node[internalInstanceKey]) {
parents.push(node);
if (node.parentNode) {
nod... | [
"function",
"getClosestInstanceFromNode",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"[",
"internalInstanceKey",
"]",
")",
"{",
"return",
"node",
"[",
"internalInstanceKey",
"]",
";",
"}",
"// Walk up the tree until we find an ancestor whose instance we have cached.",
"var... | Given a DOM node, return the closest ReactDOMComponent or
ReactDOMTextComponent instance ancestor. | [
"Given",
"a",
"DOM",
"node",
"return",
"the",
"closest",
"ReactDOMComponent",
"or",
"ReactDOMTextComponent",
"instance",
"ancestor",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L5857-L5885 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | createRoutesFromReactChildren | function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
_react2.default.Children.forEach(children, function (element) {
if (_react2.default.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
... | javascript | function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
_react2.default.Children.forEach(children, function (element) {
if (_react2.default.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
... | [
"function",
"createRoutesFromReactChildren",
"(",
"children",
",",
"parentRoute",
")",
"{",
"var",
"routes",
"=",
"[",
"]",
";",
"_react2",
".",
"default",
".",
"Children",
".",
"forEach",
"(",
"children",
",",
"function",
"(",
"element",
")",
"{",
"if",
"... | Creates and returns a routes object from the given ReactChildren. JSX
provides a convenient way to visualize how routes in the hierarchy are
nested.
import { Route, createRoutesFromReactChildren } from 'react-router'
const routes = createRoutesFromReactChildren(
<Route component={App}>
<Route path="home" component={D... | [
"Creates",
"and",
"returns",
"a",
"routes",
"object",
"from",
"the",
"given",
"ReactChildren",
".",
"JSX",
"provides",
"a",
"convenient",
"way",
"to",
"visualize",
"how",
"routes",
"in",
"the",
"hierarchy",
"are",
"nested",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L6833-L6850 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | createRoutes | function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
} else if (routes && !Array.isArray(routes)) {
routes = [routes];
}
return routes;
} | javascript | function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
} else if (routes && !Array.isArray(routes)) {
routes = [routes];
}
return routes;
} | [
"function",
"createRoutes",
"(",
"routes",
")",
"{",
"if",
"(",
"isReactChildren",
"(",
"routes",
")",
")",
"{",
"routes",
"=",
"createRoutesFromReactChildren",
"(",
"routes",
")",
";",
"}",
"else",
"if",
"(",
"routes",
"&&",
"!",
"Array",
".",
"isArray",
... | Creates and returns an array of routes from the given object which
may be a JSX route, a plain object route, or an array of either. | [
"Creates",
"and",
"returns",
"an",
"array",
"of",
"routes",
"from",
"the",
"given",
"object",
"which",
"may",
"be",
"a",
"JSX",
"route",
"a",
"plain",
"object",
"route",
"or",
"an",
"array",
"of",
"either",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L6856-L6864 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | oneArgumentPooler | function oneArgumentPooler(copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
} | javascript | function oneArgumentPooler(copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
} | [
"function",
"oneArgumentPooler",
"(",
"copyFieldsFrom",
")",
"{",
"var",
"Klass",
"=",
"this",
";",
"if",
"(",
"Klass",
".",
"instancePool",
".",
"length",
")",
"{",
"var",
"instance",
"=",
"Klass",
".",
"instancePool",
".",
"pop",
"(",
")",
";",
"Klass"... | Static poolers. Several custom versions for each potential number of
arguments. A completely generic pooler is easy to implement, but would
require accessing the `arguments` object. In each of these, `this` refers to
the Class itself, not an instance. If any others are needed, simply add them
here, or in their own file... | [
"Static",
"poolers",
".",
"Several",
"custom",
"versions",
"for",
"each",
"potential",
"number",
"of",
"arguments",
".",
"A",
"completely",
"generic",
"pooler",
"is",
"easy",
"to",
"implement",
"but",
"would",
"require",
"accessing",
"the",
"arguments",
"object"... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L7015-L7024 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | accumulateDispatches | function accumulateDispatches(inst, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(inst, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._disp... | javascript | function accumulateDispatches(inst, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(inst, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._disp... | [
"function",
"accumulateDispatches",
"(",
"inst",
",",
"ignoredDirection",
",",
"event",
")",
"{",
"if",
"(",
"event",
"&&",
"event",
".",
"dispatchConfig",
".",
"registrationName",
")",
"{",
"var",
"registrationName",
"=",
"event",
".",
"dispatchConfig",
".",
... | Accumulates without regard to direction, does not look for phased
registration names. Same as `accumulateDirectDispatchesSingle` but without
requiring that the `dispatchMarker` be the same as the dispatched ID. | [
"Accumulates",
"without",
"regard",
"to",
"direction",
"does",
"not",
"look",
"for",
"phased",
"registration",
"names",
".",
"Same",
"as",
"accumulateDirectDispatchesSingle",
"but",
"without",
"requiring",
"that",
"the",
"dispatchMarker",
"be",
"the",
"same",
"as",
... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L7940-L7949 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | listenBefore | function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addQuery(location), callback);
});
} | javascript | function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addQuery(location), callback);
});
} | [
"function",
"listenBefore",
"(",
"hook",
")",
"{",
"return",
"history",
".",
"listenBefore",
"(",
"function",
"(",
"location",
",",
"callback",
")",
"{",
"_runTransitionHook2",
"[",
"'default'",
"]",
"(",
"hook",
",",
"addQuery",
"(",
"location",
")",
",",
... | Override all read methods with query-aware versions. | [
"Override",
"all",
"read",
"methods",
"with",
"query",
"-",
"aware",
"versions",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L9229-L9233 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | beautifyCode | function beautifyCode(str) {
var beautifulStr = str;
try {
beautifulStr = (0, _jsBeautify.html)(str, beautifySettings);
} catch (err) {
console.error('Beautify error:', err.message);
}
return beautifulStr;
} | javascript | function beautifyCode(str) {
var beautifulStr = str;
try {
beautifulStr = (0, _jsBeautify.html)(str, beautifySettings);
} catch (err) {
console.error('Beautify error:', err.message);
}
return beautifulStr;
} | [
"function",
"beautifyCode",
"(",
"str",
")",
"{",
"var",
"beautifulStr",
"=",
"str",
";",
"try",
"{",
"beautifulStr",
"=",
"(",
"0",
",",
"_jsBeautify",
".",
"html",
")",
"(",
"str",
",",
"beautifySettings",
")",
";",
"}",
"catch",
"(",
"err",
")",
"... | Try to beautify a HTML or JSX string using js-beautify;
return original string if unsuccessful
@param {String} str - a string containing HTML or JSX
@return {String} | [
"Try",
"to",
"beautify",
"a",
"HTML",
"or",
"JSX",
"string",
"using",
"js",
"-",
"beautify",
";",
"return",
"original",
"string",
"if",
"unsuccessful"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L9519-L9529 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | propsToString | function propsToString() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var propStr = '';
Object.keys(props).map(function (prop) {
var propVal = props[prop];
... | javascript | function propsToString() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var propStr = '';
Object.keys(props).map(function (prop) {
var propVal = props[prop];
... | [
"function",
"propsToString",
"(",
")",
"{",
"var",
"props",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"{",
"}",
";",
"var",
"defaultProps",
"=",
"arguments",
... | Converts an object of props to a string, excluding defaultProps
@param {Object} props - an object of React props
@param {Object} defaultProps - an object of defaults
@return {String} | [
"Converts",
"an",
"object",
"of",
"props",
"to",
"a",
"string",
"excluding",
"defaultProps"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L9680-L9701 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | invokeGuardedCallback | function invokeGuardedCallback(name, func, a) {
try {
func(a);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
}
} | javascript | function invokeGuardedCallback(name, func, a) {
try {
func(a);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
}
} | [
"function",
"invokeGuardedCallback",
"(",
"name",
",",
"func",
",",
"a",
")",
"{",
"try",
"{",
"func",
"(",
"a",
")",
";",
"}",
"catch",
"(",
"x",
")",
"{",
"if",
"(",
"caughtError",
"===",
"null",
")",
"{",
"caughtError",
"=",
"x",
";",
"}",
"}"... | Call a function while guarding against errors that happens within it.
@param {String} name of the guard to use for logging or debugging
@param {Function} func The function to invoke
@param {*} a First argument
@param {*} b Second argument | [
"Call",
"a",
"function",
"while",
"guarding",
"against",
"errors",
"that",
"happens",
"within",
"it",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L15982-L15990 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | unescape | function unescape(key) {
var unescapeRegex = /(=0|=2)/g;
var unescaperLookup = {
'=0': '=',
'=2': ':'
};
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
return ('' + keySubstring).replace(unescapeRegex, function (match) {
return unescaperLookup[match];
... | javascript | function unescape(key) {
var unescapeRegex = /(=0|=2)/g;
var unescaperLookup = {
'=0': '=',
'=2': ':'
};
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
return ('' + keySubstring).replace(unescapeRegex, function (match) {
return unescaperLookup[match];
... | [
"function",
"unescape",
"(",
"key",
")",
"{",
"var",
"unescapeRegex",
"=",
"/",
"(=0|=2)",
"/",
"g",
";",
"var",
"unescaperLookup",
"=",
"{",
"'=0'",
":",
"'='",
",",
"'=2'",
":",
"':'",
"}",
";",
"var",
"keySubstring",
"=",
"key",
"[",
"0",
"]",
"... | Unescape and unwrap key for human-readable display
@param {string} key to unescape.
@return {string} the unescaped key. | [
"Unescape",
"and",
"unwrap",
"key",
"for",
"human",
"-",
"readable",
"display"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L17251-L17262 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | findOwnerStack | function findOwnerStack(instance) {
if (!instance) {
return [];
}
var stack = [];
do {
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
} | javascript | function findOwnerStack(instance) {
if (!instance) {
return [];
}
var stack = [];
do {
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
} | [
"function",
"findOwnerStack",
"(",
"instance",
")",
"{",
"if",
"(",
"!",
"instance",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"stack",
"=",
"[",
"]",
";",
"do",
"{",
"stack",
".",
"push",
"(",
"instance",
")",
";",
"}",
"while",
"(",
"insta... | Given a ReactCompositeComponent instance, return a list of its recursive
owners, starting at the root and ending with the instance itself. | [
"Given",
"a",
"ReactCompositeComponent",
"instance",
"return",
"a",
"list",
"of",
"its",
"recursive",
"owners",
"starting",
"at",
"the",
"root",
"and",
"ending",
"with",
"the",
"instance",
"itself",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L17536-L17547 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | warning | function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in yo... | javascript | function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in yo... | [
"function",
"warning",
"(",
"message",
")",
"{",
"/* eslint-disable no-console */",
"if",
"(",
"typeof",
"console",
"!==",
"'undefined'",
"&&",
"typeof",
"console",
".",
"error",
"===",
"'function'",
")",
"{",
"console",
".",
"error",
"(",
"message",
")",
";",... | Prints a warning in the console if it exists.
@param {String} message The warning message.
@returns {void} | [
"Prints",
"a",
"warning",
"in",
"the",
"console",
"if",
"it",
"exists",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L17792-L17806 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | replaceReducer | function replaceReducer(nextReducer) {
if (typeof nextReducer !== 'function') {
throw new Error('Expected the nextReducer to be a function.');
}
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
} | javascript | function replaceReducer(nextReducer) {
if (typeof nextReducer !== 'function') {
throw new Error('Expected the nextReducer to be a function.');
}
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
} | [
"function",
"replaceReducer",
"(",
"nextReducer",
")",
"{",
"if",
"(",
"typeof",
"nextReducer",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expected the nextReducer to be a function.'",
")",
";",
"}",
"currentReducer",
"=",
"nextReducer",
";",
"... | Replaces the reducer currently used by the store to calculate the state.
You might need this if your app implements code splitting and you want to
load some of the reducers dynamically. You might also need this if you
implement a hot reloading mechanism for Redux.
@param {Function} nextReducer The reducer for the sto... | [
"Replaces",
"the",
"reducer",
"currently",
"used",
"by",
"the",
"store",
"to",
"calculate",
"the",
"state",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L18019-L18026 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | subscribe | function subscribe(observer) {
if ((typeof observer === 'undefined' ? 'undefined' : _typeof(observer)) !== 'object') {
throw new TypeError('Expected the observer to be an object.');
}
function observeState() {
if (observer.next) {
observer.next(getState());
... | javascript | function subscribe(observer) {
if ((typeof observer === 'undefined' ? 'undefined' : _typeof(observer)) !== 'object') {
throw new TypeError('Expected the observer to be an object.');
}
function observeState() {
if (observer.next) {
observer.next(getState());
... | [
"function",
"subscribe",
"(",
"observer",
")",
"{",
"if",
"(",
"(",
"typeof",
"observer",
"===",
"'undefined'",
"?",
"'undefined'",
":",
"_typeof",
"(",
"observer",
")",
")",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Expected the obser... | The minimal observable subscription method.
@param {Object} observer Any object that can be used as an observer.
The observer object should have a `next` method.
@returns {subscription} An object with an `unsubscribe` method that can
be used to unsubscribe the observable from the store, and prevent further
emission of ... | [
"The",
"minimal",
"observable",
"subscription",
"method",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L18047-L18061 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | _loop | function _loop(prop) {
if (!Object.prototype.hasOwnProperty.call(location, prop)) {
return 'continue';
}
Object.defineProperty(stateWithLocation, prop, {
get: function get() {
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Accessing location pro... | javascript | function _loop(prop) {
if (!Object.prototype.hasOwnProperty.call(location, prop)) {
return 'continue';
}
Object.defineProperty(stateWithLocation, prop, {
get: function get() {
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Accessing location pro... | [
"function",
"_loop",
"(",
"prop",
")",
"{",
"if",
"(",
"!",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"location",
",",
"prop",
")",
")",
"{",
"return",
"'continue'",
";",
"}",
"Object",
".",
"defineProperty",
"(",
"stateWithLoc... | I don't use deprecateObjectProperties here because I want to keep the same code path between development and production, in that we just assign extra properties to the copy of the state object in both cases. | [
"I",
"don",
"t",
"use",
"deprecateObjectProperties",
"here",
"because",
"I",
"want",
"to",
"keep",
"the",
"same",
"code",
"path",
"between",
"development",
"and",
"production",
"in",
"that",
"we",
"just",
"assign",
"extra",
"properties",
"to",
"the",
"copy",
... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L19020-L19031 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | listenBefore | function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addBasename(location), callback);
});
} | javascript | function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addBasename(location), callback);
});
} | [
"function",
"listenBefore",
"(",
"hook",
")",
"{",
"return",
"history",
".",
"listenBefore",
"(",
"function",
"(",
"location",
",",
"callback",
")",
"{",
"_runTransitionHook2",
"[",
"'default'",
"]",
"(",
"hook",
",",
"addBasename",
"(",
"location",
")",
","... | Override all read methods with basename-aware versions. | [
"Override",
"all",
"read",
"methods",
"with",
"basename",
"-",
"aware",
"versions",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L19540-L19544 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | routerReducer | function routerReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
type = _ref.type,
payload = _ref.payload;
if (type === LOCATION_CHANGE) {
return _extends({}... | javascript | function routerReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
type = _ref.type,
payload = _ref.payload;
if (type === LOCATION_CHANGE) {
return _extends({}... | [
"function",
"routerReducer",
"(",
")",
"{",
"var",
"state",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"initialState",
";",
"var",
"_ref",
"=",
"arguments",
"."... | This reducer will update the state with the most recent location history
has transitioned to. This may not be in sync with the router, particularly
if you have asynchronously-loaded routes, so reading from and relying on
this state is discouraged. | [
"This",
"reducer",
"will",
"update",
"the",
"state",
"with",
"the",
"most",
"recent",
"location",
"history",
"has",
"transitioned",
"to",
".",
"This",
"may",
"not",
"be",
"in",
"sync",
"with",
"the",
"router",
"particularly",
"if",
"you",
"have",
"asynchrono... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L19792-L19804 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | createMarkupForCustomAttribute | function createMarkupForCustomAttribute(name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} | javascript | function createMarkupForCustomAttribute(name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} | [
"function",
"createMarkupForCustomAttribute",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"!",
"isAttributeNameSafe",
"(",
"name",
")",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"''",
";",
"}",
"return",
"name",
"+",
"'='",
"+",
"quoteAttributeV... | Creates markup for a custom property.
@param {string} name
@param {*} value
@return {string} Markup string, or empty string if the property was invalid. | [
"Creates",
"markup",
"for",
"a",
"custom",
"property",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L21124-L21129 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | applyMiddleware | function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (createStore) {
return function (reducer, preloadedState, enhancer) {
var store = createStore(reducer, preloadedState, en... | javascript | function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (createStore) {
return function (reducer, preloadedState, enhancer) {
var store = createStore(reducer, preloadedState, en... | [
"function",
"applyMiddleware",
"(",
")",
"{",
"for",
"(",
"var",
"_len",
"=",
"arguments",
".",
"length",
",",
"middlewares",
"=",
"Array",
"(",
"_len",
")",
",",
"_key",
"=",
"0",
";",
"_key",
"<",
"_len",
";",
"_key",
"++",
")",
"{",
"middlewares",... | Creates a store enhancer that applies middleware to the dispatch method
of the Redux store. This is handy for a variety of tasks, such as expressing
asynchronous actions in a concise manner, or logging every action payload.
See `redux-thunk` package as an example of the Redux middleware.
Because middleware is potenti... | [
"Creates",
"a",
"store",
"enhancer",
"that",
"applies",
"middleware",
"to",
"the",
"dispatch",
"method",
"of",
"the",
"Redux",
"store",
".",
"This",
"is",
"handy",
"for",
"a",
"variety",
"of",
"tasks",
"such",
"as",
"expressing",
"asynchronous",
"actions",
"... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L25586-L25613 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | runLeaveHooks | function runLeaveHooks(routes, prevState) {
for (var i = 0, len = routes.length; i < len; ++i) {
if (routes[i].onLeave) routes[i].onLeave.call(routes[i], prevState);
}
} | javascript | function runLeaveHooks(routes, prevState) {
for (var i = 0, len = routes.length; i < len; ++i) {
if (routes[i].onLeave) routes[i].onLeave.call(routes[i], prevState);
}
} | [
"function",
"runLeaveHooks",
"(",
"routes",
",",
"prevState",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"routes",
".",
"length",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"if",
"(",
"routes",
"[",
"i",
"]",
".",
"onLeav... | Runs all onLeave hooks in the given array of routes in order. | [
"Runs",
"all",
"onLeave",
"hooks",
"in",
"the",
"given",
"array",
"of",
"routes",
"in",
"order",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L26856-L26860 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | pathIsActive | function pathIsActive(pathname, currentPathname) {
// Normalize leading slash for consistency. Leading slash on pathname has
// already been normalized in isActive. See caveat there.
if (currentPathname.charAt(0) !== '/') {
currentPathname = '/' + currentPathname;
}
// Normalize the end of both path name... | javascript | function pathIsActive(pathname, currentPathname) {
// Normalize leading slash for consistency. Leading slash on pathname has
// already been normalized in isActive. See caveat there.
if (currentPathname.charAt(0) !== '/') {
currentPathname = '/' + currentPathname;
}
// Normalize the end of both path name... | [
"function",
"pathIsActive",
"(",
"pathname",
",",
"currentPathname",
")",
"{",
"// Normalize leading slash for consistency. Leading slash on pathname has",
"// already been normalized in isActive. See caveat there.",
"if",
"(",
"currentPathname",
".",
"charAt",
"(",
"0",
")",
"!=... | Returns true if the current pathname matches the supplied one, net of
leading and trailing slash normalization. This is sufficient for an
indexOnly route match. | [
"Returns",
"true",
"if",
"the",
"current",
"pathname",
"matches",
"the",
"supplied",
"one",
"net",
"of",
"leading",
"and",
"trailing",
"slash",
"normalization",
".",
"This",
"is",
"sufficient",
"for",
"an",
"indexOnly",
"route",
"match",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L26922-L26940 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | onChildRoutes | function onChildRoutes(error, childRoutes) {
if (error) {
callback(error);
} else if (childRoutes) {
// Check the child routes to see if any of them match.
matchRoutes(childRoutes, location, function (error, match) {
if (error) {
callback(error);
} els... | javascript | function onChildRoutes(error, childRoutes) {
if (error) {
callback(error);
} else if (childRoutes) {
// Check the child routes to see if any of them match.
matchRoutes(childRoutes, location, function (error, match) {
if (error) {
callback(error);
} els... | [
"function",
"onChildRoutes",
"(",
"error",
",",
"childRoutes",
")",
"{",
"if",
"(",
"error",
")",
"{",
"callback",
"(",
"error",
")",
";",
"}",
"else",
"if",
"(",
"childRoutes",
")",
"{",
"// Check the child routes to see if any of them match.",
"matchRoutes",
"... | Either a) this route matched at least some of the path or b) we don't have to load this route's children asynchronously. In either case continue checking for matches in the subtree. | [
"Either",
"a",
")",
"this",
"route",
"matched",
"at",
"least",
"some",
"of",
"the",
"path",
"or",
"b",
")",
"we",
"don",
"t",
"have",
"to",
"load",
"this",
"route",
"s",
"children",
"asynchronously",
".",
"In",
"either",
"case",
"continue",
"checking",
... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L27284-L27303 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | syncHistoryWithStore | function syncHistoryWithStore(history, store) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$selectLocationSt = _ref.selectLocationState,
selectLocationState = _ref$selectLocationSt === undefined ? defaultSelectLocationState : _ref$selectLocationSt,
_ref$ad... | javascript | function syncHistoryWithStore(history, store) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$selectLocationSt = _ref.selectLocationState,
selectLocationState = _ref$selectLocationSt === undefined ? defaultSelectLocationState : _ref$selectLocationSt,
_ref$ad... | [
"function",
"syncHistoryWithStore",
"(",
"history",
",",
"store",
")",
"{",
"var",
"_ref",
"=",
"arguments",
".",
"length",
">",
"2",
"&&",
"arguments",
"[",
"2",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"2",
"]",
":",
"{",
"}",
",",
"_ref$selec... | This function synchronizes your history state with the Redux store.
Location changes flow from history to the store. An enhanced history is
returned with a listen method that responds to store updates for location.
When this history is provided to the router, this means the location data
will flow like this:
history.p... | [
"This",
"function",
"synchronizes",
"your",
"history",
"state",
"with",
"the",
"Redux",
"store",
".",
"Location",
"changes",
"flow",
"from",
"history",
"to",
"the",
"store",
".",
"An",
"enhanced",
"history",
"is",
"returned",
"with",
"a",
"listen",
"method",
... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L28673-L28798 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | getLocationInStore | function getLocationInStore(useInitialIfEmpty) {
var locationState = selectLocationState(store.getState());
return locationState.locationBeforeTransitions || (useInitialIfEmpty ? initialLocation : undefined);
} | javascript | function getLocationInStore(useInitialIfEmpty) {
var locationState = selectLocationState(store.getState());
return locationState.locationBeforeTransitions || (useInitialIfEmpty ? initialLocation : undefined);
} | [
"function",
"getLocationInStore",
"(",
"useInitialIfEmpty",
")",
"{",
"var",
"locationState",
"=",
"selectLocationState",
"(",
"store",
".",
"getState",
"(",
")",
")",
";",
"return",
"locationState",
".",
"locationBeforeTransitions",
"||",
"(",
"useInitialIfEmpty",
... | What does the store say about current location? | [
"What",
"does",
"the",
"store",
"say",
"about",
"current",
"location?"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L28692-L28695 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | handleLocationChange | function handleLocationChange(location) {
// ... unless we just caused that location change
if (isTimeTraveling) {
return;
}
// Remember where we are
currentLocation = location;
// Are we being called for the first time?
if (!initialLocation) {
// Remember as a fallback in case... | javascript | function handleLocationChange(location) {
// ... unless we just caused that location change
if (isTimeTraveling) {
return;
}
// Remember where we are
currentLocation = location;
// Are we being called for the first time?
if (!initialLocation) {
// Remember as a fallback in case... | [
"function",
"handleLocationChange",
"(",
"location",
")",
"{",
"// ... unless we just caused that location change",
"if",
"(",
"isTimeTraveling",
")",
"{",
"return",
";",
"}",
"// Remember where we are",
"currentLocation",
"=",
"location",
";",
"// Are we being called for the... | Whenever location changes, dispatch an action to get it in the store | [
"Whenever",
"location",
"changes",
"dispatch",
"an",
"action",
"to",
"get",
"it",
"in",
"the",
"store"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L28722-L28747 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | listen | function listen(listener) {
// Copy of last location.
var lastPublishedLocation = getLocationInStore(true);
// Keep track of whether we unsubscribed, as Redux store
// only applies changes in subscriptions on next dispatch
var unsubscribed = false;
var unsubscribeFromStore = store.s... | javascript | function listen(listener) {
// Copy of last location.
var lastPublishedLocation = getLocationInStore(true);
// Keep track of whether we unsubscribed, as Redux store
// only applies changes in subscriptions on next dispatch
var unsubscribed = false;
var unsubscribeFromStore = store.s... | [
"function",
"listen",
"(",
"listener",
")",
"{",
"// Copy of last location.",
"var",
"lastPublishedLocation",
"=",
"getLocationInStore",
"(",
"true",
")",
";",
"// Keep track of whether we unsubscribed, as Redux store",
"// only applies changes in subscriptions on next dispatch",
"... | The listeners are subscribed to the store instead of history | [
"The",
"listeners",
"are",
"subscribed",
"to",
"the",
"store",
"instead",
"of",
"history"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L28758-L28788 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | routerMiddleware | function routerMiddleware(history) {
return function () {
return function (next) {
return function (action) {
if (action.type !== _actions.CALL_HISTORY_METHOD) {
return next(action);
}
var _action$payload = action.payload,
method = _action$payload.method,
... | javascript | function routerMiddleware(history) {
return function () {
return function (next) {
return function (action) {
if (action.type !== _actions.CALL_HISTORY_METHOD) {
return next(action);
}
var _action$payload = action.payload,
method = _action$payload.method,
... | [
"function",
"routerMiddleware",
"(",
"history",
")",
"{",
"return",
"function",
"(",
")",
"{",
"return",
"function",
"(",
"next",
")",
"{",
"return",
"function",
"(",
"action",
")",
"{",
"if",
"(",
"action",
".",
"type",
"!==",
"_actions",
".",
"CALL_HIS... | This middleware captures CALL_HISTORY_METHOD actions to redirect to the
provided history object. This will prevent these actions from reaching your
reducer or any middleware that comes after this one. | [
"This",
"middleware",
"captures",
"CALL_HISTORY_METHOD",
"actions",
"to",
"redirect",
"to",
"the",
"provided",
"history",
"object",
".",
"This",
"will",
"prevent",
"these",
"actions",
"from",
"reaching",
"your",
"reducer",
"or",
"any",
"middleware",
"that",
"comes... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L28829-L28845 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | getDataFromCustomEvent | function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if ((typeof detail === 'undefined' ? 'undefined' : _typeof(detail)) === 'object' && 'data' in detail) {
return detail.data;
}
return null;
} | javascript | function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if ((typeof detail === 'undefined' ? 'undefined' : _typeof(detail)) === 'object' && 'data' in detail) {
return detail.data;
}
return null;
} | [
"function",
"getDataFromCustomEvent",
"(",
"nativeEvent",
")",
"{",
"var",
"detail",
"=",
"nativeEvent",
".",
"detail",
";",
"if",
"(",
"(",
"typeof",
"detail",
"===",
"'undefined'",
"?",
"'undefined'",
":",
"_typeof",
"(",
"detail",
")",
")",
"===",
"'objec... | Google Input Tools provides composition data via a CustomEvent,
with the `data` property populated in the `detail` object. If this
is available on the event object, use it. If not, this is a plain
composition event and we have nothing special to extract.
@param {object} nativeEvent
@return {?string} | [
"Google",
"Input",
"Tools",
"provides",
"composition",
"data",
"via",
"a",
"CustomEvent",
"with",
"the",
"data",
"property",
"populated",
"in",
"the",
"detail",
"object",
".",
"If",
"this",
"is",
"available",
"on",
"the",
"event",
"object",
"use",
"it",
".",... | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L31889-L31895 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | receiveComponent | function receiveComponent(nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
} | javascript | function receiveComponent(nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
} | [
"function",
"receiveComponent",
"(",
"nextElement",
",",
"transaction",
",",
"context",
")",
"{",
"var",
"prevElement",
"=",
"this",
".",
"_currentElement",
";",
"this",
".",
"_currentElement",
"=",
"nextElement",
";",
"this",
".",
"updateComponent",
"(",
"trans... | Receives a next element and updates the component.
@internal
@param {ReactElement} nextElement
@param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
@param {object} context | [
"Receives",
"a",
"next",
"element",
"and",
"updates",
"the",
"component",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L34346-L34350 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | makeInsertMarkup | function makeInsertMarkup(markup, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: 'INSERT_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: toIndex,
afterNode: afterNode
};
} | javascript | function makeInsertMarkup(markup, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: 'INSERT_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: toIndex,
afterNode: afterNode
};
} | [
"function",
"makeInsertMarkup",
"(",
"markup",
",",
"afterNode",
",",
"toIndex",
")",
"{",
"// NOTE: Null values reduce hidden classes.",
"return",
"{",
"type",
":",
"'INSERT_MARKUP'",
",",
"content",
":",
"markup",
",",
"fromIndex",
":",
"null",
",",
"fromNode",
... | Make an update for markup to be rendered and inserted at a supplied index.
@param {string} markup Markup that renders into an element.
@param {number} toIndex Destination index.
@private | [
"Make",
"an",
"update",
"for",
"markup",
"to",
"be",
"rendered",
"and",
"inserted",
"at",
"a",
"supplied",
"index",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37549-L37559 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | makeRemove | function makeRemove(child, node) {
// NOTE: Null values reduce hidden classes.
return {
type: 'REMOVE_NODE',
content: null,
fromIndex: child._mountIndex,
fromNode: node,
toIndex: null,
afterNode: null
};
} | javascript | function makeRemove(child, node) {
// NOTE: Null values reduce hidden classes.
return {
type: 'REMOVE_NODE',
content: null,
fromIndex: child._mountIndex,
fromNode: node,
toIndex: null,
afterNode: null
};
} | [
"function",
"makeRemove",
"(",
"child",
",",
"node",
")",
"{",
"// NOTE: Null values reduce hidden classes.",
"return",
"{",
"type",
":",
"'REMOVE_NODE'",
",",
"content",
":",
"null",
",",
"fromIndex",
":",
"child",
".",
"_mountIndex",
",",
"fromNode",
":",
"nod... | Make an update for removing an element at an index.
@param {number} fromIndex Index of the element to remove.
@private | [
"Make",
"an",
"update",
"for",
"removing",
"an",
"element",
"at",
"an",
"index",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37586-L37596 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | makeSetMarkup | function makeSetMarkup(markup) {
// NOTE: Null values reduce hidden classes.
return {
type: 'SET_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
} | javascript | function makeSetMarkup(markup) {
// NOTE: Null values reduce hidden classes.
return {
type: 'SET_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
} | [
"function",
"makeSetMarkup",
"(",
"markup",
")",
"{",
"// NOTE: Null values reduce hidden classes.",
"return",
"{",
"type",
":",
"'SET_MARKUP'",
",",
"content",
":",
"markup",
",",
"fromIndex",
":",
"null",
",",
"fromNode",
":",
"null",
",",
"toIndex",
":",
"nul... | Make an update for setting the markup of a node.
@param {string} markup Markup that renders into an element.
@private | [
"Make",
"an",
"update",
"for",
"setting",
"the",
"markup",
"of",
"a",
"node",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37604-L37614 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | makeTextContent | function makeTextContent(textContent) {
// NOTE: Null values reduce hidden classes.
return {
type: 'TEXT_CONTENT',
content: textContent,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
} | javascript | function makeTextContent(textContent) {
// NOTE: Null values reduce hidden classes.
return {
type: 'TEXT_CONTENT',
content: textContent,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
} | [
"function",
"makeTextContent",
"(",
"textContent",
")",
"{",
"// NOTE: Null values reduce hidden classes.",
"return",
"{",
"type",
":",
"'TEXT_CONTENT'",
",",
"content",
":",
"textContent",
",",
"fromIndex",
":",
"null",
",",
"fromNode",
":",
"null",
",",
"toIndex",... | Make an update for setting the text content.
@param {string} textContent Text content to set.
@private | [
"Make",
"an",
"update",
"for",
"setting",
"the",
"text",
"content",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37622-L37632 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | enqueue | function enqueue(queue, update) {
if (update) {
queue = queue || [];
queue.push(update);
}
return queue;
} | javascript | function enqueue(queue, update) {
if (update) {
queue = queue || [];
queue.push(update);
}
return queue;
} | [
"function",
"enqueue",
"(",
"queue",
",",
"update",
")",
"{",
"if",
"(",
"update",
")",
"{",
"queue",
"=",
"queue",
"||",
"[",
"]",
";",
"queue",
".",
"push",
"(",
"update",
")",
";",
"}",
"return",
"queue",
";",
"}"
] | Push an update, if any, onto the queue. Creates a new queue if none is
passed and always returns the queue. Mutative. | [
"Push",
"an",
"update",
"if",
"any",
"onto",
"the",
"queue",
".",
"Creates",
"a",
"new",
"queue",
"if",
"none",
"is",
"passed",
"and",
"always",
"returns",
"the",
"queue",
".",
"Mutative",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37638-L37644 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | updateMarkup | function updateMarkup(nextMarkup) {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren, false);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
true ? false ? invariant(false,... | javascript | function updateMarkup(nextMarkup) {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren, false);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
true ? false ? invariant(false,... | [
"function",
"updateMarkup",
"(",
"nextMarkup",
")",
"{",
"var",
"prevChildren",
"=",
"this",
".",
"_renderedChildren",
";",
"// Remove any rendered children.",
"ReactChildReconciler",
".",
"unmountChildren",
"(",
"prevChildren",
",",
"false",
")",
";",
"for",
"(",
"... | Replaces any rendered children with a markup string.
@param {string} nextMarkup String of markup.
@internal | [
"Replaces",
"any",
"rendered",
"children",
"with",
"a",
"markup",
"string",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37790-L37801 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | unmountChildren | function unmountChildren(safely) {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren, safely);
this._renderedChildren = null;
} | javascript | function unmountChildren(safely) {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren, safely);
this._renderedChildren = null;
} | [
"function",
"unmountChildren",
"(",
"safely",
")",
"{",
"var",
"renderedChildren",
"=",
"this",
".",
"_renderedChildren",
";",
"ReactChildReconciler",
".",
"unmountChildren",
"(",
"renderedChildren",
",",
"safely",
")",
";",
"this",
".",
"_renderedChildren",
"=",
... | Unmounts all rendered children. This should be used to clean up children
when this component is unmounted. It does not actually perform any
backend operations.
@internal | [
"Unmounts",
"all",
"rendered",
"children",
".",
"This",
"should",
"be",
"used",
"to",
"clean",
"up",
"children",
"when",
"this",
"component",
"is",
"unmounted",
".",
"It",
"does",
"not",
"actually",
"perform",
"any",
"backend",
"operations",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L37884-L37888 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | _maskContext | function _maskContext(context) {
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
var maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
... | javascript | function _maskContext(context) {
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
var maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
... | [
"function",
"_maskContext",
"(",
"context",
")",
"{",
"var",
"Component",
"=",
"this",
".",
"_currentElement",
".",
"type",
";",
"var",
"contextTypes",
"=",
"Component",
".",
"contextTypes",
";",
"if",
"(",
"!",
"contextTypes",
")",
"{",
"return",
"emptyObje... | Filters the context object to only contain keys specified in
`contextTypes`
@param {object} context
@return {?object}
@private | [
"Filters",
"the",
"context",
"object",
"to",
"only",
"contain",
"keys",
"specified",
"in",
"contextTypes"
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L38581-L38592 | train |
sociomantic-tsunami/nessie-ui | docs/assets/app.js | constructSelectEvent | function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if ... | javascript | function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if ... | [
"function",
"constructSelectEvent",
"(",
"nativeEvent",
",",
"nativeEventTarget",
")",
"{",
"// Ensure we have the right element, and that the user is not dragging a",
"// selection (this matches native `select` event behavior). In HTML5, select",
"// fires only on input and textarea thus if the... | Poll selection to see whether it's changed.
@param {object} nativeEvent
@return {?SyntheticEvent} | [
"Poll",
"selection",
"to",
"see",
"whether",
"it",
"s",
"changed",
"."
] | e2348045ebc6cd10be49ffe39462abad48956ce3 | https://github.com/sociomantic-tsunami/nessie-ui/blob/e2348045ebc6cd10be49ffe39462abad48956ce3/docs/assets/app.js#L40951-L40976 | train |
larsvanbraam/vue-transition-component | build-tools/script/deploy-utils.js | connectToServer | async function connectToServer(client, config) {
return new Promise((resolve, reject) => {
client
.on('ready', error => (error ? reject(error) : resolve(client)))
.on('error', error => reject(error))
.connect(config);
});
} | javascript | async function connectToServer(client, config) {
return new Promise((resolve, reject) => {
client
.on('ready', error => (error ? reject(error) : resolve(client)))
.on('error', error => reject(error))
.connect(config);
});
} | [
"async",
"function",
"connectToServer",
"(",
"client",
",",
"config",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"client",
".",
"on",
"(",
"'ready'",
",",
"error",
"=>",
"(",
"error",
"?",
"reject",
"(",
... | Create a connection to the server
@returns {Promise<*>} | [
"Create",
"a",
"connection",
"to",
"the",
"server"
] | bad27770dff1004973ec6c18fbf59103248742c9 | https://github.com/larsvanbraam/vue-transition-component/blob/bad27770dff1004973ec6c18fbf59103248742c9/build-tools/script/deploy-utils.js#L7-L14 | train |
larsvanbraam/vue-transition-component | build-tools/script/deploy-utils.js | createSftpConnection | async function createSftpConnection(client) {
return new Promise((resolve, reject) => {
client.sftp((error, sftp) => (error ? reject(error) : resolve(sftp)));
});
} | javascript | async function createSftpConnection(client) {
return new Promise((resolve, reject) => {
client.sftp((error, sftp) => (error ? reject(error) : resolve(sftp)));
});
} | [
"async",
"function",
"createSftpConnection",
"(",
"client",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"client",
".",
"sftp",
"(",
"(",
"error",
",",
"sftp",
")",
"=>",
"(",
"error",
"?",
"reject",
"(",
... | Create an SFTP connection
@param client
@returns {Promise<*>} | [
"Create",
"an",
"SFTP",
"connection"
] | bad27770dff1004973ec6c18fbf59103248742c9 | https://github.com/larsvanbraam/vue-transition-component/blob/bad27770dff1004973ec6c18fbf59103248742c9/build-tools/script/deploy-utils.js#L21-L25 | train |
larsvanbraam/vue-transition-component | build-tools/script/deploy-utils.js | readDirectory | async function readDirectory(sftp, path) {
return new Promise(resolve => {
sftp.readdir(path, (error, list) => {
resolve(list || null);
});
});
} | javascript | async function readDirectory(sftp, path) {
return new Promise(resolve => {
sftp.readdir(path, (error, list) => {
resolve(list || null);
});
});
} | [
"async",
"function",
"readDirectory",
"(",
"sftp",
",",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"sftp",
".",
"readdir",
"(",
"path",
",",
"(",
"error",
",",
"list",
")",
"=>",
"{",
"resolve",
"(",
"list",
"||",
"null"... | Read a directory
@param sftp
@param path
@returns {Promise<*>} | [
"Read",
"a",
"directory"
] | bad27770dff1004973ec6c18fbf59103248742c9 | https://github.com/larsvanbraam/vue-transition-component/blob/bad27770dff1004973ec6c18fbf59103248742c9/build-tools/script/deploy-utils.js#L33-L39 | train |
larsvanbraam/vue-transition-component | build-tools/script/deploy-utils.js | createDirectory | async function createDirectory(sftp, path) {
return new Promise((resolve, reject) => {
sftp.mkdir(path, error => (error ? reject(error) : resolve()));
});
} | javascript | async function createDirectory(sftp, path) {
return new Promise((resolve, reject) => {
sftp.mkdir(path, error => (error ? reject(error) : resolve()));
});
} | [
"async",
"function",
"createDirectory",
"(",
"sftp",
",",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"sftp",
".",
"mkdir",
"(",
"path",
",",
"error",
"=>",
"(",
"error",
"?",
"reject",
"(",
"erro... | Create a directory on the server
@param sftp
@param path
@returns {Promise<*>} | [
"Create",
"a",
"directory",
"on",
"the",
"server"
] | bad27770dff1004973ec6c18fbf59103248742c9 | https://github.com/larsvanbraam/vue-transition-component/blob/bad27770dff1004973ec6c18fbf59103248742c9/build-tools/script/deploy-utils.js#L48-L52 | train |
larsvanbraam/vue-transition-component | build-tools/script/deploy-utils.js | uploadFile | async function uploadFile(sftp, source, target) {
return new Promise((resolve, reject) => {
sftp.fastPut(source, target, error => (error ? reject(error) : resolve()));
});
} | javascript | async function uploadFile(sftp, source, target) {
return new Promise((resolve, reject) => {
sftp.fastPut(source, target, error => (error ? reject(error) : resolve()));
});
} | [
"async",
"function",
"uploadFile",
"(",
"sftp",
",",
"source",
",",
"target",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"sftp",
".",
"fastPut",
"(",
"source",
",",
"target",
",",
"error",
"=>",
"(",
"er... | Upload a file to the provided ftp server
@param sftp
@param source
@param target
@returns {Promise<*>} | [
"Upload",
"a",
"file",
"to",
"the",
"provided",
"ftp",
"server"
] | bad27770dff1004973ec6c18fbf59103248742c9 | https://github.com/larsvanbraam/vue-transition-component/blob/bad27770dff1004973ec6c18fbf59103248742c9/build-tools/script/deploy-utils.js#L73-L77 | train |
nodeshift/openshift-rest-client | lib/openshift-rest-client.js | getNames | function getNames (resourceType) {
const aliases = [resourceType];
if (resourceAliases[resourceType]) {
return aliases.concat(resourceAliases[resourceType]);
}
return alias(resourceType);
} | javascript | function getNames (resourceType) {
const aliases = [resourceType];
if (resourceAliases[resourceType]) {
return aliases.concat(resourceAliases[resourceType]);
}
return alias(resourceType);
} | [
"function",
"getNames",
"(",
"resourceType",
")",
"{",
"const",
"aliases",
"=",
"[",
"resourceType",
"]",
";",
"if",
"(",
"resourceAliases",
"[",
"resourceType",
"]",
")",
"{",
"return",
"aliases",
".",
"concat",
"(",
"resourceAliases",
"[",
"resourceType",
... | function is passed in and called by the kubernetes-client to add the openshift aliases | [
"function",
"is",
"passed",
"in",
"and",
"called",
"by",
"the",
"kubernetes",
"-",
"client",
"to",
"add",
"the",
"openshift",
"aliases"
] | 18cc69f469ab5f22596f8e915238ba4e6df363b5 | https://github.com/nodeshift/openshift-rest-client/blob/18cc69f469ab5f22596f8e915238ba4e6df363b5/lib/openshift-rest-client.js#L47-L53 | train |
trustnote/trustnote-pow-common | p2p/network.js | addPeer | function addPeer( sPeer )
{
if ( assocKnownPeers[ sPeer ] )
{
return;
}
//
// save to memory
//
assocKnownPeers[ sPeer ] = true;
//
// save to local storage
//
let sHost = getHostByPeer( sPeer );
addPeerHost
(
sHost,
() =>
{
console.log( "will insert peer " + sPeer );
db.query( "INSERT " + ... | javascript | function addPeer( sPeer )
{
if ( assocKnownPeers[ sPeer ] )
{
return;
}
//
// save to memory
//
assocKnownPeers[ sPeer ] = true;
//
// save to local storage
//
let sHost = getHostByPeer( sPeer );
addPeerHost
(
sHost,
() =>
{
console.log( "will insert peer " + sPeer );
db.query( "INSERT " + ... | [
"function",
"addPeer",
"(",
"sPeer",
")",
"{",
"if",
"(",
"assocKnownPeers",
"[",
"sPeer",
"]",
")",
"{",
"return",
";",
"}",
"//",
"//\tsave to memory",
"//",
"assocKnownPeers",
"[",
"sPeer",
"]",
"=",
"true",
";",
"//",
"//\tsave to local storage",
"//",
... | save peer to database
@param {string} sPeer - 'wss://127.0.0.1:90000' | [
"save",
"peer",
"to",
"database"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L831-L856 | train |
trustnote/trustnote-pow-common | p2p/network.js | pushOutBoundPeersToExplorer | function pushOutBoundPeersToExplorer(){
if(!conf.IF_BYZANTINE)
return;
if (conf.bLight )
return;
findOutboundPeerOrConnect
(
explorerUrl,
( err, oWsByExplorerUrl ) =>
{
if ( ! err )
{
let arrOutboundPeerUrls = arrOutboundPeers.map(function (ws) {
return ws.peer;
});
sendJustsaying( ... | javascript | function pushOutBoundPeersToExplorer(){
if(!conf.IF_BYZANTINE)
return;
if (conf.bLight )
return;
findOutboundPeerOrConnect
(
explorerUrl,
( err, oWsByExplorerUrl ) =>
{
if ( ! err )
{
let arrOutboundPeerUrls = arrOutboundPeers.map(function (ws) {
return ws.peer;
});
sendJustsaying( ... | [
"function",
"pushOutBoundPeersToExplorer",
"(",
")",
"{",
"if",
"(",
"!",
"conf",
".",
"IF_BYZANTINE",
")",
"return",
";",
"if",
"(",
"conf",
".",
"bLight",
")",
"return",
";",
"findOutboundPeerOrConnect",
"(",
"explorerUrl",
",",
"(",
"err",
",",
"oWsByExpl... | push the arrOutboundPeers to explorer | [
"push",
"the",
"arrOutboundPeers",
"to",
"explorer"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L1181-L1200 | train |
trustnote/trustnote-pow-common | p2p/network.js | sumOnLinePeers | function sumOnLinePeers() {
let nowTime = Date.now();
assocOnlinePeers = {};
Object.keys(assocAllOutBoundPeers).forEach(function(curUrl){
var curPeers = assocAllOutBoundPeers[curUrl];
if(nowTime - parseInt(curPeers.time) < 3 * 60 * 1000){
for (var j=0; j<curPeers.peers.length; j++){
if(... | javascript | function sumOnLinePeers() {
let nowTime = Date.now();
assocOnlinePeers = {};
Object.keys(assocAllOutBoundPeers).forEach(function(curUrl){
var curPeers = assocAllOutBoundPeers[curUrl];
if(nowTime - parseInt(curPeers.time) < 3 * 60 * 1000){
for (var j=0; j<curPeers.peers.length; j++){
if(... | [
"function",
"sumOnLinePeers",
"(",
")",
"{",
"let",
"nowTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"assocOnlinePeers",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"assocAllOutBoundPeers",
")",
".",
"forEach",
"(",
"function",
"(",
"curUrl",
")",
... | Summary online peers | [
"Summary",
"online",
"peers"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L1203-L1217 | train |
trustnote/trustnote-pow-common | p2p/network.js | getOnLinePeers | function getOnLinePeers()
{
var arrOnlinePeers = [];
function compare(){
return function(a,b){
return b['count'] - a['count'];
}
}
Object.keys(assocOnlinePeers).forEach(function(curUrl){
arrOnlinePeers.push({peer:curUrl, count:assocOnlinePeers[curUrl]});
})
if(arrOnlinePeers.length === 0)
return [... | javascript | function getOnLinePeers()
{
var arrOnlinePeers = [];
function compare(){
return function(a,b){
return b['count'] - a['count'];
}
}
Object.keys(assocOnlinePeers).forEach(function(curUrl){
arrOnlinePeers.push({peer:curUrl, count:assocOnlinePeers[curUrl]});
})
if(arrOnlinePeers.length === 0)
return [... | [
"function",
"getOnLinePeers",
"(",
")",
"{",
"var",
"arrOnlinePeers",
"=",
"[",
"]",
";",
"function",
"compare",
"(",
")",
"{",
"return",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"b",
"[",
"'count'",
"]",
"-",
"a",
"[",
"'count'",
"]",
"... | Gets the online node, sorted by count | [
"Gets",
"the",
"online",
"node",
"sorted",
"by",
"count"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L1220-L1236 | train |
trustnote/trustnote-pow-common | p2p/network.js | notifyLightClientsAboutStableJoints | function notifyLightClientsAboutStableJoints(from_mci, to_mci) {
db.query(
"SELECT peer FROM units JOIN unit_authors USING(unit) JOIN watched_light_addresses USING(address) \n\
WHERE main_chain_index>? AND main_chain_index<=? \n\
UNION \n\
SELECT peer FROM units JOIN outputs USING(unit) JOIN watched_light_addr... | javascript | function notifyLightClientsAboutStableJoints(from_mci, to_mci) {
db.query(
"SELECT peer FROM units JOIN unit_authors USING(unit) JOIN watched_light_addresses USING(address) \n\
WHERE main_chain_index>? AND main_chain_index<=? \n\
UNION \n\
SELECT peer FROM units JOIN outputs USING(unit) JOIN watched_light_addr... | [
"function",
"notifyLightClientsAboutStableJoints",
"(",
"from_mci",
",",
"to_mci",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT peer FROM units JOIN unit_authors USING(unit) JOIN watched_light_addresses USING(address) \\n\\\n\t\tWHERE main_chain_index>? AND main_chain_index<=? \\n\\\n\t\tUNI... | from_mci is non-inclusive, to_mci is inclusive | [
"from_mci",
"is",
"non",
"-",
"inclusive",
"to_mci",
"is",
"inclusive"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L1961-L1984 | train |
trustnote/trustnote-pow-common | p2p/network.js | requestCatchup_Dev | function requestCatchup_Dev(oWebSocket, oRequestData) {
//
// { last_stable_mci: last_stable_mci, last_known_mci: last_known_mci }
//
if (!_bUnitTestEnv) {
return console.log(`this function only works in dev env.`);
}
return sendRequest
(
oWebSocket,
'catchup',
oRequestData,
true,
handleCatchupChain... | javascript | function requestCatchup_Dev(oWebSocket, oRequestData) {
//
// { last_stable_mci: last_stable_mci, last_known_mci: last_known_mci }
//
if (!_bUnitTestEnv) {
return console.log(`this function only works in dev env.`);
}
return sendRequest
(
oWebSocket,
'catchup',
oRequestData,
true,
handleCatchupChain... | [
"function",
"requestCatchup_Dev",
"(",
"oWebSocket",
",",
"oRequestData",
")",
"{",
"//",
"//\t{ last_stable_mci: last_stable_mci, last_known_mci: last_known_mci }",
"//",
"if",
"(",
"!",
"_bUnitTestEnv",
")",
"{",
"return",
"console",
".",
"log",
"(",
"`",
"`",
")",
... | request catchup in dev
@param {object} oWebSocket
@param {object} oRequestData
@param {number} oRequestData.last_stable_mci
@param {number} oRequestData.last_known_mci
@return {*} | [
"request",
"catchup",
"in",
"dev"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L2241-L2257 | train |
trustnote/trustnote-pow-common | p2p/network.js | sendPrivatePayment | function sendPrivatePayment(peer, arrChains) {
let ws = getPeerWebSocket(peer);
if (ws)
return sendPrivatePaymentToWs(ws, arrChains);
findOutboundPeerOrConnect(peer, function (err, ws) {
if (!err)
sendPrivatePaymentToWs(ws, arrChains);
});
} | javascript | function sendPrivatePayment(peer, arrChains) {
let ws = getPeerWebSocket(peer);
if (ws)
return sendPrivatePaymentToWs(ws, arrChains);
findOutboundPeerOrConnect(peer, function (err, ws) {
if (!err)
sendPrivatePaymentToWs(ws, arrChains);
});
} | [
"function",
"sendPrivatePayment",
"(",
"peer",
",",
"arrChains",
")",
"{",
"let",
"ws",
"=",
"getPeerWebSocket",
"(",
"peer",
")",
";",
"if",
"(",
"ws",
")",
"return",
"sendPrivatePaymentToWs",
"(",
"ws",
",",
"arrChains",
")",
";",
"findOutboundPeerOrConnect"... | sends multiple private payloads and their corresponding chains | [
"sends",
"multiple",
"private",
"payloads",
"and",
"their",
"corresponding",
"chains"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/network.js#L2384-L2393 | train |
trustnote/trustnote-pow-common | catchup/catchup.js | readHashTree | function readHashTree( hashTreeRequest, callbacks )
{
let from_ball = hashTreeRequest.from_ball;
let to_ball = hashTreeRequest.to_ball;
if ( 'string' !== typeof from_ball )
{
return callbacks.ifError( "no from_ball" );
}
if ( 'string' !== typeof to_ball )
{
return callbacks.ifError( "no to_ball" );
}
let... | javascript | function readHashTree( hashTreeRequest, callbacks )
{
let from_ball = hashTreeRequest.from_ball;
let to_ball = hashTreeRequest.to_ball;
if ( 'string' !== typeof from_ball )
{
return callbacks.ifError( "no from_ball" );
}
if ( 'string' !== typeof to_ball )
{
return callbacks.ifError( "no to_ball" );
}
let... | [
"function",
"readHashTree",
"(",
"hashTreeRequest",
",",
"callbacks",
")",
"{",
"let",
"from_ball",
"=",
"hashTreeRequest",
".",
"from_ball",
";",
"let",
"to_ball",
"=",
"hashTreeRequest",
".",
"to_ball",
";",
"if",
"(",
"'string'",
"!==",
"typeof",
"from_ball",... | read hash tree
@param {object} hashTreeRequest
@param {object} callbacks
@return {*} | [
"read",
"hash",
"tree"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/catchup/catchup.js#L796-L930 | train |
trustnote/trustnote-pow-common | catchup/catchup.js | updateLastRoundIndexFromPeers | function updateLastRoundIndexFromPeers( nLastRoundIndex, nLastMainChainIndex )
{
if ( 'number' === typeof nLastRoundIndex && nLastRoundIndex > 0 &&
'number' === typeof nLastMainChainIndex && nLastMainChainIndex > 0 )
{
if ( null === _nLastRoundIndexFromPeers || nLastRoundIndex > _nLastRoundIndexFromPeers ||
... | javascript | function updateLastRoundIndexFromPeers( nLastRoundIndex, nLastMainChainIndex )
{
if ( 'number' === typeof nLastRoundIndex && nLastRoundIndex > 0 &&
'number' === typeof nLastMainChainIndex && nLastMainChainIndex > 0 )
{
if ( null === _nLastRoundIndexFromPeers || nLastRoundIndex > _nLastRoundIndexFromPeers ||
... | [
"function",
"updateLastRoundIndexFromPeers",
"(",
"nLastRoundIndex",
",",
"nLastMainChainIndex",
")",
"{",
"if",
"(",
"'number'",
"===",
"typeof",
"nLastRoundIndex",
"&&",
"nLastRoundIndex",
">",
"0",
"&&",
"'number'",
"===",
"typeof",
"nLastMainChainIndex",
"&&",
"nL... | update last round index from all outbound peers
@return {void} | [
"update",
"last",
"round",
"index",
"from",
"all",
"outbound",
"peers"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/catchup/catchup.js#L1149-L1162 | train |
trustnote/trustnote-pow-common | validation/validation.js | function(cb){
deposit.getDepositAddressBySupernodeAddress(conn, objUnit.authors[0].address, function (err,depositAddress){
if(err)
return cb(err + " can not send pow unit");
if(payload.deposit != depositAddress)
return cb("pow unit deposit address is invalid expeected :" + depositAddress +" A... | javascript | function(cb){
deposit.getDepositAddressBySupernodeAddress(conn, objUnit.authors[0].address, function (err,depositAddress){
if(err)
return cb(err + " can not send pow unit");
if(payload.deposit != depositAddress)
return cb("pow unit deposit address is invalid expeected :" + depositAddress +" A... | [
"function",
"(",
"cb",
")",
"{",
"deposit",
".",
"getDepositAddressBySupernodeAddress",
"(",
"conn",
",",
"objUnit",
".",
"authors",
"[",
"0",
"]",
".",
"address",
",",
"function",
"(",
"err",
",",
"depositAddress",
")",
"{",
"if",
"(",
"err",
")",
"retu... | check deposit address is valid and balance | [
"check",
"deposit",
"address",
"is",
"valid",
"and",
"balance"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/validation/validation.js#L1361-L1374 | train | |
trustnote/trustnote-pow-common | p2p/gossiper.js | gossiperOnReceivedMessage | function gossiperOnReceivedMessage( oWs, oMessage )
{
try
{
_oGossiper.onReceivedMessage( oWs, oMessage );
}
catch( oException )
{
console.error( `GOSSIPER ))) gossiperOnReceivedMessage occurred an exception: ${ JSON.stringify( oException ) }` );
}
} | javascript | function gossiperOnReceivedMessage( oWs, oMessage )
{
try
{
_oGossiper.onReceivedMessage( oWs, oMessage );
}
catch( oException )
{
console.error( `GOSSIPER ))) gossiperOnReceivedMessage occurred an exception: ${ JSON.stringify( oException ) }` );
}
} | [
"function",
"gossiperOnReceivedMessage",
"(",
"oWs",
",",
"oMessage",
")",
"{",
"try",
"{",
"_oGossiper",
".",
"onReceivedMessage",
"(",
"oWs",
",",
"oMessage",
")",
";",
"}",
"catch",
"(",
"oException",
")",
"{",
"console",
".",
"error",
"(",
"`",
"${",
... | on received gossiper message
@param {object} oWs
@param {object} oMessage
@return {void} | [
"on",
"received",
"gossiper",
"message"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/gossiper.js#L137-L147 | train |
trustnote/trustnote-pow-common | p2p/gossiper.js | _gossiperStartWithOptions | function _gossiperStartWithOptions( oOptions )
{
//
// create Gossiper instance
//
_oGossiper = new Gossiper( oOptions );
//
// listen ...
//
_oGossiper.on( 'peer_update', ( sPeerUrl, sKey, vValue ) =>
{
// console.log( `GOSSIPER ))) EVENT [peer_update] (${ GossiperUtils.isReservedKey( sKey ) ? "Reserved" :... | javascript | function _gossiperStartWithOptions( oOptions )
{
//
// create Gossiper instance
//
_oGossiper = new Gossiper( oOptions );
//
// listen ...
//
_oGossiper.on( 'peer_update', ( sPeerUrl, sKey, vValue ) =>
{
// console.log( `GOSSIPER ))) EVENT [peer_update] (${ GossiperUtils.isReservedKey( sKey ) ? "Reserved" :... | [
"function",
"_gossiperStartWithOptions",
"(",
"oOptions",
")",
"{",
"//",
"//\tcreate Gossiper instance",
"//",
"_oGossiper",
"=",
"new",
"Gossiper",
"(",
"oOptions",
")",
";",
"//",
"//\tlisten ...",
"//",
"_oGossiper",
".",
"on",
"(",
"'peer_update'",
",",
"(",
... | start gossiper with options
@param {object} oOptions
@private | [
"start",
"gossiper",
"with",
"options"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/p2p/gossiper.js#L247-L325 | train |
trustnote/trustnote-pow-common | mc/byzantine.js | initByzantine | function initByzantine(){
if(!conf.IF_BYZANTINE)
return;
if(bByzantineUnderWay)
return;
db.query(
"SELECT main_chain_index FROM units \n\
WHERE is_on_main_chain=1 AND is_stable=1 AND +sequence='good' AND pow_type=? \n\
ORDER BY main_chain_index DESC LIMIT 1",
... | javascript | function initByzantine(){
if(!conf.IF_BYZANTINE)
return;
if(bByzantineUnderWay)
return;
db.query(
"SELECT main_chain_index FROM units \n\
WHERE is_on_main_chain=1 AND is_stable=1 AND +sequence='good' AND pow_type=? \n\
ORDER BY main_chain_index DESC LIMIT 1",
... | [
"function",
"initByzantine",
"(",
")",
"{",
"if",
"(",
"!",
"conf",
".",
"IF_BYZANTINE",
")",
"return",
";",
"if",
"(",
"bByzantineUnderWay",
")",
"return",
";",
"db",
".",
"query",
"(",
"\"SELECT main_chain_index FROM units \\n\\\n WHERE is_on_main_chain=1 AND... | init function begin
init byzantine, executes at startup | [
"init",
"function",
"begin",
"init",
"byzantine",
"executes",
"at",
"startup"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/mc/byzantine.js#L57-L101 | train |
trustnote/trustnote-pow-common | mc/byzantine.js | getCoordinators | function getCoordinators(conn, hp, phase, cb){
hp = parseInt(hp);
phase = parseInt(phase);
var pIndex = Math.abs(hp-phase+999)%constants.TOTAL_COORDINATORS;
if (assocByzantinePhase[hp] && assocByzantinePhase[hp].roundIndex && assocByzantinePhase[hp].witnesses){
return cb(null, assocByzantinePhas... | javascript | function getCoordinators(conn, hp, phase, cb){
hp = parseInt(hp);
phase = parseInt(phase);
var pIndex = Math.abs(hp-phase+999)%constants.TOTAL_COORDINATORS;
if (assocByzantinePhase[hp] && assocByzantinePhase[hp].roundIndex && assocByzantinePhase[hp].witnesses){
return cb(null, assocByzantinePhas... | [
"function",
"getCoordinators",
"(",
"conn",
",",
"hp",
",",
"phase",
",",
"cb",
")",
"{",
"hp",
"=",
"parseInt",
"(",
"hp",
")",
";",
"phase",
"=",
"parseInt",
"(",
"phase",
")",
";",
"var",
"pIndex",
"=",
"Math",
".",
"abs",
"(",
"hp",
"-",
"pha... | public function begin
Get proposer witnesses and round index by hp and phase
@param {obj} conn if conn is null, use db query, otherwise use conn.
@param {Integer} hp
@param {Integer} phase
@param {function} callback( err, proposer, roundIndex, witnesses ) callback function | [
"public",
"function",
"begin",
"Get",
"proposer",
"witnesses",
"and",
"round",
"index",
"by",
"hp",
"and",
"phase"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/mc/byzantine.js#L133-L159 | train |
trustnote/trustnote-pow-common | mc/byzantine.js | gossipLastMessageAtFixedInterval | function gossipLastMessageAtFixedInterval(){
if(p_phase_timeout >0 && Date.now() - p_phase_timeout > constants.BYZANTINE_PHASE_TIMEOUT){
if(bByzantineUnderWay && last_prevote_gossip &&
typeof last_prevote_gossip !== 'undefined' &&
Object.keys(last_prevote_gossip).length > 0){
... | javascript | function gossipLastMessageAtFixedInterval(){
if(p_phase_timeout >0 && Date.now() - p_phase_timeout > constants.BYZANTINE_PHASE_TIMEOUT){
if(bByzantineUnderWay && last_prevote_gossip &&
typeof last_prevote_gossip !== 'undefined' &&
Object.keys(last_prevote_gossip).length > 0){
... | [
"function",
"gossipLastMessageAtFixedInterval",
"(",
")",
"{",
"if",
"(",
"p_phase_timeout",
">",
"0",
"&&",
"Date",
".",
"now",
"(",
")",
"-",
"p_phase_timeout",
">",
"constants",
".",
"BYZANTINE_PHASE_TIMEOUT",
")",
"{",
"if",
"(",
"bByzantineUnderWay",
"&&",
... | private function end Send the last message at fixed intervals | [
"private",
"function",
"end",
"Send",
"the",
"last",
"message",
"at",
"fixed",
"intervals"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/mc/byzantine.js#L1089-L1114 | train |
trustnote/trustnote-pow-common | mc/byzantine.js | shrinkByzantineCache | function shrinkByzantineCache(){
// shrink assocByzantinePhase
var arrByzantinePhases = Object.keys(assocByzantinePhase);
if (arrByzantinePhases.length < constants.MAX_BYZANTINE_IN_CACHE){
//console.log("ByzantinePhaseCacheLog:shrinkByzantineCache,will not delete, assocByzantinePhase.length:" + arrByza... | javascript | function shrinkByzantineCache(){
// shrink assocByzantinePhase
var arrByzantinePhases = Object.keys(assocByzantinePhase);
if (arrByzantinePhases.length < constants.MAX_BYZANTINE_IN_CACHE){
//console.log("ByzantinePhaseCacheLog:shrinkByzantineCache,will not delete, assocByzantinePhase.length:" + arrByza... | [
"function",
"shrinkByzantineCache",
"(",
")",
"{",
"// shrink assocByzantinePhase",
"var",
"arrByzantinePhases",
"=",
"Object",
".",
"keys",
"(",
"assocByzantinePhase",
")",
";",
"if",
"(",
"arrByzantinePhases",
".",
"length",
"<",
"constants",
".",
"MAX_BYZANTINE_IN_... | Send the last message end cache begin | [
"Send",
"the",
"last",
"message",
"end",
"cache",
"begin"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/mc/byzantine.js#L1130-L1156 | train |
trustnote/trustnote-pow-common | wallet/light.js | addSharedAddressesOfWallet | function addSharedAddressesOfWallet(arrAddressList, handleAddedSharedAddresses){
if (!arrAddressList || arrAddressList.length === 0 )
return handleAddedSharedAddresses([]);
var strAddressList = arrAddressList.map(db.escape).join(', ');
db.query("SELECT DISTINCT shared_address FROM shared_address_signing_paths WHER... | javascript | function addSharedAddressesOfWallet(arrAddressList, handleAddedSharedAddresses){
if (!arrAddressList || arrAddressList.length === 0 )
return handleAddedSharedAddresses([]);
var strAddressList = arrAddressList.map(db.escape).join(', ');
db.query("SELECT DISTINCT shared_address FROM shared_address_signing_paths WHER... | [
"function",
"addSharedAddressesOfWallet",
"(",
"arrAddressList",
",",
"handleAddedSharedAddresses",
")",
"{",
"if",
"(",
"!",
"arrAddressList",
"||",
"arrAddressList",
".",
"length",
"===",
"0",
")",
"return",
"handleAddedSharedAddresses",
"(",
"[",
"]",
")",
";",
... | Victor ShareAddress Add | [
"Victor",
"ShareAddress",
"Add"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/light.js#L149-L162 | train |
trustnote/trustnote-pow-common | wallet/light.js | buildPath | function buildPath(objLaterJoint, objEarlierJoint, arrChain, onDone){
function addJoint(unit, onAdded){
storage.readJoint(db, unit, {
ifNotFound: function(){
throw Error("unit not found?");
},
ifFound: function(objJoint){
arrChain.push(objJoint);
onAdded(objJoint);
}
});
}
function... | javascript | function buildPath(objLaterJoint, objEarlierJoint, arrChain, onDone){
function addJoint(unit, onAdded){
storage.readJoint(db, unit, {
ifNotFound: function(){
throw Error("unit not found?");
},
ifFound: function(objJoint){
arrChain.push(objJoint);
onAdded(objJoint);
}
});
}
function... | [
"function",
"buildPath",
"(",
"objLaterJoint",
",",
"objEarlierJoint",
",",
"arrChain",
",",
"onDone",
")",
"{",
"function",
"addJoint",
"(",
"unit",
",",
"onAdded",
")",
"{",
"storage",
".",
"readJoint",
"(",
"db",
",",
"unit",
",",
"{",
"ifNotFound",
":"... | build parent path from later unit to earlier unit and add all joints along the path into arrChain arrChain will include later unit but not include earlier unit assuming arrChain already includes later unit | [
"build",
"parent",
"path",
"from",
"later",
"unit",
"to",
"earlier",
"unit",
"and",
"add",
"all",
"joints",
"along",
"the",
"path",
"into",
"arrChain",
"arrChain",
"will",
"include",
"later",
"unit",
"but",
"not",
"include",
"earlier",
"unit",
"assuming",
"a... | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/light.js#L610-L677 | train |
trustnote/trustnote-pow-common | wallet/device.js | reliablySendPreparedMessageToHub | function reliablySendPreparedMessageToHub(ws, recipient_device_pubkey, json, callbacks, conn){
var recipient_device_address = objectHash.getDeviceAddress(recipient_device_pubkey);
console.log('will encrypt and send to '+recipient_device_address+': '+JSON.stringify(json));
// encrypt to recipient's permanent pubkey b... | javascript | function reliablySendPreparedMessageToHub(ws, recipient_device_pubkey, json, callbacks, conn){
var recipient_device_address = objectHash.getDeviceAddress(recipient_device_pubkey);
console.log('will encrypt and send to '+recipient_device_address+': '+JSON.stringify(json));
// encrypt to recipient's permanent pubkey b... | [
"function",
"reliablySendPreparedMessageToHub",
"(",
"ws",
",",
"recipient_device_pubkey",
",",
"json",
",",
"callbacks",
",",
"conn",
")",
"{",
"var",
"recipient_device_address",
"=",
"objectHash",
".",
"getDeviceAddress",
"(",
"recipient_device_pubkey",
")",
";",
"c... | reliable delivery first param is either WebSocket or hostname of the hub | [
"reliable",
"delivery",
"first",
"param",
"is",
"either",
"WebSocket",
"or",
"hostname",
"of",
"the",
"hub"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/device.js#L433-L453 | train |
trustnote/trustnote-pow-common | wallet/device.js | sendPreparedMessageToHub | function sendPreparedMessageToHub(ws, recipient_device_pubkey, message_hash, json, callbacks){
if (!callbacks)
callbacks = {ifOk: function(){}, ifError: function(){}};
if (typeof ws === "string"){
var hub_host = ws;
network.findOutboundPeerOrConnect(conf.WS_PROTOCOL+hub_host, function onLocatedHubForSend(err, w... | javascript | function sendPreparedMessageToHub(ws, recipient_device_pubkey, message_hash, json, callbacks){
if (!callbacks)
callbacks = {ifOk: function(){}, ifError: function(){}};
if (typeof ws === "string"){
var hub_host = ws;
network.findOutboundPeerOrConnect(conf.WS_PROTOCOL+hub_host, function onLocatedHubForSend(err, w... | [
"function",
"sendPreparedMessageToHub",
"(",
"ws",
",",
"recipient_device_pubkey",
",",
"message_hash",
",",
"json",
",",
"callbacks",
")",
"{",
"if",
"(",
"!",
"callbacks",
")",
"callbacks",
"=",
"{",
"ifOk",
":",
"function",
"(",
")",
"{",
"}",
",",
"ifE... | first param is either WebSocket or hostname of the hub | [
"first",
"param",
"is",
"either",
"WebSocket",
"or",
"hostname",
"of",
"the",
"hub"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/device.js#L456-L469 | train |
trustnote/trustnote-pow-common | pow/round.js | getMinWlByRoundIndex | function getMinWlByRoundIndex(conn, roundIndex, callback){
conn.query(
"SELECT min_wl FROM round where round_index=?",
[roundIndex],
function(rows){
if (rows.length !== 1)
throw Error("Can not find the right round index");
callback(rows[0].min_wl);
}
);
} | javascript | function getMinWlByRoundIndex(conn, roundIndex, callback){
conn.query(
"SELECT min_wl FROM round where round_index=?",
[roundIndex],
function(rows){
if (rows.length !== 1)
throw Error("Can not find the right round index");
callback(rows[0].min_wl);
}
);
} | [
"function",
"getMinWlByRoundIndex",
"(",
"conn",
",",
"roundIndex",
",",
"callback",
")",
"{",
"conn",
".",
"query",
"(",
"\"SELECT min_wl FROM round where round_index=?\"",
",",
"[",
"roundIndex",
"]",
",",
"function",
"(",
"rows",
")",
"{",
"if",
"(",
"rows",
... | the MinWl maybe null | [
"the",
"MinWl",
"maybe",
"null"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/round.js#L283-L293 | train |
trustnote/trustnote-pow-common | pow/round.js | getCoinbaseByRoundIndex | function getCoinbaseByRoundIndex(roundIndex){
if(roundIndex < 1 || roundIndex > constants.ROUND_TOTAL_ALL)
return 0;
return constants.ROUND_COINBASE[Math.ceil(roundIndex/constants.ROUND_TOTAL_YEAR)-1];
} | javascript | function getCoinbaseByRoundIndex(roundIndex){
if(roundIndex < 1 || roundIndex > constants.ROUND_TOTAL_ALL)
return 0;
return constants.ROUND_COINBASE[Math.ceil(roundIndex/constants.ROUND_TOTAL_YEAR)-1];
} | [
"function",
"getCoinbaseByRoundIndex",
"(",
"roundIndex",
")",
"{",
"if",
"(",
"roundIndex",
"<",
"1",
"||",
"roundIndex",
">",
"constants",
".",
"ROUND_TOTAL_ALL",
")",
"return",
"0",
";",
"return",
"constants",
".",
"ROUND_COINBASE",
"[",
"Math",
".",
"ceil"... | coinbase begin old function | [
"coinbase",
"begin",
"old",
"function"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/round.js#L388-L392 | train |
trustnote/trustnote-pow-common | pow/round.js | queryFirstTrustMEBallOnMainChainByRoundIndex | function queryFirstTrustMEBallOnMainChainByRoundIndex( oConn, nRoundIndex, pfnCallback )
{
if ( ! oConn )
{
return pfnCallback( `call queryFirstTrustMEBallOnMainChainByRoundIndex with invalid oConn` );
}
if ( 'number' !== typeof nRoundIndex )
{
return pfnCallback( `call queryFirstTrustMEBallOnMainChainByRoundI... | javascript | function queryFirstTrustMEBallOnMainChainByRoundIndex( oConn, nRoundIndex, pfnCallback )
{
if ( ! oConn )
{
return pfnCallback( `call queryFirstTrustMEBallOnMainChainByRoundIndex with invalid oConn` );
}
if ( 'number' !== typeof nRoundIndex )
{
return pfnCallback( `call queryFirstTrustMEBallOnMainChainByRoundI... | [
"function",
"queryFirstTrustMEBallOnMainChainByRoundIndex",
"(",
"oConn",
",",
"nRoundIndex",
",",
"pfnCallback",
")",
"{",
"if",
"(",
"!",
"oConn",
")",
"{",
"return",
"pfnCallback",
"(",
"`",
"`",
")",
";",
"}",
"if",
"(",
"'number'",
"!==",
"typeof",
"nRo... | coinbase end
obtain ball address of the first TrustME unit
@param {handle} oConn
@param {function} oConn.query
@param {number} nRoundIndex
@param {function} pfnCallback( err, arrCoinBaseList ) | [
"coinbase",
"end",
"obtain",
"ball",
"address",
"of",
"the",
"first",
"TrustME",
"unit"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/round.js#L721-L759 | train |
trustnote/trustnote-pow-common | pow/round.js | getLastCoinbaseUnitRoundIndex | function getLastCoinbaseUnitRoundIndex(conn, address, cb){
if (!conn)
return getLastCoinbaseUnitRoundIndex(db, address, cb);
if(!validationUtils.isNonemptyString(address))
return cb("param address is null or empty string");
if(!validationUtils.isValidAddress(address))
return cb("para... | javascript | function getLastCoinbaseUnitRoundIndex(conn, address, cb){
if (!conn)
return getLastCoinbaseUnitRoundIndex(db, address, cb);
if(!validationUtils.isNonemptyString(address))
return cb("param address is null or empty string");
if(!validationUtils.isValidAddress(address))
return cb("para... | [
"function",
"getLastCoinbaseUnitRoundIndex",
"(",
"conn",
",",
"address",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"conn",
")",
"return",
"getLastCoinbaseUnitRoundIndex",
"(",
"db",
",",
"address",
",",
"cb",
")",
";",
"if",
"(",
"!",
"validationUtils",
".",
"... | Get the round index of address's last coinbase unit.
@param {obj} conn if conn is null, use db query, otherwise use conn.
@param {string} address
@param {function} cb( err, roundIndex ) callback function
If there's error, err is the error message and roundIndex is null.
If the address hasn't launch coinbase u... | [
"Get",
"the",
"round",
"index",
"of",
"address",
"s",
"last",
"coinbase",
"unit",
"."
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/pow/round.js#L774-L792 | train |
trustnote/trustnote-pow-common | wallet/supernode.js | readKeys | function readKeys(onDone){
console.log('-----------------------');
fs.readFile(KEYS_FILENAME, 'utf8', function(err, data){
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
//terminal: true
});
if (err){ // first start
console.log('failed to read keys, will gen');
... | javascript | function readKeys(onDone){
console.log('-----------------------');
fs.readFile(KEYS_FILENAME, 'utf8', function(err, data){
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
//terminal: true
});
if (err){ // first start
console.log('failed to read keys, will gen');
... | [
"function",
"readKeys",
"(",
"onDone",
")",
"{",
"console",
".",
"log",
"(",
"'-----------------------'",
")",
";",
"fs",
".",
"readFile",
"(",
"KEYS_FILENAME",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"data",
")",
"{",
"var",
"rl",
"=",
"readlin... | read keys from config file, or create new keys and write into config file
@param {function} onDone - callback | [
"read",
"keys",
"from",
"config",
"file",
"or",
"create",
"new",
"keys",
"and",
"write",
"into",
"config",
"file"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/supernode.js#L25-L92 | train |
trustnote/trustnote-pow-common | wallet/supernode.js | writeKeys | function writeKeys(mnemonic_phrase, deviceTempPrivKey, devicePrevTempPrivKey, onDone){
var keys = {
mnemonic_phrase: mnemonic_phrase,
temp_priv_key: deviceTempPrivKey.toString('base64'),
prev_temp_priv_key: devicePrevTempPrivKey.toString('base64')
};
fs.writeFile(KEYS_FILENAME, JSON.stringify(keys, null, '\t')... | javascript | function writeKeys(mnemonic_phrase, deviceTempPrivKey, devicePrevTempPrivKey, onDone){
var keys = {
mnemonic_phrase: mnemonic_phrase,
temp_priv_key: deviceTempPrivKey.toString('base64'),
prev_temp_priv_key: devicePrevTempPrivKey.toString('base64')
};
fs.writeFile(KEYS_FILENAME, JSON.stringify(keys, null, '\t')... | [
"function",
"writeKeys",
"(",
"mnemonic_phrase",
",",
"deviceTempPrivKey",
",",
"devicePrevTempPrivKey",
",",
"onDone",
")",
"{",
"var",
"keys",
"=",
"{",
"mnemonic_phrase",
":",
"mnemonic_phrase",
",",
"temp_priv_key",
":",
"deviceTempPrivKey",
".",
"toString",
"("... | write some config into config file
@param {string} mnemonic_phrase - mnemonic phrase
@param {string} deviceTempPrivKey - temp private key
@param {string} devicePrevTempPrivKey - temp device private key
@param {function} onDone - callback | [
"write",
"some",
"config",
"into",
"config",
"file"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/supernode.js#L101-L113 | train |
trustnote/trustnote-pow-common | wallet/supernode.js | createWallet | function createWallet(xPrivKey, onDone){
var devicePrivKey = xPrivKey.derive("m/1'").privateKey.bn.toBuffer({size:32});
var device = require('../wallet/device.js');
device.setDevicePrivateKey(devicePrivKey); // we need device address before creating a wallet
var strXPubKey = Bitcore.HDPublicKey(xPrivKey.derive("m/4... | javascript | function createWallet(xPrivKey, onDone){
var devicePrivKey = xPrivKey.derive("m/1'").privateKey.bn.toBuffer({size:32});
var device = require('../wallet/device.js');
device.setDevicePrivateKey(devicePrivKey); // we need device address before creating a wallet
var strXPubKey = Bitcore.HDPublicKey(xPrivKey.derive("m/4... | [
"function",
"createWallet",
"(",
"xPrivKey",
",",
"onDone",
")",
"{",
"var",
"devicePrivKey",
"=",
"xPrivKey",
".",
"derive",
"(",
"\"m/1'\"",
")",
".",
"privateKey",
".",
"bn",
".",
"toBuffer",
"(",
"{",
"size",
":",
"32",
"}",
")",
";",
"var",
"devic... | create wallet with private key
@param {string} xPrivKey - private key
@param {function} onDone - callback | [
"create",
"wallet",
"with",
"private",
"key"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/supernode.js#L120-L131 | train |
trustnote/trustnote-pow-common | wallet/supernode.js | determineIfWalletExists | function determineIfWalletExists(handleResult){
db.query("SELECT wallet FROM wallets", function(rows){
if (rows.length > 1)
throw Error("more than 1 wallet");
handleResult(rows.length > 0);
});
} | javascript | function determineIfWalletExists(handleResult){
db.query("SELECT wallet FROM wallets", function(rows){
if (rows.length > 1)
throw Error("more than 1 wallet");
handleResult(rows.length > 0);
});
} | [
"function",
"determineIfWalletExists",
"(",
"handleResult",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT wallet FROM wallets\"",
",",
"function",
"(",
"rows",
")",
"{",
"if",
"(",
"rows",
".",
"length",
">",
"1",
")",
"throw",
"Error",
"(",
"\"more than 1 wall... | determin if wallet exists
@param {function} handleResult - callback | [
"determin",
"if",
"wallet",
"exists"
] | 582965aee4cf98ad15188bfa2392f01b86fe8683 | https://github.com/trustnote/trustnote-pow-common/blob/582965aee4cf98ad15188bfa2392f01b86fe8683/wallet/supernode.js#L137-L143 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.