id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
43,700 | simonguo/hbook | lib/utils/git.js | resolveFileFromGit | function resolveFileFromGit(giturl) {
if (_.isString(giturl)) giturl = parseGitUrl(giturl);
if (!giturl) return Q(null);
// Clone or get from cache
return cloneGitRepo(giturl.host, giturl.ref)
.then(function(repo) {
// Resolve relative path
return path.resolve(repo, giturl.filepath... | javascript | function resolveFileFromGit(giturl) {
if (_.isString(giturl)) giturl = parseGitUrl(giturl);
if (!giturl) return Q(null);
// Clone or get from cache
return cloneGitRepo(giturl.host, giturl.ref)
.then(function(repo) {
// Resolve relative path
return path.resolve(repo, giturl.filepath... | [
"function",
"resolveFileFromGit",
"(",
"giturl",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"giturl",
")",
")",
"giturl",
"=",
"parseGitUrl",
"(",
"giturl",
")",
";",
"if",
"(",
"!",
"giturl",
")",
"return",
"Q",
"(",
"null",
")",
";",
"// Clone... | Get file from a git repo | [
"Get",
"file",
"from",
"a",
"git",
"repo"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/git.js#L92-L103 |
43,701 | simonguo/hbook | lib/utils/git.js | resolveGitRoot | function resolveGitRoot(filepath) {
var relativeToGit, repoId;
// No git repo cloned, or file is not in a git repository
if (!GIT_TMP || !pathUtil.isInRoot(GIT_TMP, filepath)) return null;
// Extract first directory (is the repo id)
relativeToGit = path.relative(GIT_TMP, filepath);
repoId = _.... | javascript | function resolveGitRoot(filepath) {
var relativeToGit, repoId;
// No git repo cloned, or file is not in a git repository
if (!GIT_TMP || !pathUtil.isInRoot(GIT_TMP, filepath)) return null;
// Extract first directory (is the repo id)
relativeToGit = path.relative(GIT_TMP, filepath);
repoId = _.... | [
"function",
"resolveGitRoot",
"(",
"filepath",
")",
"{",
"var",
"relativeToGit",
",",
"repoId",
";",
"// No git repo cloned, or file is not in a git repository",
"if",
"(",
"!",
"GIT_TMP",
"||",
"!",
"pathUtil",
".",
"isInRoot",
"(",
"GIT_TMP",
",",
"filepath",
")",... | Return root of git repo from a filepath | [
"Return",
"root",
"of",
"git",
"repo",
"from",
"a",
"filepath"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/git.js#L106-L119 |
43,702 | KirinJS/Kirin | javascript/lib/extensions/Networking.js | function(config) {
var hasParams = (typeof config.params === 'object');
var hasFiles = _.isArray(config.attachments);
if('GET' === config.method) {
if(hasParams) {
config.url = addParams(config.url, config.params);
}
if (hasFiles) {
throw new Error("Canno... | javascript | function(config) {
var hasParams = (typeof config.params === 'object');
var hasFiles = _.isArray(config.attachments);
if('GET' === config.method) {
if(hasParams) {
config.url = addParams(config.url, config.params);
}
if (hasFiles) {
throw new Error("Canno... | [
"function",
"(",
"config",
")",
"{",
"var",
"hasParams",
"=",
"(",
"typeof",
"config",
".",
"params",
"===",
"'object'",
")",
";",
"var",
"hasFiles",
"=",
"_",
".",
"isArray",
"(",
"config",
".",
"attachments",
")",
";",
"if",
"(",
"'GET'",
"===",
"c... | If the method is GET, the config.url string will have any parameters in the config.params added to it appropriately.
If the method is POST and there is no config.postData, the config.params object will be changed to a string. The form of this string will be "param1key=param1value¶m2key=param2value". Each key and v... | [
"If",
"the",
"method",
"is",
"GET",
"the",
"config",
".",
"url",
"string",
"will",
"have",
"any",
"parameters",
"in",
"the",
"config",
".",
"params",
"added",
"to",
"it",
"appropriately",
"."
] | d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1 | https://github.com/KirinJS/Kirin/blob/d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1/javascript/lib/extensions/Networking.js#L124-L170 | |
43,703 | simonguo/hbook | lib/utils/progress.js | calculProgress | function calculProgress(navigation, current) {
var n = _.size(navigation);
var percent = 0, prevPercent = 0, currentChapter = null;
var done = true;
var chapters = _.chain(navigation)
// Transform as array
.map(function(nav, path) {
nav.path = path;
return nav;
})
// S... | javascript | function calculProgress(navigation, current) {
var n = _.size(navigation);
var percent = 0, prevPercent = 0, currentChapter = null;
var done = true;
var chapters = _.chain(navigation)
// Transform as array
.map(function(nav, path) {
nav.path = path;
return nav;
})
// S... | [
"function",
"calculProgress",
"(",
"navigation",
",",
"current",
")",
"{",
"var",
"n",
"=",
"_",
".",
"size",
"(",
"navigation",
")",
";",
"var",
"percent",
"=",
"0",
",",
"prevPercent",
"=",
"0",
",",
"currentChapter",
"=",
"null",
";",
"var",
"done",... | Returns from a navigation and a current file, a snapshot of current detailed state | [
"Returns",
"from",
"a",
"navigation",
"and",
"a",
"current",
"file",
"a",
"snapshot",
"of",
"current",
"detailed",
"state"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/progress.js#L4-L53 |
43,704 | anvaka/amator | index.js | animate | function animate(source, target, options) {
var start = Object.create(null)
var diff = Object.create(null)
options = options || {}
// We let clients specify their own easing function
var easing = (typeof options.easing === 'function') ? options.easing : animations[options.easing]
// if nothing is specified... | javascript | function animate(source, target, options) {
var start = Object.create(null)
var diff = Object.create(null)
options = options || {}
// We let clients specify their own easing function
var easing = (typeof options.easing === 'function') ? options.easing : animations[options.easing]
// if nothing is specified... | [
"function",
"animate",
"(",
"source",
",",
"target",
",",
"options",
")",
"{",
"var",
"start",
"=",
"Object",
".",
"create",
"(",
"null",
")",
"var",
"diff",
"=",
"Object",
".",
"create",
"(",
"null",
")",
"options",
"=",
"options",
"||",
"{",
"}",
... | Creates a new instance of animator. Animator uses
interpolation function to change `source` object into
`target` object.
Note: this method mutates `source` object properties.
@param {Object} source
@param {Object} target
@param {Object} options - animation configuration
@param {Function} options.step - called on each... | [
"Creates",
"a",
"new",
"instance",
"of",
"animator",
".",
"Animator",
"uses",
"interpolation",
"function",
"to",
"change",
"source",
"object",
"into",
"target",
"object",
"."
] | 9147cdb2e9dbfcb35c564184150c2dfbd36fe4ee | https://github.com/anvaka/amator/blob/9147cdb2e9dbfcb35c564184150c2dfbd36fe4ee/index.js#L34-L94 |
43,705 | bhoriuchi/vsphere-connect | archive/v1/client/method.js | getFields | function getFields(def, obj) {
var a = {};
// if not an object, return the value
if (!_.isObject(obj)) {
return obj;
}
// check for type override
var defType = _.get(obj, 'attributes.xsi:type') || _.get(obj, 'attributes.type');
defType = defType ? defType.replace(/^vim25\:/i, '') : null;
/... | javascript | function getFields(def, obj) {
var a = {};
// if not an object, return the value
if (!_.isObject(obj)) {
return obj;
}
// check for type override
var defType = _.get(obj, 'attributes.xsi:type') || _.get(obj, 'attributes.type');
defType = defType ? defType.replace(/^vim25\:/i, '') : null;
/... | [
"function",
"getFields",
"(",
"def",
",",
"obj",
")",
"{",
"var",
"a",
"=",
"{",
"}",
";",
"// if not an object, return the value",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
";",
"}",
"// check for type override",
... | recursive function to get the fields in the correct order based on the wsdl definitions | [
"recursive",
"function",
"to",
"get",
"the",
"fields",
"in",
"the",
"correct",
"order",
"based",
"on",
"the",
"wsdl",
"definitions"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/method.js#L19-L60 |
43,706 | bhoriuchi/vsphere-connect | archive/v1/client/method.js | sortArgs | function sortArgs(method, args) {
// get the method definition
var def = _.get(_client.types, method.replace(/\_Task$/i, '') + 'RequestType');
// if found create the definition by calling its function
if (def) {
return getFields(def(), args);
}
return args;
} | javascript | function sortArgs(method, args) {
// get the method definition
var def = _.get(_client.types, method.replace(/\_Task$/i, '') + 'RequestType');
// if found create the definition by calling its function
if (def) {
return getFields(def(), args);
}
return args;
} | [
"function",
"sortArgs",
"(",
"method",
",",
"args",
")",
"{",
"// get the method definition",
"var",
"def",
"=",
"_",
".",
"get",
"(",
"_client",
".",
"types",
",",
"method",
".",
"replace",
"(",
"/",
"\\_Task$",
"/",
"i",
",",
"''",
")",
"+",
"'Reques... | function to correctly order the arguments this is done because arguments in an incorrect order will cause the soap method to fail | [
"function",
"to",
"correctly",
"order",
"the",
"arguments",
"this",
"is",
"done",
"because",
"arguments",
"in",
"an",
"incorrect",
"order",
"will",
"cause",
"the",
"soap",
"method",
"to",
"fail"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/method.js#L66-L76 |
43,707 | bhoriuchi/vsphere-connect | archive/v1/client/method.js | function(resolve, reject) {
var fn = _client.client.VimService.VimPort[name];
fn(args, function(err, result, raw, soapHeader) {
if (err) {
// emit an error and handle the error
_client.emit('method.error', err);
_client.errorHandler(err, name, args, resolve, reject);
}
else {
... | javascript | function(resolve, reject) {
var fn = _client.client.VimService.VimPort[name];
fn(args, function(err, result, raw, soapHeader) {
if (err) {
// emit an error and handle the error
_client.emit('method.error', err);
_client.errorHandler(err, name, args, resolve, reject);
}
else {
... | [
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"fn",
"=",
"_client",
".",
"client",
".",
"VimService",
".",
"VimPort",
"[",
"name",
"]",
";",
"fn",
"(",
"args",
",",
"function",
"(",
"err",
",",
"result",
",",
"raw",
",",
"soapHeader",
... | executes the function | [
"executes",
"the",
"function"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/method.js#L86-L103 | |
43,708 | bhoriuchi/vsphere-connect | archive/v1/client/emitUpdates.js | getUpdates | function getUpdates() {
return _client.method('WaitForUpdatesEx', {
_this: _client._updatesCollector,
version: _client._updatesVersion,
options: {
maxWaitSeconds: 0
}
})
.then(function(set) {
if (set) {
// update the version
_client._updatesVersion = set.version;
// get only t... | javascript | function getUpdates() {
return _client.method('WaitForUpdatesEx', {
_this: _client._updatesCollector,
version: _client._updatesVersion,
options: {
maxWaitSeconds: 0
}
})
.then(function(set) {
if (set) {
// update the version
_client._updatesVersion = set.version;
// get only t... | [
"function",
"getUpdates",
"(",
")",
"{",
"return",
"_client",
".",
"method",
"(",
"'WaitForUpdatesEx'",
",",
"{",
"_this",
":",
"_client",
".",
"_updatesCollector",
",",
"version",
":",
"_client",
".",
"_updatesVersion",
",",
"options",
":",
"{",
"maxWaitSecon... | function to get updates | [
"function",
"to",
"get",
"updates"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/emitUpdates.js#L28-L77 |
43,709 | serg-io/backbone-dynamodb | backbone-dynamodb.js | wrapComplete | function wrapComplete(instance, options) {
var complete = options.complete;
options.complete = function(response) {
if ( _.isFunction( complete ) ) {
complete.call( this, instance, response, options );
}
};
} | javascript | function wrapComplete(instance, options) {
var complete = options.complete;
options.complete = function(response) {
if ( _.isFunction( complete ) ) {
complete.call( this, instance, response, options );
}
};
} | [
"function",
"wrapComplete",
"(",
"instance",
",",
"options",
")",
"{",
"var",
"complete",
"=",
"options",
".",
"complete",
";",
"options",
".",
"complete",
"=",
"function",
"(",
"response",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"complete",
")... | Wraps the complete callback function inside another function to ensure it is executed with the right arguments.
@param {Backbone.DynamoDB.Model} instance
@param {Object} options | [
"Wraps",
"the",
"complete",
"callback",
"function",
"inside",
"another",
"function",
"to",
"ensure",
"it",
"is",
"executed",
"with",
"the",
"right",
"arguments",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L48-L56 |
43,710 | serg-io/backbone-dynamodb | backbone-dynamodb.js | putItem | function putItem(model, options) {
options || ( options = {} );
if ( options.serializeDates !== false ) {
// If serializeDates is NOT `false`, use `true` by default.
options.serializeDates = true;
}
var newKey, // If the model `isNew`, a new key is generated.
request,
hashName, // Name of the hash attribut... | javascript | function putItem(model, options) {
options || ( options = {} );
if ( options.serializeDates !== false ) {
// If serializeDates is NOT `false`, use `true` by default.
options.serializeDates = true;
}
var newKey, // If the model `isNew`, a new key is generated.
request,
hashName, // Name of the hash attribut... | [
"function",
"putItem",
"(",
"model",
",",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"if",
"(",
"options",
".",
"serializeDates",
"!==",
"false",
")",
"{",
"// If serializeDates is NOT `false`, use `true` by default.",
"option... | Sends a request to store a Backbone.DynamoDB.Model in a DynamoDB table using a PutItem request.
@param {Backbone.DynamoDB.Model} model The model to store in DynamoDB.
@param {Object} options The options object. | [
"Sends",
"a",
"request",
"to",
"store",
"a",
"Backbone",
".",
"DynamoDB",
".",
"Model",
"in",
"a",
"DynamoDB",
"table",
"using",
"a",
"PutItem",
"request",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L64-L169 |
43,711 | serg-io/backbone-dynamodb | backbone-dynamodb.js | deleteItem | function deleteItem(model, options) {
var request,
deferred = new _.Deferred(),
params = {
Key: key.call( model ),
TableName: model._tableName()
};
options || ( options = {} );
wrapComplete( model, options );
_.extend( params, options.dynamodb );
if ( options.serializeDates !== false ) {
// If the ... | javascript | function deleteItem(model, options) {
var request,
deferred = new _.Deferred(),
params = {
Key: key.call( model ),
TableName: model._tableName()
};
options || ( options = {} );
wrapComplete( model, options );
_.extend( params, options.dynamodb );
if ( options.serializeDates !== false ) {
// If the ... | [
"function",
"deleteItem",
"(",
"model",
",",
"options",
")",
"{",
"var",
"request",
",",
"deferred",
"=",
"new",
"_",
".",
"Deferred",
"(",
")",
",",
"params",
"=",
"{",
"Key",
":",
"key",
".",
"call",
"(",
"model",
")",
",",
"TableName",
":",
"mod... | Deletes a Backbone.DynamoDB.Model from a DynamoDB table using a DeleteItem request.
@param {Backbone.DynamoDB.Model} model The model to delete from DynamoDB.
@param {Object} options The options object. | [
"Deletes",
"a",
"Backbone",
".",
"DynamoDB",
".",
"Model",
"from",
"a",
"DynamoDB",
"table",
"using",
"a",
"DeleteItem",
"request",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L177-L210 |
43,712 | serg-io/backbone-dynamodb | backbone-dynamodb.js | fetchCollection | function fetchCollection(collection, options) {
options || ( options = {} );
var request,
deferred = new _.Deferred(),
// Determine the type of request: Query or Scan. Default is Scan.
fetchType = options.query ? 'query' : 'scan',
params = { TableName: collection._tableName() };
wrapComplete( collection, o... | javascript | function fetchCollection(collection, options) {
options || ( options = {} );
var request,
deferred = new _.Deferred(),
// Determine the type of request: Query or Scan. Default is Scan.
fetchType = options.query ? 'query' : 'scan',
params = { TableName: collection._tableName() };
wrapComplete( collection, o... | [
"function",
"fetchCollection",
"(",
"collection",
",",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"var",
"request",
",",
"deferred",
"=",
"new",
"_",
".",
"Deferred",
"(",
")",
",",
"// Determine the type of request: Query... | Retrieves a collection of Backbone.DynamoDB.Models from a DynamoDB table using a Query or Scan request.
@param {Backbone.DynamoDB.Collection} collection The collection instance.
@param {Object} options The options object. | [
"Retrieves",
"a",
"collection",
"of",
"Backbone",
".",
"DynamoDB",
".",
"Models",
"from",
"a",
"DynamoDB",
"table",
"using",
"a",
"Query",
"or",
"Scan",
"request",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L271-L311 |
43,713 | serg-io/backbone-dynamodb | backbone-dynamodb.js | serializeAllDates | function serializeAllDates(model, json) {
_.each(json, function (value, name) {
if ( _.isDate( value ) ) {
json[ name ] = model.serializeDate( name, value );
} else if ( !isScalar( value ) && !isBackboneInstance( value ) && isRecursive( value ) ) {
serializeAllDates( model, value );
}
});
return json;
} | javascript | function serializeAllDates(model, json) {
_.each(json, function (value, name) {
if ( _.isDate( value ) ) {
json[ name ] = model.serializeDate( name, value );
} else if ( !isScalar( value ) && !isBackboneInstance( value ) && isRecursive( value ) ) {
serializeAllDates( model, value );
}
});
return json;
} | [
"function",
"serializeAllDates",
"(",
"model",
",",
"json",
")",
"{",
"_",
".",
"each",
"(",
"json",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"if",
"(",
"_",
".",
"isDate",
"(",
"value",
")",
")",
"{",
"json",
"[",
"name",
"]",
"=",
... | Recursively serializes all `Date` values in an object.
@param {Backbone.DynamoDB.Model} model
@param {Object} json | [
"Recursively",
"serializes",
"all",
"Date",
"values",
"in",
"an",
"object",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L365-L375 |
43,714 | serg-io/backbone-dynamodb | backbone-dynamodb.js | deserializeAllDates | function deserializeAllDates(model, json) {
_.each(json, function (value, name) {
if ( !_.isDate( value ) && !isBackboneInstance( value ) ) {
if ( _.isString( value ) && model.isSerializedDate( name, value ) ) {
json[ name ] = model.deserializeDate( name, value );
} else if ( !isScalar( value ) && isRecurs... | javascript | function deserializeAllDates(model, json) {
_.each(json, function (value, name) {
if ( !_.isDate( value ) && !isBackboneInstance( value ) ) {
if ( _.isString( value ) && model.isSerializedDate( name, value ) ) {
json[ name ] = model.deserializeDate( name, value );
} else if ( !isScalar( value ) && isRecurs... | [
"function",
"deserializeAllDates",
"(",
"model",
",",
"json",
")",
"{",
"_",
".",
"each",
"(",
"json",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isDate",
"(",
"value",
")",
"&&",
"!",
"isBackboneInstance",
"(",
... | Recursively deserializes all date values in an object.
@param {Backbone.DynamoDB.Model} model
@param {Object} json | [
"Recursively",
"deserializes",
"all",
"date",
"values",
"in",
"an",
"object",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L383-L395 |
43,715 | serg-io/backbone-dynamodb | backbone-dynamodb.js | _tableName | function _tableName() {
if ( this.tableName ) {
return _.result( this, 'tableName' );
}
var urlAttributeName = this instanceof Backbone.DynamoDB.Model ? 'urlRoot' : 'url',
table = _.result( this, urlAttributeName ).replace( /^\//, '' );
return table.charAt( 0 ).toUpperCase() + table.substr( 1 );
} | javascript | function _tableName() {
if ( this.tableName ) {
return _.result( this, 'tableName' );
}
var urlAttributeName = this instanceof Backbone.DynamoDB.Model ? 'urlRoot' : 'url',
table = _.result( this, urlAttributeName ).replace( /^\//, '' );
return table.charAt( 0 ).toUpperCase() + table.substr( 1 );
} | [
"function",
"_tableName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tableName",
")",
"{",
"return",
"_",
".",
"result",
"(",
"this",
",",
"'tableName'",
")",
";",
"}",
"var",
"urlAttributeName",
"=",
"this",
"instanceof",
"Backbone",
".",
"DynamoDB",
".",
... | Determines the name of the table for the Model or Collection instance.
It returns the instance's `tableName` property, if it has one. Otherwise,
it determines the name using the `urlRoot` property, if it's a Model, or the
`url` property if it's a Collection. | [
"Determines",
"the",
"name",
"of",
"the",
"table",
"for",
"the",
"Model",
"or",
"Collection",
"instance",
".",
"It",
"returns",
"the",
"instance",
"s",
"tableName",
"property",
"if",
"it",
"has",
"one",
".",
"Otherwise",
"it",
"determines",
"the",
"name",
... | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L403-L412 |
43,716 | serg-io/backbone-dynamodb | backbone-dynamodb.js | function() {
var hashKey = _.result( this, 'hashAttribute' ) || _.result( this, 'idAttribute' ),
rangeKey = _.result( this, 'rangeAttribute' ),
hashValue = this.get( hashKey ),
rangeValue = rangeKey ? this.get( rangeKey ) : null;
return hashValue == null || ( rangeKey && rangeValue == null );
} | javascript | function() {
var hashKey = _.result( this, 'hashAttribute' ) || _.result( this, 'idAttribute' ),
rangeKey = _.result( this, 'rangeAttribute' ),
hashValue = this.get( hashKey ),
rangeValue = rangeKey ? this.get( rangeKey ) : null;
return hashValue == null || ( rangeKey && rangeValue == null );
} | [
"function",
"(",
")",
"{",
"var",
"hashKey",
"=",
"_",
".",
"result",
"(",
"this",
",",
"'hashAttribute'",
")",
"||",
"_",
".",
"result",
"(",
"this",
",",
"'idAttribute'",
")",
",",
"rangeKey",
"=",
"_",
".",
"result",
"(",
"this",
",",
"'rangeAttri... | Determines if the model is new. | [
"Determines",
"if",
"the",
"model",
"is",
"new",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L491-L498 | |
43,717 | serg-io/backbone-dynamodb | backbone-dynamodb.js | function (dynamoDbParams, options) {
var _options = { query: dynamoDbParams };
_.extend( _options, options );
return this.fetch( _options );
} | javascript | function (dynamoDbParams, options) {
var _options = { query: dynamoDbParams };
_.extend( _options, options );
return this.fetch( _options );
} | [
"function",
"(",
"dynamoDbParams",
",",
"options",
")",
"{",
"var",
"_options",
"=",
"{",
"query",
":",
"dynamoDbParams",
"}",
";",
"_",
".",
"extend",
"(",
"_options",
",",
"options",
")",
";",
"return",
"this",
".",
"fetch",
"(",
"_options",
")",
";"... | Sends a "Query" request to DynamoDB to "fetch" a collection.
@param {Object} dynamoDbParams DynamoDB [query](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#query-property) parameters.
@param {Object} options Additional `fetch` options. | [
"Sends",
"a",
"Query",
"request",
"to",
"DynamoDB",
"to",
"fetch",
"a",
"collection",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L642-L646 | |
43,718 | serg-io/backbone-dynamodb | backbone-dynamodb.js | function (dynamoDbParams, options) {
var _options = { scan: dynamoDbParams };
_.extend( _options, options );
return this.fetch( _options );
} | javascript | function (dynamoDbParams, options) {
var _options = { scan: dynamoDbParams };
_.extend( _options, options );
return this.fetch( _options );
} | [
"function",
"(",
"dynamoDbParams",
",",
"options",
")",
"{",
"var",
"_options",
"=",
"{",
"scan",
":",
"dynamoDbParams",
"}",
";",
"_",
".",
"extend",
"(",
"_options",
",",
"options",
")",
";",
"return",
"this",
".",
"fetch",
"(",
"_options",
")",
";",... | Sends a "Scan" request to DynamoDB to "fetch" a collection.
@param {Object} dynamoDbParams DynamoDB [scan](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#scan-property) parameters.
@param {Object} options Additional `fetch` options. | [
"Sends",
"a",
"Scan",
"request",
"to",
"DynamoDB",
"to",
"fetch",
"a",
"collection",
"."
] | a501865f8513d27f6577289d7cf4a20324075146 | https://github.com/serg-io/backbone-dynamodb/blob/a501865f8513d27f6577289d7cf4a20324075146/backbone-dynamodb.js#L653-L657 | |
43,719 | KirinJS/Kirin | javascript/lib/core/kirin-webview.js | function (jsName, methodName) {
return function () {
var args = slice.call(arguments, 0);
var i = 0, max, arg, util, id, exportable;
for (max=args.length; i<max; i++) {
arg = args[i];
if (arg.kirin_bridgeUtils) {
util = arg.kirin_bridgeUtils;
... | javascript | function (jsName, methodName) {
return function () {
var args = slice.call(arguments, 0);
var i = 0, max, arg, util, id, exportable;
for (max=args.length; i<max; i++) {
arg = args[i];
if (arg.kirin_bridgeUtils) {
util = arg.kirin_bridgeUtils;
... | [
"function",
"(",
"jsName",
",",
"methodName",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"var",
"i",
"=",
"0",
",",
"max",
",",
"arg",
",",
"util",
",",
"id",
"... | This is the function call that every call out to native goes through. | [
"This",
"is",
"the",
"function",
"call",
"that",
"every",
"call",
"out",
"to",
"native",
"goes",
"through",
"."
] | d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1 | https://github.com/KirinJS/Kirin/blob/d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1/javascript/lib/core/kirin-webview.js#L84-L113 | |
43,720 | KirinJS/Kirin | javascript/lib/core/kirin-webview.js | handleError | function handleError(during, e) {
/*
* {
"message": "Can't find variable: cardObject",
"line": 505,
"sourceId": 250182872,
"sourceURL": "file:///Users/james/Library/Application%20Support/iPhone%20Simulator/4.3.2/Applications/ADE774FF-B033-46A2-9CBA-DD362196E1F... | javascript | function handleError(during, e) {
/*
* {
"message": "Can't find variable: cardObject",
"line": 505,
"sourceId": 250182872,
"sourceURL": "file:///Users/james/Library/Application%20Support/iPhone%20Simulator/4.3.2/Applications/ADE774FF-B033-46A2-9CBA-DD362196E1F... | [
"function",
"handleError",
"(",
"during",
",",
"e",
")",
"{",
"/*\n * {\n \"message\": \"Can't find variable: cardObject\",\n \"line\": 505,\n \"sourceId\": 250182872,\n \"sourceURL\": \"file:///Users/james/Library/Application%20Support/iPhone%20Sim... | This is a generic error handler.
It does its best to report a stack trace, or an error or *something*.
Unfortunately, some devices are better suported than others.
e.g. Android >2.0, iOS 4.3 and iOS 6.0 are pretty good at providing errors (e.g. file location, stack trace etc)
iOS5 was shockingly bad.
@param during - ... | [
"This",
"is",
"a",
"generic",
"error",
"handler",
"."
] | d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1 | https://github.com/KirinJS/Kirin/blob/d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1/javascript/lib/core/kirin-webview.js#L140-L170 |
43,721 | KirinJS/Kirin | javascript/lib/core/kirin-webview.js | resolveModule | function resolveModule(moduleName) {
if (loadedObjects[moduleName]) {
return loadedObjects[moduleName];
}
var aModule, anObject, MyModule;
if (gwtClasses) {
aModule = gwtClasses[moduleName];
}
if (!aModule) {
try {
aModule = myRequire(moduleName);
} ca... | javascript | function resolveModule(moduleName) {
if (loadedObjects[moduleName]) {
return loadedObjects[moduleName];
}
var aModule, anObject, MyModule;
if (gwtClasses) {
aModule = gwtClasses[moduleName];
}
if (!aModule) {
try {
aModule = myRequire(moduleName);
} ca... | [
"function",
"resolveModule",
"(",
"moduleName",
")",
"{",
"if",
"(",
"loadedObjects",
"[",
"moduleName",
"]",
")",
"{",
"return",
"loadedObjects",
"[",
"moduleName",
"]",
";",
"}",
"var",
"aModule",
",",
"anObject",
",",
"MyModule",
";",
"if",
"(",
"gwtCla... | Finds the named module.
It tries quite hard to do this, looking at where gwtClasses may be stashed, and the browserify.require mechanism.
If the resulting object is a function, then it is assumed that the function is a constructor, and an object is newed.
Once we have an object to return, we keep it around as a cach... | [
"Finds",
"the",
"named",
"module",
"."
] | d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1 | https://github.com/KirinJS/Kirin/blob/d40e86ca89c40b5d3e0c129c24ff3b77ed3d28e1/javascript/lib/core/kirin-webview.js#L185-L216 |
43,722 | bhoriuchi/vsphere-connect | archive/v1/specUtil.js | traversalSpec | function traversalSpec(args) {
return {
attributes: {
'xsi:type': 'TraversalSpec'
},
type: args.listSpec.type,
path: args.listSpec.path,
skip: false
};
} | javascript | function traversalSpec(args) {
return {
attributes: {
'xsi:type': 'TraversalSpec'
},
type: args.listSpec.type,
path: args.listSpec.path,
skip: false
};
} | [
"function",
"traversalSpec",
"(",
"args",
")",
"{",
"return",
"{",
"attributes",
":",
"{",
"'xsi:type'",
":",
"'TraversalSpec'",
"}",
",",
"type",
":",
"args",
".",
"listSpec",
".",
"type",
",",
"path",
":",
"args",
".",
"listSpec",
".",
"path",
",",
"... | new traversal spec | [
"new",
"traversal",
"spec"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/specUtil.js#L16-L25 |
43,723 | bhoriuchi/vsphere-connect | archive/v1/specUtil.js | objectSpec | function objectSpec(args) {
var set = [];
if (!args.id) {
// create a base object
var spec = { attributes: { 'xsi:type': 'ObjectSpec' } };
// check for containerview
if (args.listSpec.type === 'ContainerView' && args.containerView) {
spec.obj = args.containerView;
}
else {
... | javascript | function objectSpec(args) {
var set = [];
if (!args.id) {
// create a base object
var spec = { attributes: { 'xsi:type': 'ObjectSpec' } };
// check for containerview
if (args.listSpec.type === 'ContainerView' && args.containerView) {
spec.obj = args.containerView;
}
else {
... | [
"function",
"objectSpec",
"(",
"args",
")",
"{",
"var",
"set",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"args",
".",
"id",
")",
"{",
"// create a base object",
"var",
"spec",
"=",
"{",
"attributes",
":",
"{",
"'xsi:type'",
":",
"'ObjectSpec'",
"}",
"}",
"... | new object spec | [
"new",
"object",
"spec"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/specUtil.js#L35-L76 |
43,724 | bhoriuchi/vsphere-connect | archive/v1/specUtil.js | propertySpec | function propertySpec(args) {
// create a basic specification
var spec = {
attributes: {
'xsi:type': 'PropertySpec'
},
type: args.type
};
// if an array of properties was passed, validate the properties
if (Array.isArray(args.properties) && args.properties.length > 0) {
var validPaths = ... | javascript | function propertySpec(args) {
// create a basic specification
var spec = {
attributes: {
'xsi:type': 'PropertySpec'
},
type: args.type
};
// if an array of properties was passed, validate the properties
if (Array.isArray(args.properties) && args.properties.length > 0) {
var validPaths = ... | [
"function",
"propertySpec",
"(",
"args",
")",
"{",
"// create a basic specification",
"var",
"spec",
"=",
"{",
"attributes",
":",
"{",
"'xsi:type'",
":",
"'PropertySpec'",
"}",
",",
"type",
":",
"args",
".",
"type",
"}",
";",
"// if an array of properties was pass... | new property spec | [
"new",
"property",
"spec"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/specUtil.js#L79-L105 |
43,725 | slorber/backspace-disabler | index.js | isInActiveContentEditable | function isInActiveContentEditable(node) {
while (node) {
if ( node.getAttribute &&
node.getAttribute("contenteditable") &&
node.getAttribute("contenteditable").toUpperCase() === "TRUE" ) {
return true
}
node = node.parentNod... | javascript | function isInActiveContentEditable(node) {
while (node) {
if ( node.getAttribute &&
node.getAttribute("contenteditable") &&
node.getAttribute("contenteditable").toUpperCase() === "TRUE" ) {
return true
}
node = node.parentNod... | [
"function",
"isInActiveContentEditable",
"(",
"node",
")",
"{",
"while",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getAttribute",
"&&",
"node",
".",
"getAttribute",
"(",
"\"contenteditable\"",
")",
"&&",
"node",
".",
"getAttribute",
"(",
"\"contenteditab... | Returns true if the node is or is inside an active contenteditable | [
"Returns",
"true",
"if",
"the",
"node",
"is",
"or",
"is",
"inside",
"an",
"active",
"contenteditable"
] | d57c4c6642a090aa03459b25db5e9d06c755e292 | https://github.com/slorber/backspace-disabler/blob/d57c4c6642a090aa03459b25db5e9d06c755e292/index.js#L53-L65 |
43,726 | slorber/backspace-disabler | index.js | connectedToTheDom | function connectedToTheDom(node) {
// IE does not have contains method on document element, only body
var container = node.ownerDocument.contains ? node.ownerDocument : node.ownerDocument.body;
return container.contains(node);
} | javascript | function connectedToTheDom(node) {
// IE does not have contains method on document element, only body
var container = node.ownerDocument.contains ? node.ownerDocument : node.ownerDocument.body;
return container.contains(node);
} | [
"function",
"connectedToTheDom",
"(",
"node",
")",
"{",
"// IE does not have contains method on document element, only body ",
"var",
"container",
"=",
"node",
".",
"ownerDocument",
".",
"contains",
"?",
"node",
".",
"ownerDocument",
":",
"node",
".",
"ownerDocument",
... | returns true if the element is contained within a document | [
"returns",
"true",
"if",
"the",
"element",
"is",
"contained",
"within",
"a",
"document"
] | d57c4c6642a090aa03459b25db5e9d06c755e292 | https://github.com/slorber/backspace-disabler/blob/d57c4c6642a090aa03459b25db5e9d06c755e292/index.js#L68-L72 |
43,727 | andrewimm/js-struct | lib/sign.js | sign | function sign(value, pow) {
const msb = 1 << pow;
if ((value & msb) === 0) {
return value;
}
let neg = -1 * (value & msb);
neg += (value & (msb - 1));
return neg;
} | javascript | function sign(value, pow) {
const msb = 1 << pow;
if ((value & msb) === 0) {
return value;
}
let neg = -1 * (value & msb);
neg += (value & (msb - 1));
return neg;
} | [
"function",
"sign",
"(",
"value",
",",
"pow",
")",
"{",
"const",
"msb",
"=",
"1",
"<<",
"pow",
";",
"if",
"(",
"(",
"value",
"&",
"msb",
")",
"===",
"0",
")",
"{",
"return",
"value",
";",
"}",
"let",
"neg",
"=",
"-",
"1",
"*",
"(",
"value",
... | Convert a two's-complement negative to its JS numeric value | [
"Convert",
"a",
"two",
"s",
"-",
"complement",
"negative",
"to",
"its",
"JS",
"numeric",
"value"
] | 730cb45660e36910a65dc515a880a26aca18d4b6 | https://github.com/andrewimm/js-struct/blob/730cb45660e36910a65dc515a880a26aca18d4b6/lib/sign.js#L6-L14 |
43,728 | simonguo/hbook | lib/utils/page.js | renderDom | function renderDom($, dom, options) {
if (!dom && $._root && $._root.children) {
dom = $._root.children;
}
options = options|| dom.options || $._options;
return domSerializer(dom, options);
} | javascript | function renderDom($, dom, options) {
if (!dom && $._root && $._root.children) {
dom = $._root.children;
}
options = options|| dom.options || $._options;
return domSerializer(dom, options);
} | [
"function",
"renderDom",
"(",
"$",
",",
"dom",
",",
"options",
")",
"{",
"if",
"(",
"!",
"dom",
"&&",
"$",
".",
"_root",
"&&",
"$",
".",
"_root",
".",
"children",
")",
"{",
"dom",
"=",
"$",
".",
"_root",
".",
"children",
";",
"}",
"options",
"=... | Render a cheerio dom as html | [
"Render",
"a",
"cheerio",
"dom",
"as",
"html"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/page.js#L22-L29 |
43,729 | simonguo/hbook | lib/utils/page.js | convertImages | function convertImages(images, options) {
if (!options.convertImages) return Q();
var downloaded = [];
options.book.log.debug.ln('convert ', images.length, 'images to png');
return batch.execEach(images, {
max: 100,
fn: function(image) {
var imgin = path.resolve(options.boo... | javascript | function convertImages(images, options) {
if (!options.convertImages) return Q();
var downloaded = [];
options.book.log.debug.ln('convert ', images.length, 'images to png');
return batch.execEach(images, {
max: 100,
fn: function(image) {
var imgin = path.resolve(options.boo... | [
"function",
"convertImages",
"(",
"images",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"convertImages",
")",
"return",
"Q",
"(",
")",
";",
"var",
"downloaded",
"=",
"[",
"]",
";",
"options",
".",
"book",
".",
"log",
".",
"debug",
".",
... | Convert svg images to png | [
"Convert",
"svg",
"images",
"to",
"png"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/page.js#L298-L343 |
43,730 | simonguo/hbook | lib/utils/page.js | normalizePage | function normalizePage(sections, options) {
options = _.defaults(options || {}, {
// Current book
book: null,
// Do we need to convert svg?
convertImages: false,
// Current file path
input: '.',
// Navigation to use to transform path
navigation: {},... | javascript | function normalizePage(sections, options) {
options = _.defaults(options || {}, {
// Current book
book: null,
// Do we need to convert svg?
convertImages: false,
// Current file path
input: '.',
// Navigation to use to transform path
navigation: {},... | [
"function",
"normalizePage",
"(",
"sections",
",",
"options",
")",
"{",
"options",
"=",
"_",
".",
"defaults",
"(",
"options",
"||",
"{",
"}",
",",
"{",
"// Current book",
"book",
":",
"null",
",",
"// Do we need to convert svg?",
"convertImages",
":",
"false",... | Adapt page content to be relative to a base folder | [
"Adapt",
"page",
"content",
"to",
"be",
"relative",
"to",
"a",
"base",
"folder"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/page.js#L346-L389 |
43,731 | simonguo/hbook | lib/utils/batch.js | execEach | function execEach(items, options) {
if (_.size(items) === 0) return Q();
var concurrents = 0, d = Q.defer(), pending = [];
options = _.defaults(options || {}, {
max: 100,
fn: function() {}
});
function startItem(item, i) {
if (concurrents >= options.max) {
pend... | javascript | function execEach(items, options) {
if (_.size(items) === 0) return Q();
var concurrents = 0, d = Q.defer(), pending = [];
options = _.defaults(options || {}, {
max: 100,
fn: function() {}
});
function startItem(item, i) {
if (concurrents >= options.max) {
pend... | [
"function",
"execEach",
"(",
"items",
",",
"options",
")",
"{",
"if",
"(",
"_",
".",
"size",
"(",
"items",
")",
"===",
"0",
")",
"return",
"Q",
"(",
")",
";",
"var",
"concurrents",
"=",
"0",
",",
"d",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"p... | Execute a method for all element | [
"Execute",
"a",
"method",
"for",
"all",
"element"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/batch.js#L5-L47 |
43,732 | simonguo/hbook | lib/template.js | function(filepath, source) {
var parser = parsers.get(path.extname(filepath));
var type = parser? parser.name : null;
return that.applyShortcuts(type, source);
} | javascript | function(filepath, source) {
var parser = parsers.get(path.extname(filepath));
var type = parser? parser.name : null;
return that.applyShortcuts(type, source);
} | [
"function",
"(",
"filepath",
",",
"source",
")",
"{",
"var",
"parser",
"=",
"parsers",
".",
"get",
"(",
"path",
".",
"extname",
"(",
"filepath",
")",
")",
";",
"var",
"type",
"=",
"parser",
"?",
"parser",
".",
"name",
":",
"null",
";",
"return",
"t... | Replace shortcuts in imported files | [
"Replace",
"shortcuts",
"in",
"imported",
"files"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/template.js#L29-L34 | |
43,733 | simonguo/hbook | theme/javascript/toolbar.js | createDropdownMenu | function createDropdownMenu(dropdown) {
var $menu = $('<div>', {
'class': 'dropdown-menu',
'html': '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'
});
if (_.isString(dropdown)) {
$menu.append(dropdown);
} else {
var ... | javascript | function createDropdownMenu(dropdown) {
var $menu = $('<div>', {
'class': 'dropdown-menu',
'html': '<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'
});
if (_.isString(dropdown)) {
$menu.append(dropdown);
} else {
var ... | [
"function",
"createDropdownMenu",
"(",
"dropdown",
")",
"{",
"var",
"$menu",
"=",
"$",
"(",
"'<div>'",
",",
"{",
"'class'",
":",
"'dropdown-menu'",
",",
"'html'",
":",
"'<div class=\"dropdown-caret\"><span class=\"caret-outer\"></span><span class=\"caret-inner\"></span></div>... | Create a dropdown menu | [
"Create",
"a",
"dropdown",
"menu"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/theme/javascript/toolbar.js#L28-L74 |
43,734 | simonguo/hbook | theme/javascript/toolbar.js | createButton | function createButton(opts) {
opts = _.defaults(opts || {}, {
// Aria label for the button
label: '',
// Icon to show
icon: '',
// Inner text
text: '',
// Right or left position
position: 'left',
// Other class name to add to the button
... | javascript | function createButton(opts) {
opts = _.defaults(opts || {}, {
// Aria label for the button
label: '',
// Icon to show
icon: '',
// Inner text
text: '',
// Right or left position
position: 'left',
// Other class name to add to the button
... | [
"function",
"createButton",
"(",
"opts",
")",
"{",
"opts",
"=",
"_",
".",
"defaults",
"(",
"opts",
"||",
"{",
"}",
",",
"{",
"// Aria label for the button",
"label",
":",
"''",
",",
"// Icon to show",
"icon",
":",
"''",
",",
"// Inner text",
"text",
":",
... | Create a new button in the toolbar | [
"Create",
"a",
"new",
"button",
"in",
"the",
"toolbar"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/theme/javascript/toolbar.js#L77-L106 |
43,735 | simonguo/hbook | theme/javascript/toolbar.js | updateButton | function updateButton(opts) {
var $result;
var $toolbar = $('.book-header');
var $title = $toolbar.find('h1');
// Build class name
var positionClass = 'pull-'+opts.position;
// Create button
var $btn = $('<a>', {
'class': 'btn',
'text': opts.text? ' ' + opts.text : '',
... | javascript | function updateButton(opts) {
var $result;
var $toolbar = $('.book-header');
var $title = $toolbar.find('h1');
// Build class name
var positionClass = 'pull-'+opts.position;
// Create button
var $btn = $('<a>', {
'class': 'btn',
'text': opts.text? ' ' + opts.text : '',
... | [
"function",
"updateButton",
"(",
"opts",
")",
"{",
"var",
"$result",
";",
"var",
"$toolbar",
"=",
"$",
"(",
"'.book-header'",
")",
";",
"var",
"$title",
"=",
"$toolbar",
".",
"find",
"(",
"'h1'",
")",
";",
"// Build class name",
"var",
"positionClass",
"="... | Update a button | [
"Update",
"a",
"button"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/theme/javascript/toolbar.js#L109-L166 |
43,736 | mmoulton/capture | phantomjs/capture.js | argsToObject | function argsToObject(args) {
var options = {};
options.address = args.shift();
options.output = args.shift();
// Pair two arguments, while transforming the key to camelCase
for (i = 0; i < args.length; i = i + 2) {
options[toCamelCase(args[i].substr(2))] = args[i + 1];
}
return options;
} | javascript | function argsToObject(args) {
var options = {};
options.address = args.shift();
options.output = args.shift();
// Pair two arguments, while transforming the key to camelCase
for (i = 0; i < args.length; i = i + 2) {
options[toCamelCase(args[i].substr(2))] = args[i + 1];
}
return options;
} | [
"function",
"argsToObject",
"(",
"args",
")",
"{",
"var",
"options",
"=",
"{",
"}",
";",
"options",
".",
"address",
"=",
"args",
".",
"shift",
"(",
")",
";",
"options",
".",
"output",
"=",
"args",
".",
"shift",
"(",
")",
";",
"// Pair two arguments, wh... | Transform an array to an object literal
@param {Array} args Array with seperate arguments
@return {Object} | [
"Transform",
"an",
"array",
"to",
"an",
"object",
"literal"
] | 794a0542603c4ff1f908d5d00c1bd3cda5c490ec | https://github.com/mmoulton/capture/blob/794a0542603c4ff1f908d5d00c1bd3cda5c490ec/phantomjs/capture.js#L116-L127 |
43,737 | bhoriuchi/vsphere-connect | archive/v1/client/findParentType.js | getParent | function getParent(type, id, parentType, root) {
return _client.retrieve({
type: type,
id: id,
properties: ['parent']
})
.then(function(obj) {
if (obj.length > 0) {
obj = _.first(obj);
type = _.get(obj, 'parent.type');
id = _.get(obj, 'parent.id');
// if there is no pa... | javascript | function getParent(type, id, parentType, root) {
return _client.retrieve({
type: type,
id: id,
properties: ['parent']
})
.then(function(obj) {
if (obj.length > 0) {
obj = _.first(obj);
type = _.get(obj, 'parent.type');
id = _.get(obj, 'parent.id');
// if there is no pa... | [
"function",
"getParent",
"(",
"type",
",",
"id",
",",
"parentType",
",",
"root",
")",
"{",
"return",
"_client",
".",
"retrieve",
"(",
"{",
"type",
":",
"type",
",",
"id",
":",
"id",
",",
"properties",
":",
"[",
"'parent'",
"]",
"}",
")",
".",
"then... | recursively looks for a parent type | [
"recursively",
"looks",
"for",
"a",
"parent",
"type"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/findParentType.js#L20-L76 |
43,738 | simonguo/hbook | lib/configuration.js | isDefaultPlugin | function isDefaultPlugin(name, version) {
if (!_.contains(DEFAULT_PLUGINS, name)) return false;
try {
var pluginPkg = require('gitbook-plugin-'+name+'/package.json');
return semver.satisfies(pluginPkg.version, version || '*');
} catch(e) {
return false;
}
} | javascript | function isDefaultPlugin(name, version) {
if (!_.contains(DEFAULT_PLUGINS, name)) return false;
try {
var pluginPkg = require('gitbook-plugin-'+name+'/package.json');
return semver.satisfies(pluginPkg.version, version || '*');
} catch(e) {
return false;
}
} | [
"function",
"isDefaultPlugin",
"(",
"name",
",",
"version",
")",
"{",
"if",
"(",
"!",
"_",
".",
"contains",
"(",
"DEFAULT_PLUGINS",
",",
"name",
")",
")",
"return",
"false",
";",
"try",
"{",
"var",
"pluginPkg",
"=",
"require",
"(",
"'gitbook-plugin-'",
"... | Check if a plugin is a default plugin Plugin should be in the list And version from book.json specified for this plugin should be satisfied | [
"Check",
"if",
"a",
"plugin",
"is",
"a",
"default",
"plugin",
"Plugin",
"should",
"be",
"in",
"the",
"list",
"And",
"version",
"from",
"book",
".",
"json",
"specified",
"for",
"this",
"plugin",
"should",
"be",
"satisfied"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/configuration.js#L18-L27 |
43,739 | simonguo/hbook | lib/configuration.js | normalizePluginsList | function normalizePluginsList(plugins, addDefaults) {
// Normalize list to an array
plugins = _.isString(plugins) ? plugins.split(',') : (plugins || []);
// Remove empty parts
plugins = _.compact(plugins);
// Divide as {name, version} to handle format like 'myplugin@1.0.0'
plugins = _.map(plug... | javascript | function normalizePluginsList(plugins, addDefaults) {
// Normalize list to an array
plugins = _.isString(plugins) ? plugins.split(',') : (plugins || []);
// Remove empty parts
plugins = _.compact(plugins);
// Divide as {name, version} to handle format like 'myplugin@1.0.0'
plugins = _.map(plug... | [
"function",
"normalizePluginsList",
"(",
"plugins",
",",
"addDefaults",
")",
"{",
"// Normalize list to an array",
"plugins",
"=",
"_",
".",
"isString",
"(",
"plugins",
")",
"?",
"plugins",
".",
"split",
"(",
"','",
")",
":",
"(",
"plugins",
"||",
"[",
"]",
... | Normalize a list of plugins to use | [
"Normalize",
"a",
"list",
"of",
"plugins",
"to",
"use"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/configuration.js#L30-L84 |
43,740 | cnlon/fuck-env | utils.js | getFiles | function getFiles () {
const FUCK_ENV = process.env.FUCK_ENV
|| process.env.npm_package_config_FUCK_ENV
|| FUCK_ENV_DEFAULT
return FUCK_ENV.split(',').map(file => path.resolve(root, file))
} | javascript | function getFiles () {
const FUCK_ENV = process.env.FUCK_ENV
|| process.env.npm_package_config_FUCK_ENV
|| FUCK_ENV_DEFAULT
return FUCK_ENV.split(',').map(file => path.resolve(root, file))
} | [
"function",
"getFiles",
"(",
")",
"{",
"const",
"FUCK_ENV",
"=",
"process",
".",
"env",
".",
"FUCK_ENV",
"||",
"process",
".",
"env",
".",
"npm_package_config_FUCK_ENV",
"||",
"FUCK_ENV_DEFAULT",
"return",
"FUCK_ENV",
".",
"split",
"(",
"','",
")",
".",
"map... | Get files from environment variables | [
"Get",
"files",
"from",
"environment",
"variables"
] | ddbd6d9ff34a35adf26e807e7fd4db99c52acafd | https://github.com/cnlon/fuck-env/blob/ddbd6d9ff34a35adf26e807e7fd4db99c52acafd/utils.js#L18-L23 |
43,741 | bhoriuchi/vsphere-connect | archive/v1/format.js | formatValue | function formatValue(value) {
var out;
var type = util.sType(value);
// if there is a type, check all sub items for types
if (_.has(value, 'attributes.type') && _.has(value, '$value') && _.keys(value).length === 2) {
out = util.moRef(value);
}
else if (type) {
if (util.isArray(value)) {
out ... | javascript | function formatValue(value) {
var out;
var type = util.sType(value);
// if there is a type, check all sub items for types
if (_.has(value, 'attributes.type') && _.has(value, '$value') && _.keys(value).length === 2) {
out = util.moRef(value);
}
else if (type) {
if (util.isArray(value)) {
out ... | [
"function",
"formatValue",
"(",
"value",
")",
"{",
"var",
"out",
";",
"var",
"type",
"=",
"util",
".",
"sType",
"(",
"value",
")",
";",
"// if there is a type, check all sub items for types",
"if",
"(",
"_",
".",
"has",
"(",
"value",
",",
"'attributes.type'",
... | recursive formatting function | [
"recursive",
"formatting",
"function"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/format.js#L45-L119 |
43,742 | bhoriuchi/vsphere-connect | archive/v1/format.js | formatProp | function formatProp(obj) {
var out = {};
var props = _.get(obj, 'propSet');
var moRef = _.has(obj, 'obj') ? util.moRef(obj.obj) : util.moRef(obj);
out.id = moRef.id;
out.type = moRef.type;
// loop through the propSet
if (Array.isArray(props)) {
_.forEach(props, function(prop) {... | javascript | function formatProp(obj) {
var out = {};
var props = _.get(obj, 'propSet');
var moRef = _.has(obj, 'obj') ? util.moRef(obj.obj) : util.moRef(obj);
out.id = moRef.id;
out.type = moRef.type;
// loop through the propSet
if (Array.isArray(props)) {
_.forEach(props, function(prop) {... | [
"function",
"formatProp",
"(",
"obj",
")",
"{",
"var",
"out",
"=",
"{",
"}",
";",
"var",
"props",
"=",
"_",
".",
"get",
"(",
"obj",
",",
"'propSet'",
")",
";",
"var",
"moRef",
"=",
"_",
".",
"has",
"(",
"obj",
",",
"'obj'",
")",
"?",
"util",
... | format each object | [
"format",
"each",
"object"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/format.js#L123-L142 |
43,743 | bhoriuchi/vsphere-connect | archive/v1/format.js | expandFields | function expandFields(obj) {
var out = {};
_.forEach(obj, function(val, key) {
if (_.includes(key, '.')) {
_.set(out, key, val);
}
else {
out[key] = val;
}
});
return out;
} | javascript | function expandFields(obj) {
var out = {};
_.forEach(obj, function(val, key) {
if (_.includes(key, '.')) {
_.set(out, key, val);
}
else {
out[key] = val;
}
});
return out;
} | [
"function",
"expandFields",
"(",
"obj",
")",
"{",
"var",
"out",
"=",
"{",
"}",
";",
"_",
".",
"forEach",
"(",
"obj",
",",
"function",
"(",
"val",
",",
"key",
")",
"{",
"if",
"(",
"_",
".",
"includes",
"(",
"key",
",",
"'.'",
")",
")",
"{",
"_... | since filters with dot notation return field names with dots, expand those fields and remove the dot named field | [
"since",
"filters",
"with",
"dot",
"notation",
"return",
"field",
"names",
"with",
"dots",
"expand",
"those",
"fields",
"and",
"remove",
"the",
"dot",
"named",
"field"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/format.js#L146-L159 |
43,744 | bhoriuchi/vsphere-connect | archive/v1/format.js | format | function format(response) {
var newObj = [];
var objects = _.get(response, 'objects') || response;
if (objects) {
// check if objects is an array
if (Array.isArray(objects)) {
_.forEach(objects, function(obj) {
newObj.push(expandFields(formatProp(obj)));
});
}
else {
newObj = exp... | javascript | function format(response) {
var newObj = [];
var objects = _.get(response, 'objects') || response;
if (objects) {
// check if objects is an array
if (Array.isArray(objects)) {
_.forEach(objects, function(obj) {
newObj.push(expandFields(formatProp(obj)));
});
}
else {
newObj = exp... | [
"function",
"format",
"(",
"response",
")",
"{",
"var",
"newObj",
"=",
"[",
"]",
";",
"var",
"objects",
"=",
"_",
".",
"get",
"(",
"response",
",",
"'objects'",
")",
"||",
"response",
";",
"if",
"(",
"objects",
")",
"{",
"// check if objects is an array"... | main formatting function | [
"main",
"formatting",
"function"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/format.js#L163-L184 |
43,745 | simonguo/hbook | theme/javascript/sidebar.js | filterSummary | function filterSummary(paths) {
var $summary = $('.book-summary');
$summary.find('li').each(function() {
var path = $(this).data('path');
var st = paths == null || _.contains(paths, path);
$(this).toggle(st);
if (st) $(this).parents('li').show();
});
} | javascript | function filterSummary(paths) {
var $summary = $('.book-summary');
$summary.find('li').each(function() {
var path = $(this).data('path');
var st = paths == null || _.contains(paths, path);
$(this).toggle(st);
if (st) $(this).parents('li').show();
});
} | [
"function",
"filterSummary",
"(",
"paths",
")",
"{",
"var",
"$summary",
"=",
"$",
"(",
"'.book-summary'",
")",
";",
"$summary",
".",
"find",
"(",
"'li'",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"var",
"path",
"=",
"$",
"(",
"this",
")",
"... | Filter summary with a list of path | [
"Filter",
"summary",
"with",
"a",
"list",
"of",
"path"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/theme/javascript/sidebar.js#L39-L49 |
43,746 | bhoriuchi/vsphere-connect | src/soap/client/wsdl/methods/process-docs.js | setOperations | function setOperations(operations, portType) {
_.forEach(portType.childNodes, node => {
if (node.localName === 'operation') {
operations[node.getAttribute('name')] = node;
}
});
} | javascript | function setOperations(operations, portType) {
_.forEach(portType.childNodes, node => {
if (node.localName === 'operation') {
operations[node.getAttribute('name')] = node;
}
});
} | [
"function",
"setOperations",
"(",
"operations",
",",
"portType",
")",
"{",
"_",
".",
"forEach",
"(",
"portType",
".",
"childNodes",
",",
"node",
"=>",
"{",
"if",
"(",
"node",
".",
"localName",
"===",
"'operation'",
")",
"{",
"operations",
"[",
"node",
".... | set operations via interface or portType | [
"set",
"operations",
"via",
"interface",
"or",
"portType"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/src/soap/client/wsdl/methods/process-docs.js#L6-L12 |
43,747 | simonguo/hbook | lib/utils/fs.js | getUniqueFilename | function getUniqueFilename(base, filename) {
if (!filename) {
filename = base;
base = '/';
}
filename = path.resolve(base, filename);
var ext = path.extname(filename);
filename = path.join(path.dirname(filename), path.basename(filename, ext));
var _filename = filename+ext;
... | javascript | function getUniqueFilename(base, filename) {
if (!filename) {
filename = base;
base = '/';
}
filename = path.resolve(base, filename);
var ext = path.extname(filename);
filename = path.join(path.dirname(filename), path.basename(filename, ext));
var _filename = filename+ext;
... | [
"function",
"getUniqueFilename",
"(",
"base",
",",
"filename",
")",
"{",
"if",
"(",
"!",
"filename",
")",
"{",
"filename",
"=",
"base",
";",
"base",
"=",
"'/'",
";",
"}",
"filename",
"=",
"path",
".",
"resolve",
"(",
"base",
",",
"filename",
")",
";"... | Find a filename available | [
"Find",
"a",
"filename",
"available"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/fs.js#L78-L97 |
43,748 | simonguo/hbook | lib/utils/fs.js | listFiles | function listFiles(root, options) {
options = _.defaults(options || {}, {
ignoreFiles: [],
ignoreRules: []
});
var d = Q.defer();
// Our list of files
var files = [];
var ig = Ignore({
path: root,
ignoreFiles: options.ignoreFiles
});
// Add extra rules... | javascript | function listFiles(root, options) {
options = _.defaults(options || {}, {
ignoreFiles: [],
ignoreRules: []
});
var d = Q.defer();
// Our list of files
var files = [];
var ig = Ignore({
path: root,
ignoreFiles: options.ignoreFiles
});
// Add extra rules... | [
"function",
"listFiles",
"(",
"root",
",",
"options",
")",
"{",
"options",
"=",
"_",
".",
"defaults",
"(",
"options",
"||",
"{",
"}",
",",
"{",
"ignoreFiles",
":",
"[",
"]",
",",
"ignoreRules",
":",
"[",
"]",
"}",
")",
";",
"var",
"d",
"=",
"Q",
... | List files in a directory | [
"List",
"files",
"in",
"a",
"directory"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/fs.js#L101-L142 |
43,749 | simonguo/hbook | lib/utils/fs.js | cleanFolder | function cleanFolder(root) {
if (!fs.existsSync(root)) return fsUtils.mkdirp(root);
return listFiles(root, {
ignoreFiles: [],
ignoreRules: [
// Skip Git and SVN stuff
'.git/',
'.svn/'
]
})
.then(function(files) {
var d = Q.defer();
... | javascript | function cleanFolder(root) {
if (!fs.existsSync(root)) return fsUtils.mkdirp(root);
return listFiles(root, {
ignoreFiles: [],
ignoreRules: [
// Skip Git and SVN stuff
'.git/',
'.svn/'
]
})
.then(function(files) {
var d = Q.defer();
... | [
"function",
"cleanFolder",
"(",
"root",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"root",
")",
")",
"return",
"fsUtils",
".",
"mkdirp",
"(",
"root",
")",
";",
"return",
"listFiles",
"(",
"root",
",",
"{",
"ignoreFiles",
":",
"[",
"]",
... | Clean a folder without removing .git and .svn Creates it if non existant | [
"Clean",
"a",
"folder",
"without",
"removing",
".",
"git",
"and",
".",
"svn",
"Creates",
"it",
"if",
"non",
"existant"
] | 5ea071130cc418fccd97a3e7e9a285c1d756b80b | https://github.com/simonguo/hbook/blob/5ea071130cc418fccd97a3e7e9a285c1d756b80b/lib/utils/fs.js#L146-L180 |
43,750 | stremlenye/immutable-http | src/validate.js | validateMethod | function validateMethod (method) {
if (!method) {
return option.some('HTTP method is not specified')
}
if (typeof method !== 'string') {
return option.some('HTTP method should be type of string')
}
if (supportedMethods.indexOf(method.toUpperCase()) < 0) {
return option.some(`Http method ${method} ... | javascript | function validateMethod (method) {
if (!method) {
return option.some('HTTP method is not specified')
}
if (typeof method !== 'string') {
return option.some('HTTP method should be type of string')
}
if (supportedMethods.indexOf(method.toUpperCase()) < 0) {
return option.some(`Http method ${method} ... | [
"function",
"validateMethod",
"(",
"method",
")",
"{",
"if",
"(",
"!",
"method",
")",
"{",
"return",
"option",
".",
"some",
"(",
"'HTTP method is not specified'",
")",
"}",
"if",
"(",
"typeof",
"method",
"!==",
"'string'",
")",
"{",
"return",
"option",
"."... | Validate HTTP method
@param {String} method – HTTP method
@return {String} error | [
"Validate",
"HTTP",
"method"
] | 4d46a66cc11cd02d96be63a3283bbfe7df1272c3 | https://github.com/stremlenye/immutable-http/blob/4d46a66cc11cd02d96be63a3283bbfe7df1272c3/src/validate.js#L11-L22 |
43,751 | stremlenye/immutable-http | src/validate.js | validateUrl | function validateUrl (url) {
if (!url) {
return option.some('Url is not specified')
}
if (typeof url !== 'string') {
return option.some('Url should be type of string')
}
return option.none
} | javascript | function validateUrl (url) {
if (!url) {
return option.some('Url is not specified')
}
if (typeof url !== 'string') {
return option.some('Url should be type of string')
}
return option.none
} | [
"function",
"validateUrl",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"url",
")",
"{",
"return",
"option",
".",
"some",
"(",
"'Url is not specified'",
")",
"}",
"if",
"(",
"typeof",
"url",
"!==",
"'string'",
")",
"{",
"return",
"option",
".",
"some",
"(",
... | Basicly validate url
@param {String} url – URL
@return {String} error | [
"Basicly",
"validate",
"url"
] | 4d46a66cc11cd02d96be63a3283bbfe7df1272c3 | https://github.com/stremlenye/immutable-http/blob/4d46a66cc11cd02d96be63a3283bbfe7df1272c3/src/validate.js#L29-L37 |
43,752 | stremlenye/immutable-http | src/validate.js | validateHeader | function validateHeader (key, value) {
if (typeof key !== 'string' || typeof value !== 'string')
return option.some(`Parts of header ${key}:${value} must be strings`)
return option.none
} | javascript | function validateHeader (key, value) {
if (typeof key !== 'string' || typeof value !== 'string')
return option.some(`Parts of header ${key}:${value} must be strings`)
return option.none
} | [
"function",
"validateHeader",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"key",
"!==",
"'string'",
"||",
"typeof",
"value",
"!==",
"'string'",
")",
"return",
"option",
".",
"some",
"(",
"`",
"${",
"key",
"}",
"${",
"value",
"}",
"`",
")... | Validate header to all parts be strings
@param {String} key – Header key
@param {String} value – Header value
@return {String} error | [
"Validate",
"header",
"to",
"all",
"parts",
"be",
"strings"
] | 4d46a66cc11cd02d96be63a3283bbfe7df1272c3 | https://github.com/stremlenye/immutable-http/blob/4d46a66cc11cd02d96be63a3283bbfe7df1272c3/src/validate.js#L45-L49 |
43,753 | stremlenye/immutable-http | src/validate.js | validateResponseType | function validateResponseType (type) {
if (validTypes.indexOf(type) < 0)
return option.some(`Response content type ${type} is not supported`)
return option.none
} | javascript | function validateResponseType (type) {
if (validTypes.indexOf(type) < 0)
return option.some(`Response content type ${type} is not supported`)
return option.none
} | [
"function",
"validateResponseType",
"(",
"type",
")",
"{",
"if",
"(",
"validTypes",
".",
"indexOf",
"(",
"type",
")",
"<",
"0",
")",
"return",
"option",
".",
"some",
"(",
"`",
"${",
"type",
"}",
"`",
")",
"return",
"option",
".",
"none",
"}"
] | Validates response type
@param {string} type - response type
@return {String} error | [
"Validates",
"response",
"type"
] | 4d46a66cc11cd02d96be63a3283bbfe7df1272c3 | https://github.com/stremlenye/immutable-http/blob/4d46a66cc11cd02d96be63a3283bbfe7df1272c3/src/validate.js#L68-L72 |
43,754 | bhoriuchi/vsphere-connect | archive/v1/client/retrieve.js | getResults | function getResults(result, objects) {
// if there are no results, resolve an empty array
if (!result) {
return new Promise(function(resolve, reject) {
resolve([]);
});
}
// if the result object is undefined or not an array, make it one
result.objects = result.objects || [];
result.objects =... | javascript | function getResults(result, objects) {
// if there are no results, resolve an empty array
if (!result) {
return new Promise(function(resolve, reject) {
resolve([]);
});
}
// if the result object is undefined or not an array, make it one
result.objects = result.objects || [];
result.objects =... | [
"function",
"getResults",
"(",
"result",
",",
"objects",
")",
"{",
"// if there are no results, resolve an empty array",
"if",
"(",
"!",
"result",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"resolve",
"(",
"... | continues to get all properties until finished | [
"continues",
"to",
"get",
"all",
"properties",
"until",
"finished"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/client/retrieve.js#L25-L56 |
43,755 | steamerjs/steamer-react-component | src/spin.js | ins | function ins(parent /* child1, child2, ... */) {
for (let i = 1, n = arguments.length; i < n; i++) {
parent.appendChild(arguments[i]);
}
return parent;
} | javascript | function ins(parent /* child1, child2, ... */) {
for (let i = 1, n = arguments.length; i < n; i++) {
parent.appendChild(arguments[i]);
}
return parent;
} | [
"function",
"ins",
"(",
"parent",
"/* child1, child2, ... */",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"1",
",",
"n",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"parent",
".",
"appendChild",
"(",
"arguments",
"[",
... | Appends children and returns the parent. | [
"Appends",
"children",
"and",
"returns",
"the",
"parent",
"."
] | 84cbf6a125d8d5693f037f8544c79e2b1c2bdca6 | https://github.com/steamerjs/steamer-react-component/blob/84cbf6a125d8d5693f037f8544c79e2b1c2bdca6/src/spin.js#L54-L60 |
43,756 | steamerjs/steamer-react-component | src/spin.js | function() {
let el = this.el;
if (el) {
clearTimeout(this.timeout);
if (el.parentNode) el.parentNode.removeChild(el);
this.el = null;
}
return this;
} | javascript | function() {
let el = this.el;
if (el) {
clearTimeout(this.timeout);
if (el.parentNode) el.parentNode.removeChild(el);
this.el = null;
}
return this;
} | [
"function",
"(",
")",
"{",
"let",
"el",
"=",
"this",
".",
"el",
";",
"if",
"(",
"el",
")",
"{",
"clearTimeout",
"(",
"this",
".",
"timeout",
")",
";",
"if",
"(",
"el",
".",
"parentNode",
")",
"el",
".",
"parentNode",
".",
"removeChild",
"(",
"el"... | Stops and removes the Spinner. | [
"Stops",
"and",
"removes",
"the",
"Spinner",
"."
] | 84cbf6a125d8d5693f037f8544c79e2b1c2bdca6 | https://github.com/steamerjs/steamer-react-component/blob/84cbf6a125d8d5693f037f8544c79e2b1c2bdca6/src/spin.js#L226-L235 | |
43,757 | bhoriuchi/vsphere-connect | archive/v1/util.js | moRef | function moRef(type, id) {
if (type && id) {
return {
attributes: {
type: type
},
"$value": id
};
}
else if (typeof(type) === 'object') {
return {
id: _.get(type, '$value'),
type: _.get(type, 'attributes.type') || _.get(type, 'attributes.xsi:type')
};
}
return null;
} | javascript | function moRef(type, id) {
if (type && id) {
return {
attributes: {
type: type
},
"$value": id
};
}
else if (typeof(type) === 'object') {
return {
id: _.get(type, '$value'),
type: _.get(type, 'attributes.type') || _.get(type, 'attributes.xsi:type')
};
}
return null;
} | [
"function",
"moRef",
"(",
"type",
",",
"id",
")",
"{",
"if",
"(",
"type",
"&&",
"id",
")",
"{",
"return",
"{",
"attributes",
":",
"{",
"type",
":",
"type",
"}",
",",
"\"$value\"",
":",
"id",
"}",
";",
"}",
"else",
"if",
"(",
"typeof",
"(",
"typ... | compose or decompose a moRef | [
"compose",
"or",
"decompose",
"a",
"moRef"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L14-L31 |
43,758 | bhoriuchi/vsphere-connect | archive/v1/util.js | isArray | function isArray(obj) {
var type = sType(obj);
return (Array.isArray(obj) || (typeof(type) === 'string' && type.substring(0, 5) === 'Array'));
} | javascript | function isArray(obj) {
var type = sType(obj);
return (Array.isArray(obj) || (typeof(type) === 'string' && type.substring(0, 5) === 'Array'));
} | [
"function",
"isArray",
"(",
"obj",
")",
"{",
"var",
"type",
"=",
"sType",
"(",
"obj",
")",
";",
"return",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
"||",
"(",
"typeof",
"(",
"type",
")",
"===",
"'string'",
"&&",
"type",
".",
"substring",
"(",
... | determine if type is an array | [
"determine",
"if",
"type",
"is",
"an",
"array"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L39-L42 |
43,759 | bhoriuchi/vsphere-connect | archive/v1/util.js | isBoolean | function isBoolean(obj) {
var type = sType(obj);
return (_.has(obj, '$value') && (type === 'xsd:boolean' || type === 'boolean'));
} | javascript | function isBoolean(obj) {
var type = sType(obj);
return (_.has(obj, '$value') && (type === 'xsd:boolean' || type === 'boolean'));
} | [
"function",
"isBoolean",
"(",
"obj",
")",
"{",
"var",
"type",
"=",
"sType",
"(",
"obj",
")",
";",
"return",
"(",
"_",
".",
"has",
"(",
"obj",
",",
"'$value'",
")",
"&&",
"(",
"type",
"===",
"'xsd:boolean'",
"||",
"type",
"===",
"'boolean'",
")",
")... | check for boolean | [
"check",
"for",
"boolean"
] | 2203b678847a57e3cb982f1a23277d44444f6de4 | https://github.com/bhoriuchi/vsphere-connect/blob/2203b678847a57e3cb982f1a23277d44444f6de4/archive/v1/util.js#L45-L48 |
43,760 | 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 |
43,761 | 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 |
43,762 | 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 |
43,763 | 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 |
43,764 | 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 |
43,765 | 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 |
43,766 | 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 | |
43,767 | 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 |
43,768 | 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 |
43,769 | 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 |
43,770 | 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 |
43,771 | 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 |
43,772 | 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 |
43,773 | 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 | |
43,774 | 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 |
43,775 | 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 |
43,776 | 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 |
43,777 | 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 |
43,778 | 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 |
43,779 | 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 |
43,780 | 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 | |
43,781 | 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 | |
43,782 | 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 | |
43,783 | 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 |
43,784 | 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 | |
43,785 | 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 | |
43,786 | 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 | |
43,787 | 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 | |
43,788 | 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 | |
43,789 | 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 | |
43,790 | 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 | |
43,791 | 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 | |
43,792 | 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 | |
43,793 | 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 | |
43,794 | 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 | |
43,795 | 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 | |
43,796 | 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 | |
43,797 | 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 | |
43,798 | 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 | |
43,799 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.