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
43,900
tonistiigi/styler
lib/public/build/editor.js
function(session) { this.session = session; this.doc = session.getDocument(); this.clearSelection(); this.selectionLead = this.doc.createAnchor(0, 0); this.selectionAnchor = this.doc.createAnchor(0, 0); var _self = this; this.selectionLead.on("change", function(e) { _self._emit("ch...
javascript
function(session) { this.session = session; this.doc = session.getDocument(); this.clearSelection(); this.selectionLead = this.doc.createAnchor(0, 0); this.selectionAnchor = this.doc.createAnchor(0, 0); var _self = this; this.selectionLead.on("change", function(e) { _self._emit("ch...
[ "function", "(", "session", ")", "{", "this", ".", "session", "=", "session", ";", "this", ".", "doc", "=", "session", ".", "getDocument", "(", ")", ";", "this", ".", "clearSelection", "(", ")", ";", "this", ".", "selectionLead", "=", "this", ".", "d...
Keeps cursor position and the text selection of an edit session. The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
[ "Keeps", "cursor", "position", "and", "the", "text", "selection", "of", "an", "edit", "session", "." ]
f20dd9621f671b77cbb660d35327e007e8a56e2a
https://github.com/tonistiigi/styler/blob/f20dd9621f671b77cbb660d35327e007e8a56e2a/lib/public/build/editor.js#L10737-L10758
43,901
tonistiigi/styler
lib/public/build/editor.js
function(data, hashId, key, keyCode, e) { // If we pressed any command key but no other key, then ignore the input. // Otherwise "shift-" is added to the buffer, and later on "shift-g" // which results in "shift-shift-g" which doesn't make sense. if (hashId != 0 && (key == "" || key == S...
javascript
function(data, hashId, key, keyCode, e) { // If we pressed any command key but no other key, then ignore the input. // Otherwise "shift-" is added to the buffer, and later on "shift-g" // which results in "shift-shift-g" which doesn't make sense. if (hashId != 0 && (key == "" || key == S...
[ "function", "(", "data", ",", "hashId", ",", "key", ",", "keyCode", ",", "e", ")", "{", "// If we pressed any command key but no other key, then ignore the input.", "// Otherwise \"shift-\" is added to the buffer, and later on \"shift-g\"", "// which results in \"shift-shift-g\" which ...
This function is called by keyBinding.
[ "This", "function", "is", "called", "by", "keyBinding", "." ]
f20dd9621f671b77cbb660d35327e007e8a56e2a
https://github.com/tonistiigi/styler/blob/f20dd9621f671b77cbb660d35327e007e8a56e2a/lib/public/build/editor.js#L17825-L17845
43,902
aholstenson/ecolect-js
src/graph/matching/match-set.js
findInsertLocation
function findInsertLocation(matches, score) { const idx = binarySearch(matches, 0, matches.length, score); if(idx < 0) { // If the score was not found return - idx - 1; } /* * Something with the same score was found, make sure this item is * added after all previous items with the same score. */ for(le...
javascript
function findInsertLocation(matches, score) { const idx = binarySearch(matches, 0, matches.length, score); if(idx < 0) { // If the score was not found return - idx - 1; } /* * Something with the same score was found, make sure this item is * added after all previous items with the same score. */ for(le...
[ "function", "findInsertLocation", "(", "matches", ",", "score", ")", "{", "const", "idx", "=", "binarySearch", "(", "matches", ",", "0", ",", "matches", ".", "length", ",", "score", ")", ";", "if", "(", "idx", "<", "0", ")", "{", "// If the score was not...
Find the insert location of an matches with the given score. @param {number} score
[ "Find", "the", "insert", "location", "of", "an", "matches", "with", "the", "given", "score", "." ]
db7f473a7d38588778b5724daa6ad38ac5ea4ec4
https://github.com/aholstenson/ecolect-js/blob/db7f473a7d38588778b5724daa6ad38ac5ea4ec4/src/graph/matching/match-set.js#L28-L45
43,903
layerhq/node-layer-webhooks-services
src/listen.js
handleValidation
function handleValidation(req, res, next) { var payload = JSON.stringify(req.body); var nodeVersion = Number(process.version.replace(/^v/, '').split(/\./)[0]); var utf8safe = nodeVersion >= 6 ? payload : unescape(encodeURIComponent(payload)); var hash = crypto.createHmac('sha1', secret).update(...
javascript
function handleValidation(req, res, next) { var payload = JSON.stringify(req.body); var nodeVersion = Number(process.version.replace(/^v/, '').split(/\./)[0]); var utf8safe = nodeVersion >= 6 ? payload : unescape(encodeURIComponent(payload)); var hash = crypto.createHmac('sha1', secret).update(...
[ "function", "handleValidation", "(", "req", ",", "res", ",", "next", ")", "{", "var", "payload", "=", "JSON", ".", "stringify", "(", "req", ".", "body", ")", ";", "var", "nodeVersion", "=", "Number", "(", "process", ".", "version", ".", "replace", "(",...
Validate that the request comes from Layer services by comparing the secret provided when registering the webhook with the 'layer-webhook-signature' header.
[ "Validate", "that", "the", "request", "comes", "from", "Layer", "services", "by", "comparing", "the", "secret", "provided", "when", "registering", "the", "webhook", "with", "the", "layer", "-", "webhook", "-", "signature", "header", "." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/src/listen.js#L120-L133
43,904
cast-org/figuration
js/tab-responsive.js
function(node) { var $activeTab = $(node); var data = $($activeTab).data('cfw.tab'); if (data) { var $activePane = data.$target; var $paneContainer = $activePane.closest('.tab-content'); $paneContainer.find('[data-cfw="collapse"]').each...
javascript
function(node) { var $activeTab = $(node); var data = $($activeTab).data('cfw.tab'); if (data) { var $activePane = data.$target; var $paneContainer = $activePane.closest('.tab-content'); $paneContainer.find('[data-cfw="collapse"]').each...
[ "function", "(", "node", ")", "{", "var", "$activeTab", "=", "$", "(", "node", ")", ";", "var", "data", "=", "$", "(", "$activeTab", ")", ".", "data", "(", "'cfw.tab'", ")", ";", "if", "(", "data", ")", "{", "var", "$activePane", "=", "data", "."...
Open the collapse element in the active panel Closes all related collapse items first
[ "Open", "the", "collapse", "element", "in", "the", "active", "panel", "Closes", "all", "related", "collapse", "items", "first" ]
c82f491ebccb477f7e1c945bfff61c2340afe1ac
https://github.com/cast-org/figuration/blob/c82f491ebccb477f7e1c945bfff61c2340afe1ac/js/tab-responsive.js#L50-L71
43,905
cast-org/figuration
js/tab-responsive.js
function(node) { var $activeCollapse = $(node); var $paneParent = $activeCollapse.closest('.tab-pane'); var $paneID = $paneParent.attr('id'); var $paneContainer = $activeCollapse.closest('.tab-content'); $paneContainer.find('[data-cfw="collapse"]').each(funct...
javascript
function(node) { var $activeCollapse = $(node); var $paneParent = $activeCollapse.closest('.tab-pane'); var $paneID = $paneParent.attr('id'); var $paneContainer = $activeCollapse.closest('.tab-content'); $paneContainer.find('[data-cfw="collapse"]').each(funct...
[ "function", "(", "node", ")", "{", "var", "$activeCollapse", "=", "$", "(", "node", ")", ";", "var", "$paneParent", "=", "$activeCollapse", ".", "closest", "(", "'.tab-pane'", ")", ";", "var", "$paneID", "=", "$paneParent", ".", "attr", "(", "'id'", ")",...
Set parent panel to active when collapse called Close all other collapse items
[ "Set", "parent", "panel", "to", "active", "when", "collapse", "called", "Close", "all", "other", "collapse", "items" ]
c82f491ebccb477f7e1c945bfff61c2340afe1ac
https://github.com/cast-org/figuration/blob/c82f491ebccb477f7e1c945bfff61c2340afe1ac/js/tab-responsive.js#L75-L104
43,906
NickCis/react-data-ssr
packages/react-data-ssr-server/src/resolveInitialData.js
resolveInitialData
function resolveInitialData(branches, extra) { const errors = {}; const { promises, keys } = branches.reduce( ({ promises, keys }, b) => { const getInitialData = (b.route ? b.route.component : b.component || b) .getInitialData; if (getInitialData) { const { promise, key } = getIniti...
javascript
function resolveInitialData(branches, extra) { const errors = {}; const { promises, keys } = branches.reduce( ({ promises, keys }, b) => { const getInitialData = (b.route ? b.route.component : b.component || b) .getInitialData; if (getInitialData) { const { promise, key } = getIniti...
[ "function", "resolveInitialData", "(", "branches", ",", "extra", ")", "{", "const", "errors", "=", "{", "}", ";", "const", "{", "promises", ",", "keys", "}", "=", "branches", ".", "reduce", "(", "(", "{", "promises", ",", "keys", "}", ",", "b", ")", ...
Server side initial data resolution for react-data-ssr. This function support 3 types of branches: - React Router Config: `{ route: { component: Component, routes: [] }, match: { path: '', url: '', params: {}, isExact: } }` - Dictionary: `{ component: Component, ... }` - Component: `Component` The branches argument c...
[ "Server", "side", "initial", "data", "resolution", "for", "react", "-", "data", "-", "ssr", "." ]
5271a04ed62e53a6a0fef09471f751e778aede10
https://github.com/NickCis/react-data-ssr/blob/5271a04ed62e53a6a0fef09471f751e778aede10/packages/react-data-ssr-server/src/resolveInitialData.js#L15-L43
43,907
opendxl/opendxl-client-javascript
lib/_cli/cli-update-config.js
cliUpdateConfig
function cliUpdateConfig (configDir, hostname, command) { cliUtil.fillEmptyServerCredentialsFromPrompt(command, function (error) { if (error) { provisionUtil.invokeCallback(error, command.doneCallback, command.verbosity) } else { updateConfig(configDir, cliUtil.pull...
javascript
function cliUpdateConfig (configDir, hostname, command) { cliUtil.fillEmptyServerCredentialsFromPrompt(command, function (error) { if (error) { provisionUtil.invokeCallback(error, command.doneCallback, command.verbosity) } else { updateConfig(configDir, cliUtil.pull...
[ "function", "cliUpdateConfig", "(", "configDir", ",", "hostname", ",", "command", ")", "{", "cliUtil", ".", "fillEmptyServerCredentialsFromPrompt", "(", "command", ",", "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "provisionUtil", ".", "in...
Action function invoked for the updateconfig subcommand. @param {String} configDir - Directory in which to store the private key and CSR file. @param {String} hostname - Name of the management service host. @param {Command} command - The Commander command to append options onto.
[ "Action", "function", "invoked", "for", "the", "updateconfig", "subcommand", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-update-config.js#L19-L32
43,908
silas/swagger-framework
lib/framework/router.js
FrameworkRouter
function FrameworkRouter(framework) { debug('create framework router'); this.framework = framework; this.encoder = lodash.clone(http.encoder); this.decoder = lodash.clone(http.decoder); }
javascript
function FrameworkRouter(framework) { debug('create framework router'); this.framework = framework; this.encoder = lodash.clone(http.encoder); this.decoder = lodash.clone(http.decoder); }
[ "function", "FrameworkRouter", "(", "framework", ")", "{", "debug", "(", "'create framework router'", ")", ";", "this", ".", "framework", "=", "framework", ";", "this", ".", "encoder", "=", "lodash", ".", "clone", "(", "http", ".", "encoder", ")", ";", "th...
Initialize a new `FrameworkRouter`. @param {Framework} framework @api private
[ "Initialize", "a", "new", "FrameworkRouter", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/router.js#L27-L33
43,909
opendxl/opendxl-client-javascript
lib/_provisioning/provision-util.js
function (message, component, header) { if (typeof header === 'undefined') { header = '' } if (component) { if (header) { header += ' ' } header += '(' header += component header += ')' } if (header) { message = header + ': ' + message } retu...
javascript
function (message, component, header) { if (typeof header === 'undefined') { header = '' } if (component) { if (header) { header += ' ' } header += '(' header += component header += ')' } if (header) { message = header + ': ' + message } retu...
[ "function", "(", "message", ",", "component", ",", "header", ")", "{", "if", "(", "typeof", "header", "===", "'undefined'", ")", "{", "header", "=", "''", "}", "if", "(", "component", ")", "{", "if", "(", "header", ")", "{", "header", "+=", "' '", ...
Returns a formatted error message string for use in log and exception messages. @param {String} message - The base message. @param {String} [component] - Description of the system component in which the error occurred. @param {String} [header] - Prefix to include before the error message. @returns {String} The formatte...
[ "Returns", "a", "formatted", "error", "message", "string", "for", "use", "in", "log", "and", "exception", "messages", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-util.js#L42-L58
43,910
opendxl/opendxl-client-javascript
lib/_provisioning/provision-util.js
function (error, options) { options = options || {} var verbosity = options.verbosity || 0 var message = module.exports.getErrorMessage( typeof error === 'object' ? error.message : error, options.component, options.header) if (typeof header === 'undefined') { message = 'ERROR: ' + mess...
javascript
function (error, options) { options = options || {} var verbosity = options.verbosity || 0 var message = module.exports.getErrorMessage( typeof error === 'object' ? error.message : error, options.component, options.header) if (typeof header === 'undefined') { message = 'ERROR: ' + mess...
[ "function", "(", "error", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", "var", "verbosity", "=", "options", ".", "verbosity", "||", "0", "var", "message", "=", "module", ".", "exports", ".", "getErrorMessage", "(", "typeof", "error...
Writes an error to the log. @param {(String|Error)} error - The Error or error message string to log. @param {Object} [options] - Error message options. @param {String} [options.component] - Description of the system component in which the error occurred. @param {String} [options.header] - Prefix to include before the ...
[ "Writes", "an", "error", "to", "the", "log", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-util.js#L70-L83
43,911
opendxl/opendxl-client-javascript
lib/_provisioning/provision-util.js
function (file, data) { module.exports.mkdirRecursive(path.dirname(file)) fs.writeFileSync(file, data, {mode: _0644}) }
javascript
function (file, data) { module.exports.mkdirRecursive(path.dirname(file)) fs.writeFileSync(file, data, {mode: _0644}) }
[ "function", "(", "file", ",", "data", ")", "{", "module", ".", "exports", ".", "mkdirRecursive", "(", "path", ".", "dirname", "(", "file", ")", ")", "fs", ".", "writeFileSync", "(", "file", ",", "data", ",", "{", "mode", ":", "_0644", "}", ")", "}"...
Saves the supplied data into the specified file. This function attempts to create the directory in which the file would reside if the directory does not already exist. @param {String} file - File to create. @param {String} data - Data to store in the file.
[ "Saves", "the", "supplied", "data", "into", "the", "specified", "file", ".", "This", "function", "attempts", "to", "create", "the", "directory", "in", "which", "the", "file", "would", "reside", "if", "the", "directory", "does", "not", "already", "exist", "."...
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-util.js#L114-L117
43,912
opendxl/opendxl-client-javascript
lib/_provisioning/provision-util.js
function (error, callback, verbosity) { if (callback) { callback(error) } else { module.exports.logError(error, {verbosity: verbosity}) } }
javascript
function (error, callback, verbosity) { if (callback) { callback(error) } else { module.exports.logError(error, {verbosity: verbosity}) } }
[ "function", "(", "error", ",", "callback", ",", "verbosity", ")", "{", "if", "(", "callback", ")", "{", "callback", "(", "error", ")", "}", "else", "{", "module", ".", "exports", ".", "logError", "(", "error", ",", "{", "verbosity", ":", "verbosity", ...
Invokes a callback with the supplied `Error`. @param {Error} error - The error. @param {Function} callback - Callback to invoke. If null, the `Error` is written to a log. @param {Number} [verbosity] - Level of verbosity at which to log the error message if the callback is not invoked.
[ "Invokes", "a", "callback", "with", "the", "supplied", "Error", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-util.js#L126-L132
43,913
plouc/node-firewall
lib/firewall.js
Firewall
function Firewall(name, path, authenticationHandler, successHandler, failureHandler) { this.name = name; this.path = utils.ensureRegexp(path); this.rules = []; // configure handlers this.authenticationHandler = authenticationHandler || function (req, res, next) { res.status(40...
javascript
function Firewall(name, path, authenticationHandler, successHandler, failureHandler) { this.name = name; this.path = utils.ensureRegexp(path); this.rules = []; // configure handlers this.authenticationHandler = authenticationHandler || function (req, res, next) { res.status(40...
[ "function", "Firewall", "(", "name", ",", "path", ",", "authenticationHandler", ",", "successHandler", ",", "failureHandler", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "path", "=", "utils", ".", "ensureRegexp", "(", "path", ")", ";", ...
The firewall is a simple container for multiple url based authorization rules. @param {string} name The firewall name @param {string|RegExp} path The firewall will only apply on request url matching this value @param {function|null} authenticationHandler Function to call when l...
[ "The", "firewall", "is", "a", "simple", "container", "for", "multiple", "url", "based", "authorization", "rules", "." ]
42520e18acecf1e4c0e0d842da1a517ce37aa8ff
https://github.com/plouc/node-firewall/blob/42520e18acecf1e4c0e0d842da1a517ce37aa8ff/lib/firewall.js#L18-L38
43,914
cocos-creator/fire-fs
index.js
exists
function exists (path, callback) { Fs.stat(path, function (err) { callback(checkErr(err)); }); }
javascript
function exists (path, callback) { Fs.stat(path, function (err) { callback(checkErr(err)); }); }
[ "function", "exists", "(", "path", ",", "callback", ")", "{", "Fs", ".", "stat", "(", "path", ",", "function", "(", "err", ")", "{", "callback", "(", "checkErr", "(", "err", ")", ")", ";", "}", ")", ";", "}" ]
check if a given path exists @method exists @param {string} path @param {function} callback
[ "check", "if", "a", "given", "path", "exists" ]
12cc33baf42774f2360fafdb56ef7ad13258f234
https://github.com/cocos-creator/fire-fs/blob/12cc33baf42774f2360fafdb56ef7ad13258f234/index.js#L12-L16
43,915
cocos-creator/fire-fs
index.js
existsSync
function existsSync(path) { if ( path === null || path === undefined ) return false; try { Fs.statSync(path); return true; } catch (err) { return checkErr(err); } }
javascript
function existsSync(path) { if ( path === null || path === undefined ) return false; try { Fs.statSync(path); return true; } catch (err) { return checkErr(err); } }
[ "function", "existsSync", "(", "path", ")", "{", "if", "(", "path", "===", "null", "||", "path", "===", "undefined", ")", "return", "false", ";", "try", "{", "Fs", ".", "statSync", "(", "path", ")", ";", "return", "true", ";", "}", "catch", "(", "e...
check if a given path exists, this is the sync version of FireFs.exists @method existsSync @param {string} path @return {boolean}
[ "check", "if", "a", "given", "path", "exists", "this", "is", "the", "sync", "version", "of", "FireFs", ".", "exists" ]
12cc33baf42774f2360fafdb56ef7ad13258f234
https://github.com/cocos-creator/fire-fs/blob/12cc33baf42774f2360fafdb56ef7ad13258f234/index.js#L26-L36
43,916
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
cleanup
function cleanup(err, compacted, activeCtx, options) { if(err) { return callback(err); } if(options.compactArrays && !options.graph && _isArray(compacted)) { // simplify to a single item if(compacted.length === 1) { compacted = compacted[0]; } // simplify to an empty o...
javascript
function cleanup(err, compacted, activeCtx, options) { if(err) { return callback(err); } if(options.compactArrays && !options.graph && _isArray(compacted)) { // simplify to a single item if(compacted.length === 1) { compacted = compacted[0]; } // simplify to an empty o...
[ "function", "cleanup", "(", "err", ",", "compacted", ",", "activeCtx", ",", "options", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", ";", "}", "if", "(", "options", ".", "compactArrays", "&&", "!", "options", ".", "grap...
performs clean up after compaction
[ "performs", "clean", "up", "after", "compaction" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L164-L230
43,917
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
createDocumentLoader
function createDocumentLoader(promise) { return function(url, callback) { promise(url).then( // success function(remoteDocument) { callback(null, remoteDocument); }, // failure callback ); }; }
javascript
function createDocumentLoader(promise) { return function(url, callback) { promise(url).then( // success function(remoteDocument) { callback(null, remoteDocument); }, // failure callback ); }; }
[ "function", "createDocumentLoader", "(", "promise", ")", "{", "return", "function", "(", "url", ",", "callback", ")", "{", "promise", "(", "url", ")", ".", "then", "(", "// success", "function", "(", "remoteDocument", ")", "{", "callback", "(", "null", ","...
converts a load document promise callback to a node-style callback
[ "converts", "a", "load", "document", "promise", "callback", "to", "a", "node", "-", "style", "callback" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L894-L905
43,918
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
function(msg, type, details) { if(_nodejs) { Error.call(this); Error.captureStackTrace(this, this.constructor); } this.name = type || 'jsonld.Error'; this.message = msg || 'An unspecified JSON-LD error occurred.'; this.details = details || {}; }
javascript
function(msg, type, details) { if(_nodejs) { Error.call(this); Error.captureStackTrace(this, this.constructor); } this.name = type || 'jsonld.Error'; this.message = msg || 'An unspecified JSON-LD error occurred.'; this.details = details || {}; }
[ "function", "(", "msg", ",", "type", ",", "details", ")", "{", "if", "(", "_nodejs", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "}", "this", ".",...
A JSON-LD Error. @param msg the error message. @param type the error type. @param details the error details.
[ "A", "JSON", "-", "LD", "Error", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L1737-L1745
43,919
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
hashBlankNodes
function hashBlankNodes(unnamed) { var nextUnnamed = []; var duplicates = {}; var unique = {}; // hash quads for each unnamed bnode jsonld.setImmediate(function() {hashUnnamed(0);}); function hashUnnamed(i) { if(i === unnamed.length) { // done, name blank nodes return name...
javascript
function hashBlankNodes(unnamed) { var nextUnnamed = []; var duplicates = {}; var unique = {}; // hash quads for each unnamed bnode jsonld.setImmediate(function() {hashUnnamed(0);}); function hashUnnamed(i) { if(i === unnamed.length) { // done, name blank nodes return name...
[ "function", "hashBlankNodes", "(", "unnamed", ")", "{", "var", "nextUnnamed", "=", "[", "]", ";", "var", "duplicates", "=", "{", "}", ";", "var", "unique", "=", "{", "}", ";", "// hash quads for each unnamed bnode", "jsonld", ".", "setImmediate", "(", "funct...
generates unique and duplicate hashes for bnodes
[ "generates", "unique", "and", "duplicate", "hashes", "for", "bnodes" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L2502-L2537
43,920
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
nameBlankNodes
function nameBlankNodes(unique, duplicates, unnamed) { // name unique bnodes in sorted hash order var named = false; var hashes = Object.keys(unique).sort(); for(var i = 0; i < hashes.length; ++i) { var bnode = unique[hashes[i]]; namer.getName(bnode); named = true; } // contin...
javascript
function nameBlankNodes(unique, duplicates, unnamed) { // name unique bnodes in sorted hash order var named = false; var hashes = Object.keys(unique).sort(); for(var i = 0; i < hashes.length; ++i) { var bnode = unique[hashes[i]]; namer.getName(bnode); named = true; } // contin...
[ "function", "nameBlankNodes", "(", "unique", ",", "duplicates", ",", "unnamed", ")", "{", "// name unique bnodes in sorted hash order", "var", "named", "=", "false", ";", "var", "hashes", "=", "Object", ".", "keys", "(", "unique", ")", ".", "sort", "(", ")", ...
names unique hash bnodes
[ "names", "unique", "hash", "bnodes" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L2540-L2558
43,921
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
nameDuplicates
function nameDuplicates(duplicates) { // enumerate duplicate hash groups in sorted order var hashes = Object.keys(duplicates).sort(); // process each group processGroup(0); function processGroup(i) { if(i === hashes.length) { // done, create JSON-LD array return createArray();...
javascript
function nameDuplicates(duplicates) { // enumerate duplicate hash groups in sorted order var hashes = Object.keys(duplicates).sort(); // process each group processGroup(0); function processGroup(i) { if(i === hashes.length) { // done, create JSON-LD array return createArray();...
[ "function", "nameDuplicates", "(", "duplicates", ")", "{", "// enumerate duplicate hash groups in sorted order", "var", "hashes", "=", "Object", ".", "keys", "(", "duplicates", ")", ".", "sort", "(", ")", ";", "// process each group", "processGroup", "(", "0", ")", ...
names duplicate hash bnodes
[ "names", "duplicate", "hash", "bnodes" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L2561-L2614
43,922
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
createArray
function createArray() { var normalized = []; /* Note: At this point all bnodes in the set of RDF quads have been assigned canonical names, which have been stored in the 'namer' object. Here each quad is updated by assigning each of its bnodes its new name via the 'namer' object. */ // upda...
javascript
function createArray() { var normalized = []; /* Note: At this point all bnodes in the set of RDF quads have been assigned canonical names, which have been stored in the 'namer' object. Here each quad is updated by assigning each of its bnodes its new name via the 'namer' object. */ // upda...
[ "function", "createArray", "(", ")", "{", "var", "normalized", "=", "[", "]", ";", "/* Note: At this point all bnodes in the set of RDF quads have been\n assigned canonical names, which have been stored in the 'namer' object.\n Here each quad is updated by assigning each of its bnodes ...
creates the sorted array of RDF quads
[ "creates", "the", "sorted", "array", "of", "RDF", "quads" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L2617-L2654
43,923
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_expandLanguageMap
function _expandLanguageMap(languageMap) { var rval = []; var keys = Object.keys(languageMap).sort(); for(var ki = 0; ki < keys.length; ++ki) { var key = keys[ki]; var val = languageMap[key]; if(!_isArray(val)) { val = [val]; } for(var vi = 0; vi < val.length; ++vi) { var item = va...
javascript
function _expandLanguageMap(languageMap) { var rval = []; var keys = Object.keys(languageMap).sort(); for(var ki = 0; ki < keys.length; ++ki) { var key = keys[ki]; var val = languageMap[key]; if(!_isArray(val)) { val = [val]; } for(var vi = 0; vi < val.length; ++vi) { var item = va...
[ "function", "_expandLanguageMap", "(", "languageMap", ")", "{", "var", "rval", "=", "[", "]", ";", "var", "keys", "=", "Object", ".", "keys", "(", "languageMap", ")", ".", "sort", "(", ")", ";", "for", "(", "var", "ki", "=", "0", ";", "ki", "<", ...
Expands a language map. @param languageMap the language map to expand. @return the expanded language map.
[ "Expands", "a", "language", "map", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L2983-L3006
43,924
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_labelBlankNodes
function _labelBlankNodes(namer, element) { if(_isArray(element)) { for(var i = 0; i < element.length; ++i) { element[i] = _labelBlankNodes(namer, element[i]); } } else if(_isList(element)) { element['@list'] = _labelBlankNodes(namer, element['@list']); } else if(_isObject(element)) { //...
javascript
function _labelBlankNodes(namer, element) { if(_isArray(element)) { for(var i = 0; i < element.length; ++i) { element[i] = _labelBlankNodes(namer, element[i]); } } else if(_isList(element)) { element['@list'] = _labelBlankNodes(namer, element['@list']); } else if(_isObject(element)) { //...
[ "function", "_labelBlankNodes", "(", "namer", ",", "element", ")", "{", "if", "(", "_isArray", "(", "element", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "element", ".", "length", ";", "++", "i", ")", "{", "element", "[", "i"...
Labels the blank nodes in the given value using the given UniqueNamer. @param namer the UniqueNamer to use. @param element the element with blank nodes to rename. @return the element.
[ "Labels", "the", "blank", "nodes", "in", "the", "given", "value", "using", "the", "given", "UniqueNamer", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3016-L3042
43,925
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_expandValue
function _expandValue(activeCtx, activeProperty, value) { // nothing to expand if(value === null) { return null; } // special-case expand @id and @type (skips '@id' expansion) var expandedProperty = _expandIri(activeCtx, activeProperty, {vocab: true}); if(expandedProperty === '@id') { return _expan...
javascript
function _expandValue(activeCtx, activeProperty, value) { // nothing to expand if(value === null) { return null; } // special-case expand @id and @type (skips '@id' expansion) var expandedProperty = _expandIri(activeCtx, activeProperty, {vocab: true}); if(expandedProperty === '@id') { return _expan...
[ "function", "_expandValue", "(", "activeCtx", ",", "activeProperty", ",", "value", ")", "{", "// nothing to expand", "if", "(", "value", "===", "null", ")", "{", "return", "null", ";", "}", "// special-case expand @id and @type (skips '@id' expansion)", "var", "expand...
Expands the given value by using the coercion and keyword rules in the given context. @param activeCtx the active context to use. @param activeProperty the active property the value is associated with. @param value the value to expand. @return the expanded value.
[ "Expands", "the", "given", "value", "by", "using", "the", "coercion", "and", "keyword", "rules", "in", "the", "given", "context", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3054-L3103
43,926
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_graphToRDF
function _graphToRDF(graph, namer) { var rval = []; var ids = Object.keys(graph).sort(); for(var i = 0; i < ids.length; ++i) { var id = ids[i]; var node = graph[id]; var properties = Object.keys(node).sort(); for(var pi = 0; pi < properties.length; ++pi) { var property = properties[pi]; ...
javascript
function _graphToRDF(graph, namer) { var rval = []; var ids = Object.keys(graph).sort(); for(var i = 0; i < ids.length; ++i) { var id = ids[i]; var node = graph[id]; var properties = Object.keys(node).sort(); for(var pi = 0; pi < properties.length; ++pi) { var property = properties[pi]; ...
[ "function", "_graphToRDF", "(", "graph", ",", "namer", ")", "{", "var", "rval", "=", "[", "]", ";", "var", "ids", "=", "Object", ".", "keys", "(", "graph", ")", ".", "sort", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ids...
Creates an array of RDF triples for the given graph. @param graph the graph to create RDF triples for. @param namer a UniqueNamer for assigning blank node names. @return the array of RDF triples for the given graph.
[ "Creates", "an", "array", "of", "RDF", "triples", "for", "the", "given", "graph", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3113-L3158
43,927
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_objectToRDF
function _objectToRDF(item) { var object = {}; // convert value object to RDF if(_isValue(item)) { object.type = 'literal'; var value = item['@value']; var datatype = item['@type'] || null; // convert to XSD datatypes as appropriate if(_isBoolean(value)) { object.value = value.toString...
javascript
function _objectToRDF(item) { var object = {}; // convert value object to RDF if(_isValue(item)) { object.type = 'literal'; var value = item['@value']; var datatype = item['@type'] || null; // convert to XSD datatypes as appropriate if(_isBoolean(value)) { object.value = value.toString...
[ "function", "_objectToRDF", "(", "item", ")", "{", "var", "object", "=", "{", "}", ";", "// convert value object to RDF", "if", "(", "_isValue", "(", "item", ")", ")", "{", "object", ".", "type", "=", "'literal'", ";", "var", "value", "=", "item", "[", ...
Converts a JSON-LD value object to an RDF literal or a JSON-LD string or node object to an RDF resource. @param item the JSON-LD value or node object. @return the RDF literal or RDF resource.
[ "Converts", "a", "JSON", "-", "LD", "value", "object", "to", "an", "RDF", "literal", "or", "a", "JSON", "-", "LD", "string", "or", "node", "object", "to", "an", "RDF", "resource", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3200-L3241
43,928
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_RDFToObject
function _RDFToObject(o, useNativeTypes) { // convert IRI/blank node object to JSON-LD if(o.type === 'IRI' || o.type === 'blank node') { return {'@id': o.value}; } // convert literal to JSON-LD var rval = {'@value': o.value}; // add language if('language' in o) { rval['@language'] = o.language; ...
javascript
function _RDFToObject(o, useNativeTypes) { // convert IRI/blank node object to JSON-LD if(o.type === 'IRI' || o.type === 'blank node') { return {'@id': o.value}; } // convert literal to JSON-LD var rval = {'@value': o.value}; // add language if('language' in o) { rval['@language'] = o.language; ...
[ "function", "_RDFToObject", "(", "o", ",", "useNativeTypes", ")", "{", "// convert IRI/blank node object to JSON-LD", "if", "(", "o", ".", "type", "===", "'IRI'", "||", "o", ".", "type", "===", "'blank node'", ")", "{", "return", "{", "'@id'", ":", "o", ".",...
Converts an RDF triple object to a JSON-LD object. @param o the RDF triple object to convert. @param useNativeTypes true to output native types, false not to. @return the JSON-LD object.
[ "Converts", "an", "RDF", "triple", "object", "to", "a", "JSON", "-", "LD", "object", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3251-L3300
43,929
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_compareRDFTriples
function _compareRDFTriples(t1, t2) { var attrs = ['subject', 'predicate', 'object']; for(var i = 0; i < attrs.length; ++i) { var attr = attrs[i]; if(t1[attr].type !== t2[attr].type || t1[attr].value !== t2[attr].value) { return false; } } if(t1.object.language !== t2.object.language) { re...
javascript
function _compareRDFTriples(t1, t2) { var attrs = ['subject', 'predicate', 'object']; for(var i = 0; i < attrs.length; ++i) { var attr = attrs[i]; if(t1[attr].type !== t2[attr].type || t1[attr].value !== t2[attr].value) { return false; } } if(t1.object.language !== t2.object.language) { re...
[ "function", "_compareRDFTriples", "(", "t1", ",", "t2", ")", "{", "var", "attrs", "=", "[", "'subject'", ",", "'predicate'", ",", "'object'", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "attrs", ".", "length", ";", "++", "i", ")", ...
Compares two RDF triples for equality. @param t1 the first triple. @param t2 the second triple. @return true if the triples are the same, false if not.
[ "Compares", "two", "RDF", "triples", "for", "equality", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3310-L3325
43,930
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_hashQuads
function _hashQuads(id, bnodes, namer) { // return cached hash if('hash' in bnodes[id]) { return bnodes[id].hash; } // serialize all of bnode's quads var quads = bnodes[id].quads; var nquads = []; for(var i = 0; i < quads.length; ++i) { nquads.push(_toNQuad( quads[i], quads[i].name ? quads[...
javascript
function _hashQuads(id, bnodes, namer) { // return cached hash if('hash' in bnodes[id]) { return bnodes[id].hash; } // serialize all of bnode's quads var quads = bnodes[id].quads; var nquads = []; for(var i = 0; i < quads.length; ++i) { nquads.push(_toNQuad( quads[i], quads[i].name ? quads[...
[ "function", "_hashQuads", "(", "id", ",", "bnodes", ",", "namer", ")", "{", "// return cached hash", "if", "(", "'hash'", "in", "bnodes", "[", "id", "]", ")", "{", "return", "bnodes", "[", "id", "]", ".", "hash", ";", "}", "// serialize all of bnode's quad...
Hashes all of the quads about a blank node. @param id the ID of the bnode to hash quads for. @param bnodes the mapping of bnodes to quads. @param namer the canonical bnode namer. @return the new hash.
[ "Hashes", "all", "of", "the", "quads", "about", "a", "blank", "node", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3336-L3354
43,931
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
nextPermutation
function nextPermutation(skipped) { if(!skipped && (chosenPath === null || path < chosenPath)) { chosenPath = path; chosenNamer = pathNamerCopy; } // do next permutation if(permutator.hasNext()) { jsonld.setImmediate(function() {permutate();}); } ...
javascript
function nextPermutation(skipped) { if(!skipped && (chosenPath === null || path < chosenPath)) { chosenPath = path; chosenNamer = pathNamerCopy; } // do next permutation if(permutator.hasNext()) { jsonld.setImmediate(function() {permutate();}); } ...
[ "function", "nextPermutation", "(", "skipped", ")", "{", "if", "(", "!", "skipped", "&&", "(", "chosenPath", "===", "null", "||", "path", "<", "chosenPath", ")", ")", "{", "chosenPath", "=", "path", ";", "chosenNamer", "=", "pathNamerCopy", ";", "}", "//...
stores the results of this permutation and runs the next
[ "stores", "the", "results", "of", "this", "permutation", "and", "runs", "the", "next" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3507-L3525
43,932
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_getFrameFlag
function _getFrameFlag(frame, options, name) { var flag = '@' + name; return (flag in frame) ? frame[flag][0] : options[name]; }
javascript
function _getFrameFlag(frame, options, name) { var flag = '@' + name; return (flag in frame) ? frame[flag][0] : options[name]; }
[ "function", "_getFrameFlag", "(", "frame", ",", "options", ",", "name", ")", "{", "var", "flag", "=", "'@'", "+", "name", ";", "return", "(", "flag", "in", "frame", ")", "?", "frame", "[", "flag", "]", "[", "0", "]", ":", "options", "[", "name", ...
Gets the frame flag value for the given flag name. @param frame the frame. @param options the framing options. @param name the flag name. @return the flag value.
[ "Gets", "the", "frame", "flag", "value", "for", "the", "given", "flag", "name", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3896-L3899
43,933
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_validateFrame
function _validateFrame(state, frame) { if(!_isArray(frame) || frame.length !== 1 || !_isObject(frame[0])) { throw new JsonLdError( 'Invalid JSON-LD syntax; a JSON-LD frame must be a single object.', 'jsonld.SyntaxError', {frame: frame}); } }
javascript
function _validateFrame(state, frame) { if(!_isArray(frame) || frame.length !== 1 || !_isObject(frame[0])) { throw new JsonLdError( 'Invalid JSON-LD syntax; a JSON-LD frame must be a single object.', 'jsonld.SyntaxError', {frame: frame}); } }
[ "function", "_validateFrame", "(", "state", ",", "frame", ")", "{", "if", "(", "!", "_isArray", "(", "frame", ")", "||", "frame", ".", "length", "!==", "1", "||", "!", "_isObject", "(", "frame", "[", "0", "]", ")", ")", "{", "throw", "new", "JsonLd...
Validates a JSON-LD frame, throwing an exception if the frame is invalid. @param state the current frame state. @param frame the frame to validate.
[ "Validates", "a", "JSON", "-", "LD", "frame", "throwing", "an", "exception", "if", "the", "frame", "is", "invalid", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3907-L3913
43,934
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_filterSubjects
function _filterSubjects(state, subjects, frame) { // filter subjects in @id order var rval = {}; for(var i = 0; i < subjects.length; ++i) { var id = subjects[i]; var subject = state.subjects[id]; if(_filterSubject(subject, frame)) { rval[id] = subject; } } return rval; }
javascript
function _filterSubjects(state, subjects, frame) { // filter subjects in @id order var rval = {}; for(var i = 0; i < subjects.length; ++i) { var id = subjects[i]; var subject = state.subjects[id]; if(_filterSubject(subject, frame)) { rval[id] = subject; } } return rval; }
[ "function", "_filterSubjects", "(", "state", ",", "subjects", ",", "frame", ")", "{", "// filter subjects in @id order", "var", "rval", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "subjects", ".", "length", ";", "++", "i", ")",...
Returns a map of all of the subjects that match a parsed frame. @param state the current framing state. @param subjects the set of subjects to filter. @param frame the parsed frame. @return all of the matched subjects.
[ "Returns", "a", "map", "of", "all", "of", "the", "subjects", "that", "match", "a", "parsed", "frame", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3924-L3935
43,935
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_filterSubject
function _filterSubject(subject, frame) { // check @type (object value means 'any' type, fall through to ducktyping) if('@type' in frame && !(frame['@type'].length === 1 && _isObject(frame['@type'][0]))) { var types = frame['@type']; for(var i = 0; i < types.length; ++i) { // any matching @type is...
javascript
function _filterSubject(subject, frame) { // check @type (object value means 'any' type, fall through to ducktyping) if('@type' in frame && !(frame['@type'].length === 1 && _isObject(frame['@type'][0]))) { var types = frame['@type']; for(var i = 0; i < types.length; ++i) { // any matching @type is...
[ "function", "_filterSubject", "(", "subject", ",", "frame", ")", "{", "// check @type (object value means 'any' type, fall through to ducktyping)", "if", "(", "'@type'", "in", "frame", "&&", "!", "(", "frame", "[", "'@type'", "]", ".", "length", "===", "1", "&&", ...
Returns true if the given subject matches the given frame. @param subject the subject to check. @param frame the frame to check. @return true if the subject matches, false if not.
[ "Returns", "true", "if", "the", "given", "subject", "matches", "the", "given", "frame", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3945-L3967
43,936
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_embedValues
function _embedValues(state, subject, property, output) { // embed subject properties in output var objects = subject[property]; for(var i = 0; i < objects.length; ++i) { var o = objects[i]; // recurse into @list if(_isList(o)) { var list = {'@list': []}; _addFrameOutput(state, output, pr...
javascript
function _embedValues(state, subject, property, output) { // embed subject properties in output var objects = subject[property]; for(var i = 0; i < objects.length; ++i) { var o = objects[i]; // recurse into @list if(_isList(o)) { var list = {'@list': []}; _addFrameOutput(state, output, pr...
[ "function", "_embedValues", "(", "state", ",", "subject", ",", "property", ",", "output", ")", "{", "// embed subject properties in output", "var", "objects", "=", "subject", "[", "property", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "obje...
Embeds values for the given subject and property into the given output during the framing algorithm. @param state the current framing state. @param subject the subject. @param property the property. @param output the output.
[ "Embeds", "values", "for", "the", "given", "subject", "and", "property", "into", "the", "given", "output", "during", "the", "framing", "algorithm", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L3978-L4020
43,937
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_removeEmbed
function _removeEmbed(state, id) { // get existing embed var embeds = state.embeds; var embed = embeds[id]; var parent = embed.parent; var property = embed.property; // create reference to replace embed var subject = {'@id': id}; // remove existing embed if(_isArray(parent)) { // replace subject...
javascript
function _removeEmbed(state, id) { // get existing embed var embeds = state.embeds; var embed = embeds[id]; var parent = embed.parent; var property = embed.property; // create reference to replace embed var subject = {'@id': id}; // remove existing embed if(_isArray(parent)) { // replace subject...
[ "function", "_removeEmbed", "(", "state", ",", "id", ")", "{", "// get existing embed", "var", "embeds", "=", "state", ".", "embeds", ";", "var", "embed", "=", "embeds", "[", "id", "]", ";", "var", "parent", "=", "embed", ".", "parent", ";", "var", "pr...
Removes an existing embed. @param state the current framing state. @param id the @id of the embed to remove.
[ "Removes", "an", "existing", "embed", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4028-L4069
43,938
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
function(id) { // get embed keys as a separate array to enable deleting keys in map var ids = Object.keys(embeds); for(var i = 0; i < ids.length; ++i) { var next = ids[i]; if(next in embeds && _isObject(embeds[next].parent) && embeds[next].parent['@id'] === id) { delete embeds[ne...
javascript
function(id) { // get embed keys as a separate array to enable deleting keys in map var ids = Object.keys(embeds); for(var i = 0; i < ids.length; ++i) { var next = ids[i]; if(next in embeds && _isObject(embeds[next].parent) && embeds[next].parent['@id'] === id) { delete embeds[ne...
[ "function", "(", "id", ")", "{", "// get embed keys as a separate array to enable deleting keys in map", "var", "ids", "=", "Object", ".", "keys", "(", "embeds", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ids", ".", "length", ";", "++", "i...
recursively remove dependent dangling embeds
[ "recursively", "remove", "dependent", "dangling", "embeds" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4056-L4067
43,939
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_addFrameOutput
function _addFrameOutput(state, parent, property, output) { if(_isObject(parent)) { jsonld.addValue(parent, property, output, {propertyIsArray: true}); } else { parent.push(output); } }
javascript
function _addFrameOutput(state, parent, property, output) { if(_isObject(parent)) { jsonld.addValue(parent, property, output, {propertyIsArray: true}); } else { parent.push(output); } }
[ "function", "_addFrameOutput", "(", "state", ",", "parent", ",", "property", ",", "output", ")", "{", "if", "(", "_isObject", "(", "parent", ")", ")", "{", "jsonld", ".", "addValue", "(", "parent", ",", "property", ",", "output", ",", "{", "propertyIsArr...
Adds framing output to the given parent. @param state the current framing state. @param parent the parent to add to. @param property the parent property. @param output the output to add.
[ "Adds", "framing", "output", "to", "the", "given", "parent", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4079-L4086
43,940
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_selectTerm
function _selectTerm( activeCtx, iri, value, containers, typeOrLanguage, typeOrLanguageValue) { if(typeOrLanguageValue === null) { typeOrLanguageValue = '@null'; } // preferences for the value of @type or @language var prefs = []; // determine prefs for @id based on whether or not value compacts to a ...
javascript
function _selectTerm( activeCtx, iri, value, containers, typeOrLanguage, typeOrLanguageValue) { if(typeOrLanguageValue === null) { typeOrLanguageValue = '@null'; } // preferences for the value of @type or @language var prefs = []; // determine prefs for @id based on whether or not value compacts to a ...
[ "function", "_selectTerm", "(", "activeCtx", ",", "iri", ",", "value", ",", "containers", ",", "typeOrLanguage", ",", "typeOrLanguageValue", ")", "{", "if", "(", "typeOrLanguageValue", "===", "null", ")", "{", "typeOrLanguageValue", "=", "'@null'", ";", "}", "...
Picks the preferred compaction term from the given inverse context entry. @param activeCtx the active context. @param iri the IRI to pick the term for. @param value the value to pick the term for. @param containers the preferred containers. @param typeOrLanguage either '@type' or '@language'. @param typeOrLanguageValu...
[ "Picks", "the", "preferred", "compaction", "term", "from", "the", "given", "inverse", "context", "entry", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4177-L4233
43,941
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_expandIri
function _expandIri(activeCtx, value, relativeTo, localCtx, defined) { // already expanded if(value === null || _isKeyword(value)) { return value; } // define term dependency if not defined if(localCtx && value in localCtx && defined[value] !== true) { _createTermDefinition(activeCtx, localCtx, value...
javascript
function _expandIri(activeCtx, value, relativeTo, localCtx, defined) { // already expanded if(value === null || _isKeyword(value)) { return value; } // define term dependency if not defined if(localCtx && value in localCtx && defined[value] !== true) { _createTermDefinition(activeCtx, localCtx, value...
[ "function", "_expandIri", "(", "activeCtx", ",", "value", ",", "relativeTo", ",", "localCtx", ",", "defined", ")", "{", "// already expanded", "if", "(", "value", "===", "null", "||", "_isKeyword", "(", "value", ")", ")", "{", "return", "value", ";", "}", ...
Expands a string to a full IRI. The string may be a term, a prefix, a relative IRI, or an absolute IRI. The associated absolute IRI will be returned. @param activeCtx the current active context. @param value the string to expand. @param relativeTo options for how to resolve relative IRIs: base: true to resolve against...
[ "Expands", "a", "string", "to", "a", "full", "IRI", ".", "The", "string", "may", "be", "a", "term", "a", "prefix", "a", "relative", "IRI", "or", "an", "absolute", "IRI", ".", "The", "associated", "absolute", "IRI", "will", "be", "returned", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4729-L4804
43,942
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_prependBase
function _prependBase(base, iri) { // already an absolute IRI if(iri.indexOf(':') !== -1) { return iri; } // parse base if it is a string if(_isString(base)) { base = jsonld.url.parse(base || ''); } // parse given IRI var rel = jsonld.url.parse(iri); // start hierarchical part var hierPar...
javascript
function _prependBase(base, iri) { // already an absolute IRI if(iri.indexOf(':') !== -1) { return iri; } // parse base if it is a string if(_isString(base)) { base = jsonld.url.parse(base || ''); } // parse given IRI var rel = jsonld.url.parse(iri); // start hierarchical part var hierPar...
[ "function", "_prependBase", "(", "base", ",", "iri", ")", "{", "// already an absolute IRI", "if", "(", "iri", ".", "indexOf", "(", "':'", ")", "!==", "-", "1", ")", "{", "return", "iri", ";", "}", "// parse base if it is a string", "if", "(", "_isString", ...
Prepends a base IRI to the given relative IRI. @param base the base IRI. @param iri the relative IRI. @return the absolute IRI.
[ "Prepends", "a", "base", "IRI", "to", "the", "given", "relative", "IRI", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4814-L4875
43,943
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_removeBase
function _removeBase(base, iri) { if(_isString(base)) { base = jsonld.url.parse(base || ''); } // establish base root var root = ''; if(base.href !== '') { root += (base.protocol || '') + '//' + base.authority; } // support network-path reference with empty base else if(iri.indexOf('//')) { ...
javascript
function _removeBase(base, iri) { if(_isString(base)) { base = jsonld.url.parse(base || ''); } // establish base root var root = ''; if(base.href !== '') { root += (base.protocol || '') + '//' + base.authority; } // support network-path reference with empty base else if(iri.indexOf('//')) { ...
[ "function", "_removeBase", "(", "base", ",", "iri", ")", "{", "if", "(", "_isString", "(", "base", ")", ")", "{", "base", "=", "jsonld", ".", "url", ".", "parse", "(", "base", "||", "''", ")", ";", "}", "// establish base root", "var", "root", "=", ...
Removes a base IRI from the given absolute IRI. @param base the base IRI. @param iri the absolute IRI. @return the relative IRI if relative to base, otherwise the absolute IRI.
[ "Removes", "a", "base", "IRI", "from", "the", "given", "absolute", "IRI", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4885-L4949
43,944
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_createInverseContext
function _createInverseContext() { var activeCtx = this; // lazily create inverse if(activeCtx.inverse) { return activeCtx.inverse; } var inverse = activeCtx.inverse = {}; // handle default language var defaultLanguage = activeCtx['@language'] || '@none'; // create term selectio...
javascript
function _createInverseContext() { var activeCtx = this; // lazily create inverse if(activeCtx.inverse) { return activeCtx.inverse; } var inverse = activeCtx.inverse = {}; // handle default language var defaultLanguage = activeCtx['@language'] || '@none'; // create term selectio...
[ "function", "_createInverseContext", "(", ")", "{", "var", "activeCtx", "=", "this", ";", "// lazily create inverse", "if", "(", "activeCtx", ".", "inverse", ")", "{", "return", "activeCtx", ".", "inverse", ";", "}", "var", "inverse", "=", "activeCtx", ".", ...
Generates an inverse context for use in the compaction algorithm, if not already generated for the given active context. @return the inverse context.
[ "Generates", "an", "inverse", "context", "for", "use", "in", "the", "compaction", "algorithm", "if", "not", "already", "generated", "for", "the", "given", "active", "context", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L4975-L5050
43,945
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_addPreferredTerm
function _addPreferredTerm(mapping, term, entry, typeOrLanguageValue) { if(!(typeOrLanguageValue in entry)) { entry[typeOrLanguageValue] = term; } }
javascript
function _addPreferredTerm(mapping, term, entry, typeOrLanguageValue) { if(!(typeOrLanguageValue in entry)) { entry[typeOrLanguageValue] = term; } }
[ "function", "_addPreferredTerm", "(", "mapping", ",", "term", ",", "entry", ",", "typeOrLanguageValue", ")", "{", "if", "(", "!", "(", "typeOrLanguageValue", "in", "entry", ")", ")", "{", "entry", "[", "typeOrLanguageValue", "]", "=", "term", ";", "}", "}"...
Adds the term for the given entry if not already added. @param mapping the term mapping. @param term the term to add. @param entry the inverse context typeOrLanguage entry to add to. @param typeOrLanguageValue the key in the entry to add to.
[ "Adds", "the", "term", "for", "the", "given", "entry", "if", "not", "already", "added", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5060-L5064
43,946
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_cloneActiveContext
function _cloneActiveContext() { var child = {}; child['@base'] = this['@base']; child.mappings = _clone(this.mappings); child.clone = this.clone; child.inverse = null; child.getInverse = this.getInverse; if('@language' in this) { child['@language'] = this['@language']; } if('@...
javascript
function _cloneActiveContext() { var child = {}; child['@base'] = this['@base']; child.mappings = _clone(this.mappings); child.clone = this.clone; child.inverse = null; child.getInverse = this.getInverse; if('@language' in this) { child['@language'] = this['@language']; } if('@...
[ "function", "_cloneActiveContext", "(", ")", "{", "var", "child", "=", "{", "}", ";", "child", "[", "'@base'", "]", "=", "this", "[", "'@base'", "]", ";", "child", ".", "mappings", "=", "_clone", "(", "this", ".", "mappings", ")", ";", "child", ".", ...
Clones an active context, creating a child active context. @return a clone (child) of the active context.
[ "Clones", "an", "active", "context", "creating", "a", "child", "active", "context", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5071-L5085
43,947
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_isSubject
function _isSubject(v) { // Note: A value is a subject if all of these hold true: // 1. It is an Object. // 2. It is not a @value, @set, or @list. // 3. It has more than 1 key OR any existing key is not @id. var rval = false; if(_isObject(v) && !(('@value' in v) || ('@set' in v) || ('@list' in v))) { ...
javascript
function _isSubject(v) { // Note: A value is a subject if all of these hold true: // 1. It is an Object. // 2. It is not a @value, @set, or @list. // 3. It has more than 1 key OR any existing key is not @id. var rval = false; if(_isObject(v) && !(('@value' in v) || ('@set' in v) || ('@list' in v))) { ...
[ "function", "_isSubject", "(", "v", ")", "{", "// Note: A value is a subject if all of these hold true:", "// 1. It is an Object.", "// 2. It is not a @value, @set, or @list.", "// 3. It has more than 1 key OR any existing key is not @id.", "var", "rval", "=", "false", ";", "if", "("...
Returns true if the given value is a subject with properties. @param v the value to check. @return true if the value is a subject with properties, false if not.
[ "Returns", "true", "if", "the", "given", "value", "is", "a", "subject", "with", "properties", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5263-L5275
43,948
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_isBlankNode
function _isBlankNode(v) { // Note: A value is a blank node if all of these hold true: // 1. It is an Object. // 2. If it has an @id key its value begins with '_:'. // 3. It has no keys OR is not a @value, @set, or @list. var rval = false; if(_isObject(v)) { if('@id' in v) { rval = (v['@id'].index...
javascript
function _isBlankNode(v) { // Note: A value is a blank node if all of these hold true: // 1. It is an Object. // 2. If it has an @id key its value begins with '_:'. // 3. It has no keys OR is not a @value, @set, or @list. var rval = false; if(_isObject(v)) { if('@id' in v) { rval = (v['@id'].index...
[ "function", "_isBlankNode", "(", "v", ")", "{", "// Note: A value is a blank node if all of these hold true:", "// 1. It is an Object.", "// 2. If it has an @id key its value begins with '_:'.", "// 3. It has no keys OR is not a @value, @set, or @list.", "var", "rval", "=", "false", ";",...
Returns true if the given value is a blank node. @param v the value to check. @return true if the value is a blank node, false if not.
[ "Returns", "true", "if", "the", "given", "value", "is", "a", "blank", "node", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5326-L5342
43,949
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_parseNQuads
function _parseNQuads(input) { // define partial regexes var iri = '(?:<([^:]+:[^>]*)>)'; var bnode = '(_:(?:[A-Za-z][A-Za-z0-9]*))'; var plain = '"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"'; var datatype = '(?:\\^\\^' + iri + ')'; var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))'; var literal = '(?:' + plain + '(?:' +...
javascript
function _parseNQuads(input) { // define partial regexes var iri = '(?:<([^:]+:[^>]*)>)'; var bnode = '(_:(?:[A-Za-z][A-Za-z0-9]*))'; var plain = '"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"'; var datatype = '(?:\\^\\^' + iri + ')'; var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))'; var literal = '(?:' + plain + '(?:' +...
[ "function", "_parseNQuads", "(", "input", ")", "{", "// define partial regexes", "var", "iri", "=", "'(?:<([^:]+:[^>]*)>)'", ";", "var", "bnode", "=", "'(_:(?:[A-Za-z][A-Za-z0-9]*))'", ";", "var", "plain", "=", "'\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"'", ";", "v...
Parses RDF in the form of N-Quads. @param input the N-Quads input to parse. @return an RDF dataset.
[ "Parses", "RDF", "in", "the", "form", "of", "N", "-", "Quads", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5622-L5739
43,950
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_toNQuads
function _toNQuads(dataset) { var quads = []; for(var graphName in dataset) { var triples = dataset[graphName]; for(var ti = 0; ti < triples.length; ++ti) { var triple = triples[ti]; if(graphName === '@default') { graphName = null; } quads.push(_toNQuad(triple, graphName)); ...
javascript
function _toNQuads(dataset) { var quads = []; for(var graphName in dataset) { var triples = dataset[graphName]; for(var ti = 0; ti < triples.length; ++ti) { var triple = triples[ti]; if(graphName === '@default') { graphName = null; } quads.push(_toNQuad(triple, graphName)); ...
[ "function", "_toNQuads", "(", "dataset", ")", "{", "var", "quads", "=", "[", "]", ";", "for", "(", "var", "graphName", "in", "dataset", ")", "{", "var", "triples", "=", "dataset", "[", "graphName", "]", ";", "for", "(", "var", "ti", "=", "0", ";", ...
Converts an RDF dataset to N-Quads. @param dataset the RDF dataset to convert. @return the N-Quads string.
[ "Converts", "an", "RDF", "dataset", "to", "N", "-", "Quads", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5751-L5765
43,951
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_parseRdfaApiData
function _parseRdfaApiData(data) { var dataset = {}; dataset['@default'] = []; var subjects = data.getSubjects(); for(var si = 0; si < subjects.length; ++si) { var subject = subjects[si]; if(subject === null) { continue; } // get all related triples var triples = data.getSubjectTripl...
javascript
function _parseRdfaApiData(data) { var dataset = {}; dataset['@default'] = []; var subjects = data.getSubjects(); for(var si = 0; si < subjects.length; ++si) { var subject = subjects[si]; if(subject === null) { continue; } // get all related triples var triples = data.getSubjectTripl...
[ "function", "_parseRdfaApiData", "(", "data", ")", "{", "var", "dataset", "=", "{", "}", ";", "dataset", "[", "'@default'", "]", "=", "[", "]", ";", "var", "subjects", "=", "data", ".", "getSubjects", "(", ")", ";", "for", "(", "var", "si", "=", "0...
Parses the RDF dataset found via the data object from the RDFa API. @param data the RDFa API data object. @return the RDF dataset.
[ "Parses", "the", "RDF", "dataset", "found", "via", "the", "data", "object", "from", "the", "RDFa", "API", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L5871-L5969
43,952
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_parseAuthority
function _parseAuthority(parsed) { // parse authority for unparsed relative network-path reference if(parsed.href.indexOf(':') === -1 && parsed.href.indexOf('//') === 0 && !parsed.host) { // must parse authority from pathname parsed.pathname = parsed.pathname.substr(2); var idx = parsed.pathname.ind...
javascript
function _parseAuthority(parsed) { // parse authority for unparsed relative network-path reference if(parsed.href.indexOf(':') === -1 && parsed.href.indexOf('//') === 0 && !parsed.host) { // must parse authority from pathname parsed.pathname = parsed.pathname.substr(2); var idx = parsed.pathname.ind...
[ "function", "_parseAuthority", "(", "parsed", ")", "{", "// parse authority for unparsed relative network-path reference", "if", "(", "parsed", ".", "href", ".", "indexOf", "(", "':'", ")", "===", "-", "1", "&&", "parsed", ".", "href", ".", "indexOf", "(", "'//'...
Parses the authority for the pre-parsed given URL. @param parsed the pre-parsed URL.
[ "Parses", "the", "authority", "for", "the", "pre", "-", "parsed", "given", "URL", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L6535-L6558
43,953
aaaristo/grunt-html-builder
tasks/jsonld/js/jsonld.js
_removeDotSegments
function _removeDotSegments(path, hasAuthority) { var rval = ''; if(path.indexOf('/') === 0) { rval = '/'; } // RFC 3986 5.2.4 (reworked) var input = path.split('/'); var output = []; while(input.length > 0) { if(input[0] === '.' || (input[0] === '' && input.length > 1)) { input.shift(); ...
javascript
function _removeDotSegments(path, hasAuthority) { var rval = ''; if(path.indexOf('/') === 0) { rval = '/'; } // RFC 3986 5.2.4 (reworked) var input = path.split('/'); var output = []; while(input.length > 0) { if(input[0] === '.' || (input[0] === '' && input.length > 1)) { input.shift(); ...
[ "function", "_removeDotSegments", "(", "path", ",", "hasAuthority", ")", "{", "var", "rval", "=", "''", ";", "if", "(", "path", ".", "indexOf", "(", "'/'", ")", "===", "0", ")", "{", "rval", "=", "'/'", ";", "}", "// RFC 3986 5.2.4 (reworked)", "var", ...
Removes dot segments from a URL path. @param path the path to remove dot segments from. @param hasAuthority true if the URL has an authority, false if not.
[ "Removes", "dot", "segments", "from", "a", "URL", "path", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/jsonld.js#L6566-L6597
43,954
finnfiddle/react-scroll-area
src/index.js
scrollTo
function scrollTo({ container, element, key, options }) { // if duration is ero then set it to very small so that we do not divide by zero if (options.duration <= 0) options.duration = 0.1; // width or height const sizeKey = SIZE_KEYS[key]; // destination measurement let to = Math.min( element[`offset$...
javascript
function scrollTo({ container, element, key, options }) { // if duration is ero then set it to very small so that we do not divide by zero if (options.duration <= 0) options.duration = 0.1; // width or height const sizeKey = SIZE_KEYS[key]; // destination measurement let to = Math.min( element[`offset$...
[ "function", "scrollTo", "(", "{", "container", ",", "element", ",", "key", ",", "options", "}", ")", "{", "// if duration is ero then set it to very small so that we do not divide by zero", "if", "(", "options", ".", "duration", "<=", "0", ")", "options", ".", "dura...
function that does the scrolling
[ "function", "that", "does", "the", "scrolling" ]
a4622c3c6451ee9d7d9194378f1e357bea605bdf
https://github.com/finnfiddle/react-scroll-area/blob/a4622c3c6451ee9d7d9194378f1e357bea605bdf/src/index.js#L21-L59
43,955
opendxl/opendxl-client-javascript
sample/basic/service-example.js
function (request) { // Extract information from request. The toString() call converts the // payload from a binary Buffer into a string, decoded using UTF-8 // character encoding. console.log('Service received request payload: ' + request.payload.toString()) // Create the respons...
javascript
function (request) { // Extract information from request. The toString() call converts the // payload from a binary Buffer into a string, decoded using UTF-8 // character encoding. console.log('Service received request payload: ' + request.payload.toString()) // Create the respons...
[ "function", "(", "request", ")", "{", "// Extract information from request. The toString() call converts the", "// payload from a binary Buffer into a string, decoded using UTF-8", "// character encoding.", "console", ".", "log", "(", "'Service received request payload: '", "+", "reques...
Handle the receipt of an incoming service request
[ "Handle", "the", "receipt", "of", "an", "incoming", "service", "request" ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/sample/basic/service-example.js#L27-L39
43,956
opendxl/opendxl-client-javascript
sample/basic/service-example.js
function (error, response) { // Destroy the client - frees up resources so that the application // stops running client.destroy() // Display the contents of an error, if one occurred if (error) { console.log('Request error: ' + error.message) ...
javascript
function (error, response) { // Destroy the client - frees up resources so that the application // stops running client.destroy() // Display the contents of an error, if one occurred if (error) { console.log('Request error: ' + error.message) ...
[ "function", "(", "error", ",", "response", ")", "{", "// Destroy the client - frees up resources so that the application", "// stops running", "client", ".", "destroy", "(", ")", "// Display the contents of an error, if one occurred", "if", "(", "error", ")", "{", "console", ...
Handle the response to the request
[ "Handle", "the", "response", "to", "the", "request" ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/sample/basic/service-example.js#L58-L84
43,957
ckknight/escort
lib/escort.js
function (prototype, properties) { var object = Object.create(prototype); Object.keys(properties).forEach(function (key) { object[key] = properties[key]; }); return object; }
javascript
function (prototype, properties) { var object = Object.create(prototype); Object.keys(properties).forEach(function (key) { object[key] = properties[key]; }); return object; }
[ "function", "(", "prototype", ",", "properties", ")", "{", "var", "object", "=", "Object", ".", "create", "(", "prototype", ")", ";", "Object", ".", "keys", "(", "properties", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "object", "[", ...
a simple wrapper around Object.create to easily make new objects without providing property descriptors. @param {Object} prototype The prototype to inherit from @param {Object} properties A map of properties @api private
[ "a", "simple", "wrapper", "around", "Object", ".", "create", "to", "easily", "make", "new", "objects", "without", "providing", "property", "descriptors", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L76-L82
43,958
ckknight/escort
lib/escort.js
function (descriptor) { var result = {}; for (var key in descriptor) { if (Object.prototype.hasOwnProperty.call(descriptor, key)) { var keys = key.split(','); for (var i = 0, len = keys.length; i < len; i += 1) { var method = keys[i]; ...
javascript
function (descriptor) { var result = {}; for (var key in descriptor) { if (Object.prototype.hasOwnProperty.call(descriptor, key)) { var keys = key.split(','); for (var i = 0, len = keys.length; i < len; i += 1) { var method = keys[i]; ...
[ "function", "(", "descriptor", ")", "{", "var", "result", "=", "{", "}", ";", "for", "(", "var", "key", "in", "descriptor", ")", "{", "if", "(", "Object", ".", "prototype", ".", "hasOwnProperty", ".", "call", "(", "descriptor", ",", "key", ")", ")", ...
Verify the validity of the provided descriptor and return a sanitized version. This will add an options handler if none is provided. @param {Object} descriptor A map of methods to their associated callbacks @return {Object} A map of methods to their associated callbacks @api private @example descriptor = sanitizeDesc...
[ "Verify", "the", "validity", "of", "the", "provided", "descriptor", "and", "return", "a", "sanitized", "version", ".", "This", "will", "add", "an", "options", "handler", "if", "none", "is", "provided", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L141-L162
43,959
ckknight/escort
lib/escort.js
function (route) { if (route === "/") { return "root"; } if (route.indexOf("{") >= 0) { throw new Error("Unable to guess route name for route " + route); } var result = route .replace(SLASH_PREFIX_REGEX, "") .replace(GUESS_...
javascript
function (route) { if (route === "/") { return "root"; } if (route.indexOf("{") >= 0) { throw new Error("Unable to guess route name for route " + route); } var result = route .replace(SLASH_PREFIX_REGEX, "") .replace(GUESS_...
[ "function", "(", "route", ")", "{", "if", "(", "route", "===", "\"/\"", ")", "{", "return", "\"root\"", ";", "}", "if", "(", "route", ".", "indexOf", "(", "\"{\"", ")", ">=", "0", ")", "{", "throw", "new", "Error", "(", "\"Unable to guess route name fo...
Guess a route name for the given route. This will strip out any characters and give a best-guess. @param {String} route The provided route that it uses to determine a good name for it. @return {String} A name for the route. @throws {Error} When unable to guess a route name. @api private @example guessRouteName("/") =...
[ "Guess", "a", "route", "name", "for", "the", "given", "route", ".", "This", "will", "strip", "out", "any", "characters", "and", "give", "a", "best", "-", "guess", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L213-L231
43,960
ckknight/escort
lib/escort.js
function (text, value) { var valueLength = value.length; if (text.length < valueLength) { return false; } return text.substring(0, valueLength) === value; }
javascript
function (text, value) { var valueLength = value.length; if (text.length < valueLength) { return false; } return text.substring(0, valueLength) === value; }
[ "function", "(", "text", ",", "value", ")", "{", "var", "valueLength", "=", "value", ".", "length", ";", "if", "(", "text", ".", "length", "<", "valueLength", ")", "{", "return", "false", ";", "}", "return", "text", ".", "substring", "(", "0", ",", ...
Determine whether text starts with value. @param {String} text the text to check if value is the beginning part of the string. @param {String} value the potential value of the start of the string. @return {Boolean} @api private @example startsWith("hey there", "hey") === true @example startsWith("hey there", "hello")...
[ "Determine", "whether", "text", "starts", "with", "value", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L244-L251
43,961
ckknight/escort
lib/escort.js
function (array, c, depth) { var start = array.length - (array.length / Math.pow(2, depth)); for (var i = start, len = array.length; i < len; i += 1) { array[i] += c; } }
javascript
function (array, c, depth) { var start = array.length - (array.length / Math.pow(2, depth)); for (var i = start, len = array.length; i < len; i += 1) { array[i] += c; } }
[ "function", "(", "array", ",", "c", ",", "depth", ")", "{", "var", "start", "=", "array", ".", "length", "-", "(", "array", ".", "length", "/", "Math", ".", "pow", "(", "2", ",", "depth", ")", ")", ";", "for", "(", "var", "i", "=", "start", "...
Add a char to certain elements of an array. @param {Array} array An array of strings @param {String} c A string to add to each string @param {Number} depth The current binary tree depth to add to. @api private
[ "Add", "a", "char", "to", "certain", "elements", "of", "an", "array", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L261-L266
43,962
ckknight/escort
lib/escort.js
function (array) { var set = {}; var result = []; for (var i = 0, len = array.length; i < len; i += 1) { var item = array[i]; if (!Object.prototype.hasOwnProperty.call(set, item)) { set[item] = true; result.push(item); } ...
javascript
function (array) { var set = {}; var result = []; for (var i = 0, len = array.length; i < len; i += 1) { var item = array[i]; if (!Object.prototype.hasOwnProperty.call(set, item)) { set[item] = true; result.push(item); } ...
[ "function", "(", "array", ")", "{", "var", "set", "=", "{", "}", ";", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "array", ".", "length", ";", "i", "<", "len", ";", "i", "+=", "1", ")", "{", "va...
Return an array with only distinct elements. This assumes that the elements of an array have their uniqueness determined by their String value. @param {Array} array The array to iterate over. @return {Array} An array with distinct elements. @api private @example distinct(["a", "b", "c", "a", "a", "c"]) => ["a", "b", ...
[ "Return", "an", "array", "with", "only", "distinct", "elements", ".", "This", "assumes", "that", "the", "elements", "of", "an", "array", "have", "their", "uniqueness", "determined", "by", "their", "String", "value", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L278-L291
43,963
ckknight/escort
lib/escort.js
function (routes) { if (!Array.isArray(routes)) { routes = [routes]; } var result = []; routes.forEach(function (route) { if (route.indexOf('[') === -1) { result.push(route); return; } var immediateResult ...
javascript
function (routes) { if (!Array.isArray(routes)) { routes = [routes]; } var result = []; routes.forEach(function (route) { if (route.indexOf('[') === -1) { result.push(route); return; } var immediateResult ...
[ "function", "(", "routes", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "routes", ")", ")", "{", "routes", "=", "[", "routes", "]", ";", "}", "var", "result", "=", "[", "]", ";", "routes", ".", "forEach", "(", "function", "(", "route",...
Parse all potential optional routes out of the provided String or Array. @param {Array} routes an array of routes, or a String which is a single route. @return {Array} the parsed-out array of optional routes. @api private @example parseOptionalRoutes("/same") => ["/same"] @example parseOptionalRoutes("/[optional]") =...
[ "Parse", "all", "potential", "optional", "routes", "out", "of", "the", "provided", "String", "or", "Array", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L308-L360
43,964
ckknight/escort
lib/escort.js
function (bind, prefix) { return function (path, callback) { var prefixedPath = prefix + path; validatePath(prefixedPath); var innerMethods = spawn(escort.prototype, { bind: function (routeName, route, descriptor) { if (arguments.length ===...
javascript
function (bind, prefix) { return function (path, callback) { var prefixedPath = prefix + path; validatePath(prefixedPath); var innerMethods = spawn(escort.prototype, { bind: function (routeName, route, descriptor) { if (arguments.length ===...
[ "function", "(", "bind", ",", "prefix", ")", "{", "return", "function", "(", "path", ",", "callback", ")", "{", "var", "prefixedPath", "=", "prefix", "+", "path", ";", "validatePath", "(", "prefixedPath", ")", ";", "var", "innerMethods", "=", "spawn", "(...
Make the submount function for the escort Object. @param {Function} bind the bind function for the current escort Object. @param {String} prefix the route prefix for the submount. @api private @example makeSubmountFunction("/forums")
[ "Make", "the", "submount", "function", "for", "the", "escort", "Object", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L399-L421
43,965
ckknight/escort
lib/escort.js
function (req, res) { return function (err) { if (err) { res.writeHead(500); res.end(err.toString()); } else { res.writeHead(404); res.end(); } }; }
javascript
function (req, res) { return function (err) { if (err) { res.writeHead(500); res.end(err.toString()); } else { res.writeHead(404); res.end(); } }; }
[ "function", "(", "req", ",", "res", ")", "{", "return", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "res", ".", "writeHead", "(", "500", ")", ";", "res", ".", "end", "(", "err", ".", "toString", "(", ")", ")", ";", "}", "els...
A handler for calling the next middleware module if for some reason one isn't provided. @param {Error} err An error, if it occurred. @api private
[ "A", "handler", "for", "calling", "the", "next", "middleware", "module", "if", "for", "some", "reason", "one", "isn", "t", "provided", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L442-L452
43,966
ckknight/escort
lib/escort.js
function (object) { ACCEPTABLE_METHODS.forEach(function (method) { /** * Bind the provided route with a specific method to the callback provided. * Since you cannot specify a route more than once, it is required to use bind to provide multiple methods. * ...
javascript
function (object) { ACCEPTABLE_METHODS.forEach(function (method) { /** * Bind the provided route with a specific method to the callback provided. * Since you cannot specify a route more than once, it is required to use bind to provide multiple methods. * ...
[ "function", "(", "object", ")", "{", "ACCEPTABLE_METHODS", ".", "forEach", "(", "function", "(", "method", ")", "{", "/**\n * Bind the provided route with a specific method to the callback provided.\n * Since you cannot specify a route more than once, it is requir...
Attach all the helper HTTP and WebDAV methods as helper functions which will ultimately call bind on the provided object. @param {Object} object the Object to attach the methods to. @api private
[ "Attach", "all", "the", "helper", "HTTP", "and", "WebDAV", "methods", "as", "helper", "functions", "which", "will", "ultimately", "call", "bind", "on", "the", "provided", "object", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L461-L501
43,967
ckknight/escort
lib/escort.js
function (value, length) { value = String(value); var numMissing = length - value.length; var prefix = ""; while (numMissing > 0) { prefix += "0"; numMissing -= 1; } return prefix + value; }
javascript
function (value, length) { value = String(value); var numMissing = length - value.length; var prefix = ""; while (numMissing > 0) { prefix += "0"; numMissing -= 1; } return prefix + value; }
[ "function", "(", "value", ",", "length", ")", "{", "value", "=", "String", "(", "value", ")", ";", "var", "numMissing", "=", "length", "-", "value", ".", "length", ";", "var", "prefix", "=", "\"\"", ";", "while", "(", "numMissing", ">", "0", ")", "...
Pad a value by prepending zeroes until it reaches a specified length. @param {String} value the current string or number. @param {Number} length the size wanted for the value. @return {String} a string of at least the provided length. @api private @example zeroPad(50, 4) == "0050" @example zeroPad("123", 4) == "0123"
[ "Pad", "a", "value", "by", "prepending", "zeroes", "until", "it", "reaches", "a", "specified", "length", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L1216-L1225
43,968
ckknight/escort
lib/escort.js
function (args) { if (!args) { args = {}; } var fixedDigits = args.fixedDigits; var min = args.min; var max = args.max; if (min === undefined) { min = null; } if (max === undefine...
javascript
function (args) { if (!args) { args = {}; } var fixedDigits = args.fixedDigits; var min = args.min; var max = args.max; if (min === undefined) { min = null; } if (max === undefine...
[ "function", "(", "args", ")", "{", "if", "(", "!", "args", ")", "{", "args", "=", "{", "}", ";", "}", "var", "fixedDigits", "=", "args", ".", "fixedDigits", ";", "var", "min", "=", "args", ".", "min", ";", "var", "max", "=", "args", ".", "max",...
A converter that accepts a numeric string. This does not support negative values. @example routes.get("/users/{id:int}", function(req, res, params) { }) @example routes.get("/archive/{year:int({fixedDigits: 4})}", function(req, res, params) { }) @example routes.get("/users/{id:int({min: 1})}", function(req, res) { }) ...
[ "A", "converter", "that", "accepts", "a", "numeric", "string", ".", "This", "does", "not", "support", "negative", "values", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L1237-L1257
43,969
ckknight/escort
lib/escort.js
function () { var args = Array.prototype.slice.call(arguments, 0); if (args.length < 1) { throw new Error("Must specify at least one argument to AnyConverter"); } var values = {}; for (var i = 0, len = args.length; i < len; i += 1)...
javascript
function () { var args = Array.prototype.slice.call(arguments, 0); if (args.length < 1) { throw new Error("Must specify at least one argument to AnyConverter"); } var values = {}; for (var i = 0, len = args.length; i < len; i += 1)...
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ";", "if", "(", "args", ".", "length", "<", "1", ")", "{", "throw", "new", "Error", "(", "\"Must specify at least on...
A converter that matches one of the items provided. @example routes.get("/pages/{pageName:any('about', 'help', 'contact')}", function(req, res, params) { })
[ "A", "converter", "that", "matches", "one", "of", "the", "items", "provided", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort.js#L1308-L1325
43,970
engineer-andrew/Angular-Tree-View
src/eaTreeView.factory.js
function(state, datasetId, items, matchFound, nestingLevel, stopExpandingParents) { // initialize whatever wasn't passed to a default value datasetId = datasetId || 'default'; items = items || concealed.items[datasetId]; matchFound = matchFound || false; nesti...
javascript
function(state, datasetId, items, matchFound, nestingLevel, stopExpandingParents) { // initialize whatever wasn't passed to a default value datasetId = datasetId || 'default'; items = items || concealed.items[datasetId]; matchFound = matchFound || false; nesti...
[ "function", "(", "state", ",", "datasetId", ",", "items", ",", "matchFound", ",", "nestingLevel", ",", "stopExpandingParents", ")", "{", "// initialize whatever wasn't passed to a default value", "datasetId", "=", "datasetId", "||", "'default'", ";", "items", "=", "it...
set the active item and expand all ancestors of the active item
[ "set", "the", "active", "item", "and", "expand", "all", "ancestors", "of", "the", "active", "item" ]
4a7398057f36290568203c5cb1a3d23f633cc15e
https://github.com/engineer-andrew/Angular-Tree-View/blob/4a7398057f36290568203c5cb1a3d23f633cc15e/src/eaTreeView.factory.js#L30-L66
43,971
lucsorel/markdown-image-loader
index.js
requirifyImageReference
function requirifyImageReference(markdownImageReference) { const [, mdImageStart, mdImagePath, optionalMdTitle, mdImageEnd ] = imagePathRE.exec(markdownImageReference) || [] if (!mdImagePath) { return JSON.stringify(markdownImageReference) } else { const imageRequest = loaderUtils.stringifyRequest( ...
javascript
function requirifyImageReference(markdownImageReference) { const [, mdImageStart, mdImagePath, optionalMdTitle, mdImageEnd ] = imagePathRE.exec(markdownImageReference) || [] if (!mdImagePath) { return JSON.stringify(markdownImageReference) } else { const imageRequest = loaderUtils.stringifyRequest( ...
[ "function", "requirifyImageReference", "(", "markdownImageReference", ")", "{", "const", "[", ",", "mdImageStart", ",", "mdImagePath", ",", "optionalMdTitle", ",", "mdImageEnd", "]", "=", "imagePathRE", ".", "exec", "(", "markdownImageReference", ")", "||", "[", "...
converts the image path in the markdowned-image syntax into a require statement, or stringify the given content
[ "converts", "the", "image", "path", "in", "the", "markdowned", "-", "image", "syntax", "into", "a", "require", "statement", "or", "stringify", "the", "given", "content" ]
e3272fab82a2f3de858425792401c2f2f37ab6b1
https://github.com/lucsorel/markdown-image-loader/blob/e3272fab82a2f3de858425792401c2f2f37ab6b1/index.js#L7-L20
43,972
m59peacemaker/svelte-modal
build/Modal.js
checkPointerDown
function checkPointerDown(e) { if (config.clickOutsideDeactivates && !container.contains(e.target)) { deactivate({ returnFocus: false }); } }
javascript
function checkPointerDown(e) { if (config.clickOutsideDeactivates && !container.contains(e.target)) { deactivate({ returnFocus: false }); } }
[ "function", "checkPointerDown", "(", "e", ")", "{", "if", "(", "config", ".", "clickOutsideDeactivates", "&&", "!", "container", ".", "contains", "(", "e", ".", "target", ")", ")", "{", "deactivate", "(", "{", "returnFocus", ":", "false", "}", ")", ";", ...
This needs to be done on mousedown and touchstart instead of click so that it precedes the focus event
[ "This", "needs", "to", "be", "done", "on", "mousedown", "and", "touchstart", "instead", "of", "click", "so", "that", "it", "precedes", "the", "focus", "event" ]
7f30bed0fabea376faa3e531dbfdb11b141eb548
https://github.com/m59peacemaker/svelte-modal/blob/7f30bed0fabea376faa3e531dbfdb11b141eb548/build/Modal.js#L733-L737
43,973
wala/jsdelta
src/transformations.js
applyTransformers
function applyTransformers(options, state, file) { var transformationSucceededAtLeastOnce = false; if (options.transformations && state.ext == "js") { options.transformations.forEach(function (transformation) { transformationSucceededAtLeastOnce |= transformAndTest(transformation, options, s...
javascript
function applyTransformers(options, state, file) { var transformationSucceededAtLeastOnce = false; if (options.transformations && state.ext == "js") { options.transformations.forEach(function (transformation) { transformationSucceededAtLeastOnce |= transformAndTest(transformation, options, s...
[ "function", "applyTransformers", "(", "options", ",", "state", ",", "file", ")", "{", "var", "transformationSucceededAtLeastOnce", "=", "false", ";", "if", "(", "options", ".", "transformations", "&&", "state", ".", "ext", "==", "\"js\"", ")", "{", "options", ...
Applies all the custom transformers. Returns true iff any of the transformations made the predicate true.
[ "Applies", "all", "the", "custom", "transformers", "." ]
355febea1ee23e9e909ba2bfa087ffb2499a3295
https://github.com/wala/jsdelta/blob/355febea1ee23e9e909ba2bfa087ffb2499a3295/src/transformations.js#L61-L69
43,974
asgerf/tscheck
tscore.js
TObject
function TObject(qname, meta) { this.qname = qname; this.properties = new Map; this.modules = new Map; this.calls = [] this.types = new Map; this.supers = [] this.typeParameters = [] this.brand = null; this.meta = { kind: meta.kind, origin: meta.origin, isEnum: f...
javascript
function TObject(qname, meta) { this.qname = qname; this.properties = new Map; this.modules = new Map; this.calls = [] this.types = new Map; this.supers = [] this.typeParameters = [] this.brand = null; this.meta = { kind: meta.kind, origin: meta.origin, isEnum: f...
[ "function", "TObject", "(", "qname", ",", "meta", ")", "{", "this", ".", "qname", "=", "qname", ";", "this", ".", "properties", "=", "new", "Map", ";", "this", ".", "modules", "=", "new", "Map", ";", "this", ".", "calls", "=", "[", "]", "this", "...
Object type.
[ "Object", "type", "." ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscore.js#L130-L144
43,975
asgerf/tscheck
tscore.js
addModuleMember
function addModuleMember(member, moduleObject, qname) { current_node = member; var topLevel = qname === ''; if (member instanceof TypeScript.FunctionDeclaration) { var obj = moduleObject.getMember(member.name.text()) if (obj instanceof TObject) { obj.calls.push(parseFunctionType(member)) } el...
javascript
function addModuleMember(member, moduleObject, qname) { current_node = member; var topLevel = qname === ''; if (member instanceof TypeScript.FunctionDeclaration) { var obj = moduleObject.getMember(member.name.text()) if (obj instanceof TObject) { obj.calls.push(parseFunctionType(member)) } el...
[ "function", "addModuleMember", "(", "member", ",", "moduleObject", ",", "qname", ")", "{", "current_node", "=", "member", ";", "var", "topLevel", "=", "qname", "===", "''", ";", "if", "(", "member", "instanceof", "TypeScript", ".", "FunctionDeclaration", ")", ...
Some names are resolved before merging, others after. Type parameters must be resolved before merging, because merging generic interfaces requires alpha-renaming of type parameters. Names defined in modules must be resolved after merging, because the whole module type is not available until then.
[ "Some", "names", "are", "resolved", "before", "merging", "others", "after", ".", "Type", "parameters", "must", "be", "resolved", "before", "merging", "because", "merging", "generic", "interfaces", "requires", "alpha", "-", "renaming", "of", "type", "parameters", ...
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscore.js#L239-L303
43,976
asgerf/tscheck
tscore.js
resolveReference
function resolveReference(x, isModule) { if (x instanceof TReference) { if (isBuiltin(x.name)) return new TBuiltin(x.name) if (x.resolution) return x.resolution if (x.resolving) throw new TypeError("Cyclic reference involving " + x) x.resolving = true var t = lookupInScope(x.scope, x....
javascript
function resolveReference(x, isModule) { if (x instanceof TReference) { if (isBuiltin(x.name)) return new TBuiltin(x.name) if (x.resolution) return x.resolution if (x.resolving) throw new TypeError("Cyclic reference involving " + x) x.resolving = true var t = lookupInScope(x.scope, x....
[ "function", "resolveReference", "(", "x", ",", "isModule", ")", "{", "if", "(", "x", "instanceof", "TReference", ")", "{", "if", "(", "isBuiltin", "(", "x", ".", "name", ")", ")", "return", "new", "TBuiltin", "(", "x", ".", "name", ")", "if", "(", ...
Resolves a TReference or TMember to a TQualifiedReference
[ "Resolves", "a", "TReference", "or", "TMember", "to", "a", "TQualifiedReference" ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscore.js#L962-L1015
43,977
asgerf/tscheck
tscore.js
resolveType
function resolveType(x) { if (x instanceof TReference) { return resolveReference(x) } else if (x instanceof TMember) { return resolveReference(x) } else if (x instanceof TObject) { if (x.qname) return new TQualifiedReference(x.qname) // can happen if a qname was synthesized by resolveReferenc...
javascript
function resolveType(x) { if (x instanceof TReference) { return resolveReference(x) } else if (x instanceof TMember) { return resolveReference(x) } else if (x instanceof TObject) { if (x.qname) return new TQualifiedReference(x.qname) // can happen if a qname was synthesized by resolveReferenc...
[ "function", "resolveType", "(", "x", ")", "{", "if", "(", "x", "instanceof", "TReference", ")", "{", "return", "resolveReference", "(", "x", ")", "}", "else", "if", "(", "x", "instanceof", "TMember", ")", "{", "return", "resolveReference", "(", "x", ")",...
Recursively builds a type where all references have been resolved
[ "Recursively", "builds", "a", "type", "where", "all", "references", "have", "been", "resolved" ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscore.js#L1018-L1048
43,978
asgerf/tscheck
tscheck.js
hasBrand
function hasBrand(value, brand) { var ctor = lookupPath(brand, function() { return null }) if (!ctor || typeof ctor !== 'object') return null; var proto = lookupObject(ctor.key).propertyMap.get('prototype') if (!proto || !proto.value || typeof proto.value !== 'object') return null; while (value && typeof value...
javascript
function hasBrand(value, brand) { var ctor = lookupPath(brand, function() { return null }) if (!ctor || typeof ctor !== 'object') return null; var proto = lookupObject(ctor.key).propertyMap.get('prototype') if (!proto || !proto.value || typeof proto.value !== 'object') return null; while (value && typeof value...
[ "function", "hasBrand", "(", "value", ",", "brand", ")", "{", "var", "ctor", "=", "lookupPath", "(", "brand", ",", "function", "(", ")", "{", "return", "null", "}", ")", "if", "(", "!", "ctor", "||", "typeof", "ctor", "!==", "'object'", ")", "return"...
Returns true if brand is satisfied, false if brand is not satisfied, or null if brand prototype could not be found.
[ "Returns", "true", "if", "brand", "is", "satisfied", "false", "if", "brand", "is", "not", "satisfied", "or", "null", "if", "brand", "prototype", "could", "not", "be", "found", "." ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscheck.js#L984-L997
43,979
asgerf/tscheck
tscheck.js
getEnclosingFunction
function getEnclosingFunction(node) { while (node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression' && node.type !== 'Program') { node = node.$parent; } return node; }
javascript
function getEnclosingFunction(node) { while (node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression' && node.type !== 'Program') { node = node.$parent; } return node; }
[ "function", "getEnclosingFunction", "(", "node", ")", "{", "while", "(", "node", ".", "type", "!==", "'FunctionDeclaration'", "&&", "node", ".", "type", "!==", "'FunctionExpression'", "&&", "node", ".", "type", "!==", "'Program'", ")", "{", "node", "=", "nod...
Returns the function or program immediately enclosing the given node, possibly the node itself.
[ "Returns", "the", "function", "or", "program", "immediately", "enclosing", "the", "given", "node", "possibly", "the", "node", "itself", "." ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscheck.js#L1526-L1533
43,980
asgerf/tscheck
tscheck.js
getEnclosingScope
function getEnclosingScope(node) { while (node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression' && node.type !== 'CatchClause' && node.type !== 'Program') { node = node.$parent; } return node; }
javascript
function getEnclosingScope(node) { while (node.type !== 'FunctionDeclaration' && node.type !== 'FunctionExpression' && node.type !== 'CatchClause' && node.type !== 'Program') { node = node.$parent; } return node; }
[ "function", "getEnclosingScope", "(", "node", ")", "{", "while", "(", "node", ".", "type", "!==", "'FunctionDeclaration'", "&&", "node", ".", "type", "!==", "'FunctionExpression'", "&&", "node", ".", "type", "!==", "'CatchClause'", "&&", "node", ".", "type", ...
Returns the function, program or catch clause immediately enclosing the given node, possibly the node itself.
[ "Returns", "the", "function", "program", "or", "catch", "clause", "immediately", "enclosing", "the", "given", "node", "possibly", "the", "node", "itself", "." ]
7bf73cba5d85ec96fda3f4bda20e47b194de6e08
https://github.com/asgerf/tscheck/blob/7bf73cba5d85ec96fda3f4bda20e47b194de6e08/tscheck.js#L1536-L1544
43,981
fengyuanchen/is-vue-component
dist/is-vue-component.esm.js
isElement
function isElement(value) { return isNonNullObject(value) && value.nodeType === 1 && toString.call(value).indexOf('Element') > -1; }
javascript
function isElement(value) { return isNonNullObject(value) && value.nodeType === 1 && toString.call(value).indexOf('Element') > -1; }
[ "function", "isElement", "(", "value", ")", "{", "return", "isNonNullObject", "(", "value", ")", "&&", "value", ".", "nodeType", "===", "1", "&&", "toString", ".", "call", "(", "value", ")", ".", "indexOf", "(", "'Element'", ")", ">", "-", "1", ";", ...
Check if the given value is an element. @param {*} value - The value to check. @returns {boolean} Returns `true` if the given value is an element, else `false`.
[ "Check", "if", "the", "given", "value", "is", "an", "element", "." ]
0bf281b28a87899d104f6d528ccbf6272c43d6b9
https://github.com/fengyuanchen/is-vue-component/blob/0bf281b28a87899d104f6d528ccbf6272c43d6b9/dist/is-vue-component.esm.js#L70-L72
43,982
fengyuanchen/is-vue-component
dist/is-vue-component.esm.js
isVueComponent
function isVueComponent(value) { return isPlainObject(value) && (isNonEmptyString(value.template) || isFunction(value.render) || isNonEmptyString(value.el) || isElement(value.el) || isVueComponent(value.extends) || isNonEmptyArray(value.mixins) && value.mixins.some(function (val) { return isVueComponent(val); }...
javascript
function isVueComponent(value) { return isPlainObject(value) && (isNonEmptyString(value.template) || isFunction(value.render) || isNonEmptyString(value.el) || isElement(value.el) || isVueComponent(value.extends) || isNonEmptyArray(value.mixins) && value.mixins.some(function (val) { return isVueComponent(val); }...
[ "function", "isVueComponent", "(", "value", ")", "{", "return", "isPlainObject", "(", "value", ")", "&&", "(", "isNonEmptyString", "(", "value", ".", "template", ")", "||", "isFunction", "(", "value", ".", "render", ")", "||", "isNonEmptyString", "(", "value...
Check if the given value is a valid Vue component. @param {*} value - The value to check. @returns {boolean} Returns `true` if the given value is a valid Vue component, else `false`.
[ "Check", "if", "the", "given", "value", "is", "a", "valid", "Vue", "component", "." ]
0bf281b28a87899d104f6d528ccbf6272c43d6b9
https://github.com/fengyuanchen/is-vue-component/blob/0bf281b28a87899d104f6d528ccbf6272c43d6b9/dist/is-vue-component.esm.js#L79-L83
43,983
kevincennis/logbro
lib/logbro.js
initialize
function initialize() { var flags = []; Object.keys( levels ).forEach(function( type, level ) { var method = type.toLowerCase(); exports[ method ] = log.bind( exports, type, level, false ); exports[ method ].json = log.bind( exports, type, level, true ); if ( new RegExp( '\\b' + type + '\\b', 'i' )...
javascript
function initialize() { var flags = []; Object.keys( levels ).forEach(function( type, level ) { var method = type.toLowerCase(); exports[ method ] = log.bind( exports, type, level, false ); exports[ method ].json = log.bind( exports, type, level, true ); if ( new RegExp( '\\b' + type + '\\b', 'i' )...
[ "function", "initialize", "(", ")", "{", "var", "flags", "=", "[", "]", ";", "Object", ".", "keys", "(", "levels", ")", ".", "forEach", "(", "function", "(", "type", ",", "level", ")", "{", "var", "method", "=", "type", ".", "toLowerCase", "(", ")"...
set loglevel based on NODE_DEBUG env variable and create exported methods
[ "set", "loglevel", "based", "on", "NODE_DEBUG", "env", "variable", "and", "create", "exported", "methods" ]
f06d5c774de1e2ae94bb67f15457757530f061a1
https://github.com/kevincennis/logbro/blob/f06d5c774de1e2ae94bb67f15457757530f061a1/lib/logbro.js#L31-L44
43,984
kevincennis/logbro
lib/logbro.js
format
function format( type, args ) { var now = new Date().toISOString(), tmpl = '[%s] %s: %s\n', msg; msg = args[ 0 ] instanceof Error ? args[ 0 ].stack : util.format.apply( util, args ); return util.format( tmpl, now, type, msg ); }
javascript
function format( type, args ) { var now = new Date().toISOString(), tmpl = '[%s] %s: %s\n', msg; msg = args[ 0 ] instanceof Error ? args[ 0 ].stack : util.format.apply( util, args ); return util.format( tmpl, now, type, msg ); }
[ "function", "format", "(", "type", ",", "args", ")", "{", "var", "now", "=", "new", "Date", "(", ")", ".", "toISOString", "(", ")", ",", "tmpl", "=", "'[%s] %s: %s\\n'", ",", "msg", ";", "msg", "=", "args", "[", "0", "]", "instanceof", "Error", "?"...
format log messages
[ "format", "log", "messages" ]
f06d5c774de1e2ae94bb67f15457757530f061a1
https://github.com/kevincennis/logbro/blob/f06d5c774de1e2ae94bb67f15457757530f061a1/lib/logbro.js#L47-L56
43,985
xiaoyann/deploy-kit
bin/parse.js
readConfig
function readConfig() { let options = {} let cFile = '' if (program.config) { cFile = path.resolve(cwd, program.config) if (fs.existsSync(cFile)) { Object.assign(config, require(cFile)) } else { console.warn(`Cannot find configuration file ${program.config}`) process.exit() } ...
javascript
function readConfig() { let options = {} let cFile = '' if (program.config) { cFile = path.resolve(cwd, program.config) if (fs.existsSync(cFile)) { Object.assign(config, require(cFile)) } else { console.warn(`Cannot find configuration file ${program.config}`) process.exit() } ...
[ "function", "readConfig", "(", ")", "{", "let", "options", "=", "{", "}", "let", "cFile", "=", "''", "if", "(", "program", ".", "config", ")", "{", "cFile", "=", "path", ".", "resolve", "(", "cwd", ",", "program", ".", "config", ")", "if", "(", "...
read configuration from local file
[ "read", "configuration", "from", "local", "file" ]
df1fe0ac2dba02d78661ffbbe7c92e4c23aaed03
https://github.com/xiaoyann/deploy-kit/blob/df1fe0ac2dba02d78661ffbbe7c92e4c23aaed03/bin/parse.js#L57-L92
43,986
vphantom/js-jrpc
jrpc.js
shutdown
function shutdown() { var instance = this; instance.active = false; instance.transmitter = null; instance.remoteTimeout = 0; instance.localTimeout = 0; instance.localComponents = {}; instance.remoteComponents = {}; instance.outbox.requests.length = 0; instance.outbox.responses.length = 0; instance....
javascript
function shutdown() { var instance = this; instance.active = false; instance.transmitter = null; instance.remoteTimeout = 0; instance.localTimeout = 0; instance.localComponents = {}; instance.remoteComponents = {}; instance.outbox.requests.length = 0; instance.outbox.responses.length = 0; instance....
[ "function", "shutdown", "(", ")", "{", "var", "instance", "=", "this", ";", "instance", ".", "active", "=", "false", ";", "instance", ".", "transmitter", "=", "null", ";", "instance", ".", "remoteTimeout", "=", "0", ";", "instance", ".", "localTimeout", ...
Semi-destructor for limbo conditions When we lose connection permanently, we help garbage collection by removing as many references as we can, including cancelling any outstanding timers. We may still get some callbacks, but they will immediately return. @return {undefined} No return value
[ "Semi", "-", "destructor", "for", "limbo", "conditions" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L77-L102
43,987
vphantom/js-jrpc
jrpc.js
confirmTransmit
function confirmTransmit(outpacket, err) { if (this.active && err) { // Roll it all back into outbox (which may not be empty anymore) if (outpacket.responses.length > 0) { Array.prototype.push.apply(this.outbox.responses, outpacket.responses); } if (outpacket.requests.length > 0) { Array.p...
javascript
function confirmTransmit(outpacket, err) { if (this.active && err) { // Roll it all back into outbox (which may not be empty anymore) if (outpacket.responses.length > 0) { Array.prototype.push.apply(this.outbox.responses, outpacket.responses); } if (outpacket.requests.length > 0) { Array.p...
[ "function", "confirmTransmit", "(", "outpacket", ",", "err", ")", "{", "if", "(", "this", ".", "active", "&&", "err", ")", "{", "// Roll it all back into outbox (which may not be empty anymore)", "if", "(", "outpacket", ".", "responses", ".", "length", ">", "0", ...
Handle transmission errors @type {JRPC~transmitConfirmCallback} @param {Object} outpacket Outbox data of the attempted transmission @param {boolean} err Anything non-falsey means an error occured @return {undefined} No return value
[ "Handle", "transmission", "errors" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L207-L217
43,988
vphantom/js-jrpc
jrpc.js
receive
function receive(msg) { var requests = []; var responses = []; if (!this.active) { return this; } // If we got JSON, parse it if (typeof msg === 'string') { try { msg = JSON.parse(msg); } catch (e) { // The specification doesn't force us to respond in error, ignoring return t...
javascript
function receive(msg) { var requests = []; var responses = []; if (!this.active) { return this; } // If we got JSON, parse it if (typeof msg === 'string') { try { msg = JSON.parse(msg); } catch (e) { // The specification doesn't force us to respond in error, ignoring return t...
[ "function", "receive", "(", "msg", ")", "{", "var", "requests", "=", "[", "]", ";", "var", "responses", "=", "[", "]", ";", "if", "(", "!", "this", ".", "active", ")", "{", "return", "this", ";", "}", "// If we got JSON, parse it", "if", "(", "typeof...
Handle incoming message @param {string} msg JSON message to parse @return {JRPC} This instance, for chaining
[ "Handle", "incoming", "message" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L226-L275
43,989
vphantom/js-jrpc
jrpc.js
upgrade
function upgrade() { if (!this.active) { return this; } return this.call( 'system.listComponents', this.localComponents, (function(err, result) { if (!err && typeof result === 'object') { this.remoteComponents = result; this.remoteComponents['system._upgraded'] = true; ...
javascript
function upgrade() { if (!this.active) { return this; } return this.call( 'system.listComponents', this.localComponents, (function(err, result) { if (!err && typeof result === 'object') { this.remoteComponents = result; this.remoteComponents['system._upgraded'] = true; ...
[ "function", "upgrade", "(", ")", "{", "if", "(", "!", "this", ".", "active", ")", "{", "return", "this", ";", "}", "return", "this", ".", "call", "(", "'system.listComponents'", ",", "this", ".", "localComponents", ",", "(", "function", "(", "err", ","...
Handshake to discover remote extended capabilities @return {JRPC} This instance, for chaining
[ "Handshake", "to", "discover", "remote", "extended", "capabilities" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L282-L296
43,990
vphantom/js-jrpc
jrpc.js
call
function call(methodName, params, next) { var request = { jsonrpc: '2.0', method : methodName }; if (!this.active) { return this; } if (typeof params === 'function') { next = params; params = null; } if ( 'system._upgraded' in this.remoteComponents && !(methodName in this.re...
javascript
function call(methodName, params, next) { var request = { jsonrpc: '2.0', method : methodName }; if (!this.active) { return this; } if (typeof params === 'function') { next = params; params = null; } if ( 'system._upgraded' in this.remoteComponents && !(methodName in this.re...
[ "function", "call", "(", "methodName", ",", "params", ",", "next", ")", "{", "var", "request", "=", "{", "jsonrpc", ":", "'2.0'", ",", "method", ":", "methodName", "}", ";", "if", "(", "!", "this", ".", "active", ")", "{", "return", "this", ";", "}...
Client side Queue up a remote method call @param {string} methodName Name of method to call @param {(Object|Array|null)} [params] Parameters @param {JRPC~receiveCallback} [next] Callback to receive result @return {JRPC} This instance, for chaining
[ "Client", "side", "Queue", "up", "a", "remote", "method", "call" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L310-L376
43,991
vphantom/js-jrpc
jrpc.js
deliverResponse
function deliverResponse(res) { var err = false; var result = null; if (this.active && 'id' in res && res['id'] in this.outTimers) { clearTimeout(this.outTimers[res['id']]); // Passing true instead of a timeout is safe delete this.outTimers[res['id']]; } else { // Silently ignoring second response...
javascript
function deliverResponse(res) { var err = false; var result = null; if (this.active && 'id' in res && res['id'] in this.outTimers) { clearTimeout(this.outTimers[res['id']]); // Passing true instead of a timeout is safe delete this.outTimers[res['id']]; } else { // Silently ignoring second response...
[ "function", "deliverResponse", "(", "res", ")", "{", "var", "err", "=", "false", ";", "var", "result", "=", "null", ";", "if", "(", "this", ".", "active", "&&", "'id'", "in", "res", "&&", "res", "[", "'id'", "]", "in", "this", ".", "outTimers", ")"...
Callback invoked when remote results are ready @callback JRPC~receiveCallback @param {boolean} err True if the result is an error or unavailable @param {Object} result The result from the remote method @return {undefined} No return value Deliver a received result @param {Object} res The single result to ...
[ "Callback", "invoked", "when", "remote", "results", "are", "ready" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L396-L418
43,992
vphantom/js-jrpc
jrpc.js
expose
function expose(subject, callback) { var name; if (!this.active) { return this; } if (typeof subject === 'string') { this.localComponents[subject] = true; this.exposed[subject] = callback; } else if (typeof subject === 'object') { for (name in subject) { if (subject.hasOwnProperty(name...
javascript
function expose(subject, callback) { var name; if (!this.active) { return this; } if (typeof subject === 'string') { this.localComponents[subject] = true; this.exposed[subject] = callback; } else if (typeof subject === 'object') { for (name in subject) { if (subject.hasOwnProperty(name...
[ "function", "expose", "(", "subject", ",", "callback", ")", "{", "var", "name", ";", "if", "(", "!", "this", ".", "active", ")", "{", "return", "this", ";", "}", "if", "(", "typeof", "subject", "===", "'string'", ")", "{", "this", ".", "localComponen...
Server side Expose a single or collection of methods to remote end @param {(Object|String)} subject Name of method or direct object @param {JRPC~serviceCallback} [callback] Callback to handle requests @return {JRPC} This instance, for chaining
[ "Server", "side", "Expose", "a", "single", "or", "collection", "of", "methods", "to", "remote", "end" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L431-L451
43,993
vphantom/js-jrpc
jrpc.js
serveRequest
function serveRequest(request) { var id = null; var params = null; if (!this.active || typeof request !== 'object' || request === null) { return; } if (!(typeof request.jsonrpc === 'string' && request.jsonrpc === '2.0')) { return; } id = (typeof request.id !== 'undefined' ? request.id : null); ...
javascript
function serveRequest(request) { var id = null; var params = null; if (!this.active || typeof request !== 'object' || request === null) { return; } if (!(typeof request.jsonrpc === 'string' && request.jsonrpc === '2.0')) { return; } id = (typeof request.id !== 'undefined' ? request.id : null); ...
[ "function", "serveRequest", "(", "request", ")", "{", "var", "id", "=", "null", ";", "var", "params", "=", "null", ";", "if", "(", "!", "this", ".", "active", "||", "typeof", "request", "!==", "'object'", "||", "request", "===", "null", ")", "{", "re...
Callback invoked to handle calls to our side's methods @callback JRPC~serviceCallback @param {(Object|Array|null)} params Parameters received @param {JRPC~serviceResultCallback} next Callback to send your result @return {undefined} No return value Serve a request we received @param {Object} request Reque...
[ "Callback", "invoked", "to", "handle", "calls", "to", "our", "side", "s", "methods" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L471-L536
43,994
vphantom/js-jrpc
jrpc.js
sendResponse
function sendResponse(id, err, result) { var response = { jsonrpc: '2.0', id : id }; if (id === null) { return; } if (this.active && id in this.localTimers) { clearTimeout(this.localTimers[id]); // Passing true instead of a timeout is safe delete this.localTimers[id]; } else { ...
javascript
function sendResponse(id, err, result) { var response = { jsonrpc: '2.0', id : id }; if (id === null) { return; } if (this.active && id in this.localTimers) { clearTimeout(this.localTimers[id]); // Passing true instead of a timeout is safe delete this.localTimers[id]; } else { ...
[ "function", "sendResponse", "(", "id", ",", "err", ",", "result", ")", "{", "var", "response", "=", "{", "jsonrpc", ":", "'2.0'", ",", "id", ":", "id", "}", ";", "if", "(", "id", "===", "null", ")", "{", "return", ";", "}", "if", "(", "this", "...
Handle local method results @type {JRPC~serviceResultCallback} @param {number} id Serial number, bound, no need to supply @param {boolean} err Anything non-falsey means error and is sent @param {Object} result Any result you wish to produce @return {undefined} No return value
[ "Handle", "local", "method", "results" ]
d9f4c040418b24b92dafc124613bd699015e620e
https://github.com/vphantom/js-jrpc/blob/d9f4c040418b24b92dafc124613bd699015e620e/jrpc.js#L549-L603
43,995
ckknight/escort
lib/escort-client.js
function (route, converters) { var literals = route.literals; var params = route.params; var conv = []; var fun = ""; fun += "var generate = function (params) {\n"; fun += " if (arguments.length === 1 && typeof params === 'object' && params.constructo...
javascript
function (route, converters) { var literals = route.literals; var params = route.params; var conv = []; var fun = ""; fun += "var generate = function (params) {\n"; fun += " if (arguments.length === 1 && typeof params === 'object' && params.constructo...
[ "function", "(", "route", ",", "converters", ")", "{", "var", "literals", "=", "route", ".", "literals", ";", "var", "params", "=", "route", ".", "params", ";", "var", "conv", "=", "[", "]", ";", "var", "fun", "=", "\"\"", ";", "fun", "+=", "\"var ...
Dynamically create a url-generation function. @param {Object} route A descriptor for the route in question @param {Object} converters A map of converter name to converter factory. @return {Function} A function which will generate a URL. @api private @example generateUrlFunction({ literals: ["/prefix"], params: [ { na...
[ "Dynamically", "create", "a", "url", "-", "generation", "function", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort-client.js#L40-L92
43,996
ckknight/escort
lib/escort-client.js
function (routes, converters) { var staticRoute, dynamicRoute; // we traverse backwards because the beginning ones take precedence and thus can override. for (var i = routes.length - 1; i >= 0; i -= 1) { var route = routes[i]; if (route.path) { ...
javascript
function (routes, converters) { var staticRoute, dynamicRoute; // we traverse backwards because the beginning ones take precedence and thus can override. for (var i = routes.length - 1; i >= 0; i -= 1) { var route = routes[i]; if (route.path) { ...
[ "function", "(", "routes", ",", "converters", ")", "{", "var", "staticRoute", ",", "dynamicRoute", ";", "// we traverse backwards because the beginning ones take precedence and thus can override.", "for", "(", "var", "i", "=", "routes", ".", "length", "-", "1", ";", "...
Generate a URL function based on the provided routes. @param {Array} routes An array of route descriptors @param {Object} converters A map of type to converter factory. @return {Function} A function that will generate a URL, or null if routes is blank. @api private
[ "Generate", "a", "URL", "function", "based", "on", "the", "provided", "routes", "." ]
6afbe01d48881b7eaf092e7c2307ebd8ee65497e
https://github.com/ckknight/escort/blob/6afbe01d48881b7eaf092e7c2307ebd8ee65497e/lib/escort-client.js#L102-L140
43,997
wala/jsdelta
src/file_util.js
getTempFileName
function getTempFileName(state) { var fn = state.tmp_dir + "/delta_js_" + state.round + "." + state.ext; state.round++; return fn; }
javascript
function getTempFileName(state) { var fn = state.tmp_dir + "/delta_js_" + state.round + "." + state.ext; state.round++; return fn; }
[ "function", "getTempFileName", "(", "state", ")", "{", "var", "fn", "=", "state", ".", "tmp_dir", "+", "\"/delta_js_\"", "+", "state", ".", "round", "+", "\".\"", "+", "state", ".", "ext", ";", "state", ".", "round", "++", ";", "return", "fn", ";", "...
get name of current test case
[ "get", "name", "of", "current", "test", "case" ]
355febea1ee23e9e909ba2bfa087ffb2499a3295
https://github.com/wala/jsdelta/blob/355febea1ee23e9e909ba2bfa087ffb2499a3295/src/file_util.js#L8-L12
43,998
wala/jsdelta
src/file_util.js
copyToOut
function copyToOut(src, out, multiFileMode) { try { fs.copySync(src, out); fs.statSync(out) return out; } catch (err) { } }
javascript
function copyToOut(src, out, multiFileMode) { try { fs.copySync(src, out); fs.statSync(out) return out; } catch (err) { } }
[ "function", "copyToOut", "(", "src", ",", "out", ",", "multiFileMode", ")", "{", "try", "{", "fs", ".", "copySync", "(", "src", ",", "out", ")", ";", "fs", ".", "statSync", "(", "out", ")", "return", "out", ";", "}", "catch", "(", "err", ")", "{"...
Return path to file if copy was successful. Return undefined otherwise.
[ "Return", "path", "to", "file", "if", "copy", "was", "successful", ".", "Return", "undefined", "otherwise", "." ]
355febea1ee23e9e909ba2bfa087ffb2499a3295
https://github.com/wala/jsdelta/blob/355febea1ee23e9e909ba2bfa087ffb2499a3295/src/file_util.js#L62-L69
43,999
WebReflection/es-class
build/es-class.max.amd.js
function (method) { var str = '' + method, i = str.indexOf(SUPER) ; return i < 0 ? false : isBoundary(str.charCodeAt(i - 1)) && isBoundary(str.charCodeAt(i + 5)); }
javascript
function (method) { var str = '' + method, i = str.indexOf(SUPER) ; return i < 0 ? false : isBoundary(str.charCodeAt(i - 1)) && isBoundary(str.charCodeAt(i + 5)); }
[ "function", "(", "method", ")", "{", "var", "str", "=", "''", "+", "method", ",", "i", "=", "str", ".", "indexOf", "(", "SUPER", ")", ";", "return", "i", "<", "0", "?", "false", ":", "isBoundary", "(", "str", ".", "charCodeAt", "(", "i", "-", "...
all other JS engines should be just fine
[ "all", "other", "JS", "engines", "should", "be", "just", "fine" ]
8e3f3b65a67955d11e15820e8f44e2cdaac4bd50
https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L159-L168