id
int32
0
58k
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
29,700
vseryakov/backendjs
lib/lib.js
function(t, utc, lang, tz) { return zeropad(utc ? t.getUTCMinutes() : t.getMinutes()) }
javascript
function(t, utc, lang, tz) { return zeropad(utc ? t.getUTCMinutes() : t.getMinutes()) }
[ "function", "(", "t", ",", "utc", ",", "lang", ",", "tz", ")", "{", "return", "zeropad", "(", "utc", "?", "t", ".", "getUTCMinutes", "(", ")", ":", "t", ".", "getMinutes", "(", ")", ")", "}" ]
month-1
[ "month", "-", "1" ]
7c7570a5343608912a47971f49340e2b28ce3935
https://github.com/vseryakov/backendjs/blob/7c7570a5343608912a47971f49340e2b28ce3935/lib/lib.js#L2536-L2538
29,701
vseryakov/backendjs
lib/lib.js
_parse
function _parse(type, obj, options) { if (!obj) return _checkResult(type, lib.newError("empty " + type), obj, options); try { obj = _parseResult(type, obj, options); } catch(err) { obj = _checkResult(type, err, obj, options); } return obj; }
javascript
function _parse(type, obj, options) { if (!obj) return _checkResult(type, lib.newError("empty " + type), obj, options); try { obj = _parseResult(type, obj, options); } catch(err) { obj = _checkResult(type, err, obj, options); } return obj; }
[ "function", "_parse", "(", "type", ",", "obj", ",", "options", ")", "{", "if", "(", "!", "obj", ")", "return", "_checkResult", "(", "type", ",", "lib", ".", "newError", "(", "\"empty \"", "+", "type", ")", ",", "obj", ",", "options", ")", ";", "try...
Combined parser with type validation
[ "Combined", "parser", "with", "type", "validation" ]
7c7570a5343608912a47971f49340e2b28ce3935
https://github.com/vseryakov/backendjs/blob/7c7570a5343608912a47971f49340e2b28ce3935/lib/lib.js#L3951-L3960
29,702
vseryakov/backendjs
lib/lib.js
_checkResult
function _checkResult(type, err, obj, options) { if (options) { if (options.logger) logger.logger(options.logger, 'parse:', type, options, lib.traceError(err), obj); if (options.datatype == "object" || options.datatype == "obj") return {}; if (options.datatype == "list") return []; i...
javascript
function _checkResult(type, err, obj, options) { if (options) { if (options.logger) logger.logger(options.logger, 'parse:', type, options, lib.traceError(err), obj); if (options.datatype == "object" || options.datatype == "obj") return {}; if (options.datatype == "list") return []; i...
[ "function", "_checkResult", "(", "type", ",", "err", ",", "obj", ",", "options", ")", "{", "if", "(", "options", ")", "{", "if", "(", "options", ".", "logger", ")", "logger", ".", "logger", "(", "options", ".", "logger", ",", "'parse:'", ",", "type",...
Perform validation of the result type, make sure we return what is expected, this is a helper that is used by other conversion routines
[ "Perform", "validation", "of", "the", "result", "type", "make", "sure", "we", "return", "what", "is", "expected", "this", "is", "a", "helper", "that", "is", "used", "by", "other", "conversion", "routines" ]
7c7570a5343608912a47971f49340e2b28ce3935
https://github.com/vseryakov/backendjs/blob/7c7570a5343608912a47971f49340e2b28ce3935/lib/lib.js#L3996-L4005
29,703
metascript/metascript
lib/mjs.js
getConfig
function getConfig(fpath, defaults) { var path = require('path'); var dpath = path.dirname(path.resolve(fpath)); function parentpath(fromdir, pattern) { var pp = require('parentpath'), cwd = process.cwd(); try { process.chdir(fromdir); return pp.sync(pattern); } catch (e) { ...
javascript
function getConfig(fpath, defaults) { var path = require('path'); var dpath = path.dirname(path.resolve(fpath)); function parentpath(fromdir, pattern) { var pp = require('parentpath'), cwd = process.cwd(); try { process.chdir(fromdir); return pp.sync(pattern); } catch (e) { ...
[ "function", "getConfig", "(", "fpath", ",", "defaults", ")", "{", "var", "path", "=", "require", "(", "'path'", ")", ";", "var", "dpath", "=", "path", ".", "dirname", "(", "path", ".", "resolve", "(", "fpath", ")", ")", ";", "function", "parentpath", ...
Get configuration from NPM package or from resource files
[ "Get", "configuration", "from", "NPM", "package", "or", "from", "resource", "files" ]
68ab8609d101359a88c0f7aff5e7e8ea213e378d
https://github.com/metascript/metascript/blob/68ab8609d101359a88c0f7aff5e7e8ea213e378d/lib/mjs.js#L185-L245
29,704
godmodelabs/flora
lib/config-loader.js
walk
function walk(configDirectory, resourceName, resources) { resourceName = resourceName || ''; resources = resources || {}; fs.readdirSync(path.join(configDirectory, resourceName)).forEach(fileName => { const subResourceName = (resourceName !== '' ? resourceName + '/' : '') + fileName; const ...
javascript
function walk(configDirectory, resourceName, resources) { resourceName = resourceName || ''; resources = resources || {}; fs.readdirSync(path.join(configDirectory, resourceName)).forEach(fileName => { const subResourceName = (resourceName !== '' ? resourceName + '/' : '') + fileName; const ...
[ "function", "walk", "(", "configDirectory", ",", "resourceName", ",", "resources", ")", "{", "resourceName", "=", "resourceName", "||", "''", ";", "resources", "=", "resources", "||", "{", "}", ";", "fs", ".", "readdirSync", "(", "path", ".", "join", "(", ...
Read config files from directory recursively. @param {string} configDirectory @param {string} resourceName @param {object} resources @return {Array} @private
[ "Read", "config", "files", "from", "directory", "recursively", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-loader.js#L16-L39
29,705
alibaba/ots
lib/client.js
Client
function Client(options) { this.accessID = options.accessID; this.accessKey = options.accessKey; this.signatureMethod = options.signatureMethod || 'HmacSHA1'; this.signatureVersion = options.signatureVersion || '1'; this.APIVersion = options.APIVersion || '2013-05-10'; this.APIHost = options.APIHost || 'htt...
javascript
function Client(options) { this.accessID = options.accessID; this.accessKey = options.accessKey; this.signatureMethod = options.signatureMethod || 'HmacSHA1'; this.signatureVersion = options.signatureVersion || '1'; this.APIVersion = options.APIVersion || '2013-05-10'; this.APIHost = options.APIHost || 'htt...
[ "function", "Client", "(", "options", ")", "{", "this", ".", "accessID", "=", "options", ".", "accessID", ";", "this", ".", "accessKey", "=", "options", ".", "accessKey", ";", "this", ".", "signatureMethod", "=", "options", ".", "signatureMethod", "||", "'...
OTS Client. @param {Object} options - {String} accessID - {String} accessKey - {Number} [requestTimeout], default 5000ms. - {Agent} [http] request agent, default is `urllib.agent`. - {Number} [dnsCacheTime] dns cache time, default is `10000 ms`. - {String} [APIVersion] api version, default is '2013-05-10'. - {String} ...
[ "OTS", "Client", "." ]
7875e6dde241fcbe53dd7bb00259075d4269fd37
https://github.com/alibaba/ots/blob/7875e6dde241fcbe53dd7bb00259075d4269fd37/lib/client.js#L108-L124
29,706
godmodelabs/flora
lib/xml-reader.js
getDataSource
function getDataSource(node) { const config = Object.assign({}, copyXmlAttributes(node)); if (node.childNodes.length) { // parse datasource options for (let i = 0; i < node.childNodes.length; ++i) { const childNode = node.childNodes.item(i); if (childNode.nodeType === T...
javascript
function getDataSource(node) { const config = Object.assign({}, copyXmlAttributes(node)); if (node.childNodes.length) { // parse datasource options for (let i = 0; i < node.childNodes.length; ++i) { const childNode = node.childNodes.item(i); if (childNode.nodeType === T...
[ "function", "getDataSource", "(", "node", ")", "{", "const", "config", "=", "Object", ".", "assign", "(", "{", "}", ",", "copyXmlAttributes", "(", "node", ")", ")", ";", "if", "(", "node", ".", "childNodes", ".", "length", ")", "{", "// parse datasource ...
Extract config from dataSource nodes. @param {Node} node @return {Object} @private
[ "Extract", "config", "from", "dataSource", "nodes", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/xml-reader.js#L60-L93
29,707
godmodelabs/flora
lib/xml-reader.js
parse
function parse(node) { const cfg = Object.assign({}, copyXmlAttributes(node)); for (let i = 0, l = node.childNodes.length; i < l; ++i) { const el = node.childNodes.item(i); if (el.nodeType === ELEMENT_NODE) { if (!el.namespaceURI) { // attribute elements ...
javascript
function parse(node) { const cfg = Object.assign({}, copyXmlAttributes(node)); for (let i = 0, l = node.childNodes.length; i < l; ++i) { const el = node.childNodes.item(i); if (el.nodeType === ELEMENT_NODE) { if (!el.namespaceURI) { // attribute elements ...
[ "function", "parse", "(", "node", ")", "{", "const", "cfg", "=", "Object", ".", "assign", "(", "{", "}", ",", "copyXmlAttributes", "(", "node", ")", ")", ";", "for", "(", "let", "i", "=", "0", ",", "l", "=", "node", ".", "childNodes", ".", "lengt...
Return DataSources, attributes and sub-resources as plain JS object. @param {Node} node @return {Object} @private
[ "Return", "DataSources", "attributes", "and", "sub", "-", "resources", "as", "plain", "JS", "object", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/xml-reader.js#L102-L133
29,708
godmodelabs/flora
lib/result-builder.js
getAttribute
function getAttribute(path, attrNode) { path.forEach(attrName => { if (!(attrNode.attributes && attrNode.attributes[attrName])) { throw new ImplementationError(`Result-Builder: Unknown attribute "${path.join('.')}"`); } attrNode = attrNode.attributes[attrName]; }); return...
javascript
function getAttribute(path, attrNode) { path.forEach(attrName => { if (!(attrNode.attributes && attrNode.attributes[attrName])) { throw new ImplementationError(`Result-Builder: Unknown attribute "${path.join('.')}"`); } attrNode = attrNode.attributes[attrName]; }); return...
[ "function", "getAttribute", "(", "path", ",", "attrNode", ")", "{", "path", ".", "forEach", "(", "attrName", "=>", "{", "if", "(", "!", "(", "attrNode", ".", "attributes", "&&", "attrNode", ".", "attributes", "[", "attrName", "]", ")", ")", "{", "throw...
Resolve attribute path relative to attrNode and return child attrNode @param {Array} path Array of attribute-names representing the path @param {Object} attrNode Root node where to start resolving @private
[ "Resolve", "attribute", "path", "relative", "to", "attrNode", "and", "return", "child", "attrNode" ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/result-builder.js#L14-L22
29,709
godmodelabs/flora
lib/result-builder.js
preprocessRawResults
function preprocessRawResults(rawResults, resolvedConfig) { rawResults.forEach((rawResult, resultId) => { if (!rawResult.attributePath) return; // e.g. sub-filter results don't need indexing // link resultIds into attribute tree (per DataSource): const attrNode = getAttribute(rawResult.attr...
javascript
function preprocessRawResults(rawResults, resolvedConfig) { rawResults.forEach((rawResult, resultId) => { if (!rawResult.attributePath) return; // e.g. sub-filter results don't need indexing // link resultIds into attribute tree (per DataSource): const attrNode = getAttribute(rawResult.attr...
[ "function", "preprocessRawResults", "(", "rawResults", ",", "resolvedConfig", ")", "{", "rawResults", ".", "forEach", "(", "(", "rawResult", ",", "resultId", ")", "=>", "{", "if", "(", "!", "rawResult", ".", "attributePath", ")", "return", ";", "// e.g. sub-fi...
Link resultIds into attribute tree and index rows by key. @private
[ "Link", "resultIds", "into", "attribute", "tree", "and", "index", "rows", "by", "key", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/result-builder.js#L29-L79
29,710
godmodelabs/flora
lib/config-parser.js
parseNode
function parseNode(attrNode, parsers, context) { const attrNames = Object.keys(attrNode); const errorContext = context.errorContext; Object.keys(parsers).forEach(attrName => { const parser = parsers[attrName]; context.errorContext = ` (option "${attrName}"${errorContext})`; removeV...
javascript
function parseNode(attrNode, parsers, context) { const attrNames = Object.keys(attrNode); const errorContext = context.errorContext; Object.keys(parsers).forEach(attrName => { const parser = parsers[attrName]; context.errorContext = ` (option "${attrName}"${errorContext})`; removeV...
[ "function", "parseNode", "(", "attrNode", ",", "parsers", ",", "context", ")", "{", "const", "attrNames", "=", "Object", ".", "keys", "(", "attrNode", ")", ";", "const", "errorContext", "=", "context", ".", "errorContext", ";", "Object", ".", "keys", "(", ...
Meta function which calls the defined parsers for current node and fails on additionally defined options. @private
[ "Meta", "function", "which", "calls", "the", "defined", "parsers", "for", "current", "node", "and", "fails", "on", "additionally", "defined", "options", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L39-L59
29,711
godmodelabs/flora
lib/config-parser.js
checkIdentifier
function checkIdentifier(str, context) { if (!/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(str)) { throw new ImplementationError(`Invalid identifier "${str}"${context.errorContext}`); } return str; }
javascript
function checkIdentifier(str, context) { if (!/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(str)) { throw new ImplementationError(`Invalid identifier "${str}"${context.errorContext}`); } return str; }
[ "function", "checkIdentifier", "(", "str", ",", "context", ")", "{", "if", "(", "!", "/", "^[a-zA-Z_][a-zA-Z_0-9]*$", "/", ".", "test", "(", "str", ")", ")", "{", "throw", "new", "ImplementationError", "(", "`", "${", "str", "}", "${", "context", ".", ...
Generates an error for invalid identifier strings. Identifiers contain letters, numbers and underscore - and do not start with a number. @private
[ "Generates", "an", "error", "for", "invalid", "identifier", "strings", ".", "Identifiers", "contain", "letters", "numbers", "and", "underscore", "-", "and", "do", "not", "start", "with", "a", "number", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L67-L72
29,712
godmodelabs/flora
lib/config-parser.js
parseAttributePath
function parseAttributePath(attrPath, context) { const parsed = attrPath.split('.'); parsed.forEach(item => checkIdentifier(item, context)); return parsed; }
javascript
function parseAttributePath(attrPath, context) { const parsed = attrPath.split('.'); parsed.forEach(item => checkIdentifier(item, context)); return parsed; }
[ "function", "parseAttributePath", "(", "attrPath", ",", "context", ")", "{", "const", "parsed", "=", "attrPath", ".", "split", "(", "'.'", ")", ";", "parsed", ".", "forEach", "(", "item", "=>", "checkIdentifier", "(", "item", ",", "context", ")", ")", ";...
Parses "id", "meta.id". @private
[ "Parses", "id", "meta", ".", "id", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L79-L83
29,713
godmodelabs/flora
lib/config-parser.js
parsePrimaryKey
function parsePrimaryKey(attrPathList, context) { return attrPathList.split(',').map(attrPath => parseAttributePath(attrPath, context)); }
javascript
function parsePrimaryKey(attrPathList, context) { return attrPathList.split(',').map(attrPath => parseAttributePath(attrPath, context)); }
[ "function", "parsePrimaryKey", "(", "attrPathList", ",", "context", ")", "{", "return", "attrPathList", ".", "split", "(", "','", ")", ".", "map", "(", "attrPath", "=>", "parseAttributePath", "(", "attrPath", ",", "context", ")", ")", ";", "}" ]
Parses "id", "meta.id,meta.context". @private
[ "Parses", "id", "meta", ".", "id", "meta", ".", "context", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L90-L92
29,714
godmodelabs/flora
lib/config-parser.js
checkWhitelist
function checkWhitelist(str, whitelist, context) { if (whitelist.indexOf(str) === -1) { throw new ImplementationError( 'Invalid "' + str + '" (allowed: ' + whitelist.join(', ') + ')' + context.errorContext ); } return str; }
javascript
function checkWhitelist(str, whitelist, context) { if (whitelist.indexOf(str) === -1) { throw new ImplementationError( 'Invalid "' + str + '" (allowed: ' + whitelist.join(', ') + ')' + context.errorContext ); } return str; }
[ "function", "checkWhitelist", "(", "str", ",", "whitelist", ",", "context", ")", "{", "if", "(", "whitelist", ".", "indexOf", "(", "str", ")", "===", "-", "1", ")", "{", "throw", "new", "ImplementationError", "(", "'Invalid \"'", "+", "str", "+", "'\" (a...
Validates string against whitelist. @private
[ "Validates", "string", "against", "whitelist", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L132-L139
29,715
godmodelabs/flora
lib/config-parser.js
parseList
function parseList(list, whitelist, context) { const parsed = list.split(','); parsed.forEach(item => checkWhitelist(item, whitelist, context)); return parsed; }
javascript
function parseList(list, whitelist, context) { const parsed = list.split(','); parsed.forEach(item => checkWhitelist(item, whitelist, context)); return parsed; }
[ "function", "parseList", "(", "list", ",", "whitelist", ",", "context", ")", "{", "const", "parsed", "=", "list", ".", "split", "(", "','", ")", ";", "parsed", ".", "forEach", "(", "item", "=>", "checkWhitelist", "(", "item", ",", "whitelist", ",", "co...
Parses a list of comma-separated strings and validates them against whitelist. @private
[ "Parses", "a", "list", "of", "comma", "-", "separated", "strings", "and", "validates", "them", "against", "whitelist", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L157-L161
29,716
godmodelabs/flora
lib/config-parser.js
parseBoolean
function parseBoolean(value, context) { if (value === true || value === 'true') return true; if (value === false || value === 'false') return false; throw new ImplementationError(`Invalid boolean value "${value}"${context.errorContext}`); }
javascript
function parseBoolean(value, context) { if (value === true || value === 'true') return true; if (value === false || value === 'false') return false; throw new ImplementationError(`Invalid boolean value "${value}"${context.errorContext}`); }
[ "function", "parseBoolean", "(", "value", ",", "context", ")", "{", "if", "(", "value", "===", "true", "||", "value", "===", "'true'", ")", "return", "true", ";", "if", "(", "value", "===", "false", "||", "value", "===", "'false'", ")", "return", "fals...
Parses "true", true, "false", false. @private
[ "Parses", "true", "true", "false", "false", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L205-L209
29,717
godmodelabs/flora
lib/config-parser.js
handleResourceContext
function handleResourceContext(attrNode, context) { let dataSource; let lastDataSourceName; const errorContext = context.errorContext; if (attrNode.resource) { if ('subFilters' in attrNode) { throw new ImplementationError( 'Adding subFilters for included sub-resourc...
javascript
function handleResourceContext(attrNode, context) { let dataSource; let lastDataSourceName; const errorContext = context.errorContext; if (attrNode.resource) { if ('subFilters' in attrNode) { throw new ImplementationError( 'Adding subFilters for included sub-resourc...
[ "function", "handleResourceContext", "(", "attrNode", ",", "context", ")", "{", "let", "dataSource", ";", "let", "lastDataSourceName", ";", "const", "errorContext", "=", "context", ".", "errorContext", ";", "if", "(", "attrNode", ".", "resource", ")", "{", "if...
Handle special cases and checks for options in resource context. @private
[ "Handle", "special", "cases", "and", "checks", "for", "options", "in", "resource", "context", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L295-L376
29,718
godmodelabs/flora
lib/config-parser.js
handleAttributeContext
function handleAttributeContext(attrNode, context) { if (!attrNode.type && attrNode.inherit !== 'inherit') attrNode.type = 'string'; if (attrNode.map) { Object.keys(attrNode.map).forEach(mappingName => { const mapping = attrNode.map[mappingName]; Object.keys(mapping).forEach(da...
javascript
function handleAttributeContext(attrNode, context) { if (!attrNode.type && attrNode.inherit !== 'inherit') attrNode.type = 'string'; if (attrNode.map) { Object.keys(attrNode.map).forEach(mappingName => { const mapping = attrNode.map[mappingName]; Object.keys(mapping).forEach(da...
[ "function", "handleAttributeContext", "(", "attrNode", ",", "context", ")", "{", "if", "(", "!", "attrNode", ".", "type", "&&", "attrNode", ".", "inherit", "!==", "'inherit'", ")", "attrNode", ".", "type", "=", "'string'", ";", "if", "(", "attrNode", ".", ...
Handle special cases and checks for options in attribute context. @private
[ "Handle", "special", "cases", "and", "checks", "for", "options", "in", "attribute", "context", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L383-L407
29,719
godmodelabs/flora
lib/config-parser.js
resolveKey
function resolveKey(key, attrNode, options, context) { const resolvedKey = {}; key.forEach(keyAttrPath => { const keyAttrNode = getLocalAttribute(keyAttrPath, attrNode, context); if (keyAttrNode.multiValued) { if (!options.allowMultiValued) { throw new Implementatio...
javascript
function resolveKey(key, attrNode, options, context) { const resolvedKey = {}; key.forEach(keyAttrPath => { const keyAttrNode = getLocalAttribute(keyAttrPath, attrNode, context); if (keyAttrNode.multiValued) { if (!options.allowMultiValued) { throw new Implementatio...
[ "function", "resolveKey", "(", "key", ",", "attrNode", ",", "options", ",", "context", ")", "{", "const", "resolvedKey", "=", "{", "}", ";", "key", ".", "forEach", "(", "keyAttrPath", "=>", "{", "const", "keyAttrNode", "=", "getLocalAttribute", "(", "keyAt...
Resolve key attributes per DataSource. @private
[ "Resolve", "key", "attributes", "per", "DataSource", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L436-L487
29,720
godmodelabs/flora
lib/config-parser.js
resolvePrimaryKey
function resolvePrimaryKey(attrNode, context) { const errorContext = context.errorContext; context.errorContext = ' in primaryKey' + errorContext; const neededDataSources = []; Object.keys(attrNode.dataSources).forEach(dataSourceName => { if (attrNode.dataSources[dataSourceName].joinParentKey)...
javascript
function resolvePrimaryKey(attrNode, context) { const errorContext = context.errorContext; context.errorContext = ' in primaryKey' + errorContext; const neededDataSources = []; Object.keys(attrNode.dataSources).forEach(dataSourceName => { if (attrNode.dataSources[dataSourceName].joinParentKey)...
[ "function", "resolvePrimaryKey", "(", "attrNode", ",", "context", ")", "{", "const", "errorContext", "=", "context", ".", "errorContext", ";", "context", ".", "errorContext", "=", "' in primaryKey'", "+", "errorContext", ";", "const", "neededDataSources", "=", "["...
Resolve primaryKey per DataSource and fail if not all DataSources have the complete primaryKey. Enable "equal" filter for visible non-composite primary keys by default. @private
[ "Resolve", "primaryKey", "per", "DataSource", "and", "fail", "if", "not", "all", "DataSources", "have", "the", "complete", "primaryKey", ".", "Enable", "equal", "filter", "for", "visible", "non", "-", "composite", "primary", "keys", "by", "default", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L663-L696
29,721
godmodelabs/flora
lib/config-parser.js
processNode
function processNode(attrNode, context) { const isMainResource = context.attrPath.length === 0; // identify/handle options-contexts: resource/sub-resource, nested-attribute, attribute: if (attrNode.dataSources || attrNode.resource || isMainResource) { context.errorContext = getErrorContext(isMainRe...
javascript
function processNode(attrNode, context) { const isMainResource = context.attrPath.length === 0; // identify/handle options-contexts: resource/sub-resource, nested-attribute, attribute: if (attrNode.dataSources || attrNode.resource || isMainResource) { context.errorContext = getErrorContext(isMainRe...
[ "function", "processNode", "(", "attrNode", ",", "context", ")", "{", "const", "isMainResource", "=", "context", ".", "attrPath", ".", "length", "===", "0", ";", "// identify/handle options-contexts: resource/sub-resource, nested-attribute, attribute:", "if", "(", "attrNo...
Recursive iteration over one resource. @param {Object} attrNode @param {Object} context @private
[ "Recursive", "iteration", "over", "one", "resource", "." ]
a723b860a75dc9e09e1a4e6115b8833e6c621a51
https://github.com/godmodelabs/flora/blob/a723b860a75dc9e09e1a4e6115b8833e6c621a51/lib/config-parser.js#L705-L822
29,722
vseryakov/backendjs
web/js/knockout-mapping.js
getPropertyName
function getPropertyName(parentName, parent, indexer) { var propertyName = parentName || ""; if (exports.getType(parent) === "array") { if (parentName) { propertyName += "[" + indexer + "]"; } } else { if (parentName) { propertyName += "."; } propertyName += indexer; } retur...
javascript
function getPropertyName(parentName, parent, indexer) { var propertyName = parentName || ""; if (exports.getType(parent) === "array") { if (parentName) { propertyName += "[" + indexer + "]"; } } else { if (parentName) { propertyName += "."; } propertyName += indexer; } retur...
[ "function", "getPropertyName", "(", "parentName", ",", "parent", ",", "indexer", ")", "{", "var", "propertyName", "=", "parentName", "||", "\"\"", ";", "if", "(", "exports", ".", "getType", "(", "parent", ")", "===", "\"array\"", ")", "{", "if", "(", "pa...
Based on the parentName, this creates a fully classified name of a property
[ "Based", "on", "the", "parentName", "this", "creates", "a", "fully", "classified", "name", "of", "a", "property" ]
7c7570a5343608912a47971f49340e2b28ce3935
https://github.com/vseryakov/backendjs/blob/7c7570a5343608912a47971f49340e2b28ce3935/web/js/knockout-mapping.js#L699-L712
29,723
vseryakov/backendjs
lib/aws_dynamodbstreams.js
deps
function deps(s, p) { if (!shards.map[p] || !shards.map[p].ParentShardId) return; shards.deps[s] = lib.toFlags("add", shards.deps[s], shards.map[p].ParentShardId); deps(s, shards.map[p].ParentShardId); }
javascript
function deps(s, p) { if (!shards.map[p] || !shards.map[p].ParentShardId) return; shards.deps[s] = lib.toFlags("add", shards.deps[s], shards.map[p].ParentShardId); deps(s, shards.map[p].ParentShardId); }
[ "function", "deps", "(", "s", ",", "p", ")", "{", "if", "(", "!", "shards", ".", "map", "[", "p", "]", "||", "!", "shards", ".", "map", "[", "p", "]", ".", "ParentShardId", ")", "return", ";", "shards", ".", "deps", "[", "s", "]", "=", "lib",...
For each shard keep all dependencies including parent's dependencies in one list for fast checks
[ "For", "each", "shard", "keep", "all", "dependencies", "including", "parent", "s", "dependencies", "in", "one", "list", "for", "fast", "checks" ]
7c7570a5343608912a47971f49340e2b28ce3935
https://github.com/vseryakov/backendjs/blob/7c7570a5343608912a47971f49340e2b28ce3935/lib/aws_dynamodbstreams.js#L217-L221
29,724
mattmcmanus/dox-foundation
lib/dox-foundation.js
buildStructureForFile
function buildStructureForFile(file) { var names = []; var targetLink; if (file.dox.length === 0) { return false; } file.dox.forEach(function(method){ if (method.ctx && !method.ignore) { names.push(method.ctx.name); } }); // How deep is your love? // If the splitted currentFile (the file we are cur...
javascript
function buildStructureForFile(file) { var names = []; var targetLink; if (file.dox.length === 0) { return false; } file.dox.forEach(function(method){ if (method.ctx && !method.ignore) { names.push(method.ctx.name); } }); // How deep is your love? // If the splitted currentFile (the file we are cur...
[ "function", "buildStructureForFile", "(", "file", ")", "{", "var", "names", "=", "[", "]", ";", "var", "targetLink", ";", "if", "(", "file", ".", "dox", ".", "length", "===", "0", ")", "{", "return", "false", ";", "}", "file", ".", "dox", ".", "for...
Return a list of methods for the side navigation @param {Object} file @return {Object} Object formatted for template nav helper @api private
[ "Return", "a", "list", "of", "methods", "for", "the", "side", "navigation" ]
1d3aee327c87cb6578781959c6f81d40cd6dbac1
https://github.com/mattmcmanus/dox-foundation/blob/1d3aee327c87cb6578781959c6f81d40cd6dbac1/lib/dox-foundation.js#L34-L69
29,725
mattdesl/ghrepo
cmd.js
commit
function commit(result) { var url = result.html_url //user opted not to commit anything if (argv.b || argv.bare) { return Promise.resolve(url) } return getMessage().then(function(message) { return gitCommit({ message: message, url: url + '.git' }).catch(function() { console.warn(...
javascript
function commit(result) { var url = result.html_url //user opted not to commit anything if (argv.b || argv.bare) { return Promise.resolve(url) } return getMessage().then(function(message) { return gitCommit({ message: message, url: url + '.git' }).catch(function() { console.warn(...
[ "function", "commit", "(", "result", ")", "{", "var", "url", "=", "result", ".", "html_url", "//user opted not to commit anything", "if", "(", "argv", ".", "b", "||", "argv", ".", "bare", ")", "{", "return", "Promise", ".", "resolve", "(", "url", ")", "}...
commits current working dir, resolves to html_url
[ "commits", "current", "working", "dir", "resolves", "to", "html_url" ]
1d993a9ed287f30e3e7f5edeaf6235785e4df739
https://github.com/mattdesl/ghrepo/blob/1d993a9ed287f30e3e7f5edeaf6235785e4df739/cmd.js#L111-L128
29,726
pixelunion/jquery.trend
jquery.trend.js
function(s) { s = s.replace(/\s/, ""); var v = window.parseFloat(s); return s.match(/[^m]s$/i) ? v * 1000 : v; }
javascript
function(s) { s = s.replace(/\s/, ""); var v = window.parseFloat(s); return s.match(/[^m]s$/i) ? v * 1000 : v; }
[ "function", "(", "s", ")", "{", "s", "=", "s", ".", "replace", "(", "/", "\\s", "/", ",", "\"\"", ")", ";", "var", "v", "=", "window", ".", "parseFloat", "(", "s", ")", ";", "return", "s", ".", "match", "(", "/", "[^m]s$", "/", "i", ")", "?...
Parses a CSS time value into milliseconds.
[ "Parses", "a", "CSS", "time", "value", "into", "milliseconds", "." ]
79b0d05692de78f6b5e2dbc0f90219d2e245687b
https://github.com/pixelunion/jquery.trend/blob/79b0d05692de78f6b5e2dbc0f90219d2e245687b/jquery.trend.js#L45-L52
29,727
pixelunion/jquery.trend
jquery.trend.js
function(el, properties) { var duration = 0; for (var i = 0; i < properties.length; i++) { // Get raw CSS value var value = el.css(properties[i]); if (!value) continue; // Multiple transitions--pick the longest if (value.indexOf(",") !== -1) { var values = value.split(","...
javascript
function(el, properties) { var duration = 0; for (var i = 0; i < properties.length; i++) { // Get raw CSS value var value = el.css(properties[i]); if (!value) continue; // Multiple transitions--pick the longest if (value.indexOf(",") !== -1) { var values = value.split(","...
[ "function", "(", "el", ",", "properties", ")", "{", "var", "duration", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "properties", ".", "length", ";", "i", "++", ")", "{", "// Get raw CSS value", "var", "value", "=", "el", ".", ...
Parses the longest time unit found in a series of CSS properties. Returns a value in milliseconds.
[ "Parses", "the", "longest", "time", "unit", "found", "in", "a", "series", "of", "CSS", "properties", ".", "Returns", "a", "value", "in", "milliseconds", "." ]
79b0d05692de78f6b5e2dbc0f90219d2e245687b
https://github.com/pixelunion/jquery.trend/blob/79b0d05692de78f6b5e2dbc0f90219d2e245687b/jquery.trend.js#L56-L89
29,728
pixelunion/jquery.trend
jquery.trend.js
function(handleObj) { var el = $(this); var fired = false; // Mark element as being in transition el.data("trend", true); // Calculate a fallback duration. + 20 because some browsers fire // timeouts faster than transitionend. var time = parseProperties(el, transition...
javascript
function(handleObj) { var el = $(this); var fired = false; // Mark element as being in transition el.data("trend", true); // Calculate a fallback duration. + 20 because some browsers fire // timeouts faster than transitionend. var time = parseProperties(el, transition...
[ "function", "(", "handleObj", ")", "{", "var", "el", "=", "$", "(", "this", ")", ";", "var", "fired", "=", "false", ";", "// Mark element as being in transition", "el", ".", "data", "(", "\"trend\"", ",", "true", ")", ";", "// Calculate a fallback duration. + ...
Triggers an event handler when an element is done transitioning. Handles browsers that don't support transitionend by adding a timeout with the transition duration.
[ "Triggers", "an", "event", "handler", "when", "an", "element", "is", "done", "transitioning", ".", "Handles", "browsers", "that", "don", "t", "support", "transitionend", "by", "adding", "a", "timeout", "with", "the", "transition", "duration", "." ]
79b0d05692de78f6b5e2dbc0f90219d2e245687b
https://github.com/pixelunion/jquery.trend/blob/79b0d05692de78f6b5e2dbc0f90219d2e245687b/jquery.trend.js#L96-L130
29,729
uptick/js-tinyapi
src/utils.js
ajax
function ajax( opts ) { const method = (opts.method || 'get').toUpperCase() const { url, body, contentType, extraHeaders, useBearer = true, bearer } = opts || {} let requestInit = { method, headers: fetchHeaders({ method, contentType, extraHeaders, useBea...
javascript
function ajax( opts ) { const method = (opts.method || 'get').toUpperCase() const { url, body, contentType, extraHeaders, useBearer = true, bearer } = opts || {} let requestInit = { method, headers: fetchHeaders({ method, contentType, extraHeaders, useBea...
[ "function", "ajax", "(", "opts", ")", "{", "const", "method", "=", "(", "opts", ".", "method", "||", "'get'", ")", ".", "toUpperCase", "(", ")", "const", "{", "url", ",", "body", ",", "contentType", ",", "extraHeaders", ",", "useBearer", "=", "true", ...
Perform an ajax request. Uses HTML5 fetch to perform an ajax request according to parameters supplied via the options object. @param {string} url - The URL to make the request to. @param {string} method - The request method. Defaults to "get". @param {string} body - Data to be sent with the request. @param {string} c...
[ "Perform", "an", "ajax", "request", "." ]
e70ce2f24b0c2dc7bb6c5441eecf284456b54697
https://github.com/uptick/js-tinyapi/blob/e70ce2f24b0c2dc7bb6c5441eecf284456b54697/src/utils.js#L165-L217
29,730
uptick/js-tinyapi
src/utils.js
postJson
function postJson({ url, payload, contentType, useBearer }) { return ajax({ url, method: 'post', body: JSON.stringify( payload || {} ), contentType, useBearer }) }
javascript
function postJson({ url, payload, contentType, useBearer }) { return ajax({ url, method: 'post', body: JSON.stringify( payload || {} ), contentType, useBearer }) }
[ "function", "postJson", "(", "{", "url", ",", "payload", ",", "contentType", ",", "useBearer", "}", ")", "{", "return", "ajax", "(", "{", "url", ",", "method", ":", "'post'", ",", "body", ":", "JSON", ".", "stringify", "(", "payload", "||", "{", "}",...
Post JSON data. @param {string} url - The URL to make the request to. @param {object} payload - Data to be sent with the request. @param {string} contentType - The content type of the request. Defaults to "application/json". @param {boolean} useBearer - Flag indicating whether to include bearer authorization.
[ "Post", "JSON", "data", "." ]
e70ce2f24b0c2dc7bb6c5441eecf284456b54697
https://github.com/uptick/js-tinyapi/blob/e70ce2f24b0c2dc7bb6c5441eecf284456b54697/src/utils.js#L267-L275
29,731
uptick/js-tinyapi
src/utils.js
makeFormData
function makeFormData( payload ) { let body = new FormData() for( let k in (payload || {}) ) { body.append( k, payload[k] ) } return body }
javascript
function makeFormData( payload ) { let body = new FormData() for( let k in (payload || {}) ) { body.append( k, payload[k] ) } return body }
[ "function", "makeFormData", "(", "payload", ")", "{", "let", "body", "=", "new", "FormData", "(", ")", "for", "(", "let", "k", "in", "(", "payload", "||", "{", "}", ")", ")", "{", "body", ".", "append", "(", "k", ",", "payload", "[", "k", "]", ...
Convert an object into HTML5 FormData.
[ "Convert", "an", "object", "into", "HTML5", "FormData", "." ]
e70ce2f24b0c2dc7bb6c5441eecf284456b54697
https://github.com/uptick/js-tinyapi/blob/e70ce2f24b0c2dc7bb6c5441eecf284456b54697/src/utils.js#L280-L286
29,732
uptick/js-tinyapi
src/utils.js
postForm
function postForm({ url, payload, useBearer }) { return ajax({ url, body: makeFormData( payload ), method: 'post', useBearer }) }
javascript
function postForm({ url, payload, useBearer }) { return ajax({ url, body: makeFormData( payload ), method: 'post', useBearer }) }
[ "function", "postForm", "(", "{", "url", ",", "payload", ",", "useBearer", "}", ")", "{", "return", "ajax", "(", "{", "url", ",", "body", ":", "makeFormData", "(", "payload", ")", ",", "method", ":", "'post'", ",", "useBearer", "}", ")", "}" ]
Post form data. @param {string} url - The URL to make the request to. @param {object} payload - Data to be sent with the request. @param {boolean} useBearer - Flag indicating whether to include bearer authorization.
[ "Post", "form", "data", "." ]
e70ce2f24b0c2dc7bb6c5441eecf284456b54697
https://github.com/uptick/js-tinyapi/blob/e70ce2f24b0c2dc7bb6c5441eecf284456b54697/src/utils.js#L295-L302
29,733
graphology/graphology-metrics
extent.js
nodeExtent
function nodeExtent(graph, attribute) { if (!isGraph(graph)) throw new Error('graphology-metrics/extent: the given graph is not a valid graphology instance.'); var attributes = [].concat(attribute); var nodes = graph.nodes(), node, data, value, key, a, i, l; var ...
javascript
function nodeExtent(graph, attribute) { if (!isGraph(graph)) throw new Error('graphology-metrics/extent: the given graph is not a valid graphology instance.'); var attributes = [].concat(attribute); var nodes = graph.nodes(), node, data, value, key, a, i, l; var ...
[ "function", "nodeExtent", "(", "graph", ",", "attribute", ")", "{", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graphology-metrics/extent: the given graph is not a valid graphology instance.'", ")", ";", "var", "attributes", "=...
Function returning the extent of the selected node attributes. @param {Graph} graph - Target graph. @param {string|array} attribute - Single or multiple attributes. @return {array|object}
[ "Function", "returning", "the", "extent", "of", "the", "selected", "node", "attributes", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/extent.js#L16-L56
29,734
graphology/graphology-metrics
extent.js
edgeExtent
function edgeExtent(graph, attribute) { if (!isGraph(graph)) throw new Error('graphology-metrics/extent: the given graph is not a valid graphology instance.'); var attributes = [].concat(attribute); var edges = graph.edges(), edge, data, value, key, a, i, l; var ...
javascript
function edgeExtent(graph, attribute) { if (!isGraph(graph)) throw new Error('graphology-metrics/extent: the given graph is not a valid graphology instance.'); var attributes = [].concat(attribute); var edges = graph.edges(), edge, data, value, key, a, i, l; var ...
[ "function", "edgeExtent", "(", "graph", ",", "attribute", ")", "{", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graphology-metrics/extent: the given graph is not a valid graphology instance.'", ")", ";", "var", "attributes", "=...
Function returning the extent of the selected edge attributes. @param {Graph} graph - Target graph. @param {string|array} attribute - Single or multiple attributes. @return {array|object}
[ "Function", "returning", "the", "extent", "of", "the", "selected", "edge", "attributes", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/extent.js#L65-L105
29,735
JCCDex/jcc_jingtum_base_lib
src/secp256k1.js
ScalarMultiple
function ScalarMultiple(bytes, discrim) { var order = ec.curve.n; for (var i = 0; i <= 0xFFFFFFFF; i++) { // We hash the bytes to find a 256 bit number, looping until we are sure it // is less than the order of the curve. var hasher = new Sha512().add(bytes); // If the optional discriminator index was passed ...
javascript
function ScalarMultiple(bytes, discrim) { var order = ec.curve.n; for (var i = 0; i <= 0xFFFFFFFF; i++) { // We hash the bytes to find a 256 bit number, looping until we are sure it // is less than the order of the curve. var hasher = new Sha512().add(bytes); // If the optional discriminator index was passed ...
[ "function", "ScalarMultiple", "(", "bytes", ",", "discrim", ")", "{", "var", "order", "=", "ec", ".", "curve", ".", "n", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<=", "0xFFFFFFFF", ";", "i", "++", ")", "{", "// We hash the bytes to find a 256 ...
Scalar multiplication to find one 256 bit number where it is less than the order of the curve. @param bytes @param discrim @returns {*} @constructor
[ "Scalar", "multiplication", "to", "find", "one", "256", "bit", "number", "where", "it", "is", "less", "than", "the", "order", "of", "the", "curve", "." ]
ace3cb56fcfa33372238e5f1bb06b9a58f98f889
https://github.com/JCCDex/jcc_jingtum_base_lib/blob/ace3cb56fcfa33372238e5f1bb06b9a58f98f889/src/secp256k1.js#L14-L34
29,736
midknight41/map-factory
src/lib/object-mapper/get-key-value.js
getValue
function getValue(fromObject, fromKey) { var regDot = /\./g , regFinishArray = /.+(\[\])/g , keys , key , result , lastValue ; keys = fromKey.split(regDot); key = keys.splice(0, 1); result = _getValue(fromObject, key[0], keys); return handleArrayOfUndefined_(result); }
javascript
function getValue(fromObject, fromKey) { var regDot = /\./g , regFinishArray = /.+(\[\])/g , keys , key , result , lastValue ; keys = fromKey.split(regDot); key = keys.splice(0, 1); result = _getValue(fromObject, key[0], keys); return handleArrayOfUndefined_(result); }
[ "function", "getValue", "(", "fromObject", ",", "fromKey", ")", "{", "var", "regDot", "=", "/", "\\.", "/", "g", ",", "regFinishArray", "=", "/", ".+(\\[\\])", "/", "g", ",", "keys", ",", "key", ",", "result", ",", "lastValue", ";", "keys", "=", "fro...
Make the get of a value with the key in the passed object @param fromObject @param fromKey @constructor @returns {*}
[ "Make", "the", "get", "of", "a", "value", "with", "the", "key", "in", "the", "passed", "object" ]
a8e55ec2c4e9119ce33f29c469ae21867e1827cf
https://github.com/midknight41/map-factory/blob/a8e55ec2c4e9119ce33f29c469ae21867e1827cf/src/lib/object-mapper/get-key-value.js#L13-L28
29,737
LaxarJS/laxar
lib/utilities/object.js
fillArrayWithNull
function fillArrayWithNull( arr, toIndex ) { for( let i = arr.length; i < toIndex; ++i ) { arr[ i ] = null; } }
javascript
function fillArrayWithNull( arr, toIndex ) { for( let i = arr.length; i < toIndex; ++i ) { arr[ i ] = null; } }
[ "function", "fillArrayWithNull", "(", "arr", ",", "toIndex", ")", "{", "for", "(", "let", "i", "=", "arr", ".", "length", ";", "i", "<", "toIndex", ";", "++", "i", ")", "{", "arr", "[", "i", "]", "=", "null", ";", "}", "}" ]
eslint-disable-next-line valid-jsdoc Sets all entries of the given array to `null`. @private
[ "eslint", "-", "disable", "-", "next", "-", "line", "valid", "-", "jsdoc", "Sets", "all", "entries", "of", "the", "given", "array", "to", "null", "." ]
2d6e03feb2b7e0a9916742de0edd92ac15c5d45f
https://github.com/LaxarJS/laxar/blob/2d6e03feb2b7e0a9916742de0edd92ac15c5d45f/lib/utilities/object.js#L272-L276
29,738
mrvisser/node-corporal
examples/whoami/commands/greet.js
function(session, args, callback) { session.stdout().write('Hello, ' + session.env('me').bold + '\n'); return callback(); }
javascript
function(session, args, callback) { session.stdout().write('Hello, ' + session.env('me').bold + '\n'); return callback(); }
[ "function", "(", "session", ",", "args", ",", "callback", ")", "{", "session", ".", "stdout", "(", ")", ".", "write", "(", "'Hello, '", "+", "session", ".", "env", "(", "'me'", ")", ".", "bold", "+", "'\\n'", ")", ";", "return", "callback", "(", ")...
The function that actually invokes the command. Simply pull the current state of the "me" environment variable and print it to the console.
[ "The", "function", "that", "actually", "invokes", "the", "command", ".", "Simply", "pull", "the", "current", "state", "of", "the", "me", "environment", "variable", "and", "print", "it", "to", "the", "console", "." ]
93ead59d870fe78d43135bb0a8b2d346422b970e
https://github.com/mrvisser/node-corporal/blob/93ead59d870fe78d43135bb0a8b2d346422b970e/examples/whoami/commands/greet.js#L9-L12
29,739
graphology/graphology-metrics
modularity.js
modularity
function modularity(graph, options) { // Handling errors if (!isGraph(graph)) throw new Error('graphology-metrics/modularity: the given graph is not a valid graphology instance.'); if (graph.multi) throw new Error('graphology-metrics/modularity: multi graphs are not handled.'); if (!graph.size) t...
javascript
function modularity(graph, options) { // Handling errors if (!isGraph(graph)) throw new Error('graphology-metrics/modularity: the given graph is not a valid graphology instance.'); if (graph.multi) throw new Error('graphology-metrics/modularity: multi graphs are not handled.'); if (!graph.size) t...
[ "function", "modularity", "(", "graph", ",", "options", ")", "{", "// Handling errors", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graphology-metrics/modularity: the given graph is not a valid graphology instance.'", ")", ";", "...
Function returning the modularity of the given graph. @param {Graph} graph - Target graph. @param {object} options - Options: @param {object} communities - Communities mapping. @param {object} attributes - Attribute names: @param {string} community - Name of the community attribute. @param...
[ "Function", "returning", "the", "modularity", "of", "the", "given", "graph", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/modularity.js#L41-L125
29,740
AthenaJS/athenajs
js/Scene/default/Hud.js
function (destCtx, debug) { if (!this.visible) { return; } // auto goto next frame if (this.currentAnimName.length) { this.advanceFrame(this.currentAnimName); } var w = this.getCurre...
javascript
function (destCtx, debug) { if (!this.visible) { return; } // auto goto next frame if (this.currentAnimName.length) { this.advanceFrame(this.currentAnimName); } var w = this.getCurre...
[ "function", "(", "destCtx", ",", "debug", ")", "{", "if", "(", "!", "this", ".", "visible", ")", "{", "return", ";", "}", "// auto goto next frame", "if", "(", "this", ".", "currentAnimName", ".", "length", ")", "{", "this", ".", "advanceFrame", "(", "...
we simply override the draw method
[ "we", "simply", "override", "the", "draw", "method" ]
5efe8ca3058986efc4af91fa3dbb03b716899e81
https://github.com/AthenaJS/athenajs/blob/5efe8ca3058986efc4af91fa3dbb03b716899e81/js/Scene/default/Hud.js#L16-L64
29,741
graphology/graphology-metrics
centrality/degree.js
abstractDegreeCentrality
function abstractDegreeCentrality(assign, method, graph, options) { var name = method + 'Centrality'; if (!isGraph(graph)) throw new Error('graphology-centrality/' + name + ': the given graph is not a valid graphology instance.'); if (method !== 'degree' && graph.type === 'undirected') throw new Error('...
javascript
function abstractDegreeCentrality(assign, method, graph, options) { var name = method + 'Centrality'; if (!isGraph(graph)) throw new Error('graphology-centrality/' + name + ': the given graph is not a valid graphology instance.'); if (method !== 'degree' && graph.type === 'undirected') throw new Error('...
[ "function", "abstractDegreeCentrality", "(", "assign", ",", "method", ",", "graph", ",", "options", ")", "{", "var", "name", "=", "method", "+", "'Centrality'", ";", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graph...
Asbtract function to perform any kind of degree centrality. Intuitively, the degree centrality of a node is the fraction of nodes it is connected to. @param {boolean} assign - Whether to assign the result to the nodes. @param {string} method - Method of the graph to get the degree. @param {Gra...
[ "Asbtract", "function", "to", "perform", "any", "kind", "of", "degree", "centrality", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/centrality/degree.js#L23-L66
29,742
graphology/graphology-metrics
density.js
simpleSizeForMultiGraphs
function simpleSizeForMultiGraphs(graph) { var nodes = graph.nodes(), size = 0, i, l; for (i = 0, l = nodes.length; i < l; i++) { size += graph.outNeighbors(nodes[i]).length; size += graph.undirectedNeighbors(nodes[i]).length / 2; } return size; }
javascript
function simpleSizeForMultiGraphs(graph) { var nodes = graph.nodes(), size = 0, i, l; for (i = 0, l = nodes.length; i < l; i++) { size += graph.outNeighbors(nodes[i]).length; size += graph.undirectedNeighbors(nodes[i]).length / 2; } return size; }
[ "function", "simpleSizeForMultiGraphs", "(", "graph", ")", "{", "var", "nodes", "=", "graph", ".", "nodes", "(", ")", ",", "size", "=", "0", ",", "i", ",", "l", ";", "for", "(", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<...
Returns the size a multi graph would have if it were a simple one. @param {Graph} graph - Target graph. @return {number}
[ "Returns", "the", "size", "a", "multi", "graph", "would", "have", "if", "it", "were", "a", "simple", "one", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/density.js#L53-L65
29,743
graphology/graphology-metrics
density.js
abstractDensity
function abstractDensity(type, multi, graph) { var order, size; // Retrieving order & size if (arguments.length > 3) { order = graph; size = arguments[3]; if (typeof order !== 'number') throw new Error('graphology-metrics/density: given order is not a number.'); if (typeof size !== ...
javascript
function abstractDensity(type, multi, graph) { var order, size; // Retrieving order & size if (arguments.length > 3) { order = graph; size = arguments[3]; if (typeof order !== 'number') throw new Error('graphology-metrics/density: given order is not a number.'); if (typeof size !== ...
[ "function", "abstractDensity", "(", "type", ",", "multi", ",", "graph", ")", "{", "var", "order", ",", "size", ";", "// Retrieving order & size", "if", "(", "arguments", ".", "length", ">", "3", ")", "{", "order", "=", "graph", ";", "size", "=", "argumen...
Returns the density for the given parameters. Arity 3: @param {boolean} type - Type of density. @param {boolean} multi - Compute multi density? @param {Graph} graph - Target graph. Arity 4: @param {boolean} type - Type of density. @param {boolean} multi - Compute multi density? @param {number} order - Numb...
[ "Returns", "the", "density", "for", "the", "given", "parameters", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/density.js#L83-L132
29,744
LaxarJS/laxar
lib/runtime/log.js
Logger
function Logger( configuration, channels = [] ) { this.levels = { ...levels, ...configuration.get( 'logging.levels' ) }; this.queueSize_ = 100; this.channels_ = channels; this.counter_ = 0; this.messageQueue_ = []; this.threshold_ = 0; this.tags_ = {}; this.levelToName_ = ( levels => { c...
javascript
function Logger( configuration, channels = [] ) { this.levels = { ...levels, ...configuration.get( 'logging.levels' ) }; this.queueSize_ = 100; this.channels_ = channels; this.counter_ = 0; this.messageQueue_ = []; this.threshold_ = 0; this.tags_ = {}; this.levelToName_ = ( levels => { c...
[ "function", "Logger", "(", "configuration", ",", "channels", "=", "[", "]", ")", "{", "this", ".", "levels", "=", "{", "...", "levels", ",", "...", "configuration", ".", "get", "(", "'logging.levels'", ")", "}", ";", "this", ".", "queueSize_", "=", "10...
eslint-disable-next-line valid-jsdoc A flexible logger. It is recommended to prefer this logger over `console.log` and friends, at least for any log messages that might make their way into production code. For once, this logger is safe to use across browsers and allows to attach additional channels for routing messag...
[ "eslint", "-", "disable", "-", "next", "-", "line", "valid", "-", "jsdoc", "A", "flexible", "logger", "." ]
2d6e03feb2b7e0a9916742de0edd92ac15c5d45f
https://github.com/LaxarJS/laxar/blob/2d6e03feb2b7e0a9916742de0edd92ac15c5d45f/lib/runtime/log.js#L75-L97
29,745
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
getDatabase
function getDatabase() { var mongoAdapter = this; expect(arguments).to.have.length( 0, 'Invalid arguments length when getting a database in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked || !_data...
javascript
function getDatabase() { var mongoAdapter = this; expect(arguments).to.have.length( 0, 'Invalid arguments length when getting a database in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked || !_data...
[ "function", "getDatabase", "(", ")", "{", "var", "mongoAdapter", "=", "this", ";", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "0", ",", "'Invalid arguments length when getting a database in a MongoAdapter '", "+", "'(it has to be pa...
Gets the MongoClient Db object to be use to perform the operations. @name module:back4app-entity-mongodb.MongoAdapter#getDatabase @function @returns {Promise.<Db|Error>} Promise that returns the MongoClient Db object if succeed and the Error if failed. @example mongoAdapter.getDatabase() .then(function (database) { dat...
[ "Gets", "the", "MongoClient", "Db", "object", "to", "be", "use", "to", "perform", "the", "operations", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L89-L110
29,746
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
openConnection
function openConnection() { expect(arguments).to.have.length( 0, 'Invalid arguments length when opening a connection in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked) { _databaseRequestQueue.p...
javascript
function openConnection() { expect(arguments).to.have.length( 0, 'Invalid arguments length when opening a connection in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked) { _databaseRequestQueue.p...
[ "function", "openConnection", "(", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "0", ",", "'Invalid arguments length when opening a connection in a MongoAdapter '", "+", "'(it has to be passed no arguments)'", ")", ";", "return"...
Connects the adapter with the targeted Mongo database. @name module:back4app-entity-mongodb.MongoAdapter#openConnection @function @returns {Promise.<undefined|Error>} Promise that returns nothing if succeed and the Error if failed. @example mongoAdapter.openConnection() .then(function () { console.log('connection opene...
[ "Connects", "the", "adapter", "with", "the", "targeted", "Mongo", "database", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L127-L159
29,747
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
closeConnection
function closeConnection() { expect(arguments).to.have.length( 0, 'Invalid arguments length when closing a connection in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked) { _databaseRequestQueue....
javascript
function closeConnection() { expect(arguments).to.have.length( 0, 'Invalid arguments length when closing a connection in a MongoAdapter ' + '(it has to be passed no arguments)' ); return new Promise(function (resolve, reject) { if (_databaseIsLocked) { _databaseRequestQueue....
[ "function", "closeConnection", "(", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "0", ",", "'Invalid arguments length when closing a connection in a MongoAdapter '", "+", "'(it has to be passed no arguments)'", ")", ";", "return...
Closes the current adapter' connection with MongoDB. @name module:back4app-entity-mongodb.MongoAdapter#closeConnection @function @returns {Promise.<undefined|Error>} Promise that returns nothing if succeed and the Error if failed. @example mongoAdapter.closeConnection() .then(function () { console.log('connection close...
[ "Closes", "the", "current", "adapter", "connection", "with", "MongoDB", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L176-L209
29,748
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
loadEntity
function loadEntity(Entity) { expect(arguments).to.have.length( 1, 'Invalid arguments length when loading an entity in a ' + 'MongoAdapter (it has to be passed 1 argument)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when loading an entity in a ' + ...
javascript
function loadEntity(Entity) { expect(arguments).to.have.length( 1, 'Invalid arguments length when loading an entity in a ' + 'MongoAdapter (it has to be passed 1 argument)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when loading an entity in a ' + ...
[ "function", "loadEntity", "(", "Entity", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "1", ",", "'Invalid arguments length when loading an entity in a '", "+", "'MongoAdapter (it has to be passed 1 argument)'", ")", ";", "expe...
Registers the Entity on Adapter's Collection Dictionary, if valid. @name module:back4app-entity-mongodb.MongoAdapter#loadEntity @function @param {!module:back4app-entity/models/Entity} Entity The Entity Class to be validated and added to Adapter's Collection dictionary. @example Entity.adapter.loadEntity(Entity);
[ "Registers", "the", "Entity", "on", "Adapter", "s", "Collection", "Dictionary", "if", "valid", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L235-L282
29,749
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
loadEntityAttribute
function loadEntityAttribute(Entity, attribute) { expect(arguments).to.have.length( 2, 'Invalid arguments length when loading an entity attribute in a ' + 'MongoAdapter (it has to be passed 2 arguments)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when lo...
javascript
function loadEntityAttribute(Entity, attribute) { expect(arguments).to.have.length( 2, 'Invalid arguments length when loading an entity attribute in a ' + 'MongoAdapter (it has to be passed 2 arguments)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when lo...
[ "function", "loadEntityAttribute", "(", "Entity", ",", "attribute", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "2", ",", "'Invalid arguments length when loading an entity attribute in a '", "+", "'MongoAdapter (it has to be pa...
Registers the Attribute on the Entity on Collection Dictionary, if valid. @name module:back4app-entity-mongodb.MongoAdapter#loadEntityAttribute @function @param {!module:back4app-entity/models/Entity} Entity The Entity Class to have attribute validated and added to Entity on Collection dictionary. @param {!module:back4...
[ "Registers", "the", "Attribute", "on", "the", "Entity", "on", "Collection", "Dictionary", "if", "valid", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L295-L363
29,750
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
insertObject
function insertObject(entityObject) { var mongoAdapter = this; expect(arguments).to.have.length( 1, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 1 argument)' ); return new Promise(function (resolve, reject) { expect(entityObject).to.be.an.insta...
javascript
function insertObject(entityObject) { var mongoAdapter = this; expect(arguments).to.have.length( 1, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 1 argument)' ); return new Promise(function (resolve, reject) { expect(entityObject).to.be.an.insta...
[ "function", "insertObject", "(", "entityObject", ")", "{", "var", "mongoAdapter", "=", "this", ";", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "1", ",", "'Invalid arguments length when inserting an object in a MongoAdapter '", "+", ...
Saves an Entity instance, inserting on DB. @name module:back4app-entity-mongodb.MongoAdapter#insertObject @function @param {!module:module:back4app-entity/models/Entity} entityObject Entity instance being saved, to insert on DB. @returns {Promise.<undefined|Error>} Promise that returns nothing if succeed and the Error ...
[ "Saves", "an", "Entity", "instance", "inserting", "on", "DB", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L393-L431
29,751
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
updateObject
function updateObject(entityObject) { var mongoAdapter = this; expect(arguments).to.have.length( 1, 'Invalid arguments length when updating an object in a MongoAdapter ' + '(it has to be passed 1 argument)' ); return new Promise(function (resolve, reject) { expect(entityObject).to.be.an.instan...
javascript
function updateObject(entityObject) { var mongoAdapter = this; expect(arguments).to.have.length( 1, 'Invalid arguments length when updating an object in a MongoAdapter ' + '(it has to be passed 1 argument)' ); return new Promise(function (resolve, reject) { expect(entityObject).to.be.an.instan...
[ "function", "updateObject", "(", "entityObject", ")", "{", "var", "mongoAdapter", "=", "this", ";", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "1", ",", "'Invalid arguments length when updating an object in a MongoAdapter '", "+", ...
Updates an Entity instance, changing on DB. @name module:back4app-entity-mongodb.MongoAdapter#updateObject @function @param {!module:module:back4app-entity/models/Entity} entityObject Entity instance being updates, to modify on DB. @returns {Promise.<undefined|Error>} Promise that returns nothing if succeed and the Err...
[ "Updates", "an", "Entity", "instance", "changing", "on", "DB", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L448-L487
29,752
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
objectToDocument
function objectToDocument(entityObject, onlyDirty) { expect(arguments).to.have.length.below( 3, 'Invalid arguments length when converting an entity object in a ' + 'MongoDB document (it has to be passed less than 3 arguments)' ); expect(entityObject).to.be.an.instanceOf( Entity, 'Invalid argu...
javascript
function objectToDocument(entityObject, onlyDirty) { expect(arguments).to.have.length.below( 3, 'Invalid arguments length when converting an entity object in a ' + 'MongoDB document (it has to be passed less than 3 arguments)' ); expect(entityObject).to.be.an.instanceOf( Entity, 'Invalid argu...
[ "function", "objectToDocument", "(", "entityObject", ",", "onlyDirty", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", ".", "below", "(", "3", ",", "'Invalid arguments length when converting an entity object in a '", "+", "'MongoDB ...
Converts an Entity object in a MongoDB document. @name module:back4app-entity-mongodb.MongoAdapter#objectToDocument @function @param {!module:back4app-entity/models.Entity} entityObject The Entity object to be converted to a MongoDB document. @param {?boolean} [onlyDirty=false] Sets if only dirty attributes will be add...
[ "Converts", "an", "Entity", "object", "in", "a", "MongoDB", "document", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L501-L546
29,753
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
getObject
function getObject(EntityClass, query) { expect(arguments).to.have.length( 2, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 2 arguments)' ); var cursor; var document; function findDocument(db) { cursor = _buildCursor(db, EntityClass, query); ...
javascript
function getObject(EntityClass, query) { expect(arguments).to.have.length( 2, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 2 arguments)' ); var cursor; var document; function findDocument(db) { cursor = _buildCursor(db, EntityClass, query); ...
[ "function", "getObject", "(", "EntityClass", ",", "query", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "2", ",", "'Invalid arguments length when inserting an object in a MongoAdapter '", "+", "'(it has to be passed 2 arguments)...
Get object from the database matching given query. @name module:back4app-entity-mongodb.MongoAdapter#getObject @function @param {!module:back4app-entity/models.Entity} entityObject The Entity Class which instance will be searched within the collections. @param {?Object} query Object for query search. @returns {Promise....
[ "Get", "object", "from", "the", "database", "matching", "given", "query", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L563-L608
29,754
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
findObjects
function findObjects(EntityClass, query, params) { expect(arguments).to.have.length.within( 2, 3, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 2 or 3 arguments)' ); function findDocuments(db) { // cleaning params params = params || {}; ...
javascript
function findObjects(EntityClass, query, params) { expect(arguments).to.have.length.within( 2, 3, 'Invalid arguments length when inserting an object in a MongoAdapter ' + '(it has to be passed 2 or 3 arguments)' ); function findDocuments(db) { // cleaning params params = params || {}; ...
[ "function", "findObjects", "(", "EntityClass", ",", "query", ",", "params", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", ".", "within", "(", "2", ",", "3", ",", "'Invalid arguments length when inserting an object in a MongoAd...
Find objects in the database matching given query. @name module:back4app-entity-mongodb.MongoAdapter#findObjects @function @param {!module:back4app-entity/models.Entity} entityObject The Entity Class which instance will be searched within the collections. @param {?Object} query Object for query search. @param {?Object}...
[ "Find", "objects", "in", "the", "database", "matching", "given", "query", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L629-L667
29,755
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
_buildCursor
function _buildCursor(db, EntityClass, query) { // copy query to not mess with user's object query = objects.copy(query); // rename id field if (query.hasOwnProperty('id')) { query._id = query.id; delete query.id; } // find collection name var name = getEntityCollectionName(EntityClass); // b...
javascript
function _buildCursor(db, EntityClass, query) { // copy query to not mess with user's object query = objects.copy(query); // rename id field if (query.hasOwnProperty('id')) { query._id = query.id; delete query.id; } // find collection name var name = getEntityCollectionName(EntityClass); // b...
[ "function", "_buildCursor", "(", "db", ",", "EntityClass", ",", "query", ")", "{", "// copy query to not mess with user's object", "query", "=", "objects", ".", "copy", "(", "query", ")", ";", "// rename id field", "if", "(", "query", ".", "hasOwnProperty", "(", ...
Creates the DB Cursor, which iterates within the results from a query @name module:back4app-entity-mongodb.MongoAdapter~_buildCursor @function @param {!module:mongodb/Db} db Db instance from MongoDB Driver. @param {!module:back4app-entity/models.Entity} entityObject The Entity Class which instance will be searched with...
[ "Creates", "the", "DB", "Cursor", "which", "iterates", "within", "the", "results", "from", "a", "query" ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L683-L698
29,756
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
documentToObject
function documentToObject(document, adapterName) { expect(arguments).to.have.length( 2, 'Invalid arguments length when converting a MongoDB document into ' + 'an entity object (it has to be passed 2 arguments)' ); var obj = {}; // replace `_id` with `id` if (document.hasOwnProperty('_id')) { ...
javascript
function documentToObject(document, adapterName) { expect(arguments).to.have.length( 2, 'Invalid arguments length when converting a MongoDB document into ' + 'an entity object (it has to be passed 2 arguments)' ); var obj = {}; // replace `_id` with `id` if (document.hasOwnProperty('_id')) { ...
[ "function", "documentToObject", "(", "document", ",", "adapterName", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "2", ",", "'Invalid arguments length when converting a MongoDB document into '", "+", "'an entity object (it has t...
Converts a MongoDB document to an Entity object. @name module:back4app-entity-mongodb.MongoAdapter#documentToObject @function @param {Object.<string, *>} document The MongoDB document. @param {String} adapterName The name of the entity adapter. @returns {!module:back4app-entity/models.Entity} The converted Entity objec...
[ "Converts", "a", "MongoDB", "document", "to", "an", "Entity", "object", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L712-L744
29,757
back4app/back4app-entity-mongodb
src/back/MongoAdapter.js
getEntityCollectionName
function getEntityCollectionName(Entity) { expect(arguments).to.have.length( 1, 'Invalid arguments length when getting the collection name of an Entity ' + 'class (it has to be passed 1 argument)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when getting the collection na...
javascript
function getEntityCollectionName(Entity) { expect(arguments).to.have.length( 1, 'Invalid arguments length when getting the collection name of an Entity ' + 'class (it has to be passed 1 argument)' ); expect(Entity).to.be.a( 'function', 'Invalid argument "Entity" when getting the collection na...
[ "function", "getEntityCollectionName", "(", "Entity", ")", "{", "expect", "(", "arguments", ")", ".", "to", ".", "have", ".", "length", "(", "1", ",", "'Invalid arguments length when getting the collection name of an Entity '", "+", "'class (it has to be passed 1 argument)'...
Gets the collection name in which the objects of a given Entity shall be saved. @name module:back4app-entity-mongodb.MongoAdapter#getEntityCollectionName @function @param {!Class} Entity The Entity class whose collection name will be get. @returns {string} The collection name. @example var entityCollectionName = mongoA...
[ "Gets", "the", "collection", "name", "in", "which", "the", "objects", "of", "a", "given", "Entity", "shall", "be", "saved", "." ]
5a43ab50aabdd259b0324aa7c7eed03e8de40a30
https://github.com/back4app/back4app-entity-mongodb/blob/5a43ab50aabdd259b0324aa7c7eed03e8de40a30/src/back/MongoAdapter.js#L807-L834
29,758
graphology/graphology-metrics
weighted-degree.js
abstractWeightedDegree
function abstractWeightedDegree(name, assign, edgeGetter, graph, options) { if (!isGraph(graph)) throw new Error('graphology-metrics/' + name + ': the given graph is not a valid graphology instance.'); if (edgeGetter !== 'edges' && graph.type === 'undirected') throw new Error('graphology-metrics/' + name +...
javascript
function abstractWeightedDegree(name, assign, edgeGetter, graph, options) { if (!isGraph(graph)) throw new Error('graphology-metrics/' + name + ': the given graph is not a valid graphology instance.'); if (edgeGetter !== 'edges' && graph.type === 'undirected') throw new Error('graphology-metrics/' + name +...
[ "function", "abstractWeightedDegree", "(", "name", ",", "assign", ",", "edgeGetter", ",", "graph", ",", "options", ")", "{", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graphology-metrics/'", "+", "name", "+", "': the...
Asbtract function to perform any kind of weighted degree. Signature n°1 - computing weighted degree for every node: @param {string} name - Name of the implemented function. @param {boolean} assign - Whether to assign the result to the nodes. @param {string} method - Method of the gra...
[ "Asbtract", "function", "to", "perform", "any", "kind", "of", "weighted", "degree", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/weighted-degree.js#L43-L124
29,759
graphology/graphology-metrics
centrality/betweenness.js
abstractBetweennessCentrality
function abstractBetweennessCentrality(assign, graph, options) { if (!isGraph(graph)) throw new Error('graphology-centrality/beetweenness-centrality: the given graph is not a valid graphology instance.'); var centralities = {}; // Solving options options = defaults({}, options, DEFAULTS); var weightAtt...
javascript
function abstractBetweennessCentrality(assign, graph, options) { if (!isGraph(graph)) throw new Error('graphology-centrality/beetweenness-centrality: the given graph is not a valid graphology instance.'); var centralities = {}; // Solving options options = defaults({}, options, DEFAULTS); var weightAtt...
[ "function", "abstractBetweennessCentrality", "(", "assign", ",", "graph", ",", "options", ")", "{", "if", "(", "!", "isGraph", "(", "graph", ")", ")", "throw", "new", "Error", "(", "'graphology-centrality/beetweenness-centrality: the given graph is not a valid graphology ...
Abstract function computing beetweenness centrality for the given graph. @param {boolean} assign - Assign the results to node attributes? @param {Graph} graph - Target graph. @param {object} [options] - Options: @param {object} [attributes] - Attribute names: @param {string} ...
[ "Abstract", "function", "computing", "beetweenness", "centrality", "for", "the", "given", "graph", "." ]
bf920856140994251fa799f87f58f42bc06f53e6
https://github.com/graphology/graphology-metrics/blob/bf920856140994251fa799f87f58f42bc06f53e6/centrality/betweenness.js#L37-L124
29,760
mrvisser/node-corporal
examples/whoami/commands/iam.js
function(session, args, callback) { // Parse the arguments using optimist var argv = optimist.parse(args); // Update the environment to indicate who the specified user now is session.env('me', argv._[0] || 'unknown'); // The callback always needs to be invoked to finish the co...
javascript
function(session, args, callback) { // Parse the arguments using optimist var argv = optimist.parse(args); // Update the environment to indicate who the specified user now is session.env('me', argv._[0] || 'unknown'); // The callback always needs to be invoked to finish the co...
[ "function", "(", "session", ",", "args", ",", "callback", ")", "{", "// Parse the arguments using optimist", "var", "argv", "=", "optimist", ".", "parse", "(", "args", ")", ";", "// Update the environment to indicate who the specified user now is", "session", ".", "env"...
The function that actually invokes the command. Optimist is being used here to parse the array arguments that were provided to your command, however you can use whatever utility you want
[ "The", "function", "that", "actually", "invokes", "the", "command", ".", "Optimist", "is", "being", "used", "here", "to", "parse", "the", "array", "arguments", "that", "were", "provided", "to", "your", "command", "however", "you", "can", "use", "whatever", "...
93ead59d870fe78d43135bb0a8b2d346422b970e
https://github.com/mrvisser/node-corporal/blob/93ead59d870fe78d43135bb0a8b2d346422b970e/examples/whoami/commands/iam.js#L15-L25
29,761
w3c/node-w3capi
lib/index.js
subSteps
function subSteps (obj, items) { util.inherits(obj, Ctx); var key = "teamcontacts versions successors predecessors".split(" ") , propKey = "team-contacts version-history successor-version predecessor-version".split(" "); items.forEach(function (it) { obj.prototype[it] = function () { ...
javascript
function subSteps (obj, items) { util.inherits(obj, Ctx); var key = "teamcontacts versions successors predecessors".split(" ") , propKey = "team-contacts version-history successor-version predecessor-version".split(" "); items.forEach(function (it) { obj.prototype[it] = function () { ...
[ "function", "subSteps", "(", "obj", ",", "items", ")", "{", "util", ".", "inherits", "(", "obj", ",", "Ctx", ")", ";", "var", "key", "=", "\"teamcontacts versions successors predecessors\"", ".", "split", "(", "\" \"", ")", ",", "propKey", "=", "\"team-conta...
generates steps beneath an existing one that has an ID
[ "generates", "steps", "beneath", "an", "existing", "one", "that", "has", "an", "ID" ]
70573181c1decd057a02c13fdcabe8b120703359
https://github.com/w3c/node-w3capi/blob/70573181c1decd057a02c13fdcabe8b120703359/lib/index.js#L103-L117
29,762
w3c/node-w3capi
lib/index.js
idStep
function idStep (obj, name, inherit) { return function (id) { var ctx = obj ? new obj(inherit ? this : undefined) : this; ctx.steps.push(name); ctx.steps.push(id); return ctx; }; }
javascript
function idStep (obj, name, inherit) { return function (id) { var ctx = obj ? new obj(inherit ? this : undefined) : this; ctx.steps.push(name); ctx.steps.push(id); return ctx; }; }
[ "function", "idStep", "(", "obj", ",", "name", ",", "inherit", ")", "{", "return", "function", "(", "id", ")", "{", "var", "ctx", "=", "obj", "?", "new", "obj", "(", "inherit", "?", "this", ":", "undefined", ")", ":", "this", ";", "ctx", ".", "st...
generates a step that takes an ID
[ "generates", "a", "step", "that", "takes", "an", "ID" ]
70573181c1decd057a02c13fdcabe8b120703359
https://github.com/w3c/node-w3capi/blob/70573181c1decd057a02c13fdcabe8b120703359/lib/index.js#L120-L127
29,763
w3c/node-w3capi
lib/index.js
accountOrIdStep
function accountOrIdStep(obj, name) { return function (accountOrId) { if (typeof accountOrId === 'string') { // W3C obfuscated id return idStep(obj, name)(accountOrId); } else { // accountOrId expected to be {type: 'github', id: 123456} var ctx = new o...
javascript
function accountOrIdStep(obj, name) { return function (accountOrId) { if (typeof accountOrId === 'string') { // W3C obfuscated id return idStep(obj, name)(accountOrId); } else { // accountOrId expected to be {type: 'github', id: 123456} var ctx = new o...
[ "function", "accountOrIdStep", "(", "obj", ",", "name", ")", "{", "return", "function", "(", "accountOrId", ")", "{", "if", "(", "typeof", "accountOrId", "===", "'string'", ")", "{", "// W3C obfuscated id", "return", "idStep", "(", "obj", ",", "name", ")", ...
generates a step that takes either an account object or an ID
[ "generates", "a", "step", "that", "takes", "either", "an", "account", "object", "or", "an", "ID" ]
70573181c1decd057a02c13fdcabe8b120703359
https://github.com/w3c/node-w3capi/blob/70573181c1decd057a02c13fdcabe8b120703359/lib/index.js#L194-L209
29,764
modulesio/window-fetch
src/body.js
consumeBody
function consumeBody(body) { if (this[DISTURBED]) { return Body.Promise.reject(new Error(`body used already for: ${this.url}`)); } this[DISTURBED] = true; // body is null if (this.body === null) { return Body.Promise.resolve(Buffer.alloc(0)); } // body is string if (typeof this.body === 'stri...
javascript
function consumeBody(body) { if (this[DISTURBED]) { return Body.Promise.reject(new Error(`body used already for: ${this.url}`)); } this[DISTURBED] = true; // body is null if (this.body === null) { return Body.Promise.resolve(Buffer.alloc(0)); } // body is string if (typeof this.body === 'stri...
[ "function", "consumeBody", "(", "body", ")", "{", "if", "(", "this", "[", "DISTURBED", "]", ")", "{", "return", "Body", ".", "Promise", ".", "reject", "(", "new", "Error", "(", "`", "${", "this", ".", "url", "}", "`", ")", ")", ";", "}", "this", ...
Decode buffers into utf-8 string @return Promise
[ "Decode", "buffers", "into", "utf", "-", "8", "string" ]
0a024896a36c439335931e5d7830fca6373a4c63
https://github.com/modulesio/window-fetch/blob/0a024896a36c439335931e5d7830fca6373a4c63/src/body.js#L149-L227
29,765
gkjohnson/ply-exporter-js
PLYExporter.js
traverseMeshes
function traverseMeshes( cb ) { object.traverse( function ( child ) { if ( child.isMesh === true ) { var mesh = child; var geometry = mesh.geometry; if ( geometry.isGeometry === true ) { geometry = geomToBufferGeom.get( geometry ); } if ( geometry.isBufferGeometry === true )...
javascript
function traverseMeshes( cb ) { object.traverse( function ( child ) { if ( child.isMesh === true ) { var mesh = child; var geometry = mesh.geometry; if ( geometry.isGeometry === true ) { geometry = geomToBufferGeom.get( geometry ); } if ( geometry.isBufferGeometry === true )...
[ "function", "traverseMeshes", "(", "cb", ")", "{", "object", ".", "traverse", "(", "function", "(", "child", ")", "{", "if", "(", "child", ".", "isMesh", "===", "true", ")", "{", "var", "mesh", "=", "child", ";", "var", "geometry", "=", "mesh", ".", ...
Iterate over the valid meshes in the object
[ "Iterate", "over", "the", "valid", "meshes", "in", "the", "object" ]
e949f79cb3b200335788c64f765613be91f7085c
https://github.com/gkjohnson/ply-exporter-js/blob/e949f79cb3b200335788c64f765613be91f7085c/PLYExporter.js#L32-L61
29,766
cedx/which.js
example/main.js
main
async function main() { // eslint-disable-line no-unused-vars try { // `path` is the absolute path to the executable. const path = await which('foobar'); console.log(`The command "foobar" is located at: ${path}`); } catch (err) { // `err` is an instance of `FinderError`. console.log(`The comm...
javascript
async function main() { // eslint-disable-line no-unused-vars try { // `path` is the absolute path to the executable. const path = await which('foobar'); console.log(`The command "foobar" is located at: ${path}`); } catch (err) { // `err` is an instance of `FinderError`. console.log(`The comm...
[ "async", "function", "main", "(", ")", "{", "// eslint-disable-line no-unused-vars", "try", "{", "// `path` is the absolute path to the executable.", "const", "path", "=", "await", "which", "(", "'foobar'", ")", ";", "console", ".", "log", "(", "`", "${", "path", ...
Finds the instances of an executable.
[ "Finds", "the", "instances", "of", "an", "executable", "." ]
1f875d997e6a9dff3f768673ad024e73e56af207
https://github.com/cedx/which.js/blob/1f875d997e6a9dff3f768673ad024e73e56af207/example/main.js#L4-L15
29,767
dynamiccast/sails-json-api-blueprints
lib/api/services/JsonApiService.js
function(data) { var errors = []; // data.Errors is populated by sails-hook-validations and data.invalidAttributes is the default var targetAttributes = (data.Errors !== undefined) ? data.Errors : data.invalidAttributes; for (var attributeName in targetAttributes) { var attributes = targetAtt...
javascript
function(data) { var errors = []; // data.Errors is populated by sails-hook-validations and data.invalidAttributes is the default var targetAttributes = (data.Errors !== undefined) ? data.Errors : data.invalidAttributes; for (var attributeName in targetAttributes) { var attributes = targetAtt...
[ "function", "(", "data", ")", "{", "var", "errors", "=", "[", "]", ";", "// data.Errors is populated by sails-hook-validations and data.invalidAttributes is the default", "var", "targetAttributes", "=", "(", "data", ".", "Errors", "!==", "undefined", ")", "?", "data", ...
Turn a waterline validation error object into a JSON API compliant error object
[ "Turn", "a", "waterline", "validation", "error", "object", "into", "a", "JSON", "API", "compliant", "error", "object" ]
01db9affa142a4323882b373a21f6d84d6211e81
https://github.com/dynamiccast/sails-json-api-blueprints/blob/01db9affa142a4323882b373a21f6d84d6211e81/lib/api/services/JsonApiService.js#L230-L255
29,768
borisdiakur/memoize-fs
index.js
initCache
function initCache (cachePath) { return new Promise(function (resolve, reject) { mkdirp(cachePath, function (err) { if (err) { reject(err) } else { resolve() } }) }) }
javascript
function initCache (cachePath) { return new Promise(function (resolve, reject) { mkdirp(cachePath, function (err) { if (err) { reject(err) } else { resolve() } }) }) }
[ "function", "initCache", "(", "cachePath", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "mkdirp", "(", "cachePath", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "reject", "(", "...
check for existing cache folder, if not found, create folder, then resolve
[ "check", "for", "existing", "cache", "folder", "if", "not", "found", "create", "folder", "then", "resolve" ]
edf3b9a6ab48274544f6b7fc5be3b011aea47aac
https://github.com/borisdiakur/memoize-fs/blob/edf3b9a6ab48274544f6b7fc5be3b011aea47aac/index.js#L52-L62
29,769
One-com/livestyle
lib/middleware/bufferDataEventsUntilFirstListener.js
createEventBufferer
function createEventBufferer(eventName, bufferedEvents) { return function () { // ... bufferedEvents.push([eventName].concat(Array.prototype.slice.call(arguments))); }; }
javascript
function createEventBufferer(eventName, bufferedEvents) { return function () { // ... bufferedEvents.push([eventName].concat(Array.prototype.slice.call(arguments))); }; }
[ "function", "createEventBufferer", "(", "eventName", ",", "bufferedEvents", ")", "{", "return", "function", "(", ")", "{", "// ...", "bufferedEvents", ".", "push", "(", "[", "eventName", "]", ".", "concat", "(", "Array", ".", "prototype", ".", "slice", ".", ...
Middleware that buffers up the request's 'data' and 'end' events until another 'data' listener is added, then replay the events in order. Intended for use with formidable in scenarios where the IncomingForm is initialized in a route after something async has happened (authentication via a socket, for instance).
[ "Middleware", "that", "buffers", "up", "the", "request", "s", "data", "and", "end", "events", "until", "another", "data", "listener", "is", "added", "then", "replay", "the", "events", "in", "order", "." ]
a93729183fe070d285f58f6bb1256b216f51a1f5
https://github.com/One-com/livestyle/blob/a93729183fe070d285f58f6bb1256b216f51a1f5/lib/middleware/bufferDataEventsUntilFirstListener.js#L11-L15
29,770
spmjs/grunt-cmd-transport
tasks/lib/handlebars.js
patchHandlebars
function patchHandlebars(Handlebars) { Handlebars.JavaScriptCompiler.prototype.preamble = function() { var out = []; if (!this.isChild) { var namespace = this.namespace; // patch for handlebars var copies = [ "helpers = helpers || {};", "for (var key in " + namespace + ".hel...
javascript
function patchHandlebars(Handlebars) { Handlebars.JavaScriptCompiler.prototype.preamble = function() { var out = []; if (!this.isChild) { var namespace = this.namespace; // patch for handlebars var copies = [ "helpers = helpers || {};", "for (var key in " + namespace + ".hel...
[ "function", "patchHandlebars", "(", "Handlebars", ")", "{", "Handlebars", ".", "JavaScriptCompiler", ".", "prototype", ".", "preamble", "=", "function", "(", ")", "{", "var", "out", "=", "[", "]", ";", "if", "(", "!", "this", ".", "isChild", ")", "{", ...
patch for handlebars
[ "patch", "for", "handlebars" ]
8426714a4cec653db54395ee17a6e883fbc7ce41
https://github.com/spmjs/grunt-cmd-transport/blob/8426714a4cec653db54395ee17a6e883fbc7ce41/tasks/lib/handlebars.js#L29-L60
29,771
BowlingX/marklib
src/main/modules/Site.js
presentRendering
function presentRendering(selector, classNames, speed) { const text = document.getElementById(selector).childNodes[0]; const thisLength = text.length; const render = (autoMarkText, cp, length) => { let c = cp; const r = new Rendering(document, { className: classNames }); con...
javascript
function presentRendering(selector, classNames, speed) { const text = document.getElementById(selector).childNodes[0]; const thisLength = text.length; const render = (autoMarkText, cp, length) => { let c = cp; const r = new Rendering(document, { className: classNames }); con...
[ "function", "presentRendering", "(", "selector", ",", "classNames", ",", "speed", ")", "{", "const", "text", "=", "document", ".", "getElementById", "(", "selector", ")", ".", "childNodes", "[", "0", "]", ";", "const", "thisLength", "=", "text", ".", "leng...
Creates an animated rendering
[ "Creates", "an", "animated", "rendering" ]
d3ea15907cd5021a86348695391e07d554363e70
https://github.com/BowlingX/marklib/blob/d3ea15907cd5021a86348695391e07d554363e70/src/main/modules/Site.js#L22-L44
29,772
BowlingX/marklib
src/main/modules/Site.js
onClick
function onClick(instance) { const self = instance; self.wrapperNodes.forEach((n) => { n.addEventListener(ANIMATIONEND, function thisFunction(e) { e.target.classList.remove('bubble'); e.target.removeEventListener(ANIMATIONEND, thisFunction); }); n.classList.add('bubble'); }...
javascript
function onClick(instance) { const self = instance; self.wrapperNodes.forEach((n) => { n.addEventListener(ANIMATIONEND, function thisFunction(e) { e.target.classList.remove('bubble'); e.target.removeEventListener(ANIMATIONEND, thisFunction); }); n.classList.add('bubble'); }...
[ "function", "onClick", "(", "instance", ")", "{", "const", "self", "=", "instance", ";", "self", ".", "wrapperNodes", ".", "forEach", "(", "(", "n", ")", "=>", "{", "n", ".", "addEventListener", "(", "ANIMATIONEND", ",", "function", "thisFunction", "(", ...
OnClick event for renderings
[ "OnClick", "event", "for", "renderings" ]
d3ea15907cd5021a86348695391e07d554363e70
https://github.com/BowlingX/marklib/blob/d3ea15907cd5021a86348695391e07d554363e70/src/main/modules/Site.js#L54-L80
29,773
cedx/which.js
bin/which.js
main
async function main() { // Initialize the application. process.title = 'Which.js'; // Parse the command line arguments. program.name('which') .description('Find the instances of an executable in the system path.') .version(packageVersion, '-v, --version') .option('-a, --all', 'list all instances of...
javascript
async function main() { // Initialize the application. process.title = 'Which.js'; // Parse the command line arguments. program.name('which') .description('Find the instances of an executable in the system path.') .version(packageVersion, '-v, --version') .option('-a, --all', 'list all instances of...
[ "async", "function", "main", "(", ")", "{", "// Initialize the application.", "process", ".", "title", "=", "'Which.js'", ";", "// Parse the command line arguments.", "program", ".", "name", "(", "'which'", ")", ".", "description", "(", "'Find the instances of an execut...
Application entry point. @return {Promise<void>} Completes when the program is terminated.
[ "Application", "entry", "point", "." ]
1f875d997e6a9dff3f768673ad024e73e56af207
https://github.com/cedx/which.js/blob/1f875d997e6a9dff3f768673ad024e73e56af207/bin/which.js#L15-L40
29,774
dynamiccast/sails-json-api-blueprints
lib/api/blueprints/_util/actionUtil.js
function(req) { var pk = module.exports.parsePk(req); // Validate the required `id` parameter if (!pk) { var err = new Error( 'No `id` parameter provided.' + '(Note: even if the model\'s primary key is not named `id`- ' + '`id` should be used as the name of the parameter- it...
javascript
function(req) { var pk = module.exports.parsePk(req); // Validate the required `id` parameter if (!pk) { var err = new Error( 'No `id` parameter provided.' + '(Note: even if the model\'s primary key is not named `id`- ' + '`id` should be used as the name of the parameter- it...
[ "function", "(", "req", ")", "{", "var", "pk", "=", "module", ".", "exports", ".", "parsePk", "(", "req", ")", ";", "// Validate the required `id` parameter", "if", "(", "!", "pk", ")", "{", "var", "err", "=", "new", "Error", "(", "'No `id` parameter provi...
Parse primary key value from parameters. Throw an error if it cannot be retrieved. @param {Request} req @return {Integer|String}
[ "Parse", "primary", "key", "value", "from", "parameters", ".", "Throw", "an", "error", "if", "it", "cannot", "be", "retrieved", "." ]
01db9affa142a4323882b373a21f6d84d6211e81
https://github.com/dynamiccast/sails-json-api-blueprints/blob/01db9affa142a4323882b373a21f6d84d6211e81/lib/api/blueprints/_util/actionUtil.js#L71-L89
29,775
dynamiccast/sails-json-api-blueprints
lib/hook.js
function (path, action, options) { options = options || routeOpts; options = _.extend({}, options, {action: action, controller: controllerId}); sails.router.bind ( path, _getAction(action), null, options); }
javascript
function (path, action, options) { options = options || routeOpts; options = _.extend({}, options, {action: action, controller: controllerId}); sails.router.bind ( path, _getAction(action), null, options); }
[ "function", "(", "path", ",", "action", ",", "options", ")", "{", "options", "=", "options", "||", "routeOpts", ";", "options", "=", "_", ".", "extend", "(", "{", "}", ",", "options", ",", "{", "action", ":", "action", ",", "controller", ":", "contro...
Binds a route to the specifed action using _getAction, and sets the action and controller options for req.options
[ "Binds", "a", "route", "to", "the", "specifed", "action", "using", "_getAction", "and", "sets", "the", "action", "and", "controller", "options", "for", "req", ".", "options" ]
01db9affa142a4323882b373a21f6d84d6211e81
https://github.com/dynamiccast/sails-json-api-blueprints/blob/01db9affa142a4323882b373a21f6d84d6211e81/lib/hook.js#L318-L323
29,776
dynamiccast/sails-json-api-blueprints
lib/hook.js
_getMiddlewareForShadowRoute
function _getMiddlewareForShadowRoute (controllerId, blueprintId) { // Allow custom actions defined in controller to override blueprint actions. return sails.middleware.controllers[controllerId][blueprintId.toLowerCase()] || hook.middleware[blueprintId.toLowerCase()]; }
javascript
function _getMiddlewareForShadowRoute (controllerId, blueprintId) { // Allow custom actions defined in controller to override blueprint actions. return sails.middleware.controllers[controllerId][blueprintId.toLowerCase()] || hook.middleware[blueprintId.toLowerCase()]; }
[ "function", "_getMiddlewareForShadowRoute", "(", "controllerId", ",", "blueprintId", ")", "{", "// Allow custom actions defined in controller to override blueprint actions.", "return", "sails", ".", "middleware", ".", "controllers", "[", "controllerId", "]", "[", "blueprintId",...
Return the middleware function that should be bound for a shadow route pointing to the specified blueprintId. Will use the explicit controller action if it exists, otherwise the blueprint action. @param {String} controllerId @param {String} blueprintId [find, create, etc.] @return {Function} [middleware]
[ "Return", "the", "middleware", "function", "that", "should", "be", "bound", "for", "a", "shadow", "route", "pointing", "to", "the", "specified", "blueprintId", ".", "Will", "use", "the", "explicit", "controller", "action", "if", "it", "exists", "otherwise", "t...
01db9affa142a4323882b373a21f6d84d6211e81
https://github.com/dynamiccast/sails-json-api-blueprints/blob/01db9affa142a4323882b373a21f6d84d6211e81/lib/hook.js#L395-L399
29,777
dojot/dojot-module-nodejs
lib/auth.js
getManagementToken
function getManagementToken(tenant, config = defaultConfig) { const payload = { service: tenant, username: config.dojot.management.user }; return ( new Buffer("jwt schema").toString("base64") + "." + new Buffer(JSON.stringify(payload)).toString("base64") + "." + new Buffer("dummy signa...
javascript
function getManagementToken(tenant, config = defaultConfig) { const payload = { service: tenant, username: config.dojot.management.user }; return ( new Buffer("jwt schema").toString("base64") + "." + new Buffer(JSON.stringify(payload)).toString("base64") + "." + new Buffer("dummy signa...
[ "function", "getManagementToken", "(", "tenant", ",", "config", "=", "defaultConfig", ")", "{", "const", "payload", "=", "{", "service", ":", "tenant", ",", "username", ":", "config", ".", "dojot", ".", "management", ".", "user", "}", ";", "return", "(", ...
Generates a dummy token @param {string} tenant Tenant to be used when creating the token
[ "Generates", "a", "dummy", "token" ]
f4a877ab7e39f5d27c6b28651e922654815890c6
https://github.com/dojot/dojot-module-nodejs/blob/f4a877ab7e39f5d27c6b28651e922654815890c6/lib/auth.js#L12-L24
29,778
hoodiehq/hoodie-store-server-api
utils/remove-role-privilege.js
removeRolePrivilege
function removeRolePrivilege (access, role, privilege) { if (role === true) { access[privilege] = { role: [] } return } if (access[privilege].role === true) { access[privilege].role = true } _.pullAll(access[privilege].role, _.concat(role)) }
javascript
function removeRolePrivilege (access, role, privilege) { if (role === true) { access[privilege] = { role: [] } return } if (access[privilege].role === true) { access[privilege].role = true } _.pullAll(access[privilege].role, _.concat(role)) }
[ "function", "removeRolePrivilege", "(", "access", ",", "role", ",", "privilege", ")", "{", "if", "(", "role", "===", "true", ")", "{", "access", "[", "privilege", "]", "=", "{", "role", ":", "[", "]", "}", "return", "}", "if", "(", "access", "[", "...
An empty array means that nobody has access. If the current setting is true, access cannot be revoked for a role, so it remains true. Otherwise all passed roles are removed from the once that currently have access
[ "An", "empty", "array", "means", "that", "nobody", "has", "access", ".", "If", "the", "current", "setting", "is", "true", "access", "cannot", "be", "revoked", "for", "a", "role", "so", "it", "remains", "true", ".", "Otherwise", "all", "passed", "roles", ...
75e781ad90bc34116603c331d51aae96cae6109b
https://github.com/hoodiehq/hoodie-store-server-api/blob/75e781ad90bc34116603c331d51aae96cae6109b/utils/remove-role-privilege.js#L10-L23
29,779
forest-fire/firemodel
dist/cjs/path.js
pathJoin
function pathJoin(...args) { return args .reduce((prev, val) => { if (typeof prev === "undefined") { return; } if (val === undefined) { return prev; } return typeof val === "string" || typeof val === "number" ? joinStringsWithSlash(...
javascript
function pathJoin(...args) { return args .reduce((prev, val) => { if (typeof prev === "undefined") { return; } if (val === undefined) { return prev; } return typeof val === "string" || typeof val === "number" ? joinStringsWithSlash(...
[ "function", "pathJoin", "(", "...", "args", ")", "{", "return", "args", ".", "reduce", "(", "(", "prev", ",", "val", ")", "=>", "{", "if", "(", "typeof", "prev", "===", "\"undefined\"", ")", "{", "return", ";", "}", "if", "(", "val", "===", "undefi...
An ISO-morphic path join that works everywhere
[ "An", "ISO", "-", "morphic", "path", "join", "that", "works", "everywhere" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/path.js#L14-L30
29,780
npm/readdir-scoped-modules
readdir.js
readScopes
function readScopes (root, kids, cb) { var scopes = kids . filter (function (kid) { return kid . charAt (0) === '@' }) kids = kids . filter (function (kid) { return kid . charAt (0) !== '@' }) debug ('scopes=%j', scopes) if (scopes . length === 0) dz (cb) (null, kids) // prevent maybe-sync za...
javascript
function readScopes (root, kids, cb) { var scopes = kids . filter (function (kid) { return kid . charAt (0) === '@' }) kids = kids . filter (function (kid) { return kid . charAt (0) !== '@' }) debug ('scopes=%j', scopes) if (scopes . length === 0) dz (cb) (null, kids) // prevent maybe-sync za...
[ "function", "readScopes", "(", "root", ",", "kids", ",", "cb", ")", "{", "var", "scopes", "=", "kids", ".", "filter", "(", "function", "(", "kid", ")", "{", "return", "kid", ".", "charAt", "(", "0", ")", "===", "'@'", "}", ")", "kids", "=", "kids...
Turn [ 'a', '@scope' ] into ['a', '@scope/foo', '@scope/bar']
[ "Turn", "[", "a" ]
d41d5de877cb4e9e3f14b92913132680af73d1b4
https://github.com/npm/readdir-scoped-modules/blob/d41d5de877cb4e9e3f14b92913132680af73d1b4/readdir.js#L31-L71
29,781
canjs/can-view-live
lib/attrs.js
liveAttrsUpdate
function liveAttrsUpdate(newVal) { var newAttrs = live.getAttributeParts(newVal), name; for (name in newAttrs) { var newValue = newAttrs[name], // `oldAttrs` was set on the last run of setAttrs in this context // (for this element and compute) oldValue = oldAttrs[name]; // Only fire a callback...
javascript
function liveAttrsUpdate(newVal) { var newAttrs = live.getAttributeParts(newVal), name; for (name in newAttrs) { var newValue = newAttrs[name], // `oldAttrs` was set on the last run of setAttrs in this context // (for this element and compute) oldValue = oldAttrs[name]; // Only fire a callback...
[ "function", "liveAttrsUpdate", "(", "newVal", ")", "{", "var", "newAttrs", "=", "live", ".", "getAttributeParts", "(", "newVal", ")", ",", "name", ";", "for", "(", "name", "in", "newAttrs", ")", "{", "var", "newValue", "=", "newAttrs", "[", "name", "]", ...
set up a callback for handling changes when the compute changes
[ "set", "up", "a", "callback", "for", "handling", "changes", "when", "the", "compute", "changes" ]
00f6bf4ae003afe746b3d88fcfa67c9bb2f97a60
https://github.com/canjs/can-view-live/blob/00f6bf4ae003afe746b3d88fcfa67c9bb2f97a60/lib/attrs.js#L29-L61
29,782
forest-fire/firemodel
dist/cjs/src/decorators/indexing.js
getDbIndexes
function getDbIndexes(modelKlass) { const modelName = modelKlass.constructor.name; return modelName === "Model" ? typed_conversions_1.hashToArray(exports.indexesForModel[modelName]) : (typed_conversions_1.hashToArray(exports.indexesForModel[modelName]) || []).concat(typed_conversions_1.hashToArr...
javascript
function getDbIndexes(modelKlass) { const modelName = modelKlass.constructor.name; return modelName === "Model" ? typed_conversions_1.hashToArray(exports.indexesForModel[modelName]) : (typed_conversions_1.hashToArray(exports.indexesForModel[modelName]) || []).concat(typed_conversions_1.hashToArr...
[ "function", "getDbIndexes", "(", "modelKlass", ")", "{", "const", "modelName", "=", "modelKlass", ".", "constructor", ".", "name", ";", "return", "modelName", "===", "\"Model\"", "?", "typed_conversions_1", ".", "hashToArray", "(", "exports", ".", "indexesForModel...
Gets all the db indexes for a given model
[ "Gets", "all", "the", "db", "indexes", "for", "a", "given", "model" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/indexing.js#L11-L16
29,783
vajahath/lme
src/config.js
getChalkColors
function getChalkColors(defaultConfig, overrideConfig) { var effectiveConfig = Object.assign({}, defaultConfig, overrideConfig); // make the effectiveConfig understandable to chalk // and return it return buildChalkFunction(effectiveConfig); }
javascript
function getChalkColors(defaultConfig, overrideConfig) { var effectiveConfig = Object.assign({}, defaultConfig, overrideConfig); // make the effectiveConfig understandable to chalk // and return it return buildChalkFunction(effectiveConfig); }
[ "function", "getChalkColors", "(", "defaultConfig", ",", "overrideConfig", ")", "{", "var", "effectiveConfig", "=", "Object", ".", "assign", "(", "{", "}", ",", "defaultConfig", ",", "overrideConfig", ")", ";", "// make the effectiveConfig understandable to chalk\r", ...
Produce overrided configuration
[ "Produce", "overrided", "configuration" ]
2ffe974ecafc291ce4dc3dc34ebcee1f4898f7aa
https://github.com/vajahath/lme/blob/2ffe974ecafc291ce4dc3dc34ebcee1f4898f7aa/src/config.js#L4-L10
29,784
alojs/alo
lib/subscription/subscription.js
Subscription
function Subscription () { this._id = null this._storeRelations = null this._memberRelations = null this._dependencyRelations = null this._events = { 'beforePublish': [], 'afterPublish': [] } this._subscriptionStream = null this._stream = null this._lastData = null this._muted = false ...
javascript
function Subscription () { this._id = null this._storeRelations = null this._memberRelations = null this._dependencyRelations = null this._events = { 'beforePublish': [], 'afterPublish': [] } this._subscriptionStream = null this._stream = null this._lastData = null this._muted = false ...
[ "function", "Subscription", "(", ")", "{", "this", ".", "_id", "=", "null", "this", ".", "_storeRelations", "=", "null", "this", ".", "_memberRelations", "=", "null", "this", ".", "_dependencyRelations", "=", "null", "this", ".", "_events", "=", "{", "'bef...
Subscription Constructor, is used in the Store Class to create Subscriptions to state @class @extends {Store} @see Store @param {number} id @param {Object} storeProtected @param {string | Array} namespace
[ "Subscription", "Constructor", "is", "used", "in", "the", "Store", "Class", "to", "create", "Subscriptions", "to", "state" ]
daaeff958c261565e2f8bd666ffdeb513086aac2
https://github.com/alojs/alo/blob/daaeff958c261565e2f8bd666ffdeb513086aac2/lib/subscription/subscription.js#L26-L49
29,785
forest-fire/firemodel
dist/cjs/src/Watch/createWatchEvent.js
createWatchEvent
function createWatchEvent(type, record, event) { const payload = Object.assign({ type, key: record.id, modelName: record.modelName, pluralName: record.pluralName, modelConstructor: record.modelConstructor, dynamicPathProperties: record.dynamicPathComponents, compositeKey: record.compositeKey, dbPath: record.dbPath,...
javascript
function createWatchEvent(type, record, event) { const payload = Object.assign({ type, key: record.id, modelName: record.modelName, pluralName: record.pluralName, modelConstructor: record.modelConstructor, dynamicPathProperties: record.dynamicPathComponents, compositeKey: record.compositeKey, dbPath: record.dbPath,...
[ "function", "createWatchEvent", "(", "type", ",", "record", ",", "event", ")", "{", "const", "payload", "=", "Object", ".", "assign", "(", "{", "type", ",", "key", ":", "record", ".", "id", ",", "modelName", ":", "record", ".", "modelName", ",", "plura...
expands a locally originated event into a full featured dispatch event with desired META from the model
[ "expands", "a", "locally", "originated", "event", "into", "a", "full", "featured", "dispatch", "event", "with", "desired", "META", "from", "the", "model" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/Watch/createWatchEvent.js#L7-L10
29,786
forest-fire/firemodel
dist/cjs/src/decorators/model-meta/property-store.js
addPropertyToModelMeta
function addPropertyToModelMeta(modelName, property, meta) { if (!exports.propertiesByModel[modelName]) { exports.propertiesByModel[modelName] = {}; } // TODO: investigate why we need to genericize to model (from <T>) exports.propertiesByModel[modelName][property] = meta; }
javascript
function addPropertyToModelMeta(modelName, property, meta) { if (!exports.propertiesByModel[modelName]) { exports.propertiesByModel[modelName] = {}; } // TODO: investigate why we need to genericize to model (from <T>) exports.propertiesByModel[modelName][property] = meta; }
[ "function", "addPropertyToModelMeta", "(", "modelName", ",", "property", ",", "meta", ")", "{", "if", "(", "!", "exports", ".", "propertiesByModel", "[", "modelName", "]", ")", "{", "exports", ".", "propertiesByModel", "[", "modelName", "]", "=", "{", "}", ...
allows the addition of meta information to be added to a model's properties
[ "allows", "the", "addition", "of", "meta", "information", "to", "be", "added", "to", "a", "model", "s", "properties" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/model-meta/property-store.js#L13-L19
29,787
forest-fire/firemodel
dist/cjs/src/decorators/model-meta/property-store.js
getModelProperty
function getModelProperty(model) { const className = model.constructor.name; const propsForModel = getProperties(model); return (prop) => { return propsForModel.find(value => { return value.property === prop; }); }; }
javascript
function getModelProperty(model) { const className = model.constructor.name; const propsForModel = getProperties(model); return (prop) => { return propsForModel.find(value => { return value.property === prop; }); }; }
[ "function", "getModelProperty", "(", "model", ")", "{", "const", "className", "=", "model", ".", "constructor", ".", "name", ";", "const", "propsForModel", "=", "getProperties", "(", "model", ")", ";", "return", "(", "prop", ")", "=>", "{", "return", "prop...
lookup meta data for schema properties
[ "lookup", "meta", "data", "for", "schema", "properties" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/model-meta/property-store.js#L22-L30
29,788
forest-fire/firemodel
dist/cjs/src/decorators/model-meta/property-store.js
getProperties
function getProperties(model) { const modelName = model.constructor.name; const properties = typed_conversions_1.hashToArray(exports.propertiesByModel[modelName], "property") || []; let parent = Object.getPrototypeOf(model.constructor); while (parent.name) { const subClass = new parent(); ...
javascript
function getProperties(model) { const modelName = model.constructor.name; const properties = typed_conversions_1.hashToArray(exports.propertiesByModel[modelName], "property") || []; let parent = Object.getPrototypeOf(model.constructor); while (parent.name) { const subClass = new parent(); ...
[ "function", "getProperties", "(", "model", ")", "{", "const", "modelName", "=", "model", ".", "constructor", ".", "name", ";", "const", "properties", "=", "typed_conversions_1", ".", "hashToArray", "(", "exports", ".", "propertiesByModel", "[", "modelName", "]",...
Gets all the properties for a given model @param modelConstructor the schema object which is being looked up
[ "Gets", "all", "the", "properties", "for", "a", "given", "model" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/model-meta/property-store.js#L37-L48
29,789
forest-fire/firemodel
dist/cjs/CompositeKey.js
createCompositeKeyString
function createCompositeKeyString(rec) { const cKey = createCompositeKey(rec); return rec.hasDynamicPath ? cKey.id + Object.keys(cKey) .filter(k => k !== "id") .map(k => `::${k}:${cKey[k]}`) : rec.id; }
javascript
function createCompositeKeyString(rec) { const cKey = createCompositeKey(rec); return rec.hasDynamicPath ? cKey.id + Object.keys(cKey) .filter(k => k !== "id") .map(k => `::${k}:${cKey[k]}`) : rec.id; }
[ "function", "createCompositeKeyString", "(", "rec", ")", "{", "const", "cKey", "=", "createCompositeKey", "(", "rec", ")", ";", "return", "rec", ".", "hasDynamicPath", "?", "cKey", ".", "id", "+", "Object", ".", "keys", "(", "cKey", ")", ".", "filter", "...
Creates a string based composite key if the passed in record has dynamic path segments; if not it will just return the "id"
[ "Creates", "a", "string", "based", "composite", "key", "if", "the", "passed", "in", "record", "has", "dynamic", "path", "segments", ";", "if", "not", "it", "will", "just", "return", "the", "id" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/CompositeKey.js#L12-L20
29,790
forest-fire/firemodel
dist/cjs/Mock/mockProperties.js
mockProperties
function mockProperties(db, config = { relationshipBehavior: "ignore" }, exceptions) { return async (record) => { const meta = ModelMeta_1.getModelMeta(record); const props = meta.properties; const recProps = {}; // below is needed to import faker library props.map(prop => { ...
javascript
function mockProperties(db, config = { relationshipBehavior: "ignore" }, exceptions) { return async (record) => { const meta = ModelMeta_1.getModelMeta(record); const props = meta.properties; const recProps = {}; // below is needed to import faker library props.map(prop => { ...
[ "function", "mockProperties", "(", "db", ",", "config", "=", "{", "relationshipBehavior", ":", "\"ignore\"", "}", ",", "exceptions", ")", "{", "return", "async", "(", "record", ")", "=>", "{", "const", "meta", "=", "ModelMeta_1", ".", "getModelMeta", "(", ...
adds mock values for all the properties on a given model
[ "adds", "mock", "values", "for", "all", "the", "properties", "on", "a", "given", "model" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/Mock/mockProperties.js#L10-L27
29,791
forest-fire/firemodel
dist/cjs/src/decorators/model-meta/relationship-store.js
addRelationshipToModelMeta
function addRelationshipToModelMeta(modelName, property, meta) { if (!exports.relationshipsByModel[modelName]) { exports.relationshipsByModel[modelName] = {}; } // TODO: investigate why we need to genericize to model (from <T>) exports.relationshipsByModel[modelName][property] = meta; }
javascript
function addRelationshipToModelMeta(modelName, property, meta) { if (!exports.relationshipsByModel[modelName]) { exports.relationshipsByModel[modelName] = {}; } // TODO: investigate why we need to genericize to model (from <T>) exports.relationshipsByModel[modelName][property] = meta; }
[ "function", "addRelationshipToModelMeta", "(", "modelName", ",", "property", ",", "meta", ")", "{", "if", "(", "!", "exports", ".", "relationshipsByModel", "[", "modelName", "]", ")", "{", "exports", ".", "relationshipsByModel", "[", "modelName", "]", "=", "{"...
allows the addition of meta information to be added to a model's relationships
[ "allows", "the", "addition", "of", "meta", "information", "to", "be", "added", "to", "a", "model", "s", "relationships" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/model-meta/relationship-store.js#L6-L12
29,792
forest-fire/firemodel
dist/cjs/src/decorators/model-meta/relationship-store.js
getRelationships
function getRelationships(model) { const modelName = model.constructor.name; const properties = typed_conversions_1.hashToArray(exports.relationshipsByModel[modelName], "property") || []; let parent = Object.getPrototypeOf(model.constructor); while (parent.name) { const subClass = new parent(); ...
javascript
function getRelationships(model) { const modelName = model.constructor.name; const properties = typed_conversions_1.hashToArray(exports.relationshipsByModel[modelName], "property") || []; let parent = Object.getPrototypeOf(model.constructor); while (parent.name) { const subClass = new parent(); ...
[ "function", "getRelationships", "(", "model", ")", "{", "const", "modelName", "=", "model", ".", "constructor", ".", "name", ";", "const", "properties", "=", "typed_conversions_1", ".", "hashToArray", "(", "exports", ".", "relationshipsByModel", "[", "modelName", ...
Gets all the relationships for a given model
[ "Gets", "all", "the", "relationships", "for", "a", "given", "model" ]
381b4c9d6df5db47924ef406243f6e8669a1f03e
https://github.com/forest-fire/firemodel/blob/381b4c9d6df5db47924ef406243f6e8669a1f03e/dist/cjs/src/decorators/model-meta/relationship-store.js#L33-L44
29,793
nodeGame/ultimatum-game
auth/auth.js
authPlayers
function authPlayers(channel, info) { var code, player, token; playerId = info.cookies.player; token = info.cookies.token; // Code not existing. if (!code) { console.log('not existing token: ', token); return false; } if (code.checkedOu...
javascript
function authPlayers(channel, info) { var code, player, token; playerId = info.cookies.player; token = info.cookies.token; // Code not existing. if (!code) { console.log('not existing token: ', token); return false; } if (code.checkedOu...
[ "function", "authPlayers", "(", "channel", ",", "info", ")", "{", "var", "code", ",", "player", ",", "token", ";", "playerId", "=", "info", ".", "cookies", ".", "player", ";", "token", "=", "info", ".", "cookies", ".", "token", ";", "// Code not existing...
Creating an authorization function for the players. This is executed before the client the PCONNECT listener. Here direct messages to the client can be sent only using his socketId property, since no clientId has been created yet.
[ "Creating", "an", "authorization", "function", "for", "the", "players", ".", "This", "is", "executed", "before", "the", "client", "the", "PCONNECT", "listener", ".", "Here", "direct", "messages", "to", "the", "client", "can", "be", "sent", "only", "using", "...
b07351612df6d6759bf3563db36855ea3cc4c800
https://github.com/nodeGame/ultimatum-game/blob/b07351612df6d6759bf3563db36855ea3cc4c800/auth/auth.js#L17-L49
29,794
nodeGame/ultimatum-game
auth/auth.js
idGen
function idGen(channel, info) { var cid = channel.registry.generateClientId(); var cookies; var ids; // Return the id only if token was validated. // More checks could be done here to ensure that token is unique in ids. ids = channel.registry.getIds(); cookies =...
javascript
function idGen(channel, info) { var cid = channel.registry.generateClientId(); var cookies; var ids; // Return the id only if token was validated. // More checks could be done here to ensure that token is unique in ids. ids = channel.registry.getIds(); cookies =...
[ "function", "idGen", "(", "channel", ",", "info", ")", "{", "var", "cid", "=", "channel", ".", "registry", ".", "generateClientId", "(", ")", ";", "var", "cookies", ";", "var", "ids", ";", "// Return the id only if token was validated.", "// More checks could be d...
Assigns Player Ids based on cookie token.
[ "Assigns", "Player", "Ids", "based", "on", "cookie", "token", "." ]
b07351612df6d6759bf3563db36855ea3cc4c800
https://github.com/nodeGame/ultimatum-game/blob/b07351612df6d6759bf3563db36855ea3cc4c800/auth/auth.js#L52-L72
29,795
kartotherian/server
static/main.js
bracketDevicePixelRatio
function bracketDevicePixelRatio() { var i, scale, brackets = [ 1, 1.3, 1.5, 2, 2.6, 3 ], baseRatio = window.devicePixelRatio || 1; for ( i = 0; i < brackets.length; i++ ) { scale = brackets[ i ]; if ( scale >= baseRatio || ( baseRatio - scale ) < 0.1 ) { return s...
javascript
function bracketDevicePixelRatio() { var i, scale, brackets = [ 1, 1.3, 1.5, 2, 2.6, 3 ], baseRatio = window.devicePixelRatio || 1; for ( i = 0; i < brackets.length; i++ ) { scale = brackets[ i ]; if ( scale >= baseRatio || ( baseRatio - scale ) < 0.1 ) { return s...
[ "function", "bracketDevicePixelRatio", "(", ")", "{", "var", "i", ",", "scale", ",", "brackets", "=", "[", "1", ",", "1.3", ",", "1.5", ",", "2", ",", "2.6", ",", "3", "]", ",", "baseRatio", "=", "window", ".", "devicePixelRatio", "||", "1", ";", "...
eslint-disable-line func-names Allow user to change style via the ?s=xxx URL parameter Uses "osm-intl" as the default style
[ "eslint", "-", "disable", "-", "line", "func", "-", "names", "Allow", "user", "to", "change", "style", "via", "the", "?s", "=", "xxx", "URL", "parameter", "Uses", "osm", "-", "intl", "as", "the", "default", "style" ]
490b558979199c7bba11aaac269d9e2122f0c819
https://github.com/kartotherian/server/blob/490b558979199c7bba11aaac269d9e2122f0c819/static/main.js#L7-L20
29,796
kartotherian/server
static/main.js
setupMap
function setupMap( config ) { var layerSettings, defaultSettings, query = '', matchLang = location.search.match( /lang=([-_a-zA-Z]+)/ ); defaultSettings = { maxzoom: 18, // TODO: This is UI text, and needs to be translatable. attribution: 'Map data &copy; <a href="http://openstre...
javascript
function setupMap( config ) { var layerSettings, defaultSettings, query = '', matchLang = location.search.match( /lang=([-_a-zA-Z]+)/ ); defaultSettings = { maxzoom: 18, // TODO: This is UI text, and needs to be translatable. attribution: 'Map data &copy; <a href="http://openstre...
[ "function", "setupMap", "(", "config", ")", "{", "var", "layerSettings", ",", "defaultSettings", ",", "query", "=", "''", ",", "matchLang", "=", "location", ".", "search", ".", "match", "(", "/", "lang=([-_a-zA-Z]+)", "/", ")", ";", "defaultSettings", "=", ...
Finishes setting up the map @param {Object|null} config Config object @param {string} [config.attribution] Attribution text to show in footer; see below for default @param {number} [config.maxzoom=18] Maximum zoom level
[ "Finishes", "setting", "up", "the", "map" ]
490b558979199c7bba11aaac269d9e2122f0c819
https://github.com/kartotherian/server/blob/490b558979199c7bba11aaac269d9e2122f0c819/static/main.js#L36-L75
29,797
primus/mirage
index.js
gen
function gen(spark, fn) { crypto.randomBytes(8, function generated(err, buff) { if (err) return fn(err); fn(undefined, buff.toString('hex')); }); }
javascript
function gen(spark, fn) { crypto.randomBytes(8, function generated(err, buff) { if (err) return fn(err); fn(undefined, buff.toString('hex')); }); }
[ "function", "gen", "(", "spark", ",", "fn", ")", "{", "crypto", ".", "randomBytes", "(", "8", ",", "function", "generated", "(", "err", ",", "buff", ")", "{", "if", "(", "err", ")", "return", "fn", "(", "err", ")", ";", "fn", "(", "undefined", ",...
Generator of session ids. It should call the callback with a string that should be used as session id. If a generation failed you should set an error as first argument in the callback. This function will only be called if there is no id sent with the request. @param {Spark} spark The incoming connection. @param {Func...
[ "Generator", "of", "session", "ids", ".", "It", "should", "call", "the", "callback", "with", "a", "string", "that", "should", "be", "used", "as", "session", "id", ".", "If", "a", "generation", "failed", "you", "should", "set", "an", "error", "as", "first...
231c1de1d94593baa0a8ed3e8147f725cbaef36b
https://github.com/primus/mirage/blob/231c1de1d94593baa0a8ed3e8147f725cbaef36b/index.js#L113-L119
29,798
hsnaydd/validetta
dist/validetta.js
function( tmp ) { var _length = tmp.val.length; return _length === 0 || _length >= tmp.arg || messages.minLength.replace( '{count}', tmp.arg ); }
javascript
function( tmp ) { var _length = tmp.val.length; return _length === 0 || _length >= tmp.arg || messages.minLength.replace( '{count}', tmp.arg ); }
[ "function", "(", "tmp", ")", "{", "var", "_length", "=", "tmp", ".", "val", ".", "length", ";", "return", "_length", "===", "0", "||", "_length", ">=", "tmp", ".", "arg", "||", "messages", ".", "minLength", ".", "replace", "(", "'{count}'", ",", "tmp...
Minimum length check
[ "Minimum", "length", "check" ]
f712b7375e1465bfc687a8c6fc93ea700cb590e3
https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L100-L103
29,799
hsnaydd/validetta
dist/validetta.js
function( tmp ) { return tmp.val.length <= tmp.arg || messages.maxLength.replace( '{count}', tmp.arg ); }
javascript
function( tmp ) { return tmp.val.length <= tmp.arg || messages.maxLength.replace( '{count}', tmp.arg ); }
[ "function", "(", "tmp", ")", "{", "return", "tmp", ".", "val", ".", "length", "<=", "tmp", ".", "arg", "||", "messages", ".", "maxLength", ".", "replace", "(", "'{count}'", ",", "tmp", ".", "arg", ")", ";", "}" ]
Maximum lenght check
[ "Maximum", "lenght", "check" ]
f712b7375e1465bfc687a8c6fc93ea700cb590e3
https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L105-L107