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
ember-cli/eslint-plugin-ember
lib/utils/ember.js
getEmberImportAliasName
function getEmberImportAliasName(importDeclaration) { if (!importDeclaration.source) return null; if (importDeclaration.source.value !== 'ember') return null; return importDeclaration.specifiers[0].local.name; }
javascript
function getEmberImportAliasName(importDeclaration) { if (!importDeclaration.source) return null; if (importDeclaration.source.value !== 'ember') return null; return importDeclaration.specifiers[0].local.name; }
[ "function", "getEmberImportAliasName", "(", "importDeclaration", ")", "{", "if", "(", "!", "importDeclaration", ".", "source", ")", "return", "null", ";", "if", "(", "importDeclaration", ".", "source", ".", "value", "!==", "'ember'", ")", "return", "null", ";"...
Get alias name of default ember import. @param {ImportDeclaration} importDeclaration node to parse @return {String} import name
[ "Get", "alias", "name", "of", "default", "ember", "import", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/utils/ember.js#L317-L321
train
ember-cli/eslint-plugin-ember
lib/utils/ember.js
hasDuplicateDependentKeys
function hasDuplicateDependentKeys(callExp) { if (!isComputedProp(callExp)) return false; const dependentKeys = parseDependentKeys(callExp); const uniqueKeys = dependentKeys .filter((val, index, self) => self.indexOf(val) === index); return uniqueKeys.length !== dependentKeys.length; }
javascript
function hasDuplicateDependentKeys(callExp) { if (!isComputedProp(callExp)) return false; const dependentKeys = parseDependentKeys(callExp); const uniqueKeys = dependentKeys .filter((val, index, self) => self.indexOf(val) === index); return uniqueKeys.length !== dependentKeys.length; }
[ "function", "hasDuplicateDependentKeys", "(", "callExp", ")", "{", "if", "(", "!", "isComputedProp", "(", "callExp", ")", ")", "return", "false", ";", "const", "dependentKeys", "=", "parseDependentKeys", "(", "callExp", ")", ";", "const", "uniqueKeys", "=", "d...
Checks whether a computed property has duplicate dependent keys. @param {CallExpression} callExp Given call expression @return {Boolean} Flag whether dependent keys present.
[ "Checks", "whether", "a", "computed", "property", "has", "duplicate", "dependent", "keys", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/utils/ember.js#L368-L376
train
ember-cli/eslint-plugin-ember
lib/utils/ember.js
parseDependentKeys
function parseDependentKeys(callExp) { // Check whether we have a MemberExpression, eg. computed(...).volatile() const isMemberExpCallExp = !callExp.arguments.length && utils.isMemberExpression(callExp.callee) && utils.isCallExpression(callExp.callee.object); const args = isMemberExpCallExp ? callExp.cal...
javascript
function parseDependentKeys(callExp) { // Check whether we have a MemberExpression, eg. computed(...).volatile() const isMemberExpCallExp = !callExp.arguments.length && utils.isMemberExpression(callExp.callee) && utils.isCallExpression(callExp.callee.object); const args = isMemberExpCallExp ? callExp.cal...
[ "function", "parseDependentKeys", "(", "callExp", ")", "{", "// Check whether we have a MemberExpression, eg. computed(...).volatile()", "const", "isMemberExpCallExp", "=", "!", "callExp", ".", "arguments", ".", "length", "&&", "utils", ".", "isMemberExpression", "(", "call...
Parses dependent keys from call expression and returns them in an array. It also unwraps the expressions, so that `model.{foo,bar}` becomes `model.foo, model.bar`. @param {CallExpression} callExp CallExpression to examine @return {String[]} Array of unwrapped dependent keys
[ "Parses", "dependent", "keys", "from", "call", "expression", "and", "returns", "them", "in", "an", "array", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/utils/ember.js#L386-L399
train
ember-cli/eslint-plugin-ember
lib/utils/ember.js
unwrapBraceExpressions
function unwrapBraceExpressions(dependentKeys) { const braceExpressionRegexp = /{.+}/g; const unwrappedExpressions = dependentKeys.map((key) => { if (typeof key !== 'string' || !braceExpressionRegexp.test(key)) return key; const braceExpansionPart = key.match(braceExpressionRegexp)[0]; const prefix = ...
javascript
function unwrapBraceExpressions(dependentKeys) { const braceExpressionRegexp = /{.+}/g; const unwrappedExpressions = dependentKeys.map((key) => { if (typeof key !== 'string' || !braceExpressionRegexp.test(key)) return key; const braceExpansionPart = key.match(braceExpressionRegexp)[0]; const prefix = ...
[ "function", "unwrapBraceExpressions", "(", "dependentKeys", ")", "{", "const", "braceExpressionRegexp", "=", "/", "{.+}", "/", "g", ";", "const", "unwrappedExpressions", "=", "dependentKeys", ".", "map", "(", "(", "key", ")", "=>", "{", "if", "(", "typeof", ...
Unwraps brace expressions. @param {String[]} dependentKeys array of strings containing unprocessed dependent keys. @return {String[]} Array of unwrapped dependent keys
[ "Unwraps", "brace", "expressions", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/utils/ember.js#L407-L425
train
ember-cli/eslint-plugin-ember
lib/rules/require-super-in-init.js
findStmtNodes
function findStmtNodes(nodeBody) { const nodes = []; const fnExpressions = utils.findNodes(nodeBody, 'ExpressionStatement'); const returnStatement = utils.findNodes(nodeBody, 'ReturnStatement'); if (fnExpressions.length !== 0) { fnExpressions.forEach((item) => { nodes.push(item); }); } if (r...
javascript
function findStmtNodes(nodeBody) { const nodes = []; const fnExpressions = utils.findNodes(nodeBody, 'ExpressionStatement'); const returnStatement = utils.findNodes(nodeBody, 'ReturnStatement'); if (fnExpressions.length !== 0) { fnExpressions.forEach((item) => { nodes.push(item); }); } if (r...
[ "function", "findStmtNodes", "(", "nodeBody", ")", "{", "const", "nodes", "=", "[", "]", ";", "const", "fnExpressions", "=", "utils", ".", "findNodes", "(", "nodeBody", ",", "'ExpressionStatement'", ")", ";", "const", "returnStatement", "=", "utils", ".", "f...
Locates nodes with either an ExpressionStatement or ReturnStatement given name. @param {Node[]} nodeBody Array of nodes. @returns {Node[]} Array of nodes with given names.
[ "Locates", "nodes", "with", "either", "an", "ExpressionStatement", "or", "ReturnStatement", "given", "name", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/rules/require-super-in-init.js#L12-L30
train
ember-cli/eslint-plugin-ember
lib/rules/require-super-in-init.js
checkForSuper
function checkForSuper(nodes) { if (nodes.length === 0) return false; return nodes.some((n) => { if (utils.isCallExpression(n.expression)) { const fnCallee = n.expression.callee; return utils.isMemberExpression(fnCallee) && utils.isThisExpression(fnCallee.object) && utils.isIdentifi...
javascript
function checkForSuper(nodes) { if (nodes.length === 0) return false; return nodes.some((n) => { if (utils.isCallExpression(n.expression)) { const fnCallee = n.expression.callee; return utils.isMemberExpression(fnCallee) && utils.isThisExpression(fnCallee.object) && utils.isIdentifi...
[ "function", "checkForSuper", "(", "nodes", ")", "{", "if", "(", "nodes", ".", "length", "===", "0", ")", "return", "false", ";", "return", "nodes", ".", "some", "(", "(", "n", ")", "=>", "{", "if", "(", "utils", ".", "isCallExpression", "(", "n", "...
Checks whether a node has the '_super' property. @param {Node[]} nodes An array of nodes. @returns {Boolean}
[ "Checks", "whether", "a", "node", "has", "the", "_super", "property", "." ]
cce30db8d4c8fd0f27fa26411bfdc57864015231
https://github.com/ember-cli/eslint-plugin-ember/blob/cce30db8d4c8fd0f27fa26411bfdc57864015231/lib/rules/require-super-in-init.js#L37-L56
train
wojtkowiak/meteor-desktop
plugins/watcher/watcher.js
saveNewVersion
function saveNewVersion(version, versionFile) { fs.writeFileSync(versionFile, JSON.stringify({ version }, null, 2), 'UTF-8'); }
javascript
function saveNewVersion(version, versionFile) { fs.writeFileSync(versionFile, JSON.stringify({ version }, null, 2), 'UTF-8'); }
[ "function", "saveNewVersion", "(", "version", ",", "versionFile", ")", "{", "fs", ".", "writeFileSync", "(", "versionFile", ",", "JSON", ".", "stringify", "(", "{", "version", "}", ",", "null", ",", "2", ")", ",", "'UTF-8'", ")", ";", "}" ]
Saves version hash to the version file. @param {string} version @param {string} versionFile
[ "Saves", "version", "hash", "to", "the", "version", "file", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/plugins/watcher/watcher.js#L78-L82
train
wojtkowiak/meteor-desktop
plugins/watcher/watcher.js
getSettings
function getSettings(desktopPath) { let settings = {}; try { settings = JSON.parse( fs.readFileSync(path.join(desktopPath, 'settings.json'), 'UTF-8') ); } catch (e) { return {}; } return settings; }
javascript
function getSettings(desktopPath) { let settings = {}; try { settings = JSON.parse( fs.readFileSync(path.join(desktopPath, 'settings.json'), 'UTF-8') ); } catch (e) { return {}; } return settings; }
[ "function", "getSettings", "(", "desktopPath", ")", "{", "let", "settings", "=", "{", "}", ";", "try", "{", "settings", "=", "JSON", ".", "parse", "(", "fs", ".", "readFileSync", "(", "path", ".", "join", "(", "desktopPath", ",", "'settings.json'", ")", ...
Tries to read a settings.json file from desktop dir. @param {string} desktopPath - Path to the desktop dir. @returns {Object}
[ "Tries", "to", "read", "a", "settings", ".", "json", "file", "from", "desktop", "dir", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/plugins/watcher/watcher.js#L90-L100
train
wojtkowiak/meteor-desktop
plugins/watcher/watcher.js
getFileList
function getFileList(dir, sort = true) { return new Promise((resolve, reject) => { readdir(dir, (error, files) => { if (error) { reject(error); return; } let resultantFilesList; if (sort) { const stripLength = (...
javascript
function getFileList(dir, sort = true) { return new Promise((resolve, reject) => { readdir(dir, (error, files) => { if (error) { reject(error); return; } let resultantFilesList; if (sort) { const stripLength = (...
[ "function", "getFileList", "(", "dir", ",", "sort", "=", "true", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "readdir", "(", "dir", ",", "(", "error", ",", "files", ")", "=>", "{", "if", "(", "error", ...
Returns a file list from a directory. @param {string} dir - dir path @returns {Promise<Array>}
[ "Returns", "a", "file", "list", "from", "a", "directory", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/plugins/watcher/watcher.js#L107-L136
train
wojtkowiak/meteor-desktop
plugins/watcher/watcher.js
readAndHashFiles
function readAndHashFiles(files) { const fileHashes = {}; const fileContents = {}; const promises = []; function readSingleFile(file) { return new Promise((resolve, reject) => { fs.readFile(file, (err, data) => { if (err) { console.log(err); ...
javascript
function readAndHashFiles(files) { const fileHashes = {}; const fileContents = {}; const promises = []; function readSingleFile(file) { return new Promise((resolve, reject) => { fs.readFile(file, (err, data) => { if (err) { console.log(err); ...
[ "function", "readAndHashFiles", "(", "files", ")", "{", "const", "fileHashes", "=", "{", "}", ";", "const", "fileContents", "=", "{", "}", ";", "const", "promises", "=", "[", "]", ";", "function", "readSingleFile", "(", "file", ")", "{", "return", "new",...
Reads files from disk and computes hashes for them. @param {Array} files - array with file paths @returns {Promise<any>}
[ "Reads", "files", "from", "disk", "and", "computes", "hashes", "for", "them", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/plugins/watcher/watcher.js#L143-L179
train
wojtkowiak/meteor-desktop
plugins/watcher/watcher.js
readFilesAndComputeDesktopHash
function readFilesAndComputeDesktopHash(dir) { const desktopHash = crypto.createHash('sha1'); return new Promise((resolve, reject) => { getFileList(dir) .catch(reject) .then(readAndHashFiles) .catch(reject) .then((result) => { const hash =...
javascript
function readFilesAndComputeDesktopHash(dir) { const desktopHash = crypto.createHash('sha1'); return new Promise((resolve, reject) => { getFileList(dir) .catch(reject) .then(readAndHashFiles) .catch(reject) .then((result) => { const hash =...
[ "function", "readFilesAndComputeDesktopHash", "(", "dir", ")", "{", "const", "desktopHash", "=", "crypto", ".", "createHash", "(", "'sha1'", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "getFileList", "(", "dir", ...
Reads files from .desktop and computes a version hash. @param {string} dir - path @returns {Promise<Object>}
[ "Reads", "files", "from", ".", "desktop", "and", "computes", "a", "version", "hash", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/plugins/watcher/watcher.js#L187-L207
train
wojtkowiak/meteor-desktop
lib/electronBuilder.js
removeDir
function removeDir(dirPath, delay = 0) { return new Promise((resolve, reject) => { setTimeout(() => { rimraf(dirPath, { maxBusyTries: 100 }, (err) => { if (err) { reject(err); } else { resolve(); ...
javascript
function removeDir(dirPath, delay = 0) { return new Promise((resolve, reject) => { setTimeout(() => { rimraf(dirPath, { maxBusyTries: 100 }, (err) => { if (err) { reject(err); } else { resolve(); ...
[ "function", "removeDir", "(", "dirPath", ",", "delay", "=", "0", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "setTimeout", "(", "(", ")", "=>", "{", "rimraf", "(", "dirPath", ",", "{", "maxBusyTries", ":"...
Promisfied rimraf. @param {string} dirPath - path to the dir to be deleted @param {number} delay - delay the task by ms @returns {Promise<any>}
[ "Promisfied", "rimraf", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/lib/electronBuilder.js#L18-L32
train
wojtkowiak/meteor-desktop
skeleton/modules/autoupdate/assetManifest.js
ManifestEntry
function ManifestEntry(manifestEntry) { assignIn(this, { filePath: manifestEntry.path, urlPath: manifestEntry.url, fileType: manifestEntry.type, size: manifestEntry.size, cacheable: manifestEntry.cacheable, hash: manifestEntry.hash || null, sourceMapFilePath: ...
javascript
function ManifestEntry(manifestEntry) { assignIn(this, { filePath: manifestEntry.path, urlPath: manifestEntry.url, fileType: manifestEntry.type, size: manifestEntry.size, cacheable: manifestEntry.cacheable, hash: manifestEntry.hash || null, sourceMapFilePath: ...
[ "function", "ManifestEntry", "(", "manifestEntry", ")", "{", "assignIn", "(", "this", ",", "{", "filePath", ":", "manifestEntry", ".", "path", ",", "urlPath", ":", "manifestEntry", ".", "url", ",", "fileType", ":", "manifestEntry", ".", "type", ",", "size", ...
Represents single file in the manifest. @param {object} manifestEntry @param {string} manifestEntry.path @param {string} manifestEntry.url @param {string} manifestEntry.type @param {number} manifestEntry.size @param {bool} manifestEntry.cacheable @param {string} manifestEntry.hash @param {string} manifestEntry.sourc...
[ "Represents", "single", "file", "in", "the", "manifest", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/autoupdate/assetManifest.js#L57-L68
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
createStreamProtocolResponse
function createStreamProtocolResponse(filePath, res, beforeFinalize) { if (!fs.existsSync(filePath)) { return; } // Setting file size. const stat = fs.statSync(filePath); res.setHeader('Content-Length', stat.size); // Setting last modified date. const modified = stat.mtime.toUTCStr...
javascript
function createStreamProtocolResponse(filePath, res, beforeFinalize) { if (!fs.existsSync(filePath)) { return; } // Setting file size. const stat = fs.statSync(filePath); res.setHeader('Content-Length', stat.size); // Setting last modified date. const modified = stat.mtime.toUTCStr...
[ "function", "createStreamProtocolResponse", "(", "filePath", ",", "res", ",", "beforeFinalize", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "filePath", ")", ")", "{", "return", ";", "}", "// Setting file size.", "const", "stat", "=", "fs", ".", ...
Creates stream protocol response for a given file acting like it would come from a real HTTP server. @param {string} filePath - path to the file being sent @param {StreamProtocolResponse} res - the response object @param {Function} beforeFinalize - function to be run before finalizing the response object
[ "Creates", "stream", "protocol", "response", "for", "a", "given", "file", "acting", "like", "it", "would", "come", "from", "a", "real", "HTTP", "server", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L55-L83
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
respondWithCode
function respondWithCode(res, code, message) { /* eslint-disable */ res._headers = {}; res._headerNames = {}; res.statusCode = code; /* eslint-enable */ res.setHeader('Content-Type', 'text/plain; charset=UTF-8'); res.setHeader('Content-...
javascript
function respondWithCode(res, code, message) { /* eslint-disable */ res._headers = {}; res._headerNames = {}; res.statusCode = code; /* eslint-enable */ res.setHeader('Content-Type', 'text/plain; charset=UTF-8'); res.setHeader('Content-...
[ "function", "respondWithCode", "(", "res", ",", "code", ",", "message", ")", "{", "/* eslint-disable */", "res", ".", "_headers", "=", "{", "}", ";", "res", ".", "_headerNames", "=", "{", "}", ";", "res", ".", "statusCode", "=", "code", ";", "/* eslint-e...
Responds with HTTP status code and a message. @param {Object} res - response object @param {number} code - http response code @param {string} message - message
[ "Responds", "with", "HTTP", "status", "code", "and", "a", "message", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L209-L219
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
AssetHandler
function AssetHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); // Check if we have an asset for that url defined. /** @type {Asset} */ const asset = self.assetBundle.assetForUrlPath(parsedUrl.pathname); if (!asset) return next();...
javascript
function AssetHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); // Check if we have an asset for that url defined. /** @type {Asset} */ const asset = self.assetBundle.assetForUrlPath(parsedUrl.pathname); if (!asset) return next();...
[ "function", "AssetHandler", "(", "req", ",", "res", ",", "next", ",", "local", "=", "false", ")", "{", "const", "parsedUrl", "=", "url", ".", "parse", "(", "req", ".", "url", ")", ";", "// Check if we have an asset for that url defined.", "/** @type {Asset} */",...
Provides assets defined in the manifest. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {boolean} local - local mode
[ "Provides", "assets", "defined", "in", "the", "manifest", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L268-L292
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
WwwHandler
function WwwHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); if (parsedUrl.pathname !== '/cordova.js') { return next(); } const parentAssetBundle = self.assetBundle.getParentAssetBundle(); // We need to obtain a p...
javascript
function WwwHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); if (parsedUrl.pathname !== '/cordova.js') { return next(); } const parentAssetBundle = self.assetBundle.getParentAssetBundle(); // We need to obtain a p...
[ "function", "WwwHandler", "(", "req", ",", "res", ",", "next", ",", "local", "=", "false", ")", "{", "const", "parsedUrl", "=", "url", ".", "parse", "(", "req", ".", "url", ")", ";", "if", "(", "parsedUrl", ".", "pathname", "!==", "'/cordova.js'", ")...
Right now this is only used to serve cordova.js and it might seems like an overkill but it will be used later for serving desktop specific files bundled into meteor bundle. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {boolean} ...
[ "Right", "now", "this", "is", "only", "used", "to", "serve", "cordova", ".", "js", "and", "it", "might", "seems", "like", "an", "overkill", "but", "it", "will", "be", "used", "later", "for", "serving", "desktop", "specific", "files", "bundled", "into", "...
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L303-L326
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
FilesystemHandler
function FilesystemHandler(req, res, next, urlAlias, localPath, local = false) { const parsedUrl = url.parse(req.url); if (!parsedUrl.pathname.startsWith(urlAlias)) { return next(); } const bareUrl = parsedUrl.pathname.substr(urlAlias.length); ...
javascript
function FilesystemHandler(req, res, next, urlAlias, localPath, local = false) { const parsedUrl = url.parse(req.url); if (!parsedUrl.pathname.startsWith(urlAlias)) { return next(); } const bareUrl = parsedUrl.pathname.substr(urlAlias.length); ...
[ "function", "FilesystemHandler", "(", "req", ",", "res", ",", "next", ",", "urlAlias", ",", "localPath", ",", "local", "=", "false", ")", "{", "const", "parsedUrl", "=", "url", ".", "parse", "(", "req", ".", "url", ")", ";", "if", "(", "!", "parsedUr...
Provides files from the filesystem on a specified url alias. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {string} urlAlias - url alias on which to serve the files @param {string=} localPath - serve files only from...
[ "Provides", "files", "from", "the", "filesystem", "on", "a", "specified", "url", "alias", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L338-L363
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
LocalFilesystemHandler
function LocalFilesystemHandler(req, res, next, local = false) { if (!self.settings.localFilesystem) { return next(); } return FilesystemHandler(req, res, next, self.localFilesystemUrl, undefined, local); }
javascript
function LocalFilesystemHandler(req, res, next, local = false) { if (!self.settings.localFilesystem) { return next(); } return FilesystemHandler(req, res, next, self.localFilesystemUrl, undefined, local); }
[ "function", "LocalFilesystemHandler", "(", "req", ",", "res", ",", "next", ",", "local", "=", "false", ")", "{", "if", "(", "!", "self", ".", "settings", ".", "localFilesystem", ")", "{", "return", "next", "(", ")", ";", "}", "return", "FilesystemHandler...
Serves files from the entire filesystem if enabled in settings. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {boolean} local - local mode
[ "Serves", "files", "from", "the", "entire", "filesystem", "if", "enabled", "in", "settings", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L374-L379
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
DesktopAssetsHandler
function DesktopAssetsHandler(req, res, next, local = false) { return FilesystemHandler(req, res, next, self.desktopAssetsUrl, path.join(desktopPath, 'assets'), local); }
javascript
function DesktopAssetsHandler(req, res, next, local = false) { return FilesystemHandler(req, res, next, self.desktopAssetsUrl, path.join(desktopPath, 'assets'), local); }
[ "function", "DesktopAssetsHandler", "(", "req", ",", "res", ",", "next", ",", "local", "=", "false", ")", "{", "return", "FilesystemHandler", "(", "req", ",", "res", ",", "next", ",", "self", ".", "desktopAssetsUrl", ",", "path", ".", "join", "(", "deskt...
Serves files from the assets directory. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {boolean} local - local mode
[ "Serves", "files", "from", "the", "assets", "directory", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L389-L391
train
wojtkowiak/meteor-desktop
skeleton/modules/localServer.js
IndexHandler
function IndexHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); if (!parsedUrl.pathname.startsWith(self.localFilesystemUrl) && parsedUrl.pathname !== '/favicon.ico' ) { /** @type {Asset} */ const indexFile =...
javascript
function IndexHandler(req, res, next, local = false) { const parsedUrl = url.parse(req.url); if (!parsedUrl.pathname.startsWith(self.localFilesystemUrl) && parsedUrl.pathname !== '/favicon.ico' ) { /** @type {Asset} */ const indexFile =...
[ "function", "IndexHandler", "(", "req", ",", "res", ",", "next", ",", "local", "=", "false", ")", "{", "const", "parsedUrl", "=", "url", ".", "parse", "(", "req", ".", "url", ")", ";", "if", "(", "!", "parsedUrl", ".", "pathname", ".", "startsWith", ...
Serves index.html as the last resort. @param {Object} req - request object @param {Object} res - response object @param {Function} next - called on handler miss @param {boolean} local - local mode
[ "Serves", "index", ".", "html", "as", "the", "last", "resort", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/localServer.js#L401-L417
train
wojtkowiak/meteor-desktop
skeleton/modules/autoupdate/assetBundle.js
Asset
function Asset(filePath, urlPath, fileType, cacheable, hash, sourceMapUrlPath, size, bundle) { this.filePath = filePath; this.urlPath = urlPath; this.fileType = fileType; this.cacheable = cacheable; this.hash = hash; this.entrySize = size; this.sourceMapUrlPath = sourceMapUrlPath; this.b...
javascript
function Asset(filePath, urlPath, fileType, cacheable, hash, sourceMapUrlPath, size, bundle) { this.filePath = filePath; this.urlPath = urlPath; this.fileType = fileType; this.cacheable = cacheable; this.hash = hash; this.entrySize = size; this.sourceMapUrlPath = sourceMapUrlPath; this.b...
[ "function", "Asset", "(", "filePath", ",", "urlPath", ",", "fileType", ",", "cacheable", ",", "hash", ",", "sourceMapUrlPath", ",", "size", ",", "bundle", ")", "{", "this", ".", "filePath", "=", "filePath", ";", "this", ".", "urlPath", "=", "urlPath", ";...
Represent single asset in the bundle. @property {string} filePath @property {string} urlPath @property {string} fileType @property {number} size @property {bool} cacheable @property {string} hash @property {string} sourceMapFilePath @property {string} sourceMapUrlPath @property {AssetBundle} bundle @constructor
[ "Represent", "single", "asset", "in", "the", "bundle", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/autoupdate/assetBundle.js#L52-L65
train
wojtkowiak/meteor-desktop
lib/desktop.js
isEmptySync
function isEmptySync(searchPath) { let stat; try { stat = fs.statSync(searchPath); } catch (e) { return true; } if (stat.isDirectory()) { const items = fs.readdirSync(searchPath); return !items || !items.length; } return false; }
javascript
function isEmptySync(searchPath) { let stat; try { stat = fs.statSync(searchPath); } catch (e) { return true; } if (stat.isDirectory()) { const items = fs.readdirSync(searchPath); return !items || !items.length; } return false; }
[ "function", "isEmptySync", "(", "searchPath", ")", "{", "let", "stat", ";", "try", "{", "stat", "=", "fs", ".", "statSync", "(", "searchPath", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "true", ";", "}", "if", "(", "stat", ".", "isDirect...
Checks if the path is empty. @param {string} searchPath @returns {boolean}
[ "Checks", "if", "the", "path", "is", "empty", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/lib/desktop.js#L16-L28
train
wojtkowiak/meteor-desktop
skeleton/modules/autoupdate/utils.js
rimrafWithRetries
function rimrafWithRetries(...args) { let retries = 0; return new Promise((resolve, reject) => { function rm(...rmArgs) { try { rimraf.sync(...rmArgs); resolve(); } catch (e) { retries += 1; if (retries < 5) { ...
javascript
function rimrafWithRetries(...args) { let retries = 0; return new Promise((resolve, reject) => { function rm(...rmArgs) { try { rimraf.sync(...rmArgs); resolve(); } catch (e) { retries += 1; if (retries < 5) { ...
[ "function", "rimrafWithRetries", "(", "...", "args", ")", "{", "let", "retries", "=", "0", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "function", "rm", "(", "...", "rmArgs", ")", "{", "try", "{", "rimraf", "....
Simple wrapper for rimraf with additional retries in case of failure. It is useful when something is concurrently reading the dir you want to remove.
[ "Simple", "wrapper", "for", "rimraf", "with", "additional", "retries", "in", "case", "of", "failure", ".", "It", "is", "useful", "when", "something", "is", "concurrently", "reading", "the", "dir", "you", "want", "to", "remove", "." ]
3e4f21be1b7ca3cfbf9093b413037e679e502d81
https://github.com/wojtkowiak/meteor-desktop/blob/3e4f21be1b7ca3cfbf9093b413037e679e502d81/skeleton/modules/autoupdate/utils.js#L7-L27
train
englercj/resource-loader
src/Resource.js
setExtMap
function setExtMap(map, extname, val) { if (extname && extname.indexOf('.') === 0) { extname = extname.substring(1); } if (!extname) { return; } map[extname] = val; }
javascript
function setExtMap(map, extname, val) { if (extname && extname.indexOf('.') === 0) { extname = extname.substring(1); } if (!extname) { return; } map[extname] = val; }
[ "function", "setExtMap", "(", "map", ",", "extname", ",", "val", ")", "{", "if", "(", "extname", "&&", "extname", ".", "indexOf", "(", "'.'", ")", "===", "0", ")", "{", "extname", "=", "extname", ".", "substring", "(", "1", ")", ";", "}", "if", "...
Quick helper to set a value on one of the extension maps. Ensures there is no dot at the start of the extension. @ignore @param {object} map - The map to set on. @param {string} extname - The extension (or key) to set. @param {number} val - The value to set.
[ "Quick", "helper", "to", "set", "a", "value", "on", "one", "of", "the", "extension", "maps", ".", "Ensures", "there", "is", "no", "dot", "at", "the", "start", "of", "the", "extension", "." ]
3a2a8d7a524bc467cb4198f72ef725dbcc54f2cd
https://github.com/englercj/resource-loader/blob/3a2a8d7a524bc467cb4198f72ef725dbcc54f2cd/src/Resource.js#L1155-L1165
train
leancloud/javascript-sdk
src/op.js
function(json) { var decoder = AV.Op._opDecoderMap[json.__op]; if (decoder) { return decoder(json); } else { return undefined; } }
javascript
function(json) { var decoder = AV.Op._opDecoderMap[json.__op]; if (decoder) { return decoder(json); } else { return undefined; } }
[ "function", "(", "json", ")", "{", "var", "decoder", "=", "AV", ".", "Op", ".", "_opDecoderMap", "[", "json", ".", "__op", "]", ";", "if", "(", "decoder", ")", "{", "return", "decoder", "(", "json", ")", ";", "}", "else", "{", "return", "undefined"...
Converts a json object into an instance of a subclass of AV.Op. @private
[ "Converts", "a", "json", "object", "into", "an", "instance", "of", "a", "subclass", "of", "AV", ".", "Op", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/op.js#L51-L58
train
leancloud/javascript-sdk
src/status.js
function(options) { if (!this.id) return Promise.reject(new Error('The status id is not exists.')); var request = AVRequest('statuses', null, this.id, 'DELETE', options); return request; }
javascript
function(options) { if (!this.id) return Promise.reject(new Error('The status id is not exists.')); var request = AVRequest('statuses', null, this.id, 'DELETE', options); return request; }
[ "function", "(", "options", ")", "{", "if", "(", "!", "this", ".", "id", ")", "return", "Promise", ".", "reject", "(", "new", "Error", "(", "'The status id is not exists.'", ")", ")", ";", "var", "request", "=", "AVRequest", "(", "'statuses'", ",", "null...
Destroy this status,then it will not be avaiable in other user's inboxes. @param {AuthOptions} options @return {Promise} A promise that is fulfilled when the destroy completes.
[ "Destroy", "this", "status", "then", "it", "will", "not", "be", "avaiable", "in", "other", "user", "s", "inboxes", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/status.js#L66-L71
train
leancloud/javascript-sdk
src/status.js
function(options = {}) { if (!getSessionToken(options) && !AV.User.current()) { throw new Error('Please signin an user.'); } if (!this.query) { return AV.Status.sendStatusToFollowers(this, options); } return getUserPointer(options) .then(currUser =>...
javascript
function(options = {}) { if (!getSessionToken(options) && !AV.User.current()) { throw new Error('Please signin an user.'); } if (!this.query) { return AV.Status.sendStatusToFollowers(this, options); } return getUserPointer(options) .then(currUser =>...
[ "function", "(", "options", "=", "{", "}", ")", "{", "if", "(", "!", "getSessionToken", "(", "options", ")", "&&", "!", "AV", ".", "User", ".", "current", "(", ")", ")", "{", "throw", "new", "Error", "(", "'Please signin an user.'", ")", ";", "}", ...
Send a status by a AV.Query object. @since 0.3.0 @param {AuthOptions} options @return {Promise} A promise that is fulfilled when the send completes. @example // send a status to male users var status = new AVStatus('image url', 'a message'); status.query = new AV.Query('_User'); status.query.equalTo('gender', 'male'); ...
[ "Send", "a", "status", "by", "a", "AV", ".", "Query", "object", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/status.js#L102-L128
train
leancloud/javascript-sdk
src/query.js
function(objectId, options) { if (!objectId) { var errorObject = new AVError( AVError.OBJECT_NOT_FOUND, 'Object not found.' ); throw errorObject; } var obj = this._newObject(); obj.id = objectId; var queryJSON = this.toJSON(...
javascript
function(objectId, options) { if (!objectId) { var errorObject = new AVError( AVError.OBJECT_NOT_FOUND, 'Object not found.' ); throw errorObject; } var obj = this._newObject(); obj.id = objectId; var queryJSON = this.toJSON(...
[ "function", "(", "objectId", ",", "options", ")", "{", "if", "(", "!", "objectId", ")", "{", "var", "errorObject", "=", "new", "AVError", "(", "AVError", ".", "OBJECT_NOT_FOUND", ",", "'Object not found.'", ")", ";", "throw", "errorObject", ";", "}", "var"...
Constructs an AV.Object whose id is already known by fetching data from the server. @param {String} objectId The id of the object to be fetched. @param {AuthOptions} options @return {Promise.<AV.Object>}
[ "Constructs", "an", "AV", ".", "Object", "whose", "id", "is", "already", "known", "by", "fetching", "data", "from", "the", "server", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L185-L218
train
leancloud/javascript-sdk
src/query.js
function() { var params = { where: this._where, }; if (this._include.length > 0) { params.include = this._include.join(','); } if (this._select.length > 0) { params.keys = this._select.join(','); } if (this._includeACL !== undefined)...
javascript
function() { var params = { where: this._where, }; if (this._include.length > 0) { params.include = this._include.join(','); } if (this._select.length > 0) { params.keys = this._select.join(','); } if (this._includeACL !== undefined)...
[ "function", "(", ")", "{", "var", "params", "=", "{", "where", ":", "this", ".", "_where", ",", "}", ";", "if", "(", "this", ".", "_include", ".", "length", ">", "0", ")", "{", "params", ".", "include", "=", "this", ".", "_include", ".", "join", ...
Returns a JSON representation of this query. @return {Object}
[ "Returns", "a", "JSON", "representation", "of", "this", "query", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L224-L253
train
leancloud/javascript-sdk
src/query.js
function(options) { var self = this; return self.find(options).then(function(objects) { return AV.Object.destroyAll(objects, options); }); }
javascript
function(options) { var self = this; return self.find(options).then(function(objects) { return AV.Object.destroyAll(objects, options); }); }
[ "function", "(", "options", ")", "{", "var", "self", "=", "this", ";", "return", "self", ".", "find", "(", "options", ")", ".", "then", "(", "function", "(", "objects", ")", "{", "return", "AV", ".", "Object", ".", "destroyAll", "(", "objects", ",", ...
Delete objects retrieved by this query. @param {AuthOptions} options @return {Promise} A promise that is fulfilled when the save completes.
[ "Delete", "objects", "retrieved", "by", "this", "query", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L421-L426
train
leancloud/javascript-sdk
src/query.js
function(options) { var params = this.toJSON(); params.limit = 0; params.count = 1; var request = this._createRequest(params, options); return request.then(function(response) { return response.count; }); }
javascript
function(options) { var params = this.toJSON(); params.limit = 0; params.count = 1; var request = this._createRequest(params, options); return request.then(function(response) { return response.count; }); }
[ "function", "(", "options", ")", "{", "var", "params", "=", "this", ".", "toJSON", "(", ")", ";", "params", ".", "limit", "=", "0", ";", "params", ".", "count", "=", "1", ";", "var", "request", "=", "this", ".", "_createRequest", "(", "params", ","...
Counts the number of objects that match this query. @param {AuthOptions} options @return {Promise} A promise that is resolved with the count when the query completes.
[ "Counts", "the", "number", "of", "objects", "that", "match", "this", "query", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L435-L444
train
leancloud/javascript-sdk
src/query.js
function(options) { var self = this; var params = this.toJSON(); params.limit = 1; var request = this._createRequest(params, options); return request.then(function(response) { return _.map(response.results, function(json) { var obj = self._newObject(); ...
javascript
function(options) { var self = this; var params = this.toJSON(); params.limit = 1; var request = this._createRequest(params, options); return request.then(function(response) { return _.map(response.results, function(json) { var obj = self._newObject(); ...
[ "function", "(", "options", ")", "{", "var", "self", "=", "this", ";", "var", "params", "=", "this", ".", "toJSON", "(", ")", ";", "params", ".", "limit", "=", "1", ";", "var", "request", "=", "this", ".", "_createRequest", "(", "params", ",", "opt...
Retrieves at most one AV.Object that satisfies this query. @param {AuthOptions} options @return {Promise} A promise that is resolved with the object when the query completes.
[ "Retrieves", "at", "most", "one", "AV", ".", "Object", "that", "satisfies", "this", "query", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L453-L469
train
leancloud/javascript-sdk
src/query.js
function(key, regex, modifiers) { this._addCondition(key, '$regex', regex); if (!modifiers) { modifiers = ''; } // Javascript regex options support mig as inline options but store them // as properties of the object. We support mi & should migrate them to // mod...
javascript
function(key, regex, modifiers) { this._addCondition(key, '$regex', regex); if (!modifiers) { modifiers = ''; } // Javascript regex options support mig as inline options but store them // as properties of the object. We support mi & should migrate them to // mod...
[ "function", "(", "key", ",", "regex", ",", "modifiers", ")", "{", "this", ".", "_addCondition", "(", "key", ",", "'$regex'", ",", "regex", ")", ";", "if", "(", "!", "modifiers", ")", "{", "modifiers", "=", "''", ";", "}", "// Javascript regex options sup...
Add a regular expression constraint for finding string values that match the provided regular expression. This may be slow for large datasets. @param {String} key The key that the string to match is stored in. @param {RegExp} regex The regular expression pattern to match. @return {AV.Query} Returns the query, so you ca...
[ "Add", "a", "regular", "expression", "constraint", "for", "finding", "string", "values", "that", "match", "the", "provided", "regular", "expression", ".", "This", "may", "be", "slow", "for", "large", "datasets", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L663-L682
train
leancloud/javascript-sdk
src/query.js
function(key, query) { var queryJSON = query.toJSON(); queryJSON.className = query.className; this._addCondition(key, '$inQuery', queryJSON); return this; }
javascript
function(key, query) { var queryJSON = query.toJSON(); queryJSON.className = query.className; this._addCondition(key, '$inQuery', queryJSON); return this; }
[ "function", "(", "key", ",", "query", ")", "{", "var", "queryJSON", "=", "query", ".", "toJSON", "(", ")", ";", "queryJSON", ".", "className", "=", "query", ".", "className", ";", "this", ".", "_addCondition", "(", "key", ",", "'$inQuery'", ",", "query...
Add a constraint that requires that a key's value matches a AV.Query constraint. @param {String} key The key that the contains the object to match the query. @param {AV.Query} query The query that should match. @return {AV.Query} Returns the query, so you can chain this call.
[ "Add", "a", "constraint", "that", "requires", "that", "a", "key", "s", "value", "matches", "a", "AV", ".", "Query", "constraint", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L692-L697
train
leancloud/javascript-sdk
src/query.js
function(queries) { var queryJSON = _.map(queries, function(q) { return q.toJSON().where; }); this._where.$and = queryJSON; return this; }
javascript
function(queries) { var queryJSON = _.map(queries, function(q) { return q.toJSON().where; }); this._where.$and = queryJSON; return this; }
[ "function", "(", "queries", ")", "{", "var", "queryJSON", "=", "_", ".", "map", "(", "queries", ",", "function", "(", "q", ")", "{", "return", "q", ".", "toJSON", "(", ")", ".", "where", ";", "}", ")", ";", "this", ".", "_where", ".", "$and", "...
Add constraint that both of the passed in queries matches. @param {Array} queries @return {AV.Query} Returns the query, so you can chain this call. @private
[ "Add", "constraint", "that", "both", "of", "the", "passed", "in", "queries", "matches", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L772-L779
train
leancloud/javascript-sdk
src/query.js
function(keys) { requires(keys, 'undefined is not a valid key'); _(arguments).forEach(keys => { this._include = this._include.concat(ensureArray(keys)); }); return this; }
javascript
function(keys) { requires(keys, 'undefined is not a valid key'); _(arguments).forEach(keys => { this._include = this._include.concat(ensureArray(keys)); }); return this; }
[ "function", "(", "keys", ")", "{", "requires", "(", "keys", ",", "'undefined is not a valid key'", ")", ";", "_", "(", "arguments", ")", ".", "forEach", "(", "keys", "=>", "{", "this", ".", "_include", "=", "this", ".", "_include", ".", "concat", "(", ...
Include nested AV.Objects for the provided key. You can use dot notation to specify which fields in the included object are also fetch. @param {String[]} keys The name of the key to include. @return {AV.Query} Returns the query, so you can chain this call.
[ "Include", "nested", "AV", ".", "Objects", "for", "the", "provided", "key", ".", "You", "can", "use", "dot", "notation", "to", "specify", "which", "fields", "in", "the", "included", "object", "are", "also", "fetch", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L966-L972
train
leancloud/javascript-sdk
src/query.js
function(keys) { requires(keys, 'undefined is not a valid key'); _(arguments).forEach(keys => { this._select = this._select.concat(ensureArray(keys)); }); return this; }
javascript
function(keys) { requires(keys, 'undefined is not a valid key'); _(arguments).forEach(keys => { this._select = this._select.concat(ensureArray(keys)); }); return this; }
[ "function", "(", "keys", ")", "{", "requires", "(", "keys", ",", "'undefined is not a valid key'", ")", ";", "_", "(", "arguments", ")", ".", "forEach", "(", "keys", "=>", "{", "this", ".", "_select", "=", "this", ".", "_select", ".", "concat", "(", "e...
Restrict the fields of the returned AV.Objects to include only the provided keys. If this is called multiple times, then all of the keys specified in each of the calls will be included. @param {String[]} keys The names of the keys to include. @return {AV.Query} Returns the query, so you can chain this call.
[ "Restrict", "the", "fields", "of", "the", "returned", "AV", ".", "Objects", "to", "include", "only", "the", "provided", "keys", ".", "If", "this", "is", "called", "multiple", "times", "then", "all", "of", "the", "keys", "specified", "in", "each", "of", "...
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/query.js#L991-L997
train
leancloud/javascript-sdk
src/search.js
function() { var self = this; var request = this._createRequest(); return request.then(function(response) { //update sid for next querying. if (response.sid) { self._oldSid = self._sid; self._sid = response.sid; } else { self._s...
javascript
function() { var self = this; var request = this._createRequest(); return request.then(function(response) { //update sid for next querying. if (response.sid) { self._oldSid = self._sid; self._sid = response.sid; } else { self._s...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "request", "=", "this", ".", "_createRequest", "(", ")", ";", "return", "request", ".", "then", "(", "function", "(", "response", ")", "{", "//update sid for next querying.", "if", "(", "...
Retrieves a list of AVObjects that satisfy this query. Either options.success or options.error is called when the find completes. @see AV.Query#find @return {Promise} A promise that is resolved with the results when the query completes.
[ "Retrieves", "a", "list", "of", "AVObjects", "that", "satisfy", "this", "query", ".", "Either", "options", ".", "success", "or", "options", ".", "error", "is", "called", "when", "the", "find", "completes", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/search.js#L232-L258
train
leancloud/javascript-sdk
src/event.js
function(events, callback, context) { var calls, event, node, tail, list; if (!callback) { return this; } events = events.split(eventSplitter); calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during // modific...
javascript
function(events, callback, context) { var calls, event, node, tail, list; if (!callback) { return this; } events = events.split(eventSplitter); calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during // modific...
[ "function", "(", "events", ",", "callback", ",", "context", ")", "{", "var", "calls", ",", "event", ",", "node", ",", "tail", ",", "list", ";", "if", "(", "!", "callback", ")", "{", "return", "this", ";", "}", "events", "=", "events", ".", "split",...
Bind one or more space separated events, `events`, to a `callback` function. Passing `"all"` will bind the callback to all events fired.
[ "Bind", "one", "or", "more", "space", "separated", "events", "events", "to", "a", "callback", "function", ".", "Passing", "all", "will", "bind", "the", "callback", "to", "all", "events", "fired", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/event.js#L32-L55
train
leancloud/javascript-sdk
src/object.js
getValue
function getValue(object, prop) { if (!(object && object[prop])) { return null; } return _.isFunction(object[prop]) ? object[prop]() : object[prop]; }
javascript
function getValue(object, prop) { if (!(object && object[prop])) { return null; } return _.isFunction(object[prop]) ? object[prop]() : object[prop]; }
[ "function", "getValue", "(", "object", ",", "prop", ")", "{", "if", "(", "!", "(", "object", "&&", "object", "[", "prop", "]", ")", ")", "{", "return", "null", ";", "}", "return", "_", ".", "isFunction", "(", "object", "[", "prop", "]", ")", "?",...
Helper function to get a value from a Backbone object as a property or as a function.
[ "Helper", "function", "to", "get", "a", "value", "from", "a", "Backbone", "object", "as", "a", "property", "or", "as", "a", "function", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/object.js#L40-L45
train
leancloud/javascript-sdk
src/object.js
function(serverData) { // Grab a copy of any object referenced by this object. These instances // may have already been fetched, and we don't want to lose their data. // Note that doing it like this means we will unify separate copies of the // same object, but that's a risk we have to t...
javascript
function(serverData) { // Grab a copy of any object referenced by this object. These instances // may have already been fetched, and we don't want to lose their data. // Note that doing it like this means we will unify separate copies of the // same object, but that's a risk we have to t...
[ "function", "(", "serverData", ")", "{", "// Grab a copy of any object referenced by this object. These instances", "// may have already been fetched, and we don't want to lose their data.", "// Note that doing it like this means we will unify separate copies of the", "// same object, but that's a r...
Called when a save completes successfully. This merges the changes that were saved into the known server data, and overrides it with any data sent directly from the server. @private
[ "Called", "when", "a", "save", "completes", "successfully", ".", "This", "merges", "the", "changes", "that", "were", "saved", "into", "the", "known", "server", "data", "and", "overrides", "it", "with", "any", "data", "sent", "directly", "from", "the", "serve...
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/object.js#L486-L522
train
leancloud/javascript-sdk
src/object.js
function(serverData, hasData) { // Clear out any changes the user might have made previously. this._opSetQueue = [{}]; // Bring in all the new server data. this._mergeMagicFields(serverData); var self = this; AV._objectEach(serverData, function(value, key) { se...
javascript
function(serverData, hasData) { // Clear out any changes the user might have made previously. this._opSetQueue = [{}]; // Bring in all the new server data. this._mergeMagicFields(serverData); var self = this; AV._objectEach(serverData, function(value, key) { se...
[ "function", "(", "serverData", ",", "hasData", ")", "{", "// Clear out any changes the user might have made previously.", "this", ".", "_opSetQueue", "=", "[", "{", "}", "]", ";", "// Bring in all the new server data.", "this", ".", "_mergeMagicFields", "(", "serverData",...
Called when a fetch or login is complete to set the known server data to the given object. @private
[ "Called", "when", "a", "fetch", "or", "login", "is", "complete", "to", "set", "the", "known", "server", "data", "to", "the", "given", "object", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/object.js#L529-L548
train
leancloud/javascript-sdk
src/object.js
function(opSet, target) { var self = this; AV._objectEach(opSet, function(change, key) { const [value, actualTarget, actualKey] = findValue(target, key); setValue(target, key, change._estimate(value, self, key)); if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET)...
javascript
function(opSet, target) { var self = this; AV._objectEach(opSet, function(change, key) { const [value, actualTarget, actualKey] = findValue(target, key); setValue(target, key, change._estimate(value, self, key)); if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET)...
[ "function", "(", "opSet", ",", "target", ")", "{", "var", "self", "=", "this", ";", "AV", ".", "_objectEach", "(", "opSet", ",", "function", "(", "change", ",", "key", ")", "{", "const", "[", "value", ",", "actualTarget", ",", "actualKey", "]", "=", ...
Applies the set of AV.Op in opSet to the object target. @private
[ "Applies", "the", "set", "of", "AV", ".", "Op", "in", "opSet", "to", "the", "object", "target", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/object.js#L554-L563
train
leancloud/javascript-sdk
src/object.js
function(value, attr) { if (!self._pending[attr] && !self._silent[attr]) { delete self.changed[attr]; } }
javascript
function(value, attr) { if (!self._pending[attr] && !self._silent[attr]) { delete self.changed[attr]; } }
[ "function", "(", "value", ",", "attr", ")", "{", "if", "(", "!", "self", ".", "_pending", "[", "attr", "]", "&&", "!", "self", ".", "_silent", "[", "attr", "]", ")", "{", "delete", "self", ".", "changed", "[", "attr", "]", ";", "}", "}" ]
This is to get around lint not letting us make a function in a loop.
[ "This", "is", "to", "get", "around", "lint", "not", "letting", "us", "make", "a", "function", "in", "a", "loop", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/object.js#L1203-L1207
train
leancloud/javascript-sdk
src/user.js
function(attrs) { if (attrs.sessionToken) { this._sessionToken = attrs.sessionToken; delete attrs.sessionToken; } return AV.User.__super__._mergeMagicFields.call(this, attrs); }
javascript
function(attrs) { if (attrs.sessionToken) { this._sessionToken = attrs.sessionToken; delete attrs.sessionToken; } return AV.User.__super__._mergeMagicFields.call(this, attrs); }
[ "function", "(", "attrs", ")", "{", "if", "(", "attrs", ".", "sessionToken", ")", "{", "this", ".", "_sessionToken", "=", "attrs", ".", "sessionToken", ";", "delete", "attrs", ".", "sessionToken", ";", "}", "return", "AV", ".", "User", ".", "__super__", ...
Instance Methods Internal method to handle special fields in a _User response. @private
[ "Instance", "Methods", "Internal", "method", "to", "handle", "special", "fields", "in", "a", "_User", "response", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L79-L85
train
leancloud/javascript-sdk
src/user.js
function(provider) { var authType; if (_.isString(provider)) { authType = provider; } else { authType = provider.getAuthType(); } var authData = this.get('authData') || {}; return !!authData[authType]; }
javascript
function(provider) { var authType; if (_.isString(provider)) { authType = provider; } else { authType = provider.getAuthType(); } var authData = this.get('authData') || {}; return !!authData[authType]; }
[ "function", "(", "provider", ")", "{", "var", "authType", ";", "if", "(", "_", ".", "isString", "(", "provider", ")", ")", "{", "authType", "=", "provider", ";", "}", "else", "{", "authType", "=", "provider", ".", "getAuthType", "(", ")", ";", "}", ...
Checks whether a user is linked to a service. @private
[ "Checks", "whether", "a", "user", "is", "linked", "to", "a", "service", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L336-L345
train
leancloud/javascript-sdk
src/user.js
function(options, authOptions) { if (!this.id) { throw new Error('Please signin.'); } let user; let attributes; if (options.user) { user = options.user; attributes = options.attributes; } else { user = options; } var...
javascript
function(options, authOptions) { if (!this.id) { throw new Error('Please signin.'); } let user; let attributes; if (options.user) { user = options.user; attributes = options.attributes; } else { user = options; } var...
[ "function", "(", "options", ",", "authOptions", ")", "{", "if", "(", "!", "this", ".", "id", ")", "{", "throw", "new", "Error", "(", "'Please signin.'", ")", ";", "}", "let", "user", ";", "let", "attributes", ";", "if", "(", "options", ".", "user", ...
Follow a user @since 0.3.0 @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user. @param {AV.User | String} options.user The target user or user's objectId to follow. @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions o...
[ "Follow", "a", "user" ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L605-L631
train
leancloud/javascript-sdk
src/user.js
function(oldPassword, newPassword, options) { var route = 'users/' + this.id + '/updatePassword'; var params = { old_password: oldPassword, new_password: newPassword, }; var request = AVRequest(route, null, null, 'PUT', params, options); return request; ...
javascript
function(oldPassword, newPassword, options) { var route = 'users/' + this.id + '/updatePassword'; var params = { old_password: oldPassword, new_password: newPassword, }; var request = AVRequest(route, null, null, 'PUT', params, options); return request; ...
[ "function", "(", "oldPassword", ",", "newPassword", ",", "options", ")", "{", "var", "route", "=", "'users/'", "+", "this", ".", "id", "+", "'/updatePassword'", ";", "var", "params", "=", "{", "old_password", ":", "oldPassword", ",", "new_password", ":", "...
Update user's new password safely based on old password. @param {String} oldPassword the old password. @param {String} newPassword the new password. @param {AuthOptions} options
[ "Update", "user", "s", "new", "password", "safely", "based", "on", "old", "password", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L696-L704
train
leancloud/javascript-sdk
src/user.js
function(userObjectId) { if (!userObjectId || !_.isString(userObjectId)) { throw new Error('Invalid user object id.'); } var query = new AV.FriendShipQuery('_Follower'); query._friendshipTag = 'follower'; query.equalTo( 'user', AV.Object.createWithou...
javascript
function(userObjectId) { if (!userObjectId || !_.isString(userObjectId)) { throw new Error('Invalid user object id.'); } var query = new AV.FriendShipQuery('_Follower'); query._friendshipTag = 'follower'; query.equalTo( 'user', AV.Object.createWithou...
[ "function", "(", "userObjectId", ")", "{", "if", "(", "!", "userObjectId", "||", "!", "_", ".", "isString", "(", "userObjectId", ")", ")", "{", "throw", "new", "Error", "(", "'Invalid user object id.'", ")", ";", "}", "var", "query", "=", "new", "AV", ...
Create a follower query for special user to query the user's followers. @param {String} userObjectId The user object id. @return {AV.FriendShipQuery} @since 0.3.0
[ "Create", "a", "follower", "query", "for", "special", "user", "to", "query", "the", "user", "s", "followers", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L1210-L1221
train
leancloud/javascript-sdk
src/user.js
function(email) { var json = { email: email }; var request = AVRequest( 'requestPasswordReset', null, null, 'POST', json ); return request; }
javascript
function(email) { var json = { email: email }; var request = AVRequest( 'requestPasswordReset', null, null, 'POST', json ); return request; }
[ "function", "(", "email", ")", "{", "var", "json", "=", "{", "email", ":", "email", "}", ";", "var", "request", "=", "AVRequest", "(", "'requestPasswordReset'", ",", "null", ",", "null", ",", "'POST'", ",", "json", ")", ";", "return", "request", ";", ...
Requests a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the AV site. @param {String} email The email address associated with the user that forgot their password. @return {Promise}
[ "Requests", "a", "password", "reset", "email", "to", "be", "sent", "to", "the", "specified", "email", "address", "associated", "with", "the", "user", "account", ".", "This", "email", "allows", "the", "user", "to", "securely", "reset", "their", "password", "o...
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L1251-L1261
train
leancloud/javascript-sdk
src/user.js
function(code, password) { var json = { password: password }; var request = AVRequest( 'resetPasswordBySmsCode', null, code, 'PUT', json ); return request; }
javascript
function(code, password) { var json = { password: password }; var request = AVRequest( 'resetPasswordBySmsCode', null, code, 'PUT', json ); return request; }
[ "function", "(", "code", ",", "password", ")", "{", "var", "json", "=", "{", "password", ":", "password", "}", ";", "var", "request", "=", "AVRequest", "(", "'resetPasswordBySmsCode'", ",", "null", ",", "code", ",", "'PUT'", ",", "json", ")", ";", "ret...
Makes a call to reset user's account password by sms code and new password. The sms code is sent by AV.User.requestPasswordResetBySmsCode. @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode @param {String} password The new password. @return {Promise} A promise that will be resolved with the result o...
[ "Makes", "a", "call", "to", "reset", "user", "s", "account", "password", "by", "sms", "code", "and", "new", "password", ".", "The", "sms", "code", "is", "sent", "by", "AV", ".", "User", ".", "requestPasswordResetBySmsCode", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L1344-L1354
train
leancloud/javascript-sdk
src/user.js
function(mobilePhoneNumber, options = {}) { const data = { mobilePhoneNumber, }; if (options.validateToken) { data.validate_token = options.validateToken; } var request = AVRequest( 'requestLoginSmsCode', null, null, 'PO...
javascript
function(mobilePhoneNumber, options = {}) { const data = { mobilePhoneNumber, }; if (options.validateToken) { data.validate_token = options.validateToken; } var request = AVRequest( 'requestLoginSmsCode', null, null, 'PO...
[ "function", "(", "mobilePhoneNumber", ",", "options", "=", "{", "}", ")", "{", "const", "data", "=", "{", "mobilePhoneNumber", ",", "}", ";", "if", "(", "options", ".", "validateToken", ")", "{", "data", ".", "validate_token", "=", "options", ".", "valid...
Requests a logIn sms code to be sent to the specified mobile phone number associated with the user account. This sms code allows the user to login by AV.User.logInWithMobilePhoneSmsCode function. @param {String} mobilePhoneNumber The mobile phone number associated with the user that want to login by AV.User.logInWith...
[ "Requests", "a", "logIn", "sms", "code", "to", "be", "sent", "to", "the", "specified", "mobile", "phone", "number", "associated", "with", "the", "user", "account", ".", "This", "sms", "code", "allows", "the", "user", "to", "login", "by", "AV", ".", "User...
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L1379-L1395
train
leancloud/javascript-sdk
src/user.js
function() { if (AV._config.disableCurrentUser) { console.warn( 'AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html' ); return Promise.resolve(null); } ...
javascript
function() { if (AV._config.disableCurrentUser) { console.warn( 'AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html' ); return Promise.resolve(null); } ...
[ "function", "(", ")", "{", "if", "(", "AV", ".", "_config", ".", "disableCurrentUser", ")", "{", "console", ".", "warn", "(", "'AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.ht...
Retrieves the currently logged in AVUser with a valid session, either from memory or localStorage, if necessary. @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
[ "Retrieves", "the", "currently", "logged", "in", "AVUser", "with", "a", "valid", "session", "either", "from", "memory", "or", "localStorage", "if", "necessary", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/user.js#L1402-L1444
train
leancloud/javascript-sdk
src/geopoint.js
function() { AV.GeoPoint._validate(this.latitude, this.longitude); return { __type: 'GeoPoint', latitude: this.latitude, longitude: this.longitude, }; }
javascript
function() { AV.GeoPoint._validate(this.latitude, this.longitude); return { __type: 'GeoPoint', latitude: this.latitude, longitude: this.longitude, }; }
[ "function", "(", ")", "{", "AV", ".", "GeoPoint", ".", "_validate", "(", "this", ".", "latitude", ",", "this", ".", "longitude", ")", ";", "return", "{", "__type", ":", "'GeoPoint'", ",", "latitude", ":", "this", ".", "latitude", ",", "longitude", ":",...
Returns a JSON representation of the GeoPoint, suitable for AV. @return {Object}
[ "Returns", "a", "JSON", "representation", "of", "the", "GeoPoint", "suitable", "for", "AV", "." ]
f44017dc64e36ac126cf64d6cfd0ee1489e31a22
https://github.com/leancloud/javascript-sdk/blob/f44017dc64e36ac126cf64d6cfd0ee1489e31a22/src/geopoint.js#L121-L128
train
wellcaffeinated/PhysicsJS
src/math/gjk.js
getNextSearchDir
function getNextSearchDir( ptA, ptB, dir ){ var ABdotB = ptB.normSq() - ptB.dot( ptA ) ,ABdotA = ptB.dot( ptA ) - ptA.normSq() ; // if the origin is farther than either of these points // get the direction from one of those points to the origin if ( ABdotB < 0 )...
javascript
function getNextSearchDir( ptA, ptB, dir ){ var ABdotB = ptB.normSq() - ptB.dot( ptA ) ,ABdotA = ptB.dot( ptA ) - ptA.normSq() ; // if the origin is farther than either of these points // get the direction from one of those points to the origin if ( ABdotB < 0 )...
[ "function", "getNextSearchDir", "(", "ptA", ",", "ptB", ",", "dir", ")", "{", "var", "ABdotB", "=", "ptB", ".", "normSq", "(", ")", "-", "ptB", ".", "dot", "(", "ptA", ")", ",", "ABdotA", "=", "ptB", ".", "dot", "(", "ptA", ")", "-", "ptA", "."...
get the next search direction from two simplex points
[ "get", "the", "next", "search", "direction", "from", "two", "simplex", "points" ]
b9eca1634b6db222571e7e820a09404513fe2e46
https://github.com/wellcaffeinated/PhysicsJS/blob/b9eca1634b6db222571e7e820a09404513fe2e46/src/math/gjk.js#L9-L34
train
wellcaffeinated/PhysicsJS
src/math/transform.js
Transform
function Transform( vect, angle, origin ) { if (!(this instanceof Transform)){ return new Transform( vect, angle ); } this.v = new Physics.vector(); this.o = new Physics.vector(); // origin of rotation if ( vect instanceof Transform ){ this.clo...
javascript
function Transform( vect, angle, origin ) { if (!(this instanceof Transform)){ return new Transform( vect, angle ); } this.v = new Physics.vector(); this.o = new Physics.vector(); // origin of rotation if ( vect instanceof Transform ){ this.clo...
[ "function", "Transform", "(", "vect", ",", "angle", ",", "origin", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Transform", ")", ")", "{", "return", "new", "Transform", "(", "vect", ",", "angle", ")", ";", "}", "this", ".", "v", "=", "new"...
class Physics.transform Vector Transformations class for rotating and translating vectors new Physics.transform( [vect, angle, origin] ) new Physics.transform( transform ) - vect (Vectorish): Translation vector - transform (Physics.transform): Transform to copy - angle (Number): Angle (radians) to use for rotation -...
[ "class", "Physics", ".", "transform" ]
b9eca1634b6db222571e7e820a09404513fe2e46
https://github.com/wellcaffeinated/PhysicsJS/blob/b9eca1634b6db222571e7e820a09404513fe2e46/src/math/transform.js#L19-L39
train
wellcaffeinated/PhysicsJS
gruntfile.js
wrapDefine
function wrapDefine( src, path ){ path = path.replace('src/', ''); var deps = ['physicsjs']; var l = path.split('/').length; var pfx = l > 0 ? (new Array( l )).join('../') : './'; src.replace(/@requires\s([\w-_\/]+(\.js)?)/g, function( match, dep ){ var i = dep.ind...
javascript
function wrapDefine( src, path ){ path = path.replace('src/', ''); var deps = ['physicsjs']; var l = path.split('/').length; var pfx = l > 0 ? (new Array( l )).join('../') : './'; src.replace(/@requires\s([\w-_\/]+(\.js)?)/g, function( match, dep ){ var i = dep.ind...
[ "function", "wrapDefine", "(", "src", ",", "path", ")", "{", "path", "=", "path", ".", "replace", "(", "'src/'", ",", "''", ")", ";", "var", "deps", "=", "[", "'physicsjs'", "]", ";", "var", "l", "=", "path", ".", "split", "(", "'/'", ")", ".", ...
search for pragmas to figure out dependencies and add a umd declaration
[ "search", "for", "pragmas", "to", "figure", "out", "dependencies", "and", "add", "a", "umd", "declaration" ]
b9eca1634b6db222571e7e820a09404513fe2e46
https://github.com/wellcaffeinated/PhysicsJS/blob/b9eca1634b6db222571e7e820a09404513fe2e46/gruntfile.js#L133-L164
train
chadxz/imap-simple
lib/errors.js
ConnectionTimeoutError
function ConnectionTimeoutError(timeout) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.message = 'connection timed out'; if (timeout) { this.message += '. timeout = ' + timeout + ' ms'; } this.name = 'ConnectionTimeoutError'; }
javascript
function ConnectionTimeoutError(timeout) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.message = 'connection timed out'; if (timeout) { this.message += '. timeout = ' + timeout + ' ms'; } this.name = 'ConnectionTimeoutError'; }
[ "function", "ConnectionTimeoutError", "(", "timeout", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "this", ".", "message", "=", "'connection timed out'", ";"...
Error thrown when a connection attempt has timed out @param {number} timeout timeout in milliseconds that the connection waited before timing out @constructor
[ "Error", "thrown", "when", "a", "connection", "attempt", "has", "timed", "out" ]
a0c73265123d15000109b04fe6de54a73ef948d5
https://github.com/chadxz/imap-simple/blob/a0c73265123d15000109b04fe6de54a73ef948d5/lib/errors.js#L10-L20
train
chadxz/imap-simple
lib/imapSimple.js
ImapSimple
function ImapSimple(imap) { var self = this; self.imap = imap; // flag to determine whether we should suppress ECONNRESET from bubbling up to listener self.ending = false; // pass most node-imap `Connection` events through 1:1 ['alert', 'mail', 'expunge', 'uidvalidity', 'update', 'close', 'end...
javascript
function ImapSimple(imap) { var self = this; self.imap = imap; // flag to determine whether we should suppress ECONNRESET from bubbling up to listener self.ending = false; // pass most node-imap `Connection` events through 1:1 ['alert', 'mail', 'expunge', 'uidvalidity', 'update', 'close', 'end...
[ "function", "ImapSimple", "(", "imap", ")", "{", "var", "self", "=", "this", ";", "self", ".", "imap", "=", "imap", ";", "// flag to determine whether we should suppress ECONNRESET from bubbling up to listener", "self", ".", "ending", "=", "false", ";", "// pass most ...
Constructs an instance of ImapSimple @param {object} imap a constructed node-imap connection @constructor @class ImapSimple
[ "Constructs", "an", "instance", "of", "ImapSimple" ]
a0c73265123d15000109b04fe6de54a73ef948d5
https://github.com/chadxz/imap-simple/blob/a0c73265123d15000109b04fe6de54a73ef948d5/lib/imapSimple.js#L20-L41
train
chadxz/imap-simple
lib/imapSimple.js
connect
function connect(options, callback) { options = options || {}; options.imap = options.imap || {}; // support old connectTimeout config option. Remove in v2.0.0 if (options.hasOwnProperty('connectTimeout')) { console.warn('[imap-simple] connect: options.connectTimeout is deprecated. ' + ...
javascript
function connect(options, callback) { options = options || {}; options.imap = options.imap || {}; // support old connectTimeout config option. Remove in v2.0.0 if (options.hasOwnProperty('connectTimeout')) { console.warn('[imap-simple] connect: options.connectTimeout is deprecated. ' + ...
[ "function", "connect", "(", "options", ",", "callback", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "imap", "=", "options", ".", "imap", "||", "{", "}", ";", "// support old connectTimeout config option. Remove in v2.0.0", "if", "...
Connect to an Imap server, returning an ImapSimple instance, which is a wrapper over node-imap to simplify it's api for common use cases. @param {object} options @param {object} options.imap Options to pass to node-imap constructor 1:1 @param {function} [callback] Optional callback, receiving signature (err, connectio...
[ "Connect", "to", "an", "Imap", "server", "returning", "an", "ImapSimple", "instance", "which", "is", "a", "wrapper", "over", "node", "-", "imap", "to", "simplify", "it", "s", "api", "for", "common", "use", "cases", "." ]
a0c73265123d15000109b04fe6de54a73ef948d5
https://github.com/chadxz/imap-simple/blob/a0c73265123d15000109b04fe6de54a73ef948d5/lib/imapSimple.js#L548-L620
train
chadxz/imap-simple
lib/imapSimple.js
getParts
function getParts(struct, parts) { parts = parts || []; for (var i = 0; i < struct.length; i++) { if (Array.isArray(struct[i])) { getParts(struct[i], parts); } else if (struct[i].partID) { parts.push(struct[i]); } } return parts; }
javascript
function getParts(struct, parts) { parts = parts || []; for (var i = 0; i < struct.length; i++) { if (Array.isArray(struct[i])) { getParts(struct[i], parts); } else if (struct[i].partID) { parts.push(struct[i]); } } return parts; }
[ "function", "getParts", "(", "struct", ",", "parts", ")", "{", "parts", "=", "parts", "||", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "struct", ".", "length", ";", "i", "++", ")", "{", "if", "(", "Array", ".", "isArray", ...
Given the `message.attributes.struct`, retrieve a flattened array of `parts` objects that describe the structure of the different parts of the message's body. Useful for getting a simple list to iterate for the purposes of, for example, finding all attachments. Code taken from http://stackoverflow.com/questions/252472...
[ "Given", "the", "message", ".", "attributes", ".", "struct", "retrieve", "a", "flattened", "array", "of", "parts", "objects", "that", "describe", "the", "structure", "of", "the", "different", "parts", "of", "the", "message", "s", "body", ".", "Useful", "for"...
a0c73265123d15000109b04fe6de54a73ef948d5
https://github.com/chadxz/imap-simple/blob/a0c73265123d15000109b04fe6de54a73ef948d5/lib/imapSimple.js#L634-L644
train
blinksocks/blinksocks
bin/init.js
random
function random(array, len) { const size = array.length; const randomIndexes = crypto.randomBytes(len).toJSON().data; return randomIndexes.map((char) => array[char % size]).join(''); }
javascript
function random(array, len) { const size = array.length; const randomIndexes = crypto.randomBytes(len).toJSON().data; return randomIndexes.map((char) => array[char % size]).join(''); }
[ "function", "random", "(", "array", ",", "len", ")", "{", "const", "size", "=", "array", ".", "length", ";", "const", "randomIndexes", "=", "crypto", ".", "randomBytes", "(", "len", ")", ".", "toJSON", "(", ")", ".", "data", ";", "return", "randomIndex...
return a fixed length random string from array @param array @param len @returns {string}
[ "return", "a", "fixed", "length", "random", "string", "from", "array" ]
88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0
https://github.com/blinksocks/blinksocks/blob/88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0/bin/init.js#L10-L14
train
blinksocks/blinksocks
src/core/acl.js
ruleIsMatch
function ruleIsMatch(host, port) { const { host: rHost, port: rPort } = this; const slashIndex = rHost.indexOf('/'); let isHostMatch = false; if (slashIndex !== -1 && net.isIP(host)) { isHostMatch = ip.cidrSubnet(rHost).contains(host); } else { isHostMatch = (rHost === host); } if (rHost === '*'...
javascript
function ruleIsMatch(host, port) { const { host: rHost, port: rPort } = this; const slashIndex = rHost.indexOf('/'); let isHostMatch = false; if (slashIndex !== -1 && net.isIP(host)) { isHostMatch = ip.cidrSubnet(rHost).contains(host); } else { isHostMatch = (rHost === host); } if (rHost === '*'...
[ "function", "ruleIsMatch", "(", "host", ",", "port", ")", "{", "const", "{", "host", ":", "rHost", ",", "port", ":", "rPort", "}", "=", "this", ";", "const", "slashIndex", "=", "rHost", ".", "indexOf", "(", "'/'", ")", ";", "let", "isHostMatch", "=",...
rule's methods
[ "rule", "s", "methods" ]
88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0
https://github.com/blinksocks/blinksocks/blob/88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0/src/core/acl.js#L17-L34
train
blinksocks/blinksocks
src/proxies/socks.js
getHostType
function getHostType(host) { if (net.isIPv4(host)) { return ATYP_V4; } if (net.isIPv6(host)) { return ATYP_V6; } return ATYP_DOMAIN; }
javascript
function getHostType(host) { if (net.isIPv4(host)) { return ATYP_V4; } if (net.isIPv6(host)) { return ATYP_V6; } return ATYP_DOMAIN; }
[ "function", "getHostType", "(", "host", ")", "{", "if", "(", "net", ".", "isIPv4", "(", "host", ")", ")", "{", "return", "ATYP_V4", ";", "}", "if", "(", "net", ".", "isIPv6", "(", "host", ")", ")", "{", "return", "ATYP_V6", ";", "}", "return", "A...
const REPLY_ADDRESS_TYPE_NOT_SUPPORTED = 0x08; const REPLY_UNASSIGNED = 0xff;
[ "const", "REPLY_ADDRESS_TYPE_NOT_SUPPORTED", "=", "0x08", ";", "const", "REPLY_UNASSIGNED", "=", "0xff", ";" ]
88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0
https://github.com/blinksocks/blinksocks/blob/88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0/src/proxies/socks.js#L98-L106
train
blinksocks/blinksocks
bin/bootstrap.js
obtainConfig
function obtainConfig(file) { let json; try { const jsonFile = fs.readFileSync(file); json = JSON.parse(jsonFile); } catch (err) { throw Error(`fail to load/parse your '${file}': ${err.message}`); } return json; }
javascript
function obtainConfig(file) { let json; try { const jsonFile = fs.readFileSync(file); json = JSON.parse(jsonFile); } catch (err) { throw Error(`fail to load/parse your '${file}': ${err.message}`); } return json; }
[ "function", "obtainConfig", "(", "file", ")", "{", "let", "json", ";", "try", "{", "const", "jsonFile", "=", "fs", ".", "readFileSync", "(", "file", ")", ";", "json", "=", "JSON", ".", "parse", "(", "jsonFile", ")", ";", "}", "catch", "(", "err", "...
get raw config object from json @param file @returns {object}
[ "get", "raw", "config", "object", "from", "json" ]
88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0
https://github.com/blinksocks/blinksocks/blob/88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0/bin/bootstrap.js#L8-L17
train
blinksocks/blinksocks
src/presets/obfs-tls1.2-ticket.js
ApplicationData
function ApplicationData(buffer) { const len = numberToBuffer(buffer.length); return Buffer.concat([stb('170303'), len, buffer]); }
javascript
function ApplicationData(buffer) { const len = numberToBuffer(buffer.length); return Buffer.concat([stb('170303'), len, buffer]); }
[ "function", "ApplicationData", "(", "buffer", ")", "{", "const", "len", "=", "numberToBuffer", "(", "buffer", ".", "length", ")", ";", "return", "Buffer", ".", "concat", "(", "[", "stb", "(", "'170303'", ")", ",", "len", ",", "buffer", "]", ")", ";", ...
wrap buffer to Application Data @param buffer @returns {Buffer} @constructor
[ "wrap", "buffer", "to", "Application", "Data" ]
88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0
https://github.com/blinksocks/blinksocks/blob/88b2b6c0041ef8df4912f9ff0a9cbbec7a2784d0/src/presets/obfs-tls1.2-ticket.js#L41-L44
train
bartve/disconnect
lib/client.js
function() { var err = null, status = parseInt(res.statusCode, 10); if (status > 399) { // Unsuccessful HTTP status? Then pass an error to the callback var match = data.match(/^\{"message": "(.+)"\}/i); err = new error.DiscogsError(status, ((match && match[1]) ? m...
javascript
function() { var err = null, status = parseInt(res.statusCode, 10); if (status > 399) { // Unsuccessful HTTP status? Then pass an error to the callback var match = data.match(/^\{"message": "(.+)"\}/i); err = new error.DiscogsError(status, ((match && match[1]) ? m...
[ "function", "(", ")", "{", "var", "err", "=", "null", ",", "status", "=", "parseInt", "(", "res", ".", "statusCode", ",", "10", ")", ";", "if", "(", "status", ">", "399", ")", "{", "// Unsuccessful HTTP status? Then pass an error to the callback", "var", "ma...
Pass the data to the callback and pass an error on unsuccessful HTTP status
[ "Pass", "the", "data", "to", "the", "callback", "and", "pass", "an", "error", "on", "unsuccessful", "HTTP", "status" ]
a3fa52cffefa07b3f3d2863284228843176a7336
https://github.com/bartve/disconnect/blob/a3fa52cffefa07b3f3d2863284228843176a7336/lib/client.js#L208-L215
train
bartve/disconnect
lib/error.js
DiscogsError
function DiscogsError(statusCode, message){ Error.captureStackTrace(this, this.constructor); this.statusCode = statusCode||404; this.message = message||'Unknown error.'; }
javascript
function DiscogsError(statusCode, message){ Error.captureStackTrace(this, this.constructor); this.statusCode = statusCode||404; this.message = message||'Unknown error.'; }
[ "function", "DiscogsError", "(", "statusCode", ",", "message", ")", "{", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "this", ".", "statusCode", "=", "statusCode", "||", "404", ";", "this", ".", "message", "=",...
Discogs generic error @param {number} [statusCode] - A HTTP status code @param {string} [message] - The error message @returns {DiscogsError}
[ "Discogs", "generic", "error" ]
a3fa52cffefa07b3f3d2863284228843176a7336
https://github.com/bartve/disconnect/blob/a3fa52cffefa07b3f3d2863284228843176a7336/lib/error.js#L12-L16
train
bbc/bigscreen-player
script/playbackstrategy/msestrategy.js
calculateSourceAnchor
function calculateSourceAnchor (source, startTime) { if (startTime === undefined || isNaN(startTime)) { return source; } if (windowType === WindowTypes.STATIC) { return startTime === 0 ? source : source + '#t=' + parseInt(startTime); } if (windowType === Win...
javascript
function calculateSourceAnchor (source, startTime) { if (startTime === undefined || isNaN(startTime)) { return source; } if (windowType === WindowTypes.STATIC) { return startTime === 0 ? source : source + '#t=' + parseInt(startTime); } if (windowType === Win...
[ "function", "calculateSourceAnchor", "(", "source", ",", "startTime", ")", "{", "if", "(", "startTime", "===", "undefined", "||", "isNaN", "(", "startTime", ")", ")", "{", "return", "source", ";", "}", "if", "(", "windowType", "===", "WindowTypes", ".", "S...
Calculates a source url with anchor tags for playback within dashjs Anchor tags applied to the MPD source for playback: #r - relative to the start of the first period defined in the DASH manifest #t - time since the beginning of the first period defined in the DASH manifest @param {String} source @param {Number} star...
[ "Calculates", "a", "source", "url", "with", "anchor", "tags", "for", "playback", "within", "dashjs" ]
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/script/playbackstrategy/msestrategy.js#L228-L248
train
bbc/bigscreen-player
docs/example-app/script/index.js
toggleControls
function toggleControls () { controlsElement.style.display = controlsElement.style.display == "none" ? "block" : "none"; if (controlsElement.style.display === "block") { playButton.focus(); } }
javascript
function toggleControls () { controlsElement.style.display = controlsElement.style.display == "none" ? "block" : "none"; if (controlsElement.style.display === "block") { playButton.focus(); } }
[ "function", "toggleControls", "(", ")", "{", "controlsElement", ".", "style", ".", "display", "=", "controlsElement", ".", "style", ".", "display", "==", "\"none\"", "?", "\"block\"", ":", "\"none\"", ";", "if", "(", "controlsElement", ".", "style", ".", "di...
Toggle on screen playback controls
[ "Toggle", "on", "screen", "playback", "controls" ]
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/docs/example-app/script/index.js#L26-L31
train
bbc/bigscreen-player
docs/example-app/script/index.js
startControlsTimeOut
function startControlsTimeOut () { clearTimeout(controlsTimeout); if (controlsElement.style.display === "block") { controlsTimeout = setTimeout(function () { toggleControls(); }, 5000); } else { toggleControls(); } }
javascript
function startControlsTimeOut () { clearTimeout(controlsTimeout); if (controlsElement.style.display === "block") { controlsTimeout = setTimeout(function () { toggleControls(); }, 5000); } else { toggleControls(); } }
[ "function", "startControlsTimeOut", "(", ")", "{", "clearTimeout", "(", "controlsTimeout", ")", ";", "if", "(", "controlsElement", ".", "style", ".", "display", "===", "\"block\"", ")", "{", "controlsTimeout", "=", "setTimeout", "(", "function", "(", ")", "{",...
Timeout feature for controls
[ "Timeout", "feature", "for", "controls" ]
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/docs/example-app/script/index.js#L34-L45
train
bbc/bigscreen-player
docs/example-app/script/index.js
setupControls
function setupControls () { window.addEventListener('keydown', function () { startControlsTimeOut(); }); playButton.addEventListener('click', function () { bigscreenPlayer.play(); startControlsTimeOut(); }); pauseButton.addEventListener('click', function () { ...
javascript
function setupControls () { window.addEventListener('keydown', function () { startControlsTimeOut(); }); playButton.addEventListener('click', function () { bigscreenPlayer.play(); startControlsTimeOut(); }); pauseButton.addEventListener('click', function () { ...
[ "function", "setupControls", "(", ")", "{", "window", ".", "addEventListener", "(", "'keydown'", ",", "function", "(", ")", "{", "startControlsTimeOut", "(", ")", ";", "}", ")", ";", "playButton", ".", "addEventListener", "(", "'click'", ",", "function", "("...
Create event listeners
[ "Create", "event", "listeners" ]
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/docs/example-app/script/index.js#L48-L103
train
bbc/bigscreen-player
script/playbackstrategy/modifiers/html5.js
isNearToCurrentTime
function isNearToCurrentTime (seconds) { var currentTime = getCurrentTime(); var targetTime = getClampedTime(seconds); return Math.abs(currentTime - targetTime) <= CURRENT_TIME_TOLERANCE; }
javascript
function isNearToCurrentTime (seconds) { var currentTime = getCurrentTime(); var targetTime = getClampedTime(seconds); return Math.abs(currentTime - targetTime) <= CURRENT_TIME_TOLERANCE; }
[ "function", "isNearToCurrentTime", "(", "seconds", ")", "{", "var", "currentTime", "=", "getCurrentTime", "(", ")", ";", "var", "targetTime", "=", "getClampedTime", "(", "seconds", ")", ";", "return", "Math", ".", "abs", "(", "currentTime", "-", "targetTime", ...
Check whether a time value is near to the current media play time. @param {Number} seconds The time value to test, in seconds from the start of the media @protected
[ "Check", "whether", "a", "time", "value", "is", "near", "to", "the", "current", "media", "play", "time", "." ]
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/script/playbackstrategy/modifiers/html5.js#L475-L479
train
bbc/bigscreen-player
script/playbackstrategy/modifiers/html5.js
getClampedTime
function getClampedTime (seconds) { var range = getSeekableRange(); var offsetFromEnd = getClampOffsetFromConfig(); var nearToEnd = Math.max(range.end - offsetFromEnd, range.start); if (seconds < range.start) { return range.start; } else if (seconds > nearToEnd) { ...
javascript
function getClampedTime (seconds) { var range = getSeekableRange(); var offsetFromEnd = getClampOffsetFromConfig(); var nearToEnd = Math.max(range.end - offsetFromEnd, range.start); if (seconds < range.start) { return range.start; } else if (seconds > nearToEnd) { ...
[ "function", "getClampedTime", "(", "seconds", ")", "{", "var", "range", "=", "getSeekableRange", "(", ")", ";", "var", "offsetFromEnd", "=", "getClampOffsetFromConfig", "(", ")", ";", "var", "nearToEnd", "=", "Math", ".", "max", "(", "range", ".", "end", "...
Clamp a time value so it does not exceed the current range. Clamps to near the end instead of the end itself to allow for devices that cannot seek to the very end of the media. @param {Number} seconds The time value to clamp in seconds from the start of the media @protected
[ "Clamp", "a", "time", "value", "so", "it", "does", "not", "exceed", "the", "current", "range", ".", "Clamps", "to", "near", "the", "end", "instead", "of", "the", "end", "itself", "to", "allow", "for", "devices", "that", "cannot", "seek", "to", "the", "...
2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5
https://github.com/bbc/bigscreen-player/blob/2ea81b43cdae1c1cf3540b5e35b224ad7bb734b5/script/playbackstrategy/modifiers/html5.js#L487-L498
train
supermedium/aframe-environment-component
index.js
function (skyType, sunHeight) { var fogColor; if (skyType == 'color' || skyType == 'none'){ fogColor = new THREE.Color(this.data.skyColor); } else if (skyType == 'gradient'){ fogColor = new THREE.Color(this.data.horizonColor); } else if (skyType == 'atmosphere') { var fogR...
javascript
function (skyType, sunHeight) { var fogColor; if (skyType == 'color' || skyType == 'none'){ fogColor = new THREE.Color(this.data.skyColor); } else if (skyType == 'gradient'){ fogColor = new THREE.Color(this.data.horizonColor); } else if (skyType == 'atmosphere') { var fogR...
[ "function", "(", "skyType", ",", "sunHeight", ")", "{", "var", "fogColor", ";", "if", "(", "skyType", "==", "'color'", "||", "skyType", "==", "'none'", ")", "{", "fogColor", "=", "new", "THREE", ".", "Color", "(", "this", ".", "data", ".", "skyColor", ...
returns a fog color from a specific sky type and sun height
[ "returns", "a", "fog", "color", "from", "a", "specific", "sky", "type", "and", "sun", "height" ]
4054f003ff4781b4ee6c4b3ae5071fd691831ccf
https://github.com/supermedium/aframe-environment-component/blob/4054f003ff4781b4ee6c4b3ae5071fd691831ccf/index.js#L205-L240
train
supermedium/aframe-environment-component
index.js
function () { var str = '{'; for (var i in this.schema){ if (i == 'preset') continue; str += i + ': '; var type = this.schema[i].type; if (type == 'vec3') { str += '{ x: ' + this.data[i].x + ', y: ' + this.data[i].y + ', z: ' + this.data[i].z + '}'; } else if (type ==...
javascript
function () { var str = '{'; for (var i in this.schema){ if (i == 'preset') continue; str += i + ': '; var type = this.schema[i].type; if (type == 'vec3') { str += '{ x: ' + this.data[i].x + ', y: ' + this.data[i].y + ', z: ' + this.data[i].z + '}'; } else if (type ==...
[ "function", "(", ")", "{", "var", "str", "=", "'{'", ";", "for", "(", "var", "i", "in", "this", ".", "schema", ")", "{", "if", "(", "i", "==", "'preset'", ")", "continue", ";", "str", "+=", "i", "+", "': '", ";", "var", "type", "=", "this", "...
logs current parameters to console, for saving to a preset
[ "logs", "current", "parameters", "to", "console", "for", "saving", "to", "a", "preset" ]
4054f003ff4781b4ee6c4b3ae5071fd691831ccf
https://github.com/supermedium/aframe-environment-component/blob/4054f003ff4781b4ee6c4b3ae5071fd691831ccf/index.js#L385-L404
train
supermedium/aframe-environment-component
index.js
function () { // trim number to 3 decimals function dec3 (v) { return Math.floor(v * 1000) / 1000; } var params = []; var usingPreset = this.data.preset != 'none' ? this.presets[this.data.preset] : false; if (usingPreset) { params.push('preset: ' + this.data.preset); } fo...
javascript
function () { // trim number to 3 decimals function dec3 (v) { return Math.floor(v * 1000) / 1000; } var params = []; var usingPreset = this.data.preset != 'none' ? this.presets[this.data.preset] : false; if (usingPreset) { params.push('preset: ' + this.data.preset); } fo...
[ "function", "(", ")", "{", "// trim number to 3 decimals", "function", "dec3", "(", "v", ")", "{", "return", "Math", ".", "floor", "(", "v", "*", "1000", ")", "/", "1000", ";", "}", "var", "params", "=", "[", "]", ";", "var", "usingPreset", "=", "thi...
dumps current component settings to console.
[ "dumps", "current", "component", "settings", "to", "console", "." ]
4054f003ff4781b4ee6c4b3ae5071fd691831ccf
https://github.com/supermedium/aframe-environment-component/blob/4054f003ff4781b4ee6c4b3ae5071fd691831ccf/index.js#L407-L448
train
supermedium/aframe-environment-component
index.js
function (ctx, size, texMeters) { if (this.data.grid == 'none') return; // one grid feature each 2 meters var num = Math.floor(texMeters / 2); var step = size / (texMeters / 2); // 2 meters == <step> pixels var i, j, ii; ctx.fillStyle = this.data.gridColor; switch (this.data.grid) { ...
javascript
function (ctx, size, texMeters) { if (this.data.grid == 'none') return; // one grid feature each 2 meters var num = Math.floor(texMeters / 2); var step = size / (texMeters / 2); // 2 meters == <step> pixels var i, j, ii; ctx.fillStyle = this.data.gridColor; switch (this.data.grid) { ...
[ "function", "(", "ctx", ",", "size", ",", "texMeters", ")", "{", "if", "(", "this", ".", "data", ".", "grid", "==", "'none'", ")", "return", ";", "// one grid feature each 2 meters", "var", "num", "=", "Math", ".", "floor", "(", "texMeters", "/", "2", ...
draw grid to a canvas context
[ "draw", "grid", "to", "a", "canvas", "context" ]
4054f003ff4781b4ee6c4b3ae5071fd691831ccf
https://github.com/supermedium/aframe-environment-component/blob/4054f003ff4781b4ee6c4b3ae5071fd691831ccf/index.js#L608-L667
train
supermedium/aframe-environment-component
index.js
function() { var numStars = 2000; var geometry = new THREE.BufferGeometry(); var positions = new Float32Array( numStars * 3 ); var radius = this.STAGE_SIZE - 1; var v = new THREE.Vector3(); for (var i = 0; i < positions.length; i += 3) { v.set(this.random(i + 23) - 0.5, this.random(i + 24)...
javascript
function() { var numStars = 2000; var geometry = new THREE.BufferGeometry(); var positions = new Float32Array( numStars * 3 ); var radius = this.STAGE_SIZE - 1; var v = new THREE.Vector3(); for (var i = 0; i < positions.length; i += 3) { v.set(this.random(i + 23) - 0.5, this.random(i + 24)...
[ "function", "(", ")", "{", "var", "numStars", "=", "2000", ";", "var", "geometry", "=", "new", "THREE", ".", "BufferGeometry", "(", ")", ";", "var", "positions", "=", "new", "Float32Array", "(", "numStars", "*", "3", ")", ";", "var", "radius", "=", "...
initializes the BufferGeometry for the stars
[ "initializes", "the", "BufferGeometry", "for", "the", "stars" ]
4054f003ff4781b4ee6c4b3ae5071fd691831ccf
https://github.com/supermedium/aframe-environment-component/blob/4054f003ff4781b4ee6c4b3ae5071fd691831ccf/index.js#L959-L977
train
datproject/dat-node
index.js
checkIfExists
function checkIfExists () { // Create after we check for pre-sleep .dat stuff var createAfterValid = (createIfMissing && !errorIfExists) var missingError = new Error('Dat storage does not exist.') missingError.name = 'MissingError' var existsError = new Error('Dat storage already exists.') exis...
javascript
function checkIfExists () { // Create after we check for pre-sleep .dat stuff var createAfterValid = (createIfMissing && !errorIfExists) var missingError = new Error('Dat storage does not exist.') missingError.name = 'MissingError' var existsError = new Error('Dat storage already exists.') exis...
[ "function", "checkIfExists", "(", ")", "{", "// Create after we check for pre-sleep .dat stuff", "var", "createAfterValid", "=", "(", "createIfMissing", "&&", "!", "errorIfExists", ")", "var", "missingError", "=", "new", "Error", "(", "'Dat storage does not exist.'", ")",...
Check if archive storage folder exists. @private
[ "Check", "if", "archive", "storage", "folder", "exists", "." ]
c5f377309ead92cbef57f726795e2d85e0720b24
https://github.com/datproject/dat-node/blob/c5f377309ead92cbef57f726795e2d85e0720b24/index.js#L52-L78
train
datproject/dat-node
lib/storage.js
defaultStorage
function defaultStorage (storage, opts) { // Use custom storage or ram if (typeof storage !== 'string') return storage if (opts.temp) return ram if (opts.latest === false) { // Store as SLEEP files inluding content.data return { metadata: function (name, opts) { // I don't think we want th...
javascript
function defaultStorage (storage, opts) { // Use custom storage or ram if (typeof storage !== 'string') return storage if (opts.temp) return ram if (opts.latest === false) { // Store as SLEEP files inluding content.data return { metadata: function (name, opts) { // I don't think we want th...
[ "function", "defaultStorage", "(", "storage", ",", "opts", ")", "{", "// Use custom storage or ram", "if", "(", "typeof", "storage", "!==", "'string'", ")", "return", "storage", "if", "(", "opts", ".", "temp", ")", "return", "ram", "if", "(", "opts", ".", ...
Parse the storage argument and return storage for hyperdrive. By default, uses dat-secret-storage to storage secret keys in user's home directory. @param {string|object} storage - Storage for hyperdrive. `string` is a directory or file. Directory: `/my-data`, storage will be in `/my-data/.dat`. Single File: `/my-file.z...
[ "Parse", "the", "storage", "argument", "and", "return", "storage", "for", "hyperdrive", ".", "By", "default", "uses", "dat", "-", "secret", "-", "storage", "to", "storage", "secret", "keys", "in", "user", "s", "home", "directory", "." ]
c5f377309ead92cbef57f726795e2d85e0720b24
https://github.com/datproject/dat-node/blob/c5f377309ead92cbef57f726795e2d85e0720b24/lib/storage.js#L21-L60
train
gka/d3-jetpack
src/polygonClip.js
polygonClosed
function polygonClosed(coordinates) { var a = coordinates[0], b = coordinates[coordinates.length - 1]; return !(a[0] - b[0] || a[1] - b[1]); }
javascript
function polygonClosed(coordinates) { var a = coordinates[0], b = coordinates[coordinates.length - 1]; return !(a[0] - b[0] || a[1] - b[1]); }
[ "function", "polygonClosed", "(", "coordinates", ")", "{", "var", "a", "=", "coordinates", "[", "0", "]", ",", "b", "=", "coordinates", "[", "coordinates", ".", "length", "-", "1", "]", ";", "return", "!", "(", "a", "[", "0", "]", "-", "b", "[", ...
Returns true if the polygon is closed.
[ "Returns", "true", "if", "the", "polygon", "is", "closed", "." ]
2f68acf9805650bed7bd21aa293d32709f36833c
https://github.com/gka/d3-jetpack/blob/2f68acf9805650bed7bd21aa293d32709f36833c/src/polygonClip.js#L54-L58
train
krispo/angular-nvd3
dist/angular-nvd3.js
function (data){ // set data if (!arguments.length) { if (scope.options.chart.type === 'sunburstChart') { data = angular.copy(scope.data); } else { ...
javascript
function (data){ // set data if (!arguments.length) { if (scope.options.chart.type === 'sunburstChart') { data = angular.copy(scope.data); } else { ...
[ "function", "(", "data", ")", "{", "// set data", "if", "(", "!", "arguments", ".", "length", ")", "{", "if", "(", "scope", ".", "options", ".", "chart", ".", "type", "===", "'sunburstChart'", ")", "{", "data", "=", "angular", ".", "copy", "(", "scop...
Update chart with new data
[ "Update", "chart", "with", "new", "data" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L237-L276
train
krispo/angular-nvd3
dist/angular-nvd3.js
function (){ element.find('.title').remove(); element.find('.subtitle').remove(); element.find('.caption').remove(); element.empty(); // remove tooltip if exists ...
javascript
function (){ element.find('.title').remove(); element.find('.subtitle').remove(); element.find('.caption').remove(); element.empty(); // remove tooltip if exists ...
[ "function", "(", ")", "{", "element", ".", "find", "(", "'.title'", ")", ".", "remove", "(", ")", ";", "element", ".", "find", "(", "'.subtitle'", ")", ".", "remove", "(", ")", ";", "element", ".", "find", "(", "'.caption'", ")", ".", "remove", "("...
Fully clear directive element
[ "Fully", "clear", "directive", "element" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L279-L303
train
krispo/angular-nvd3
dist/angular-nvd3.js
configure
function configure(chart, options, chartType){ if (chart && options){ angular.forEach(chart, function(value, key){ if (key[0] === '_'); else if (key === 'dispatch') { i...
javascript
function configure(chart, options, chartType){ if (chart && options){ angular.forEach(chart, function(value, key){ if (key[0] === '_'); else if (key === 'dispatch') { i...
[ "function", "configure", "(", "chart", ",", "options", ",", "chartType", ")", "{", "if", "(", "chart", "&&", "options", ")", "{", "angular", ".", "forEach", "(", "chart", ",", "function", "(", "value", ",", "key", ")", "{", "if", "(", "key", "[", "...
Configure the chart model with the passed options
[ "Configure", "the", "chart", "model", "with", "the", "passed", "options" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L313-L353
train
krispo/angular-nvd3
dist/angular-nvd3.js
configureWrapper
function configureWrapper(name){ var _ = nvd3Utils.deepExtend(defaultWrapper(name), scope.options[name] || {}); if (scope._config.extended) scope.options[name] = _; var wrapElement = angular.element('<div></div>').html(_['html'] || '') ...
javascript
function configureWrapper(name){ var _ = nvd3Utils.deepExtend(defaultWrapper(name), scope.options[name] || {}); if (scope._config.extended) scope.options[name] = _; var wrapElement = angular.element('<div></div>').html(_['html'] || '') ...
[ "function", "configureWrapper", "(", "name", ")", "{", "var", "_", "=", "nvd3Utils", ".", "deepExtend", "(", "defaultWrapper", "(", "name", ")", ",", "scope", ".", "options", "[", "name", "]", "||", "{", "}", ")", ";", "if", "(", "scope", ".", "_conf...
Configure 'title', 'subtitle', 'caption'. nvd3 has no sufficient models for it yet.
[ "Configure", "title", "subtitle", "caption", ".", "nvd3", "has", "no", "sufficient", "models", "for", "it", "yet", "." ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L370-L387
train
krispo/angular-nvd3
dist/angular-nvd3.js
configureStyles
function configureStyles(){ var _ = nvd3Utils.deepExtend(defaultStyles(), scope.options['styles'] || {}); if (scope._config.extended) scope.options['styles'] = _; angular.forEach(_.classes, function(value, key){ value ...
javascript
function configureStyles(){ var _ = nvd3Utils.deepExtend(defaultStyles(), scope.options['styles'] || {}); if (scope._config.extended) scope.options['styles'] = _; angular.forEach(_.classes, function(value, key){ value ...
[ "function", "configureStyles", "(", ")", "{", "var", "_", "=", "nvd3Utils", ".", "deepExtend", "(", "defaultStyles", "(", ")", ",", "scope", ".", "options", "[", "'styles'", "]", "||", "{", "}", ")", ";", "if", "(", "scope", ".", "_config", ".", "ext...
Add some styles to the whole directive element
[ "Add", "some", "styles", "to", "the", "whole", "directive", "element" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L390-L400
train
krispo/angular-nvd3
dist/angular-nvd3.js
defaultWrapper
function defaultWrapper(_){ switch (_){ case 'title': return { enable: false, text: 'Write Your Title', className: 'h4', css: { ...
javascript
function defaultWrapper(_){ switch (_){ case 'title': return { enable: false, text: 'Write Your Title', className: 'h4', css: { ...
[ "function", "defaultWrapper", "(", "_", ")", "{", "switch", "(", "_", ")", "{", "case", "'title'", ":", "return", "{", "enable", ":", "false", ",", "text", ":", "'Write Your Title'", ",", "className", ":", "'h4'", ",", "css", ":", "{", "width", ":", ...
Default values for 'title', 'subtitle', 'caption'
[ "Default", "values", "for", "title", "subtitle", "caption" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L403-L431
train
krispo/angular-nvd3
dist/angular-nvd3.js
dataWatchFn
function dataWatchFn(newData, oldData) { if (newData !== oldData){ if (!scope._config.disabled) { scope._config.refreshDataOnly ? scope.api.update() : scope.api.refresh(); // if wanted to refresh data only, use update method, otherwise ...
javascript
function dataWatchFn(newData, oldData) { if (newData !== oldData){ if (!scope._config.disabled) { scope._config.refreshDataOnly ? scope.api.update() : scope.api.refresh(); // if wanted to refresh data only, use update method, otherwise ...
[ "function", "dataWatchFn", "(", "newData", ",", "oldData", ")", "{", "if", "(", "newData", "!==", "oldData", ")", "{", "if", "(", "!", "scope", ".", "_config", ".", "disabled", ")", "{", "scope", ".", "_config", ".", "refreshDataOnly", "?", "scope", "....
Watching on data changing
[ "Watching", "on", "data", "changing" ]
19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8
https://github.com/krispo/angular-nvd3/blob/19e6d97d2db1f92e84a18e3980c2c4e3f6329ae8/dist/angular-nvd3.js#L454-L460
train
yaronn/xml-crypto
lib/signed-xml.js
FileKeyInfo
function FileKeyInfo(file) { this.file = file this.getKeyInfo = function(key, prefix) { prefix = prefix || '' prefix = prefix ? prefix + ':' : prefix return "<" + prefix + "X509Data></" + prefix + "X509Data>" } this.getKey = function(keyInfo) { return fs.readFileSync(this.file) } }
javascript
function FileKeyInfo(file) { this.file = file this.getKeyInfo = function(key, prefix) { prefix = prefix || '' prefix = prefix ? prefix + ':' : prefix return "<" + prefix + "X509Data></" + prefix + "X509Data>" } this.getKey = function(keyInfo) { return fs.readFileSync(this.file) } }
[ "function", "FileKeyInfo", "(", "file", ")", "{", "this", ".", "file", "=", "file", "this", ".", "getKeyInfo", "=", "function", "(", "key", ",", "prefix", ")", "{", "prefix", "=", "prefix", "||", "''", "prefix", "=", "prefix", "?", "prefix", "+", "':...
A key info provider implementation
[ "A", "key", "info", "provider", "implementation" ]
40bd9e8f8787c9c996572fe5937572506b9e43d1
https://github.com/yaronn/xml-crypto/blob/40bd9e8f8787c9c996572fe5937572506b9e43d1/lib/signed-xml.js#L17-L29
train
yaronn/xml-crypto
lib/signed-xml.js
RSASHA512
function RSASHA512() { /** * Sign the given string using the given key * */ this.getSignature = function(signedInfo, signingKey) { var signer = crypto.createSign("RSA-SHA512") signer.update(signedInfo) var res = signer.sign(signingKey, 'base64') return res } /** * Verify the given sign...
javascript
function RSASHA512() { /** * Sign the given string using the given key * */ this.getSignature = function(signedInfo, signingKey) { var signer = crypto.createSign("RSA-SHA512") signer.update(signedInfo) var res = signer.sign(signingKey, 'base64') return res } /** * Verify the given sign...
[ "function", "RSASHA512", "(", ")", "{", "/**\n * Sign the given string using the given key\n *\n */", "this", ".", "getSignature", "=", "function", "(", "signedInfo", ",", "signingKey", ")", "{", "var", "signer", "=", "crypto", ".", "createSign", "(", "\"RSA-SHA512...
Signature algorithm implementation
[ "Signature", "algorithm", "implementation" ]
40bd9e8f8787c9c996572fe5937572506b9e43d1
https://github.com/yaronn/xml-crypto/blob/40bd9e8f8787c9c996572fe5937572506b9e43d1/lib/signed-xml.js#L151-L178
train
yaronn/xml-crypto
lib/signed-xml.js
findAncestorNs
function findAncestorNs(doc, docSubsetXpath){ var docSubset = xpath.select(docSubsetXpath, doc); if(!Array.isArray(docSubset) || docSubset.length < 1){ return []; } // Remove duplicate on ancestor namespace var ancestorNs = collectAncestorNamespaces(docSubset[0]); var ancestorNsWithoutDuplicate = ...
javascript
function findAncestorNs(doc, docSubsetXpath){ var docSubset = xpath.select(docSubsetXpath, doc); if(!Array.isArray(docSubset) || docSubset.length < 1){ return []; } // Remove duplicate on ancestor namespace var ancestorNs = collectAncestorNamespaces(docSubset[0]); var ancestorNsWithoutDuplicate = ...
[ "function", "findAncestorNs", "(", "doc", ",", "docSubsetXpath", ")", "{", "var", "docSubset", "=", "xpath", ".", "select", "(", "docSubsetXpath", ",", "doc", ")", ";", "if", "(", "!", "Array", ".", "isArray", "(", "docSubset", ")", "||", "docSubset", "....
Extract ancestor namespaces in order to import it to root of document subset which is being canonicalized for non-exclusive c14n. @param {object} doc - Usually a product from `new DOMParser().parseFromString()` @param {string} docSubsetXpath - xpath query to get document subset being canonicalized @returns {Array} i.e...
[ "Extract", "ancestor", "namespaces", "in", "order", "to", "import", "it", "to", "root", "of", "document", "subset", "which", "is", "being", "canonicalized", "for", "non", "-", "exclusive", "c14n", "." ]
40bd9e8f8787c9c996572fe5937572506b9e43d1
https://github.com/yaronn/xml-crypto/blob/40bd9e8f8787c9c996572fe5937572506b9e43d1/lib/signed-xml.js#L210-L255
train
yaronn/xml-crypto
lib/signed-xml.js
SignedXml
function SignedXml(idMode, options) { this.options = options || {}; this.idMode = idMode this.references = [] this.id = 0 this.signingKey = null this.signatureAlgorithm = this.options.signatureAlgorithm || "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; this.keyInfoProvider = null this.canonicalizationAlg...
javascript
function SignedXml(idMode, options) { this.options = options || {}; this.idMode = idMode this.references = [] this.id = 0 this.signingKey = null this.signatureAlgorithm = this.options.signatureAlgorithm || "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; this.keyInfoProvider = null this.canonicalizationAlg...
[ "function", "SignedXml", "(", "idMode", ",", "options", ")", "{", "this", ".", "options", "=", "options", "||", "{", "}", ";", "this", ".", "idMode", "=", "idMode", "this", ".", "references", "=", "[", "]", "this", ".", "id", "=", "0", "this", ".",...
Xml signature implementation @param {string} idMode. Value of "wssecurity" will create/validate id's with the ws-security namespace @param {object} options. Initial configurations
[ "Xml", "signature", "implementation" ]
40bd9e8f8787c9c996572fe5937572506b9e43d1
https://github.com/yaronn/xml-crypto/blob/40bd9e8f8787c9c996572fe5937572506b9e43d1/lib/signed-xml.js#L288-L307
train
susielu/d3-annotation
indexRollupNext.js
wrap
function wrap(text, width, wrapSplitter) { var lineHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.2; text.each(function () { var text = select(this), words = text.text().split(wrapSplitter || /[ \t\r\n]+/).reverse().filter(function (w) { return w !== ""; }); ...
javascript
function wrap(text, width, wrapSplitter) { var lineHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.2; text.each(function () { var text = select(this), words = text.text().split(wrapSplitter || /[ \t\r\n]+/).reverse().filter(function (w) { return w !== ""; }); ...
[ "function", "wrap", "(", "text", ",", "width", ",", "wrapSplitter", ")", "{", "var", "lineHeight", "=", "arguments", ".", "length", ">", "3", "&&", "arguments", "[", "3", "]", "!==", "undefined", "?", "arguments", "[", "3", "]", ":", "1.2", ";", "tex...
Text wrapping code adapted from Mike Bostock
[ "Text", "wrapping", "code", "adapted", "from", "Mike", "Bostock" ]
5279464dfac828443988d4b2695beff46b02618d
https://github.com/susielu/d3-annotation/blob/5279464dfac828443988d4b2695beff46b02618d/indexRollupNext.js#L1862-L1885
train
siddii/angular-timer
bower_components/angular-scenario/jstd-scenario-adapter.js
JstdPlugin
function JstdPlugin() { var nop = function() {}; this.reportResult = nop; this.reportEnd = nop; this.runScenario = nop; this.name = 'Angular Scenario Adapter'; /** * Called for each JSTD TestCase * * Handles only SCENARIO_TYPE test cases. There should be only one fake TestCase. * Runs all sce...
javascript
function JstdPlugin() { var nop = function() {}; this.reportResult = nop; this.reportEnd = nop; this.runScenario = nop; this.name = 'Angular Scenario Adapter'; /** * Called for each JSTD TestCase * * Handles only SCENARIO_TYPE test cases. There should be only one fake TestCase. * Runs all sce...
[ "function", "JstdPlugin", "(", ")", "{", "var", "nop", "=", "function", "(", ")", "{", "}", ";", "this", ".", "reportResult", "=", "nop", ";", "this", ".", "reportEnd", "=", "nop", ";", "this", ".", "runScenario", "=", "nop", ";", "this", ".", "nam...
Plugin for JSTestDriver Connection point between scenario's jstd output and jstestdriver. @see jstestdriver.PluginRegistrar
[ "Plugin", "for", "JSTestDriver", "Connection", "point", "between", "scenario", "s", "jstd", "output", "and", "jstestdriver", "." ]
d58fbf8c3325f63e1fdb250ed1f1a0676c8344de
https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/angular-scenario/jstd-scenario-adapter.js#L58-L96
train
siddii/angular-timer
bower_components/jquery/src/css.js
css_defaultDisplay
function css_defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible ifra...
javascript
function css_defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible ifra...
[ "function", "css_defaultDisplay", "(", "nodeName", ")", "{", "var", "doc", "=", "document", ",", "display", "=", "elemdisplay", "[", "nodeName", "]", ";", "if", "(", "!", "display", ")", "{", "display", "=", "actualDisplay", "(", "nodeName", ",", "doc", ...
Try to determine the default display value of an element
[ "Try", "to", "determine", "the", "default", "display", "value", "of", "an", "element" ]
d58fbf8c3325f63e1fdb250ed1f1a0676c8344de
https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/jquery/src/css.js#L418-L447
train
siddii/angular-timer
bower_components/jquery/src/css.js
actualDisplay
function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[0], "display" ); elem.remove(); return display; }
javascript
function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[0], "display" ); elem.remove(); return display; }
[ "function", "actualDisplay", "(", "name", ",", "doc", ")", "{", "var", "elem", "=", "jQuery", "(", "doc", ".", "createElement", "(", "name", ")", ")", ".", "appendTo", "(", "doc", ".", "body", ")", ",", "display", "=", "jQuery", ".", "css", "(", "e...
Called ONLY from within css_defaultDisplay
[ "Called", "ONLY", "from", "within", "css_defaultDisplay" ]
d58fbf8c3325f63e1fdb250ed1f1a0676c8344de
https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/jquery/src/css.js#L450-L455
train
siddii/angular-timer
bower_components/jquery/src/core.js
function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf("use strict") === 1 ) { script = document.createE...
javascript
function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf("use strict") === 1 ) { script = document.createE...
[ "function", "(", "code", ")", "{", "var", "script", ",", "indirect", "=", "eval", ";", "code", "=", "jQuery", ".", "trim", "(", "code", ")", ";", "if", "(", "code", ")", "{", "// If the code includes a valid, prologue position", "// strict mode pragma, execute c...
Evaluates a script in a global context
[ "Evaluates", "a", "script", "in", "a", "global", "context" ]
d58fbf8c3325f63e1fdb250ed1f1a0676c8344de
https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/jquery/src/core.js#L508-L528
train
siddii/angular-timer
bower_components/jquery/speed/benchmark.js
benchmark
function benchmark(fn, times, name){ fn = fn.toString(); var s = fn.indexOf('{')+1, e = fn.lastIndexOf('}'); fn = fn.substring(s,e); return benchmarkString(fn, times, name); }
javascript
function benchmark(fn, times, name){ fn = fn.toString(); var s = fn.indexOf('{')+1, e = fn.lastIndexOf('}'); fn = fn.substring(s,e); return benchmarkString(fn, times, name); }
[ "function", "benchmark", "(", "fn", ",", "times", ",", "name", ")", "{", "fn", "=", "fn", ".", "toString", "(", ")", ";", "var", "s", "=", "fn", ".", "indexOf", "(", "'{'", ")", "+", "1", ",", "e", "=", "fn", ".", "lastIndexOf", "(", "'}'", "...
Runs a function many times without the function call overhead
[ "Runs", "a", "function", "many", "times", "without", "the", "function", "call", "overhead" ]
d58fbf8c3325f63e1fdb250ed1f1a0676c8344de
https://github.com/siddii/angular-timer/blob/d58fbf8c3325f63e1fdb250ed1f1a0676c8344de/bower_components/jquery/speed/benchmark.js#L2-L9
train