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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,500 | nutella-framework/nutella_lib.js | src/simple-mqtt-client/client-browser.js | matchesWildcard | function matchesWildcard (subscriptions, channel) {
var i;
var subs = Object.keys(subscriptions);
for (i=0; i < subs.length; i++) {
if (matchesFilter(subs[i], channel)) {
return subs[i];
}
}
return undefined;
} | javascript | function matchesWildcard (subscriptions, channel) {
var i;
var subs = Object.keys(subscriptions);
for (i=0; i < subs.length; i++) {
if (matchesFilter(subs[i], channel)) {
return subs[i];
}
}
return undefined;
} | [
"function",
"matchesWildcard",
"(",
"subscriptions",
",",
"channel",
")",
"{",
"var",
"i",
";",
"var",
"subs",
"=",
"Object",
".",
"keys",
"(",
"subscriptions",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"subs",
".",
"length",
";",
"i",
"+... | Helper function that tries to match a channel with each subscription it returns undefined if no match is found | [
"Helper",
"function",
"that",
"tries",
"to",
"match",
"a",
"channel",
"with",
"each",
"subscription",
"it",
"returns",
"undefined",
"if",
"no",
"match",
"is",
"found"
] | b3a3406a407e2a1ada6edcc503b70991f9cb249b | https://github.com/nutella-framework/nutella_lib.js/blob/b3a3406a407e2a1ada6edcc503b70991f9cb249b/src/simple-mqtt-client/client-browser.js#L251-L260 |
57,501 | nutella-framework/nutella_lib.js | src/simple-mqtt-client/client-browser.js | addToBacklog | function addToBacklog (client, backlog, method, parameters) {
if (!client.isConnected() ) {
backlog.push({
op : method,
params : parameters
});
return true;
}
return false;
} | javascript | function addToBacklog (client, backlog, method, parameters) {
if (!client.isConnected() ) {
backlog.push({
op : method,
params : parameters
});
return true;
}
return false;
} | [
"function",
"addToBacklog",
"(",
"client",
",",
"backlog",
",",
"method",
",",
"parameters",
")",
"{",
"if",
"(",
"!",
"client",
".",
"isConnected",
"(",
")",
")",
"{",
"backlog",
".",
"push",
"(",
"{",
"op",
":",
"method",
",",
"params",
":",
"param... | Helper method that queues operations into the backlog. This method is used to make `connect` "synchronous" by queueing up operations on the client until it is connected. @param {string} method - the method that needs to be added to the backlog @param {Array} parameters - parameters to the method being added to the ba... | [
"Helper",
"method",
"that",
"queues",
"operations",
"into",
"the",
"backlog",
".",
"This",
"method",
"is",
"used",
"to",
"make",
"connect",
"synchronous",
"by",
"queueing",
"up",
"operations",
"on",
"the",
"client",
"until",
"it",
"is",
"connected",
"."
] | b3a3406a407e2a1ada6edcc503b70991f9cb249b | https://github.com/nutella-framework/nutella_lib.js/blob/b3a3406a407e2a1ada6edcc503b70991f9cb249b/src/simple-mqtt-client/client-browser.js#L295-L304 |
57,502 | thlorenz/snippetify | examples/snippetify-self-parsable.js | printParsableCode | function printParsableCode(snippets) {
// prints all lines, some of which were fixed to make them parsable
var lines = snippets
.map(function (x) { return '[ ' + x.code + ' ]'; });
console.log(lines.join('\n'));
} | javascript | function printParsableCode(snippets) {
// prints all lines, some of which were fixed to make them parsable
var lines = snippets
.map(function (x) { return '[ ' + x.code + ' ]'; });
console.log(lines.join('\n'));
} | [
"function",
"printParsableCode",
"(",
"snippets",
")",
"{",
"// prints all lines, some of which were fixed to make them parsable",
"var",
"lines",
"=",
"snippets",
".",
"map",
"(",
"function",
"(",
"x",
")",
"{",
"return",
"'[ '",
"+",
"x",
".",
"code",
"+",
"' ]'... | This meaningless comment will be a separate snippet since it is parsable on its own | [
"This",
"meaningless",
"comment",
"will",
"be",
"a",
"separate",
"snippet",
"since",
"it",
"is",
"parsable",
"on",
"its",
"own"
] | cc5795b155955c15c78ead01d10d72ee44fab846 | https://github.com/thlorenz/snippetify/blob/cc5795b155955c15c78ead01d10d72ee44fab846/examples/snippetify-self-parsable.js#L8-L14 |
57,503 | LuiseteMola/wraps-cache | dist/index.js | configure | function configure(cacheType, conf) {
// Check for custom logging functions on cache (debug)
if (conf && conf.logger) {
logger_1.configureLogger(conf.logger);
logger_1.logger.info('Custom cache logger configured');
}
if (cacheType)
exports.cache = cacheType;
} | javascript | function configure(cacheType, conf) {
// Check for custom logging functions on cache (debug)
if (conf && conf.logger) {
logger_1.configureLogger(conf.logger);
logger_1.logger.info('Custom cache logger configured');
}
if (cacheType)
exports.cache = cacheType;
} | [
"function",
"configure",
"(",
"cacheType",
",",
"conf",
")",
"{",
"// Check for custom logging functions on cache (debug)",
"if",
"(",
"conf",
"&&",
"conf",
".",
"logger",
")",
"{",
"logger_1",
".",
"configureLogger",
"(",
"conf",
".",
"logger",
")",
";",
"logge... | Cache middleware configuration | [
"Cache",
"middleware",
"configuration"
] | b43973a4d48e4223c08ec4aae05f3f8267112f16 | https://github.com/LuiseteMola/wraps-cache/blob/b43973a4d48e4223c08ec4aae05f3f8267112f16/dist/index.js#L10-L18 |
57,504 | ugate/releasebot | Gruntfile.js | Tasks | function Tasks() {
this.tasks = [];
this.add = function(task) {
var commit = grunt.config.get('releasebot.commit');
if (commit.skipTaskCheck(task)) {
grunt.log.writeln('Skipping "' + task + '" task');
return false;
}
// grunt.log.writeln('Queuing "' + task + '" task');
return this.tasks.push(... | javascript | function Tasks() {
this.tasks = [];
this.add = function(task) {
var commit = grunt.config.get('releasebot.commit');
if (commit.skipTaskCheck(task)) {
grunt.log.writeln('Skipping "' + task + '" task');
return false;
}
// grunt.log.writeln('Queuing "' + task + '" task');
return this.tasks.push(... | [
"function",
"Tasks",
"(",
")",
"{",
"this",
".",
"tasks",
"=",
"[",
"]",
";",
"this",
".",
"add",
"=",
"function",
"(",
"task",
")",
"{",
"var",
"commit",
"=",
"grunt",
".",
"config",
".",
"get",
"(",
"'releasebot.commit'",
")",
";",
"if",
"(",
"... | Task array that takes into account possible skip options
@constructor | [
"Task",
"array",
"that",
"takes",
"into",
"account",
"possible",
"skip",
"options"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/Gruntfile.js#L140-L151 |
57,505 | kuhnza/node-tubesio | lib/tubesio/utils.js | Args | function Args() {
if (argv._.length >= 1) {
try {
// Attempt to parse 1st argument as JSON string
_.extend(this, JSON.parse(argv._[0]));
} catch (err) {
// Pass, we must be in the console so don't worry about it
}
}
} | javascript | function Args() {
if (argv._.length >= 1) {
try {
// Attempt to parse 1st argument as JSON string
_.extend(this, JSON.parse(argv._[0]));
} catch (err) {
// Pass, we must be in the console so don't worry about it
}
}
} | [
"function",
"Args",
"(",
")",
"{",
"if",
"(",
"argv",
".",
"_",
".",
"length",
">=",
"1",
")",
"{",
"try",
"{",
"// Attempt to parse 1st argument as JSON string",
"_",
".",
"extend",
"(",
"this",
",",
"JSON",
".",
"parse",
"(",
"argv",
".",
"_",
"[",
... | All functions, include conflict, will be available through _.str object
Argument parser object. | [
"All",
"functions",
"include",
"conflict",
"will",
"be",
"available",
"through",
"_",
".",
"str",
"object",
"Argument",
"parser",
"object",
"."
] | 198d005de764480485fe038d1832ccb0f6e0596e | https://github.com/kuhnza/node-tubesio/blob/198d005de764480485fe038d1832ccb0f6e0596e/lib/tubesio/utils.js#L27-L36 |
57,506 | kuhnza/node-tubesio | lib/tubesio/utils.js | getLastResult | function getLastResult() {
if (argv._.length >= 2) {
try {
return JSON.parse(argv._[1]);
} catch (err) {
// pass
}
}
return null;
} | javascript | function getLastResult() {
if (argv._.length >= 2) {
try {
return JSON.parse(argv._[1]);
} catch (err) {
// pass
}
}
return null;
} | [
"function",
"getLastResult",
"(",
")",
"{",
"if",
"(",
"argv",
".",
"_",
".",
"length",
">=",
"2",
")",
"{",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"argv",
".",
"_",
"[",
"1",
"]",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"// p... | Parse last results if present. | [
"Parse",
"last",
"results",
"if",
"present",
"."
] | 198d005de764480485fe038d1832ccb0f6e0596e | https://github.com/kuhnza/node-tubesio/blob/198d005de764480485fe038d1832ccb0f6e0596e/lib/tubesio/utils.js#L54-L64 |
57,507 | kuhnza/node-tubesio | lib/tubesio/utils.js | EStoreScraper | function EStoreScraper() {
_.defaults(this, {
logger: new logging.Logger(),
cookieJar: new CookieJar(),
maxConcurrency: 10,
startPage: '',
agent: new http.Agent()
});
this.agent.maxSockets = this.maxConcurrency;
this.products = [];
this.waiting = ... | javascript | function EStoreScraper() {
_.defaults(this, {
logger: new logging.Logger(),
cookieJar: new CookieJar(),
maxConcurrency: 10,
startPage: '',
agent: new http.Agent()
});
this.agent.maxSockets = this.maxConcurrency;
this.products = [];
this.waiting = ... | [
"function",
"EStoreScraper",
"(",
")",
"{",
"_",
".",
"defaults",
"(",
"this",
",",
"{",
"logger",
":",
"new",
"logging",
".",
"Logger",
"(",
")",
",",
"cookieJar",
":",
"new",
"CookieJar",
"(",
")",
",",
"maxConcurrency",
":",
"10",
",",
"startPage",
... | General purpose e-commerce store scraper shell. | [
"General",
"purpose",
"e",
"-",
"commerce",
"store",
"scraper",
"shell",
"."
] | 198d005de764480485fe038d1832ccb0f6e0596e | https://github.com/kuhnza/node-tubesio/blob/198d005de764480485fe038d1832ccb0f6e0596e/lib/tubesio/utils.js#L72-L84 |
57,508 | andreruffert/closest-number | index.js | closestNumber | function closestNumber(arr, num) {
return arr.reduce((prev, curr) => (Math.abs(curr - num) < Math.abs(prev - num)) ? curr : prev);
} | javascript | function closestNumber(arr, num) {
return arr.reduce((prev, curr) => (Math.abs(curr - num) < Math.abs(prev - num)) ? curr : prev);
} | [
"function",
"closestNumber",
"(",
"arr",
",",
"num",
")",
"{",
"return",
"arr",
".",
"reduce",
"(",
"(",
"prev",
",",
"curr",
")",
"=>",
"(",
"Math",
".",
"abs",
"(",
"curr",
"-",
"num",
")",
"<",
"Math",
".",
"abs",
"(",
"prev",
"-",
"num",
")... | Returns the closest number out of an array
@param {Array} arr
@param {Number} num
@return {Number} | [
"Returns",
"the",
"closest",
"number",
"out",
"of",
"an",
"array"
] | 5dcf1497d7fa6b05ed4cd80f05ad4fccc5edb1ed | https://github.com/andreruffert/closest-number/blob/5dcf1497d7fa6b05ed4cd80f05ad4fccc5edb1ed/index.js#L7-L9 |
57,509 | Augmentedjs/augmented | scripts/core/augmented.js | function(source, type) {
var out = null;
switch(type) {
case Augmented.Utility.TransformerType.xString:
if (typeof source === 'object') {
out = JSON.stringify(source);
} else {
out = String(source);
}
break;
case Augment... | javascript | function(source, type) {
var out = null;
switch(type) {
case Augmented.Utility.TransformerType.xString:
if (typeof source === 'object') {
out = JSON.stringify(source);
} else {
out = String(source);
}
break;
case Augment... | [
"function",
"(",
"source",
",",
"type",
")",
"{",
"var",
"out",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Augmented",
".",
"Utility",
".",
"TransformerType",
".",
"xString",
":",
"if",
"(",
"typeof",
"source",
"===",
"'object'",
")",
... | Transform an object, primitive, or array to another object, primitive, or array
@method transform
@param {object} source Source primitive to transform
@param {Augmented.Utility.TransformerType} type Type to transform to
@memberof Augmented.Utility.Transformer
@returns {object} returns a transformed object or primitive | [
"Transform",
"an",
"object",
"primitive",
"or",
"array",
"to",
"another",
"object",
"primitive",
"or",
"array"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L613-L650 | |
57,510 | Augmentedjs/augmented | scripts/core/augmented.js | function(source) {
if (source === null) {
return Augmented.Utility.TransformerType.xNull;
} else if (typeof source === 'string') {
return Augmented.Utility.TransformerType.xString;
} else if (typeof source === 'number') {
return Augmented.Utility.TransformerType.xNu... | javascript | function(source) {
if (source === null) {
return Augmented.Utility.TransformerType.xNull;
} else if (typeof source === 'string') {
return Augmented.Utility.TransformerType.xString;
} else if (typeof source === 'number') {
return Augmented.Utility.TransformerType.xNu... | [
"function",
"(",
"source",
")",
"{",
"if",
"(",
"source",
"===",
"null",
")",
"{",
"return",
"Augmented",
".",
"Utility",
".",
"TransformerType",
".",
"xNull",
";",
"}",
"else",
"if",
"(",
"typeof",
"source",
"===",
"'string'",
")",
"{",
"return",
"Aug... | Returns a Augmented.Utility.TransformerType of a passed object
@method isType
@memberof Augmented.Utility.Transformer
@param {object} source The source primitive
@returns {Augmented.Utility.TransformerType} type of source as Augmented.Utility.TransformerType | [
"Returns",
"a",
"Augmented",
".",
"Utility",
".",
"TransformerType",
"of",
"a",
"passed",
"object"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L658-L672 | |
57,511 | Augmentedjs/augmented | scripts/core/augmented.js | function(type, level) {
if (type === Augmented.Logger.Type.console) {
return new consoleLogger(level);
} else if (type === Augmented.Logger.Type.colorConsole) {
return new colorConsoleLogger(level);
} else if (type === Augmented.Logger.Type.rest) {
return new restLo... | javascript | function(type, level) {
if (type === Augmented.Logger.Type.console) {
return new consoleLogger(level);
} else if (type === Augmented.Logger.Type.colorConsole) {
return new colorConsoleLogger(level);
} else if (type === Augmented.Logger.Type.rest) {
return new restLo... | [
"function",
"(",
"type",
",",
"level",
")",
"{",
"if",
"(",
"type",
"===",
"Augmented",
".",
"Logger",
".",
"Type",
".",
"console",
")",
"{",
"return",
"new",
"consoleLogger",
"(",
"level",
")",
";",
"}",
"else",
"if",
"(",
"type",
"===",
"Augmented"... | getLogger - get an instance of a logger
@method getLogger
@param {Augmented.Logger.Type} type Type of logger instance
@param {Augmented.Logger.Level} level Level to set the logger to
@memberof Augmented.Logger.LoggerFactory
@returns {Augmented.Logger.abstractLogger} logger Instance of a logger by istance type
@example ... | [
"getLogger",
"-",
"get",
"an",
"instance",
"of",
"a",
"logger"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L1280-L1288 | |
57,512 | Augmentedjs/augmented | scripts/core/augmented.js | function(username, password) {
var c = null;
Augmented.ajax({
url: this.uri,
method: "GET",
user: username,
password: password,
success: function(data, status) {
var p = new principal({
fullName: data.fullName,
id:... | javascript | function(username, password) {
var c = null;
Augmented.ajax({
url: this.uri,
method: "GET",
user: username,
password: password,
success: function(data, status) {
var p = new principal({
fullName: data.fullName,
id:... | [
"function",
"(",
"username",
",",
"password",
")",
"{",
"var",
"c",
"=",
"null",
";",
"Augmented",
".",
"ajax",
"(",
"{",
"url",
":",
"this",
".",
"uri",
",",
"method",
":",
"\"GET\"",
",",
"user",
":",
"username",
",",
"password",
":",
"password",
... | authenticate the user
@method authenticate
@param {string} username The name of the user (login)
@param {string} password The password for the user (not stored)
@returns {Augmented.Security.Context} Returns a security context or null is case of failure
@memberof Augmented.Security.Client.ACL
@throws Error Failed to aut... | [
"authenticate",
"the",
"user"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L1794-L1816 | |
57,513 | Augmentedjs/augmented | scripts/core/augmented.js | function(clientType) {
if (clientType === Augmented.Security.ClientType.OAUTH2) {
return new Augmented.Security.Client.OAUTH2Client();
} else if (clientType === Augmented.Security.ClientType.ACL) {
return new Augmented.Security.Client.ACLClient();
}
return null;
... | javascript | function(clientType) {
if (clientType === Augmented.Security.ClientType.OAUTH2) {
return new Augmented.Security.Client.OAUTH2Client();
} else if (clientType === Augmented.Security.ClientType.ACL) {
return new Augmented.Security.Client.ACLClient();
}
return null;
... | [
"function",
"(",
"clientType",
")",
"{",
"if",
"(",
"clientType",
"===",
"Augmented",
".",
"Security",
".",
"ClientType",
".",
"OAUTH2",
")",
"{",
"return",
"new",
"Augmented",
".",
"Security",
".",
"Client",
".",
"OAUTH2Client",
"(",
")",
";",
"}",
"els... | Get an instance of a security client
@method getSecurityClient
@param {Augmented.Security.ClientType} clientType The Client Type to return
@returns {Augmented.Security.Client} Returns a security client instance
@memberof Augmented.Security.AuthenticationFactory | [
"Get",
"an",
"instance",
"of",
"a",
"security",
"client"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L1834-L1841 | |
57,514 | Augmentedjs/augmented | scripts/core/augmented.js | function(message) {
var key = "";
if (message) {
var x = message.level &&
(key += message.level, message.kind &&
(key += this.delimiter + message.kind, message.rule &&
(key += this.delimiter + message.rule, message.values.title &&
(key += this.delimiter + ... | javascript | function(message) {
var key = "";
if (message) {
var x = message.level &&
(key += message.level, message.kind &&
(key += this.delimiter + message.kind, message.rule &&
(key += this.delimiter + message.rule, message.values.title &&
(key += this.delimiter + ... | [
"function",
"(",
"message",
")",
"{",
"var",
"key",
"=",
"\"\"",
";",
"if",
"(",
"message",
")",
"{",
"var",
"x",
"=",
"message",
".",
"level",
"&&",
"(",
"key",
"+=",
"message",
".",
"level",
",",
"message",
".",
"kind",
"&&",
"(",
"key",
"+=",
... | Format a key for a message
@function format
@param {message} message The message to format
@memberof Augmented.Utility.MessageKeyFormatter
@returns The key to lookup in a bundle | [
"Format",
"a",
"key",
"for",
"a",
"message"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3553-L3563 | |
57,515 | Augmentedjs/augmented | scripts/core/augmented.js | function() {
var myValidator;
if (myValidator === undefined) {
myValidator = new Validator();
}
/**
* Returns if the framework supports validation
* @method supportsValidation
* @returns {boolean} Returns true if the framework supports va... | javascript | function() {
var myValidator;
if (myValidator === undefined) {
myValidator = new Validator();
}
/**
* Returns if the framework supports validation
* @method supportsValidation
* @returns {boolean} Returns true if the framework supports va... | [
"function",
"(",
")",
"{",
"var",
"myValidator",
";",
"if",
"(",
"myValidator",
"===",
"undefined",
")",
"{",
"myValidator",
"=",
"new",
"Validator",
"(",
")",
";",
"}",
"/**\n * Returns if the framework supports validation\n * @method supportsValidation... | Augmented.ValidationFramework -
The Validation Framework Base Wrapper Class.
Provides abstraction for base validation build-in library
@constructor Augmented.ValidationFramework
@memberof Augmented | [
"Augmented",
".",
"ValidationFramework",
"-",
"The",
"Validation",
"Framework",
"Base",
"Wrapper",
"Class",
".",
"Provides",
"abstraction",
"for",
"base",
"validation",
"build",
"-",
"in",
"library"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3611-L3690 | |
57,516 | Augmentedjs/augmented | scripts/core/augmented.js | function() {
if (this.supportsValidation() && Augmented.ValidationFramework.supportsValidation()) {
// validate from Validator
this.validationMessages = Augmented.ValidationFramework.validate(this.toJSON(), this.schema);
} else {
this.validationMessages.... | javascript | function() {
if (this.supportsValidation() && Augmented.ValidationFramework.supportsValidation()) {
// validate from Validator
this.validationMessages = Augmented.ValidationFramework.validate(this.toJSON(), this.schema);
} else {
this.validationMessages.... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"supportsValidation",
"(",
")",
"&&",
"Augmented",
".",
"ValidationFramework",
".",
"supportsValidation",
"(",
")",
")",
"{",
"// validate from Validator",
"this",
".",
"validationMessages",
"=",
"Augmented",
".... | Validates the model
@method validate
@memberof Augmented.Model
@returns {array} Returns array of messages from validation | [
"Validates",
"the",
"model"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3757-L3765 | |
57,517 | Augmentedjs/augmented | scripts/core/augmented.js | function() {
const messages = [];
if (this.validationMessages && this.validationMessages.errors) {
const l = this.validationMessages.errors.length;
var i = 0;
for (i = 0; i < l; i++) {
messages.push(this.validationMessages.errors[i].messa... | javascript | function() {
const messages = [];
if (this.validationMessages && this.validationMessages.errors) {
const l = this.validationMessages.errors.length;
var i = 0;
for (i = 0; i < l; i++) {
messages.push(this.validationMessages.errors[i].messa... | [
"function",
"(",
")",
"{",
"const",
"messages",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"validationMessages",
"&&",
"this",
".",
"validationMessages",
".",
"errors",
")",
"{",
"const",
"l",
"=",
"this",
".",
"validationMessages",
".",
"errors",
".",
... | Gets the validation messages only in an array
@method getValidationMessages
@memberof Augmented.Model
@returns {array} Returns array of messages from validation | [
"Gets",
"the",
"validation",
"messages",
"only",
"in",
"an",
"array"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3772-L3782 | |
57,518 | Augmentedjs/augmented | scripts/core/augmented.js | function(method, model, options) {
if (!options) {
options = {};
}
if (this.crossOrigin === true) {
options.crossDomain = true;
}
if (!options.xhrFields) {
options.xhrFields = {
withCredentials: true
... | javascript | function(method, model, options) {
if (!options) {
options = {};
}
if (this.crossOrigin === true) {
options.crossDomain = true;
}
if (!options.xhrFields) {
options.xhrFields = {
withCredentials: true
... | [
"function",
"(",
"method",
",",
"model",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"this",
".",
"crossOrigin",
"===",
"true",
")",
"{",
"options",
".",
"crossDomain",
"=",
"true",
... | Model.sync - Sync model data to bound REST call
@method sync
@memberof Augmented.Model | [
"Model",
".",
"sync",
"-",
"Sync",
"model",
"data",
"to",
"bound",
"REST",
"call"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3794-L3812 | |
57,519 | Augmentedjs/augmented | scripts/core/augmented.js | function() {
if (this.supportsValidation() && Augmented.ValidationFramework.supportsValidation()) {
// validate from Validator
var messages = [];
this.validationMessages.messages = messages;
this.validationMessages.valid = true;
var a = ... | javascript | function() {
if (this.supportsValidation() && Augmented.ValidationFramework.supportsValidation()) {
// validate from Validator
var messages = [];
this.validationMessages.messages = messages;
this.validationMessages.valid = true;
var a = ... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"supportsValidation",
"(",
")",
"&&",
"Augmented",
".",
"ValidationFramework",
".",
"supportsValidation",
"(",
")",
")",
"{",
"// validate from Validator",
"var",
"messages",
"=",
"[",
"]",
";",
"this",
".",... | Validates the collection
@method validate
@memberof Augmented.Collection
@returns {array} Returns array of message from validation | [
"Validates",
"the",
"collection"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L3946-L3967 | |
57,520 | Augmentedjs/augmented | scripts/core/augmented.js | function(key) {
if (key) {
var data = this.toJSON();
if (data) {
var sorted = Augmented.Utility.Sort(data, key);
this.reset(sorted);
}
}
} | javascript | function(key) {
if (key) {
var data = this.toJSON();
if (data) {
var sorted = Augmented.Utility.Sort(data, key);
this.reset(sorted);
}
}
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"key",
")",
"{",
"var",
"data",
"=",
"this",
".",
"toJSON",
"(",
")",
";",
"if",
"(",
"data",
")",
"{",
"var",
"sorted",
"=",
"Augmented",
".",
"Utility",
".",
"Sort",
"(",
"data",
",",
"key",
")",
... | sortByKey - Sorts the collection by a property key
@method sortByKey
@param {object} key The key to sort by
@memberof Augmented.Collection | [
"sortByKey",
"-",
"Sorts",
"the",
"collection",
"by",
"a",
"property",
"key"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4029-L4037 | |
57,521 | Augmentedjs/augmented | scripts/core/augmented.js | function(options) {
options = (options) ? options : {};
var data = (options.data || {});
var p = this.paginationConfiguration;
var d = {};
d[p.currentPageParam] = this.currentPage;
d[p.pageSizeParam] = this.pageSize;
options.data = d;
... | javascript | function(options) {
options = (options) ? options : {};
var data = (options.data || {});
var p = this.paginationConfiguration;
var d = {};
d[p.currentPageParam] = this.currentPage;
d[p.pageSizeParam] = this.pageSize;
options.data = d;
... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"(",
"options",
")",
"?",
"options",
":",
"{",
"}",
";",
"var",
"data",
"=",
"(",
"options",
".",
"data",
"||",
"{",
"}",
")",
";",
"var",
"p",
"=",
"this",
".",
"paginationConfiguration",
";",
... | Collection.fetch - rewritten fetch method from Backbone.Collection.fetch
@method fetch
@memberof Augmented.PaginatedCollection
@borrows Collection.fetch | [
"Collection",
".",
"fetch",
"-",
"rewritten",
"fetch",
"method",
"from",
"Backbone",
".",
"Collection",
".",
"fetch"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4147-L4162 | |
57,522 | Augmentedjs/augmented | scripts/core/augmented.js | function(apiType, data) {
var arg = (data) ? data : {};
var collection = null;
if (!apiType) {
apiType = paginationAPIType.github;
}
if (apiType === paginationAPIType.github) {
collection = new paginatedCollection(arg);
... | javascript | function(apiType, data) {
var arg = (data) ? data : {};
var collection = null;
if (!apiType) {
apiType = paginationAPIType.github;
}
if (apiType === paginationAPIType.github) {
collection = new paginatedCollection(arg);
... | [
"function",
"(",
"apiType",
",",
"data",
")",
"{",
"var",
"arg",
"=",
"(",
"data",
")",
"?",
"data",
":",
"{",
"}",
";",
"var",
"collection",
"=",
"null",
";",
"if",
"(",
"!",
"apiType",
")",
"{",
"apiType",
"=",
"paginationAPIType",
".",
"github",... | Get a pagination collection of type
@method getPaginatedCollection
@memberof Augmented.PaginationFactory
@param {Augmented.PaginationFactory.type} apiType The API type to return an instance of
@param {object} args Collection arguments | [
"Get",
"a",
"pagination",
"collection",
"of",
"type"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4254-L4281 | |
57,523 | Augmentedjs/augmented | scripts/core/augmented.js | function(permission, negative) {
if (!negative) {
negative = false;
}
if (permission !== null && !Array.isArray(permission)) {
var p = (negative) ? this.permissions.exclude : this.permissions.include;
p.push(permission);
}
... | javascript | function(permission, negative) {
if (!negative) {
negative = false;
}
if (permission !== null && !Array.isArray(permission)) {
var p = (negative) ? this.permissions.exclude : this.permissions.include;
p.push(permission);
}
... | [
"function",
"(",
"permission",
",",
"negative",
")",
"{",
"if",
"(",
"!",
"negative",
")",
"{",
"negative",
"=",
"false",
";",
"}",
"if",
"(",
"permission",
"!==",
"null",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"permission",
")",
")",
"{",
"var",
... | Adds a permission to the view
@method addPermission
@param {string} permission The permission to add
@param {boolean} negative Flag to set a nagative permission (optional)
@memberof Augmented.View | [
"Adds",
"a",
"permission",
"to",
"the",
"view"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4388-L4396 | |
57,524 | Augmentedjs/augmented | scripts/core/augmented.js | function(permission, negative) {
if (!negative) {
negative = false;
}
if (permission !== null && !Array.isArray(permission)) {
var p = (negative) ? this.permissions.exclude : this.permissions.include;
p.splice((p.indexOf(permission)), 1);
... | javascript | function(permission, negative) {
if (!negative) {
negative = false;
}
if (permission !== null && !Array.isArray(permission)) {
var p = (negative) ? this.permissions.exclude : this.permissions.include;
p.splice((p.indexOf(permission)), 1);
... | [
"function",
"(",
"permission",
",",
"negative",
")",
"{",
"if",
"(",
"!",
"negative",
")",
"{",
"negative",
"=",
"false",
";",
"}",
"if",
"(",
"permission",
"!==",
"null",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"permission",
")",
")",
"{",
"var",
... | Removes a permission to the view
@method removePermission
@param {string} permission The permission to remove
@param {boolean} negative Flag to set a nagative permission (optional)
@memberof Augmented.View | [
"Removes",
"a",
"permission",
"to",
"the",
"view"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4404-L4412 | |
57,525 | Augmentedjs/augmented | scripts/core/augmented.js | function(permissions, negative) {
if (!negative) {
negative = false;
}
if (permissions !== null && Array.isArray(permissions)) {
if (negative) {
this.permissions.exclude = permissions;
} else {
this.permissions... | javascript | function(permissions, negative) {
if (!negative) {
negative = false;
}
if (permissions !== null && Array.isArray(permissions)) {
if (negative) {
this.permissions.exclude = permissions;
} else {
this.permissions... | [
"function",
"(",
"permissions",
",",
"negative",
")",
"{",
"if",
"(",
"!",
"negative",
")",
"{",
"negative",
"=",
"false",
";",
"}",
"if",
"(",
"permissions",
"!==",
"null",
"&&",
"Array",
".",
"isArray",
"(",
"permissions",
")",
")",
"{",
"if",
"(",... | Sets the permissions to the view
@method setPermissions
@param {array} permissions The permissions to set
@param {boolean} negative Flag to set a nagative permission (optional)
@memberof Augmented.View | [
"Sets",
"the",
"permissions",
"to",
"the",
"view"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4420-L4431 | |
57,526 | Augmentedjs/augmented | scripts/core/augmented.js | function(match, negative) {
if (!negative) {
negative = false;
}
var p = (negative) ? this.permissions.exclude : this.permissions.include;
return (p.indexOf(match) !== -1);
} | javascript | function(match, negative) {
if (!negative) {
negative = false;
}
var p = (negative) ? this.permissions.exclude : this.permissions.include;
return (p.indexOf(match) !== -1);
} | [
"function",
"(",
"match",
",",
"negative",
")",
"{",
"if",
"(",
"!",
"negative",
")",
"{",
"negative",
"=",
"false",
";",
"}",
"var",
"p",
"=",
"(",
"negative",
")",
"?",
"this",
".",
"permissions",
".",
"exclude",
":",
"this",
".",
"permissions",
... | Matches a permission in the view
@method matchesPermission
@param {string} match The permissions to match
@param {boolean} negative Flag to set a nagative permission (optional)
@returns {boolean} Returns true if the match exists
@memberof Augmented.View | [
"Matches",
"a",
"permission",
"in",
"the",
"view"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/core/augmented.js#L4466-L4472 | |
57,527 | kaelzhang/node-mix2 | index.js | mix | function mix (r, s, or, cl) {
if (!s || !r) {
return r;
}
var i = 0,
c, len;
or = or || arguments.length === 2;
if (cl && (len = cl.length)) {
for (; i < len; i++) {
c = cl[i];
if ((c in s) && (or || !(c in r))) {
r[c] = s[c];
}
}
} else {
for (c in s) {
... | javascript | function mix (r, s, or, cl) {
if (!s || !r) {
return r;
}
var i = 0,
c, len;
or = or || arguments.length === 2;
if (cl && (len = cl.length)) {
for (; i < len; i++) {
c = cl[i];
if ((c in s) && (or || !(c in r))) {
r[c] = s[c];
}
}
} else {
for (c in s) {
... | [
"function",
"mix",
"(",
"r",
",",
"s",
",",
"or",
",",
"cl",
")",
"{",
"if",
"(",
"!",
"s",
"||",
"!",
"r",
")",
"{",
"return",
"r",
";",
"}",
"var",
"i",
"=",
"0",
",",
"c",
",",
"len",
";",
"or",
"=",
"or",
"||",
"arguments",
".",
"le... | copy all properties in the supplier to the receiver @param r {Object} receiver @param s {Object} supplier @param or {boolean=} whether override the existing property in the receiver @param cl {(Array.<string>)=} copy list, an array of selected properties | [
"copy",
"all",
"properties",
"in",
"the",
"supplier",
"to",
"the",
"receiver"
] | 23490e0bb671664cbfa7aa6033e364560878bbe3 | https://github.com/kaelzhang/node-mix2/blob/23490e0bb671664cbfa7aa6033e364560878bbe3/index.js#L11-L36 |
57,528 | jmchilton/pyre-to-regexp | index.js | pyre | function pyre(pattern, namedCaptures) {
pattern = String(pattern || '').trim();
// populate namedCaptures array and removed named captures from the `pattern`
namedCaptures = namedCaptures == undefined ? [] : namedCaptures;
var numGroups = 0;
pattern = replaceCaptureGroups(pattern, function (group) {
if (... | javascript | function pyre(pattern, namedCaptures) {
pattern = String(pattern || '').trim();
// populate namedCaptures array and removed named captures from the `pattern`
namedCaptures = namedCaptures == undefined ? [] : namedCaptures;
var numGroups = 0;
pattern = replaceCaptureGroups(pattern, function (group) {
if (... | [
"function",
"pyre",
"(",
"pattern",
",",
"namedCaptures",
")",
"{",
"pattern",
"=",
"String",
"(",
"pattern",
"||",
"''",
")",
".",
"trim",
"(",
")",
";",
"// populate namedCaptures array and removed named captures from the `pattern`",
"namedCaptures",
"=",
"namedCapt... | Returns a JavaScript RegExp instance from the given Python-like string.
An empty array may be passsed in as the second argument, which will be
populated with the "named capture group" names as Strings in the Array,
once the RegExp has been returned.
@param {String} pattern - Python-like regexp string to compile to a ... | [
"Returns",
"a",
"JavaScript",
"RegExp",
"instance",
"from",
"the",
"given",
"Python",
"-",
"like",
"string",
"."
] | 1adc49fee33096c8d93dfcd26d13b3600c425ce0 | https://github.com/jmchilton/pyre-to-regexp/blob/1adc49fee33096c8d93dfcd26d13b3600c425ce0/index.js#L18-L50 |
57,529 | kaelzhang/neuron-module-bundler | lib/unwrap.js | unwrapAst | function unwrapAst (ast, prefix, suffix) {
let fake_code = `${prefix}\nlet ${LONG_AND_WEIRED_STRING}\n${suffix}`
let fake_ast = babylon.parse(fake_code, {
sourceType: 'module'
})
let selected_node
let selected_index
traverse(fake_ast, {
enter: function (node, parent) {
// removes the loc info... | javascript | function unwrapAst (ast, prefix, suffix) {
let fake_code = `${prefix}\nlet ${LONG_AND_WEIRED_STRING}\n${suffix}`
let fake_ast = babylon.parse(fake_code, {
sourceType: 'module'
})
let selected_node
let selected_index
traverse(fake_ast, {
enter: function (node, parent) {
// removes the loc info... | [
"function",
"unwrapAst",
"(",
"ast",
",",
"prefix",
",",
"suffix",
")",
"{",
"let",
"fake_code",
"=",
"`",
"${",
"prefix",
"}",
"\\n",
"${",
"LONG_AND_WEIRED_STRING",
"}",
"\\n",
"${",
"suffix",
"}",
"`",
"let",
"fake_ast",
"=",
"babylon",
".",
"parse",
... | Based on the situation that neuron wrappings are always functions with no statements within the bodies or statements at the beginning of function bodies | [
"Based",
"on",
"the",
"situation",
"that",
"neuron",
"wrappings",
"are",
"always",
"functions",
"with",
"no",
"statements",
"within",
"the",
"bodies",
"or",
"statements",
"at",
"the",
"beginning",
"of",
"function",
"bodies"
] | ddf458a80c8e973d0312f800a83293345d073e11 | https://github.com/kaelzhang/neuron-module-bundler/blob/ddf458a80c8e973d0312f800a83293345d073e11/lib/unwrap.js#L54-L105 |
57,530 | raincatcher-beta/raincatcher-sync | lib/client/mediator-subscribers/index.js | function(datasetId) {
if (syncSubscribers && datasetId && syncSubscribers[datasetId]) {
syncSubscribers[datasetId].unsubscribeAll();
delete syncSubscribers[datasetId];
}
} | javascript | function(datasetId) {
if (syncSubscribers && datasetId && syncSubscribers[datasetId]) {
syncSubscribers[datasetId].unsubscribeAll();
delete syncSubscribers[datasetId];
}
} | [
"function",
"(",
"datasetId",
")",
"{",
"if",
"(",
"syncSubscribers",
"&&",
"datasetId",
"&&",
"syncSubscribers",
"[",
"datasetId",
"]",
")",
"{",
"syncSubscribers",
"[",
"datasetId",
"]",
".",
"unsubscribeAll",
"(",
")",
";",
"delete",
"syncSubscribers",
"[",... | Removing any subscribers for a specific data set
@param {string} datasetId - The identifier for the data set. | [
"Removing",
"any",
"subscribers",
"for",
"a",
"specific",
"data",
"set"
] | a51eeb8fdea30a6afdcd0587019bd1148bf30468 | https://github.com/raincatcher-beta/raincatcher-sync/blob/a51eeb8fdea30a6afdcd0587019bd1148bf30468/lib/client/mediator-subscribers/index.js#L64-L69 | |
57,531 | sendanor/nor-api-profile | src/validity.js | create_message | function create_message(req, data) {
debug.assert(data).is('object');
if(!is.uuid(data.$id)) {
data.$id = require('node-uuid').v4();
}
req.session.client.messages[data.$id] = data;
} | javascript | function create_message(req, data) {
debug.assert(data).is('object');
if(!is.uuid(data.$id)) {
data.$id = require('node-uuid').v4();
}
req.session.client.messages[data.$id] = data;
} | [
"function",
"create_message",
"(",
"req",
",",
"data",
")",
"{",
"debug",
".",
"assert",
"(",
"data",
")",
".",
"is",
"(",
"'object'",
")",
";",
"if",
"(",
"!",
"is",
".",
"uuid",
"(",
"data",
".",
"$id",
")",
")",
"{",
"data",
".",
"$id",
"=",... | Add a message
@fixme This code should be from session.js somehow | [
"Add",
"a",
"message"
] | 5938f8b0c8e3c27062856f2d70e98d20fa78af8f | https://github.com/sendanor/nor-api-profile/blob/5938f8b0c8e3c27062856f2d70e98d20fa78af8f/src/validity.js#L200-L206 |
57,532 | alexindigo/multibundle | bundler.js | hookStdout | function hookStdout(callback)
{
process.stdout._oWrite = process.stdout.write;
// take control
process.stdout.write = function(string, encoding, fd)
{
callback(string, encoding, fd);
};
// reverse it
return function()
{
process.stdout.write = process.stdout._oWrite;
};
} | javascript | function hookStdout(callback)
{
process.stdout._oWrite = process.stdout.write;
// take control
process.stdout.write = function(string, encoding, fd)
{
callback(string, encoding, fd);
};
// reverse it
return function()
{
process.stdout.write = process.stdout._oWrite;
};
} | [
"function",
"hookStdout",
"(",
"callback",
")",
"{",
"process",
".",
"stdout",
".",
"_oWrite",
"=",
"process",
".",
"stdout",
".",
"write",
";",
"// take control",
"process",
".",
"stdout",
".",
"write",
"=",
"function",
"(",
"string",
",",
"encoding",
","... | Hooks into stdout stream
to snitch on passed data
@param {function} callback - invoked on each passing chunk
@returns {function} - snitching-cancel function | [
"Hooks",
"into",
"stdout",
"stream",
"to",
"snitch",
"on",
"passed",
"data"
] | 3eac4c590600cc71cd8dc18119187cc73c9175bb | https://github.com/alexindigo/multibundle/blob/3eac4c590600cc71cd8dc18119187cc73c9175bb/bundler.js#L46-L61 |
57,533 | EyalAr/fume | lib/fume.js | Fume | function Fume(sources, config) {
config = config || {};
config.nameTagPrefix = config.nameTagPrefix || NAME_TAG_PREFIX;
config.preferTagPrefix = config.preferTagPrefix || PREFER_TAG_PREFIX;
config.amdTagPrefix = config.amdTagPrefix || AMD_TAG_PREFIX;
config.cjsTagPrefix = config... | javascript | function Fume(sources, config) {
config = config || {};
config.nameTagPrefix = config.nameTagPrefix || NAME_TAG_PREFIX;
config.preferTagPrefix = config.preferTagPrefix || PREFER_TAG_PREFIX;
config.amdTagPrefix = config.amdTagPrefix || AMD_TAG_PREFIX;
config.cjsTagPrefix = config... | [
"function",
"Fume",
"(",
"sources",
",",
"config",
")",
"{",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"config",
".",
"nameTagPrefix",
"=",
"config",
".",
"nameTagPrefix",
"||",
"NAME_TAG_PREFIX",
";",
"config",
".",
"preferTagPrefix",
"=",
"config",
"... | Parse the list of sources | [
"Parse",
"the",
"list",
"of",
"sources"
] | 66f555d39b9cee18bbdf7a0a565919247163a227 | https://github.com/EyalAr/fume/blob/66f555d39b9cee18bbdf7a0a565919247163a227/lib/fume.js#L52-L169 |
57,534 | EyalAr/fume | lib/fume.js | amdWrap | function amdWrap(factoryCode, deps) {
var deps = deps.map(function (dep) {
return "'" + dep + "'";
});
return AMD_TEMPLATE.START +
deps.join(',') +
AMD_TEMPLATE.MIDDLE +
factoryCode +
AMD_TEMPLATE.END;
} | javascript | function amdWrap(factoryCode, deps) {
var deps = deps.map(function (dep) {
return "'" + dep + "'";
});
return AMD_TEMPLATE.START +
deps.join(',') +
AMD_TEMPLATE.MIDDLE +
factoryCode +
AMD_TEMPLATE.END;
} | [
"function",
"amdWrap",
"(",
"factoryCode",
",",
"deps",
")",
"{",
"var",
"deps",
"=",
"deps",
".",
"map",
"(",
"function",
"(",
"dep",
")",
"{",
"return",
"\"'\"",
"+",
"dep",
"+",
"\"'\"",
";",
"}",
")",
";",
"return",
"AMD_TEMPLATE",
".",
"START",
... | Wrap a factory with an AMD loader. | [
"Wrap",
"a",
"factory",
"with",
"an",
"AMD",
"loader",
"."
] | 66f555d39b9cee18bbdf7a0a565919247163a227 | https://github.com/EyalAr/fume/blob/66f555d39b9cee18bbdf7a0a565919247163a227/lib/fume.js#L276-L285 |
57,535 | EyalAr/fume | lib/fume.js | cjsWrap | function cjsWrap(factoryCode, deps) {
var requires = deps.map(function (dep) {
return "require('" + dep + "')";
});
return CJS_TEMPLATE.START +
factoryCode +
CJS_TEMPLATE.MIDDLE +
requires.join(',') +
CJS_TEMPLATE.END;
} | javascript | function cjsWrap(factoryCode, deps) {
var requires = deps.map(function (dep) {
return "require('" + dep + "')";
});
return CJS_TEMPLATE.START +
factoryCode +
CJS_TEMPLATE.MIDDLE +
requires.join(',') +
CJS_TEMPLATE.END;
} | [
"function",
"cjsWrap",
"(",
"factoryCode",
",",
"deps",
")",
"{",
"var",
"requires",
"=",
"deps",
".",
"map",
"(",
"function",
"(",
"dep",
")",
"{",
"return",
"\"require('\"",
"+",
"dep",
"+",
"\"')\"",
";",
"}",
")",
";",
"return",
"CJS_TEMPLATE",
"."... | Wrap a factory with a CJS loader. | [
"Wrap",
"a",
"factory",
"with",
"a",
"CJS",
"loader",
"."
] | 66f555d39b9cee18bbdf7a0a565919247163a227 | https://github.com/EyalAr/fume/blob/66f555d39b9cee18bbdf7a0a565919247163a227/lib/fume.js#L290-L299 |
57,536 | bmustiata/tsdlocal | tasks/tsdlocal.js | ensureFolderExists | function ensureFolderExists(file) {
var folderName = path.dirname(file);
if (fs.existsSync(folderName)) {
return;
}
try {
mkdirp.sync(folderName);
}
catch (e) {
console.log(colors.red("Unable to create parent folders for: " + file), e);
}
} | javascript | function ensureFolderExists(file) {
var folderName = path.dirname(file);
if (fs.existsSync(folderName)) {
return;
}
try {
mkdirp.sync(folderName);
}
catch (e) {
console.log(colors.red("Unable to create parent folders for: " + file), e);
}
} | [
"function",
"ensureFolderExists",
"(",
"file",
")",
"{",
"var",
"folderName",
"=",
"path",
".",
"dirname",
"(",
"file",
")",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"folderName",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"mkdirp",
".",
"sy... | Ensures the parent folders for the given file name exists. | [
"Ensures",
"the",
"parent",
"folders",
"for",
"the",
"given",
"file",
"name",
"exists",
"."
] | 584bc9974337e54eb30897f1a9b2417210e6b968 | https://github.com/bmustiata/tsdlocal/blob/584bc9974337e54eb30897f1a9b2417210e6b968/tasks/tsdlocal.js#L103-L114 |
57,537 | camshaft/node-env-builder | index.js | mergeTypes | function mergeTypes(env, types, conf, ENV, fn) {
fetch(conf, 'types', function(err, layout) {
if (err) return fn(err);
debug('# TYPES');
var batch = new Batch();
batch.concurrency(1);
types.forEach(function(type) {
batch.push(function(cb) {
debug(type);
mergeConf(env, layo... | javascript | function mergeTypes(env, types, conf, ENV, fn) {
fetch(conf, 'types', function(err, layout) {
if (err) return fn(err);
debug('# TYPES');
var batch = new Batch();
batch.concurrency(1);
types.forEach(function(type) {
batch.push(function(cb) {
debug(type);
mergeConf(env, layo... | [
"function",
"mergeTypes",
"(",
"env",
",",
"types",
",",
"conf",
",",
"ENV",
",",
"fn",
")",
"{",
"fetch",
"(",
"conf",
",",
"'types'",
",",
"function",
"(",
"err",
",",
"layout",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fn",
"(",
"err",
")",
... | Merge types into ENV
@param {String} env
@param {Array} types
@param {Object} conf
@param {Object} ENV
@param {Function} fn | [
"Merge",
"types",
"into",
"ENV"
] | b9ae640bbfbccccaebcfa19ec65392da042a49e9 | https://github.com/camshaft/node-env-builder/blob/b9ae640bbfbccccaebcfa19ec65392da042a49e9/index.js#L54-L72 |
57,538 | camshaft/node-env-builder | index.js | mergeApp | function mergeApp(env, app, conf, ENV, fn) {
fetch(conf, 'apps', function(err, apps) {
if (err) return fn(err);
debug('# APP');
debug(app);
mergeConf(env, apps, app, ENV, fn);
});
} | javascript | function mergeApp(env, app, conf, ENV, fn) {
fetch(conf, 'apps', function(err, apps) {
if (err) return fn(err);
debug('# APP');
debug(app);
mergeConf(env, apps, app, ENV, fn);
});
} | [
"function",
"mergeApp",
"(",
"env",
",",
"app",
",",
"conf",
",",
"ENV",
",",
"fn",
")",
"{",
"fetch",
"(",
"conf",
",",
"'apps'",
",",
"function",
"(",
"err",
",",
"apps",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fn",
"(",
"err",
")",
";",
... | Merge app into ENV
@param {String} env
@param {String} app
@param {Object} conf
@param {Object} ENV
@param {Function} fn | [
"Merge",
"app",
"into",
"ENV"
] | b9ae640bbfbccccaebcfa19ec65392da042a49e9 | https://github.com/camshaft/node-env-builder/blob/b9ae640bbfbccccaebcfa19ec65392da042a49e9/index.js#L84-L91 |
57,539 | camshaft/node-env-builder | index.js | mergeConf | function mergeConf(env, conf, key, ENV, fn) {
fetch(conf, key, function(err, layout) {
if (err) return fn(err);
fetch(layout, 'default', function(err, defaults) {
if (err) return fn(err);
debug(' default', defaults);
merge(ENV, defaults);
debug(' ', ENV);
fetch(layout, env... | javascript | function mergeConf(env, conf, key, ENV, fn) {
fetch(conf, key, function(err, layout) {
if (err) return fn(err);
fetch(layout, 'default', function(err, defaults) {
if (err) return fn(err);
debug(' default', defaults);
merge(ENV, defaults);
debug(' ', ENV);
fetch(layout, env... | [
"function",
"mergeConf",
"(",
"env",
",",
"conf",
",",
"key",
",",
"ENV",
",",
"fn",
")",
"{",
"fetch",
"(",
"conf",
",",
"key",
",",
"function",
"(",
"err",
",",
"layout",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fn",
"(",
"err",
")",
";",
... | Merge conf into ENV
@param {String} env
@param {Object} conf
@param {String} key
@param {Object} ENV
@param {Function} fn | [
"Merge",
"conf",
"into",
"ENV"
] | b9ae640bbfbccccaebcfa19ec65392da042a49e9 | https://github.com/camshaft/node-env-builder/blob/b9ae640bbfbccccaebcfa19ec65392da042a49e9/index.js#L103-L125 |
57,540 | camshaft/node-env-builder | index.js | fetch | function fetch(conf, key, fn) {
getKey(conf, key, function(err, layout) {
if (err) return fn(err);
get(layout, fn);
});
} | javascript | function fetch(conf, key, fn) {
getKey(conf, key, function(err, layout) {
if (err) return fn(err);
get(layout, fn);
});
} | [
"function",
"fetch",
"(",
"conf",
",",
"key",
",",
"fn",
")",
"{",
"getKey",
"(",
"conf",
",",
"key",
",",
"function",
"(",
"err",
",",
"layout",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fn",
"(",
"err",
")",
";",
"get",
"(",
"layout",
",",
... | Fetch an object by key
@param {Object} conf
@param {String} key
@param {Function} fn | [
"Fetch",
"an",
"object",
"by",
"key"
] | b9ae640bbfbccccaebcfa19ec65392da042a49e9 | https://github.com/camshaft/node-env-builder/blob/b9ae640bbfbccccaebcfa19ec65392da042a49e9/index.js#L135-L140 |
57,541 | camshaft/node-env-builder | index.js | get | function get(obj, fn) {
if (typeof obj === 'object') return fn(null, obj);
if (typeof obj === 'undefined') return fn(null, {});
if (typeof obj !== 'function') return fn(new Error('cannot read conf:\n' + obj));
if (obj.length === 1) return obj(fn);
var val;
try {
val = obj();
} catch(err) {
return ... | javascript | function get(obj, fn) {
if (typeof obj === 'object') return fn(null, obj);
if (typeof obj === 'undefined') return fn(null, {});
if (typeof obj !== 'function') return fn(new Error('cannot read conf:\n' + obj));
if (obj.length === 1) return obj(fn);
var val;
try {
val = obj();
} catch(err) {
return ... | [
"function",
"get",
"(",
"obj",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"obj",
"===",
"'object'",
")",
"return",
"fn",
"(",
"null",
",",
"obj",
")",
";",
"if",
"(",
"typeof",
"obj",
"===",
"'undefined'",
")",
"return",
"fn",
"(",
"null",
",",
"{... | Lazily evaluate the value
@param {Any} obj
@param {Function} fn | [
"Lazily",
"evaluate",
"the",
"value"
] | b9ae640bbfbccccaebcfa19ec65392da042a49e9 | https://github.com/camshaft/node-env-builder/blob/b9ae640bbfbccccaebcfa19ec65392da042a49e9/index.js#L171-L183 |
57,542 | puranjayjain/gulp-replace-frommap | index.js | getIndexOf | function getIndexOf(string, find) {
// if regex then do it regex way
if(XRegExp.isRegExp(find)) {
return string.search(find);
} else {
// normal way
return string.indexOf(find);
}
} | javascript | function getIndexOf(string, find) {
// if regex then do it regex way
if(XRegExp.isRegExp(find)) {
return string.search(find);
} else {
// normal way
return string.indexOf(find);
}
} | [
"function",
"getIndexOf",
"(",
"string",
",",
"find",
")",
"{",
"// if regex then do it regex way",
"if",
"(",
"XRegExp",
".",
"isRegExp",
"(",
"find",
")",
")",
"{",
"return",
"string",
".",
"search",
"(",
"find",
")",
";",
"}",
"else",
"{",
"// normal wa... | get index of using regex or normal way -1 other wise | [
"get",
"index",
"of",
"using",
"regex",
"or",
"normal",
"way",
"-",
"1",
"other",
"wise"
] | def6b6345ebf5341e46ddfe05d7d09974180c718 | https://github.com/puranjayjain/gulp-replace-frommap/blob/def6b6345ebf5341e46ddfe05d7d09974180c718/index.js#L112-L120 |
57,543 | puranjayjain/gulp-replace-frommap | index.js | getStringWithLength | function getStringWithLength(string, find) {
let obj;
// if regex then do it regex way
if(XRegExp.isRegExp(find)) {
obj = {
textValue: XRegExp.replace(string, find, '$1', 'one'),
textLength: XRegExp.match(string, /class/g, 'one')
.length
};
return;
} else {
... | javascript | function getStringWithLength(string, find) {
let obj;
// if regex then do it regex way
if(XRegExp.isRegExp(find)) {
obj = {
textValue: XRegExp.replace(string, find, '$1', 'one'),
textLength: XRegExp.match(string, /class/g, 'one')
.length
};
return;
} else {
... | [
"function",
"getStringWithLength",
"(",
"string",
",",
"find",
")",
"{",
"let",
"obj",
";",
"// if regex then do it regex way",
"if",
"(",
"XRegExp",
".",
"isRegExp",
"(",
"find",
")",
")",
"{",
"obj",
"=",
"{",
"textValue",
":",
"XRegExp",
".",
"replace",
... | get the full matched regex string or the string itself along with it's length | [
"get",
"the",
"full",
"matched",
"regex",
"string",
"or",
"the",
"string",
"itself",
"along",
"with",
"it",
"s",
"length"
] | def6b6345ebf5341e46ddfe05d7d09974180c718 | https://github.com/puranjayjain/gulp-replace-frommap/blob/def6b6345ebf5341e46ddfe05d7d09974180c718/index.js#L123-L140 |
57,544 | puranjayjain/gulp-replace-frommap | index.js | replaceTextWithMap | function replaceTextWithMap(string, map) {
// break the words into tokens using _ and words themselves
const tokens = XRegExp.match(string, /([a-z0-9_]+)/ig);
// for all the tokens replace it in string
for(let token of tokens) {
// try to replace only if the key exists in the map else skip over
... | javascript | function replaceTextWithMap(string, map) {
// break the words into tokens using _ and words themselves
const tokens = XRegExp.match(string, /([a-z0-9_]+)/ig);
// for all the tokens replace it in string
for(let token of tokens) {
// try to replace only if the key exists in the map else skip over
... | [
"function",
"replaceTextWithMap",
"(",
"string",
",",
"map",
")",
"{",
"// break the words into tokens using _ and words themselves",
"const",
"tokens",
"=",
"XRegExp",
".",
"match",
"(",
"string",
",",
"/",
"([a-z0-9_]+)",
"/",
"ig",
")",
";",
"// for all the tokens ... | replace until all of the map has are exhausted | [
"replace",
"until",
"all",
"of",
"the",
"map",
"has",
"are",
"exhausted"
] | def6b6345ebf5341e46ddfe05d7d09974180c718 | https://github.com/puranjayjain/gulp-replace-frommap/blob/def6b6345ebf5341e46ddfe05d7d09974180c718/index.js#L143-L154 |
57,545 | Industryswarm/isnode-mod-data | lib/mysql/mysql/index.js | loadClass | function loadClass(className) {
var Class = Classes[className];
if (Class !== undefined) {
return Class;
}
// This uses a switch for static require analysis
switch (className) {
case 'Connection':
Class = require('./lib/Connection');
break;
case 'ConnectionConfig':
Class = requ... | javascript | function loadClass(className) {
var Class = Classes[className];
if (Class !== undefined) {
return Class;
}
// This uses a switch for static require analysis
switch (className) {
case 'Connection':
Class = require('./lib/Connection');
break;
case 'ConnectionConfig':
Class = requ... | [
"function",
"loadClass",
"(",
"className",
")",
"{",
"var",
"Class",
"=",
"Classes",
"[",
"className",
"]",
";",
"if",
"(",
"Class",
"!==",
"undefined",
")",
"{",
"return",
"Class",
";",
"}",
"// This uses a switch for static require analysis",
"switch",
"(",
... | Load the given class.
@param {string} className Name of class to default
@return {function|object} Class constructor or exports
@private | [
"Load",
"the",
"given",
"class",
"."
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mysql/mysql/index.js#L123-L161 |
57,546 | Ma3Route/node-sdk | lib/generate.js | newGet | function newGet(endpoint, allowable) {
return function(params, callback) {
// allow options params
var args = utils.allowOptionalParams(params, callback);
// get and detach/remove the uri options
var uriOptions = utils.getURIOptions([utils.setup(), this, args.params]);
utils.... | javascript | function newGet(endpoint, allowable) {
return function(params, callback) {
// allow options params
var args = utils.allowOptionalParams(params, callback);
// get and detach/remove the uri options
var uriOptions = utils.getURIOptions([utils.setup(), this, args.params]);
utils.... | [
"function",
"newGet",
"(",
"endpoint",
",",
"allowable",
")",
"{",
"return",
"function",
"(",
"params",
",",
"callback",
")",
"{",
"// allow options params",
"var",
"args",
"=",
"utils",
".",
"allowOptionalParams",
"(",
"params",
",",
"callback",
")",
";",
"... | Return a function for retrieving one or more items
@param {Endpoint} endpoint
@param {String[]} [allowable]
@return {itemsGetRequest} | [
"Return",
"a",
"function",
"for",
"retrieving",
"one",
"or",
"more",
"items"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L40-L67 |
57,547 | Ma3Route/node-sdk | lib/generate.js | newGetOne | function newGetOne(endpoint, allowable) {
var get = newGet(endpoint, allowable);
return function(id, params, callback) {
var args = utils.allowOptionalParams(params, callback);
if (typeof id === "object") {
_.assign(args.params, id);
} else {
args.params.id = id;
... | javascript | function newGetOne(endpoint, allowable) {
var get = newGet(endpoint, allowable);
return function(id, params, callback) {
var args = utils.allowOptionalParams(params, callback);
if (typeof id === "object") {
_.assign(args.params, id);
} else {
args.params.id = id;
... | [
"function",
"newGetOne",
"(",
"endpoint",
",",
"allowable",
")",
"{",
"var",
"get",
"=",
"newGet",
"(",
"endpoint",
",",
"allowable",
")",
";",
"return",
"function",
"(",
"id",
",",
"params",
",",
"callback",
")",
"{",
"var",
"args",
"=",
"utils",
".",... | Return a function for retrieving one item
@param {Endpoint} endpoint
@param {String[]} [allowable]
@return {itemsGetOneRequest} | [
"Return",
"a",
"function",
"for",
"retrieving",
"one",
"item"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L77-L89 |
57,548 | Ma3Route/node-sdk | lib/generate.js | newPostOne | function newPostOne(endpoint, options) {
// for backwards-compatibility <= 0.11.1
if (_.isArray(options)) {
options = { allowable: options };
}
options = _.defaultsDeep({}, options, {
allowable: [],
method: "post",
});
return function(body, callback) {
// get and... | javascript | function newPostOne(endpoint, options) {
// for backwards-compatibility <= 0.11.1
if (_.isArray(options)) {
options = { allowable: options };
}
options = _.defaultsDeep({}, options, {
allowable: [],
method: "post",
});
return function(body, callback) {
// get and... | [
"function",
"newPostOne",
"(",
"endpoint",
",",
"options",
")",
"{",
"// for backwards-compatibility <= 0.11.1",
"if",
"(",
"_",
".",
"isArray",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"allowable",
":",
"options",
"}",
";",
"}",
"options",
"=",
... | Return a function for posting items
@param {Endpoint} endpoint
@param {Object} [options]
@param {String[]} [options.allowable]
@param {String} [options.method=post]
@param {Number} [options.apiVersion=2] API version used
@return {itemsPostOneRequest} | [
"Return",
"a",
"function",
"for",
"posting",
"items"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L102-L152 |
57,549 | Ma3Route/node-sdk | lib/generate.js | newCustomPostOne | function newCustomPostOne(endpoint, initParams, allowable) {
var modify = newPostOne(endpoint, allowable);
return function(body, callback) {
_.assign(body, initParams);
return modify.call(this, body, callback);
};
} | javascript | function newCustomPostOne(endpoint, initParams, allowable) {
var modify = newPostOne(endpoint, allowable);
return function(body, callback) {
_.assign(body, initParams);
return modify.call(this, body, callback);
};
} | [
"function",
"newCustomPostOne",
"(",
"endpoint",
",",
"initParams",
",",
"allowable",
")",
"{",
"var",
"modify",
"=",
"newPostOne",
"(",
"endpoint",
",",
"allowable",
")",
";",
"return",
"function",
"(",
"body",
",",
"callback",
")",
"{",
"_",
".",
"assign... | Return a function for custom Post requests
@param {Endpoint} endpoint
@param {Object} initParams - parameters used to indicate we are infact modifying
@param {String[]} [allowable]
@return {itemsPostOneRequest} | [
"Return",
"a",
"function",
"for",
"custom",
"Post",
"requests"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L163-L169 |
57,550 | Ma3Route/node-sdk | lib/generate.js | newPutOne | function newPutOne(endpoint, options) {
// for backwards-compatibility <= 0.11.1
if (_.isArray(options)) options = { allowable: options };
else options = options || {};
options.method = "put";
return newPostOne(endpoint, options);
} | javascript | function newPutOne(endpoint, options) {
// for backwards-compatibility <= 0.11.1
if (_.isArray(options)) options = { allowable: options };
else options = options || {};
options.method = "put";
return newPostOne(endpoint, options);
} | [
"function",
"newPutOne",
"(",
"endpoint",
",",
"options",
")",
"{",
"// for backwards-compatibility <= 0.11.1",
"if",
"(",
"_",
".",
"isArray",
"(",
"options",
")",
")",
"options",
"=",
"{",
"allowable",
":",
"options",
"}",
";",
"else",
"options",
"=",
"opt... | Return a function for editing an item
@param {String} endpoint
@param {Object} [options] Passed to {@link module:generate~newPostOne}
@return {itemsPutOneRequest} | [
"Return",
"a",
"function",
"for",
"editing",
"an",
"item"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L179-L185 |
57,551 | Ma3Route/node-sdk | lib/generate.js | newSSEClientFactory | function newSSEClientFactory(endpoint) {
return function(initDict) {
initDict = initDict || { };
// get URI options
var uriOptions = utils.getURIOptions(initDict);
utils.removeURIOptions(initDict);
// create a new URI
var uri = utils.url(endpoint, uriOptions);
... | javascript | function newSSEClientFactory(endpoint) {
return function(initDict) {
initDict = initDict || { };
// get URI options
var uriOptions = utils.getURIOptions(initDict);
utils.removeURIOptions(initDict);
// create a new URI
var uri = utils.url(endpoint, uriOptions);
... | [
"function",
"newSSEClientFactory",
"(",
"endpoint",
")",
"{",
"return",
"function",
"(",
"initDict",
")",
"{",
"initDict",
"=",
"initDict",
"||",
"{",
"}",
";",
"// get URI options",
"var",
"uriOptions",
"=",
"utils",
".",
"getURIOptions",
"(",
"initDict",
")"... | Return a function that returns a SSE client
@param {Endpoint} endpoint
@return {SSEClientFactory}
@throws Error | [
"Return",
"a",
"function",
"that",
"returns",
"a",
"SSE",
"client"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/generate.js#L195-L210 |
57,552 | Antyfive/teo-html-compressor-extension | index.js | Compressor | function Compressor() {
var self = this;
var regexps = [/[\n\r\t]+/g, /\s{2,}/g];
/**
* Remover of the html comment blocks
* @param html
* @returns {*}
* @private
*/
function _clearHTMLComments(html) {
var cStart = '<!--',
cEnd = '-->',
beg = htm... | javascript | function Compressor() {
var self = this;
var regexps = [/[\n\r\t]+/g, /\s{2,}/g];
/**
* Remover of the html comment blocks
* @param html
* @returns {*}
* @private
*/
function _clearHTMLComments(html) {
var cStart = '<!--',
cEnd = '-->',
beg = htm... | [
"function",
"Compressor",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"regexps",
"=",
"[",
"/",
"[\\n\\r\\t]+",
"/",
"g",
",",
"/",
"\\s{2,}",
"/",
"g",
"]",
";",
"/**\n * Remover of the html comment blocks\n * @param html\n * @returns {*}\n ... | Compressor of the output html
@returns {Compressor}
@constructor | [
"Compressor",
"of",
"the",
"output",
"html"
] | 34d10a92b21ec2357c9e8512df358e19741e174d | https://github.com/Antyfive/teo-html-compressor-extension/blob/34d10a92b21ec2357c9e8512df358e19741e174d/index.js#L14-L115 |
57,553 | Antyfive/teo-html-compressor-extension | index.js | _clearHTMLComments | function _clearHTMLComments(html) {
var cStart = '<!--',
cEnd = '-->',
beg = html.indexOf(cStart),
end = 0;
while (beg !== -1) {
end = html.indexOf(cEnd, beg + 4);
if (end === -1) {
break;
}
var commen... | javascript | function _clearHTMLComments(html) {
var cStart = '<!--',
cEnd = '-->',
beg = html.indexOf(cStart),
end = 0;
while (beg !== -1) {
end = html.indexOf(cEnd, beg + 4);
if (end === -1) {
break;
}
var commen... | [
"function",
"_clearHTMLComments",
"(",
"html",
")",
"{",
"var",
"cStart",
"=",
"'<!--'",
",",
"cEnd",
"=",
"'-->'",
",",
"beg",
"=",
"html",
".",
"indexOf",
"(",
"cStart",
")",
",",
"end",
"=",
"0",
";",
"while",
"(",
"beg",
"!==",
"-",
"1",
")",
... | Remover of the html comment blocks
@param html
@returns {*}
@private | [
"Remover",
"of",
"the",
"html",
"comment",
"blocks"
] | 34d10a92b21ec2357c9e8512df358e19741e174d | https://github.com/Antyfive/teo-html-compressor-extension/blob/34d10a92b21ec2357c9e8512df358e19741e174d/index.js#L24-L49 |
57,554 | nodys/cssy | lib/processor.js | function (ctx, next) {
var plugins = []
var config = process.cssy.config
ctx.imports = []
var parseImportPlugin = postcss.plugin('cssy-parse-imports', function () {
return function (styles) {
styles.walkAtRules(function (atRule) {
if (atRule.name !==... | javascript | function (ctx, next) {
var plugins = []
var config = process.cssy.config
ctx.imports = []
var parseImportPlugin = postcss.plugin('cssy-parse-imports', function () {
return function (styles) {
styles.walkAtRules(function (atRule) {
if (atRule.name !==... | [
"function",
"(",
"ctx",
",",
"next",
")",
"{",
"var",
"plugins",
"=",
"[",
"]",
"var",
"config",
"=",
"process",
".",
"cssy",
".",
"config",
"ctx",
".",
"imports",
"=",
"[",
"]",
"var",
"parseImportPlugin",
"=",
"postcss",
".",
"plugin",
"(",
"'cssy-... | 6. Extract importations and generate source | [
"6",
".",
"Extract",
"importations",
"and",
"generate",
"source"
] | 7b43cf7cfd1899ad54adcbae2701373cff5077a3 | https://github.com/nodys/cssy/blob/7b43cf7cfd1899ad54adcbae2701373cff5077a3/lib/processor.js#L138-L187 | |
57,555 | nodys/cssy | lib/processor.js | parseCss | function parseCss (ctx, done) {
var result
try {
result = postcss()
.process(ctx.src, {
map: {
sourcesContent: true,
annotation: false,
prev: ctx.map
},
from: ctx.filename
})
ctx.src = result.css
ctx.map = result.map.toJSON()
done(nul... | javascript | function parseCss (ctx, done) {
var result
try {
result = postcss()
.process(ctx.src, {
map: {
sourcesContent: true,
annotation: false,
prev: ctx.map
},
from: ctx.filename
})
ctx.src = result.css
ctx.map = result.map.toJSON()
done(nul... | [
"function",
"parseCss",
"(",
"ctx",
",",
"done",
")",
"{",
"var",
"result",
"try",
"{",
"result",
"=",
"postcss",
"(",
")",
".",
"process",
"(",
"ctx",
".",
"src",
",",
"{",
"map",
":",
"{",
"sourcesContent",
":",
"true",
",",
"annotation",
":",
"f... | Default source parser for css source
@param {Object} ctx
Cssy context object with source
@param {Function} done
Async callback | [
"Default",
"source",
"parser",
"for",
"css",
"source"
] | 7b43cf7cfd1899ad54adcbae2701373cff5077a3 | https://github.com/nodys/cssy/blob/7b43cf7cfd1899ad54adcbae2701373cff5077a3/lib/processor.js#L202-L225 |
57,556 | sydneystockholm/blog.md | lib/network.js | Network | function Network(blogs) {
this.blogs = {};
this.loading = 0;
this.length = 1;
this.blog_names = [];
blogs = blogs || {};
for (var name in blogs) {
this.add(name, blogs[name]);
}
} | javascript | function Network(blogs) {
this.blogs = {};
this.loading = 0;
this.length = 1;
this.blog_names = [];
blogs = blogs || {};
for (var name in blogs) {
this.add(name, blogs[name]);
}
} | [
"function",
"Network",
"(",
"blogs",
")",
"{",
"this",
".",
"blogs",
"=",
"{",
"}",
";",
"this",
".",
"loading",
"=",
"0",
";",
"this",
".",
"length",
"=",
"1",
";",
"this",
".",
"blog_names",
"=",
"[",
"]",
";",
"blogs",
"=",
"blogs",
"||",
"{... | Create a new blog network.
@param {Object} blogs (optional) - { name: Blog, ... } | [
"Create",
"a",
"new",
"blog",
"network",
"."
] | 0b145fa1620cbe8b7296eb242241ee93223db9f9 | https://github.com/sydneystockholm/blog.md/blob/0b145fa1620cbe8b7296eb242241ee93223db9f9/lib/network.js#L12-L21 |
57,557 | ahwayakchih/serve-files | lib/MIME.js | getFromFileNameV1 | function getFromFileNameV1 (filename) {
var result = mime.lookup(filename);
// Add charset just in case for some buggy browsers.
if (result === 'application/javascript' || result === 'application/json' || result === 'text/plain') {
result += '; charset=UTF-8';
}
return result;
} | javascript | function getFromFileNameV1 (filename) {
var result = mime.lookup(filename);
// Add charset just in case for some buggy browsers.
if (result === 'application/javascript' || result === 'application/json' || result === 'text/plain') {
result += '; charset=UTF-8';
}
return result;
} | [
"function",
"getFromFileNameV1",
"(",
"filename",
")",
"{",
"var",
"result",
"=",
"mime",
".",
"lookup",
"(",
"filename",
")",
";",
"// Add charset just in case for some buggy browsers.",
"if",
"(",
"result",
"===",
"'application/javascript'",
"||",
"result",
"===",
... | Use `mime` v1.x to get type.
@param {String} filename can be a full path
@returns {String} mime type | [
"Use",
"mime",
"v1",
".",
"x",
"to",
"get",
"type",
"."
] | cd949252a37210bec229146ab519534ef641e942 | https://github.com/ahwayakchih/serve-files/blob/cd949252a37210bec229146ab519534ef641e942/lib/MIME.js#L72-L81 |
57,558 | ahwayakchih/serve-files | lib/MIME.js | getFromFileNameV2 | function getFromFileNameV2 (filename) {
var result = mime.getType(filename);
// Add charset just in case for some buggy browsers.
if (result === 'application/javascript' || result === 'application/json' || result === 'text/plain') {
result += '; charset=UTF-8';
}
return result;
} | javascript | function getFromFileNameV2 (filename) {
var result = mime.getType(filename);
// Add charset just in case for some buggy browsers.
if (result === 'application/javascript' || result === 'application/json' || result === 'text/plain') {
result += '; charset=UTF-8';
}
return result;
} | [
"function",
"getFromFileNameV2",
"(",
"filename",
")",
"{",
"var",
"result",
"=",
"mime",
".",
"getType",
"(",
"filename",
")",
";",
"// Add charset just in case for some buggy browsers.",
"if",
"(",
"result",
"===",
"'application/javascript'",
"||",
"result",
"===",
... | Use `mime` v2.x to get type.
@param {String} filename can be a full path
@returns {String} mime type | [
"Use",
"mime",
"v2",
".",
"x",
"to",
"get",
"type",
"."
] | cd949252a37210bec229146ab519534ef641e942 | https://github.com/ahwayakchih/serve-files/blob/cd949252a37210bec229146ab519534ef641e942/lib/MIME.js#L89-L98 |
57,559 | JulioGold/smart-utils | smartUtils.js | ListDirectoryContentRecursive | function ListDirectoryContentRecursive(directoryPath, callback) {
var fs = fs || require('fs');
var path = path || require('path');
var results = [];
fs.readdir(directoryPath, function(err, list) {
if (err) {
return callback(err);
}
var pending = list.length;
... | javascript | function ListDirectoryContentRecursive(directoryPath, callback) {
var fs = fs || require('fs');
var path = path || require('path');
var results = [];
fs.readdir(directoryPath, function(err, list) {
if (err) {
return callback(err);
}
var pending = list.length;
... | [
"function",
"ListDirectoryContentRecursive",
"(",
"directoryPath",
",",
"callback",
")",
"{",
"var",
"fs",
"=",
"fs",
"||",
"require",
"(",
"'fs'",
")",
";",
"var",
"path",
"=",
"path",
"||",
"require",
"(",
"'path'",
")",
";",
"var",
"results",
"=",
"["... | List all files and directories inside a directory recursive, that is asynchronous | [
"List",
"all",
"files",
"and",
"directories",
"inside",
"a",
"directory",
"recursive",
"that",
"is",
"asynchronous"
] | 2599e17dd5ed7ac656fc7518417a8e8419ea68b9 | https://github.com/JulioGold/smart-utils/blob/2599e17dd5ed7ac656fc7518417a8e8419ea68b9/smartUtils.js#L55-L99 |
57,560 | JulioGold/smart-utils | smartUtils.js | ObjectDeepFind | function ObjectDeepFind(obj, propertyPath) {
// Divide todas as propriedades pelo .
var paths = propertyPath.split('.');
// Copia o objeto
var currentObj = obj;
// Para cada propriedade vou pegar a próxima até encontrar o valor do path inteiro da propriedade
for (var i = 0; i < paths.length; ++i) {
... | javascript | function ObjectDeepFind(obj, propertyPath) {
// Divide todas as propriedades pelo .
var paths = propertyPath.split('.');
// Copia o objeto
var currentObj = obj;
// Para cada propriedade vou pegar a próxima até encontrar o valor do path inteiro da propriedade
for (var i = 0; i < paths.length; ++i) {
... | [
"function",
"ObjectDeepFind",
"(",
"obj",
",",
"propertyPath",
")",
"{",
"// Divide todas as propriedades pelo .",
"var",
"paths",
"=",
"propertyPath",
".",
"split",
"(",
"'.'",
")",
";",
"// Copia o objeto",
"var",
"currentObj",
"=",
"obj",
";",
"// Para cada propr... | Get the value of an property deep into in a object, or not. Do not ask me the utility of it ;D | [
"Get",
"the",
"value",
"of",
"an",
"property",
"deep",
"into",
"in",
"a",
"object",
"or",
"not",
".",
"Do",
"not",
"ask",
"me",
"the",
"utility",
"of",
"it",
";",
"D"
] | 2599e17dd5ed7ac656fc7518417a8e8419ea68b9 | https://github.com/JulioGold/smart-utils/blob/2599e17dd5ed7ac656fc7518417a8e8419ea68b9/smartUtils.js#L170-L188 |
57,561 | lookyhooky/toolchest | toolchest.js | curry | function curry (fn, ...args) {
if (args.length >= fn.length) {
return fn.apply(null, args)
} else {
return function (...rest) {
return curry(fn, ...args, ...rest)
}
}
} | javascript | function curry (fn, ...args) {
if (args.length >= fn.length) {
return fn.apply(null, args)
} else {
return function (...rest) {
return curry(fn, ...args, ...rest)
}
}
} | [
"function",
"curry",
"(",
"fn",
",",
"...",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
">=",
"fn",
".",
"length",
")",
"{",
"return",
"fn",
".",
"apply",
"(",
"null",
",",
"args",
")",
"}",
"else",
"{",
"return",
"function",
"(",
"...",
... | The All Mighty Curry!
Any extra arguments are to be handled by the curried function.
Note: Default and Rest parameters are not accounted for in Function#length.
So the curried function will be called as soon as it has recieved all regular
parameters. To utilize Rest parameters use curryN
By the way, the spread operat... | [
"The",
"All",
"Mighty",
"Curry!",
"Any",
"extra",
"arguments",
"are",
"to",
"be",
"handled",
"by",
"the",
"curried",
"function",
"."
] | d76213f27d87ca929b1f8652a45db5fab214e881 | https://github.com/lookyhooky/toolchest/blob/d76213f27d87ca929b1f8652a45db5fab214e881/toolchest.js#L284-L292 |
57,562 | thundernet8/mpvue-rc-loader | lib/loader.js | getRawRequest | function getRawRequest(context, excludedPreLoaders) {
excludedPreLoaders = excludedPreLoaders || /eslint-loader/;
return loaderUtils.getRemainingRequest({
resource: context.resource,
loaderIndex: context.loaderIndex,
loaders: context.loaders.filter(loader => !excludedPreLoaders.test(load... | javascript | function getRawRequest(context, excludedPreLoaders) {
excludedPreLoaders = excludedPreLoaders || /eslint-loader/;
return loaderUtils.getRemainingRequest({
resource: context.resource,
loaderIndex: context.loaderIndex,
loaders: context.loaders.filter(loader => !excludedPreLoaders.test(load... | [
"function",
"getRawRequest",
"(",
"context",
",",
"excludedPreLoaders",
")",
"{",
"excludedPreLoaders",
"=",
"excludedPreLoaders",
"||",
"/",
"eslint-loader",
"/",
";",
"return",
"loaderUtils",
".",
"getRemainingRequest",
"(",
"{",
"resource",
":",
"context",
".",
... | When extracting parts from the source vue file, we want to apply the loaders chained before vue-loader, but exclude some loaders that simply produces side effects such as linting. | [
"When",
"extracting",
"parts",
"from",
"the",
"source",
"vue",
"file",
"we",
"want",
"to",
"apply",
"the",
"loaders",
"chained",
"before",
"vue",
"-",
"loader",
"but",
"exclude",
"some",
"loaders",
"that",
"simply",
"produces",
"side",
"effects",
"such",
"as... | 9353432153abbddc2fa673f289edc39f35801b8f | https://github.com/thundernet8/mpvue-rc-loader/blob/9353432153abbddc2fa673f289edc39f35801b8f/lib/loader.js#L40-L47 |
57,563 | shinuza/captain-core | lib/models/tokens.js | findUserFromToken | function findUserFromToken(token, cb) {
var q = "SELECT * FROM users " +
"JOIN tokens t ON t.token = $1 " +
"JOIN users u ON u.id = t.user_id";
db.getClient(function(err, client, done) {
client.query(q, [token], function(err, r) {
var result = r && r.rows[0];
if(!result && !err) { err = new... | javascript | function findUserFromToken(token, cb) {
var q = "SELECT * FROM users " +
"JOIN tokens t ON t.token = $1 " +
"JOIN users u ON u.id = t.user_id";
db.getClient(function(err, client, done) {
client.query(q, [token], function(err, r) {
var result = r && r.rows[0];
if(!result && !err) { err = new... | [
"function",
"findUserFromToken",
"(",
"token",
",",
"cb",
")",
"{",
"var",
"q",
"=",
"\"SELECT * FROM users \"",
"+",
"\"JOIN tokens t ON t.token = $1 \"",
"+",
"\"JOIN users u ON u.id = t.user_id\"",
";",
"db",
".",
"getClient",
"(",
"function",
"(",
"err",
",",
"c... | Finds associated user with the token matching `token`
`cb` is passed with the matching user or exceptions.NotFound
@param {String} token
@param {Function} cb | [
"Finds",
"associated",
"user",
"with",
"the",
"token",
"matching",
"token"
] | 02f3a404cdfca608e8726bbacc33e32fec484b21 | https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/tokens.js#L92-L110 |
57,564 | shinuza/captain-core | lib/models/tokens.js | create | function create(body, cb) {
var validates = Schema(body);
if(!validates) {
return cb(new exceptions.BadRequest());
}
body.expires_at = stampify(conf.session_maxage);
var q = qb.insert(body);
db.getClient(function(err, client, done) {
client.query(q[0], q[1], function(err, r) {
if(err) {
... | javascript | function create(body, cb) {
var validates = Schema(body);
if(!validates) {
return cb(new exceptions.BadRequest());
}
body.expires_at = stampify(conf.session_maxage);
var q = qb.insert(body);
db.getClient(function(err, client, done) {
client.query(q[0], q[1], function(err, r) {
if(err) {
... | [
"function",
"create",
"(",
"body",
",",
"cb",
")",
"{",
"var",
"validates",
"=",
"Schema",
"(",
"body",
")",
";",
"if",
"(",
"!",
"validates",
")",
"{",
"return",
"cb",
"(",
"new",
"exceptions",
".",
"BadRequest",
"(",
")",
")",
";",
"}",
"body",
... | Creates a new token.
`cb` is passed with the newly created token or:
* exceptions.BadRequest: if `body` does not satisfy the schema
* exceptions.AlreadyExists: if a token with the same `token` already exists
@param {Object} body
@param {Function} cb | [
"Creates",
"a",
"new",
"token",
"."
] | 02f3a404cdfca608e8726bbacc33e32fec484b21 | https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/tokens.js#L125-L149 |
57,565 | shinuza/captain-core | lib/models/tokens.js | harvest | function harvest() {
var q = "DELETE FROM tokens WHERE expires_at < now() AT TIME ZONE 'UTC'";
db.getClient(function(err, client, done) {
client.query(q, function(err) {
if(err) {
console.error(new Date);
console.error(err.stack);
}
done(err);
});
});
} | javascript | function harvest() {
var q = "DELETE FROM tokens WHERE expires_at < now() AT TIME ZONE 'UTC'";
db.getClient(function(err, client, done) {
client.query(q, function(err) {
if(err) {
console.error(new Date);
console.error(err.stack);
}
done(err);
});
});
} | [
"function",
"harvest",
"(",
")",
"{",
"var",
"q",
"=",
"\"DELETE FROM tokens WHERE expires_at < now() AT TIME ZONE 'UTC'\"",
";",
"db",
".",
"getClient",
"(",
"function",
"(",
"err",
",",
"client",
",",
"done",
")",
"{",
"client",
".",
"query",
"(",
"q",
",",
... | Deletes expired tokens | [
"Deletes",
"expired",
"tokens"
] | 02f3a404cdfca608e8726bbacc33e32fec484b21 | https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/tokens.js#L183-L194 |
57,566 | justinhelmer/vinyl-tasks | lib/filter.js | filter | function filter(filterName, pattern, options) {
return function() {
options = options || {};
filters[filterName] = gFilter(pattern, options);
return filters[filterName];
};
} | javascript | function filter(filterName, pattern, options) {
return function() {
options = options || {};
filters[filterName] = gFilter(pattern, options);
return filters[filterName];
};
} | [
"function",
"filter",
"(",
"filterName",
",",
"pattern",
",",
"options",
")",
"{",
"return",
"function",
"(",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"filters",
"[",
"filterName",
"]",
"=",
"gFilter",
"(",
"pattern",
",",
"options",
"... | Creates a filter function that filters a vinyl stream when invoked. Additionally stores the filter in memory
for use with filter.restore.
@name filter
@param {string} filterName - The name of the filter to create. Should be namespaced to avoid collisions.
@param {*} pattern - The source glob pattern(s) to filter the v... | [
"Creates",
"a",
"filter",
"function",
"that",
"filters",
"a",
"vinyl",
"stream",
"when",
"invoked",
".",
"Additionally",
"stores",
"the",
"filter",
"in",
"memory",
"for",
"use",
"with",
"filter",
".",
"restore",
"."
] | eca1f79065a3653023896c4f546dc44dbac81e62 | https://github.com/justinhelmer/vinyl-tasks/blob/eca1f79065a3653023896c4f546dc44dbac81e62/lib/filter.js#L18-L24 |
57,567 | davidwood/cachetree-redis | lib/store.js | createBuffer | function createBuffer(str, encoding) {
if (BUFFER_FROM) {
return Buffer.from(str, encoding || ENCODING);
}
return new Buffer(str, encoding || ENCODING);
} | javascript | function createBuffer(str, encoding) {
if (BUFFER_FROM) {
return Buffer.from(str, encoding || ENCODING);
}
return new Buffer(str, encoding || ENCODING);
} | [
"function",
"createBuffer",
"(",
"str",
",",
"encoding",
")",
"{",
"if",
"(",
"BUFFER_FROM",
")",
"{",
"return",
"Buffer",
".",
"from",
"(",
"str",
",",
"encoding",
"||",
"ENCODING",
")",
";",
"}",
"return",
"new",
"Buffer",
"(",
"str",
",",
"encoding"... | Create a buffer from a string
@param {String} str String value
@param {String} [encoding] Optional string encoding
@returns {Buffer} string as buffer | [
"Create",
"a",
"buffer",
"from",
"a",
"string"
] | a44842b77dad9f7a9f87a829a98820284548d874 | https://github.com/davidwood/cachetree-redis/blob/a44842b77dad9f7a9f87a829a98820284548d874/lib/store.js#L31-L36 |
57,568 | davidwood/cachetree-redis | lib/store.js | convertValue | function convertValue(value, cast) {
var val;
if (value === null || value === undefined) {
return value;
}
val = Buffer.isBuffer(value) ? value.toString('utf8') : value;
if (cast !== false && typeof val === 'string') {
try {
return JSON.parse(val);
} catch (e) {}
}
return val;
} | javascript | function convertValue(value, cast) {
var val;
if (value === null || value === undefined) {
return value;
}
val = Buffer.isBuffer(value) ? value.toString('utf8') : value;
if (cast !== false && typeof val === 'string') {
try {
return JSON.parse(val);
} catch (e) {}
}
return val;
} | [
"function",
"convertValue",
"(",
"value",
",",
"cast",
")",
"{",
"var",
"val",
";",
"if",
"(",
"value",
"===",
"null",
"||",
"value",
"===",
"undefined",
")",
"{",
"return",
"value",
";",
"}",
"val",
"=",
"Buffer",
".",
"isBuffer",
"(",
"value",
")",... | Convert a value
@param {*} value Value to convert
@param {Boolean} rawBuffer true to return a raw buffer
@param {Boolean} cast true to cast the value
@returns {*} converted value | [
"Convert",
"a",
"value"
] | a44842b77dad9f7a9f87a829a98820284548d874 | https://github.com/davidwood/cachetree-redis/blob/a44842b77dad9f7a9f87a829a98820284548d874/lib/store.js#L46-L58 |
57,569 | davidwood/cachetree-redis | lib/store.js | wrapData | function wrapData(target, name, value, rawBuffer, cast) {
var converted = false;
var val;
if (!target.hasOwnProperty(name)) {
if (value === null || value === undefined || (rawBuffer === true && Buffer.isBuffer(value))) {
converted = true;
val = value;
}
Object.defineProperty(target, name, ... | javascript | function wrapData(target, name, value, rawBuffer, cast) {
var converted = false;
var val;
if (!target.hasOwnProperty(name)) {
if (value === null || value === undefined || (rawBuffer === true && Buffer.isBuffer(value))) {
converted = true;
val = value;
}
Object.defineProperty(target, name, ... | [
"function",
"wrapData",
"(",
"target",
",",
"name",
",",
"value",
",",
"rawBuffer",
",",
"cast",
")",
"{",
"var",
"converted",
"=",
"false",
";",
"var",
"val",
";",
"if",
"(",
"!",
"target",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"if",
... | Generate a property to lazily convert a Buffer value
@param {Object} target Target object
@param {String} name Property name
@param {*} value Property value
@param {Boolean} rawBuffer true to return a raw buffer
@param {Boolean} cast true to cast the value | [
"Generate",
"a",
"property",
"to",
"lazily",
"convert",
"a",
"Buffer",
"value"
] | a44842b77dad9f7a9f87a829a98820284548d874 | https://github.com/davidwood/cachetree-redis/blob/a44842b77dad9f7a9f87a829a98820284548d874/lib/store.js#L69-L88 |
57,570 | melvincarvalho/rdf-shell | lib/sub.js | sub | function sub (subURI, callback) {
var PING_TIMEOUT = process.env['PING_TIMEOUT']
if (!subURI) {
callback(new Error('uri is required'))
return
}
var domain = subURI.split('/')[2]
var wss = 'wss://' + domain + '/'
var Socket = new ws(wss, {
origin: 'http://websocket.org'
})
Socket.on('open'... | javascript | function sub (subURI, callback) {
var PING_TIMEOUT = process.env['PING_TIMEOUT']
if (!subURI) {
callback(new Error('uri is required'))
return
}
var domain = subURI.split('/')[2]
var wss = 'wss://' + domain + '/'
var Socket = new ws(wss, {
origin: 'http://websocket.org'
})
Socket.on('open'... | [
"function",
"sub",
"(",
"subURI",
",",
"callback",
")",
"{",
"var",
"PING_TIMEOUT",
"=",
"process",
".",
"env",
"[",
"'PING_TIMEOUT'",
"]",
"if",
"(",
"!",
"subURI",
")",
"{",
"callback",
"(",
"new",
"Error",
"(",
"'uri is required'",
")",
")",
"return",... | sub gets list of files for a given container
@param {String} argv[2] url
@callback {bin~cb} callback | [
"sub",
"gets",
"list",
"of",
"files",
"for",
"a",
"given",
"container"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/sub.js#L12-L47 |
57,571 | antonycourtney/tabli-core | lib/js/searchOps.js | matchTabItem | function matchTabItem(tabItem, searchExp) {
var urlMatches = tabItem.url.match(searchExp);
var titleMatches = tabItem.title.match(searchExp);
if (urlMatches === null && titleMatches === null) {
return null;
}
return new FilteredTabItem({ tabItem: tabItem, urlMatches: urlMatches, titleMatches: titleMatch... | javascript | function matchTabItem(tabItem, searchExp) {
var urlMatches = tabItem.url.match(searchExp);
var titleMatches = tabItem.title.match(searchExp);
if (urlMatches === null && titleMatches === null) {
return null;
}
return new FilteredTabItem({ tabItem: tabItem, urlMatches: urlMatches, titleMatches: titleMatch... | [
"function",
"matchTabItem",
"(",
"tabItem",
",",
"searchExp",
")",
"{",
"var",
"urlMatches",
"=",
"tabItem",
".",
"url",
".",
"match",
"(",
"searchExp",
")",
";",
"var",
"titleMatches",
"=",
"tabItem",
".",
"title",
".",
"match",
"(",
"searchExp",
")",
"... | Use a RegExp to match a particular TabItem
@return {FilteredTabItem} filtered item (or null if no match)
Search and filter operations on TabWindows | [
"Use",
"a",
"RegExp",
"to",
"match",
"a",
"particular",
"TabItem"
] | 76cc540891421bc6c8bdcf00f277ebb6e716fdd9 | https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/searchOps.js#L42-L51 |
57,572 | antonycourtney/tabli-core | lib/js/searchOps.js | matchTabWindow | function matchTabWindow(tabWindow, searchExp) {
var itemMatches = tabWindow.tabItems.map(function (ti) {
return matchTabItem(ti, searchExp);
}).filter(function (fti) {
return fti !== null;
});
var titleMatches = tabWindow.title.match(searchExp);
if (titleMatches === null && itemMatches.count() === 0)... | javascript | function matchTabWindow(tabWindow, searchExp) {
var itemMatches = tabWindow.tabItems.map(function (ti) {
return matchTabItem(ti, searchExp);
}).filter(function (fti) {
return fti !== null;
});
var titleMatches = tabWindow.title.match(searchExp);
if (titleMatches === null && itemMatches.count() === 0)... | [
"function",
"matchTabWindow",
"(",
"tabWindow",
",",
"searchExp",
")",
"{",
"var",
"itemMatches",
"=",
"tabWindow",
".",
"tabItems",
".",
"map",
"(",
"function",
"(",
"ti",
")",
"{",
"return",
"matchTabItem",
"(",
"ti",
",",
"searchExp",
")",
";",
"}",
"... | Match a TabWindow using a Regexp
matching tab items | [
"Match",
"a",
"TabWindow",
"using",
"a",
"Regexp"
] | 76cc540891421bc6c8bdcf00f277ebb6e716fdd9 | https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/searchOps.js#L66-L79 |
57,573 | antonycourtney/tabli-core | lib/js/searchOps.js | filterTabWindows | function filterTabWindows(tabWindows, searchExp) {
var res;
if (searchExp === null) {
res = _.map(tabWindows, function (tw) {
return new FilteredTabWindow({ tabWindow: tw });
});
} else {
var mappedWindows = _.map(tabWindows, function (tw) {
return matchTabWindow(tw, searchExp);
});
... | javascript | function filterTabWindows(tabWindows, searchExp) {
var res;
if (searchExp === null) {
res = _.map(tabWindows, function (tw) {
return new FilteredTabWindow({ tabWindow: tw });
});
} else {
var mappedWindows = _.map(tabWindows, function (tw) {
return matchTabWindow(tw, searchExp);
});
... | [
"function",
"filterTabWindows",
"(",
"tabWindows",
",",
"searchExp",
")",
"{",
"var",
"res",
";",
"if",
"(",
"searchExp",
"===",
"null",
")",
"{",
"res",
"=",
"_",
".",
"map",
"(",
"tabWindows",
",",
"function",
"(",
"tw",
")",
"{",
"return",
"new",
... | filter an array of TabWindows using a searchRE to obtain
an array of FilteredTabWindow | [
"filter",
"an",
"array",
"of",
"TabWindows",
"using",
"a",
"searchRE",
"to",
"obtain",
"an",
"array",
"of",
"FilteredTabWindow"
] | 76cc540891421bc6c8bdcf00f277ebb6e716fdd9 | https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/searchOps.js#L85-L101 |
57,574 | angeloocana/joj-core | dist/Position.js | setICanGoHere | function setICanGoHere(positionsWhereCanIGo, position) {
return Object.assign({
iCanGoHere: containsXY(positionsWhereCanIGo, position)
}, position);
} | javascript | function setICanGoHere(positionsWhereCanIGo, position) {
return Object.assign({
iCanGoHere: containsXY(positionsWhereCanIGo, position)
}, position);
} | [
"function",
"setICanGoHere",
"(",
"positionsWhereCanIGo",
",",
"position",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"{",
"iCanGoHere",
":",
"containsXY",
"(",
"positionsWhereCanIGo",
",",
"position",
")",
"}",
",",
"position",
")",
";",
"}"
] | Takes a position and return a new position with iCanGoHere checked. | [
"Takes",
"a",
"position",
"and",
"return",
"a",
"new",
"position",
"with",
"iCanGoHere",
"checked",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist/Position.js#L99-L103 |
57,575 | angeloocana/joj-core | dist/Position.js | printUnicodePosition | function printUnicodePosition(p) {
return isBackGroundBlack(p.x, p.y) ? printUnicodeBackgroundBlack(p) : printUnicodeBackgroundWhite(p);
} | javascript | function printUnicodePosition(p) {
return isBackGroundBlack(p.x, p.y) ? printUnicodeBackgroundBlack(p) : printUnicodeBackgroundWhite(p);
} | [
"function",
"printUnicodePosition",
"(",
"p",
")",
"{",
"return",
"isBackGroundBlack",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
")",
"?",
"printUnicodeBackgroundBlack",
"(",
"p",
")",
":",
"printUnicodeBackgroundWhite",
"(",
"p",
")",
";",
"}"
] | Print unicode position to print the board in console.
@param p position | [
"Print",
"unicode",
"position",
"to",
"print",
"the",
"board",
"in",
"console",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist/Position.js#L182-L184 |
57,576 | angeloocana/joj-core | dist/Position.js | containsXY | function containsXY(positions, position) {
return positions ? positions.some(function (p) {
return hasSameXY(p, position);
}) : false;
} | javascript | function containsXY(positions, position) {
return positions ? positions.some(function (p) {
return hasSameXY(p, position);
}) : false;
} | [
"function",
"containsXY",
"(",
"positions",
",",
"position",
")",
"{",
"return",
"positions",
"?",
"positions",
".",
"some",
"(",
"function",
"(",
"p",
")",
"{",
"return",
"hasSameXY",
"(",
"p",
",",
"position",
")",
";",
"}",
")",
":",
"false",
";",
... | Checks if an array of positions contains a position. | [
"Checks",
"if",
"an",
"array",
"of",
"positions",
"contains",
"a",
"position",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist/Position.js#L188-L192 |
57,577 | jtheriault/code-copter-analyzer-jshint | src/index.js | getJshintrc | function getJshintrc () {
var jshintrcPath = process.cwd() + '/.jshintrc';
try {
return JSON.parse(fs.readFileSync(jshintrcPath, 'utf8'));
}
catch (error) {
console.warn(`Expected to find JSHint configuration ${jshintrcPath}. Using default JSHint configuration`);
return undefine... | javascript | function getJshintrc () {
var jshintrcPath = process.cwd() + '/.jshintrc';
try {
return JSON.parse(fs.readFileSync(jshintrcPath, 'utf8'));
}
catch (error) {
console.warn(`Expected to find JSHint configuration ${jshintrcPath}. Using default JSHint configuration`);
return undefine... | [
"function",
"getJshintrc",
"(",
")",
"{",
"var",
"jshintrcPath",
"=",
"process",
".",
"cwd",
"(",
")",
"+",
"'/.jshintrc'",
";",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"jshintrcPath",
",",
"'utf8'",
")",
")",
"... | Gets the object representation of the configuration in .jshintrc in the
project root. | [
"Gets",
"the",
"object",
"representation",
"of",
"the",
"configuration",
"in",
".",
"jshintrc",
"in",
"the",
"project",
"root",
"."
] | 0061f3942c99623f7ba48c521126141ae29bdba1 | https://github.com/jtheriault/code-copter-analyzer-jshint/blob/0061f3942c99623f7ba48c521126141ae29bdba1/src/index.js#L47-L57 |
57,578 | Itee/i-return | sources/i-return.js | returnData | function returnData (data, response) {
if (typeof (response) === 'function') {
return response(null, data)
}
if (!response.headersSent) {
return response.status(200).end(JSON.stringify(data))
}
} | javascript | function returnData (data, response) {
if (typeof (response) === 'function') {
return response(null, data)
}
if (!response.headersSent) {
return response.status(200).end(JSON.stringify(data))
}
} | [
"function",
"returnData",
"(",
"data",
",",
"response",
")",
"{",
"if",
"(",
"typeof",
"(",
"response",
")",
"===",
"'function'",
")",
"{",
"return",
"response",
"(",
"null",
",",
"data",
")",
"}",
"if",
"(",
"!",
"response",
".",
"headersSent",
")",
... | In case database call return some data.
If response parameter is a function consider this is a returnData callback function to call,
else check if server response headers aren't send yet, and return response with status 200 and
stringified data as content
@param data - The server/database data
@param response - The se... | [
"In",
"case",
"database",
"call",
"return",
"some",
"data",
".",
"If",
"response",
"parameter",
"is",
"a",
"function",
"consider",
"this",
"is",
"a",
"returnData",
"callback",
"function",
"to",
"call",
"else",
"check",
"if",
"server",
"response",
"headers",
... | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/sources/i-return.js#L205-L213 |
57,579 | Itee/i-return | sources/i-return.js | dispatchResult | function dispatchResult (error, data) {
if (_cb.beforeAll) { _cb.beforeAll() }
if (_cb.returnForAll) {
_cb.returnForAll(error, data)
} else if (!_isNullOrEmptyArray(error)) {
var _error = _normalizeError(error)
if (!_isNullOrEmptyArray(data)) {
processErrorAndData(_error, data)
... | javascript | function dispatchResult (error, data) {
if (_cb.beforeAll) { _cb.beforeAll() }
if (_cb.returnForAll) {
_cb.returnForAll(error, data)
} else if (!_isNullOrEmptyArray(error)) {
var _error = _normalizeError(error)
if (!_isNullOrEmptyArray(data)) {
processErrorAndData(_error, data)
... | [
"function",
"dispatchResult",
"(",
"error",
",",
"data",
")",
"{",
"if",
"(",
"_cb",
".",
"beforeAll",
")",
"{",
"_cb",
".",
"beforeAll",
"(",
")",
"}",
"if",
"(",
"_cb",
".",
"returnForAll",
")",
"{",
"_cb",
".",
"returnForAll",
"(",
"error",
",",
... | The callback that will be used for parse database response | [
"The",
"callback",
"that",
"will",
"be",
"used",
"for",
"parse",
"database",
"response"
] | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/sources/i-return.js#L352-L373 |
57,580 | undeadway/mircore | demo/lib/util/md5.js | chars_to_bytes | function chars_to_bytes(ac) {
var retval = []
for (var i = 0; i < ac.length; i++) {
retval = retval.concat(str_to_bytes(ac[i]))
}
return retval
} | javascript | function chars_to_bytes(ac) {
var retval = []
for (var i = 0; i < ac.length; i++) {
retval = retval.concat(str_to_bytes(ac[i]))
}
return retval
} | [
"function",
"chars_to_bytes",
"(",
"ac",
")",
"{",
"var",
"retval",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ac",
".",
"length",
";",
"i",
"++",
")",
"{",
"retval",
"=",
"retval",
".",
"concat",
"(",
"str_to_bytes",
"(",
... | convert array of chars to array of bytes | [
"convert",
"array",
"of",
"chars",
"to",
"array",
"of",
"bytes"
] | c44d30f1e5f7f898f4ad7f24150de04a70df43be | https://github.com/undeadway/mircore/blob/c44d30f1e5f7f898f4ad7f24150de04a70df43be/demo/lib/util/md5.js#L69-L75 |
57,581 | undeadway/mircore | demo/lib/util/md5.js | int64_to_bytes | function int64_to_bytes(num) {
var retval = []
for (var i = 0; i < 8; i++) {
retval.push(num & 0xFF)
num = num >>> 8
}
return retval
} | javascript | function int64_to_bytes(num) {
var retval = []
for (var i = 0; i < 8; i++) {
retval.push(num & 0xFF)
num = num >>> 8
}
return retval
} | [
"function",
"int64_to_bytes",
"(",
"num",
")",
"{",
"var",
"retval",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"retval",
".",
"push",
"(",
"num",
"&",
"0xFF",
")",
"num",
"=",
"num",
">>>",... | convert a 64 bit unsigned number to array of bytes. Little endian | [
"convert",
"a",
"64",
"bit",
"unsigned",
"number",
"to",
"array",
"of",
"bytes",
".",
"Little",
"endian"
] | c44d30f1e5f7f898f4ad7f24150de04a70df43be | https://github.com/undeadway/mircore/blob/c44d30f1e5f7f898f4ad7f24150de04a70df43be/demo/lib/util/md5.js#L79-L86 |
57,582 | undeadway/mircore | demo/lib/util/md5.js | bytes_to_int32 | function bytes_to_int32(arr, off) {
return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off])
} | javascript | function bytes_to_int32(arr, off) {
return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off])
} | [
"function",
"bytes_to_int32",
"(",
"arr",
",",
"off",
")",
"{",
"return",
"(",
"arr",
"[",
"off",
"+",
"3",
"]",
"<<",
"24",
")",
"|",
"(",
"arr",
"[",
"off",
"+",
"2",
"]",
"<<",
"16",
")",
"|",
"(",
"arr",
"[",
"off",
"+",
"1",
"]",
"<<",... | pick 4 bytes at specified offset. Little-endian is assumed | [
"pick",
"4",
"bytes",
"at",
"specified",
"offset",
".",
"Little",
"-",
"endian",
"is",
"assumed"
] | c44d30f1e5f7f898f4ad7f24150de04a70df43be | https://github.com/undeadway/mircore/blob/c44d30f1e5f7f898f4ad7f24150de04a70df43be/demo/lib/util/md5.js#L111-L113 |
57,583 | undeadway/mircore | demo/lib/util/md5.js | typed_to_plain | function typed_to_plain(tarr) {
var retval = new Array(tarr.length)
for (var i = 0; i < tarr.length; i++) {
retval[i] = tarr[i]
}
return retval
} | javascript | function typed_to_plain(tarr) {
var retval = new Array(tarr.length)
for (var i = 0; i < tarr.length; i++) {
retval[i] = tarr[i]
}
return retval
} | [
"function",
"typed_to_plain",
"(",
"tarr",
")",
"{",
"var",
"retval",
"=",
"new",
"Array",
"(",
"tarr",
".",
"length",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"tarr",
".",
"length",
";",
"i",
"++",
")",
"{",
"retval",
"[",
"i",
"]... | conversion from typed byte array to plain javascript array | [
"conversion",
"from",
"typed",
"byte",
"array",
"to",
"plain",
"javascript",
"array"
] | c44d30f1e5f7f898f4ad7f24150de04a70df43be | https://github.com/undeadway/mircore/blob/c44d30f1e5f7f898f4ad7f24150de04a70df43be/demo/lib/util/md5.js#L160-L166 |
57,584 | undeadway/mircore | demo/lib/util/md5.js | updateRun | function updateRun(nf, sin32, dw32, b32) {
var temp = d
d = c
c = b
//b = b + rol(a + (nf + (sin32 + dw32)), b32)
b = _add(b,
rol(
_add(a,
_add(nf, _add(sin32, dw32))
), b32
... | javascript | function updateRun(nf, sin32, dw32, b32) {
var temp = d
d = c
c = b
//b = b + rol(a + (nf + (sin32 + dw32)), b32)
b = _add(b,
rol(
_add(a,
_add(nf, _add(sin32, dw32))
), b32
... | [
"function",
"updateRun",
"(",
"nf",
",",
"sin32",
",",
"dw32",
",",
"b32",
")",
"{",
"var",
"temp",
"=",
"d",
"d",
"=",
"c",
"c",
"=",
"b",
"//b = b + rol(a + (nf + (sin32 + dw32)), b32)",
"b",
"=",
"_add",
"(",
"b",
",",
"rol",
"(",
"_add",
"(",
"a"... | function update partial state for each run | [
"function",
"update",
"partial",
"state",
"for",
"each",
"run"
] | c44d30f1e5f7f898f4ad7f24150de04a70df43be | https://github.com/undeadway/mircore/blob/c44d30f1e5f7f898f4ad7f24150de04a70df43be/demo/lib/util/md5.js#L217-L230 |
57,585 | msikma/grunt-usage | tasks/usage.js | getUsageOptions | function getUsageOptions() {
var configData = this.config.data;
if (configData.usage && configData.usage.options) {
return configData.usage.options;
}
return {};
} | javascript | function getUsageOptions() {
var configData = this.config.data;
if (configData.usage && configData.usage.options) {
return configData.usage.options;
}
return {};
} | [
"function",
"getUsageOptions",
"(",
")",
"{",
"var",
"configData",
"=",
"this",
".",
"config",
".",
"data",
";",
"if",
"(",
"configData",
".",
"usage",
"&&",
"configData",
".",
"usage",
".",
"options",
")",
"{",
"return",
"configData",
".",
"usage",
".",... | Returns the options object for grunt-usage.
Helper function in order to avoid a fatal error when the options
object has not been defined yet.
@returns {Object} The usage options object | [
"Returns",
"the",
"options",
"object",
"for",
"grunt",
"-",
"usage",
"."
] | 395e194d446e25a4a24f3bb7d2f77c56e87619df | https://github.com/msikma/grunt-usage/blob/395e194d446e25a4a24f3bb7d2f77c56e87619df/tasks/usage.js#L15-L21 |
57,586 | msikma/grunt-usage | tasks/usage.js | formatDescription | function formatDescription(str, formattingOptions) {
var end = '.', endRe = new RegExp('[\\.\\!\\?]{1}[\\)\\]"\']*?$');
// Apply a fallback in case we're trying to format a null or undefined.
if (!str) {
str = 'N/A';
}
// Add a period in case no valid end-of-sentence marker is found.
if (formattingOpt... | javascript | function formatDescription(str, formattingOptions) {
var end = '.', endRe = new RegExp('[\\.\\!\\?]{1}[\\)\\]"\']*?$');
// Apply a fallback in case we're trying to format a null or undefined.
if (!str) {
str = 'N/A';
}
// Add a period in case no valid end-of-sentence marker is found.
if (formattingOpt... | [
"function",
"formatDescription",
"(",
"str",
",",
"formattingOptions",
")",
"{",
"var",
"end",
"=",
"'.'",
",",
"endRe",
"=",
"new",
"RegExp",
"(",
"'[\\\\.\\\\!\\\\?]{1}[\\\\)\\\\]\"\\']*?$'",
")",
";",
"// Apply a fallback in case we're trying to format a null or undefine... | Returns a formatted version of a description string. Chiefly, it
ensures that each line ends with a valid end-of-sentence marker,
mostly a period.
@param {String} str The description string to format and return
@param {Object} formattingOptions Formatting options object
@returns {String} The formatted string | [
"Returns",
"a",
"formatted",
"version",
"of",
"a",
"description",
"string",
".",
"Chiefly",
"it",
"ensures",
"that",
"each",
"line",
"ends",
"with",
"a",
"valid",
"end",
"-",
"of",
"-",
"sentence",
"marker",
"mostly",
"a",
"period",
"."
] | 395e194d446e25a4a24f3bb7d2f77c56e87619df | https://github.com/msikma/grunt-usage/blob/395e194d446e25a4a24f3bb7d2f77c56e87619df/tasks/usage.js#L46-L62 |
57,587 | msikma/grunt-usage | tasks/usage.js | formatUsageHeader | function formatUsageHeader(headerContent) {
var headerString = headerContent instanceof Array ?
headerContent.join(EOL) :
headerContent;
return headerString + EOL;
} | javascript | function formatUsageHeader(headerContent) {
var headerString = headerContent instanceof Array ?
headerContent.join(EOL) :
headerContent;
return headerString + EOL;
} | [
"function",
"formatUsageHeader",
"(",
"headerContent",
")",
"{",
"var",
"headerString",
"=",
"headerContent",
"instanceof",
"Array",
"?",
"headerContent",
".",
"join",
"(",
"EOL",
")",
":",
"headerContent",
";",
"return",
"headerString",
"+",
"EOL",
";",
"}"
] | Formats and returns the user's header string or array.
@param {Array|String} headerContent The usage header option string or array
@returns {String} The formatted usage header string | [
"Formats",
"and",
"returns",
"the",
"user",
"s",
"header",
"string",
"or",
"array",
"."
] | 395e194d446e25a4a24f3bb7d2f77c56e87619df | https://github.com/msikma/grunt-usage/blob/395e194d446e25a4a24f3bb7d2f77c56e87619df/tasks/usage.js#L83-L89 |
57,588 | msikma/grunt-usage | tasks/usage.js | formatUsage | function formatUsage(grunt, usageHeader, usageHelp) {
var usageString = '',
reUsage = [new RegExp('\\[-(.+?)\\]', 'g'), '[$1]'],
reTasks = [new RegExp('^[ ]{2}-([^\\s]*)', 'mg'), ' $1 '];
usageString += usageHeader;
usageHelp = usageHelp.replace(reUsage[0], reUsage[1]);
usageHelp = usageHelp.repl... | javascript | function formatUsage(grunt, usageHeader, usageHelp) {
var usageString = '',
reUsage = [new RegExp('\\[-(.+?)\\]', 'g'), '[$1]'],
reTasks = [new RegExp('^[ ]{2}-([^\\s]*)', 'mg'), ' $1 '];
usageString += usageHeader;
usageHelp = usageHelp.replace(reUsage[0], reUsage[1]);
usageHelp = usageHelp.repl... | [
"function",
"formatUsage",
"(",
"grunt",
",",
"usageHeader",
",",
"usageHelp",
")",
"{",
"var",
"usageString",
"=",
"''",
",",
"reUsage",
"=",
"[",
"new",
"RegExp",
"(",
"'\\\\[-(.+?)\\\\]'",
",",
"'g'",
")",
",",
"'[$1]'",
"]",
",",
"reTasks",
"=",
"[",... | Performs a final processing run on the usage string and then returns it.
The most major modification we do is removing the dash at the start of
the Grunt task names. This is a hack to work around the fact that
argparse won't show a valid usage string at the top of the help dialog
unless we use optional arguments.
Opt... | [
"Performs",
"a",
"final",
"processing",
"run",
"on",
"the",
"usage",
"string",
"and",
"then",
"returns",
"it",
"."
] | 395e194d446e25a4a24f3bb7d2f77c56e87619df | https://github.com/msikma/grunt-usage/blob/395e194d446e25a4a24f3bb7d2f77c56e87619df/tasks/usage.js#L108-L122 |
57,589 | msikma/grunt-usage | tasks/usage.js | addTaskGroup | function addTaskGroup(taskGroup, grunt, parser, descriptionOverrides,
formattingOptions) {
var parserGruntTasks;
var taskName, taskInfo;
var n;
// Create the parser for this group.
parserGruntTasks = parser.addArgumentGroup({
title: taskGroup.header ? taskGroup.header : 'Grunt tasks... | javascript | function addTaskGroup(taskGroup, grunt, parser, descriptionOverrides,
formattingOptions) {
var parserGruntTasks;
var taskName, taskInfo;
var n;
// Create the parser for this group.
parserGruntTasks = parser.addArgumentGroup({
title: taskGroup.header ? taskGroup.header : 'Grunt tasks... | [
"function",
"addTaskGroup",
"(",
"taskGroup",
",",
"grunt",
",",
"parser",
",",
"descriptionOverrides",
",",
"formattingOptions",
")",
"{",
"var",
"parserGruntTasks",
";",
"var",
"taskName",
",",
"taskInfo",
";",
"var",
"n",
";",
"// Create the parser for this group... | Adds a task group to the parser.
@param {Object} taskGroup The task group object
@param {Object} grunt The global Grunt object
@param {ArgumentParser} parser The global ArgumentParser object
@param {Object} descriptionOverrides Task description overrides
@param {Object} formattingOptions Options that determine the for... | [
"Adds",
"a",
"task",
"group",
"to",
"the",
"parser",
"."
] | 395e194d446e25a4a24f3bb7d2f77c56e87619df | https://github.com/msikma/grunt-usage/blob/395e194d446e25a4a24f3bb7d2f77c56e87619df/tasks/usage.js#L140-L171 |
57,590 | brycebaril/level-bufferstreams | read.js | createReader | function createReader(db, options) {
if (options == null) options = {}
var iterator = db.iterator(options)
function _read(n) {
// ignore n for now
var self = this
iterator.next(function (err, key, value) {
if (err) {
iterator.end(noop)
self.emit("error", err)
return
... | javascript | function createReader(db, options) {
if (options == null) options = {}
var iterator = db.iterator(options)
function _read(n) {
// ignore n for now
var self = this
iterator.next(function (err, key, value) {
if (err) {
iterator.end(noop)
self.emit("error", err)
return
... | [
"function",
"createReader",
"(",
"db",
",",
"options",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"options",
"=",
"{",
"}",
"var",
"iterator",
"=",
"db",
".",
"iterator",
"(",
"options",
")",
"function",
"_read",
"(",
"n",
")",
"{",
"// ignor... | Create a stream instance that streams data out of a level instance as multibuffers
@param {LevelDOWN} db A LevelDOWN instance
@param {Object} options Read range options (start, end, reverse, limit) | [
"Create",
"a",
"stream",
"instance",
"that",
"streams",
"data",
"out",
"of",
"a",
"level",
"instance",
"as",
"multibuffers"
] | b78bfddfe1f4cb1a962803d5cc1bba26e277efb9 | https://github.com/brycebaril/level-bufferstreams/blob/b78bfddfe1f4cb1a962803d5cc1bba26e277efb9/read.js#L12-L39 |
57,591 | rwaldron/t2-project | lib/index.js | buildResolverOptions | function buildResolverOptions(options, base) {
var pathFilter = options.pathFilter;
options.basedir = base;
options.pathFilter = function(info, resvPath, relativePath) {
if (relativePath[0] !== '.') {
relativePath = './' + relativePath;
}
var mappedPath;
if (pathFilter) {
mappedPath =... | javascript | function buildResolverOptions(options, base) {
var pathFilter = options.pathFilter;
options.basedir = base;
options.pathFilter = function(info, resvPath, relativePath) {
if (relativePath[0] !== '.') {
relativePath = './' + relativePath;
}
var mappedPath;
if (pathFilter) {
mappedPath =... | [
"function",
"buildResolverOptions",
"(",
"options",
",",
"base",
")",
"{",
"var",
"pathFilter",
"=",
"options",
".",
"pathFilter",
";",
"options",
".",
"basedir",
"=",
"base",
";",
"options",
".",
"pathFilter",
"=",
"function",
"(",
"info",
",",
"resvPath",
... | Loosely based on an operation found in browser-resolve | [
"Loosely",
"based",
"on",
"an",
"operation",
"found",
"in",
"browser",
"-",
"resolve"
] | 4c7a8def29b9d0507c1fafb039d25500750b7787 | https://github.com/rwaldron/t2-project/blob/4c7a8def29b9d0507c1fafb039d25500750b7787/lib/index.js#L84-L102 |
57,592 | pauldijou/open-issue | examples/node_error.js | parseError | function parseError(error) {
// If this file is at the root of your project
var pathRegexp = new RegExp(__dirname, 'g');
var display = '';
if (error.code) { display += 'Error code: ' + error.code + '\n\n' };
if (error.stack) { display += error.stack.replace(pathRegexp, ''); }
if (!display) { display = error... | javascript | function parseError(error) {
// If this file is at the root of your project
var pathRegexp = new RegExp(__dirname, 'g');
var display = '';
if (error.code) { display += 'Error code: ' + error.code + '\n\n' };
if (error.stack) { display += error.stack.replace(pathRegexp, ''); }
if (!display) { display = error... | [
"function",
"parseError",
"(",
"error",
")",
"{",
"// If this file is at the root of your project",
"var",
"pathRegexp",
"=",
"new",
"RegExp",
"(",
"__dirname",
",",
"'g'",
")",
";",
"var",
"display",
"=",
"''",
";",
"if",
"(",
"error",
".",
"code",
")",
"{"... | Extract stack and hide user paths | [
"Extract",
"stack",
"and",
"hide",
"user",
"paths"
] | 1044e8c27d996683ffc6684d7cb5c44ef3d1c935 | https://github.com/pauldijou/open-issue/blob/1044e8c27d996683ffc6684d7cb5c44ef3d1c935/examples/node_error.js#L2-L10 |
57,593 | pauldijou/open-issue | examples/node_error.js | openIssue | function openIssue(e) {
require('../lib/node.js')
.github('pauldijou/open-issue')
.title('Unexpected error')
.labels('bug', 'fatal')
.append('The following error occured:')
.appendCode(parseError(e))
.append('You can also add custom infos if necessary...')
.open();
} | javascript | function openIssue(e) {
require('../lib/node.js')
.github('pauldijou/open-issue')
.title('Unexpected error')
.labels('bug', 'fatal')
.append('The following error occured:')
.appendCode(parseError(e))
.append('You can also add custom infos if necessary...')
.open();
} | [
"function",
"openIssue",
"(",
"e",
")",
"{",
"require",
"(",
"'../lib/node.js'",
")",
".",
"github",
"(",
"'pauldijou/open-issue'",
")",
".",
"title",
"(",
"'Unexpected error'",
")",
".",
"labels",
"(",
"'bug'",
",",
"'fatal'",
")",
".",
"append",
"(",
"'T... | Open the issue if user is ok | [
"Open",
"the",
"issue",
"if",
"user",
"is",
"ok"
] | 1044e8c27d996683ffc6684d7cb5c44ef3d1c935 | https://github.com/pauldijou/open-issue/blob/1044e8c27d996683ffc6684d7cb5c44ef3d1c935/examples/node_error.js#L13-L22 |
57,594 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/div/dialogs/div.js | addSafely | function addSafely( collection, element, database ) {
// 1. IE doesn't support customData on text nodes;
// 2. Text nodes never get chance to appear twice;
if ( !element.is || !element.getCustomData( 'block_processed' ) ) {
element.is && CKEDITOR.dom.element.setMarker( database, element, 'block_processed',... | javascript | function addSafely( collection, element, database ) {
// 1. IE doesn't support customData on text nodes;
// 2. Text nodes never get chance to appear twice;
if ( !element.is || !element.getCustomData( 'block_processed' ) ) {
element.is && CKEDITOR.dom.element.setMarker( database, element, 'block_processed',... | [
"function",
"addSafely",
"(",
"collection",
",",
"element",
",",
"database",
")",
"{",
"// 1. IE doesn't support customData on text nodes;\r",
"// 2. Text nodes never get chance to appear twice;\r",
"if",
"(",
"!",
"element",
".",
"is",
"||",
"!",
"element",
".",
"getCust... | Add to collection with DUP examination. @param {Object} collection @param {Object} element @param {Object} database | [
"Add",
"to",
"collection",
"with",
"DUP",
"examination",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/div/dialogs/div.js#L12-L19 |
57,595 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/div/dialogs/div.js | getDivContainer | function getDivContainer( element ) {
var container = editor.elementPath( element ).blockLimit;
// Never consider read-only (i.e. contenteditable=false) element as
// a first div limit (#11083).
if ( container.isReadOnly() )
container = container.getParent();
// Dont stop at 'td' and 'th' w... | javascript | function getDivContainer( element ) {
var container = editor.elementPath( element ).blockLimit;
// Never consider read-only (i.e. contenteditable=false) element as
// a first div limit (#11083).
if ( container.isReadOnly() )
container = container.getParent();
// Dont stop at 'td' and 'th' w... | [
"function",
"getDivContainer",
"(",
"element",
")",
"{",
"var",
"container",
"=",
"editor",
".",
"elementPath",
"(",
"element",
")",
".",
"blockLimit",
";",
"// Never consider read-only (i.e. contenteditable=false) element as\r",
"// a first div limit (#11083).\r",
"if",
"(... | Get the first div limit element on the element's path. @param {Object} element | [
"Get",
"the",
"first",
"div",
"limit",
"element",
"on",
"the",
"element",
"s",
"path",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/div/dialogs/div.js#L54-L69 |
57,596 | buybrain/storymock | lib/storymock.js | reject | function reject(err, async) {
err = toErr(err);
if (async) {
return Promise.reject(err);
} else {
throw err;
}
} | javascript | function reject(err, async) {
err = toErr(err);
if (async) {
return Promise.reject(err);
} else {
throw err;
}
} | [
"function",
"reject",
"(",
"err",
",",
"async",
")",
"{",
"err",
"=",
"toErr",
"(",
"err",
")",
";",
"if",
"(",
"async",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"err",
")",
";",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}"
] | Reject with the given error. Returns a rejected promise if async, throws otherwise. | [
"Reject",
"with",
"the",
"given",
"error",
".",
"Returns",
"a",
"rejected",
"promise",
"if",
"async",
"throws",
"otherwise",
"."
] | 1292be256377b51c9bffc0b3b4fa4c71f9498464 | https://github.com/buybrain/storymock/blob/1292be256377b51c9bffc0b3b4fa4c71f9498464/lib/storymock.js#L190-L197 |
57,597 | willmark/file-sync | index.js | copyFiles | function copyFiles(srcfile, dstfile, callback) {
var fs = require("fs");
var rs = fs.createReadStream(srcfile);
var ws = fs.createWriteStream(dstfile);
rs.on("data", function(d) {
ws.write(d);
});
rs.on("end", function() {
ws.end();
cal... | javascript | function copyFiles(srcfile, dstfile, callback) {
var fs = require("fs");
var rs = fs.createReadStream(srcfile);
var ws = fs.createWriteStream(dstfile);
rs.on("data", function(d) {
ws.write(d);
});
rs.on("end", function() {
ws.end();
cal... | [
"function",
"copyFiles",
"(",
"srcfile",
",",
"dstfile",
",",
"callback",
")",
"{",
"var",
"fs",
"=",
"require",
"(",
"\"fs\"",
")",
";",
"var",
"rs",
"=",
"fs",
".",
"createReadStream",
"(",
"srcfile",
")",
";",
"var",
"ws",
"=",
"fs",
".",
"createW... | Copy file1 to file2 | [
"Copy",
"file1",
"to",
"file2"
] | 499bd8b1c88edb5d122dc85731d7a3fa330f42ec | https://github.com/willmark/file-sync/blob/499bd8b1c88edb5d122dc85731d7a3fa330f42ec/index.js#L50-L61 |
57,598 | VasoBolkvadze/noderaven | index.js | function (db, index, term, field, cb) {
var url = host +
'databases/' + db +
'/suggest/' + index +
'?term=' + encodeURIComponent(term) +
'&field=' + field +
'&max=10&distance=Default&accuracy=0.5';
request(url, function (error, response, body) {
if (!error && response.statusCode === 200) {... | javascript | function (db, index, term, field, cb) {
var url = host +
'databases/' + db +
'/suggest/' + index +
'?term=' + encodeURIComponent(term) +
'&field=' + field +
'&max=10&distance=Default&accuracy=0.5';
request(url, function (error, response, body) {
if (!error && response.statusCode === 200) {... | [
"function",
"(",
"db",
",",
"index",
",",
"term",
",",
"field",
",",
"cb",
")",
"{",
"var",
"url",
"=",
"host",
"+",
"'databases/'",
"+",
"db",
"+",
"'/suggest/'",
"+",
"index",
"+",
"'?term='",
"+",
"encodeURIComponent",
"(",
"term",
")",
"+",
"'&fi... | Returns Suggestions for given query and fieldName.
@param {string} db
@param {string} index
@param {string} term
@param {string} field
@param {Function} cb | [
"Returns",
"Suggestions",
"for",
"given",
"query",
"and",
"fieldName",
"."
] | 62353a62f634be90f7aa4c36f19574ecd720b463 | https://github.com/VasoBolkvadze/noderaven/blob/62353a62f634be90f7aa4c36f19574ecd720b463/index.js#L151-L167 | |
57,599 | VasoBolkvadze/noderaven | index.js | function (db, indexName, facetDoc, query, cb) {
var url = host + "databases/" + db + "/facets/" + indexName + "?facetDoc=" + facetDoc + "&query=" + encodeURIComponent(query);
request(url, function (error, response, body) {
if (!error && response.statusCode === 200) {
var result = JSON.parse(body);
_... | javascript | function (db, indexName, facetDoc, query, cb) {
var url = host + "databases/" + db + "/facets/" + indexName + "?facetDoc=" + facetDoc + "&query=" + encodeURIComponent(query);
request(url, function (error, response, body) {
if (!error && response.statusCode === 200) {
var result = JSON.parse(body);
_... | [
"function",
"(",
"db",
",",
"indexName",
",",
"facetDoc",
",",
"query",
",",
"cb",
")",
"{",
"var",
"url",
"=",
"host",
"+",
"\"databases/\"",
"+",
"db",
"+",
"\"/facets/\"",
"+",
"indexName",
"+",
"\"?facetDoc=\"",
"+",
"facetDoc",
"+",
"\"&query=\"",
"... | Returns Facet Results.
@param {string} db
@param {string} indexName
@param {string} facetDoc
@param {string} query
@param {Function} cb | [
"Returns",
"Facet",
"Results",
"."
] | 62353a62f634be90f7aa4c36f19574ecd720b463 | https://github.com/VasoBolkvadze/noderaven/blob/62353a62f634be90f7aa4c36f19574ecd720b463/index.js#L175-L215 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.