repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
rakuten-frontend/bower-browser
client/assets/scripts/services/settings.js
function (data) { var validData = _.deepMapValues(this.config, function (value, propertyPath) { return _.deepGet(data, propertyPath.join('.')); }); _.merge(this.config, validData); }
javascript
function (data) { var validData = _.deepMapValues(this.config, function (value, propertyPath) { return _.deepGet(data, propertyPath.join('.')); }); _.merge(this.config, validData); }
[ "function", "(", "data", ")", "{", "var", "validData", "=", "_", ".", "deepMapValues", "(", "this", ".", "config", ",", "function", "(", "value", ",", "propertyPath", ")", "{", "return", "_", ".", "deepGet", "(", "data", ",", "propertyPath", ".", "join...
Set settings Invalid properties are ignored
[ "Set", "settings", "Invalid", "properties", "are", "ignored" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/settings.js#L38-L43
train
rakuten-frontend/bower-browser
client/assets/scripts/services/settings.js
function () { var self = this; $http.get(settingsApi) .success(function (data) { self.set(data); $timeout(function () { self.loaded = true; }); }) .error(function () { self.reset(); $timeout(function ...
javascript
function () { var self = this; $http.get(settingsApi) .success(function (data) { self.set(data); $timeout(function () { self.loaded = true; }); }) .error(function () { self.reset(); $timeout(function ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "$http", ".", "get", "(", "settingsApi", ")", ".", "success", "(", "function", "(", "data", ")", "{", "self", ".", "set", "(", "data", ")", ";", "$timeout", "(", "function", "(", ")", "{...
Load settings from server
[ "Load", "settings", "from", "server" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/settings.js#L46-L61
train
rakuten-frontend/bower-browser
client/assets/scripts/services/settings.js
function () { var searchField = this.config.searchField; return searchField && Object.keys(searchField).every(function (key) { return searchField[key] === false; }); }
javascript
function () { var searchField = this.config.searchField; return searchField && Object.keys(searchField).every(function (key) { return searchField[key] === false; }); }
[ "function", "(", ")", "{", "var", "searchField", "=", "this", ".", "config", ".", "searchField", ";", "return", "searchField", "&&", "Object", ".", "keys", "(", "searchField", ")", ".", "every", "(", "function", "(", "key", ")", "{", "return", "searchFie...
Warn when no search field is selected
[ "Warn", "when", "no", "search", "field", "is", "selected" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/settings.js#L74-L80
train
opendxl/opendxl-client-javascript
sample/common.js
function (module) { if (module === SDK_PACKAGE_NAME) { var packageFile = path.join(__dirname, '..', 'package.json') if (fs.existsSync(packageFile)) { var packageInfo = JSON.parse(fs.readFileSync(packageFile)) if (packageInfo.name === SDK_PACKAGE_NAME) { // Use local library sou...
javascript
function (module) { if (module === SDK_PACKAGE_NAME) { var packageFile = path.join(__dirname, '..', 'package.json') if (fs.existsSync(packageFile)) { var packageInfo = JSON.parse(fs.readFileSync(packageFile)) if (packageInfo.name === SDK_PACKAGE_NAME) { // Use local library sou...
[ "function", "(", "module", ")", "{", "if", "(", "module", "===", "SDK_PACKAGE_NAME", ")", "{", "var", "packageFile", "=", "path", ".", "join", "(", "__dirname", ",", "'..'", ",", "'package.json'", ")", "if", "(", "fs", ".", "existsSync", "(", "packageFil...
Load a module, adjusting for an alternate location when running from an SDK sample. This function adjusts for differences in the module path when running a sample from a repository source checkout vs. an installed release package and for flat (NPM version 2) vs. nested (NPM version 3 and later) dependency installation...
[ "Load", "a", "module", "adjusting", "for", "an", "alternate", "location", "when", "running", "from", "an", "SDK", "sample", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/sample/common.js#L37-L55
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (params) { var self = this; this.parseParams(params); if (!this.loaded) { this.fetchApi(api).success(function (data) { packages = data; self.loaded = true; self.search(); }); } else { this.search(); ...
javascript
function (params) { var self = this; this.parseParams(params); if (!this.loaded) { this.fetchApi(api).success(function (data) { packages = data; self.loaded = true; self.search(); }); } else { this.search(); ...
[ "function", "(", "params", ")", "{", "var", "self", "=", "this", ";", "this", ".", "parseParams", "(", "params", ")", ";", "if", "(", "!", "this", ".", "loaded", ")", "{", "this", ".", "fetchApi", "(", "api", ")", ".", "success", "(", "function", ...
Set params and update results
[ "Set", "params", "and", "update", "results" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L42-L55
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (params) { this.query = params.q !== undefined ? String(params.q) : defaultParams.query; this.page = params.p !== undefined ? parseInt(params.p, 10) : defaultParams.page; switch (params.s) { case 'name': case 'owner': case 'stars': case 'updated':...
javascript
function (params) { this.query = params.q !== undefined ? String(params.q) : defaultParams.query; this.page = params.p !== undefined ? parseInt(params.p, 10) : defaultParams.page; switch (params.s) { case 'name': case 'owner': case 'stars': case 'updated':...
[ "function", "(", "params", ")", "{", "this", ".", "query", "=", "params", ".", "q", "!==", "undefined", "?", "String", "(", "params", ".", "q", ")", ":", "defaultParams", ".", "query", ";", "this", ".", "page", "=", "params", ".", "p", "!==", "unde...
Parse params to set correct value
[ "Parse", "params", "to", "set", "correct", "value" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L58-L79
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (url) { var self = this; this.searching = true; this.loadingError = false; return $http.get(url) .success(function (res) { self.searching = false; return res.data; }) .error(function () { self.searching = false; ...
javascript
function (url) { var self = this; this.searching = true; this.loadingError = false; return $http.get(url) .success(function (res) { self.searching = false; return res.data; }) .error(function () { self.searching = false; ...
[ "function", "(", "url", ")", "{", "var", "self", "=", "this", ";", "this", ".", "searching", "=", "true", ";", "this", ".", "loadingError", "=", "false", ";", "return", "$http", ".", "get", "(", "url", ")", ".", "success", "(", "function", "(", "re...
Get component list from API
[ "Get", "component", "list", "from", "API" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L82-L96
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (items) { if (!config.ignoreDeprecatedPackages) { return items; } var list = _.filter(items, function (item) { // Ignore packages if (ignore.indexOf(item.name) !== -1) { return false; } // Limit to whitelisted packages ...
javascript
function (items) { if (!config.ignoreDeprecatedPackages) { return items; } var list = _.filter(items, function (item) { // Ignore packages if (ignore.indexOf(item.name) !== -1) { return false; } // Limit to whitelisted packages ...
[ "function", "(", "items", ")", "{", "if", "(", "!", "config", ".", "ignoreDeprecatedPackages", ")", "{", "return", "items", ";", "}", "var", "list", "=", "_", ".", "filter", "(", "items", ",", "function", "(", "item", ")", "{", "// Ignore packages", "i...
Exclude ignoring packages
[ "Exclude", "ignoring", "packages" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L133-L149
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (items, query, fields, exact) { var self = this; var isTarget = function (fieldName) { return fields.indexOf(fieldName) !== -1; }; if (query === '') { return items; } fields = fields || ['name', 'owner', 'description', 'keyword']; retu...
javascript
function (items, query, fields, exact) { var self = this; var isTarget = function (fieldName) { return fields.indexOf(fieldName) !== -1; }; if (query === '') { return items; } fields = fields || ['name', 'owner', 'description', 'keyword']; retu...
[ "function", "(", "items", ",", "query", ",", "fields", ",", "exact", ")", "{", "var", "self", "=", "this", ";", "var", "isTarget", "=", "function", "(", "fieldName", ")", "{", "return", "fields", ".", "indexOf", "(", "fieldName", ")", "!==", "-", "1"...
Find items by query
[ "Find", "items", "by", "query" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L177-L195
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (query, string, exact) { if (typeof string !== 'string' || string === '') { return false; } if (exact) { return string.toLowerCase() === query.toLowerCase(); } return string.toLowerCase().indexOf(query.toLowerCase()) !== -1; }
javascript
function (query, string, exact) { if (typeof string !== 'string' || string === '') { return false; } if (exact) { return string.toLowerCase() === query.toLowerCase(); } return string.toLowerCase().indexOf(query.toLowerCase()) !== -1; }
[ "function", "(", "query", ",", "string", ",", "exact", ")", "{", "if", "(", "typeof", "string", "!==", "'string'", "||", "string", "===", "''", ")", "{", "return", "false", ";", "}", "if", "(", "exact", ")", "{", "return", "string", ".", "toLowerCase...
Search in string field
[ "Search", "in", "string", "field" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L198-L206
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (query, array, exact) { if (!_.isArray(array) || array.length === 0) { return false; } return array.some(function (string) { if (exact) { return query.toLowerCase() === string.toLowerCase(); } return string.toLowerCase().indexOf(query....
javascript
function (query, array, exact) { if (!_.isArray(array) || array.length === 0) { return false; } return array.some(function (string) { if (exact) { return query.toLowerCase() === string.toLowerCase(); } return string.toLowerCase().indexOf(query....
[ "function", "(", "query", ",", "array", ",", "exact", ")", "{", "if", "(", "!", "_", ".", "isArray", "(", "array", ")", "||", "array", ".", "length", "===", "0", ")", "{", "return", "false", ";", "}", "return", "array", ".", "some", "(", "functio...
Search in array field
[ "Search", "in", "array", "field" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L209-L219
train
rakuten-frontend/bower-browser
client/assets/scripts/services/search.js
function (items, query) { if (!config.exactMatch || !config.searchField.name) { return items; } var list = items; var match = _.findIndex(list, function (item) { return query.toLowerCase() === item.name.toLowerCase(); }); if (match !== -1) { ...
javascript
function (items, query) { if (!config.exactMatch || !config.searchField.name) { return items; } var list = items; var match = _.findIndex(list, function (item) { return query.toLowerCase() === item.name.toLowerCase(); }); if (match !== -1) { ...
[ "function", "(", "items", ",", "query", ")", "{", "if", "(", "!", "config", ".", "exactMatch", "||", "!", "config", ".", "searchField", ".", "name", ")", "{", "return", "items", ";", "}", "var", "list", "=", "items", ";", "var", "match", "=", "_", ...
Prioritize exact match
[ "Prioritize", "exact", "match" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/search.js#L233-L245
train
layerhq/node-layer-webhooks-services
src/receipts.js
processMessage
function processMessage(message) { var recipients = Object.keys(message.recipient_status).filter(function(userId) { return hook.receipts.reportForStatus.indexOf(message.recipient_status[userId]) !== -1; }); if (recipients.length) { var identities = [message.sender.user_id].concat(reci...
javascript
function processMessage(message) { var recipients = Object.keys(message.recipient_status).filter(function(userId) { return hook.receipts.reportForStatus.indexOf(message.recipient_status[userId]) !== -1; }); if (recipients.length) { var identities = [message.sender.user_id].concat(reci...
[ "function", "processMessage", "(", "message", ")", "{", "var", "recipients", "=", "Object", ".", "keys", "(", "message", ".", "recipient_status", ")", ".", "filter", "(", "function", "(", "userId", ")", "{", "return", "hook", ".", "receipts", ".", "reportF...
Process an individual Message and create a job if there are matching recipients.
[ "Process", "an", "individual", "Message", "and", "create", "a", "job", "if", "there", "are", "matching", "recipients", "." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/src/receipts.js#L155-L180
train
serkanyersen/kwargsjs
kwargs.js
function() { var args = Array.prototype.slice.call(arguments, 0), org = args.shift(); return kwargs.apply(org, args); }
javascript
function() { var args = Array.prototype.slice.call(arguments, 0), org = args.shift(); return kwargs.apply(org, args); }
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ",", "org", "=", "args", ".", "shift", "(", ")", ";", "return", "kwargs", ".", "apply", "(", "org", ",", "args",...
as a separate function for module loaders
[ "as", "a", "separate", "function", "for", "module", "loaders" ]
fa294ffea701d14977c5b2ded3c8c73e5cec5b04
https://github.com/serkanyersen/kwargsjs/blob/fa294ffea701d14977c5b2ded3c8c73e5cec5b04/kwargs.js#L72-L77
train
silas/swagger-framework
lib/docs/router.js
DocsRouter
function DocsRouter(docs, options) { debug('create docs router'); options = options || {}; this.docs = docs; this.prefix = options.prefix || '/'; }
javascript
function DocsRouter(docs, options) { debug('create docs router'); options = options || {}; this.docs = docs; this.prefix = options.prefix || '/'; }
[ "function", "DocsRouter", "(", "docs", ",", "options", ")", "{", "debug", "(", "'create docs router'", ")", ";", "options", "=", "options", "||", "{", "}", ";", "this", ".", "docs", "=", "docs", ";", "this", ".", "prefix", "=", "options", ".", "prefix"...
Initialize a new `DocsRouter`. @param {Docs} docs @param {Object} options @api private
[ "Initialize", "a", "new", "DocsRouter", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/docs/router.js#L27-L34
train
silas/swagger-framework
lib/docs/router.js
function(path, handler) { var node = trie.define(path)[0]; if (typeof handler !== 'function') { throw new Error('invalid handler'); } node.handler = handler; }
javascript
function(path, handler) { var node = trie.define(path)[0]; if (typeof handler !== 'function') { throw new Error('invalid handler'); } node.handler = handler; }
[ "function", "(", "path", ",", "handler", ")", "{", "var", "node", "=", "trie", ".", "define", "(", "path", ")", "[", "0", "]", ";", "if", "(", "typeof", "handler", "!==", "'function'", ")", "{", "throw", "new", "Error", "(", "'invalid handler'", ")",...
check and define routes
[ "check", "and", "define", "routes" ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/docs/router.js#L60-L68
train
layerhq/node-layer-webhooks-services
src/register.js
verifyWebhook
function verifyWebhook(hookDef, webhook) { logger(hookDef.name + ': Webhook already registered: ' + webhook.id + ': ' + webhook.status); if (webhook.status !== 'active') { logger(hookDef.name + ': Enabling webhook'); webhooksClient.enable(webhook.id); } }
javascript
function verifyWebhook(hookDef, webhook) { logger(hookDef.name + ': Webhook already registered: ' + webhook.id + ': ' + webhook.status); if (webhook.status !== 'active') { logger(hookDef.name + ': Enabling webhook'); webhooksClient.enable(webhook.id); } }
[ "function", "verifyWebhook", "(", "hookDef", ",", "webhook", ")", "{", "logger", "(", "hookDef", ".", "name", "+", "': Webhook already registered: '", "+", "webhook", ".", "id", "+", "': '", "+", "webhook", ".", "status", ")", ";", "if", "(", "webhook", "....
Verify that the webhook is active; activate it if its not. @param {Object} hookDef -- A webhook definition object @param {Object} webhook -- A webhook object from Layer
[ "Verify", "that", "the", "webhook", "is", "active", ";", "activate", "it", "if", "its", "not", "." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/src/register.js#L56-L62
train
NickCis/react-data-ssr
packages/express-data-ssr/src/createFetch.js
createRequest
function createRequest(url, req, { method, query } = {}) { const request = { url, method: method || 'GET', query: query || {}, }; return new Proxy(req, { set: (target, name, value, receiver) => { request[name] = value; return true; }, get: (target, name) => { if (name in...
javascript
function createRequest(url, req, { method, query } = {}) { const request = { url, method: method || 'GET', query: query || {}, }; return new Proxy(req, { set: (target, name, value, receiver) => { request[name] = value; return true; }, get: (target, name) => { if (name in...
[ "function", "createRequest", "(", "url", ",", "req", ",", "{", "method", ",", "query", "}", "=", "{", "}", ")", "{", "const", "request", "=", "{", "url", ",", "method", ":", "method", "||", "'GET'", ",", "query", ":", "query", "||", "{", "}", ","...
Creates a Proxy object for the request. XXX: It only supports `GET`, but, will we need another method for SSR? @param {String} url - @param {Object} req - Express request object @param {String} method - GET @param {Object} query - Url query parameters @return {Proxy} Request object
[ "Creates", "a", "Proxy", "object", "for", "the", "request", "." ]
5271a04ed62e53a6a0fef09471f751e778aede10
https://github.com/NickCis/react-data-ssr/blob/5271a04ed62e53a6a0fef09471f751e778aede10/packages/express-data-ssr/src/createFetch.js#L14-L43
train
opendxl/opendxl-client-javascript
lib/client.js
addSubscription
function addSubscription (client, topic, messageType, callback, subscribeToTopic) { if (typeof (subscribeToTopic) === 'undefined') { subscribeToTopic = true } if (callback !== explicitSubscriptionCallback) { client._callbackManager.addCallback(messageType, topic, callback) } if (...
javascript
function addSubscription (client, topic, messageType, callback, subscribeToTopic) { if (typeof (subscribeToTopic) === 'undefined') { subscribeToTopic = true } if (callback !== explicitSubscriptionCallback) { client._callbackManager.addCallback(messageType, topic, callback) } if (...
[ "function", "addSubscription", "(", "client", ",", "topic", ",", "messageType", ",", "callback", ",", "subscribeToTopic", ")", "{", "if", "(", "typeof", "(", "subscribeToTopic", ")", "===", "'undefined'", ")", "{", "subscribeToTopic", "=", "true", "}", "if", ...
Add a topic subscription. @private @param {Client} client - The {@link Client} instance to which the topic subscription should be added. @param {String} topic - Topic to subscribe to. An empty string or null value indicates that the callback should receive messages for all topics (no filtering). @param {(Number|String)...
[ "Add", "a", "topic", "subscription", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/client.js#L183-L212
train
opendxl/opendxl-client-javascript
lib/client.js
removeSubscription
function removeSubscription (client, topic, messageType, callback) { if (callback !== explicitSubscriptionCallback) { client._callbackManager.removeCallback(messageType, topic, callback) } if (topic) { var subscriptionsByMessageType = client._subscriptionsByMessageType var topicMessageTypes = subscri...
javascript
function removeSubscription (client, topic, messageType, callback) { if (callback !== explicitSubscriptionCallback) { client._callbackManager.removeCallback(messageType, topic, callback) } if (topic) { var subscriptionsByMessageType = client._subscriptionsByMessageType var topicMessageTypes = subscri...
[ "function", "removeSubscription", "(", "client", ",", "topic", ",", "messageType", ",", "callback", ")", "{", "if", "(", "callback", "!==", "explicitSubscriptionCallback", ")", "{", "client", ".", "_callbackManager", ".", "removeCallback", "(", "messageType", ",",...
Removes a topic subscription. @private @param {Client} client - The {@link Client} instance from which the topic subscription should be removed. @param {String} topic - Topic to unsubscribe from. @param {(Number|String)} messageType - Type of DXL messages for which the callback should be invoked. Corresponds to one of ...
[ "Removes", "a", "topic", "subscription", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/client.js#L227-L269
train
opendxl/opendxl-client-javascript
lib/client.js
publish
function publish (client, topic, message) { if (client._mqttClient) { client._mqttClient.publish(topic, message) } else { throw new DxlError( 'Client not connected, unable to publish data to: ' + topic) } }
javascript
function publish (client, topic, message) { if (client._mqttClient) { client._mqttClient.publish(topic, message) } else { throw new DxlError( 'Client not connected, unable to publish data to: ' + topic) } }
[ "function", "publish", "(", "client", ",", "topic", ",", "message", ")", "{", "if", "(", "client", ".", "_mqttClient", ")", "{", "client", ".", "_mqttClient", ".", "publish", "(", "topic", ",", "message", ")", "}", "else", "{", "throw", "new", "DxlErro...
Publishes data to a specific topic. @private @param {Client} client - The {@link Client} instance to which the message should be published. @param {String} topic - Topic to publish message to. @param {(String|Buffer)} message - Message to publish. @throws {DxlError} If the MQTT client is not connected.
[ "Publishes", "data", "to", "a", "specific", "topic", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/client.js#L280-L287
train
andreypopp/xcss
lib/expression-compiler.js
compile
function compile(str, scope) { if (!/[\(\){}]/.exec(str)) return literal(str); var nodes = compile2(compile1(str), scope || {}); if (nodes.length === 0) return literal(''); return foldLiterals(nodes) .reduce(function(c, e) {return binaryExpression('+', c, e)}); }
javascript
function compile(str, scope) { if (!/[\(\){}]/.exec(str)) return literal(str); var nodes = compile2(compile1(str), scope || {}); if (nodes.length === 0) return literal(''); return foldLiterals(nodes) .reduce(function(c, e) {return binaryExpression('+', c, e)}); }
[ "function", "compile", "(", "str", ",", "scope", ")", "{", "if", "(", "!", "/", "[\\(\\){}]", "/", ".", "exec", "(", "str", ")", ")", "return", "literal", "(", "str", ")", ";", "var", "nodes", "=", "compile2", "(", "compile1", "(", "str", ")", ",...
Compile xCSS expression. @param {String} str @param {Object} scope
[ "Compile", "xCSS", "expression", "." ]
2beae072eb8c7e41e9434565bb8c3a0389c8053d
https://github.com/andreypopp/xcss/blob/2beae072eb8c7e41e9434565bb8c3a0389c8053d/lib/expression-compiler.js#L24-L32
train
andreypopp/xcss
lib/expression-compiler.js
foldLiterals
function foldLiterals(nodes) { return nodes.reduce(function(c, e) { if (e.type === 'Literal') { var last = c[c.length - 1]; if (last && last.type === 'Literal') { c.pop(); return c.concat(literal(last.value + e.value)); } } return c.concat(e); }, []) }
javascript
function foldLiterals(nodes) { return nodes.reduce(function(c, e) { if (e.type === 'Literal') { var last = c[c.length - 1]; if (last && last.type === 'Literal') { c.pop(); return c.concat(literal(last.value + e.value)); } } return c.concat(e); }, []) }
[ "function", "foldLiterals", "(", "nodes", ")", "{", "return", "nodes", ".", "reduce", "(", "function", "(", "c", ",", "e", ")", "{", "if", "(", "e", ".", "type", "===", "'Literal'", ")", "{", "var", "last", "=", "c", "[", "c", ".", "length", "-",...
Fold adjacent string literals
[ "Fold", "adjacent", "string", "literals" ]
2beae072eb8c7e41e9434565bb8c3a0389c8053d
https://github.com/andreypopp/xcss/blob/2beae072eb8c7e41e9434565bb8c3a0389c8053d/lib/expression-compiler.js#L37-L48
train
andreypopp/xcss
lib/expression-compiler.js
compile1
function compile1(str) { if (!/[{}]/.exec(str)) return [literal(str)]; var depth = 0; var nodes = []; var m; var buffer = ''; while ((m = /[{}]/.exec(str)) && str.length > 0) { var chunk = str.substring(0, m.index); switch (m[0]) { case '{': depth += 1; if (depth === 1) { ...
javascript
function compile1(str) { if (!/[{}]/.exec(str)) return [literal(str)]; var depth = 0; var nodes = []; var m; var buffer = ''; while ((m = /[{}]/.exec(str)) && str.length > 0) { var chunk = str.substring(0, m.index); switch (m[0]) { case '{': depth += 1; if (depth === 1) { ...
[ "function", "compile1", "(", "str", ")", "{", "if", "(", "!", "/", "[{}]", "/", ".", "exec", "(", "str", ")", ")", "return", "[", "literal", "(", "str", ")", "]", ";", "var", "depth", "=", "0", ";", "var", "nodes", "=", "[", "]", ";", "var", ...
Compile JS interpolations. @param {String} str
[ "Compile", "JS", "interpolations", "." ]
2beae072eb8c7e41e9434565bb8c3a0389c8053d
https://github.com/andreypopp/xcss/blob/2beae072eb8c7e41e9434565bb8c3a0389c8053d/lib/expression-compiler.js#L55-L94
train
andreypopp/xcss
lib/expression-compiler.js
compile2
function compile2(nodes, scope) { var toks = flatMap(nodes, function(expr) { return expr.type === 'Literal' ? tokenize2(expr.value) : expr; }); return parse2(toks, scope); }
javascript
function compile2(nodes, scope) { var toks = flatMap(nodes, function(expr) { return expr.type === 'Literal' ? tokenize2(expr.value) : expr; }); return parse2(toks, scope); }
[ "function", "compile2", "(", "nodes", ",", "scope", ")", "{", "var", "toks", "=", "flatMap", "(", "nodes", ",", "function", "(", "expr", ")", "{", "return", "expr", ".", "type", "===", "'Literal'", "?", "tokenize2", "(", "expr", ".", "value", ")", ":...
Compile function calls and variable references @param {Array<Node>} nodes @param {Object} scope
[ "Compile", "function", "calls", "and", "variable", "references" ]
2beae072eb8c7e41e9434565bb8c3a0389c8053d
https://github.com/andreypopp/xcss/blob/2beae072eb8c7e41e9434565bb8c3a0389c8053d/lib/expression-compiler.js#L102-L107
train
silas/swagger-framework
lib/framework.js
Framework
function Framework(spec, options) { if (!(this instanceof Framework)) { return new Framework(spec, options); } debug('create framework', spec, options); spec = lodash.cloneDeep(spec || {}); options = lodash.cloneDeep(options || {}); spec = lodash.defaults(spec, { swaggerVersion: '1.2', apis: ...
javascript
function Framework(spec, options) { if (!(this instanceof Framework)) { return new Framework(spec, options); } debug('create framework', spec, options); spec = lodash.cloneDeep(spec || {}); options = lodash.cloneDeep(options || {}); spec = lodash.defaults(spec, { swaggerVersion: '1.2', apis: ...
[ "function", "Framework", "(", "spec", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Framework", ")", ")", "{", "return", "new", "Framework", "(", "spec", ",", "options", ")", ";", "}", "debug", "(", "'create framework'", ",", "s...
Initialize a new `Framework`. @param {Object} spec @param {Object} options @api public
[ "Initialize", "a", "new", "Framework", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework.js#L30-L64
train
opendxl/opendxl-client-javascript
lib/_cli/cli-pki.js
fieldAsOption
function fieldAsOption (field) { var option = '' for (var i = 0; i < field.length; i++) { var c = field.charAt(i) if (c < 'a') { option = option + '-' + c.toLowerCase() } else { option += c } } return option }
javascript
function fieldAsOption (field) { var option = '' for (var i = 0; i < field.length; i++) { var c = field.charAt(i) if (c < 'a') { option = option + '-' + c.toLowerCase() } else { option += c } } return option }
[ "function", "fieldAsOption", "(", "field", ")", "{", "var", "option", "=", "''", "for", "(", "var", "i", "=", "0", ";", "i", "<", "field", ".", "length", ";", "i", "++", ")", "{", "var", "c", "=", "field", ".", "charAt", "(", "i", ")", "if", ...
Converts a camelCase field name to lowercase hyphen-delimited format for use as a command-line option. For example, this method would convert 'optionName' to 'option-name'. @param {String} field - Name of the field to convert. @returns {String} Field name in lowercase hyphen-delimited format.
[ "Converts", "a", "camelCase", "field", "name", "to", "lowercase", "hyphen", "-", "delimited", "format", "for", "use", "as", "a", "command", "-", "line", "option", ".", "For", "example", "this", "method", "would", "convert", "optionName", "to", "option", "-",...
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-pki.js#L21-L32
train
opendxl/opendxl-client-javascript
lib/_cli/cli-pki.js
function (command) { command.option('--opensslbin <file>', 'Location of the OpenSSL executable that the command uses. If not ' + 'specified, the command attempts to find an OpenSSL executable in ' + 'the current environment path.') command.option('-s, --san [value]', 'add Subject Alterna...
javascript
function (command) { command.option('--opensslbin <file>', 'Location of the OpenSSL executable that the command uses. If not ' + 'specified, the command attempts to find an OpenSSL executable in ' + 'the current environment path.') command.option('-s, --san [value]', 'add Subject Alterna...
[ "function", "(", "command", ")", "{", "command", ".", "option", "(", "'--opensslbin <file>'", ",", "'Location of the OpenSSL executable that the command uses. If not '", "+", "'specified, the command attempts to find an OpenSSL executable in '", "+", "'the current environment path.'", ...
Appends options related to the use of PKI utilities to a Commander-based command. @param {Command} command - The Commander command to append options onto. @returns {Command}
[ "Appends", "options", "related", "to", "the", "use", "of", "PKI", "utilities", "to", "a", "Commander", "-", "based", "command", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-pki.js#L55-L73
train
opendxl/opendxl-client-javascript
lib/_cli/cli-pki.js
function (command, responseCallback) { if (command.passphrase === true) { cliUtil.getValueFromPrompt('private key passphrase', true, function (error, passphrase) { if (error) { provisionUtil.invokeCallback(error, responseCallback, command.verbosity) } else...
javascript
function (command, responseCallback) { if (command.passphrase === true) { cliUtil.getValueFromPrompt('private key passphrase', true, function (error, passphrase) { if (error) { provisionUtil.invokeCallback(error, responseCallback, command.verbosity) } else...
[ "function", "(", "command", ",", "responseCallback", ")", "{", "if", "(", "command", ".", "passphrase", "===", "true", ")", "{", "cliUtil", ".", "getValueFromPrompt", "(", "'private key passphrase'", ",", "true", ",", "function", "(", "error", ",", "passphrase...
Process the private key passphrase from the supplied Commander-based command. @param {Command} command - Commander-based command which contains options to use in generating the CSR and private key. @param {(String|Boolean)} [command.passphrase] - If `true`, prompt from the command line for the private key passphrase to...
[ "Process", "the", "private", "key", "passphrase", "from", "the", "supplied", "Commander", "-", "based", "command", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-pki.js#L87-L103
train
cast-org/figuration
js/util.js
CFW_transitionCssDuration
function CFW_transitionCssDuration($node) { var durationArray = [0]; // Set a min value -- otherwise get `Infinity` $node.each(function() { var durations = $node.css('transition-duration') || $node.css('-webkit-transition-duration') || $node.css('-moz-transition-duration') || $node.css('-ms-...
javascript
function CFW_transitionCssDuration($node) { var durationArray = [0]; // Set a min value -- otherwise get `Infinity` $node.each(function() { var durations = $node.css('transition-duration') || $node.css('-webkit-transition-duration') || $node.css('-moz-transition-duration') || $node.css('-ms-...
[ "function", "CFW_transitionCssDuration", "(", "$node", ")", "{", "var", "durationArray", "=", "[", "0", "]", ";", "// Set a min value -- otherwise get `Infinity`", "$node", ".", "each", "(", "function", "(", ")", "{", "var", "durations", "=", "$node", ".", "css"...
Get longest CSS transition duration
[ "Get", "longest", "CSS", "transition", "duration" ]
c82f491ebccb477f7e1c945bfff61c2340afe1ac
https://github.com/cast-org/figuration/blob/c82f491ebccb477f7e1c945bfff61c2340afe1ac/js/util.js#L62-L78
train
jeffbski/autoflow
dist/autoflow.js
nameTasks
function nameTasks(tasks) { //name tasks that are not already named, validation done elsewhere, ret map var namesMap = tasks.reduce(function (map, t) { if (t.name) { map[t.name] = t; } return map; }, {}); tasks.forEach(function (t, idx) { if (!t.name) { //not already named var name...
javascript
function nameTasks(tasks) { //name tasks that are not already named, validation done elsewhere, ret map var namesMap = tasks.reduce(function (map, t) { if (t.name) { map[t.name] = t; } return map; }, {}); tasks.forEach(function (t, idx) { if (!t.name) { //not already named var name...
[ "function", "nameTasks", "(", "tasks", ")", "{", "//name tasks that are not already named, validation done elsewhere, ret map", "var", "namesMap", "=", "tasks", ".", "reduce", "(", "function", "(", "map", ",", "t", ")", "{", "if", "(", "t", ".", "name", ")", "{"...
Name tasks that are not already named. Prenamed task uniquness validation will be done in validate. This modifies the tasks with the new names. @returns map of names to tasks
[ "Name", "tasks", "that", "are", "not", "already", "named", ".", "Prenamed", "task", "uniquness", "validation", "will", "be", "done", "in", "validate", "." ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/dist/autoflow.js#L2133-L2150
train
jeffbski/autoflow
dist/autoflow.js
validate
function validate(ast) { if (!ast || !ast.inParams || !ast.tasks || !ast.outTask) return [AST_IS_OBJECT]; var errors = []; errors = errors.concat(validateInParams(ast.inParams)); errors = errors.concat(validateTasks(ast.tasks)); errors = errors.concat(validateTaskNamesUnique(ast.tasks)); errors ...
javascript
function validate(ast) { if (!ast || !ast.inParams || !ast.tasks || !ast.outTask) return [AST_IS_OBJECT]; var errors = []; errors = errors.concat(validateInParams(ast.inParams)); errors = errors.concat(validateTasks(ast.tasks)); errors = errors.concat(validateTaskNamesUnique(ast.tasks)); errors ...
[ "function", "validate", "(", "ast", ")", "{", "if", "(", "!", "ast", "||", "!", "ast", ".", "inParams", "||", "!", "ast", ".", "tasks", "||", "!", "ast", ".", "outTask", ")", "return", "[", "AST_IS_OBJECT", "]", ";", "var", "errors", "=", "[", "]...
validate the AST return Errors @example var validate = require('./validate'); var errors = validate(ast); @returns array of errors, could be empty
[ "validate", "the", "AST", "return", "Errors" ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/dist/autoflow.js#L2280-L2294
train
jeffbski/autoflow
dist/autoflow.js
validateNoMissingNames
function validateNoMissingNames(ast) { var errors = []; var names = {}; if (ast.locals) { names = Object.keys(ast.locals).reduce(function (accum, k) { // start with locals accum[k] = true; return accum; }, names); } ast.inParams.reduce(function (accum, p) { // add input ...
javascript
function validateNoMissingNames(ast) { var errors = []; var names = {}; if (ast.locals) { names = Object.keys(ast.locals).reduce(function (accum, k) { // start with locals accum[k] = true; return accum; }, names); } ast.inParams.reduce(function (accum, p) { // add input ...
[ "function", "validateNoMissingNames", "(", "ast", ")", "{", "var", "errors", "=", "[", "]", ";", "var", "names", "=", "{", "}", ";", "if", "(", "ast", ".", "locals", ")", "{", "names", "=", "Object", ".", "keys", "(", "ast", ".", "locals", ")", "...
validate there are no missing or mispelled param names in any task inputs or the final task output @return array of errors, or empty array if none
[ "validate", "there", "are", "no", "missing", "or", "mispelled", "param", "names", "in", "any", "task", "inputs", "or", "the", "final", "task", "output" ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/dist/autoflow.js#L2361-L2395
train
jeffbski/autoflow
dist/autoflow.js
filterOutTrailingCbParam
function filterOutTrailingCbParam(args) { // if has trailing cb | callback param, filter it out if (args.length && args[args.length - 1].match(CB_NAMES_RE)) args.pop(); return args; }
javascript
function filterOutTrailingCbParam(args) { // if has trailing cb | callback param, filter it out if (args.length && args[args.length - 1].match(CB_NAMES_RE)) args.pop(); return args; }
[ "function", "filterOutTrailingCbParam", "(", "args", ")", "{", "// if has trailing cb | callback param, filter it out", "if", "(", "args", ".", "length", "&&", "args", "[", "args", ".", "length", "-", "1", "]", ".", "match", "(", "CB_NAMES_RE", ")", ")", "args",...
err, ERR, Err, ...
[ "err", "ERR", "Err", "..." ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/dist/autoflow.js#L2669-L2672
train
tonistiigi/styler
support/dryice.js
CommonJsProject
function CommonJsProject(opts) { this.roots = opts.roots; this.textPluginPattern = opts.textPluginPattern || /^text!/; opts.roots = this.roots.map(function(root) { if (!copy.isDirectory(root)) { throw new Error('Each commonjs root should be a directory: ' + root); } return ensureTrailingSlash(r...
javascript
function CommonJsProject(opts) { this.roots = opts.roots; this.textPluginPattern = opts.textPluginPattern || /^text!/; opts.roots = this.roots.map(function(root) { if (!copy.isDirectory(root)) { throw new Error('Each commonjs root should be a directory: ' + root); } return ensureTrailingSlash(r...
[ "function", "CommonJsProject", "(", "opts", ")", "{", "this", ".", "roots", "=", "opts", ".", "roots", ";", "this", ".", "textPluginPattern", "=", "opts", ".", "textPluginPattern", "||", "/", "^text!", "/", ";", "opts", ".", "roots", "=", "this", ".", ...
Keep track of the files in a project
[ "Keep", "track", "of", "the", "files", "in", "a", "project" ]
f20dd9621f671b77cbb660d35327e007e8a56e2a
https://github.com/tonistiigi/styler/blob/f20dd9621f671b77cbb660d35327e007e8a56e2a/support/dryice.js#L659-L673
train
silas/swagger-framework
lib/schema/find.js
model
function model(obj) { if (!obj) return; if (obj.$ref) { obj = obj.$ref; } else if (obj.type === 'array' && obj.items && obj.items.$ref) { obj = obj.items.$ref; } else if (obj.type) { obj = obj.type; } // ensure valid type if (typeof obj !== 'string') return; // ensure non-builtin type if...
javascript
function model(obj) { if (!obj) return; if (obj.$ref) { obj = obj.$ref; } else if (obj.type === 'array' && obj.items && obj.items.$ref) { obj = obj.items.$ref; } else if (obj.type) { obj = obj.type; } // ensure valid type if (typeof obj !== 'string') return; // ensure non-builtin type if...
[ "function", "model", "(", "obj", ")", "{", "if", "(", "!", "obj", ")", "return", ";", "if", "(", "obj", ".", "$ref", ")", "{", "obj", "=", "obj", ".", "$ref", ";", "}", "else", "if", "(", "obj", ".", "type", "===", "'array'", "&&", "obj", "."...
Find model.
[ "Find", "model", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/find.js#L19-L36
train
silas/swagger-framework
lib/schema/find.js
models
function models(spec) { var ids = {}; if (!spec) return ids; var add = function(obj) { var type = model(obj); if (type) ids[type] = true; }; add(spec); if (spec.properties) { lodash.forOwn(spec.properties, function(p) { add(p); }); } else if (spec.parameters) { spec.parameters.forEach(...
javascript
function models(spec) { var ids = {}; if (!spec) return ids; var add = function(obj) { var type = model(obj); if (type) ids[type] = true; }; add(spec); if (spec.properties) { lodash.forOwn(spec.properties, function(p) { add(p); }); } else if (spec.parameters) { spec.parameters.forEach(...
[ "function", "models", "(", "spec", ")", "{", "var", "ids", "=", "{", "}", ";", "if", "(", "!", "spec", ")", "return", "ids", ";", "var", "add", "=", "function", "(", "obj", ")", "{", "var", "type", "=", "model", "(", "obj", ")", ";", "if", "(...
Find models.
[ "Find", "models", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/find.js#L42-L61
train
layerhq/node-layer-webhooks-services
examples/basic-services/conversation-delete.js
getDescription
function getDescription(conversation) { if (conversation.metadata.conversationersationName) { return 'The Conversation ' + conversation.metadata.conversationersationName + ' has been deleted'; } else { return 'The Conversation with ' + conversation.participants.join(', ').replace(/(.*),(.*)/...
javascript
function getDescription(conversation) { if (conversation.metadata.conversationersationName) { return 'The Conversation ' + conversation.metadata.conversationersationName + ' has been deleted'; } else { return 'The Conversation with ' + conversation.participants.join(', ').replace(/(.*),(.*)/...
[ "function", "getDescription", "(", "conversation", ")", "{", "if", "(", "conversation", ".", "metadata", ".", "conversationersationName", ")", "{", "return", "'The Conversation '", "+", "conversation", ".", "metadata", ".", "conversationersationName", "+", "' has been...
Return a message body describing the deletion
[ "Return", "a", "message", "body", "describing", "the", "deletion" ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/examples/basic-services/conversation-delete.js#L53-L61
train
opendxl/opendxl-client-javascript
lib/_cli/cli-generate-csr.js
cliGenerateCsr
function cliGenerateCsr (configDir, commonOrCsrFileName, command) { cliPki.processPrivateKeyPassphrase(command, function (error) { if (error) { provisionUtil.invokeCallback(error, command.doneCallback, command.verbosity) } else { pki.generatePrivateKeyAndCsr(configDir, common...
javascript
function cliGenerateCsr (configDir, commonOrCsrFileName, command) { cliPki.processPrivateKeyPassphrase(command, function (error) { if (error) { provisionUtil.invokeCallback(error, command.doneCallback, command.verbosity) } else { pki.generatePrivateKeyAndCsr(configDir, common...
[ "function", "cliGenerateCsr", "(", "configDir", ",", "commonOrCsrFileName", ",", "command", ")", "{", "cliPki", ".", "processPrivateKeyPassphrase", "(", "command", ",", "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "provisionUtil", ".", "in...
Action function invoked for the generatecsr subcommand. @param {String} configDir - Directory in which to store the private key and CSR file. @param {String} commonOrCsrFileName - A string representing either a common name (CN) to add into the generated file or the path to the location of an existing CSR file. The para...
[ "Action", "function", "invoked", "for", "the", "generatecsr", "subcommand", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-generate-csr.js#L24-L35
train
tonistiigi/styler
lib/public/build/editor.js
function(win) { win = win || window; this.lastFocus = new Date().getTime(); this._isFocused = true; var _self = this; // IE < 9 supports focusin and focusout events if ("onfocusin" in win.document) { event.addListener(win.document, "focusin", function(e) { _self._s...
javascript
function(win) { win = win || window; this.lastFocus = new Date().getTime(); this._isFocused = true; var _self = this; // IE < 9 supports focusin and focusout events if ("onfocusin" in win.document) { event.addListener(win.document, "focusin", function(e) { _self._s...
[ "function", "(", "win", ")", "{", "win", "=", "win", "||", "window", ";", "this", ".", "lastFocus", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "this", ".", "_isFocused", "=", "true", ";", "var", "_self", "=", "this", ";", "// IE...
This class keeps track of the focus state of the given window. Focus changes for example when the user switches a browser tab, goes to the location bar or switches to another application.
[ "This", "class", "keeps", "track", "of", "the", "focus", "state", "of", "the", "given", "window", ".", "Focus", "changes", "for", "example", "when", "the", "user", "switches", "a", "browser", "tab", "goes", "to", "the", "location", "bar", "or", "switches",...
f20dd9621f671b77cbb660d35327e007e8a56e2a
https://github.com/tonistiigi/styler/blob/f20dd9621f671b77cbb660d35327e007e8a56e2a/lib/public/build/editor.js#L7768-L7795
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train