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
bhoriuchi/vsphere-connect
archive/v1/util.js
isInt
function isInt(obj) { var type = sType(obj); return (_.has(obj, '$value') && (type === 'xsd:int' || type === 'int')); }
javascript
function isInt(obj) { var type = sType(obj); return (_.has(obj, '$value') && (type === 'xsd:int' || type === 'int')); }
[ "function", "isInt", "(", "obj", ")", "{", "var", "type", "=", "sType", "(", "obj", ")", ";", "return", "(", "_", ".", "has", "(", "obj", ",", "'$value'", ")", "&&", "(", "type", "===", "'xsd:int'", "||", "type", "===", "'int'", ")", ")", ";", ...
check for number
[ "check", "for", "number" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L51-L54
train
bhoriuchi/vsphere-connect
archive/v1/util.js
hasKeys
function hasKeys(obj) { return (!Array.isArray(obj) && _.isObject(obj) && _.keys(obj).length > 0); }
javascript
function hasKeys(obj) { return (!Array.isArray(obj) && _.isObject(obj) && _.keys(obj).length > 0); }
[ "function", "hasKeys", "(", "obj", ")", "{", "return", "(", "!", "Array", ".", "isArray", "(", "obj", ")", "&&", "_", ".", "isObject", "(", "obj", ")", "&&", "_", ".", "keys", "(", "obj", ")", ".", "length", ">", "0", ")", ";", "}" ]
function to check for object with keys
[ "function", "to", "check", "for", "object", "with", "keys" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L57-L59
train
bhoriuchi/vsphere-connect
archive/v1/util.js
filterValidPaths
function filterValidPaths(type, paths, version) { var valid = []; version = env.schema[version] || env.schema['5.1']; _.forEach(paths, function(p) { if (env.schema.hasProperty(version, type, p)) { valid.push(p); } }); return valid; }
javascript
function filterValidPaths(type, paths, version) { var valid = []; version = env.schema[version] || env.schema['5.1']; _.forEach(paths, function(p) { if (env.schema.hasProperty(version, type, p)) { valid.push(p); } }); return valid; }
[ "function", "filterValidPaths", "(", "type", ",", "paths", ",", "version", ")", "{", "var", "valid", "=", "[", "]", ";", "version", "=", "env", ".", "schema", "[", "version", "]", "||", "env", ".", "schema", "[", "'5.1'", "]", ";", "_", ".", "forEa...
function to get valid paths
[ "function", "to", "get", "valid", "paths" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L62-L74
train
bhoriuchi/vsphere-connect
archive/v1/util.js
newError
function newError(errorCode, errorMessage) { var errObj; if (_.isObject(errorCode)) { errObj = errorCode; } else if (typeof(errorCode) === 'number') { errObj = { errorCode: errorCode, }; if (errorMessage) { errObj.message = errorMessage; } } else { errObj = {errorCode: 50...
javascript
function newError(errorCode, errorMessage) { var errObj; if (_.isObject(errorCode)) { errObj = errorCode; } else if (typeof(errorCode) === 'number') { errObj = { errorCode: errorCode, }; if (errorMessage) { errObj.message = errorMessage; } } else { errObj = {errorCode: 50...
[ "function", "newError", "(", "errorCode", ",", "errorMessage", ")", "{", "var", "errObj", ";", "if", "(", "_", ".", "isObject", "(", "errorCode", ")", ")", "{", "errObj", "=", "errorCode", ";", "}", "else", "if", "(", "typeof", "(", "errorCode", ")", ...
returns a promise that resolves to an error
[ "returns", "a", "promise", "that", "resolves", "to", "an", "error" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L77-L100
train
bhoriuchi/vsphere-connect
archive/v1/util.js
getSessionId
function getSessionId(cookie) { if (typeof(cookie.cookies) === 'string') { var idx = cookie.cookies.indexOf('='); if (idx !== -1) { return _.trim(cookie.cookies.substring(idx + 1), '"') || null; } } return null; }
javascript
function getSessionId(cookie) { if (typeof(cookie.cookies) === 'string') { var idx = cookie.cookies.indexOf('='); if (idx !== -1) { return _.trim(cookie.cookies.substring(idx + 1), '"') || null; } } return null; }
[ "function", "getSessionId", "(", "cookie", ")", "{", "if", "(", "typeof", "(", "cookie", ".", "cookies", ")", "===", "'string'", ")", "{", "var", "idx", "=", "cookie", ".", "cookies", ".", "indexOf", "(", "'='", ")", ";", "if", "(", "idx", "!==", "...
parse the cookie for a session id
[ "parse", "the", "cookie", "for", "a", "session", "id" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L103-L111
train
bhoriuchi/vsphere-connect
archive/v1/util.js
log
function log(obj, message) { obj = obj || []; obj.push({ time: new Date(), log: message }); return obj; }
javascript
function log(obj, message) { obj = obj || []; obj.push({ time: new Date(), log: message }); return obj; }
[ "function", "log", "(", "obj", ",", "message", ")", "{", "obj", "=", "obj", "||", "[", "]", ";", "obj", ".", "push", "(", "{", "time", ":", "new", "Date", "(", ")", ",", "log", ":", "message", "}", ")", ";", "return", "obj", ";", "}" ]
keep a log of something
[ "keep", "a", "log", "of", "something" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L121-L129
train
KirinJS/Kirin
javascript/lib/extensions/Facebook-android.js
function() { if(savedMessageFromLastFail) { // Last time we tried to publish there was a failure preventing it from ending up on the wall. // In such a case, we want to pre-populate the user's message with the same message from last time. // See 20552: ('Write Something..' te...
javascript
function() { if(savedMessageFromLastFail) { // Last time we tried to publish there was a failure preventing it from ending up on the wall. // In such a case, we want to pre-populate the user's message with the same message from last time. // See 20552: ('Write Something..' te...
[ "function", "(", ")", "{", "if", "(", "savedMessageFromLastFail", ")", "{", "// Last time we tried to publish there was a failure preventing it from ending up on the wall.", "// In such a case, we want to pre-populate the user's message with the same message from last time.", "// See 20552: ('...
Function that deals with showing the preview popup and asking the user for their comment and confirmation for publishing. It will then post it with the mesasge once it gets user confirmation.
[ "Function", "that", "deals", "with", "showing", "the", "preview", "popup", "and", "asking", "the", "user", "for", "their", "comment", "and", "confirmation", "for", "publishing", ".", "It", "will", "then", "post", "it", "with", "the", "mesasge", "once", "it",...
d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1
https://github.com/KirinJS/Kirin/blob/d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1/javascript/lib/extensions/Facebook-android.js#L94-L130
train
messyfresh/hirez.js
src/sessions/sessionAPI.js
genSession
function genSession (baseUrl, devId, authHash, platform) { let url = baseUrl + 'createsessionjson/' + devId + '/' + authHash + '/' + util.getUtcTime() return new Promise((resolve, reject) => { request(url, (error, response, body) => { if (!error && response.statusCode === 200) { let sessionID ...
javascript
function genSession (baseUrl, devId, authHash, platform) { let url = baseUrl + 'createsessionjson/' + devId + '/' + authHash + '/' + util.getUtcTime() return new Promise((resolve, reject) => { request(url, (error, response, body) => { if (!error && response.statusCode === 200) { let sessionID ...
[ "function", "genSession", "(", "baseUrl", ",", "devId", ",", "authHash", ",", "platform", ")", "{", "let", "url", "=", "baseUrl", "+", "'createsessionjson/'", "+", "devId", "+", "'/'", "+", "authHash", "+", "'/'", "+", "util", ".", "getUtcTime", "(", ")"...
Generate a new Session
[ "Generate", "a", "new", "Session" ]
c849a887cf6141639896d4f0ee9e49145a12d6e2
https://github.com/messyfresh/hirez.js/blob/c849a887cf6141639896d4f0ee9e49145a12d6e2/src/sessions/sessionAPI.js#L63-L100
train
bhoriuchi/vsphere-connect
archive/v1/client/monitor.js
taskAsync
function taskAsync(args, result) { // format the result result = env.format(result); // if the delete should not be asyncronous and the task should be monitored if (args.async === false) { // set the polling period and timeout defaults args.delay = !isNaN(args.delay) ? args.delay : 1000; args....
javascript
function taskAsync(args, result) { // format the result result = env.format(result); // if the delete should not be asyncronous and the task should be monitored if (args.async === false) { // set the polling period and timeout defaults args.delay = !isNaN(args.delay) ? args.delay : 1000; args....
[ "function", "taskAsync", "(", "args", ",", "result", ")", "{", "// format the result", "result", "=", "env", ".", "format", "(", "result", ")", ";", "// if the delete should not be asyncronous and the task should be monitored", "if", "(", "args", ".", "async", "===", ...
determine if the task should be monitored or to simply return the task id
[ "determine", "if", "the", "task", "should", "be", "monitored", "or", "to", "simply", "return", "the", "task", "id" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/monitor.js#L115-L133
train
bhoriuchi/vsphere-connect
archive/v.js
assignRequest
function assignRequest (target, source, obj = {}, term) { _.merge(target, _.omit(source, ['term']), obj) if (term == true) target.term = source.term }
javascript
function assignRequest (target, source, obj = {}, term) { _.merge(target, _.omit(source, ['term']), obj) if (term == true) target.term = source.term }
[ "function", "assignRequest", "(", "target", ",", "source", ",", "obj", "=", "{", "}", ",", "term", ")", "{", "_", ".", "merge", "(", "target", ",", "_", ".", "omit", "(", "source", ",", "[", "'term'", "]", ")", ",", "obj", ")", "if", "(", "term...
returns a new request context built from the existing @param target @param source @param obj @param term
[ "returns", "a", "new", "request", "context", "built", "from", "the", "existing" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v.js#L16-L19
train
bhoriuchi/vsphere-connect
archive/v.js
processTerm
function processTerm (handler, obj = {}, isDefault) { let req = { term: this._request.term.then(value => { assignRequest(req, this._request, obj) if (this._request.error && !isDefault) return null if (isDefault) req.error = null return handler(value, req) }) } return new v(this._cl...
javascript
function processTerm (handler, obj = {}, isDefault) { let req = { term: this._request.term.then(value => { assignRequest(req, this._request, obj) if (this._request.error && !isDefault) return null if (isDefault) req.error = null return handler(value, req) }) } return new v(this._cl...
[ "function", "processTerm", "(", "handler", ",", "obj", "=", "{", "}", ",", "isDefault", ")", "{", "let", "req", "=", "{", "term", ":", "this", ".", "_request", ".", "term", ".", "then", "(", "value", "=>", "{", "assignRequest", "(", "req", ",", "th...
processes the current term promise and updates the context @param handler @param obj @return {v}
[ "processes", "the", "current", "term", "promise", "and", "updates", "the", "context" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v.js#L27-L37
train
bhoriuchi/vsphere-connect
archive/v.js
processBranch
function processBranch (args, resolve, reject) { let condition = args.shift() let val = args.shift() let las = _.last(args) return Promise.resolve(condition) .then(c => { if (c === true) { return Promise.resolve(_.isFunction(val) ? val() : val) .then(resolve, reject) } else if...
javascript
function processBranch (args, resolve, reject) { let condition = args.shift() let val = args.shift() let las = _.last(args) return Promise.resolve(condition) .then(c => { if (c === true) { return Promise.resolve(_.isFunction(val) ? val() : val) .then(resolve, reject) } else if...
[ "function", "processBranch", "(", "args", ",", "resolve", ",", "reject", ")", "{", "let", "condition", "=", "args", ".", "shift", "(", ")", "let", "val", "=", "args", ".", "shift", "(", ")", "let", "las", "=", "_", ".", "last", "(", "args", ")", ...
recursively processes the branch statements @param args @param resolve @param reject @return {*|Promise.<*>|Promise.<TResult>}
[ "recursively", "processes", "the", "branch", "statements" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v.js#L46-L63
train
bhoriuchi/vsphere-connect
archive/v.js
performRetrieve
function performRetrieve (req) { return this._client.retrieve(req.args, req.options) .then(result => { req.args = {} req.options = {} return result }) }
javascript
function performRetrieve (req) { return this._client.retrieve(req.args, req.options) .then(result => { req.args = {} req.options = {} return result }) }
[ "function", "performRetrieve", "(", "req", ")", "{", "return", "this", ".", "_client", ".", "retrieve", "(", "req", ".", "args", ",", "req", ".", "options", ")", ".", "then", "(", "result", "=>", "{", "req", ".", "args", "=", "{", "}", "req", ".", ...
retrieves records and clears out the request context @param req @return {*|Promise.<*>}
[ "retrieves", "records", "and", "clears", "out", "the", "request", "context" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v.js#L70-L77
train
mmoulton/capture
index.js
function(url, done) { var urlParts = urlUtil.parse(url, true), filename = urlParts.pathname, auth = urlParts.auth; if (S(filename).endsWith("/")) filename += "index"; // Append var filePath = path.resolve( process.cwd(), outPath, ...
javascript
function(url, done) { var urlParts = urlUtil.parse(url, true), filename = urlParts.pathname, auth = urlParts.auth; if (S(filename).endsWith("/")) filename += "index"; // Append var filePath = path.resolve( process.cwd(), outPath, ...
[ "function", "(", "url", ",", "done", ")", "{", "var", "urlParts", "=", "urlUtil", ".", "parse", "(", "url", ",", "true", ")", ",", "filename", "=", "urlParts", ".", "pathname", ",", "auth", "=", "urlParts", ".", "auth", ";", "if", "(", "S", "(", ...
For each url
[ "For", "each", "url" ]
794a0542603c4ff1f908d5d00c1bd3cda5c490ec
https://github.com/mmoulton/capture/blob/794a0542603c4ff1f908d5d00c1bd3cda5c490ec/index.js#L54-L80
train
bhoriuchi/vsphere-connect
archive/v1/client/findByName.js
rootSearch
function rootSearch(args) { // get the datacenters return _client.retrieve({ type: 'Datacenter', properties: ['name', 'datastoreFolder', 'hostFolder', 'networkFolder', 'vmFolder'] }) .then(function(dcs) { // look through each of the dcs and map the return values return Promise.map(dcs, function(...
javascript
function rootSearch(args) { // get the datacenters return _client.retrieve({ type: 'Datacenter', properties: ['name', 'datastoreFolder', 'hostFolder', 'networkFolder', 'vmFolder'] }) .then(function(dcs) { // look through each of the dcs and map the return values return Promise.map(dcs, function(...
[ "function", "rootSearch", "(", "args", ")", "{", "// get the datacenters", "return", "_client", ".", "retrieve", "(", "{", "type", ":", "'Datacenter'", ",", "properties", ":", "[", "'name'", ",", "'datastoreFolder'", ",", "'hostFolder'", ",", "'networkFolder'", ...
search the top level folders in each datacenter
[ "search", "the", "top", "level", "folders", "in", "each", "datacenter" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/findByName.js#L23-L58
train
bhoriuchi/vsphere-connect
archive/v1/client/findByName.js
findByNameEx
function findByNameEx(args, matches) { // create a variable to store the matches matches = matches || []; // set option defaults args.name = Array.isArray(args.name) ? args.name : [args.name]; args.recursive = (typeof(args.recursive) === 'boolean') ? args.recursive : false; args.limit = !isN...
javascript
function findByNameEx(args, matches) { // create a variable to store the matches matches = matches || []; // set option defaults args.name = Array.isArray(args.name) ? args.name : [args.name]; args.recursive = (typeof(args.recursive) === 'boolean') ? args.recursive : false; args.limit = !isN...
[ "function", "findByNameEx", "(", "args", ",", "matches", ")", "{", "// create a variable to store the matches", "matches", "=", "matches", "||", "[", "]", ";", "// set option defaults", "args", ".", "name", "=", "Array", ".", "isArray", "(", "args", ".", "name",...
recursive function to find matches
[ "recursive", "function", "to", "find", "matches" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/findByName.js#L64-L171
train
bhoriuchi/vsphere-connect
archive/v1/client/findByName.js
findByName
function findByName(args) { // validate the types if (!args.type || !_.includes(['Datastore', 'HostSystem', 'Network', 'VirtualMachine'], args.type)) { return new Promise(function(resolve, reject) { reject({ errorCode: 400, message: 'Invalid search type. Valid types are Datastore, HostSystem, Ne...
javascript
function findByName(args) { // validate the types if (!args.type || !_.includes(['Datastore', 'HostSystem', 'Network', 'VirtualMachine'], args.type)) { return new Promise(function(resolve, reject) { reject({ errorCode: 400, message: 'Invalid search type. Valid types are Datastore, HostSystem, Ne...
[ "function", "findByName", "(", "args", ")", "{", "// validate the types", "if", "(", "!", "args", ".", "type", "||", "!", "_", ".", "includes", "(", "[", "'Datastore'", ",", "'HostSystem'", ",", "'Network'", ",", "'VirtualMachine'", "]", ",", "args", ".", ...
finds entities by name @param {Object} args - Arguments hash @param {string} args.type - Type of entity to search for @param {(string|string[])} args.name - Name or names to search for @param {(Object|Object[])} [args.parent] - Parent entity or array of parent enties to search from @param {string} [args.parent.type] - ...
[ "finds", "entities", "by", "name" ]
2203b678847a57e3cb982f1a23277d44444f6de4
https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/findByName.js#L185-L219
train
silas/swagger-framework
lib/resource.js
Resource
function Resource(spec, options) { if (!(this instanceof Resource)) { return new Resource(spec, options); } if (typeof spec !== 'object') { throw new Error('resource spec must be an object'); } debug('create resource %s', spec.path, spec); this.spec = spec; this.list = []; this.options = opti...
javascript
function Resource(spec, options) { if (!(this instanceof Resource)) { return new Resource(spec, options); } if (typeof spec !== 'object') { throw new Error('resource spec must be an object'); } debug('create resource %s', spec.path, spec); this.spec = spec; this.list = []; this.options = opti...
[ "function", "Resource", "(", "spec", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Resource", ")", ")", "{", "return", "new", "Resource", "(", "spec", ",", "options", ")", ";", "}", "if", "(", "typeof", "spec", "!==", "'object...
Initialize a new `Resource`. @param {Object} spec @param {Object} options @api public
[ "Initialize", "a", "new", "Resource", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/resource.js#L29-L46
train
theblacksmith/chai-param
lib/chai-param.js
c
function c(color, text) { if(chaiParam.config.disableColors) return text; return chalk[color](text); }
javascript
function c(color, text) { if(chaiParam.config.disableColors) return text; return chalk[color](text); }
[ "function", "c", "(", "color", ",", "text", ")", "{", "if", "(", "chaiParam", ".", "config", ".", "disableColors", ")", "return", "text", ";", "return", "chalk", "[", "color", "]", "(", "text", ")", ";", "}" ]
chalk wrapper for easy enabling and disabling colors
[ "chalk", "wrapper", "for", "easy", "enabling", "and", "disabling", "colors" ]
6a30ba4402afa988a38e392c56dec3d7864970ff
https://github.com/theblacksmith/chai-param/blob/6a30ba4402afa988a38e392c56dec3d7864970ff/lib/chai-param.js#L18-L23
train
opendxl/opendxl-client-javascript
lib/_cli/cli-util.js
fillEmptyOptionsFromPrompt
function fillEmptyOptionsFromPrompt (options, args, callback, startPosition) { if (typeof startPosition === 'undefined') { startPosition = 0 } if (startPosition < 0) { throw new RangeError('Start position must not be negative') } if (startPosition > args.length) { throw new RangeError('Start posit...
javascript
function fillEmptyOptionsFromPrompt (options, args, callback, startPosition) { if (typeof startPosition === 'undefined') { startPosition = 0 } if (startPosition < 0) { throw new RangeError('Start position must not be negative') } if (startPosition > args.length) { throw new RangeError('Start posit...
[ "function", "fillEmptyOptionsFromPrompt", "(", "options", ",", "args", ",", "callback", ",", "startPosition", ")", "{", "if", "(", "typeof", "startPosition", "===", "'undefined'", ")", "{", "startPosition", "=", "0", "}", "if", "(", "startPosition", "<", "0", ...
For each arg in the args object, check to see if a corresponding non-empty value is set in the options object. For any unset value, prompt the user on the console for a value to set into the options object. Argument input is processed asynchronously, with a call made to the function specified in the callback argument a...
[ "For", "each", "arg", "in", "the", "args", "object", "check", "to", "see", "if", "a", "corresponding", "non", "-", "empty", "value", "is", "set", "in", "the", "options", "object", ".", "For", "any", "unset", "value", "prompt", "the", "user", "on", "the...
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-util.js#L33-L63
train
opendxl/opendxl-client-javascript
lib/_cli/cli-util.js
function (program) { var verbosity = program.verbose if (program.quiet) { verbosity = 0 } else if (typeof verbosity === 'undefined') { verbosity = 1 } return verbosity }
javascript
function (program) { var verbosity = program.verbose if (program.quiet) { verbosity = 0 } else if (typeof verbosity === 'undefined') { verbosity = 1 } return verbosity }
[ "function", "(", "program", ")", "{", "var", "verbosity", "=", "program", ".", "verbose", "if", "(", "program", ".", "quiet", ")", "{", "verbosity", "=", "0", "}", "else", "if", "(", "typeof", "verbosity", "===", "'undefined'", ")", "{", "verbosity", "...
Determines the logging verbosity for the specified Commander program object. @param {Program} program - Commander program / command. @returns {Number} Verbosity level where 0 = silence to N = most verbose.
[ "Determines", "the", "logging", "verbosity", "for", "the", "specified", "Commander", "program", "object", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-util.js#L72-L80
train
opendxl/opendxl-client-javascript
lib/_cli/cli-util.js
function (title, confirm, callback) { var fullTitle = title.indexOf('Confirm') === 0 ? title : 'Enter ' + title fullTitle += ':' read({ prompt: fullTitle, silent: true }, function (error, result) { if (error) { process.stdout.write('\n') callback(provisionUtil.createFor...
javascript
function (title, confirm, callback) { var fullTitle = title.indexOf('Confirm') === 0 ? title : 'Enter ' + title fullTitle += ':' read({ prompt: fullTitle, silent: true }, function (error, result) { if (error) { process.stdout.write('\n') callback(provisionUtil.createFor...
[ "function", "(", "title", ",", "confirm", ",", "callback", ")", "{", "var", "fullTitle", "=", "title", ".", "indexOf", "(", "'Confirm'", ")", "===", "0", "?", "title", ":", "'Enter '", "+", "title", "fullTitle", "+=", "':'", "read", "(", "{", "prompt",...
Reads a value from standard input. The characters entered by the user are not echoed to the console. @param {String} title - Prompt string title to display. @param {Boolean} confirm - Whether or not to prompt the user to enter the value a second time before using it. This could be used for validating the user's selecti...
[ "Reads", "a", "value", "from", "standard", "input", ".", "The", "characters", "entered", "by", "the", "user", "are", "not", "echoed", "to", "the", "console", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-util.js#L91-L127
train
opendxl/opendxl-client-javascript
lib/_cli/cli-util.js
function (hostname, command) { var hostInfo = {hostname: hostname, user: '', password: ''} var hostInfoKeys = ['port', 'user', 'password', 'truststore'] hostInfoKeys.forEach(function (hostInfoKey) { if (command[hostInfoKey]) { hostInfo[hostInfoKey] = command[hostInfoKey] delete command...
javascript
function (hostname, command) { var hostInfo = {hostname: hostname, user: '', password: ''} var hostInfoKeys = ['port', 'user', 'password', 'truststore'] hostInfoKeys.forEach(function (hostInfoKey) { if (command[hostInfoKey]) { hostInfo[hostInfoKey] = command[hostInfoKey] delete command...
[ "function", "(", "hostname", ",", "command", ")", "{", "var", "hostInfo", "=", "{", "hostname", ":", "hostname", ",", "user", ":", "''", ",", "password", ":", "''", "}", "var", "hostInfoKeys", "=", "[", "'port'", ",", "'user'", ",", "'password'", ",", ...
Extract host info from the supplied Commander-based command. Host-info keys are removed from the command. @param {String} hostname - Name of the management service host. @param {Command} command - The Commander command to extract host info from. @returns {ManagementServiceHostInfo} The host info.
[ "Extract", "host", "info", "from", "the", "supplied", "Commander", "-", "based", "command", ".", "Host", "-", "info", "keys", "are", "removed", "from", "the", "command", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_cli/cli-util.js#L171-L181
train
silas/swagger-framework
lib/api.js
Api
function Api(spec, options) { if (!(this instanceof Api)) { return new Api(spec, options); } if (typeof spec !== 'object') { throw new Error('api spec must be an object'); } options = options || {}; // path alias for both resourcePath and doc path if (spec.path) { if (!spec.resourcePath) sp...
javascript
function Api(spec, options) { if (!(this instanceof Api)) { return new Api(spec, options); } if (typeof spec !== 'object') { throw new Error('api spec must be an object'); } options = options || {}; // path alias for both resourcePath and doc path if (spec.path) { if (!spec.resourcePath) sp...
[ "function", "Api", "(", "spec", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Api", ")", ")", "{", "return", "new", "Api", "(", "spec", ",", "options", ")", ";", "}", "if", "(", "typeof", "spec", "!==", "'object'", ")", "{...
Initialize a new `Api`. @param {Object} spec @param {Object} options @api public
[ "Initialize", "a", "new", "Api", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/api.js#L28-L69
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(self, obj) { self.stack = ''; for(var key in obj) { self[key] = obj[key]; } }
javascript
function(self, obj) { self.stack = ''; for(var key in obj) { self[key] = obj[key]; } }
[ "function", "(", "self", ",", "obj", ")", "{", "self", ".", "stack", "=", "''", ";", "for", "(", "var", "key", "in", "obj", ")", "{", "self", "[", "key", "]", "=", "obj", "[", "key", "]", ";", "}", "}" ]
used by Exception
[ "used", "by", "Exception" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2023-L2030
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(s, p, o) { if(p in s) { if(s[p].constructor === Array) { s[p].push(o); } else { s[p] = [s[p], o]; } } else { s[p] = o; } }
javascript
function(s, p, o) { if(p in s) { if(s[p].constructor === Array) { s[p].push(o); } else { s[p] = [s[p], o]; } } else { s[p] = o; } }
[ "function", "(", "s", ",", "p", ",", "o", ")", "{", "if", "(", "p", "in", "s", ")", "{", "if", "(", "s", "[", "p", "]", ".", "constructor", "===", "Array", ")", "{", "s", "[", "p", "]", ".", "push", "(", "o", ")", ";", "}", "else", "{",...
Sets a subject's property to the given object value. If a value already exists, it will be appended to an array. @param s the subject. @param p the property. @param o the object.
[ "Sets", "a", "subject", "s", "property", "to", "the", "given", "object", "value", ".", "If", "a", "value", "already", "exists", "it", "will", "be", "appended", "to", "an", "array", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2150-L2167
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(ctx) { // TODO: reduce calls to this function by caching keywords in processor // state var rval = { '@id': '@id', '@language': '@language', '@literal': '@literal', '@type': '@type' }; if(ctx) { // gather keyword aliases from context var keywords...
javascript
function(ctx) { // TODO: reduce calls to this function by caching keywords in processor // state var rval = { '@id': '@id', '@language': '@language', '@literal': '@literal', '@type': '@type' }; if(ctx) { // gather keyword aliases from context var keywords...
[ "function", "(", "ctx", ")", "{", "// TODO: reduce calls to this function by caching keywords in processor", "// state", "var", "rval", "=", "{", "'@id'", ":", "'@id'", ",", "'@language'", ":", "'@language'", ",", "'@literal'", ":", "'@literal'", ",", "'@type'", ":", ...
Gets the keywords from a context. @param ctx the context. @return the keywords.
[ "Gets", "the", "keywords", "from", "a", "context", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2214-L2247
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(ctx, term) { var rval = null; if(term in ctx) { if(ctx[term].constructor === String) { rval = ctx[term]; } else if(ctx[term].constructor === Object && '@id' in ctx[term]) { rval = ctx[term]['@id']; } } return rval; }
javascript
function(ctx, term) { var rval = null; if(term in ctx) { if(ctx[term].constructor === String) { rval = ctx[term]; } else if(ctx[term].constructor === Object && '@id' in ctx[term]) { rval = ctx[term]['@id']; } } return rval; }
[ "function", "(", "ctx", ",", "term", ")", "{", "var", "rval", "=", "null", ";", "if", "(", "term", "in", "ctx", ")", "{", "if", "(", "ctx", "[", "term", "]", ".", "constructor", "===", "String", ")", "{", "rval", "=", "ctx", "[", "term", "]", ...
Gets the iri associated with a term. @param ctx the context. @param term the term. @return the iri or NULL.
[ "Gets", "the", "iri", "associated", "with", "a", "term", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2257-L2272
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(ctx, iri, usedCtx) { var rval = null; // check the context for a term that could shorten the IRI // (give preference to terms over prefixes) for(var key in ctx) { // skip special context keys (start with '@') if(key.length > 0 && key[0] !== '@') { // compact to a t...
javascript
function(ctx, iri, usedCtx) { var rval = null; // check the context for a term that could shorten the IRI // (give preference to terms over prefixes) for(var key in ctx) { // skip special context keys (start with '@') if(key.length > 0 && key[0] !== '@') { // compact to a t...
[ "function", "(", "ctx", ",", "iri", ",", "usedCtx", ")", "{", "var", "rval", "=", "null", ";", "// check the context for a term that could shorten the IRI", "// (give preference to terms over prefixes)", "for", "(", "var", "key", "in", "ctx", ")", "{", "// skip specia...
Compacts an IRI into a term or prefix if it can be. IRIs will not be compacted to relative IRIs if they match the given context's default vocabulary. @param ctx the context to use. @param iri the IRI to compact. @param usedCtx a context to update if a value was used from "ctx". @return the compacted IRI as a term or ...
[ "Compacts", "an", "IRI", "into", "a", "term", "or", "prefix", "if", "it", "can", "be", ".", "IRIs", "will", "not", "be", "compacted", "to", "relative", "IRIs", "if", "they", "match", "the", "given", "context", "s", "default", "vocabulary", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2285-L2351
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(ctx, term, usedCtx) { var rval = term; // get JSON-LD keywords var keywords = _getKeywords(ctx); // 1. If the property has a colon, it is a prefix or an absolute IRI: var idx = term.indexOf(':'); if(idx !== -1) { // get the potential prefix var prefix = term.substr(0, i...
javascript
function(ctx, term, usedCtx) { var rval = term; // get JSON-LD keywords var keywords = _getKeywords(ctx); // 1. If the property has a colon, it is a prefix or an absolute IRI: var idx = term.indexOf(':'); if(idx !== -1) { // get the potential prefix var prefix = term.substr(0, i...
[ "function", "(", "ctx", ",", "term", ",", "usedCtx", ")", "{", "var", "rval", "=", "term", ";", "// get JSON-LD keywords", "var", "keywords", "=", "_getKeywords", "(", "ctx", ")", ";", "// 1. If the property has a colon, it is a prefix or an absolute IRI:", "var", "...
Expands a term into an absolute IRI. The term may be a regular term, a prefix, a relative IRI, or an absolute IRI. In any case, the associated absolute IRI will be returned. @param ctx the context to use. @param term the term to expand. @param usedCtx a context to update if a value was used from "ctx". @return the ex...
[ "Expands", "a", "term", "into", "an", "absolute", "IRI", ".", "The", "term", "may", "be", "a", "regular", "term", "a", "prefix", "a", "relative", "IRI", "or", "an", "absolute", "IRI", ".", "In", "any", "case", "the", "associated", "absolute", "IRI", "w...
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2364-L2413
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(ctx) { // sort keys var rval = {}; var keys = Object.keys(ctx).sort(); for(var k in keys) { var key = keys[k]; rval[key] = ctx[key]; } return rval; }
javascript
function(ctx) { // sort keys var rval = {}; var keys = Object.keys(ctx).sort(); for(var k in keys) { var key = keys[k]; rval[key] = ctx[key]; } return rval; }
[ "function", "(", "ctx", ")", "{", "// sort keys", "var", "rval", "=", "{", "}", ";", "var", "keys", "=", "Object", ".", "keys", "(", "ctx", ")", ".", "sort", "(", ")", ";", "for", "(", "var", "k", "in", "keys", ")", "{", "var", "key", "=", "k...
Sorts the keys in a context. @param ctx the context to sort. @return the sorted context.
[ "Sorts", "the", "keys", "in", "a", "context", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2422-L2433
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(value) { var rval = false; // Note: A value is a subject if all of these hold true: // 1. It is an Object. // 2. It is not a literal. // 3. It has more than 1 key OR any existing key is not '@id'. if(value !== null && value.constructor === Object && !('@literal' in value)) { var ...
javascript
function(value) { var rval = false; // Note: A value is a subject if all of these hold true: // 1. It is an Object. // 2. It is not a literal. // 3. It has more than 1 key OR any existing key is not '@id'. if(value !== null && value.constructor === Object && !('@literal' in value)) { var ...
[ "function", "(", "value", ")", "{", "var", "rval", "=", "false", ";", "// Note: A value is a subject if all of these hold true:", "// 1. It is an Object.", "// 2. It is not a literal.", "// 3. It has more than 1 key OR any existing key is not '@id'.", "if", "(", "value", "!==", "...
Gets whether or not a value is a subject with properties. @param value the value to check. @return true if the value is a subject with properties, false if not.
[ "Gets", "whether", "or", "not", "a", "value", "is", "a", "subject", "with", "properties", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L2462-L2477
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(v1, v2) { var rval = 0; if(v1.constructor === Array && v2.constructor === Array) { for(var i = 0; i < v1.length && rval === 0; ++i) { rval = _compare(v1[i], v2[i]); } } else { rval = (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); } return rval; }
javascript
function(v1, v2) { var rval = 0; if(v1.constructor === Array && v2.constructor === Array) { for(var i = 0; i < v1.length && rval === 0; ++i) { rval = _compare(v1[i], v2[i]); } } else { rval = (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); } return rval; }
[ "function", "(", "v1", ",", "v2", ")", "{", "var", "rval", "=", "0", ";", "if", "(", "v1", ".", "constructor", "===", "Array", "&&", "v2", ".", "constructor", "===", "Array", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "v1", "....
Compares two values. @param v1 the first value. @param v2 the second value. @return -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2.
[ "Compares", "two", "values", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3370-L3387
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(o1, o2, key) { var rval = 0; if(key in o1) { if(key in o2) { rval = _compare(o1[key], o2[key]); } else { rval = -1; } } else if(key in o2) { rval = 1; } return rval; }
javascript
function(o1, o2, key) { var rval = 0; if(key in o1) { if(key in o2) { rval = _compare(o1[key], o2[key]); } else { rval = -1; } } else if(key in o2) { rval = 1; } return rval; }
[ "function", "(", "o1", ",", "o2", ",", "key", ")", "{", "var", "rval", "=", "0", ";", "if", "(", "key", "in", "o1", ")", "{", "if", "(", "key", "in", "o2", ")", "{", "rval", "=", "_compare", "(", "o1", "[", "key", "]", ",", "o2", "[", "ke...
Compares two keys in an object. If the key exists in one object and not the other, the object with the key is less. If the key exists in both objects, then the one with the lesser value is less. @param o1 the first object. @param o2 the second object. @param key the key. @return -1 if o1 < o2, 0 if o1 == o2, 1 if o1 ...
[ "Compares", "two", "keys", "in", "an", "object", ".", "If", "the", "key", "exists", "in", "one", "object", "and", "not", "the", "other", "the", "object", "with", "the", "key", "is", "less", ".", "If", "the", "key", "exists", "in", "both", "objects", ...
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3400-L3419
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(o1, o2) { var rval = 0; if(o1.constructor === String) { if(o2.constructor !== String) { rval = -1; } else { rval = _compare(o1, o2); } } else if(o2.constructor === String) { rval = 1; } else { rval = _compareObject...
javascript
function(o1, o2) { var rval = 0; if(o1.constructor === String) { if(o2.constructor !== String) { rval = -1; } else { rval = _compare(o1, o2); } } else if(o2.constructor === String) { rval = 1; } else { rval = _compareObject...
[ "function", "(", "o1", ",", "o2", ")", "{", "var", "rval", "=", "0", ";", "if", "(", "o1", ".", "constructor", "===", "String", ")", "{", "if", "(", "o2", ".", "constructor", "!==", "String", ")", "{", "rval", "=", "-", "1", ";", "}", "else", ...
Compares two object values. @param o1 the first object. @param o2 the second object. @return -1 if o1 < o2, 0 if o1 == o2, 1 if o1 > o2.
[ "Compares", "two", "object", "values", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3429-L3470
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(a, b) { var rval = 0; /* 3. For each property, compare sorted object values. 3.1. The bnode with fewer objects is first. 3.2. For each object value, compare only literals and non-bnodes. 3.2.1. The bnode with fewer non-bnodes is first. 3.2.2. The bnode with a string object is first. ...
javascript
function(a, b) { var rval = 0; /* 3. For each property, compare sorted object values. 3.1. The bnode with fewer objects is first. 3.2. For each object value, compare only literals and non-bnodes. 3.2.1. The bnode with fewer non-bnodes is first. 3.2.2. The bnode with a string object is first. ...
[ "function", "(", "a", ",", "b", ")", "{", "var", "rval", "=", "0", ";", "/*\n 3. For each property, compare sorted object values.\n 3.1. The bnode with fewer objects is first.\n 3.2. For each object value, compare only literals and non-bnodes.\n 3.2.1. The bnode with fewer non-bnodes...
Compares the object values between two bnodes. @param a the first bnode. @param b the second bnode. @return -1 if a < b, 0 if a == b, 1 if a > b.
[ "Compares", "the", "object", "values", "between", "two", "bnodes", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3480-L3546
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(prefix) { var count = -1; var ng = { next: function() { ++count; return ng.current(); }, current: function() { return '_:' + prefix + count; }, inNamespace: function(iri) { return iri.indexOf('_:' + prefix) === 0; }...
javascript
function(prefix) { var count = -1; var ng = { next: function() { ++count; return ng.current(); }, current: function() { return '_:' + prefix + count; }, inNamespace: function(iri) { return iri.indexOf('_:' + prefix) === 0; }...
[ "function", "(", "prefix", ")", "{", "var", "count", "=", "-", "1", ";", "var", "ng", "=", "{", "next", ":", "function", "(", ")", "{", "++", "count", ";", "return", "ng", ".", "current", "(", ")", ";", "}", ",", "current", ":", "function", "("...
Creates a blank node name generator using the given prefix for the blank nodes. @param prefix the prefix to use. @return the blank node name generator.
[ "Creates", "a", "blank", "node", "name", "generator", "using", "the", "given", "prefix", "for", "the", "blank", "nodes", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3556-L3575
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(parent, parentProperty, value, subjects) { var flattened = null; if(value === null) { // drop null values } else if(value.constructor === Array) { // list of objects or a disjoint graph for(var i in value) { _flatten(parent, parentProperty, value[i], subje...
javascript
function(parent, parentProperty, value, subjects) { var flattened = null; if(value === null) { // drop null values } else if(value.constructor === Array) { // list of objects or a disjoint graph for(var i in value) { _flatten(parent, parentProperty, value[i], subje...
[ "function", "(", "parent", ",", "parentProperty", ",", "value", ",", "subjects", ")", "{", "var", "flattened", "=", "null", ";", "if", "(", "value", "===", "null", ")", "{", "// drop null values", "}", "else", "if", "(", "value", ".", "constructor", "===...
Flattens the given value into a map of unique subjects. It is assumed that all blank nodes have been uniquely named before this call. Array values for properties will be sorted. @param parent the value's parent, NULL for none. @param parentProperty the property relating the value to the parent. @param value the value ...
[ "Flattens", "the", "given", "value", "into", "a", "map", "of", "unique", "subjects", ".", "It", "is", "assumed", "that", "all", "blank", "nodes", "have", "been", "uniquely", "named", "before", "this", "call", ".", "Array", "values", "for", "properties", "w...
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L3637-L3756
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(b) { var rval = ''; var first = true; for(var p in b) { if(p !== '@id') { if(first) { first = false; } else { rval += '|'; } // property rval += '<' + p + '>'; ...
javascript
function(b) { var rval = ''; var first = true; for(var p in b) { if(p !== '@id') { if(first) { first = false; } else { rval += '|'; } // property rval += '<' + p + '>'; ...
[ "function", "(", "b", ")", "{", "var", "rval", "=", "''", ";", "var", "first", "=", "true", ";", "for", "(", "var", "p", "in", "b", ")", "{", "if", "(", "p", "!==", "'@id'", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";"...
Serializes the properties of the given bnode for its relation serialization. @param b the blank node. @return the serialized properties.
[ "Serializes", "the", "properties", "of", "the", "given", "bnode", "for", "its", "relation", "serialization", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L4088-L4155
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(input, frame) { var rval = false; // check if type(s) are specified in frame and input var type = '@type'; if('@type' in frame && input.constructor === Object && type in input) { var tmp = (input[type].constructor === Array) ? input[type] : [input[type]]; var types...
javascript
function(input, frame) { var rval = false; // check if type(s) are specified in frame and input var type = '@type'; if('@type' in frame && input.constructor === Object && type in input) { var tmp = (input[type].constructor === Array) ? input[type] : [input[type]]; var types...
[ "function", "(", "input", ",", "frame", ")", "{", "var", "rval", "=", "false", ";", "// check if type(s) are specified in frame and input", "var", "type", "=", "'@type'", ";", "if", "(", "'@type'", "in", "frame", "&&", "input", ".", "constructor", "===", "Obje...
Returns true if the given input is a subject and has one of the given types in the given frame. @param input the input. @param frame the frame with types to look for. @return true if the input has one of the given types.
[ "Returns", "true", "if", "the", "given", "input", "is", "a", "subject", "and", "has", "one", "of", "the", "given", "types", "in", "the", "given", "frame", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L4716-L4744
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(input, frame) { var rval = false; // frame must not have a specific type var type = '@type'; if(!(type in frame)) { // get frame properties that must exist on input var props = Object.keys(frame).filter(function(e) { // filter non-keywords return e.indexOf...
javascript
function(input, frame) { var rval = false; // frame must not have a specific type var type = '@type'; if(!(type in frame)) { // get frame properties that must exist on input var props = Object.keys(frame).filter(function(e) { // filter non-keywords return e.indexOf...
[ "function", "(", "input", ",", "frame", ")", "{", "var", "rval", "=", "false", ";", "// frame must not have a specific type", "var", "type", "=", "'@type'", ";", "if", "(", "!", "(", "type", "in", "frame", ")", ")", "{", "// get frame properties that must exis...
Returns true if the given input matches the given frame via duck-typing. @param input the input. @param frame the frame to check against. @return true if the input matches the frame.
[ "Returns", "true", "if", "the", "given", "input", "matches", "the", "given", "frame", "via", "duck", "-", "typing", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L4754-L4789
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function(iri) { var iris = Object.keys(embeds); for(var i in iris) { i = iris[i]; if(i in embeds && embeds[i].parent !== null && embeds[i].parent['@id'] === iri) { delete embeds[i]; ...
javascript
function(iri) { var iris = Object.keys(embeds); for(var i in iris) { i = iris[i]; if(i in embeds && embeds[i].parent !== null && embeds[i].parent['@id'] === iri) { delete embeds[i]; ...
[ "function", "(", "iri", ")", "{", "var", "iris", "=", "Object", ".", "keys", "(", "embeds", ")", ";", "for", "(", "var", "i", "in", "iris", ")", "{", "i", "=", "iris", "[", "i", "]", ";", "if", "(", "i", "in", "embeds", "&&", "embeds", "[", ...
recursively remove any dependent dangling embeds
[ "recursively", "remove", "any", "dependent", "dangling", "embeds" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L4858-L4871
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
function( subjects, input, frame, embeds, autoembed, parent, parentKey, options) { var rval = null; // prepare output, set limit, get array of frames var limit = -1; var frames; if(frame.constructor === Array) { rval = []; frames = frame; if(frames.length === 0) { ...
javascript
function( subjects, input, frame, embeds, autoembed, parent, parentKey, options) { var rval = null; // prepare output, set limit, get array of frames var limit = -1; var frames; if(frame.constructor === Array) { rval = []; frames = frame; if(frames.length === 0) { ...
[ "function", "(", "subjects", ",", "input", ",", "frame", ",", "embeds", ",", "autoembed", ",", "parent", ",", "parentKey", ",", "options", ")", "{", "var", "rval", "=", "null", ";", "// prepare output, set limit, get array of frames", "var", "limit", "=", "-",...
Recursively frames the given input according to the given frame. @param subjects a map of subjects in the graph. @param input the input to frame. @param frame the frame to use. @param embeds a map of previously embedded subjects, used to prevent cycles. @param autoembed true if auto-embed is on, false if not. @param p...
[ "Recursively", "frames", "the", "given", "input", "according", "to", "the", "given", "frame", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L4995-L5083
train
aaaristo/grunt-html-builder
tasks/rdfstore/index.js
RDFMakeTerm
function RDFMakeTerm(formula,val, canonicalize) { if (typeof val != 'object') { if (typeof val == 'string') return new N3Parser.Literal(val); if (typeof val == 'number') return new N3Parser.Literal(val); // @@ differet types if (typeof val == 'boolean') return new N3Parser.Literal...
javascript
function RDFMakeTerm(formula,val, canonicalize) { if (typeof val != 'object') { if (typeof val == 'string') return new N3Parser.Literal(val); if (typeof val == 'number') return new N3Parser.Literal(val); // @@ differet types if (typeof val == 'boolean') return new N3Parser.Literal...
[ "function", "RDFMakeTerm", "(", "formula", ",", "val", ",", "canonicalize", ")", "{", "if", "(", "typeof", "val", "!=", "'object'", ")", "{", "if", "(", "typeof", "val", "==", "'string'", ")", "return", "new", "N3Parser", ".", "Literal", "(", "val", ")...
On input parameters, convert constants to terms
[ "On", "input", "parameters", "convert", "constants", "to", "terms" ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/rdfstore/index.js#L24922-L24939
train
silas/swagger-framework
lib/schema/environment.js
Environment
function Environment(options) { if (!(this instanceof Environment)) { return new Environment(options); } // defaults options = lodash.defaults(options || {}, { setup: true, }); this.env = jjv(); this.env.defaultOptions.checkRequired = true; this.env.defaultOptions.useDefault = true; this.env...
javascript
function Environment(options) { if (!(this instanceof Environment)) { return new Environment(options); } // defaults options = lodash.defaults(options || {}, { setup: true, }); this.env = jjv(); this.env.defaultOptions.checkRequired = true; this.env.defaultOptions.useDefault = true; this.env...
[ "function", "Environment", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Environment", ")", ")", "{", "return", "new", "Environment", "(", "options", ")", ";", "}", "// defaults", "options", "=", "lodash", ".", "defaults", "(", "o...
Initialize a new `Environment`. @param {Object} options @api public
[ "Initialize", "a", "new", "Environment", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/environment.js#L24-L41
train
opendxl/opendxl-client-javascript
lib/_provisioning/update-config.js
updateBrokerCertChain
function updateBrokerCertChain (configDir, certChainFile, certChain, verbosity) { var caBundleFileName = util.getConfigFilePath(configDir, certChainFile) if (verbosity) { console.log('Updating certs in ' + caBundleFileName) } provisionUtil.saveToFile(caBundleFileName, certChain) }
javascript
function updateBrokerCertChain (configDir, certChainFile, certChain, verbosity) { var caBundleFileName = util.getConfigFilePath(configDir, certChainFile) if (verbosity) { console.log('Updating certs in ' + caBundleFileName) } provisionUtil.saveToFile(caBundleFileName, certChain) }
[ "function", "updateBrokerCertChain", "(", "configDir", ",", "certChainFile", ",", "certChain", ",", "verbosity", ")", "{", "var", "caBundleFileName", "=", "util", ".", "getConfigFilePath", "(", "configDir", ",", "certChainFile", ")", "if", "(", "verbosity", ")", ...
Stores a broker certificate chain into a file. @param {String} configDir - Directory in which to store the certificate chain. This is only used if certChainFile is not an absolute path to an existing certificate chain file. @param {String} certChainFile - Name of the file at which to store the broker certificate chain....
[ "Stores", "a", "broker", "certificate", "chain", "into", "a", "file", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/update-config.js#L43-L49
train
opendxl/opendxl-client-javascript
lib/_provisioning/update-config.js
updateBrokerListInConfigFile
function updateBrokerListInConfigFile (configFileName, brokerLines, verbosity) { if (verbosity) { console.log('Updating DXL config file at ' + configFileName) } var inBrokerSection = false var linesAfterBrokerSection = [] var configFileData = util.getConfigFileData(configFileName) // Replace the curre...
javascript
function updateBrokerListInConfigFile (configFileName, brokerLines, verbosity) { if (verbosity) { console.log('Updating DXL config file at ' + configFileName) } var inBrokerSection = false var linesAfterBrokerSection = [] var configFileData = util.getConfigFileData(configFileName) // Replace the curre...
[ "function", "updateBrokerListInConfigFile", "(", "configFileName", ",", "brokerLines", ",", "verbosity", ")", "{", "if", "(", "verbosity", ")", "{", "console", ".", "log", "(", "'Updating DXL config file at '", "+", "configFileName", ")", "}", "var", "inBrokerSectio...
Updates the broker section in a client configuration file with a list of broker data lines. @param {String} configFileName - Name of the configuration file to update. @param {Array<String>} brokerLines - List of broker data strings to insert into the configuration file. @param {Number} verbosity - Level of verbosity at...
[ "Updates", "the", "broker", "section", "in", "a", "client", "configuration", "file", "with", "a", "list", "of", "broker", "data", "lines", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/update-config.js#L94-L158
train
tonistiigi/styler
lib/public/build/main.js
function(models, options) { var i, l, index, model; options || (options = {}); models = _.isArray(models) ? models.slice() : [models]; for (i = 0, l = models.length; i < l; i++) { model = this.getByCid(models[i]) || this.get(models[i]); if (!model) continue; delete this._...
javascript
function(models, options) { var i, l, index, model; options || (options = {}); models = _.isArray(models) ? models.slice() : [models]; for (i = 0, l = models.length; i < l; i++) { model = this.getByCid(models[i]) || this.get(models[i]); if (!model) continue; delete this._...
[ "function", "(", "models", ",", "options", ")", "{", "var", "i", ",", "l", ",", "index", ",", "model", ";", "options", "||", "(", "options", "=", "{", "}", ")", ";", "models", "=", "_", ".", "isArray", "(", "models", ")", "?", "models", ".", "s...
Remove a model, or a list of models from the set. Pass silent to avoid firing the `remove` event for every model removed.
[ "Remove", "a", "model", "or", "a", "list", "of", "models", "from", "the", "set", ".", "Pass", "silent", "to", "avoid", "firing", "the", "remove", "event", "for", "every", "model", "removed", "." ]
f20dd9621f671b77cbb660d35327e007e8a56e2a
https://github.com/tonistiigi/styler/blob/f20dd9621f671b77cbb660d35327e007e8a56e2a/lib/public/build/main.js#L4388-L4407
train
netzkolchose/node-ansiparser
dist/ansiparser.js
add
function add(table, inp, state, action, next) { table[state<<8|inp] = ((action | 0) << 4) | ((next === undefined) ? state : next); }
javascript
function add(table, inp, state, action, next) { table[state<<8|inp] = ((action | 0) << 4) | ((next === undefined) ? state : next); }
[ "function", "add", "(", "table", ",", "inp", ",", "state", ",", "action", ",", "next", ")", "{", "table", "[", "state", "<<", "8", "|", "inp", "]", "=", "(", "(", "action", "|", "0", ")", "<<", "4", ")", "|", "(", "(", "next", "===", "undefin...
Add a transition to the transition table. @param table - table to add transition @param {number} inp - input character code @param {number} state - current state @param {number=} action - action to be taken @param {number=} next - next state
[ "Add", "a", "transition", "to", "the", "transition", "table", "." ]
548ba7d39d0cc937d85ffdd2430424a4bff137df
https://github.com/netzkolchose/node-ansiparser/blob/548ba7d39d0cc937d85ffdd2430424a4bff137df/dist/ansiparser.js#L28-L30
train
netzkolchose/node-ansiparser
dist/ansiparser.js
add_list
function add_list(table, inps, state, action, next) { for (var i=0; i<inps.length; i++) add(table, inps[i], state, action, next); }
javascript
function add_list(table, inps, state, action, next) { for (var i=0; i<inps.length; i++) add(table, inps[i], state, action, next); }
[ "function", "add_list", "(", "table", ",", "inps", ",", "state", ",", "action", ",", "next", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "inps", ".", "length", ";", "i", "++", ")", "add", "(", "table", ",", "inps", "[", "i", "]...
Add multiple transitions to the transition table. @param table - table to add transition @param {Array} inps - array of input character codes @param {number} state - current state @param {number=} action - action to be taken @param {number=} next - next state
[ "Add", "multiple", "transitions", "to", "the", "transition", "table", "." ]
548ba7d39d0cc937d85ffdd2430424a4bff137df
https://github.com/netzkolchose/node-ansiparser/blob/548ba7d39d0cc937d85ffdd2430424a4bff137df/dist/ansiparser.js#L41-L44
train
netzkolchose/node-ansiparser
dist/ansiparser.js
AnsiParser
function AnsiParser(terminal) { this.initial_state = 0; // 'GROUND' is default this.current_state = this.initial_state|0; // clone global transition table this.transitions = new Uint8Array(4095); this.transitions.set(TRANSITION_TABLE); // global non pushable buffers fo...
javascript
function AnsiParser(terminal) { this.initial_state = 0; // 'GROUND' is default this.current_state = this.initial_state|0; // clone global transition table this.transitions = new Uint8Array(4095); this.transitions.set(TRANSITION_TABLE); // global non pushable buffers fo...
[ "function", "AnsiParser", "(", "terminal", ")", "{", "this", ".", "initial_state", "=", "0", ";", "// 'GROUND' is default", "this", ".", "current_state", "=", "this", ".", "initial_state", "|", "0", ";", "// clone global transition table", "this", ".", "transition...
AnsiParser - Parser for ANSI terminal escape sequences. @param {Object=} terminal emulation object @constructor
[ "AnsiParser", "-", "Parser", "for", "ANSI", "terminal", "escape", "sequences", "." ]
548ba7d39d0cc937d85ffdd2430424a4bff137df
https://github.com/netzkolchose/node-ansiparser/blob/548ba7d39d0cc937d85ffdd2430424a4bff137df/dist/ansiparser.js#L217-L237
train
opendxl/opendxl-client-javascript
lib/config.js
getSetting
function getSetting (config, section, setting, required, readFromFile, configPath) { if (typeof (required) === 'undefined') { required = true } if (typeof (configPath) === 'undefined') { configPath = null } if (!config[section]) { if (required) { throw new DxlError('Required sectio...
javascript
function getSetting (config, section, setting, required, readFromFile, configPath) { if (typeof (required) === 'undefined') { required = true } if (typeof (configPath) === 'undefined') { configPath = null } if (!config[section]) { if (required) { throw new DxlError('Required sectio...
[ "function", "getSetting", "(", "config", ",", "section", ",", "setting", ",", "required", ",", "readFromFile", ",", "configPath", ")", "{", "if", "(", "typeof", "(", "required", ")", "===", "'undefined'", ")", "{", "required", "=", "true", "}", "if", "("...
Get the value for a setting from a configuration file. @private @param {Object} config - Object representation of a config file where each key corresponds to a section or setting name and each value corresponds to the contents of the section or the value for a setting, respectively. @param {String} section - Name of th...
[ "Get", "the", "value", "for", "a", "setting", "from", "a", "configuration", "file", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/config.js#L37-L78
train
jeffbski/autoflow
lib/core.js
mergeOptions
function mergeOptions(parsedOptions) { return Object.keys(autoflowOptions).reduce(function (accum, k) { if (!accum[k]) accum[k] = autoflowOptions[k]; return accum; }, parsedOptions); }
javascript
function mergeOptions(parsedOptions) { return Object.keys(autoflowOptions).reduce(function (accum, k) { if (!accum[k]) accum[k] = autoflowOptions[k]; return accum; }, parsedOptions); }
[ "function", "mergeOptions", "(", "parsedOptions", ")", "{", "return", "Object", ".", "keys", "(", "autoflowOptions", ")", ".", "reduce", "(", "function", "(", "accum", ",", "k", ")", "{", "if", "(", "!", "accum", "[", "k", "]", ")", "accum", "[", "k"...
the top emitter merge global autoflow options with parsed options
[ "the", "top", "emitter", "merge", "global", "autoflow", "options", "with", "parsed", "options" ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/lib/core.js#L22-L27
train
silas/swagger-framework
lib/framework/middleware.js
describe
function describe(ctx) { try { return ctx.operation.spec.method + ' ' + ctx.operation.resource.spec.path + ' '; } catch (err) { return ''; } }
javascript
function describe(ctx) { try { return ctx.operation.spec.method + ' ' + ctx.operation.resource.spec.path + ' '; } catch (err) { return ''; } }
[ "function", "describe", "(", "ctx", ")", "{", "try", "{", "return", "ctx", ".", "operation", ".", "spec", ".", "method", "+", "' '", "+", "ctx", ".", "operation", ".", "resource", ".", "spec", ".", "path", "+", "' '", ";", "}", "catch", "(", "err",...
Operation debug prefix.
[ "Operation", "debug", "prefix", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L25-L32
train
silas/swagger-framework
lib/framework/middleware.js
validate
function validate(res, result) { if (!result) return true; var err = new Error('Validation failed'); try { err.errors = result.errors(); } catch (err) { err.errors = [result.validation]; } err.expose = true; err.statusCode = 400; err.toJSON = function() { return { message: this.messag...
javascript
function validate(res, result) { if (!result) return true; var err = new Error('Validation failed'); try { err.errors = result.errors(); } catch (err) { err.errors = [result.validation]; } err.expose = true; err.statusCode = 400; err.toJSON = function() { return { message: this.messag...
[ "function", "validate", "(", "res", ",", "result", ")", "{", "if", "(", "!", "result", ")", "return", "true", ";", "var", "err", "=", "new", "Error", "(", "'Validation failed'", ")", ";", "try", "{", "err", ".", "errors", "=", "result", ".", "errors"...
Render validation errors.
[ "Render", "validation", "errors", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L38-L57
train
silas/swagger-framework
lib/framework/middleware.js
lookup
function lookup(obj, type, name) { while (obj) { if (obj[type] && obj[type].hasOwnProperty(name)) { return obj[type][name]; } obj = obj.parent; } }
javascript
function lookup(obj, type, name) { while (obj) { if (obj[type] && obj[type].hasOwnProperty(name)) { return obj[type][name]; } obj = obj.parent; } }
[ "function", "lookup", "(", "obj", ",", "type", ",", "name", ")", "{", "while", "(", "obj", ")", "{", "if", "(", "obj", "[", "type", "]", "&&", "obj", "[", "type", "]", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "return", "obj", "[", "ty...
Lookup property.
[ "Lookup", "property", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L63-L70
train
silas/swagger-framework
lib/framework/middleware.js
validateOptions
function validateOptions(operation, type, useCoerce) { var options = { useCoerce: useCoerce }; // capitalize type var suffix = type[0].toUpperCase() + type.slice(1); // Get remove option (ex: options.removeHeader) var removeAdditional = lookup(operation, 'options', 'remove' + suffix); if (typeof removeAd...
javascript
function validateOptions(operation, type, useCoerce) { var options = { useCoerce: useCoerce }; // capitalize type var suffix = type[0].toUpperCase() + type.slice(1); // Get remove option (ex: options.removeHeader) var removeAdditional = lookup(operation, 'options', 'remove' + suffix); if (typeof removeAd...
[ "function", "validateOptions", "(", "operation", ",", "type", ",", "useCoerce", ")", "{", "var", "options", "=", "{", "useCoerce", ":", "useCoerce", "}", ";", "// capitalize type", "var", "suffix", "=", "type", "[", "0", "]", ".", "toUpperCase", "(", ")", ...
Setup validation options.
[ "Setup", "validation", "options", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L76-L91
train
silas/swagger-framework
lib/framework/middleware.js
before
function before(ctx) { var fn = lookup(ctx.operation, 'middleware', 'before'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'before middleware disabled (not defined)'); } }
javascript
function before(ctx) { var fn = lookup(ctx.operation, 'middleware', 'before'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'before middleware disabled (not defined)'); } }
[ "function", "before", "(", "ctx", ")", "{", "var", "fn", "=", "lookup", "(", "ctx", ".", "operation", ",", "'middleware'", ",", "'before'", ")", ";", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "if", "(", "fn", ")", "{", "return", "fn",...
Before middleware.
[ "Before", "middleware", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L97-L106
train
silas/swagger-framework
lib/framework/middleware.js
header
function header(ctx) { var prefix = describe(ctx); var schema = transform.parameters(ctx.operation.spec, 'header'); if (!schema) { debug(prefix + 'header middleware disabled (no schema)'); return; } var env = ctx.operation.resource.api.env; var options = validateOptions(ctx.operation, 'header', tr...
javascript
function header(ctx) { var prefix = describe(ctx); var schema = transform.parameters(ctx.operation.spec, 'header'); if (!schema) { debug(prefix + 'header middleware disabled (no schema)'); return; } var env = ctx.operation.resource.api.env; var options = validateOptions(ctx.operation, 'header', tr...
[ "function", "header", "(", "ctx", ")", "{", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "var", "schema", "=", "transform", ".", "parameters", "(", "ctx", ".", "operation", ".", "spec", ",", "'header'", ")", ";", "if", "(", "!", "schema", ...
Validate headers based on Swagger spec.
[ "Validate", "headers", "based", "on", "Swagger", "spec", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L112-L152
train
silas/swagger-framework
lib/framework/middleware.js
produces
function produces(ctx) { var mimes = ctx.operation.spec.produces || ctx.operation.resource.api.spec.produces || []; var prefix = describe(ctx); if (!mimes.length) { debug(prefix + 'produces validation disabled (no produces)'); } return function(req, res, next) { req.sf.accept = accepts(req); ...
javascript
function produces(ctx) { var mimes = ctx.operation.spec.produces || ctx.operation.resource.api.spec.produces || []; var prefix = describe(ctx); if (!mimes.length) { debug(prefix + 'produces validation disabled (no produces)'); } return function(req, res, next) { req.sf.accept = accepts(req); ...
[ "function", "produces", "(", "ctx", ")", "{", "var", "mimes", "=", "ctx", ".", "operation", ".", "spec", ".", "produces", "||", "ctx", ".", "operation", ".", "resource", ".", "api", ".", "spec", ".", "produces", "||", "[", "]", ";", "var", "prefix", ...
Check produces.
[ "Check", "produces", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L158-L202
train
silas/swagger-framework
lib/framework/middleware.js
query
function query(ctx) { var prefix = describe(ctx); var schema = transform.parameters(ctx.operation.spec, 'query'); if (!schema) { debug(prefix + 'query middleware disabled (no schema)'); return; } var env = ctx.operation.resource.api.env; var options = validateOptions(ctx.operation, 'query', true);...
javascript
function query(ctx) { var prefix = describe(ctx); var schema = transform.parameters(ctx.operation.spec, 'query'); if (!schema) { debug(prefix + 'query middleware disabled (no schema)'); return; } var env = ctx.operation.resource.api.env; var options = validateOptions(ctx.operation, 'query', true);...
[ "function", "query", "(", "ctx", ")", "{", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "var", "schema", "=", "transform", ".", "parameters", "(", "ctx", ".", "operation", ".", "spec", ",", "'query'", ")", ";", "if", "(", "!", "schema", ...
Validate query based on Swagger spec.
[ "Validate", "query", "based", "on", "Swagger", "spec", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L240-L266
train
silas/swagger-framework
lib/framework/middleware.js
authenticate
function authenticate(ctx) { var fn = lookup(ctx.operation, 'middleware', 'authenticate'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'authenticate middleware disabled (not defined)'); } }
javascript
function authenticate(ctx) { var fn = lookup(ctx.operation, 'middleware', 'authenticate'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'authenticate middleware disabled (not defined)'); } }
[ "function", "authenticate", "(", "ctx", ")", "{", "var", "fn", "=", "lookup", "(", "ctx", ".", "operation", ",", "'middleware'", ",", "'authenticate'", ")", ";", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "if", "(", "fn", ")", "{", "retu...
Authenticate request.
[ "Authenticate", "request", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L272-L281
train
silas/swagger-framework
lib/framework/middleware.js
consumes
function consumes(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var mimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var prefix = describe(ctx); if (!mimes.length) { debug(prefix + 'consumes middleware disabled (no consumes)'); re...
javascript
function consumes(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var mimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var prefix = describe(ctx); if (!mimes.length) { debug(prefix + 'consumes middleware disabled (no consumes)'); re...
[ "function", "consumes", "(", "ctx", ")", "{", "if", "(", "[", "'HEAD'", ",", "'GET'", "]", ".", "indexOf", "(", "ctx", ".", "operation", ".", "spec", ".", "method", ")", ">=", "0", ")", "return", ";", "var", "mimes", "=", "ctx", ".", "operation", ...
Check consumes.
[ "Check", "consumes", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L287-L315
train
silas/swagger-framework
lib/framework/middleware.js
raw
function raw(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var limit = lookup(ctx.operation, 'options', 'bodyLimit') || '100kb'; return function(req, res, next) { rawBody(req, { length: req.headers['content-length'], limit: limit, encoding: http.CHARSET },...
javascript
function raw(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var limit = lookup(ctx.operation, 'options', 'bodyLimit') || '100kb'; return function(req, res, next) { rawBody(req, { length: req.headers['content-length'], limit: limit, encoding: http.CHARSET },...
[ "function", "raw", "(", "ctx", ")", "{", "if", "(", "[", "'HEAD'", ",", "'GET'", "]", ".", "indexOf", "(", "ctx", ".", "operation", ".", "spec", ".", "method", ")", ">=", "0", ")", "return", ";", "var", "limit", "=", "lookup", "(", "ctx", ".", ...
Parse raw body.
[ "Parse", "raw", "body", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L321-L347
train
silas/swagger-framework
lib/framework/middleware.js
form
function form(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var mimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var mime = 'application/x-www-form-urlencoded'; var prefix = describe(ctx); var decode = ctx.router.decoder[mime]; if (mi...
javascript
function form(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var mimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var mime = 'application/x-www-form-urlencoded'; var prefix = describe(ctx); var decode = ctx.router.decoder[mime]; if (mi...
[ "function", "form", "(", "ctx", ")", "{", "if", "(", "[", "'HEAD'", ",", "'GET'", "]", ".", "indexOf", "(", "ctx", ".", "operation", ".", "spec", ".", "method", ")", ">=", "0", ")", "return", ";", "var", "mimes", "=", "ctx", ".", "operation", "."...
Validate form based on Swagger spec.
[ "Validate", "form", "based", "on", "Swagger", "spec", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L353-L401
train
silas/swagger-framework
lib/framework/middleware.js
body
function body(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var consumeMimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var mimes = lodash.intersection(consumeMimes, Object.keys(ctx.router.decoder)); var prefix = describe(ctx); if (...
javascript
function body(ctx) { if (['HEAD', 'GET'].indexOf(ctx.operation.spec.method) >= 0) return; var consumeMimes = ctx.operation.spec.consumes || ctx.operation.resource.api.spec.consumes || []; var mimes = lodash.intersection(consumeMimes, Object.keys(ctx.router.decoder)); var prefix = describe(ctx); if (...
[ "function", "body", "(", "ctx", ")", "{", "if", "(", "[", "'HEAD'", ",", "'GET'", "]", ".", "indexOf", "(", "ctx", ".", "operation", ".", "spec", ".", "method", ")", ">=", "0", ")", "return", ";", "var", "consumeMimes", "=", "ctx", ".", "operation"...
Validate body based on Swagger spec.
[ "Validate", "body", "based", "on", "Swagger", "spec", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L407-L475
train
silas/swagger-framework
lib/framework/middleware.js
authorize
function authorize(ctx) { var fn = lookup(ctx.operation, 'middleware', 'authorize'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'authorize middleware disabled (not defined)'); } }
javascript
function authorize(ctx) { var fn = lookup(ctx.operation, 'middleware', 'authorize'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'authorize middleware disabled (not defined)'); } }
[ "function", "authorize", "(", "ctx", ")", "{", "var", "fn", "=", "lookup", "(", "ctx", ".", "operation", ",", "'middleware'", ",", "'authorize'", ")", ";", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "if", "(", "fn", ")", "{", "return", ...
Authorize request.
[ "Authorize", "request", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L481-L490
train
silas/swagger-framework
lib/framework/middleware.js
after
function after(ctx) { var fn = lookup(ctx.operation, 'middleware', 'after'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'after middleware disabled (not defined)'); } }
javascript
function after(ctx) { var fn = lookup(ctx.operation, 'middleware', 'after'); var prefix = describe(ctx); if (fn) { return fn(ctx); } else { debug(prefix + 'after middleware disabled (not defined)'); } }
[ "function", "after", "(", "ctx", ")", "{", "var", "fn", "=", "lookup", "(", "ctx", ".", "operation", ",", "'middleware'", ",", "'after'", ")", ";", "var", "prefix", "=", "describe", "(", "ctx", ")", ";", "if", "(", "fn", ")", "{", "return", "fn", ...
After middleware.
[ "After", "middleware", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/framework/middleware.js#L496-L505
train
imsobear/node-qrcode
index.js
getScript
function getScript(cfg) { var script = function(cfg) { $('#J_Qrcode').qrcode({ 'render': 'canvas', 'size': cfg.size || 150, 'color': '#3a3', 'text': cfg.text }); var canvas = $('#J_Qrcode canvas')[0]; // here is the most important part because if you dont replace you will get...
javascript
function getScript(cfg) { var script = function(cfg) { $('#J_Qrcode').qrcode({ 'render': 'canvas', 'size': cfg.size || 150, 'color': '#3a3', 'text': cfg.text }); var canvas = $('#J_Qrcode canvas')[0]; // here is the most important part because if you dont replace you will get...
[ "function", "getScript", "(", "cfg", ")", "{", "var", "script", "=", "function", "(", "cfg", ")", "{", "$", "(", "'#J_Qrcode'", ")", ".", "qrcode", "(", "{", "'render'", ":", "'canvas'", ",", "'size'", ":", "cfg", ".", "size", "||", "150", ",", "'c...
get the script to generate canvas in the browser
[ "get", "the", "script", "to", "generate", "canvas", "in", "the", "browser" ]
4544c3856a7f9a8e01292619964f75c5b7217598
https://github.com/imsobear/node-qrcode/blob/4544c3856a7f9a8e01292619964f75c5b7217598/index.js#L84-L102
train
layerhq/node-layer-webhooks-services
examples/server.js
startInlineServices
function startInlineServices() { // Provide a webhook definition var hook = { name: 'Inline Sample', events: ['message.sent'], path: '/inline_sample_message_sent', }; // Register this webhook with Layer's Services webhooksServices.register({ secret: SECRET, url: HOST + ':' + PORT, hoo...
javascript
function startInlineServices() { // Provide a webhook definition var hook = { name: 'Inline Sample', events: ['message.sent'], path: '/inline_sample_message_sent', }; // Register this webhook with Layer's Services webhooksServices.register({ secret: SECRET, url: HOST + ':' + PORT, hoo...
[ "function", "startInlineServices", "(", ")", "{", "// Provide a webhook definition", "var", "hook", "=", "{", "name", ":", "'Inline Sample'", ",", "events", ":", "[", "'message.sent'", "]", ",", "path", ":", "'/inline_sample_message_sent'", ",", "}", ";", "// Regi...
Example shows quick and simple setup of a webhooks service. This example shows a single inline service that logs new messages.
[ "Example", "shows", "quick", "and", "simple", "setup", "of", "a", "webhooks", "service", ".", "This", "example", "shows", "a", "single", "inline", "service", "that", "logs", "new", "messages", "." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/examples/server.js#L50-L77
train
aaaristo/grunt-html-builder
tasks/jsonld/js/request.js
_typedParse
function _typedParse(loc, type, data, callback) { switch(type.toLowerCase()) { case 'text': case 'plain': case 'text/plain': callback(null, data); break; case 'json': case 'jsonld': case 'json-ld': case 'ld+json': case 'application/json': case 'application/ld+json': ...
javascript
function _typedParse(loc, type, data, callback) { switch(type.toLowerCase()) { case 'text': case 'plain': case 'text/plain': callback(null, data); break; case 'json': case 'jsonld': case 'json-ld': case 'ld+json': case 'application/json': case 'application/ld+json': ...
[ "function", "_typedParse", "(", "loc", ",", "type", ",", "data", ",", "callback", ")", "{", "switch", "(", "type", ".", "toLowerCase", "(", ")", ")", "{", "case", "'text'", ":", "case", "'plain'", ":", "case", "'text/plain'", ":", "callback", "(", "nul...
Parse data with given type. @param loc location string came from @param type content type of the string @param data the data string or buffer @param callback function(err, data) called with errors and result data
[ "Parse", "data", "with", "given", "type", "." ]
9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1
https://github.com/aaaristo/grunt-html-builder/blob/9ab9ffb5c3d3395b7b097d906ea20c1e4fd09da1/tasks/jsonld/js/request.js#L55-L147
train
opendxl/opendxl-client-javascript
lib/_provisioning/provision-config.js
requestProvisionConfig
function requestProvisionConfig (managementService, csr, verbosity, callback) { managementService.request('Requesting client certificate', PROVISION_COMMAND, {csrString: csr}, verbosity, callback) }
javascript
function requestProvisionConfig (managementService, csr, verbosity, callback) { managementService.request('Requesting client certificate', PROVISION_COMMAND, {csrString: csr}, verbosity, callback) }
[ "function", "requestProvisionConfig", "(", "managementService", ",", "csr", ",", "verbosity", ",", "callback", ")", "{", "managementService", ".", "request", "(", "'Requesting client certificate'", ",", "PROVISION_COMMAND", ",", "{", "csrString", ":", "csr", "}", ",...
Gets the provision configuration from the management service. @param {ManagementService} managementService - The management service instance. @param {String} csr - The CSR string to send to the management service for signing. @param {Number} verbosity - Level of verbosity at which to log any error or trace messages. @p...
[ "Gets", "the", "provision", "configuration", "from", "the", "management", "service", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-config.js#L31-L34
train
opendxl/opendxl-client-javascript
lib/_provisioning/provision-config.js
brokersForConfig
function brokersForConfig (brokerLines) { return brokerLines.reduce(function (acc, brokerLine) { var brokerElements = brokerLine.split('=') if (brokerElements.length !== 2) { throw new DxlError('Invalid key value pair for broker entry: ' + brokerLine) } acc[brokerElements[0]] = brokerEle...
javascript
function brokersForConfig (brokerLines) { return brokerLines.reduce(function (acc, brokerLine) { var brokerElements = brokerLine.split('=') if (brokerElements.length !== 2) { throw new DxlError('Invalid key value pair for broker entry: ' + brokerLine) } acc[brokerElements[0]] = brokerEle...
[ "function", "brokersForConfig", "(", "brokerLines", ")", "{", "return", "brokerLines", ".", "reduce", "(", "function", "(", "acc", ",", "brokerLine", ")", "{", "var", "brokerElements", "=", "brokerLine", ".", "split", "(", "'='", ")", "if", "(", "brokerEleme...
Converts the broker lines received from the management service into an object which can be used for rewriting the full configuration ini file. @param {Array<String>} brokerLines - List of broker lines. @example For a value of "id1=id1;host1;8883;127.0.0.1\nid2=id2;host2;8883;127.0.0.2", this function would return an ob...
[ "Converts", "the", "broker", "lines", "received", "from", "the", "management", "service", "into", "an", "object", "which", "can", "be", "used", "for", "rewriting", "the", "full", "configuration", "ini", "file", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-config.js#L47-L57
train
opendxl/opendxl-client-javascript
lib/_provisioning/provision-config.js
storeProvisionConfig
function storeProvisionConfig (config, configDir, filePrefix, privateKeyFileName, verbosity) { if (typeof config !== 'string') { throw new DxlError('Unexpected data type for response: ' + typeof config) } var configElements = config.split(',') if (configElements.length <...
javascript
function storeProvisionConfig (config, configDir, filePrefix, privateKeyFileName, verbosity) { if (typeof config !== 'string') { throw new DxlError('Unexpected data type for response: ' + typeof config) } var configElements = config.split(',') if (configElements.length <...
[ "function", "storeProvisionConfig", "(", "config", ",", "configDir", ",", "filePrefix", ",", "privateKeyFileName", ",", "verbosity", ")", "{", "if", "(", "typeof", "config", "!==", "'string'", ")", "{", "throw", "new", "DxlError", "(", "'Unexpected data type for r...
Store the configuration data received from the management service to the local file system. @param {String} config - Configuration data received from the management service. @param {String} configDir - Directory in which to store the configuration data. @param {String} filePrefix - Prefix of the certificate file to sto...
[ "Store", "the", "configuration", "data", "received", "from", "the", "management", "service", "to", "the", "local", "file", "system", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/provision-config.js#L73-L123
train
opendxl/opendxl-client-javascript
lib/_provisioning/management-service.js
ManagementService
function ManagementService (hostInfo) { if (!hostInfo.hostname) { throw new TypeError('Hostname is required for management service requests') } if (!hostInfo.user) { throw new TypeError('User name is required for management service requests') } if (!hostInfo.password) { throw new TypeError('Passwo...
javascript
function ManagementService (hostInfo) { if (!hostInfo.hostname) { throw new TypeError('Hostname is required for management service requests') } if (!hostInfo.user) { throw new TypeError('User name is required for management service requests') } if (!hostInfo.password) { throw new TypeError('Passwo...
[ "function", "ManagementService", "(", "hostInfo", ")", "{", "if", "(", "!", "hostInfo", ".", "hostname", ")", "{", "throw", "new", "TypeError", "(", "'Hostname is required for management service requests'", ")", "}", "if", "(", "!", "hostInfo", ".", "user", ")",...
Host info for the management service @typedef {Object} ManagementServiceHostInfo @property {String} hostname - Name of the host where the management service resides. @property {String} user - Username to run remote commands as. @property {String} password - Password for the management service user. @property {String} [...
[ "Host", "info", "for", "the", "management", "service" ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/management-service.js#L34-L48
train
opendxl/opendxl-client-javascript
lib/_provisioning/management-service.js
httpGet
function httpGet (description, currentRedirects, requestOptions, verbosity, responseCallback) { var requestUrl = toUrlString(requestOptions) var responseBody = '' if (verbosity > 1) { console.log('HTTP request to: ' + requestUrl) } var request = https.get(requestOptions, function (resp...
javascript
function httpGet (description, currentRedirects, requestOptions, verbosity, responseCallback) { var requestUrl = toUrlString(requestOptions) var responseBody = '' if (verbosity > 1) { console.log('HTTP request to: ' + requestUrl) } var request = https.get(requestOptions, function (resp...
[ "function", "httpGet", "(", "description", ",", "currentRedirects", ",", "requestOptions", ",", "verbosity", ",", "responseCallback", ")", "{", "var", "requestUrl", "=", "toUrlString", "(", "requestOptions", ")", "var", "responseBody", "=", "''", "if", "(", "ver...
Performs an HTTP get to the management service. The response received from the service is supplied as an argument to the responseCallback function. @param {String} description - Textual description of the HTTP request (used in log and error messages). @param {Number} currentRedirects - Number of HTTP redirects which ha...
[ "Performs", "an", "HTTP", "get", "to", "the", "management", "service", ".", "The", "response", "received", "from", "the", "service", "is", "supplied", "as", "an", "argument", "to", "the", "responseCallback", "function", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/management-service.js#L105-L180
train
assemble/assemble-core
index.js
Assemble
function Assemble(options) { if (!(this instanceof Assemble)) { return new Assemble(options); } Templates.call(this, options); this.is('assemble'); this.initCore(); }
javascript
function Assemble(options) { if (!(this instanceof Assemble)) { return new Assemble(options); } Templates.call(this, options); this.is('assemble'); this.initCore(); }
[ "function", "Assemble", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Assemble", ")", ")", "{", "return", "new", "Assemble", "(", "options", ")", ";", "}", "Templates", ".", "call", "(", "this", ",", "options", ")", ";", "this...
Create an `assemble` application. This is the main function exported by the assemble module. ```js var assemble = require('assemble'); var app = assemble(); ``` @param {Object} `options` Optionally pass default options to use. @api public
[ "Create", "an", "assemble", "application", ".", "This", "is", "the", "main", "function", "exported", "by", "the", "assemble", "module", "." ]
ed8c3b5a7885ebcb911eb69a3cc8e98f4e27ab01
https://github.com/assemble/assemble-core/blob/ed8c3b5a7885ebcb911eb69a3cc8e98f4e27ab01/index.js#L22-L29
train
cast-org/figuration
js/tooltip.js
function(e) { this._tabReset(); if (e.which == 9) { this.flags.keyTab = true; if (e.shiftKey) { this.flags.keyShift = true; } } }
javascript
function(e) { this._tabReset(); if (e.which == 9) { this.flags.keyTab = true; if (e.shiftKey) { this.flags.keyShift = true; } } }
[ "function", "(", "e", ")", "{", "this", ".", "_tabReset", "(", ")", ";", "if", "(", "e", ".", "which", "==", "9", ")", "{", "this", ".", "flags", ".", "keyTab", "=", "true", ";", "if", "(", "e", ".", "shiftKey", ")", "{", "this", ".", "flags"...
Set flags for `tab` key interactions
[ "Set", "flags", "for", "tab", "key", "interactions" ]
c82f491ebccb477f7e1c945bfff61c2340afe1ac
https://github.com/cast-org/figuration/blob/c82f491ebccb477f7e1c945bfff61c2340afe1ac/js/tooltip.js#L930-L936
train
cast-org/figuration
js/tooltip.js
function(current, $scope) { var $selfRef = this; var selectables = $selfRef._tabItems($scope); var nextIndex = 0; if ($(current).length === 1){ var currentIndex = selectables.index(current); if (currentIndex + 1 < selectables.length) { ...
javascript
function(current, $scope) { var $selfRef = this; var selectables = $selfRef._tabItems($scope); var nextIndex = 0; if ($(current).length === 1){ var currentIndex = selectables.index(current); if (currentIndex + 1 < selectables.length) { ...
[ "function", "(", "current", ",", "$scope", ")", "{", "var", "$selfRef", "=", "this", ";", "var", "selectables", "=", "$selfRef", ".", "_tabItems", "(", "$scope", ")", ";", "var", "nextIndex", "=", "0", ";", "if", "(", "$", "(", "current", ")", ".", ...
Find the next tabbabale item after given element
[ "Find", "the", "next", "tabbabale", "item", "after", "given", "element" ]
c82f491ebccb477f7e1c945bfff61c2340afe1ac
https://github.com/cast-org/figuration/blob/c82f491ebccb477f7e1c945bfff61c2340afe1ac/js/tooltip.js#L976-L988
train
silas/swagger-framework
lib/operation.js
Operation
function Operation(spec, options, fn) { if (typeof options === 'function') { fn = [].slice.call(arguments).slice(1); options = {}; } else if (Array.isArray(options)) { fn = options; options = {}; } else if (!Array.isArray(fn)) { fn = [].slice.call(arguments).slice(2); } if (!(this instanc...
javascript
function Operation(spec, options, fn) { if (typeof options === 'function') { fn = [].slice.call(arguments).slice(1); options = {}; } else if (Array.isArray(options)) { fn = options; options = {}; } else if (!Array.isArray(fn)) { fn = [].slice.call(arguments).slice(2); } if (!(this instanc...
[ "function", "Operation", "(", "spec", ",", "options", ",", "fn", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "fn", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ".", "slice", "(", "1", ")", ";", "op...
Initialize a new `Operation`. @param {Object} spec @param {Object} options @param {Function} fn @api public
[ "Initialize", "a", "new", "Operation", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/operation.js#L27-L52
train
victorporof/MAX7219.js
MAX7219.js
function(n, symbol, dp, callback) { if (n < 0 || n > 7) { throw "Invalid digit number"; } if (!(symbol in MAX7219._Font)) { throw "Invalid symbol string"; } var byte = MAX7219._Font[symbol] | (dp ? (1 << 7) : 0); this._shiftOut(MAX7219._Registers["Digit" + n], byte, callback); }
javascript
function(n, symbol, dp, callback) { if (n < 0 || n > 7) { throw "Invalid digit number"; } if (!(symbol in MAX7219._Font)) { throw "Invalid symbol string"; } var byte = MAX7219._Font[symbol] | (dp ? (1 << 7) : 0); this._shiftOut(MAX7219._Registers["Digit" + n], byte, callback); }
[ "function", "(", "n", ",", "symbol", ",", "dp", ",", "callback", ")", "{", "if", "(", "n", "<", "0", "||", "n", ">", "7", ")", "{", "throw", "\"Invalid digit number\"", ";", "}", "if", "(", "!", "(", "symbol", "in", "MAX7219", ".", "_Font", ")", ...
Sets the symbol displayed in a digit. For this to work properly, the digit should be in decode mode. @param number n The digit number, from 0 up to and including 7. @param string symbol The symbol do display: "0".."9", "E", "H", "L", "P", "-" or " ". @param boolean dp Specifies if the decimal point should be on or off...
[ "Sets", "the", "symbol", "displayed", "in", "a", "digit", ".", "For", "this", "to", "work", "properly", "the", "digit", "should", "be", "in", "decode", "mode", "." ]
dec565caa8d33f1fdd1a36b309a74cd06f1e6837
https://github.com/victorporof/MAX7219.js/blob/dec565caa8d33f1fdd1a36b309a74cd06f1e6837/MAX7219.js#L271-L280
train
victorporof/MAX7219.js
MAX7219.js
function(callback) { if (!this._decodeModes) { this.setDecodeNone(); } for (var i = 0; i < this._decodeModes.length; i++) { var mode = this._decodeModes[i]; if (mode == 0) { this.setDigitSegmentsByte(i, 0x00, callback); } else { this.setDigitSymbol(i, " ", false, cal...
javascript
function(callback) { if (!this._decodeModes) { this.setDecodeNone(); } for (var i = 0; i < this._decodeModes.length; i++) { var mode = this._decodeModes[i]; if (mode == 0) { this.setDigitSegmentsByte(i, 0x00, callback); } else { this.setDigitSymbol(i, " ", false, cal...
[ "function", "(", "callback", ")", "{", "if", "(", "!", "this", ".", "_decodeModes", ")", "{", "this", ".", "setDecodeNone", "(", ")", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_decodeModes", ".", "length", ";", "i",...
Sets all segments for all digits off. Shortcut for manually calling setDigitSegments or setDigitSymbol with the appropriate params. If a decode mode wasn't specifically set beforehand, no-decode mode is assumed. @param function callback [optional] Invoked once the write to the SPI device finishes.
[ "Sets", "all", "segments", "for", "all", "digits", "off", "." ]
dec565caa8d33f1fdd1a36b309a74cd06f1e6837
https://github.com/victorporof/MAX7219.js/blob/dec565caa8d33f1fdd1a36b309a74cd06f1e6837/MAX7219.js#L292-L305
train
victorporof/MAX7219.js
MAX7219.js
function(brightness, callback) { if (brightness < 0 || brightness > 15) { throw "Invalid brightness number"; } this._shiftOut(MAX7219._Registers.Intensity, brightness, callback); }
javascript
function(brightness, callback) { if (brightness < 0 || brightness > 15) { throw "Invalid brightness number"; } this._shiftOut(MAX7219._Registers.Intensity, brightness, callback); }
[ "function", "(", "brightness", ",", "callback", ")", "{", "if", "(", "brightness", "<", "0", "||", "brightness", ">", "15", ")", "{", "throw", "\"Invalid brightness number\"", ";", "}", "this", ".", "_shiftOut", "(", "MAX7219", ".", "_Registers", ".", "Int...
Sets digital control of display brightness. @param number brightness The brightness from 0 (dimmest) up to and including 15 (brightest). @param function callback [optional] Invoked once the write to the SPI device finishes.
[ "Sets", "digital", "control", "of", "display", "brightness", "." ]
dec565caa8d33f1fdd1a36b309a74cd06f1e6837
https://github.com/victorporof/MAX7219.js/blob/dec565caa8d33f1fdd1a36b309a74cd06f1e6837/MAX7219.js#L316-L321
train
victorporof/MAX7219.js
MAX7219.js
function(limit, callback) { if (limit < 1 || limit > 8) { throw "Invalid scan limit number"; } this._shiftOut(MAX7219._Registers.ScanLimit, limit - 1, callback); }
javascript
function(limit, callback) { if (limit < 1 || limit > 8) { throw "Invalid scan limit number"; } this._shiftOut(MAX7219._Registers.ScanLimit, limit - 1, callback); }
[ "function", "(", "limit", ",", "callback", ")", "{", "if", "(", "limit", "<", "1", "||", "limit", ">", "8", ")", "{", "throw", "\"Invalid scan limit number\"", ";", "}", "this", ".", "_shiftOut", "(", "MAX7219", ".", "_Registers", ".", "ScanLimit", ",", ...
Sets how many digits are displayed, from 1 digit to 8 digits. @param number limit The number of digits displayed, counting from first to last. E.g., to display only the first digit, limit would be 1. E.g., to display only digits 0, 1 and 2, limit would be 3. @param function callback [optional] Invoked once the write ...
[ "Sets", "how", "many", "digits", "are", "displayed", "from", "1", "digit", "to", "8", "digits", "." ]
dec565caa8d33f1fdd1a36b309a74cd06f1e6837
https://github.com/victorporof/MAX7219.js/blob/dec565caa8d33f1fdd1a36b309a74cd06f1e6837/MAX7219.js#L334-L339
train
victorporof/MAX7219.js
MAX7219.js
function(firstByte, secondByte, callback) { if (!this._spi) { throw "SPI device not initialized"; } for (var i = 0; i < this._buffer.length; i += 2) { this._buffer[i] = MAX7219._Registers.NoOp; this._buffer[i + 1] = 0x00; } var offset = this._activeController * 2; this._buffe...
javascript
function(firstByte, secondByte, callback) { if (!this._spi) { throw "SPI device not initialized"; } for (var i = 0; i < this._buffer.length; i += 2) { this._buffer[i] = MAX7219._Registers.NoOp; this._buffer[i + 1] = 0x00; } var offset = this._activeController * 2; this._buffe...
[ "function", "(", "firstByte", ",", "secondByte", ",", "callback", ")", "{", "if", "(", "!", "this", ".", "_spi", ")", "{", "throw", "\"SPI device not initialized\"", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_buffer", "...
Shifts two bytes to the SPI device. @param number firstByte The first byte, as a number. @param number secondByte The second byte, as a number. @param function callback [optional] Invoked once the write to the SPI device finishes.
[ "Shifts", "two", "bytes", "to", "the", "SPI", "device", "." ]
dec565caa8d33f1fdd1a36b309a74cd06f1e6837
https://github.com/victorporof/MAX7219.js/blob/dec565caa8d33f1fdd1a36b309a74cd06f1e6837/MAX7219.js#L371-L386
train
opendxl/opendxl-client-javascript
lib/service-manager.js
registerService
function registerService (client, service) { clearTtlTimeout(service) if (client.connected) { var request = new Request(DXL_SERVICE_REGISTER_REQUEST_TOPIC) request.payload = JSON.stringify({ serviceType: service.info.serviceType, metaData: service.info.metadata, requestChannels: service.i...
javascript
function registerService (client, service) { clearTtlTimeout(service) if (client.connected) { var request = new Request(DXL_SERVICE_REGISTER_REQUEST_TOPIC) request.payload = JSON.stringify({ serviceType: service.info.serviceType, metaData: service.info.metadata, requestChannels: service.i...
[ "function", "registerService", "(", "client", ",", "service", ")", "{", "clearTtlTimeout", "(", "service", ")", "if", "(", "client", ".", "connected", ")", "{", "var", "request", "=", "new", "Request", "(", "DXL_SERVICE_REGISTER_REQUEST_TOPIC", ")", "request", ...
Registers the service with the DXL fabric. @private @param {Client} client - Client to be used for registering the service. @param {Object} service - Metadata for the service. @param {ServiceRegistrationInfo} service.info - Info supplied for the service registration via a call to the {@link ServiceManager#registerServi...
[ "Registers", "the", "service", "with", "the", "DXL", "fabric", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/service-manager.js#L101-L126
train
opendxl/opendxl-client-javascript
lib/service-manager.js
unregisterService
function unregisterService (client, service, callback) { if (client.connected) { var request = new Request(DXL_SERVICE_UNREGISTER_REQUEST_TOPIC) request.payload = JSON.stringify({ serviceGuid: service.info.serviceId}) var unregisterCallback = null if (callback) { unregisterCallback = funct...
javascript
function unregisterService (client, service, callback) { if (client.connected) { var request = new Request(DXL_SERVICE_UNREGISTER_REQUEST_TOPIC) request.payload = JSON.stringify({ serviceGuid: service.info.serviceId}) var unregisterCallback = null if (callback) { unregisterCallback = funct...
[ "function", "unregisterService", "(", "client", ",", "service", ",", "callback", ")", "{", "if", "(", "client", ".", "connected", ")", "{", "var", "request", "=", "new", "Request", "(", "DXL_SERVICE_UNREGISTER_REQUEST_TOPIC", ")", "request", ".", "payload", "=...
Unregisters the service from the DXL fabric. @private @param {Client} client - Client to be used for unregistering the service. @param {Object} service - Metadata for the service. @param {ServiceRegistrationInfo} service.info - Info supplied for the service registration via a call to the {@link ServiceManager#registerS...
[ "Unregisters", "the", "service", "from", "the", "DXL", "fabric", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/service-manager.js#L142-L161
train
opendxl/opendxl-client-javascript
lib/_provisioning/pki.js
findOpenSslBin
function findOpenSslBin (opensslBin) { if (opensslBin) { if (!fs.existsSync(opensslBin)) { throw new DxlError('Unable to find openssl at: ' + opensslBin) } } else { opensslBin = which.sync('openssl', {nothrow: true}) if (!opensslBin && (os.platform() === 'win32')) { opensslBin = DEFAULT_...
javascript
function findOpenSslBin (opensslBin) { if (opensslBin) { if (!fs.existsSync(opensslBin)) { throw new DxlError('Unable to find openssl at: ' + opensslBin) } } else { opensslBin = which.sync('openssl', {nothrow: true}) if (!opensslBin && (os.platform() === 'win32')) { opensslBin = DEFAULT_...
[ "function", "findOpenSslBin", "(", "opensslBin", ")", "{", "if", "(", "opensslBin", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "opensslBin", ")", ")", "{", "throw", "new", "DxlError", "(", "'Unable to find openssl at: '", "+", "opensslBin", ")",...
Returns the first location found for the openssl executable. @param {String} [opensslBin=null] - If non-null and the named file exists, this value is returned. @returns {String} Path to the openssl executable. @throws {DxlError} If openssl cannot be found.
[ "Returns", "the", "first", "location", "found", "for", "the", "openssl", "executable", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/pki.js#L88-L112
train
opendxl/opendxl-client-javascript
lib/_provisioning/pki.js
indentedLogOutput
function indentedLogOutput (logOutput) { logOutput = logOutput.toString() if (logOutput) { logOutput = '\n ' + logOutput.toString().replace(/(\r?\n)/g, '$1 ') } return logOutput }
javascript
function indentedLogOutput (logOutput) { logOutput = logOutput.toString() if (logOutput) { logOutput = '\n ' + logOutput.toString().replace(/(\r?\n)/g, '$1 ') } return logOutput }
[ "function", "indentedLogOutput", "(", "logOutput", ")", "{", "logOutput", "=", "logOutput", ".", "toString", "(", ")", "if", "(", "logOutput", ")", "{", "logOutput", "=", "'\\n '", "+", "logOutput", ".", "toString", "(", ")", ".", "replace", "(", "/", "(...
Indents the lines in the supplied string for display in log output. @param {String} logOutput - The data to indent. @returns {String} The indented output.
[ "Indents", "the", "lines", "in", "the", "supplied", "string", "for", "display", "in", "log", "output", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/pki.js#L119-L125
train
opendxl/opendxl-client-javascript
lib/_provisioning/pki.js
buildCsrSubject
function buildCsrSubject (commonName, options) { var subject = '/CN=' + commonName Object.keys(SUBJECT_ATTRIBUTES).forEach(function (key) { if (options[key]) { subject = subject + '/' + SUBJECT_ATTRIBUTES[key].name + '=' + options[key] } }) return subject }
javascript
function buildCsrSubject (commonName, options) { var subject = '/CN=' + commonName Object.keys(SUBJECT_ATTRIBUTES).forEach(function (key) { if (options[key]) { subject = subject + '/' + SUBJECT_ATTRIBUTES[key].name + '=' + options[key] } }) return subject }
[ "function", "buildCsrSubject", "(", "commonName", ",", "options", ")", "{", "var", "subject", "=", "'/CN='", "+", "commonName", "Object", ".", "keys", "(", "SUBJECT_ATTRIBUTES", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "option...
Convert the X509 subject attributes specified on the command-line into a flat X509 subject string for use with openssl commands. @param {String} commonName - The X509 Common Name (CN) specified on the command line. @param {Object} [options] - Options to use in generating the CSR and private key. @returns {String} The X...
[ "Convert", "the", "X509", "subject", "attributes", "specified", "on", "the", "command", "-", "line", "into", "a", "flat", "X509", "subject", "string", "for", "use", "with", "openssl", "commands", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/pki.js#L136-L145
train
opendxl/opendxl-client-javascript
lib/_provisioning/pki.js
function (description, commandArgs, opensslBin, verbosity, input) { opensslBin = findOpenSslBin(opensslBin) if (verbosity) { if (description) { console.log(description) } if (verbosity > 1) { console.log("Running openssl. Path: '" + opensslBin + ...
javascript
function (description, commandArgs, opensslBin, verbosity, input) { opensslBin = findOpenSslBin(opensslBin) if (verbosity) { if (description) { console.log(description) } if (verbosity > 1) { console.log("Running openssl. Path: '" + opensslBin + ...
[ "function", "(", "description", ",", "commandArgs", ",", "opensslBin", ",", "verbosity", ",", "input", ")", "{", "opensslBin", "=", "findOpenSslBin", "(", "opensslBin", ")", "if", "(", "verbosity", ")", "{", "if", "(", "description", ")", "{", "console", "...
Runs an openssl command. @param {String} description - Textual description of the HTTP request (used in log and error messages). @param {Array<String>} commandArgs - Array of arguments to supply to the openssl command line. @param {String} [opensslBin] - Path to the openssl executable. If not specified, the function at...
[ "Runs", "an", "openssl", "command", "." ]
eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997
https://github.com/opendxl/opendxl-client-javascript/blob/eb947dcba18b9c34f5ccb3f0f6cccf2db70b4997/lib/_provisioning/pki.js#L178-L214
train
aholstenson/ecolect-js
src/time/dates.js
adjust
function adjust(r, e, time, def) { const requested = r[def.field]; const current = def.get(time, e.options); if(r.relationToCurrent === 'auto') { if(requested < current) { time = def.set(def.adjuster(time, 1, e.options), requested, e.options); } else { time = def.set(time, requested, e.options); } } el...
javascript
function adjust(r, e, time, def) { const requested = r[def.field]; const current = def.get(time, e.options); if(r.relationToCurrent === 'auto') { if(requested < current) { time = def.set(def.adjuster(time, 1, e.options), requested, e.options); } else { time = def.set(time, requested, e.options); } } el...
[ "function", "adjust", "(", "r", ",", "e", ",", "time", ",", "def", ")", "{", "const", "requested", "=", "r", "[", "def", ".", "field", "]", ";", "const", "current", "=", "def", ".", "get", "(", "time", ",", "e", ".", "options", ")", ";", "if", ...
Adjust the current time based on a field. Implements different strategies such as automatic, which tries to adjust the field forward if it's in the past. @param {Date} time the current time @param {Object} r the object containing the data @param {*} def definition describing the field to modify
[ "Adjust", "the", "current", "time", "based", "on", "a", "field", ".", "Implements", "different", "strategies", "such", "as", "automatic", "which", "tries", "to", "adjust", "the", "field", "forward", "if", "it", "s", "in", "the", "past", "." ]
db7f473a7d38588778b5724daa6ad38ac5ea4ec4
https://github.com/aholstenson/ecolect-js/blob/db7f473a7d38588778b5724daa6ad38ac5ea4ec4/src/time/dates.js#L118-L149
train
silas/swagger-framework
lib/schema/transform.js
traverse
function traverse(value, cbs) { cbs = cbs || {}; if (Array.isArray(value)) { if (cbs.beforeArray) value = cbs.beforeArray(value, cbs); value = value.map(function(v) { return traverse(v, cbs); }); if (cbs.afterArray) value = cbs.afterArray(value, cbs); } else if (typeof value === 'object')...
javascript
function traverse(value, cbs) { cbs = cbs || {}; if (Array.isArray(value)) { if (cbs.beforeArray) value = cbs.beforeArray(value, cbs); value = value.map(function(v) { return traverse(v, cbs); }); if (cbs.afterArray) value = cbs.afterArray(value, cbs); } else if (typeof value === 'object')...
[ "function", "traverse", "(", "value", ",", "cbs", ")", "{", "cbs", "=", "cbs", "||", "{", "}", ";", "if", "(", "Array", ".", "isArray", "(", "value", ")", ")", "{", "if", "(", "cbs", ".", "beforeArray", ")", "value", "=", "cbs", ".", "beforeArray...
Traverse object.
[ "Traverse", "object", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/transform.js#L19-L41
train
silas/swagger-framework
lib/schema/transform.js
transform
function transform(value, options) { options = options || {}; return traverse(value, { beforeObject: function(v) { if (options.removeFormats && typeof v.format === 'string' && typeof v.type === 'string' && v.type !== 'string') { delete v.format; } return...
javascript
function transform(value, options) { options = options || {}; return traverse(value, { beforeObject: function(v) { if (options.removeFormats && typeof v.format === 'string' && typeof v.type === 'string' && v.type !== 'string') { delete v.format; } return...
[ "function", "transform", "(", "value", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "return", "traverse", "(", "value", ",", "{", "beforeObject", ":", "function", "(", "v", ")", "{", "if", "(", "options", ".", "removeFormat...
Transform Swagger spec.
[ "Transform", "Swagger", "spec", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/transform.js#L47-L71
train
silas/swagger-framework
lib/schema/transform.js
model
function model(spec) { var schema = lodash.cloneDeep(spec); delete schema.id; schema = transform(schema, { removeFormats: true, }); return schema; }
javascript
function model(spec) { var schema = lodash.cloneDeep(spec); delete schema.id; schema = transform(schema, { removeFormats: true, }); return schema; }
[ "function", "model", "(", "spec", ")", "{", "var", "schema", "=", "lodash", ".", "cloneDeep", "(", "spec", ")", ";", "delete", "schema", ".", "id", ";", "schema", "=", "transform", "(", "schema", ",", "{", "removeFormats", ":", "true", ",", "}", ")",...
Convert Swagger model to JSON Schema.
[ "Convert", "Swagger", "model", "to", "JSON", "Schema", "." ]
d5b5bcb30feafc5e37b431ec09e494f9b6303950
https://github.com/silas/swagger-framework/blob/d5b5bcb30feafc5e37b431ec09e494f9b6303950/lib/schema/transform.js#L202-L212
train
layerhq/node-layer-webhooks-services
examples/basic-services/message-sent.js
getText
function getText(msg) { return msg.parts.filter(function (part) { return part.mime_type === 'text/plain'; }).map(function (part) { return part.body; }).join('; '); }
javascript
function getText(msg) { return msg.parts.filter(function (part) { return part.mime_type === 'text/plain'; }).map(function (part) { return part.body; }).join('; '); }
[ "function", "getText", "(", "msg", ")", "{", "return", "msg", ".", "parts", ".", "filter", "(", "function", "(", "part", ")", "{", "return", "part", ".", "mime_type", "===", "'text/plain'", ";", "}", ")", ".", "map", "(", "function", "(", "part", ")"...
Get the text from a Message.
[ "Get", "the", "text", "from", "a", "Message", "." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/examples/basic-services/message-sent.js#L20-L26
train
layerhq/node-layer-webhooks-services
examples/basic-services/message-sent.js
rollTheDie
function rollTheDie(msg, text) { var conversationId = msg.conversation.id; var matches = text.match(/die (\d+)/i); if (matches && matches[1]) { var dieCount = Number(matches[1]); var result = []; if (dieCount > 20) { layerClient.messages.sendTextFromName(conversationId, 'Die-bot',...
javascript
function rollTheDie(msg, text) { var conversationId = msg.conversation.id; var matches = text.match(/die (\d+)/i); if (matches && matches[1]) { var dieCount = Number(matches[1]); var result = []; if (dieCount > 20) { layerClient.messages.sendTextFromName(conversationId, 'Die-bot',...
[ "function", "rollTheDie", "(", "msg", ",", "text", ")", "{", "var", "conversationId", "=", "msg", ".", "conversation", ".", "id", ";", "var", "matches", "=", "text", ".", "match", "(", "/", "die (\\d+)", "/", "i", ")", ";", "if", "(", "matches", "&&"...
If someone sends the phrase "die 5" roll the dice 5 times and report the results
[ "If", "someone", "sends", "the", "phrase", "die", "5", "roll", "the", "dice", "5", "times", "and", "report", "the", "results" ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/examples/basic-services/message-sent.js#L58-L74
train
layerhq/node-layer-webhooks-services
examples/basic-services/message-sent.js
foodTalk
function foodTalk (msg, text) { var conversationId = msg.conversation.id; var matches = text.match(/eat my (.+?)\b/i); if (matches) { layerClient.messages.sendTextFromName(conversationId, 'Food-bot', 'My ' + matches[1] + ' taste a lot better than yours'); } else { var messages = [ '...
javascript
function foodTalk (msg, text) { var conversationId = msg.conversation.id; var matches = text.match(/eat my (.+?)\b/i); if (matches) { layerClient.messages.sendTextFromName(conversationId, 'Food-bot', 'My ' + matches[1] + ' taste a lot better than yours'); } else { var messages = [ '...
[ "function", "foodTalk", "(", "msg", ",", "text", ")", "{", "var", "conversationId", "=", "msg", ".", "conversation", ".", "id", ";", "var", "matches", "=", "text", ".", "match", "(", "/", "eat my (.+?)\\b", "/", "i", ")", ";", "if", "(", "matches", "...
If someone sends any phrase that has the word eat in it, respond with some food talk...
[ "If", "someone", "sends", "any", "phrase", "that", "has", "the", "word", "eat", "in", "it", "respond", "with", "some", "food", "talk", "..." ]
7ef63df31fb5b769ebe57b8855806178e1ce8dd8
https://github.com/layerhq/node-layer-webhooks-services/blob/7ef63df31fb5b769ebe57b8855806178e1ce8dd8/examples/basic-services/message-sent.js#L79-L96
train
jeffbski/autoflow
lib/autoflow.js
logEvents
function logEvents(flowFn, eventWildcard) { if (typeof(flowFn) !== 'function') { // only wildcard provided eventWildcard = flowFn; flowFn = undefined; } if (!flowFn) flowFn = autoflow; // use global trackTasks(); return logEventsMod.logEvents(flowFn, eventWildcard); }
javascript
function logEvents(flowFn, eventWildcard) { if (typeof(flowFn) !== 'function') { // only wildcard provided eventWildcard = flowFn; flowFn = undefined; } if (!flowFn) flowFn = autoflow; // use global trackTasks(); return logEventsMod.logEvents(flowFn, eventWildcard); }
[ "function", "logEvents", "(", "flowFn", ",", "eventWildcard", ")", "{", "if", "(", "typeof", "(", "flowFn", ")", "!==", "'function'", ")", "{", "// only wildcard provided", "eventWildcard", "=", "flowFn", ";", "flowFn", "=", "undefined", ";", "}", "if", "(",...
If called, load the built-in plugin for log events and invoke @param flowFn [function] if not provided uses global autoflow @param eventWildcard [string] pattern to log events for
[ "If", "called", "load", "the", "built", "-", "in", "plugin", "for", "log", "events", "and", "invoke" ]
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
https://github.com/jeffbski/autoflow/blob/aa30f6e6c2e74aa72a018c65698acac3fb478cbb/lib/autoflow.js#L34-L42
train
rakuten-frontend/bower-browser
client/assets/scripts/services/process.js
function (command, id) { id = id || ''; if (id) { this.queue.push(id); } SocketService.emit('execute', { command: command, id: id }); }
javascript
function (command, id) { id = id || ''; if (id) { this.queue.push(id); } SocketService.emit('execute', { command: command, id: id }); }
[ "function", "(", "command", ",", "id", ")", "{", "id", "=", "id", "||", "''", ";", "if", "(", "id", ")", "{", "this", ".", "queue", ".", "push", "(", "id", ")", ";", "}", "SocketService", ".", "emit", "(", "'execute'", ",", "{", "command", ":",...
WebSocket to execute command
[ "WebSocket", "to", "execute", "command" ]
d7875331f5d6f6ad0b7164d6116a341ac97f613f
https://github.com/rakuten-frontend/bower-browser/blob/d7875331f5d6f6ad0b7164d6116a341ac97f613f/client/assets/scripts/services/process.js#L35-L44
train