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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
webgme/webgme-engine | src/client/gmeNodeSetter.js | setSetAttribute | function setSetAttribute(path, setName, attrName, attrValue, msg) {
var node = _getNode(path);
if (node) {
state.core.setSetAttribute(node, setName, attrName, attrValue);
saveRoot(typeof msg === 'string' ?
msg : 'setSetAttribute(' + path + ','... | javascript | function setSetAttribute(path, setName, attrName, attrValue, msg) {
var node = _getNode(path);
if (node) {
state.core.setSetAttribute(node, setName, attrName, attrValue);
saveRoot(typeof msg === 'string' ?
msg : 'setSetAttribute(' + path + ','... | [
"function",
"setSetAttribute",
"(",
"path",
",",
"setName",
",",
"attrName",
",",
"attrValue",
",",
"msg",
")",
"{",
"var",
"node",
"=",
"_getNode",
"(",
"path",
")",
";",
"if",
"(",
"node",
")",
"{",
"state",
".",
"core",
".",
"setSetAttribute",
"(",
... | Mixed argument methods - END | [
"Mixed",
"argument",
"methods",
"-",
"END"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/client/gmeNodeSetter.js#L468-L477 | train |
webgme/webgme-engine | src/bin/blob_fs_clean_up.js | cleanUp | function cleanUp(options) {
var BlobClient = require('../server/middleware/blob/BlobClientWithFSBackend'),
blobClient,
logger,
gmeAuth,
error,
storage;
if (options && options.env) {
process.env.NODE_ENV = options.env;
}
gmeConfig = require(path.join(proce... | javascript | function cleanUp(options) {
var BlobClient = require('../server/middleware/blob/BlobClientWithFSBackend'),
blobClient,
logger,
gmeAuth,
error,
storage;
if (options && options.env) {
process.env.NODE_ENV = options.env;
}
gmeConfig = require(path.join(proce... | [
"function",
"cleanUp",
"(",
"options",
")",
"{",
"var",
"BlobClient",
"=",
"require",
"(",
"'../server/middleware/blob/BlobClientWithFSBackend'",
")",
",",
"blobClient",
",",
"logger",
",",
"gmeAuth",
",",
"error",
",",
"storage",
";",
"if",
"(",
"options",
"&&"... | Lists and optionally deletes the unused data from file-system based Blob-storage.
@param {object} [options]
@param {bool} [options.del=false] - If true will do the deletion.
@param {string} [options.env] - If given it will set the NODE_ENV environment variable.
@param {string} [options.input] - Input JSON array file, ... | [
"Lists",
"and",
"optionally",
"deletes",
"the",
"unused",
"data",
"from",
"file",
"-",
"system",
"based",
"Blob",
"-",
"storage",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/bin/blob_fs_clean_up.js#L274-L334 | train |
webgme/webgme-engine | src/common/core/users/metarules.js | loadNode | function loadNode(core, rootNode, nodePath) {
return core.loadByPath(rootNode, nodePath)
.then(function (node) {
if (node === null) {
throw new Error('Given nodePath does not exist "' + nodePath + '"!');
} else {
return node;
... | javascript | function loadNode(core, rootNode, nodePath) {
return core.loadByPath(rootNode, nodePath)
.then(function (node) {
if (node === null) {
throw new Error('Given nodePath does not exist "' + nodePath + '"!');
} else {
return node;
... | [
"function",
"loadNode",
"(",
"core",
",",
"rootNode",
",",
"nodePath",
")",
"{",
"return",
"core",
".",
"loadByPath",
"(",
"rootNode",
",",
"nodePath",
")",
".",
"then",
"(",
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"===",
"null",
")",
"... | Helper functions. | [
"Helper",
"functions",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/users/metarules.js#L13-L22 | train |
webgme/webgme-engine | src/common/core/users/metarules.js | checkPointerRules | function checkPointerRules(meta, core, node, callback) {
var result = {
hasViolation: false,
messages: []
},
metaPointers = filterPointerRules(meta).pointers,
checkPromises = [],
pointerNames = core.getPointerNames(node);
c... | javascript | function checkPointerRules(meta, core, node, callback) {
var result = {
hasViolation: false,
messages: []
},
metaPointers = filterPointerRules(meta).pointers,
checkPromises = [],
pointerNames = core.getPointerNames(node);
c... | [
"function",
"checkPointerRules",
"(",
"meta",
",",
"core",
",",
"node",
",",
"callback",
")",
"{",
"var",
"result",
"=",
"{",
"hasViolation",
":",
"false",
",",
"messages",
":",
"[",
"]",
"}",
",",
"metaPointers",
"=",
"filterPointerRules",
"(",
"meta",
... | Checker functions for pointers, sets, containment and attributes. | [
"Checker",
"functions",
"for",
"pointers",
"sets",
"containment",
"and",
"attributes",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/users/metarules.js#L142-L189 | train |
webgme/webgme-engine | src/server/worker/workerrequests.js | _extractProjectJsonAndAddAssets | function _extractProjectJsonAndAddAssets(filenameOrBuffer, blobClient, callback) {
var zip = new AdmZip(filenameOrBuffer),
artifact = blobClient.createArtifact('files'),
projectStr;
return Q.all(zip.getEntries()
.map(function (entry) {
var entryName =... | javascript | function _extractProjectJsonAndAddAssets(filenameOrBuffer, blobClient, callback) {
var zip = new AdmZip(filenameOrBuffer),
artifact = blobClient.createArtifact('files'),
projectStr;
return Q.all(zip.getEntries()
.map(function (entry) {
var entryName =... | [
"function",
"_extractProjectJsonAndAddAssets",
"(",
"filenameOrBuffer",
",",
"blobClient",
",",
"callback",
")",
"{",
"var",
"zip",
"=",
"new",
"AdmZip",
"(",
"filenameOrBuffer",
")",
",",
"artifact",
"=",
"blobClient",
".",
"createArtifact",
"(",
"'files'",
")",
... | Extracts the exported zip file and adds the contained files to the blob using
the import-part of ExportImport Plugin.
@param {string|Buffer} filenameOrBuffer
@param {BlobClient} blobClient
@param function [callback]
@returns {string} - The project json as a string
@private | [
"Extracts",
"the",
"exported",
"zip",
"file",
"and",
"adds",
"the",
"contained",
"files",
"to",
"the",
"blob",
"using",
"the",
"import",
"-",
"part",
"of",
"ExportImport",
"Plugin",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/worker/workerrequests.js#L308-L331 | train |
webgme/webgme-engine | src/server/worker/workerrequests.js | changeAttributeMeta | function changeAttributeMeta(webgmeToken, parameters, callback) {
var storage,
context,
finish = function (err, result) {
if (err) {
err = err instanceof Error ? err : new Error(err);
logger.error('changeAttributeMeta failed with er... | javascript | function changeAttributeMeta(webgmeToken, parameters, callback) {
var storage,
context,
finish = function (err, result) {
if (err) {
err = err instanceof Error ? err : new Error(err);
logger.error('changeAttributeMeta failed with er... | [
"function",
"changeAttributeMeta",
"(",
"webgmeToken",
",",
"parameters",
",",
"callback",
")",
"{",
"var",
"storage",
",",
"context",
",",
"finish",
"=",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"{",
"err",
"=",
"err",
"... | Renames the given attribute definition and propagates the change throughout the whole project.
@param {string} webgmeToken
@param {object} parameters
@param {string} parameters.projectId
@param {string} parameters.branchName
@param {string} parameters.nodePath - the starting meta node's path.
@param {string} parameters... | [
"Renames",
"the",
"given",
"attribute",
"definition",
"and",
"propagates",
"the",
"change",
"throughout",
"the",
"whole",
"project",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/worker/workerrequests.js#L1323-L1374 | train |
webgme/webgme-engine | src/server/worker/workerrequests.js | renameMetaPointerTarget | function renameMetaPointerTarget(webgmeToken, parameters, callback) {
var storage,
context,
finish = function (err, result) {
if (err) {
err = err instanceof Error ? err : new Error(err);
logger.error('changeAttributeMeta failed wit... | javascript | function renameMetaPointerTarget(webgmeToken, parameters, callback) {
var storage,
context,
finish = function (err, result) {
if (err) {
err = err instanceof Error ? err : new Error(err);
logger.error('changeAttributeMeta failed wit... | [
"function",
"renameMetaPointerTarget",
"(",
"webgmeToken",
",",
"parameters",
",",
"callback",
")",
"{",
"var",
"storage",
",",
"context",
",",
"finish",
"=",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"{",
"err",
"=",
"err",... | Renames the given pointer relation definitions and propagates the change throughout the whole project.
@param {string} webgmeToken
@param {object} parameters
@param {string} parameters.projectId
@param {string} parameters.branchName
@param {string} parameters.type - the type of the relation ['pointer'|'set'].
@param {s... | [
"Renames",
"the",
"given",
"pointer",
"relation",
"definitions",
"and",
"propagates",
"the",
"change",
"throughout",
"the",
"whole",
"project",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/worker/workerrequests.js#L1390-L1440 | train |
webgme/webgme-engine | src/server/util/ensureDir.js | ensureDir | function ensureDir(dir, mode, callback) {
var deferred = Q.defer();
if (mode && typeof mode === 'function') {
callback = mode;
mode = null;
}
mode = mode || parseInt('0777', 8) & (~process.umask());
_ensureDir(dir, mode, function (err) {
if (err) {
deferred.re... | javascript | function ensureDir(dir, mode, callback) {
var deferred = Q.defer();
if (mode && typeof mode === 'function') {
callback = mode;
mode = null;
}
mode = mode || parseInt('0777', 8) & (~process.umask());
_ensureDir(dir, mode, function (err) {
if (err) {
deferred.re... | [
"function",
"ensureDir",
"(",
"dir",
",",
"mode",
",",
"callback",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"if",
"(",
"mode",
"&&",
"typeof",
"mode",
"===",
"'function'",
")",
"{",
"callback",
"=",
"mode",
";",
"mode",
"... | ensure a directory exists, create it recursively if not.
@param dir The directory you want to ensure it exists
@param mode Refer to fs.mkdir()
@param callback | [
"ensure",
"a",
"directory",
"exists",
"create",
"it",
"recursively",
"if",
"not",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/util/ensureDir.js#L57-L77 | train |
webgme/webgme-engine | src/utils.js | requestWebGMEToken | function requestWebGMEToken(gmeConfig, userId, password, serverUrl, callback) {
var deferred,
req;
if (gmeConfig.authentication.enable === false) {
return Q().nodeify(callback);
}
if (!serverUrl) {
serverUrl = 'http://localhost:' + gmeConfig.server.port;
}
req = supera... | javascript | function requestWebGMEToken(gmeConfig, userId, password, serverUrl, callback) {
var deferred,
req;
if (gmeConfig.authentication.enable === false) {
return Q().nodeify(callback);
}
if (!serverUrl) {
serverUrl = 'http://localhost:' + gmeConfig.server.port;
}
req = supera... | [
"function",
"requestWebGMEToken",
"(",
"gmeConfig",
",",
"userId",
",",
"password",
",",
"serverUrl",
",",
"callback",
")",
"{",
"var",
"deferred",
",",
"req",
";",
"if",
"(",
"gmeConfig",
".",
"authentication",
".",
"enable",
"===",
"false",
")",
"{",
"re... | Request a token for the user via the webgme server.
If authentication is turned off it will resolve with undefined.
@param {object} gmeConfig
@param {string} userId - User to get token for.
@param {string} [password] - Must be provided if userId is not the guestAccount.
@param {string} [serverUrl='http://127.0.0.1:<gme... | [
"Request",
"a",
"token",
"for",
"the",
"user",
"via",
"the",
"webgme",
"server",
".",
"If",
"authentication",
"is",
"turned",
"off",
"it",
"will",
"resolve",
"with",
"undefined",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/utils.js#L30-L63 | train |
webgme/webgme-engine | src/utils.js | getSVGMap | function getSVGMap(gmeConfig, logger, callback) {
var svgAssetDir = gmeConfig.visualization.svgDirs[0],
//path.join(__dirname, 'client', 'assets', 'DecoratorSVG'),
svgMap;
if (!svgAssetDir) {
return Q.resolve({});
}
function joinPath(paths) {
return '/' + paths.join('/'... | javascript | function getSVGMap(gmeConfig, logger, callback) {
var svgAssetDir = gmeConfig.visualization.svgDirs[0],
//path.join(__dirname, 'client', 'assets', 'DecoratorSVG'),
svgMap;
if (!svgAssetDir) {
return Q.resolve({});
}
function joinPath(paths) {
return '/' + paths.join('/'... | [
"function",
"getSVGMap",
"(",
"gmeConfig",
",",
"logger",
",",
"callback",
")",
"{",
"var",
"svgAssetDir",
"=",
"gmeConfig",
".",
"visualization",
".",
"svgDirs",
"[",
"0",
"]",
",",
"//path.join(__dirname, 'client', 'assets', 'DecoratorSVG'),",
"svgMap",
";",
"if",... | Note, the svgs in the first directory in gmeConfig.visualization.svgDirs will be added without
the dirname prefix for the svg.
With the following file structure:
./icons/svg1.svg
./icons2/svg2.svg
./icons3/svg3.svg
and gmeConfig.visualization.svgDirs = ['./icons', './icons2', './icons3'];
then the svgMap will have ... | [
"Note",
"the",
"svgs",
"in",
"the",
"first",
"directory",
"in",
"gmeConfig",
".",
"visualization",
".",
"svgDirs",
"will",
"be",
"added",
"without",
"the",
"dirname",
"prefix",
"for",
"the",
"svg",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/utils.js#L166-L223 | train |
webgme/webgme-engine | src/common/core/corediff.js | function (containerGuid, relativePath) {
var usedDiff, path, containerDiff, baseGuids, i, baseDiff, dataKnownInExtension;
containerDiff = getNodeByGuid(diffExtension, containerGuid);
if (containerDiff === null) {
containerDiff = getNod... | javascript | function (containerGuid, relativePath) {
var usedDiff, path, containerDiff, baseGuids, i, baseDiff, dataKnownInExtension;
containerDiff = getNodeByGuid(diffExtension, containerGuid);
if (containerDiff === null) {
containerDiff = getNod... | [
"function",
"(",
"containerGuid",
",",
"relativePath",
")",
"{",
"var",
"usedDiff",
",",
"path",
",",
"containerDiff",
",",
"baseGuids",
",",
"i",
",",
"baseDiff",
",",
"dataKnownInExtension",
";",
"containerDiff",
"=",
"getNodeByGuid",
"(",
"diffExtension",
","... | a generic approach to check for complex collisions, when the same path is being created by changes in the base of some container and inside the container by either move or creation also it moves new nodes whenever any of its container changed base - not necessarily able to figure out, so it is safer to reallocate relid... | [
"a",
"generic",
"approach",
"to",
"check",
"for",
"complex",
"collisions",
"when",
"the",
"same",
"path",
"is",
"being",
"created",
"by",
"changes",
"in",
"the",
"base",
"of",
"some",
"container",
"and",
"inside",
"the",
"container",
"by",
"either",
"move",
... | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/corediff.js#L935-L974 | train | |
webgme/webgme-engine | src/common/storage/storageclasses/editorstorage.js | extractSWMContext | function extractSWMContext(swmParams) {
var result = {};
if (swmParams.projectId) {
result.projectId = swmParams.projectId;
if (swmParams.branchName || swmParams.branch || swmParams.commitHash || swmParams.commit) {
// Add any of these.
... | javascript | function extractSWMContext(swmParams) {
var result = {};
if (swmParams.projectId) {
result.projectId = swmParams.projectId;
if (swmParams.branchName || swmParams.branch || swmParams.commitHash || swmParams.commit) {
// Add any of these.
... | [
"function",
"extractSWMContext",
"(",
"swmParams",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"if",
"(",
"swmParams",
".",
"projectId",
")",
"{",
"result",
".",
"projectId",
"=",
"swmParams",
".",
"projectId",
";",
"if",
"(",
"swmParams",
".",
"branc... | Dig out the context for the server-worker request. Needed to determine if
the request needs be queued on the current commit-queue.
@param {object} swmParams
@returns {object} If the request contains a projectId and (branchName and/or commitHash). It
will return an object with projectId and (branchName and/or commitHash... | [
"Dig",
"out",
"the",
"context",
"for",
"the",
"server",
"-",
"worker",
"request",
".",
"Needed",
"to",
"determine",
"if",
"the",
"request",
"needs",
"be",
"queued",
"on",
"the",
"current",
"commit",
"-",
"queue",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/storage/storageclasses/editorstorage.js#L60-L80 | train |
webgme/webgme-engine | src/server/middleware/auth/gmeauth.js | updateUserComponentSettings | function updateUserComponentSettings(userId, componentId, settings, overwrite, callback) {
return _updateUserObjectField(userId, ['settings', componentId], settings, overwrite)
.then(function (userData) {
return userData.settings[componentId];
})
.nodeify(call... | javascript | function updateUserComponentSettings(userId, componentId, settings, overwrite, callback) {
return _updateUserObjectField(userId, ['settings', componentId], settings, overwrite)
.then(function (userData) {
return userData.settings[componentId];
})
.nodeify(call... | [
"function",
"updateUserComponentSettings",
"(",
"userId",
",",
"componentId",
",",
"settings",
",",
"overwrite",
",",
"callback",
")",
"{",
"return",
"_updateUserObjectField",
"(",
"userId",
",",
"[",
"'settings'",
",",
"componentId",
"]",
",",
"settings",
",",
... | Updates the provided fields in the settings stored at given componentId.
@param {string} userId
@param {string} componentId
@param {object} settings
@param {boolean} [overwrite] - if true the settings for the key will be overwritten.
@param {function} [callback]
@returns {*} | [
"Updates",
"the",
"provided",
"fields",
"in",
"the",
"settings",
"stored",
"at",
"given",
"componentId",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/middleware/auth/gmeauth.js#L610-L616 | train |
webgme/webgme-engine | src/server/middleware/auth/gmeauth.js | updateUserSettings | function updateUserSettings(userId, settings, overwrite, callback) {
return _updateUserObjectField(userId, ['settings'], settings, overwrite)
.then(function (userData) {
return userData.settings;
})
.nodeify(callback);
} | javascript | function updateUserSettings(userId, settings, overwrite, callback) {
return _updateUserObjectField(userId, ['settings'], settings, overwrite)
.then(function (userData) {
return userData.settings;
})
.nodeify(callback);
} | [
"function",
"updateUserSettings",
"(",
"userId",
",",
"settings",
",",
"overwrite",
",",
"callback",
")",
"{",
"return",
"_updateUserObjectField",
"(",
"userId",
",",
"[",
"'settings'",
"]",
",",
"settings",
",",
"overwrite",
")",
".",
"then",
"(",
"function",... | Updates the provided fields in the settings.
@param {string} userId
@param {object} settings
@param {boolean} [overwrite] - if true the settings for the key will be overwritten.
@param {function} [callback]
@returns {*} | [
"Updates",
"the",
"provided",
"fields",
"in",
"the",
"settings",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/middleware/auth/gmeauth.js#L626-L632 | train |
webgme/webgme-engine | src/plugin/climanager.js | PluginCliManager | function PluginCliManager(project, mainLogger, gmeConfig, opts) {
var blobClient = new BlobClientWithFSBackend(gmeConfig, mainLogger, opts);
PluginManagerBase.call(this, blobClient, project, mainLogger, gmeConfig);
} | javascript | function PluginCliManager(project, mainLogger, gmeConfig, opts) {
var blobClient = new BlobClientWithFSBackend(gmeConfig, mainLogger, opts);
PluginManagerBase.call(this, blobClient, project, mainLogger, gmeConfig);
} | [
"function",
"PluginCliManager",
"(",
"project",
",",
"mainLogger",
",",
"gmeConfig",
",",
"opts",
")",
"{",
"var",
"blobClient",
"=",
"new",
"BlobClientWithFSBackend",
"(",
"gmeConfig",
",",
"mainLogger",
",",
"opts",
")",
";",
"PluginManagerBase",
".",
"call",
... | Creates a new instance of PluginCliManager
@param {UserProject} [project] - optional default project, can be passed during initialization of plugin too.
@param {object} - mainLogger - logger for manager, plugin-logger will fork from this logger.
@param {object} gmeConfig - global configuration
@param {object} [opts] - ... | [
"Creates",
"a",
"new",
"instance",
"of",
"PluginCliManager"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/plugin/climanager.js#L22-L26 | train |
webgme/webgme-engine | src/server/storage/storage.js | loadRootAndCommitObject | function loadRootAndCommitObject(project) {
var deferred = Q.defer();
if (data.newHash !== '') {
project.loadObject(data.newHash)
.then(function (commitObject) {
fullEventData.commitObject = commitObject;
return project.loadObject(commi... | javascript | function loadRootAndCommitObject(project) {
var deferred = Q.defer();
if (data.newHash !== '') {
project.loadObject(data.newHash)
.then(function (commitObject) {
fullEventData.commitObject = commitObject;
return project.loadObject(commi... | [
"function",
"loadRootAndCommitObject",
"(",
"project",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"if",
"(",
"data",
".",
"newHash",
"!==",
"''",
")",
"{",
"project",
".",
"loadObject",
"(",
"data",
".",
"newHash",
")",
".",
... | This will also ensure that the new commit does indeed point to a commitObject with an existing root. | [
"This",
"will",
"also",
"ensure",
"that",
"the",
"new",
"commit",
"does",
"indeed",
"point",
"to",
"a",
"commitObject",
"with",
"an",
"existing",
"root",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/storage/storage.js#L649-L672 | train |
webgme/webgme-engine | src/common/storage/util.js | function (project, projectJson, options, callback) {
var deferred = Q.defer(),
toPersist = {},
rootHash = projectJson.rootHash,
defaultCommitMessage = 'Importing contents of [' +
projectJson.projectId + '@' + rootHash + ']',
... | javascript | function (project, projectJson, options, callback) {
var deferred = Q.defer(),
toPersist = {},
rootHash = projectJson.rootHash,
defaultCommitMessage = 'Importing contents of [' +
projectJson.projectId + '@' + rootHash + ']',
... | [
"function",
"(",
"project",
",",
"projectJson",
",",
"options",
",",
"callback",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"toPersist",
"=",
"{",
"}",
",",
"rootHash",
"=",
"projectJson",
".",
"rootHash",
",",
"defaultCommitMess... | Inserts a serialized project tree into the storage and associates it with a commitHash.
@param {ProjectInterface} project
@param {object} [options]
@param {string} [options.branch] - Name of branch to update
@param {string} [options.parentCommit] - Array of parents for new commit
@param {string} [options.commitMessage... | [
"Inserts",
"a",
"serialized",
"project",
"tree",
"into",
"the",
"storage",
"and",
"associates",
"it",
"with",
"a",
"commitHash",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/storage/util.js#L300-L327 | train | |
webgme/webgme-engine | src/client/client.js | fitsInPatternTypes | function fitsInPatternTypes(path, pattern) {
var i;
if (pattern.items && pattern.items.length > 0) {
for (i = 0; i < pattern.items.length; i += 1) {
if (self.isTypeOf(path, pattern.items[i])) {
return true;
}
... | javascript | function fitsInPatternTypes(path, pattern) {
var i;
if (pattern.items && pattern.items.length > 0) {
for (i = 0; i < pattern.items.length; i += 1) {
if (self.isTypeOf(path, pattern.items[i])) {
return true;
}
... | [
"function",
"fitsInPatternTypes",
"(",
"path",
",",
"pattern",
")",
"{",
"var",
"i",
";",
"if",
"(",
"pattern",
".",
"items",
"&&",
"pattern",
".",
"items",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"pattern",
"... | this is just a first brute implementation it needs serious optimization!!! | [
"this",
"is",
"just",
"a",
"first",
"brute",
"implementation",
"it",
"needs",
"serious",
"optimization!!!"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/client/client.js#L213-L226 | train |
webgme/webgme-engine | src/client/client.js | reLaunchUsers | function reLaunchUsers() {
var i;
for (i in state.users) {
if (state.users.hasOwnProperty(i)) {
if (state.users[i].UI && typeof state.users[i].UI === 'object' &&
typeof state.users[i].UI.reLaunch === 'function') {
... | javascript | function reLaunchUsers() {
var i;
for (i in state.users) {
if (state.users.hasOwnProperty(i)) {
if (state.users[i].UI && typeof state.users[i].UI === 'object' &&
typeof state.users[i].UI.reLaunch === 'function') {
... | [
"function",
"reLaunchUsers",
"(",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"in",
"state",
".",
"users",
")",
"{",
"if",
"(",
"state",
".",
"users",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"if",
"(",
"state",
".",
"users",
"[",
"i",
"... | magic number could be fine-tuned | [
"magic",
"number",
"could",
"be",
"fine",
"-",
"tuned"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/client/client.js#L407-L417 | train |
webgme/webgme-engine | src/plugin/coreplugins/GuidCollider/GuidCollider.js | function (node, next) {
var oldGuid = self.core.getGuid(node),
newGuid;
if (guids.hasOwnProperty(oldGuid)) {
hasCollision = true;
if (currentConfiguration.checkOnly) {
self.createMessage(node, 'guid colli... | javascript | function (node, next) {
var oldGuid = self.core.getGuid(node),
newGuid;
if (guids.hasOwnProperty(oldGuid)) {
hasCollision = true;
if (currentConfiguration.checkOnly) {
self.createMessage(node, 'guid colli... | [
"function",
"(",
"node",
",",
"next",
")",
"{",
"var",
"oldGuid",
"=",
"self",
".",
"core",
".",
"getGuid",
"(",
"node",
")",
",",
"newGuid",
";",
"if",
"(",
"guids",
".",
"hasOwnProperty",
"(",
"oldGuid",
")",
")",
"{",
"hasCollision",
"=",
"true",
... | Use self to access core, project, result, logger etc from PluginBase. These are all instantiated at this point. | [
"Use",
"self",
"to",
"access",
"core",
"project",
"result",
"logger",
"etc",
"from",
"PluginBase",
".",
"These",
"are",
"all",
"instantiated",
"at",
"this",
"point",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/plugin/coreplugins/GuidCollider/GuidCollider.js#L59-L76 | train | |
webgme/webgme-engine | src/common/util/uint.js | uint8ArrayToString | function uint8ArrayToString(uintArray) {
var resultString = '',
i;
for (i = 0; i < uintArray.byteLength; i++) {
resultString += String.fromCharCode(uintArray[i]);
}
return decodeURIComponent(escape(resultString));
} | javascript | function uint8ArrayToString(uintArray) {
var resultString = '',
i;
for (i = 0; i < uintArray.byteLength; i++) {
resultString += String.fromCharCode(uintArray[i]);
}
return decodeURIComponent(escape(resultString));
} | [
"function",
"uint8ArrayToString",
"(",
"uintArray",
")",
"{",
"var",
"resultString",
"=",
"''",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"uintArray",
".",
"byteLength",
";",
"i",
"++",
")",
"{",
"resultString",
"+=",
"String",
".",
"f... | this helper function is necessary as in case of large json objects, the library standard function causes stack overflow | [
"this",
"helper",
"function",
"is",
"necessary",
"as",
"in",
"case",
"of",
"large",
"json",
"objects",
"the",
"library",
"standard",
"function",
"causes",
"stack",
"overflow"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/util/uint.js#L13-L20 | train |
webgme/webgme-engine | src/server/storage/storagehelpers.js | loadObject | function loadObject(dbProject, nodeHash) {
var deferred = Q.defer(),
node;
dbProject.loadObject(nodeHash)
.then(function (node_) {
var shardLoads = [],
shardId;
node = node_;
if (node && node.ovr && node.ovr.sharded === true) {
... | javascript | function loadObject(dbProject, nodeHash) {
var deferred = Q.defer(),
node;
dbProject.loadObject(nodeHash)
.then(function (node_) {
var shardLoads = [],
shardId;
node = node_;
if (node && node.ovr && node.ovr.sharded === true) {
... | [
"function",
"loadObject",
"(",
"dbProject",
",",
"nodeHash",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"node",
";",
"dbProject",
".",
"loadObject",
"(",
"nodeHash",
")",
".",
"then",
"(",
"function",
"(",
"node_",
")",
"{",
... | Loads the specific object, and if that object represents a node with sharded overlays,
then it loads those objects as well, and pack it into a single response.
@param {object} dbProject
@param {string} nodeHash
@returns {function|promise}
@ignore | [
"Loads",
"the",
"specific",
"object",
"and",
"if",
"that",
"object",
"represents",
"a",
"node",
"with",
"sharded",
"overlays",
"then",
"it",
"loads",
"those",
"objects",
"as",
"well",
"and",
"pack",
"it",
"into",
"a",
"single",
"response",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/storage/storagehelpers.js#L87-L130 | train |
webgme/webgme-engine | src/server/storage/storagehelpers.js | loadPath | function loadPath(dbProject, rootHash, loadedObjects, path, excludeParents) {
var deferred = Q.defer(),
pathArray = path.split('/');
function processLoadResult(hash, result) {
var subHash;
if (result.multipleObjects === true) {
for (subHash in result.objects) {
... | javascript | function loadPath(dbProject, rootHash, loadedObjects, path, excludeParents) {
var deferred = Q.defer(),
pathArray = path.split('/');
function processLoadResult(hash, result) {
var subHash;
if (result.multipleObjects === true) {
for (subHash in result.objects) {
... | [
"function",
"loadPath",
"(",
"dbProject",
",",
"rootHash",
",",
"loadedObjects",
",",
"path",
",",
"excludeParents",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"pathArray",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
";",
"func... | Loads the entire composition chain up till the rootNode for the provided path. And stores the nodes
in the loadedObjects. If the any of the objects already exists in loadedObjects - it does not load it
from the database.
@param {object} dbProject
@param {string} rootHash
@param {Object<string, object>} loadedObjects
@... | [
"Loads",
"the",
"entire",
"composition",
"chain",
"up",
"till",
"the",
"rootNode",
"for",
"the",
"provided",
"path",
".",
"And",
"stores",
"the",
"nodes",
"in",
"the",
"loadedObjects",
".",
"If",
"the",
"any",
"of",
"the",
"objects",
"already",
"exists",
"... | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/storage/storagehelpers.js#L145-L195 | train |
webgme/webgme-engine | src/client/gmeServerRequests.js | checkMetaRules | function checkMetaRules(nodePaths, includeChildren, callback) {
var parameters = {
command: CONSTANTS.SERVER_WORKER_REQUESTS.CHECK_CONSTRAINTS,
checkType: 'META', //TODO this should come from a constant
includeChildren: includeChildren,
nodePat... | javascript | function checkMetaRules(nodePaths, includeChildren, callback) {
var parameters = {
command: CONSTANTS.SERVER_WORKER_REQUESTS.CHECK_CONSTRAINTS,
checkType: 'META', //TODO this should come from a constant
includeChildren: includeChildren,
nodePat... | [
"function",
"checkMetaRules",
"(",
"nodePaths",
",",
"includeChildren",
",",
"callback",
")",
"{",
"var",
"parameters",
"=",
"{",
"command",
":",
"CONSTANTS",
".",
"SERVER_WORKER_REQUESTS",
".",
"CHECK_CONSTRAINTS",
",",
"checkType",
":",
"'META'",
",",
"//TODO th... | meta rules checking
@param {string[]} nodePaths - Paths to nodes of which to check.
@param includeChildren
@param callback | [
"meta",
"rules",
"checking"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/client/gmeServerRequests.js#L212-L240 | train |
webgme/webgme-engine | src/common/storage/project/cache.js | deepFreeze | function deepFreeze(obj) {
Object.freeze(obj);
if (obj instanceof Array) {
for (var i = 0; i < obj.length; i += 1) {
if (obj[i] !== null && typeof obj[i] === 'object') {
deepFreeze(obj[i]);
}
}
... | javascript | function deepFreeze(obj) {
Object.freeze(obj);
if (obj instanceof Array) {
for (var i = 0; i < obj.length; i += 1) {
if (obj[i] !== null && typeof obj[i] === 'object') {
deepFreeze(obj[i]);
}
}
... | [
"function",
"deepFreeze",
"(",
"obj",
")",
"{",
"Object",
".",
"freeze",
"(",
"obj",
")",
";",
"if",
"(",
"obj",
"instanceof",
"Array",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"obj",
".",
"length",
";",
"i",
"+=",
"1",
")",
... | Useful for debugging potential mutations, but not good for performance. | [
"Useful",
"for",
"debugging",
"potential",
"mutations",
"but",
"not",
"good",
"for",
"performance",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/storage/project/cache.js#L32-L48 | train |
webgme/webgme-engine | src/addon/AddOnBase.js | AddOnBase | function AddOnBase(logger, gmeConfig) {
/**
* @type {GmeConfig}
*/
this.gmeConfig = gmeConfig;
/**
* @type {GmeLogger}
*/
this.logger = logger;
// Set at configure
/**
* @type {Core}
*/
this.core = null;
... | javascript | function AddOnBase(logger, gmeConfig) {
/**
* @type {GmeConfig}
*/
this.gmeConfig = gmeConfig;
/**
* @type {GmeLogger}
*/
this.logger = logger;
// Set at configure
/**
* @type {Core}
*/
this.core = null;
... | [
"function",
"AddOnBase",
"(",
"logger",
",",
"gmeConfig",
")",
"{",
"/**\n * @type {GmeConfig}\n */",
"this",
".",
"gmeConfig",
"=",
"gmeConfig",
";",
"/**\n * @type {GmeLogger}\n */",
"this",
".",
"logger",
"=",
"logger",
";",
"// Set at c... | BaseClass for AddOns which run on the server and act upon changes in a branch.
Use the AddOnGenerator to generate a new AddOn that implements this class.
@param {GmeLogger} logger
@param {GmeConfig} gmeConfig
@constructor
@alias AddOnBase | [
"BaseClass",
"for",
"AddOns",
"which",
"run",
"on",
"the",
"server",
"and",
"act",
"upon",
"changes",
"in",
"a",
"branch",
".",
"Use",
"the",
"AddOnGenerator",
"to",
"generate",
"a",
"new",
"AddOn",
"that",
"implements",
"this",
"class",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/addon/AddOnBase.js#L24-L67 | train |
webgme/webgme-engine | src/bin/serialize_to_xml.js | connectionToJson | function connectionToJson(object) {
var pointerNames = theCore.getPointerNames(object);
var src = null;
var dst = null;
if (pointerNames.indexOf('source') !== -1) {
src = theCore.loadPointer(object, 'source');
}
if (pointerNames.indexOf('target') !== -1... | javascript | function connectionToJson(object) {
var pointerNames = theCore.getPointerNames(object);
var src = null;
var dst = null;
if (pointerNames.indexOf('source') !== -1) {
src = theCore.loadPointer(object, 'source');
}
if (pointerNames.indexOf('target') !== -1... | [
"function",
"connectionToJson",
"(",
"object",
")",
"{",
"var",
"pointerNames",
"=",
"theCore",
".",
"getPointerNames",
"(",
"object",
")",
";",
"var",
"src",
"=",
"null",
";",
"var",
"dst",
"=",
"null",
";",
"if",
"(",
"pointerNames",
".",
"indexOf",
"(... | new TASYNC compatible functions | [
"new",
"TASYNC",
"compatible",
"functions"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/bin/serialize_to_xml.js#L419-L479 | train |
webgme/webgme-engine | src/common/core/metacore.js | isOnMetaSheet | function isOnMetaSheet(node) {
//MetaAspectSet
var sets = self.isMemberOf(node);
if (sets && sets[''] && sets[''].indexOf(CONSTANTS.META_SET_NAME) !== -1) {
return true;
}
return false;
} | javascript | function isOnMetaSheet(node) {
//MetaAspectSet
var sets = self.isMemberOf(node);
if (sets && sets[''] && sets[''].indexOf(CONSTANTS.META_SET_NAME) !== -1) {
return true;
}
return false;
} | [
"function",
"isOnMetaSheet",
"(",
"node",
")",
"{",
"//MetaAspectSet",
"var",
"sets",
"=",
"self",
".",
"isMemberOf",
"(",
"node",
")",
";",
"if",
"(",
"sets",
"&&",
"sets",
"[",
"''",
"]",
"&&",
"sets",
"[",
"''",
"]",
".",
"indexOf",
"(",
"CONSTANT... | type related extra query functions | [
"type",
"related",
"extra",
"query",
"functions"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/metacore.js#L78-L86 | train |
webgme/webgme-engine | src/common/EventDispatcher.js | function (sender, args) {
for (var i = 0; i < evt.length; i++) {
evt[i](sender, args);
}
} | javascript | function (sender, args) {
for (var i = 0; i < evt.length; i++) {
evt[i](sender, args);
}
} | [
"function",
"(",
"sender",
",",
"args",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"evt",
".",
"length",
";",
"i",
"++",
")",
"{",
"evt",
"[",
"i",
"]",
"(",
"sender",
",",
"args",
")",
";",
"}",
"}"
] | Create the Handler method that will use currying to call all the Events Handlers internally | [
"Create",
"the",
"Handler",
"method",
"that",
"will",
"use",
"currying",
"to",
"call",
"all",
"the",
"Events",
"Handlers",
"internally"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/EventDispatcher.js#L99-L103 | train | |
webgme/webgme-engine | src/server/standalone.js | getUrl | function getUrl() {
if (!self.serverUrl) {
// use the cached version if we already built the string
self.serverUrl = 'http://127.0.0.1:' + gmeConfig.server.port;
}
return self.serverUrl;
} | javascript | function getUrl() {
if (!self.serverUrl) {
// use the cached version if we already built the string
self.serverUrl = 'http://127.0.0.1:' + gmeConfig.server.port;
}
return self.serverUrl;
} | [
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"!",
"self",
".",
"serverUrl",
")",
"{",
"// use the cached version if we already built the string",
"self",
".",
"serverUrl",
"=",
"'http://127.0.0.1:'",
"+",
"gmeConfig",
".",
"server",
".",
"port",
";",
"}",
"re... | Gets the server's url based on the gmeConfig that was given to the constructor.
@returns {string} | [
"Gets",
"the",
"server",
"s",
"url",
"based",
"on",
"the",
"gmeConfig",
"that",
"was",
"given",
"to",
"the",
"constructor",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/standalone.js#L147-L154 | train |
webgme/webgme-engine | src/common/core/corerel.js | shouldHaveShardedOverlays | function shouldHaveShardedOverlays(node) {
return Object.keys(self.getProperty(node, CONSTANTS.OVERLAYS_PROPERTY) || {}).length >=
_shardingLimit && self.getPath(node).indexOf('_') === -1;
} | javascript | function shouldHaveShardedOverlays(node) {
return Object.keys(self.getProperty(node, CONSTANTS.OVERLAYS_PROPERTY) || {}).length >=
_shardingLimit && self.getPath(node).indexOf('_') === -1;
} | [
"function",
"shouldHaveShardedOverlays",
"(",
"node",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"self",
".",
"getProperty",
"(",
"node",
",",
"CONSTANTS",
".",
"OVERLAYS_PROPERTY",
")",
"||",
"{",
"}",
")",
".",
"length",
">=",
"_shardingLimit",
"&&",
... | We only shard regular GME nodes, technical sub-nodes do not get sharded | [
"We",
"only",
"shard",
"regular",
"GME",
"nodes",
"technical",
"sub",
"-",
"nodes",
"do",
"not",
"get",
"sharded"
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/corerel.js#L188-L191 | train |
webgme/webgme-engine | src/common/core/coretype.js | getInheritedCollectionPaths | function getInheritedCollectionPaths(node, name) {
var paths = [],
startNode = node,
actualNode = node,
endNode,
prefixNode,
i,
inverseOverlays,
target;
while (startNode) {
... | javascript | function getInheritedCollectionPaths(node, name) {
var paths = [],
startNode = node,
actualNode = node,
endNode,
prefixNode,
i,
inverseOverlays,
target;
while (startNode) {
... | [
"function",
"getInheritedCollectionPaths",
"(",
"node",
",",
"name",
")",
"{",
"var",
"paths",
"=",
"[",
"]",
",",
"startNode",
"=",
"node",
",",
"actualNode",
"=",
"node",
",",
"endNode",
",",
"prefixNode",
",",
"i",
",",
"inverseOverlays",
",",
"target",... | This function gathers the paths of the nodes that are pointing to the questioned node. The set of relations
that are checked is the 'inherited' inverse relations.
The method of this function is identical to getInheritedCollectionNames, except this function collects the
sources of the given relations and not just the n... | [
"This",
"function",
"gathers",
"the",
"paths",
"of",
"the",
"nodes",
"that",
"are",
"pointing",
"to",
"the",
"questioned",
"node",
".",
"The",
"set",
"of",
"relations",
"that",
"are",
"checked",
"is",
"the",
"inherited",
"inverse",
"relations",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/common/core/coretype.js#L245-L277 | train |
webgme/webgme-engine | src/server/storage/metadatastorage.js | updateProjectHooks | function updateProjectHooks(projectId, hooks, callback) {
return self.projectCollection.findOne({_id: projectId})
.then(function (projectData) {
if (!projectData) {
throw new Error('no such project [' + projectId + ']');
}
// alway... | javascript | function updateProjectHooks(projectId, hooks, callback) {
return self.projectCollection.findOne({_id: projectId})
.then(function (projectData) {
if (!projectData) {
throw new Error('no such project [' + projectId + ']');
}
// alway... | [
"function",
"updateProjectHooks",
"(",
"projectId",
",",
"hooks",
",",
"callback",
")",
"{",
"return",
"self",
".",
"projectCollection",
".",
"findOne",
"(",
"{",
"_id",
":",
"projectId",
"}",
")",
".",
"then",
"(",
"function",
"(",
"projectData",
")",
"{"... | This method isn't safe and should only be used privately or for removing all hooks.
@param projectId
@param hooks
@param callback
@returns {*} | [
"This",
"method",
"isn",
"t",
"safe",
"and",
"should",
"only",
"be",
"used",
"privately",
"or",
"for",
"removing",
"all",
"hooks",
"."
] | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/src/server/storage/metadatastorage.js#L242-L258 | train |
webgme/webgme-engine | utils/postinstall.js | resolveJSDocConfigPath | function resolveJSDocConfigPath() {
var jsdocConfJson = require('../jsdoc_conf.json'),
jsdocConfPath;
try {
fs.statSync(jsdocConfJson.opts.template);
console.log('jsdoc template from default config exists');
} catch (err) {
if (err.code === 'ENOENT') {
jsdocConfJ... | javascript | function resolveJSDocConfigPath() {
var jsdocConfJson = require('../jsdoc_conf.json'),
jsdocConfPath;
try {
fs.statSync(jsdocConfJson.opts.template);
console.log('jsdoc template from default config exists');
} catch (err) {
if (err.code === 'ENOENT') {
jsdocConfJ... | [
"function",
"resolveJSDocConfigPath",
"(",
")",
"{",
"var",
"jsdocConfJson",
"=",
"require",
"(",
"'../jsdoc_conf.json'",
")",
",",
"jsdocConfPath",
";",
"try",
"{",
"fs",
".",
"statSync",
"(",
"jsdocConfJson",
".",
"opts",
".",
"template",
")",
";",
"console"... | The path to the template in the jsdoc.json does not match for npm > 3 when webgme
is installed in another repo. I these cases we need to generate an alternative config
with the resolved path to the template.
@return {string} Path to jsdoc that should be used. | [
"The",
"path",
"to",
"the",
"template",
"in",
"the",
"jsdoc",
".",
"json",
"does",
"not",
"match",
"for",
"npm",
">",
"3",
"when",
"webgme",
"is",
"installed",
"in",
"another",
"repo",
".",
"I",
"these",
"cases",
"we",
"need",
"to",
"generate",
"an",
... | f9af95d7bedd83cdfde9cca9c8c2d560c0222065 | https://github.com/webgme/webgme-engine/blob/f9af95d7bedd83cdfde9cca9c8c2d560c0222065/utils/postinstall.js#L49-L82 | train |
browserstack/browserstack-runner | lib/_patch/browserstack.js | function (url, json, cb) {
var req;
if (window.ActiveXObject)
req = new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest)
req = new XMLHttpRequest();
else
throw "Strider: No ajax"
req.onreadystatechange = function () {
if (req.readyState==4)
cb(req... | javascript | function (url, json, cb) {
var req;
if (window.ActiveXObject)
req = new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest)
req = new XMLHttpRequest();
else
throw "Strider: No ajax"
req.onreadystatechange = function () {
if (req.readyState==4)
cb(req... | [
"function",
"(",
"url",
",",
"json",
",",
"cb",
")",
"{",
"var",
"req",
";",
"if",
"(",
"window",
".",
"ActiveXObject",
")",
"req",
"=",
"new",
"ActiveXObject",
"(",
"'Microsoft.XMLHTTP'",
")",
";",
"else",
"if",
"(",
"window",
".",
"XMLHttpRequest",
"... | Tiny Ajax Post | [
"Tiny",
"Ajax",
"Post"
] | 52b23f060a19c3a5d9d31db4b0cfa65334d926cc | https://github.com/browserstack/browserstack-runner/blob/52b23f060a19c3a5d9d31db4b0cfa65334d926cc/lib/_patch/browserstack.js#L12-L38 | train | |
browserstack/browserstack-runner | lib/_patch/jasmine-jsreporter.js | round | function round (amount, numOfDecDigits) {
numOfDecDigits = numOfDecDigits || 2;
return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);
} | javascript | function round (amount, numOfDecDigits) {
numOfDecDigits = numOfDecDigits || 2;
return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);
} | [
"function",
"round",
"(",
"amount",
",",
"numOfDecDigits",
")",
"{",
"numOfDecDigits",
"=",
"numOfDecDigits",
"||",
"2",
";",
"return",
"Math",
".",
"round",
"(",
"amount",
"*",
"Math",
".",
"pow",
"(",
"10",
",",
"numOfDecDigits",
")",
")",
"/",
"Math",... | Round an amount to the given number of Digits.
If no number of digits is given, than '2' is assumed.
@param amount Amount to round
@param numOfDecDigits Number of Digits to round to. Default value is '2'.
@return Rounded amount | [
"Round",
"an",
"amount",
"to",
"the",
"given",
"number",
"of",
"Digits",
".",
"If",
"no",
"number",
"of",
"digits",
"is",
"given",
"than",
"2",
"is",
"assumed",
"."
] | 52b23f060a19c3a5d9d31db4b0cfa65334d926cc | https://github.com/browserstack/browserstack-runner/blob/52b23f060a19c3a5d9d31db4b0cfa65334d926cc/lib/_patch/jasmine-jsreporter.js#L51-L54 | train |
browserstack/browserstack-runner | lib/_patch/jasmine-jsreporter.js | getSuiteData | function getSuiteData (suite) {
var suiteData = {
description : suite.description,
durationSec : 0,
specs: [],
suites: [],
passed: true
},
specs = suite.specs(),
suites = suite.suites(),
... | javascript | function getSuiteData (suite) {
var suiteData = {
description : suite.description,
durationSec : 0,
specs: [],
suites: [],
passed: true
},
specs = suite.specs(),
suites = suite.suites(),
... | [
"function",
"getSuiteData",
"(",
"suite",
")",
"{",
"var",
"suiteData",
"=",
"{",
"description",
":",
"suite",
".",
"description",
",",
"durationSec",
":",
"0",
",",
"specs",
":",
"[",
"]",
",",
"suites",
":",
"[",
"]",
",",
"passed",
":",
"true",
"}... | Collect information about a Suite, recursively, and return a JSON result.
@param suite The Jasmine Suite to get data from | [
"Collect",
"information",
"about",
"a",
"Suite",
"recursively",
"and",
"return",
"a",
"JSON",
"result",
"."
] | 52b23f060a19c3a5d9d31db4b0cfa65334d926cc | https://github.com/browserstack/browserstack-runner/blob/52b23f060a19c3a5d9d31db4b0cfa65334d926cc/lib/_patch/jasmine-jsreporter.js#L60-L95 | train |
angular-translate/grunt-angular-translate | tasks/angular-translate.js | function (translationKey, translationDefaultValue) {
if (regexName !== "JavascriptServiceArraySimpleQuote" &&
regexName !== "JavascriptServiceArrayDoubleQuote") {
if (keyAsText === true && translationDefaultValue.length === 0) {
results[translationKey] = translati... | javascript | function (translationKey, translationDefaultValue) {
if (regexName !== "JavascriptServiceArraySimpleQuote" &&
regexName !== "JavascriptServiceArrayDoubleQuote") {
if (keyAsText === true && translationDefaultValue.length === 0) {
results[translationKey] = translati... | [
"function",
"(",
"translationKey",
",",
"translationDefaultValue",
")",
"{",
"if",
"(",
"regexName",
"!==",
"\"JavascriptServiceArraySimpleQuote\"",
"&&",
"regexName",
"!==",
"\"JavascriptServiceArrayDoubleQuote\"",
")",
"{",
"if",
"(",
"keyAsText",
"===",
"true",
"&&",... | Store the translationKey with the value into results | [
"Store",
"the",
"translationKey",
"with",
"the",
"value",
"into",
"results"
] | a3988c3850a3970a048c1a0a1ae5d2d14f0793f7 | https://github.com/angular-translate/grunt-angular-translate/blob/a3988c3850a3970a048c1a0a1ae5d2d14f0793f7/tasks/angular-translate.js#L140-L149 | train | |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.device-orientation/www/compass.js | function(successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
var win = function(result) {
var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
... | javascript | function(successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments);
var win = function(result) {
var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp);
... | [
"function",
"(",
"successCallback",
",",
"errorCallback",
",",
"options",
")",
"{",
"argscheck",
".",
"checkArgs",
"(",
"'fFO'",
",",
"'compass.getCurrentHeading'",
",",
"arguments",
")",
";",
"var",
"win",
"=",
"function",
"(",
"result",
")",
"{",
"var",
"c... | Asynchronously acquires the current heading.
@param {Function} successCallback The function to call when the heading
data is available
@param {Function} errorCallback The function to call when there is an error
getting the heading data.
@param {CompassOptions} options The options for getting the heading data (not used)... | [
"Asynchronously",
"acquires",
"the",
"current",
"heading",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.device-orientation/www/compass.js#L38-L52 | train | |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.device-orientation/www/compass.js | function(successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
// Default interval (100 msec)
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
var filter = (options !=... | javascript | function(successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'compass.watchHeading', arguments);
// Default interval (100 msec)
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
var filter = (options !=... | [
"function",
"(",
"successCallback",
",",
"errorCallback",
",",
"options",
")",
"{",
"argscheck",
".",
"checkArgs",
"(",
"'fFO'",
",",
"'compass.watchHeading'",
",",
"arguments",
")",
";",
"// Default interval (100 msec)",
"var",
"frequency",
"=",
"(",
"options",
"... | Asynchronously acquires the heading repeatedly at a given interval.
@param {Function} successCallback The function to call each time the heading
data is available
@param {Function} errorCallback The function to call when there is an error
getting the heading data.
@param {HeadingOptions} options The options for getting... | [
"Asynchronously",
"acquires",
"the",
"heading",
"repeatedly",
"at",
"a",
"given",
"interval",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.device-orientation/www/compass.js#L64-L83 | train | |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/Contact.js | convertOut | function convertOut(contact) {
var value = contact.birthday;
if (value !== null) {
// try to make it a Date object if it is not already
if (!utils.isDate(value)){
try {
value = new Date(value);
} catch(exception){
value = null;
... | javascript | function convertOut(contact) {
var value = contact.birthday;
if (value !== null) {
// try to make it a Date object if it is not already
if (!utils.isDate(value)){
try {
value = new Date(value);
} catch(exception){
value = null;
... | [
"function",
"convertOut",
"(",
"contact",
")",
"{",
"var",
"value",
"=",
"contact",
".",
"birthday",
";",
"if",
"(",
"value",
"!==",
"null",
")",
"{",
"// try to make it a Date object if it is not already",
"if",
"(",
"!",
"utils",
".",
"isDate",
"(",
"value",... | Converts Complex objects into primitives
Only conversion at present is for Dates. | [
"Converts",
"Complex",
"objects",
"into",
"primitives",
"Only",
"conversion",
"at",
"present",
"is",
"for",
"Dates",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/Contact.js#L46-L63 | train |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/Contact.js | function (id, displayName, name, nickname, phoneNumbers, emails, addresses,
ims, organizations, birthday, note, photos, categories, urls) {
this.id = id || null;
this.rawId = null;
this.displayName = displayName || null;
this.name = name || null; // ContactName
this.nickname = nickname || null;
... | javascript | function (id, displayName, name, nickname, phoneNumbers, emails, addresses,
ims, organizations, birthday, note, photos, categories, urls) {
this.id = id || null;
this.rawId = null;
this.displayName = displayName || null;
this.name = name || null; // ContactName
this.nickname = nickname || null;
... | [
"function",
"(",
"id",
",",
"displayName",
",",
"name",
",",
"nickname",
",",
"phoneNumbers",
",",
"emails",
",",
"addresses",
",",
"ims",
",",
"organizations",
",",
"birthday",
",",
"note",
",",
"photos",
",",
"categories",
",",
"urls",
")",
"{",
"this"... | Contains information about a single contact.
@constructor
@param {DOMString} id unique identifier
@param {DOMString} displayName
@param {ContactName} name
@param {DOMString} nickname
@param {Array.<ContactField>} phoneNumbers array of phone numbers
@param {Array.<ContactField>} emails array of email addresses
@param {A... | [
"Contains",
"information",
"about",
"a",
"single",
"contact",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/Contact.js#L83-L100 | train | |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.file/www/Entry.js | Entry | function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
this.isFile = !!isFile;
this.isDirectory = !!isDirectory;
this.name = name || '';
this.fullPath = fullPath || '';
this.filesystem = fileSystem || null;
} | javascript | function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
this.isFile = !!isFile;
this.isDirectory = !!isDirectory;
this.name = name || '';
this.fullPath = fullPath || '';
this.filesystem = fileSystem || null;
} | [
"function",
"Entry",
"(",
"isFile",
",",
"isDirectory",
",",
"name",
",",
"fullPath",
",",
"fileSystem",
")",
"{",
"this",
".",
"isFile",
"=",
"!",
"!",
"isFile",
";",
"this",
".",
"isDirectory",
"=",
"!",
"!",
"isDirectory",
";",
"this",
".",
"name",
... | Represents a file or directory on the local file system.
@param isFile
{boolean} true if Entry is a file (readonly)
@param isDirectory
{boolean} true if Entry is a directory (readonly)
@param name
{DOMString} name of the file or directory, excluding the path
leading to it (readonly)
@param fullPath
{DOMString} the abs... | [
"Represents",
"a",
"file",
"or",
"directory",
"on",
"the",
"local",
"file",
"system",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.file/www/Entry.js#L44-L50 | train |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.geolocation/www/geolocation.js | parseParameters | function parseParameters(options) {
var opt = {
maximumAge: 0,
enableHighAccuracy: false,
timeout: Infinity
};
if (options) {
if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) {
opt.maximumAge = options.maximumAge;
... | javascript | function parseParameters(options) {
var opt = {
maximumAge: 0,
enableHighAccuracy: false,
timeout: Infinity
};
if (options) {
if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) {
opt.maximumAge = options.maximumAge;
... | [
"function",
"parseParameters",
"(",
"options",
")",
"{",
"var",
"opt",
"=",
"{",
"maximumAge",
":",
"0",
",",
"enableHighAccuracy",
":",
"false",
",",
"timeout",
":",
"Infinity",
"}",
";",
"if",
"(",
"options",
")",
"{",
"if",
"(",
"options",
".",
"max... | list of timers in use Returns default params, overrides if provided with values | [
"list",
"of",
"timers",
"in",
"use",
"Returns",
"default",
"params",
"overrides",
"if",
"provided",
"with",
"values"
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.geolocation/www/geolocation.js#L31-L55 | train |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.geolocation/www/geolocation.js | createTimeout | function createTimeout(errorCallback, timeout) {
var t = setTimeout(function() {
clearTimeout(t);
t = null;
errorCallback({
code:PositionError.TIMEOUT,
message:"Position retrieval timed out."
});
}, timeout);
return t;
} | javascript | function createTimeout(errorCallback, timeout) {
var t = setTimeout(function() {
clearTimeout(t);
t = null;
errorCallback({
code:PositionError.TIMEOUT,
message:"Position retrieval timed out."
});
}, timeout);
return t;
} | [
"function",
"createTimeout",
"(",
"errorCallback",
",",
"timeout",
")",
"{",
"var",
"t",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"clearTimeout",
"(",
"t",
")",
";",
"t",
"=",
"null",
";",
"errorCallback",
"(",
"{",
"code",
":",
"PositionError"... | Returns a timeout failure, closed over a specified timeout value and error callback. | [
"Returns",
"a",
"timeout",
"failure",
"closed",
"over",
"a",
"specified",
"timeout",
"value",
"and",
"error",
"callback",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.geolocation/www/geolocation.js#L58-L68 | train |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/contacts.js | function(fields, successCB, errorCB, options) {
argscheck.checkArgs('afFO', 'contacts.find', arguments);
if (!fields.length) {
errorCB && errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
} else {
var win = function(result) {
var cs = [];
... | javascript | function(fields, successCB, errorCB, options) {
argscheck.checkArgs('afFO', 'contacts.find', arguments);
if (!fields.length) {
errorCB && errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
} else {
var win = function(result) {
var cs = [];
... | [
"function",
"(",
"fields",
",",
"successCB",
",",
"errorCB",
",",
"options",
")",
"{",
"argscheck",
".",
"checkArgs",
"(",
"'afFO'",
",",
"'contacts.find'",
",",
"arguments",
")",
";",
"if",
"(",
"!",
"fields",
".",
"length",
")",
"{",
"errorCB",
"&&",
... | Returns an array of Contacts matching the search criteria.
@param fields that should be searched
@param successCB success callback
@param errorCB error callback
@param {ContactFindOptions} options that can be applied to contact searching
@return array of Contacts matching search criteria | [
"Returns",
"an",
"array",
"of",
"Contacts",
"matching",
"the",
"search",
"criteria",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.contacts/www/contacts.js#L41-L55 | train | |
phonegap/connect-phonegap | res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.file/www/DirectoryEntry.js | function(name, fullPath, fileSystem) {
DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem);
} | javascript | function(name, fullPath, fileSystem) {
DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem);
} | [
"function",
"(",
"name",
",",
"fullPath",
",",
"fileSystem",
")",
"{",
"DirectoryEntry",
".",
"__super__",
".",
"constructor",
".",
"call",
"(",
"this",
",",
"false",
",",
"true",
",",
"name",
",",
"fullPath",
",",
"fileSystem",
")",
";",
"}"
] | An interface representing a directory on the file system.
{boolean} isFile always false (readonly)
{boolean} isDirectory always true (readonly)
{DOMString} name of the directory, excluding the path leading to it (readonly)
{DOMString} fullPath the absolute full path to the directory (readonly)
{FileSystem} filesystem ... | [
"An",
"interface",
"representing",
"a",
"directory",
"on",
"the",
"file",
"system",
"."
] | 720ed8c8341a67a7a622aaeb83e153883f3fcb2c | https://github.com/phonegap/connect-phonegap/blob/720ed8c8341a67a7a622aaeb83e153883f3fcb2c/res/middleware/cordova/3.4.0/android/plugins/org.apache.cordova.file/www/DirectoryEntry.js#L38-L40 | train | |
jasongin/noble-uwp | lib/rt-utils.js | using | function using(ns) {
let nsParts = ns.split('.');
let parentObj = global;
// Build an object tree as necessary for the namespace hierarchy.
for (let i = 0; i < nsParts.length - 1; i++) {
let nsObj = parentObj[nsParts[i]];
if (!nsObj) {
nsObj = {};
parentObj[nsParts[i]] = nsObj;
}
parentObj = nsObj;
... | javascript | function using(ns) {
let nsParts = ns.split('.');
let parentObj = global;
// Build an object tree as necessary for the namespace hierarchy.
for (let i = 0; i < nsParts.length - 1; i++) {
let nsObj = parentObj[nsParts[i]];
if (!nsObj) {
nsObj = {};
parentObj[nsParts[i]] = nsObj;
}
parentObj = nsObj;
... | [
"function",
"using",
"(",
"ns",
")",
"{",
"let",
"nsParts",
"=",
"ns",
".",
"split",
"(",
"'.'",
")",
";",
"let",
"parentObj",
"=",
"global",
";",
"// Build an object tree as necessary for the namespace hierarchy.",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i"... | Require a NodeRt namespace package and load it into the global namespace. | [
"Require",
"a",
"NodeRt",
"namespace",
"package",
"and",
"load",
"it",
"into",
"the",
"global",
"namespace",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L11-L37 | train |
jasongin/noble-uwp | lib/rt-utils.js | toArray | function toArray(o) {
let a = new Array(o.length);
for (let i = 0; i < a.length; i++) {
a[i] = o[i];
}
return a;
} | javascript | function toArray(o) {
let a = new Array(o.length);
for (let i = 0; i < a.length; i++) {
a[i] = o[i];
}
return a;
} | [
"function",
"toArray",
"(",
"o",
")",
"{",
"let",
"a",
"=",
"new",
"Array",
"(",
"o",
".",
"length",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
";",
"i",
"++",
")",
"{",
"a",
"[",
"i",
"]",
"=",
"o",
... | Convert a WinRT IVectorView to a JS Array. | [
"Convert",
"a",
"WinRT",
"IVectorView",
"to",
"a",
"JS",
"Array",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L52-L58 | train |
jasongin/noble-uwp | lib/rt-utils.js | toMap | function toMap(o) {
let m = new Map();
for (let i = o.first(); i.hasCurrent; i.moveNext()) {
m.set(i.current.key, i.current.value);
}
return m;
} | javascript | function toMap(o) {
let m = new Map();
for (let i = o.first(); i.hasCurrent; i.moveNext()) {
m.set(i.current.key, i.current.value);
}
return m;
} | [
"function",
"toMap",
"(",
"o",
")",
"{",
"let",
"m",
"=",
"new",
"Map",
"(",
")",
";",
"for",
"(",
"let",
"i",
"=",
"o",
".",
"first",
"(",
")",
";",
"i",
".",
"hasCurrent",
";",
"i",
".",
"moveNext",
"(",
")",
")",
"{",
"m",
".",
"set",
... | Convert a WinRT IMap to a JS Map. | [
"Convert",
"a",
"WinRT",
"IMap",
"to",
"a",
"JS",
"Map",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L61-L67 | train |
jasongin/noble-uwp | lib/rt-utils.js | toBuffer | function toBuffer(b) {
// TODO: Use nodert-streams to more efficiently convert the buffer?
let len = b.length;
const DataReader = Windows.Storage.Streams.DataReader;
let r = DataReader.fromBuffer(b);
let a = new Uint8Array(len);
for (let i = 0; i < len; i++) {
a[i] = r.readByte();
}
return Buffer.from(a.buffe... | javascript | function toBuffer(b) {
// TODO: Use nodert-streams to more efficiently convert the buffer?
let len = b.length;
const DataReader = Windows.Storage.Streams.DataReader;
let r = DataReader.fromBuffer(b);
let a = new Uint8Array(len);
for (let i = 0; i < len; i++) {
a[i] = r.readByte();
}
return Buffer.from(a.buffe... | [
"function",
"toBuffer",
"(",
"b",
")",
"{",
"// TODO: Use nodert-streams to more efficiently convert the buffer?",
"let",
"len",
"=",
"b",
".",
"length",
";",
"const",
"DataReader",
"=",
"Windows",
".",
"Storage",
".",
"Streams",
".",
"DataReader",
";",
"let",
"r"... | Convert a WinRT IBuffer to a JS Buffer. | [
"Convert",
"a",
"WinRT",
"IBuffer",
"to",
"a",
"JS",
"Buffer",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L70-L80 | train |
jasongin/noble-uwp | lib/rt-utils.js | fromBuffer | function fromBuffer(b) {
// TODO: Use nodert-streams to more efficiently convert the buffer?
let len = b.length;
const DataWriter = Windows.Storage.Streams.DataWriter;
let w = new DataWriter();
for (let i = 0; i < len; i++) {
w.writeByte(b[i]);
}
return w.detachBuffer();
} | javascript | function fromBuffer(b) {
// TODO: Use nodert-streams to more efficiently convert the buffer?
let len = b.length;
const DataWriter = Windows.Storage.Streams.DataWriter;
let w = new DataWriter();
for (let i = 0; i < len; i++) {
w.writeByte(b[i]);
}
return w.detachBuffer();
} | [
"function",
"fromBuffer",
"(",
"b",
")",
"{",
"// TODO: Use nodert-streams to more efficiently convert the buffer?",
"let",
"len",
"=",
"b",
".",
"length",
";",
"const",
"DataWriter",
"=",
"Windows",
".",
"Storage",
".",
"Streams",
".",
"DataWriter",
";",
"let",
"... | Convert a JS Buffer to a WinRT IBuffer. | [
"Convert",
"a",
"JS",
"Buffer",
"to",
"a",
"WinRT",
"IBuffer",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L83-L92 | train |
jasongin/noble-uwp | lib/rt-utils.js | keepAlive | function keepAlive(k) {
if (k) {
if (++keepAliveIntervalCount === 1) {
// The actual duration doesn't really matter: it should be large but not too large.
keepAliveIntervalId = setInterval(() => { }, 24 * 60 * 60 * 1000);
}
} else {
if (--keepAliveIntervalCount === 0) {
clearInterval(keepAliveIntervalI... | javascript | function keepAlive(k) {
if (k) {
if (++keepAliveIntervalCount === 1) {
// The actual duration doesn't really matter: it should be large but not too large.
keepAliveIntervalId = setInterval(() => { }, 24 * 60 * 60 * 1000);
}
} else {
if (--keepAliveIntervalCount === 0) {
clearInterval(keepAliveIntervalI... | [
"function",
"keepAlive",
"(",
"k",
")",
"{",
"if",
"(",
"k",
")",
"{",
"if",
"(",
"++",
"keepAliveIntervalCount",
"===",
"1",
")",
"{",
"// The actual duration doesn't really matter: it should be large but not too large.",
"keepAliveIntervalId",
"=",
"setInterval",
"(",... | Increment or decrement the count of WinRT async tasks. While the count is non-zero an interval is used to keep the JS engine alive. | [
"Increment",
"or",
"decrement",
"the",
"count",
"of",
"WinRT",
"async",
"tasks",
".",
"While",
"the",
"count",
"is",
"non",
"-",
"zero",
"an",
"interval",
"is",
"used",
"to",
"keep",
"the",
"JS",
"engine",
"alive",
"."
] | a76c6230720f768615faccf5b5dfb41cc0b8ed33 | https://github.com/jasongin/noble-uwp/blob/a76c6230720f768615faccf5b5dfb41cc0b8ed33/lib/rt-utils.js#L99-L111 | train |
Prinzhorn/skrollr-stylesheets | src/skrollr.stylesheets.js | function(input, output) {
rxAnimation.lastIndex = 0;
var animation;
var rawKeyframes;
var keyframe;
var curAnimation;
while((animation = rxAnimation.exec(input)) !== null) {
//Grab the keyframes inside this animation.
rxKeyframes.lastIndex = rxAnimation.lastIndex;
rawKeyframes = rxKeyframes.exec(... | javascript | function(input, output) {
rxAnimation.lastIndex = 0;
var animation;
var rawKeyframes;
var keyframe;
var curAnimation;
while((animation = rxAnimation.exec(input)) !== null) {
//Grab the keyframes inside this animation.
rxKeyframes.lastIndex = rxAnimation.lastIndex;
rawKeyframes = rxKeyframes.exec(... | [
"function",
"(",
"input",
",",
"output",
")",
"{",
"rxAnimation",
".",
"lastIndex",
"=",
"0",
";",
"var",
"animation",
";",
"var",
"rawKeyframes",
";",
"var",
"keyframe",
";",
"var",
"curAnimation",
";",
"while",
"(",
"(",
"animation",
"=",
"rxAnimation",
... | Finds animation declarations and puts them into the output map. | [
"Finds",
"animation",
"declarations",
"and",
"puts",
"them",
"into",
"the",
"output",
"map",
"."
] | f6a339e128a69e7d25e7caa4bdf38b5235cf29c6 | https://github.com/Prinzhorn/skrollr-stylesheets/blob/f6a339e128a69e7d25e7caa4bdf38b5235cf29c6/src/skrollr.stylesheets.js#L109-L134 | train | |
Prinzhorn/skrollr-stylesheets | src/skrollr.stylesheets.js | function(input, startIndex) {
var begin;
var end = startIndex;
//First find the curly bracket that opens this block.
while(end-- && input.charAt(end) !== '{') {}
//The end is now fixed to the right of the selector.
//Now start there to find the begin of the selector.
begin = end;
//Now walk farther b... | javascript | function(input, startIndex) {
var begin;
var end = startIndex;
//First find the curly bracket that opens this block.
while(end-- && input.charAt(end) !== '{') {}
//The end is now fixed to the right of the selector.
//Now start there to find the begin of the selector.
begin = end;
//Now walk farther b... | [
"function",
"(",
"input",
",",
"startIndex",
")",
"{",
"var",
"begin",
";",
"var",
"end",
"=",
"startIndex",
";",
"//First find the curly bracket that opens this block.",
"while",
"(",
"end",
"--",
"&&",
"input",
".",
"charAt",
"(",
"end",
")",
"!==",
"'{'",
... | Extracts the selector of the given block by walking backwards to the start of the block. | [
"Extracts",
"the",
"selector",
"of",
"the",
"given",
"block",
"by",
"walking",
"backwards",
"to",
"the",
"start",
"of",
"the",
"block",
"."
] | f6a339e128a69e7d25e7caa4bdf38b5235cf29c6 | https://github.com/Prinzhorn/skrollr-stylesheets/blob/f6a339e128a69e7d25e7caa4bdf38b5235cf29c6/src/skrollr.stylesheets.js#L137-L154 | train | |
Prinzhorn/skrollr-stylesheets | src/skrollr.stylesheets.js | function(input, output) {
var match;
var selector;
rxAttributeSetter.lastIndex = 0;
while((match = rxAttributeSetter.exec(input)) !== null) {
//Extract the selector of the block we found the animation in.
selector = extractSelector(input, rxAttributeSetter.lastIndex);
//Associate this selector with ... | javascript | function(input, output) {
var match;
var selector;
rxAttributeSetter.lastIndex = 0;
while((match = rxAttributeSetter.exec(input)) !== null) {
//Extract the selector of the block we found the animation in.
selector = extractSelector(input, rxAttributeSetter.lastIndex);
//Associate this selector with ... | [
"function",
"(",
"input",
",",
"output",
")",
"{",
"var",
"match",
";",
"var",
"selector",
";",
"rxAttributeSetter",
".",
"lastIndex",
"=",
"0",
";",
"while",
"(",
"(",
"match",
"=",
"rxAttributeSetter",
".",
"exec",
"(",
"input",
")",
")",
"!==",
"nul... | Finds usage of attribute setters and puts the selector and attribute data into the output array. | [
"Finds",
"usage",
"of",
"attribute",
"setters",
"and",
"puts",
"the",
"selector",
"and",
"attribute",
"data",
"into",
"the",
"output",
"array",
"."
] | f6a339e128a69e7d25e7caa4bdf38b5235cf29c6 | https://github.com/Prinzhorn/skrollr-stylesheets/blob/f6a339e128a69e7d25e7caa4bdf38b5235cf29c6/src/skrollr.stylesheets.js#L173-L186 | train | |
travishorn/jquery-sessionTimeout | jquery.sessionTimeout.js | function () {
$(this).dialog('close');
$.ajax({
type: o.keepAliveAjaxRequestType,
url: o.appendTime ? updateQueryStringParameter(o.keepAliveUrl, "_", new Date().getTime()) : o.keepAliveUrl
});
... | javascript | function () {
$(this).dialog('close');
$.ajax({
type: o.keepAliveAjaxRequestType,
url: o.appendTime ? updateQueryStringParameter(o.keepAliveUrl, "_", new Date().getTime()) : o.keepAliveUrl
});
... | [
"function",
"(",
")",
"{",
"$",
"(",
"this",
")",
".",
"dialog",
"(",
"'close'",
")",
";",
"$",
".",
"ajax",
"(",
"{",
"type",
":",
"o",
".",
"keepAliveAjaxRequestType",
",",
"url",
":",
"o",
".",
"appendTime",
"?",
"updateQueryStringParameter",
"(",
... | Button two - closes dialog and makes call to keep-alive URL | [
"Button",
"two",
"-",
"closes",
"dialog",
"and",
"makes",
"call",
"to",
"keep",
"-",
"alive",
"URL"
] | b9027365ca616b16008cddd0068f2aabf387ed12 | https://github.com/travishorn/jquery-sessionTimeout/blob/b9027365ca616b16008cddd0068f2aabf387ed12/jquery.sessionTimeout.js#L90-L101 | train | |
gustavohenke/toposort | build/toposort.js | visit | function visit( node, predecessors ) {
//check if a node is dependent of itself
if( predecessors.length !== 0 && predecessors.indexOf( node ) !== -1 ) {
throw new Error( "Cyclic dependency found. " + node + " is dependent of itself.\nDependency chain: "
... | javascript | function visit( node, predecessors ) {
//check if a node is dependent of itself
if( predecessors.length !== 0 && predecessors.indexOf( node ) !== -1 ) {
throw new Error( "Cyclic dependency found. " + node + " is dependent of itself.\nDependency chain: "
... | [
"function",
"visit",
"(",
"node",
",",
"predecessors",
")",
"{",
"//check if a node is dependent of itself",
"if",
"(",
"predecessors",
".",
"length",
"!==",
"0",
"&&",
"predecessors",
".",
"indexOf",
"(",
"node",
")",
"!==",
"-",
"1",
")",
"{",
"throw",
"ne... | define a visitor function that recursively traverses dependencies. | [
"define",
"a",
"visitor",
"function",
"that",
"recursively",
"traverses",
"dependencies",
"."
] | fe0ca2afb366a115e6f8068b1f67bfd701bfd3d8 | https://github.com/gustavohenke/toposort/blob/fe0ca2afb366a115e6f8068b1f67bfd701bfd3d8/build/toposort.js#L170-L219 | train |
ssbc/ssb-ws | json-api.js | function (req, res, next) {
var id
try { id = decodeURIComponent(req.url.substring(5)) }
catch (_) { id = req.url.substring(5) }
if(req.url.substring(0, 5) !== '/msg/' || !ref.isMsg(id)) return next()
sbot.get(id, function (err, msg) {
if(err) return next(err)
send(res, {k... | javascript | function (req, res, next) {
var id
try { id = decodeURIComponent(req.url.substring(5)) }
catch (_) { id = req.url.substring(5) }
if(req.url.substring(0, 5) !== '/msg/' || !ref.isMsg(id)) return next()
sbot.get(id, function (err, msg) {
if(err) return next(err)
send(res, {k... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"id",
"try",
"{",
"id",
"=",
"decodeURIComponent",
"(",
"req",
".",
"url",
".",
"substring",
"(",
"5",
")",
")",
"}",
"catch",
"(",
"_",
")",
"{",
"id",
"=",
"req",
".",
"url",
... | blobs are served over CORS, so you can get blobs from any pub. | [
"blobs",
"are",
"served",
"over",
"CORS",
"so",
"you",
"can",
"get",
"blobs",
"from",
"any",
"pub",
"."
] | d839f9abdd5d58d9fb244b8e49ff221f161e7845 | https://github.com/ssbc/ssb-ws/blob/d839f9abdd5d58d9fb244b8e49ff221f161e7845/json-api.js#L19-L29 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(dt, inc) {
var args = {
dt: dt,
inc: inc
},
result = this._cacheGet('before', args);
if (result === false) {
result = this._iter(new IterResult('before', args));
this._cacheAdd('before', result, args);
}
... | javascript | function(dt, inc) {
var args = {
dt: dt,
inc: inc
},
result = this._cacheGet('before', args);
if (result === false) {
result = this._iter(new IterResult('before', args));
this._cacheAdd('before', result, args);
}
... | [
"function",
"(",
"dt",
",",
"inc",
")",
"{",
"var",
"args",
"=",
"{",
"dt",
":",
"dt",
",",
"inc",
":",
"inc",
"}",
",",
"result",
"=",
"this",
".",
"_cacheGet",
"(",
"'before'",
",",
"args",
")",
";",
"if",
"(",
"result",
"===",
"false",
")",
... | Returns the last recurrence before the given datetime instance.
The inc keyword defines what happens if dt is an occurrence.
With inc == True, if dt itself is an occurrence, it will be returned.
@return Date or null | [
"Returns",
"the",
"last",
"recurrence",
"before",
"the",
"given",
"datetime",
"instance",
".",
"The",
"inc",
"keyword",
"defines",
"what",
"happens",
"if",
"dt",
"is",
"an",
"occurrence",
".",
"With",
"inc",
"==",
"True",
"if",
"dt",
"itself",
"is",
"an",
... | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L22650-L22661 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(date) {
var tooEarly = this.minDate && date < this.minDate,
tooLate = this.maxDate && date > this.maxDate;
if (this.method == 'between') {
if (tooEarly)
return true;
if (tooLate)
return false;
} else if (this.method ==... | javascript | function(date) {
var tooEarly = this.minDate && date < this.minDate,
tooLate = this.maxDate && date > this.maxDate;
if (this.method == 'between') {
if (tooEarly)
return true;
if (tooLate)
return false;
} else if (this.method ==... | [
"function",
"(",
"date",
")",
"{",
"var",
"tooEarly",
"=",
"this",
".",
"minDate",
"&&",
"date",
"<",
"this",
".",
"minDate",
",",
"tooLate",
"=",
"this",
".",
"maxDate",
"&&",
"date",
">",
"this",
".",
"maxDate",
";",
"if",
"(",
"this",
".",
"meth... | Possibly adds a date into the result.
@param {Date} date - the date isn't necessarly added to the result
list (if it is too late/too early)
@return {Boolean} true if it makes sense to continue the iteration;
false if we're done. | [
"Possibly",
"adds",
"a",
"date",
"into",
"the",
"result",
"."
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L23588-L23609 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(method, args, iterator) {
var allowedMethods = ['all', 'between'];
if (!_.include(allowedMethods, method)) {
throw 'Invalid method "' + method
+ '". Only all and between works with iterator.'
}
this.add = function(date) {
if (iterator(date, this._result.length)) {
... | javascript | function(method, args, iterator) {
var allowedMethods = ['all', 'between'];
if (!_.include(allowedMethods, method)) {
throw 'Invalid method "' + method
+ '". Only all and between works with iterator.'
}
this.add = function(date) {
if (iterator(date, this._result.length)) {
... | [
"function",
"(",
"method",
",",
"args",
",",
"iterator",
")",
"{",
"var",
"allowedMethods",
"=",
"[",
"'all'",
",",
"'between'",
"]",
";",
"if",
"(",
"!",
"_",
".",
"include",
"(",
"allowedMethods",
",",
"method",
")",
")",
"{",
"throw",
"'Invalid meth... | IterResult subclass that calls a callback function on each add,
and stops iterating when the callback returns false. | [
"IterResult",
"subclass",
"that",
"calls",
"a",
"callback",
"function",
"on",
"each",
"add",
"and",
"stops",
"iterating",
"when",
"the",
"callback",
"returns",
"false",
"."
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L23646-L23663 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(channel, subscription, context, once) {
if (!channels[channel]) channels[channel] = [];
channels[channel].push({fn: subscription, context: context || this, once: once});
} | javascript | function(channel, subscription, context, once) {
if (!channels[channel]) channels[channel] = [];
channels[channel].push({fn: subscription, context: context || this, once: once});
} | [
"function",
"(",
"channel",
",",
"subscription",
",",
"context",
",",
"once",
")",
"{",
"if",
"(",
"!",
"channels",
"[",
"channel",
"]",
")",
"channels",
"[",
"channel",
"]",
"=",
"[",
"]",
";",
"channels",
"[",
"channel",
"]",
".",
"push",
"(",
"{... | Subscribe to a channel
@param channel | [
"Subscribe",
"to",
"a",
"channel"
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L29019-L29022 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(channel) {
if (!channels[channel]) return;
var args = [].slice.call(arguments, 1),
subscription;
for (var i = 0; i < channels[channel].length; i++) {
subscription = channels[channel][i];
subscription.fn.apply(subscription.context, args);
if (subscription.on... | javascript | function(channel) {
if (!channels[channel]) return;
var args = [].slice.call(arguments, 1),
subscription;
for (var i = 0; i < channels[channel].length; i++) {
subscription = channels[channel][i];
subscription.fn.apply(subscription.context, args);
if (subscription.on... | [
"function",
"(",
"channel",
")",
"{",
"if",
"(",
"!",
"channels",
"[",
"channel",
"]",
")",
"return",
";",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
",",
"subscription",
";",
"for",
"(",
"var",
"i",... | Trigger all callbacks for a channel
@param channel
@params N Extra parametter to pass to handler | [
"Trigger",
"all",
"callbacks",
"for",
"a",
"channel"
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L29030-L29044 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function (channel, subscription, context) {
Backbone.Mediator.subscribe(channel, subscription, context, true);
} | javascript | function (channel, subscription, context) {
Backbone.Mediator.subscribe(channel, subscription, context, true);
} | [
"function",
"(",
"channel",
",",
"subscription",
",",
"context",
")",
"{",
"Backbone",
".",
"Mediator",
".",
"subscribe",
"(",
"channel",
",",
"subscription",
",",
"context",
",",
"true",
")",
";",
"}"
] | Subscribing to one event only
@param channel
@param subscription
@param context | [
"Subscribing",
"to",
"one",
"event",
"only"
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L29074-L29076 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(subscriptions){
if (subscriptions) _.extend(this.subscriptions || {}, subscriptions);
subscriptions = subscriptions || this.subscriptions;
if (!subscriptions || _.isEmpty(subscriptions)) return;
// Just to be sure we don't set duplicate
this.unsetSubscriptions(subscriptions);
... | javascript | function(subscriptions){
if (subscriptions) _.extend(this.subscriptions || {}, subscriptions);
subscriptions = subscriptions || this.subscriptions;
if (!subscriptions || _.isEmpty(subscriptions)) return;
// Just to be sure we don't set duplicate
this.unsetSubscriptions(subscriptions);
... | [
"function",
"(",
"subscriptions",
")",
"{",
"if",
"(",
"subscriptions",
")",
"_",
".",
"extend",
"(",
"this",
".",
"subscriptions",
"||",
"{",
"}",
",",
"subscriptions",
")",
";",
"subscriptions",
"=",
"subscriptions",
"||",
"this",
".",
"subscriptions",
"... | Subscribe to each subscription
@param {Object} [subscriptions] An optional hash of subscription to add | [
"Subscribe",
"to",
"each",
"subscription"
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L29115-L29133 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | function(subscriptions){
subscriptions = subscriptions || this.subscriptions;
if (!subscriptions || _.isEmpty(subscriptions)) return;
_.each(subscriptions, function(subscription, channel){
if (_.isString(subscription)) {
subscription = this[subscription];
}
Backbone.M... | javascript | function(subscriptions){
subscriptions = subscriptions || this.subscriptions;
if (!subscriptions || _.isEmpty(subscriptions)) return;
_.each(subscriptions, function(subscription, channel){
if (_.isString(subscription)) {
subscription = this[subscription];
}
Backbone.M... | [
"function",
"(",
"subscriptions",
")",
"{",
"subscriptions",
"=",
"subscriptions",
"||",
"this",
".",
"subscriptions",
";",
"if",
"(",
"!",
"subscriptions",
"||",
"_",
".",
"isEmpty",
"(",
"subscriptions",
")",
")",
"return",
";",
"_",
".",
"each",
"(",
... | Unsubscribe to each subscription
@param {Object} [subscriptions] An optional hash of subscription to remove | [
"Unsubscribe",
"to",
"each",
"subscription"
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L29139-L29148 | train | |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | choosePluralForm | function choosePluralForm(text, locale, count){
var ret, texts, chosenText;
if (count != null && text) {
texts = text.split(delimeter);
chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
ret = trim(chosenText);
} else {
ret = text;
}
return ret;
} | javascript | function choosePluralForm(text, locale, count){
var ret, texts, chosenText;
if (count != null && text) {
texts = text.split(delimeter);
chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
ret = trim(chosenText);
} else {
ret = text;
}
return ret;
} | [
"function",
"choosePluralForm",
"(",
"text",
",",
"locale",
",",
"count",
")",
"{",
"var",
"ret",
",",
"texts",
",",
"chosenText",
";",
"if",
"(",
"count",
"!=",
"null",
"&&",
"text",
")",
"{",
"texts",
"=",
"text",
".",
"split",
"(",
"delimeter",
")... | Based on a phrase text that contains `n` plural forms separated by `delimeter`, a `locale`, and a `count`, choose the correct plural form, or none if `count` is `null`. | [
"Based",
"on",
"a",
"phrase",
"text",
"that",
"contains",
"n",
"plural",
"forms",
"separated",
"by",
"delimeter",
"a",
"locale",
"and",
"a",
"count",
"choose",
"the",
"correct",
"plural",
"form",
"or",
"none",
"if",
"count",
"is",
"null",
"."
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L31928-L31938 | train |
cozy/cozy-calendar | build/client/public/javascripts/vendor-d0a31592.js | encodeAsBinary | function encodeAsBinary(obj, callback) {
function writeEncoding(bloblessData) {
var deconstruction = binary.deconstructPacket(bloblessData);
var pack = encodeAsString(deconstruction.packet);
var buffers = deconstruction.buffers;
buffers.unshift(pack); // add packet info to beginning of data list
... | javascript | function encodeAsBinary(obj, callback) {
function writeEncoding(bloblessData) {
var deconstruction = binary.deconstructPacket(bloblessData);
var pack = encodeAsString(deconstruction.packet);
var buffers = deconstruction.buffers;
buffers.unshift(pack); // add packet info to beginning of data list
... | [
"function",
"encodeAsBinary",
"(",
"obj",
",",
"callback",
")",
"{",
"function",
"writeEncoding",
"(",
"bloblessData",
")",
"{",
"var",
"deconstruction",
"=",
"binary",
".",
"deconstructPacket",
"(",
"bloblessData",
")",
";",
"var",
"pack",
"=",
"encodeAsString"... | Encode packet as 'buffer sequence' by removing blobs, and
deconstructing packet into object with placeholders and
a list of buffers.
@param {Object} packet
@return {Buffer} encoded
@api private | [
"Encode",
"packet",
"as",
"buffer",
"sequence",
"by",
"removing",
"blobs",
"and",
"deconstructing",
"packet",
"into",
"object",
"with",
"placeholders",
"and",
"a",
"list",
"of",
"buffers",
"."
] | 786b1f6070cc3382db72dc473b45a8abf496fe16 | https://github.com/cozy/cozy-calendar/blob/786b1f6070cc3382db72dc473b45a8abf496fe16/build/client/public/javascripts/vendor-d0a31592.js#L38889-L38901 | train |
words/n-gram | index.js | nGram | function nGram(n) {
if (typeof n !== 'number' || isNaN(n) || n < 1 || n === Infinity) {
throw new Error('`' + n + '` is not a valid argument for n-gram')
}
return grams
// Create n-grams from a given value.
function grams(value) {
var nGrams = []
var index
if (value === null || value === un... | javascript | function nGram(n) {
if (typeof n !== 'number' || isNaN(n) || n < 1 || n === Infinity) {
throw new Error('`' + n + '` is not a valid argument for n-gram')
}
return grams
// Create n-grams from a given value.
function grams(value) {
var nGrams = []
var index
if (value === null || value === un... | [
"function",
"nGram",
"(",
"n",
")",
"{",
"if",
"(",
"typeof",
"n",
"!==",
"'number'",
"||",
"isNaN",
"(",
"n",
")",
"||",
"n",
"<",
"1",
"||",
"n",
"===",
"Infinity",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`'",
"+",
"n",
"+",
"'` is not a vali... | Factory returning a function that converts a value string to n-grams. | [
"Factory",
"returning",
"a",
"function",
"that",
"converts",
"a",
"value",
"string",
"to",
"n",
"-",
"grams",
"."
] | 006bfc965e118805ed6692854e854e925f75dcfc | https://github.com/words/n-gram/blob/006bfc965e118805ed6692854e854e925f75dcfc/index.js#L9-L38 | train |
words/n-gram | index.js | grams | function grams(value) {
var nGrams = []
var index
if (value === null || value === undefined) {
return nGrams
}
value = value.slice ? value : String(value)
index = value.length - n + 1
if (index < 1) {
return nGrams
}
while (index--) {
nGrams[index] = value.slice... | javascript | function grams(value) {
var nGrams = []
var index
if (value === null || value === undefined) {
return nGrams
}
value = value.slice ? value : String(value)
index = value.length - n + 1
if (index < 1) {
return nGrams
}
while (index--) {
nGrams[index] = value.slice... | [
"function",
"grams",
"(",
"value",
")",
"{",
"var",
"nGrams",
"=",
"[",
"]",
"var",
"index",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
")",
"{",
"return",
"nGrams",
"}",
"value",
"=",
"value",
".",
"slice",
"?",
"value",
... | Create n-grams from a given value. | [
"Create",
"n",
"-",
"grams",
"from",
"a",
"given",
"value",
"."
] | 006bfc965e118805ed6692854e854e925f75dcfc | https://github.com/words/n-gram/blob/006bfc965e118805ed6692854e854e925f75dcfc/index.js#L17-L37 | train |
briankircho/mongoose-schema-extend | Gruntfile.js | pathsort | function pathsort(paths, sep, algorithm) {
sep = sep || '/'
return paths.map(function(el) {
return el.split(sep)
}).sort(algorithm || levelSorter).map(function(el) {
return el.join(sep)
})
} | javascript | function pathsort(paths, sep, algorithm) {
sep = sep || '/'
return paths.map(function(el) {
return el.split(sep)
}).sort(algorithm || levelSorter).map(function(el) {
return el.join(sep)
})
} | [
"function",
"pathsort",
"(",
"paths",
",",
"sep",
",",
"algorithm",
")",
"{",
"sep",
"=",
"sep",
"||",
"'/'",
"return",
"paths",
".",
"map",
"(",
"function",
"(",
"el",
")",
"{",
"return",
"el",
".",
"split",
"(",
"sep",
")",
"}",
")",
".",
"sort... | Sort a list of paths | [
"Sort",
"a",
"list",
"of",
"paths"
] | de17899ff3c326ba6db3c35a91721e4751affc9c | https://github.com/briankircho/mongoose-schema-extend/blob/de17899ff3c326ba6db3c35a91721e4751affc9c/Gruntfile.js#L17-L25 | train |
briankircho/mongoose-schema-extend | Gruntfile.js | levelSorter | function levelSorter(a, b) {
var l = Math.max(a.length, b.length)
for (var i = 0; i < l; i += 1) {
if (!(i in a)) return +1
if (!(i in b)) return -1
if (a.length < b.length) return +1
if (a.length > b.length) return -1
}
} | javascript | function levelSorter(a, b) {
var l = Math.max(a.length, b.length)
for (var i = 0; i < l; i += 1) {
if (!(i in a)) return +1
if (!(i in b)) return -1
if (a.length < b.length) return +1
if (a.length > b.length) return -1
}
} | [
"function",
"levelSorter",
"(",
"a",
",",
"b",
")",
"{",
"var",
"l",
"=",
"Math",
".",
"max",
"(",
"a",
".",
"length",
",",
"b",
".",
"length",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"+=",
"1",
")",
"{",
"if"... | Level-order sort of a list of paths | [
"Level",
"-",
"order",
"sort",
"of",
"a",
"list",
"of",
"paths"
] | de17899ff3c326ba6db3c35a91721e4751affc9c | https://github.com/briankircho/mongoose-schema-extend/blob/de17899ff3c326ba6db3c35a91721e4751affc9c/Gruntfile.js#L30-L39 | train |
meteorhacks/npm | plugin/init_npm.js | canProceed | function canProceed() {
var unAcceptableCommands = {'test-packages': 1, 'publish': 1};
if(process.argv.length > 2) {
var command = process.argv[2];
if(unAcceptableCommands[command]) {
return false;
}
}
return true;
} | javascript | function canProceed() {
var unAcceptableCommands = {'test-packages': 1, 'publish': 1};
if(process.argv.length > 2) {
var command = process.argv[2];
if(unAcceptableCommands[command]) {
return false;
}
}
return true;
} | [
"function",
"canProceed",
"(",
")",
"{",
"var",
"unAcceptableCommands",
"=",
"{",
"'test-packages'",
":",
"1",
",",
"'publish'",
":",
"1",
"}",
";",
"if",
"(",
"process",
".",
"argv",
".",
"length",
">",
"2",
")",
"{",
"var",
"command",
"=",
"process",... | check whether is this `meteor test-packages` or not | [
"check",
"whether",
"is",
"this",
"meteor",
"test",
"-",
"packages",
"or",
"not"
] | 177465467a87d37ec283d127d877a1a5ce97f818 | https://github.com/meteorhacks/npm/blob/177465467a87d37ec283d127d877a1a5ce97f818/plugin/init_npm.js#L44-L54 | train |
meteorhacks/npm | plugin/init_npm.js | getContent | function getContent(func) {
var lines = func.toString().split('\n');
// Drop the function declaration and closing bracket
var onlyBody = lines.slice(1, lines.length -1);
// Drop line number comments generated by Meteor, trim whitespace, make string
onlyBody = _.map(onlyBody, function(line) {
return line.s... | javascript | function getContent(func) {
var lines = func.toString().split('\n');
// Drop the function declaration and closing bracket
var onlyBody = lines.slice(1, lines.length -1);
// Drop line number comments generated by Meteor, trim whitespace, make string
onlyBody = _.map(onlyBody, function(line) {
return line.s... | [
"function",
"getContent",
"(",
"func",
")",
"{",
"var",
"lines",
"=",
"func",
".",
"toString",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
";",
"// Drop the function declaration and closing bracket",
"var",
"onlyBody",
"=",
"lines",
".",
"slice",
"(",
"1",
",... | getContent inside a function | [
"getContent",
"inside",
"a",
"function"
] | 177465467a87d37ec283d127d877a1a5ce97f818 | https://github.com/meteorhacks/npm/blob/177465467a87d37ec283d127d877a1a5ce97f818/plugin/init_npm.js#L57-L67 | train |
meteorhacks/npm | plugin/init_npm.js | _indexJsContent | function _indexJsContent() {
Meteor.npmRequire = function(moduleName) {
var module = Npm.require(moduleName);
return module;
};
Meteor.require = function(moduleName) {
console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!');
return Meteor.npmRequire(moduleName);
};
} | javascript | function _indexJsContent() {
Meteor.npmRequire = function(moduleName) {
var module = Npm.require(moduleName);
return module;
};
Meteor.require = function(moduleName) {
console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!');
return Meteor.npmRequire(moduleName);
};
} | [
"function",
"_indexJsContent",
"(",
")",
"{",
"Meteor",
".",
"npmRequire",
"=",
"function",
"(",
"moduleName",
")",
"{",
"var",
"module",
"=",
"Npm",
".",
"require",
"(",
"moduleName",
")",
";",
"return",
"module",
";",
"}",
";",
"Meteor",
".",
"require"... | Following function has been defined to just get the content inside them They are not executables | [
"Following",
"function",
"has",
"been",
"defined",
"to",
"just",
"get",
"the",
"content",
"inside",
"them",
"They",
"are",
"not",
"executables"
] | 177465467a87d37ec283d127d877a1a5ce97f818 | https://github.com/meteorhacks/npm/blob/177465467a87d37ec283d127d877a1a5ce97f818/plugin/init_npm.js#L71-L81 | train |
IdentityModel/oidc-token-manager | sample/vs/Sample/oidc-token-manager.js | _rsapem_readPrivateKeyFromASN1HexString | function _rsapem_readPrivateKeyFromASN1HexString(keyHex) {
var a = _rsapem_getHexValueArrayOfChildrenFromHex(keyHex);
this.setPrivateEx(a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]);
} | javascript | function _rsapem_readPrivateKeyFromASN1HexString(keyHex) {
var a = _rsapem_getHexValueArrayOfChildrenFromHex(keyHex);
this.setPrivateEx(a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]);
} | [
"function",
"_rsapem_readPrivateKeyFromASN1HexString",
"(",
"keyHex",
")",
"{",
"var",
"a",
"=",
"_rsapem_getHexValueArrayOfChildrenFromHex",
"(",
"keyHex",
")",
";",
"this",
".",
"setPrivateEx",
"(",
"a",
"[",
"1",
"]",
",",
"a",
"[",
"2",
"]",
",",
"a",
"[... | read RSA private key from a ASN.1 hexadecimal string
@name readPrivateKeyFromASN1HexString
@memberOf RSAKey#
@function
@param {String} keyHex ASN.1 hexadecimal string of PKCS#1 private key.
@since 1.1.1 | [
"read",
"RSA",
"private",
"key",
"from",
"a",
"ASN",
".",
"1",
"hexadecimal",
"string"
] | 92998b8c3713975d98dc41cec4de2fff2c23e102 | https://github.com/IdentityModel/oidc-token-manager/blob/92998b8c3713975d98dc41cec4de2fff2c23e102/sample/vs/Sample/oidc-token-manager.js#L3455-L3458 | train |
IdentityModel/oidc-token-manager | sample/vs/Sample/oidc-token-manager.js | BAtos | function BAtos(a) {
var s = "";
for (var i = 0; i < a.length; i++) {
s = s + String.fromCharCode(a[i]);
}
return s;
} | javascript | function BAtos(a) {
var s = "";
for (var i = 0; i < a.length; i++) {
s = s + String.fromCharCode(a[i]);
}
return s;
} | [
"function",
"BAtos",
"(",
"a",
")",
"{",
"var",
"s",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
";",
"i",
"++",
")",
"{",
"s",
"=",
"s",
"+",
"String",
".",
"fromCharCode",
"(",
"a",
"[",
"i",
"... | convert an array of character codes to a string
@param {Array of Numbers} a array of character codes
@return {String} s | [
"convert",
"an",
"array",
"of",
"character",
"codes",
"to",
"a",
"string"
] | 92998b8c3713975d98dc41cec4de2fff2c23e102 | https://github.com/IdentityModel/oidc-token-manager/blob/92998b8c3713975d98dc41cec4de2fff2c23e102/sample/vs/Sample/oidc-token-manager.js#L5391-L5397 | train |
koajs/koa-hbs | index.js | merge | function merge (obj1, obj2) {
var c = {},
keys = Object.keys(obj2),
i;
for (i = 0; i !== keys.length; i++) {
c[keys[i]] = obj2[keys[i]];
}
keys = Object.keys(obj1);
for (i = 0; i !== keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
c[keys[i]] = obj1[keys[i]];
}
}
return c... | javascript | function merge (obj1, obj2) {
var c = {},
keys = Object.keys(obj2),
i;
for (i = 0; i !== keys.length; i++) {
c[keys[i]] = obj2[keys[i]];
}
keys = Object.keys(obj1);
for (i = 0; i !== keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
c[keys[i]] = obj1[keys[i]];
}
}
return c... | [
"function",
"merge",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"c",
"=",
"{",
"}",
",",
"keys",
"=",
"Object",
".",
"keys",
"(",
"obj2",
")",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"!==",
"keys",
".",
"length",
";",
"i",
"++",... | Shallow copy two objects into a new object
Objects are merged from left to right. Thus, properties in objects further
to the right are preferred over those on the left.
@param {object} obj1
@param {object} obj2
@returns {object}
@api private | [
"Shallow",
"copy",
"two",
"objects",
"into",
"a",
"new",
"object"
] | 7a505cb9d1030ecd059ba8dd98c6a3edff8376d4 | https://github.com/koajs/koa-hbs/blob/7a505cb9d1030ecd059ba8dd98c6a3edff8376d4/index.js#L23-L40 | train |
koajs/koa-hbs | index.js | Hbs | function Hbs () {
if (!(this instanceof Hbs)) {
return new Hbs();
}
this.handlebars = require('handlebars').create();
this.Utils = this.handlebars.Utils;
this.SafeString = this.handlebars.SafeString;
} | javascript | function Hbs () {
if (!(this instanceof Hbs)) {
return new Hbs();
}
this.handlebars = require('handlebars').create();
this.Utils = this.handlebars.Utils;
this.SafeString = this.handlebars.SafeString;
} | [
"function",
"Hbs",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Hbs",
")",
")",
"{",
"return",
"new",
"Hbs",
"(",
")",
";",
"}",
"this",
".",
"handlebars",
"=",
"require",
"(",
"'handlebars'",
")",
".",
"create",
"(",
")",
";",
"thi... | Create new instance of `Hbs`
@api public | [
"Create",
"new",
"instance",
"of",
"Hbs"
] | 7a505cb9d1030ecd059ba8dd98c6a3edff8376d4 | https://github.com/koajs/koa-hbs/blob/7a505cb9d1030ecd059ba8dd98c6a3edff8376d4/index.js#L100-L109 | train |
jonschlinkert/array-sort | index.js | arraySort | function arraySort(arr, props, opts) {
if (arr == null) {
return [];
}
if (!Array.isArray(arr)) {
throw new TypeError('array-sort expects an array.');
}
if (arguments.length === 1) {
return arr.sort();
}
var args = flatten([].slice.call(arguments, 1));
// if the last argument appears to ... | javascript | function arraySort(arr, props, opts) {
if (arr == null) {
return [];
}
if (!Array.isArray(arr)) {
throw new TypeError('array-sort expects an array.');
}
if (arguments.length === 1) {
return arr.sort();
}
var args = flatten([].slice.call(arguments, 1));
// if the last argument appears to ... | [
"function",
"arraySort",
"(",
"arr",
",",
"props",
",",
"opts",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"throw",
"new",
"TypeError",
"... | Sort an array of objects by one or more properties.
@param {Array} `arr` The Array to sort.
@param {String|Array|Function} `props` One or more object paths or comparison functions.
@param {Object} `opts` Pass `{ reverse: true }` to reverse the sort order.
@return {Array} Returns a sorted array.
@api public | [
"Sort",
"an",
"array",
"of",
"objects",
"by",
"one",
"or",
"more",
"properties",
"."
] | 055c178975547166c3c78602e6dc134d3dc450f5 | https://github.com/jonschlinkert/array-sort/blob/055c178975547166c3c78602e6dc134d3dc450f5/index.js#L24-L45 | train |
jonschlinkert/array-sort | index.js | sortBy | function sortBy(props, opts) {
opts = opts || {};
return function compareFn(a, b) {
var len = props.length, i = -1;
var result;
while (++i < len) {
result = compare(props[i], a, b);
if (result !== 0) {
break;
}
}
if (opts.reverse === true) {
return result * -1;
... | javascript | function sortBy(props, opts) {
opts = opts || {};
return function compareFn(a, b) {
var len = props.length, i = -1;
var result;
while (++i < len) {
result = compare(props[i], a, b);
if (result !== 0) {
break;
}
}
if (opts.reverse === true) {
return result * -1;
... | [
"function",
"sortBy",
"(",
"props",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"return",
"function",
"compareFn",
"(",
"a",
",",
"b",
")",
"{",
"var",
"len",
"=",
"props",
".",
"length",
",",
"i",
"=",
"-",
"1",
";",
"var"... | Iterate over each comparison property or function until `1` or `-1`
is returned.
@param {String|Array|Function} `props` One or more object paths or comparison functions.
@param {Object} `opts` Pass `{ reverse: true }` to reverse the sort order.
@return {Array} | [
"Iterate",
"over",
"each",
"comparison",
"property",
"or",
"function",
"until",
"1",
"or",
"-",
"1",
"is",
"returned",
"."
] | 055c178975547166c3c78602e6dc134d3dc450f5 | https://github.com/jonschlinkert/array-sort/blob/055c178975547166c3c78602e6dc134d3dc450f5/index.js#L56-L74 | train |
gruntjs/grunt-contrib-handlebars | tasks/handlebars.js | function(filepath) {
var pieces = _.last(filepath.split('/')).split('.');
var name = _(pieces).without(_.last(pieces)).join('.'); // strips file extension
if (name.charAt(0) === '_') {
name = name.substr(1, name.length); // strips leading _ character
}
return name;
} | javascript | function(filepath) {
var pieces = _.last(filepath.split('/')).split('.');
var name = _(pieces).without(_.last(pieces)).join('.'); // strips file extension
if (name.charAt(0) === '_') {
name = name.substr(1, name.length); // strips leading _ character
}
return name;
} | [
"function",
"(",
"filepath",
")",
"{",
"var",
"pieces",
"=",
"_",
".",
"last",
"(",
"filepath",
".",
"split",
"(",
"'/'",
")",
")",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"name",
"=",
"_",
"(",
"pieces",
")",
".",
"without",
"(",
"_",
".",
... | filename conversion for partials | [
"filename",
"conversion",
"for",
"partials"
] | 84e9d9e533cb600828998e93de30cf40e157a595 | https://github.com/gruntjs/grunt-contrib-handlebars/blob/84e9d9e533cb600828998e93de30cf40e157a595/tasks/handlebars.js#L26-L33 | train | |
indieisaconcept/grunt-styleguide | tasks/styleguide.js | function(/* Array */ files) {
var preprocessor;
if (_.isEmpty(files)) {
return preprocessor;
}
// collect all the possible extensions
// and remove duplicates
files = _.chai... | javascript | function(/* Array */ files) {
var preprocessor;
if (_.isEmpty(files)) {
return preprocessor;
}
// collect all the possible extensions
// and remove duplicates
files = _.chai... | [
"function",
"(",
"/* Array */",
"files",
")",
"{",
"var",
"preprocessor",
";",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"files",
")",
")",
"{",
"return",
"preprocessor",
";",
"}",
"// collect all the possible extensions",
"// and remove duplicates",
"files",
"=",
"_... | processor Determine the CSS processor to use based on an array of files | [
"processor",
"Determine",
"the",
"CSS",
"processor",
"to",
"use",
"based",
"on",
"an",
"array",
"of",
"files"
] | 0447f9e099eade810b61f71ad057d7ce79774095 | https://github.com/indieisaconcept/grunt-styleguide/blob/0447f9e099eade810b61f71ad057d7ce79774095/tasks/styleguide.js#L109-L142 | train | |
luciotato/waitfor | waitfor.js | function(err,data){
if (fiber.callbackAlreadyCalled)
throw new Error("Callback for function "+fnName+" called twice. Wait.for already resumed the execution.");
fiber.callbackAlreadyCalled = true;
fiber.e... | javascript | function(err,data){
if (fiber.callbackAlreadyCalled)
throw new Error("Callback for function "+fnName+" called twice. Wait.for already resumed the execution.");
fiber.callbackAlreadyCalled = true;
fiber.e... | [
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"fiber",
".",
"callbackAlreadyCalled",
")",
"throw",
"new",
"Error",
"(",
"\"Callback for function \"",
"+",
"fnName",
"+",
"\" called twice. Wait.for already resumed the execution.\"",
")",
";",
"fiber",
"."... | create a closure to resume on callback | [
"create",
"a",
"closure",
"to",
"resume",
"on",
"callback"
] | 4a5e155084dab3dbdbc42ed585b16c0600d20f3e | https://github.com/luciotato/waitfor/blob/4a5e155084dab3dbdbc42ed585b16c0600d20f3e/waitfor.js#L26-L40 | train | |
luciotato/waitfor | examples/waitfor-demo.js | handler | function handler(req,res){
try{
res.writeHead(200, {'Content-Type': 'text/html'});
var start = new Date().getTime();
//console.log(start);
//read css, wait.for syntax:
var css = wait.for(fs.readFile,'style.css','utf8');
//read post, fancy syntax:
var content = wait.for(... | javascript | function handler(req,res){
try{
res.writeHead(200, {'Content-Type': 'text/html'});
var start = new Date().getTime();
//console.log(start);
//read css, wait.for syntax:
var css = wait.for(fs.readFile,'style.css','utf8');
//read post, fancy syntax:
var content = wait.for(... | [
"function",
"handler",
"(",
"req",
",",
"res",
")",
"{",
"try",
"{",
"res",
".",
"writeHead",
"(",
"200",
",",
"{",
"'Content-Type'",
":",
"'text/html'",
"}",
")",
";",
"var",
"start",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
... | handle request in a fiber | [
"handle",
"request",
"in",
"a",
"fiber"
] | 4a5e155084dab3dbdbc42ed585b16c0600d20f3e | https://github.com/luciotato/waitfor/blob/4a5e155084dab3dbdbc42ed585b16c0600d20f3e/examples/waitfor-demo.js#L40-L73 | train |
Mangopay/mangopay2-nodejs-sdk | lib/api.js | function(callback, options, params) {
var options = options || ((_.isObject(callback) && !_.isFunction(callback)) ? callback : {});
if (params) {
options = _.extend({}, options, params);
}
return options
} | javascript | function(callback, options, params) {
var options = options || ((_.isObject(callback) && !_.isFunction(callback)) ? callback : {});
if (params) {
options = _.extend({}, options, params);
}
return options
} | [
"function",
"(",
"callback",
",",
"options",
",",
"params",
")",
"{",
"var",
"options",
"=",
"options",
"||",
"(",
"(",
"_",
".",
"isObject",
"(",
"callback",
")",
"&&",
"!",
"_",
".",
"isFunction",
"(",
"callback",
")",
")",
"?",
"callback",
":",
... | Checks if callback is a function or not, and passes the options
@param {Object, Function} callback
@param {Object} options
@param {Object} params Additional params that extend options | [
"Checks",
"if",
"callback",
"is",
"a",
"function",
"or",
"not",
"and",
"passes",
"the",
"options"
] | 73c0699835877b3d2851c1fcd8fefb6a457b6e06 | https://github.com/Mangopay/mangopay2-nodejs-sdk/blob/73c0699835877b3d2851c1fcd8fefb6a457b6e06/lib/api.js#L80-L87 | train | |
Mangopay/mangopay2-nodejs-sdk | lib/api.js | function(method, callback, options) {
options = this._getOptions(callback, options);
if (this.config.debugMode) {
this.config.logClass(method, options);
}
/**
* If data has parse method, call it before passing data
*/
if (options.data && options.da... | javascript | function(method, callback, options) {
options = this._getOptions(callback, options);
if (this.config.debugMode) {
this.config.logClass(method, options);
}
/**
* If data has parse method, call it before passing data
*/
if (options.data && options.da... | [
"function",
"(",
"method",
",",
"callback",
",",
"options",
")",
"{",
"options",
"=",
"this",
".",
"_getOptions",
"(",
"callback",
",",
"options",
")",
";",
"if",
"(",
"this",
".",
"config",
".",
"debugMode",
")",
"{",
"this",
".",
"config",
".",
"lo... | Main API resource request method
@param {string} method Mangopay API method to be called
@param {function} callback Callback function
@param {object} options Hash of configuration to be passed to request
@returns {object} request promise | [
"Main",
"API",
"resource",
"request",
"method"
] | 73c0699835877b3d2851c1fcd8fefb6a457b6e06 | https://github.com/Mangopay/mangopay2-nodejs-sdk/blob/73c0699835877b3d2851c1fcd8fefb6a457b6e06/lib/api.js#L96-L153 | train | |
Mangopay/mangopay2-nodejs-sdk | lib/api.js | function(callback) {
var self = this;
var auth_post_data = querystring.stringify({
'grant_type': 'client_credentials'
});
return new Promise(function(resolve, reject){
self.client.methods.authentication_oauth(_.extend({}, self.requestOptions, {
d... | javascript | function(callback) {
var self = this;
var auth_post_data = querystring.stringify({
'grant_type': 'client_credentials'
});
return new Promise(function(resolve, reject){
self.client.methods.authentication_oauth(_.extend({}, self.requestOptions, {
d... | [
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"auth_post_data",
"=",
"querystring",
".",
"stringify",
"(",
"{",
"'grant_type'",
":",
"'client_credentials'",
"}",
")",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"... | OAuth2 authorization mechanism. After authorization request, calls the callback with returned authorization data
@param {function} callback
@returns {object} request promise | [
"OAuth2",
"authorization",
"mechanism",
".",
"After",
"authorization",
"request",
"calls",
"the",
"callback",
"with",
"returned",
"authorization",
"data"
] | 73c0699835877b3d2851c1fcd8fefb6a457b6e06 | https://github.com/Mangopay/mangopay2-nodejs-sdk/blob/73c0699835877b3d2851c1fcd8fefb6a457b6e06/lib/api.js#L262-L294 | train | |
Mangopay/mangopay2-nodejs-sdk | lib/api.js | function() {
var self = this;
// Read all files from ./services and add them to this object
// ex: services/User.js becomes mangopay.Users
var servicesRoot = path.join(__dirname, 'services');
fs.readdirSync(servicesRoot).forEach(function (file) {
var serviceName = fil... | javascript | function() {
var self = this;
// Read all files from ./services and add them to this object
// ex: services/User.js becomes mangopay.Users
var servicesRoot = path.join(__dirname, 'services');
fs.readdirSync(servicesRoot).forEach(function (file) {
var serviceName = fil... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Read all files from ./services and add them to this object",
"// ex: services/User.js becomes mangopay.Users",
"var",
"servicesRoot",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'services'",
")",
";",
... | Populates the SDK object with the services | [
"Populates",
"the",
"SDK",
"object",
"with",
"the",
"services"
] | 73c0699835877b3d2851c1fcd8fefb6a457b6e06 | https://github.com/Mangopay/mangopay2-nodejs-sdk/blob/73c0699835877b3d2851c1fcd8fefb6a457b6e06/lib/api.js#L305-L325 | train | |
36node/sketch | packages/cli/config-overrides.js | mockServer | function mockServer(app) {
const jsonRouter = jsonServer.router(db);
const shouldMockReq = req => {
return (
req.method !== "GET" ||
(req.headers.accept &&
req.headers.accept.indexOf("application/json") !== -1)
);
};
if (serverO... | javascript | function mockServer(app) {
const jsonRouter = jsonServer.router(db);
const shouldMockReq = req => {
return (
req.method !== "GET" ||
(req.headers.accept &&
req.headers.accept.indexOf("application/json") !== -1)
);
};
if (serverO... | [
"function",
"mockServer",
"(",
"app",
")",
"{",
"const",
"jsonRouter",
"=",
"jsonServer",
".",
"router",
"(",
"db",
")",
";",
"const",
"shouldMockReq",
"=",
"req",
"=>",
"{",
"return",
"(",
"req",
".",
"method",
"!==",
"\"GET\"",
"||",
"(",
"req",
".",... | mock server hoc
@param {Express.Application} app | [
"mock",
"server",
"hoc"
] | a4e96c4f2f1fe524357afcd31a555e0da5ee17a9 | https://github.com/36node/sketch/blob/a4e96c4f2f1fe524357afcd31a555e0da5ee17a9/packages/cli/config-overrides.js#L101-L146 | train |
36node/sketch | packages/fastman/bin/fastman-import.js | importing | async function importing(file) {
await helpers.checkApiKey();
if (typeof file === "undefined") {
stderr("collection file not given!");
process.exit(1);
}
const collection = jsonfile.readFileSync(file);
const collections = await apis.listCollections();
const { info = {} } = collection;
const foun... | javascript | async function importing(file) {
await helpers.checkApiKey();
if (typeof file === "undefined") {
stderr("collection file not given!");
process.exit(1);
}
const collection = jsonfile.readFileSync(file);
const collections = await apis.listCollections();
const { info = {} } = collection;
const foun... | [
"async",
"function",
"importing",
"(",
"file",
")",
"{",
"await",
"helpers",
".",
"checkApiKey",
"(",
")",
";",
"if",
"(",
"typeof",
"file",
"===",
"\"undefined\"",
")",
"{",
"stderr",
"(",
"\"collection file not given!\"",
")",
";",
"process",
".",
"exit",
... | import collection file
@param {string} file collection file path | [
"import",
"collection",
"file"
] | a4e96c4f2f1fe524357afcd31a555e0da5ee17a9 | https://github.com/36node/sketch/blob/a4e96c4f2f1fe524357afcd31a555e0da5ee17a9/packages/fastman/bin/fastman-import.js#L16-L36 | train |
z-hao-wang/react-native-rsa | lib/rsa.js | RSAGetPublicString | function RSAGetPublicString() {
var exportObj = {n: this.n.toString(16), e: this.e.toString(16)};
if (exportObj.n.length % 2 == 1) {
exportObj.n = '0' + exportObj.n; // pad them with 0
}
return JSON.stringify(exportObj);
} | javascript | function RSAGetPublicString() {
var exportObj = {n: this.n.toString(16), e: this.e.toString(16)};
if (exportObj.n.length % 2 == 1) {
exportObj.n = '0' + exportObj.n; // pad them with 0
}
return JSON.stringify(exportObj);
} | [
"function",
"RSAGetPublicString",
"(",
")",
"{",
"var",
"exportObj",
"=",
"{",
"n",
":",
"this",
".",
"n",
".",
"toString",
"(",
"16",
")",
",",
"e",
":",
"this",
".",
"e",
".",
"toString",
"(",
"16",
")",
"}",
";",
"if",
"(",
"exportObj",
".",
... | return modulus and public exponent as string | [
"return",
"modulus",
"and",
"public",
"exponent",
"as",
"string"
] | 112ecd2e78006221c579d4949d670adad3189fa5 | https://github.com/z-hao-wang/react-native-rsa/blob/112ecd2e78006221c579d4949d670adad3189fa5/lib/rsa.js#L77-L83 | train |
z-hao-wang/react-native-rsa | lib/rsa.js | RSASetPrivate | function RSASetPrivate(N,E,D) {
if(N != null && E != null && N.length > 0 && E.length > 0) {
this.n = parseBigInt(N,16);
this.e = parseInt(E,16);
this.d = parseBigInt(D,16);
}
else
console.log("Invalid RSA private key");
} | javascript | function RSASetPrivate(N,E,D) {
if(N != null && E != null && N.length > 0 && E.length > 0) {
this.n = parseBigInt(N,16);
this.e = parseInt(E,16);
this.d = parseBigInt(D,16);
}
else
console.log("Invalid RSA private key");
} | [
"function",
"RSASetPrivate",
"(",
"N",
",",
"E",
",",
"D",
")",
"{",
"if",
"(",
"N",
"!=",
"null",
"&&",
"E",
"!=",
"null",
"&&",
"N",
".",
"length",
">",
"0",
"&&",
"E",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"n",
"=",
"parseBigInt"... | Set the private key fields N, e, and d from hex strings | [
"Set",
"the",
"private",
"key",
"fields",
"N",
"e",
"and",
"d",
"from",
"hex",
"strings"
] | 112ecd2e78006221c579d4949d670adad3189fa5 | https://github.com/z-hao-wang/react-native-rsa/blob/112ecd2e78006221c579d4949d670adad3189fa5/lib/rsa.js#L194-L202 | train |
jpravetz/node-datatable | lib/builder.js | buildLimitPartial | function buildLimitPartial(requestQuery) {
var sLimit = "";
if (requestQuery && requestQuery.start !== undefined && self.dbType !== 'oracle') {
var start = parseInt(requestQuery.start, 10);
if (start >= 0) {
var len = parseInt(requestQuery.length, 10);
... | javascript | function buildLimitPartial(requestQuery) {
var sLimit = "";
if (requestQuery && requestQuery.start !== undefined && self.dbType !== 'oracle') {
var start = parseInt(requestQuery.start, 10);
if (start >= 0) {
var len = parseInt(requestQuery.length, 10);
... | [
"function",
"buildLimitPartial",
"(",
"requestQuery",
")",
"{",
"var",
"sLimit",
"=",
"\"\"",
";",
"if",
"(",
"requestQuery",
"&&",
"requestQuery",
".",
"start",
"!==",
"undefined",
"&&",
"self",
".",
"dbType",
"!==",
"'oracle'",
")",
"{",
"var",
"start",
... | Build a LIMIT clause
@param requestQuery The Datatable query string (we look at length and start)
@return {String} The LIMIT clause | [
"Build",
"a",
"LIMIT",
"clause"
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L234-L245 | train |
jpravetz/node-datatable | lib/builder.js | buildSelectPartial | function buildSelectPartial() {
var query = "SELECT ";
query += self.sSelectSql ? self.sSelectSql : "*";
query += " FROM ";
query += self.sFromSql ? self.sFromSql : self.sTableName;
return query;
} | javascript | function buildSelectPartial() {
var query = "SELECT ";
query += self.sSelectSql ? self.sSelectSql : "*";
query += " FROM ";
query += self.sFromSql ? self.sFromSql : self.sTableName;
return query;
} | [
"function",
"buildSelectPartial",
"(",
")",
"{",
"var",
"query",
"=",
"\"SELECT \"",
";",
"query",
"+=",
"self",
".",
"sSelectSql",
"?",
"self",
".",
"sSelectSql",
":",
"\"*\"",
";",
"query",
"+=",
"\" FROM \"",
";",
"query",
"+=",
"self",
".",
"sFromSql",... | Build the base SELECT statement.
@return {String} The SELECT partial | [
"Build",
"the",
"base",
"SELECT",
"statement",
"."
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L251-L257 | train |
jpravetz/node-datatable | lib/builder.js | buildQuery | function buildQuery(requestQuery) {
var queries = {};
if (typeof requestQuery !== 'object')
return queries;
var searchString = sanitize(_u.isObject(requestQuery.search) ? requestQuery.search.value : '');
self.oRequestQuery = requestQuery;
var useStmt = buildSetDatabas... | javascript | function buildQuery(requestQuery) {
var queries = {};
if (typeof requestQuery !== 'object')
return queries;
var searchString = sanitize(_u.isObject(requestQuery.search) ? requestQuery.search.value : '');
self.oRequestQuery = requestQuery;
var useStmt = buildSetDatabas... | [
"function",
"buildQuery",
"(",
"requestQuery",
")",
"{",
"var",
"queries",
"=",
"{",
"}",
";",
"if",
"(",
"typeof",
"requestQuery",
"!==",
"'object'",
")",
"return",
"queries",
";",
"var",
"searchString",
"=",
"sanitize",
"(",
"_u",
".",
"isObject",
"(",
... | Build an array of query strings based on the Datatable parameters
@param requestQuery The datatable parameters that are generated by the client
@return {Object} An array of query strings, each including a terminating semicolon. | [
"Build",
"an",
"array",
"of",
"query",
"strings",
"based",
"on",
"the",
"Datatable",
"parameters"
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L264-L293 | train |
jpravetz/node-datatable | lib/builder.js | parseResponse | function parseResponse(queryResult) {
var oQuery = self.oRequestQuery;
var result = { recordsFiltered: 0, recordsTotal: 0 };
if (oQuery && typeof oQuery.draw === 'string') {
// Cast for security reasons, as per http://datatables.net/usage/server-side
result.draw = parseIn... | javascript | function parseResponse(queryResult) {
var oQuery = self.oRequestQuery;
var result = { recordsFiltered: 0, recordsTotal: 0 };
if (oQuery && typeof oQuery.draw === 'string') {
// Cast for security reasons, as per http://datatables.net/usage/server-side
result.draw = parseIn... | [
"function",
"parseResponse",
"(",
"queryResult",
")",
"{",
"var",
"oQuery",
"=",
"self",
".",
"oRequestQuery",
";",
"var",
"result",
"=",
"{",
"recordsFiltered",
":",
"0",
",",
"recordsTotal",
":",
"0",
"}",
";",
"if",
"(",
"oQuery",
"&&",
"typeof",
"oQu... | Parse the responses from the database and build a Datatable response object.
@param queryResult An array of SQL response objects, each of which must, in order, correspond with a query string
returned by buildQuery.
@return {Object} A Datatable reply that is suitable for sending in a response to the client. | [
"Parse",
"the",
"responses",
"from",
"the",
"database",
"and",
"build",
"a",
"Datatable",
"response",
"object",
"."
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L301-L318 | train |
jpravetz/node-datatable | lib/builder.js | filteredResult | function filteredResult(obj, count) {
if (obj) {
var result = _u.omit(obj, self.sAjaxDataProp );
result.aaLength = obj[self.sAjaxDataProp] ? obj[self.sAjaxDataProp].length : 0;
result[self.sAjaxDataProp] = [];
var count = count ? Math.min(count, result.aaLength) :... | javascript | function filteredResult(obj, count) {
if (obj) {
var result = _u.omit(obj, self.sAjaxDataProp );
result.aaLength = obj[self.sAjaxDataProp] ? obj[self.sAjaxDataProp].length : 0;
result[self.sAjaxDataProp] = [];
var count = count ? Math.min(count, result.aaLength) :... | [
"function",
"filteredResult",
"(",
"obj",
",",
"count",
")",
"{",
"if",
"(",
"obj",
")",
"{",
"var",
"result",
"=",
"_u",
".",
"omit",
"(",
"obj",
",",
"self",
".",
"sAjaxDataProp",
")",
";",
"result",
".",
"aaLength",
"=",
"obj",
"[",
"self",
".",... | Debug, reduced size object for display
@param obj
@return {*} | [
"Debug",
"reduced",
"size",
"object",
"for",
"display"
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L340-L352 | train |
jpravetz/node-datatable | lib/builder.js | sanitize | function sanitize(str, len) {
len = len || 256;
if (!str || typeof str === 'string' && str.length < 1)
return str;
if (typeof str !== 'string' || str.length > len)
return null;
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case "\... | javascript | function sanitize(str, len) {
len = len || 256;
if (!str || typeof str === 'string' && str.length < 1)
return str;
if (typeof str !== 'string' || str.length > len)
return null;
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case "\... | [
"function",
"sanitize",
"(",
"str",
",",
"len",
")",
"{",
"len",
"=",
"len",
"||",
"256",
";",
"if",
"(",
"!",
"str",
"||",
"typeof",
"str",
"===",
"'string'",
"&&",
"str",
".",
"length",
"<",
"1",
")",
"return",
"str",
";",
"if",
"(",
"typeof",
... | Sanitize to prevent SQL injections.
@param str
@return {*} | [
"Sanitize",
"to",
"prevent",
"SQL",
"injections",
"."
] | 6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5 | https://github.com/jpravetz/node-datatable/blob/6166ed2bc50f1bcd8e6f2b170a58fc5e75e78bd5/lib/builder.js#L362-L390 | 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.