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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54,700 | RnbWd/parse-browserify | lib/query.js | function(options) {
var self = this;
options = options || {};
var request = Parse._request({
route: "classes",
className: this.className,
method: "GET",
useMasterKey: options.useMasterKey,
data: this.toJSON()
});
return request.then(function(respon... | javascript | function(options) {
var self = this;
options = options || {};
var request = Parse._request({
route: "classes",
className: this.className,
method: "GET",
useMasterKey: options.useMasterKey,
data: this.toJSON()
});
return request.then(function(respon... | [
"function",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"request",
"=",
"Parse",
".",
"_request",
"(",
"{",
"route",
":",
"\"classes\"",
",",
"className",
":",
"this",
".",
"classN... | Retrieves a list of ParseObjects that satisfy this query.
Either options.success or options.error is called when the find
completes.
@param {Object} options A Backbone-style options object. Valid options
are:<ul>
<li>success: Function to call when the find completes successfully.
<li>error: Function to call when the f... | [
"Retrieves",
"a",
"list",
"of",
"ParseObjects",
"that",
"satisfy",
"this",
"query",
".",
"Either",
"options",
".",
"success",
"or",
"options",
".",
"error",
"is",
"called",
"when",
"the",
"find",
"completes",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L189-L213 | |
54,701 | RnbWd/parse-browserify | lib/query.js | function(options) {
var self = this;
options = options || {};
var params = this.toJSON();
params.limit = 0;
params.count = 1;
var request = Parse._request({
route: "classes",
className: self.className,
method: "GET",
useMasterKey: options.useMasterKe... | javascript | function(options) {
var self = this;
options = options || {};
var params = this.toJSON();
params.limit = 0;
params.count = 1;
var request = Parse._request({
route: "classes",
className: self.className,
method: "GET",
useMasterKey: options.useMasterKe... | [
"function",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"params",
"=",
"this",
".",
"toJSON",
"(",
")",
";",
"params",
".",
"limit",
"=",
"0",
";",
"params",
".",
"count",
"=",... | Counts the number of objects that match this query.
Either options.success or options.error is called when the count
completes.
@param {Object} options A Backbone-style options object. Valid options
are:<ul>
<li>success: Function to call when the count completes successfully.
<li>error: Function to call when the find ... | [
"Counts",
"the",
"number",
"of",
"objects",
"that",
"match",
"this",
"query",
".",
"Either",
"options",
".",
"success",
"or",
"options",
".",
"error",
"is",
"called",
"when",
"the",
"count",
"completes",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L231-L249 | |
54,702 | RnbWd/parse-browserify | lib/query.js | function(items, options) {
options = options || {};
return new Parse.Collection(items, _.extend(options, {
model: this.objectClass,
query: this
}));
} | javascript | function(items, options) {
options = options || {};
return new Parse.Collection(items, _.extend(options, {
model: this.objectClass,
query: this
}));
} | [
"function",
"(",
"items",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"return",
"new",
"Parse",
".",
"Collection",
"(",
"items",
",",
"_",
".",
"extend",
"(",
"options",
",",
"{",
"model",
":",
"this",
".",
"objectClass"... | Returns a new instance of Parse.Collection backed by this query.
@param {Array} items An array of instances of <code>Parse.Object</code>
with which to start this Collection.
@param {Object} options An optional object with Backbone-style options.
Valid options are:<ul>
<li>model: The Parse.Object subclass that this coll... | [
"Returns",
"a",
"new",
"instance",
"of",
"Parse",
".",
"Collection",
"backed",
"by",
"this",
"query",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L303-L309 | |
54,703 | RnbWd/parse-browserify | lib/query.js | function(key) {
var self = this;
if (!this._order) {
this._order = [];
}
Parse._arrayEach(arguments, function(key) {
if (Array.isArray(key)) {
key = key.join();
}
self._order = self._order.concat(key.replace(/\s/g, "").split(","));
});
retur... | javascript | function(key) {
var self = this;
if (!this._order) {
this._order = [];
}
Parse._arrayEach(arguments, function(key) {
if (Array.isArray(key)) {
key = key.join();
}
self._order = self._order.concat(key.replace(/\s/g, "").split(","));
});
retur... | [
"function",
"(",
"key",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"this",
".",
"_order",
")",
"{",
"this",
".",
"_order",
"=",
"[",
"]",
";",
"}",
"Parse",
".",
"_arrayEach",
"(",
"arguments",
",",
"function",
"(",
"key",
")",
... | Sorts the results in ascending order by the given key,
but can also add secondary sort descriptors without overwriting _order.
@param {(String|String[]|...String} key The key to order by, which is a
string of comma separated values, or an Array of keys, or multiple keys.
@return {Parse.Query} Returns the query, so you... | [
"Sorts",
"the",
"results",
"in",
"ascending",
"order",
"by",
"the",
"given",
"key",
"but",
"can",
"also",
"add",
"secondary",
"sort",
"descriptors",
"without",
"overwriting",
"_order",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L649-L661 | |
54,704 | RnbWd/parse-browserify | lib/query.js | function() {
var self = this;
Parse._arrayEach(arguments, function(key) {
if (_.isArray(key)) {
self._include = self._include.concat(key);
} else {
self._include.push(key);
}
});
return this;
} | javascript | function() {
var self = this;
Parse._arrayEach(arguments, function(key) {
if (_.isArray(key)) {
self._include = self._include.concat(key);
} else {
self._include.push(key);
}
});
return this;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"Parse",
".",
"_arrayEach",
"(",
"arguments",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"key",
")",
")",
"{",
"self",
".",
"_include",
"=",
"self",
".",... | Include nested Parse.Objects for the provided key. You can use dot
notation to specify which fields in the included object are also fetch.
@param {String} key The name of the key to include.
@return {Parse.Query} Returns the query, so you can chain this call. | [
"Include",
"nested",
"Parse",
".",
"Objects",
"for",
"the",
"provided",
"key",
".",
"You",
"can",
"use",
"dot",
"notation",
"to",
"specify",
"which",
"fields",
"in",
"the",
"included",
"object",
"are",
"also",
"fetch",
"."
] | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L786-L796 | |
54,705 | RnbWd/parse-browserify | lib/query.js | function() {
var self = this;
this._select = this._select || [];
Parse._arrayEach(arguments, function(key) {
if (_.isArray(key)) {
self._select = self._select.concat(key);
} else {
self._select.push(key);
}
});
return this;
} | javascript | function() {
var self = this;
this._select = this._select || [];
Parse._arrayEach(arguments, function(key) {
if (_.isArray(key)) {
self._select = self._select.concat(key);
} else {
self._select.push(key);
}
});
return this;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"_select",
"=",
"this",
".",
"_select",
"||",
"[",
"]",
";",
"Parse",
".",
"_arrayEach",
"(",
"arguments",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"_",
".",
"isArr... | Restrict the fields of the returned Parse.Objects to include only the
provided keys. If this is called multiple times, then all of the keys
specified in each of the calls will be included.
@param {Array} keys The names of the keys to include.
@return {Parse.Query} Returns the query, so you can chain this call. | [
"Restrict",
"the",
"fields",
"of",
"the",
"returned",
"Parse",
".",
"Objects",
"to",
"include",
"only",
"the",
"provided",
"keys",
".",
"If",
"this",
"is",
"called",
"multiple",
"times",
"then",
"all",
"of",
"the",
"keys",
"specified",
"in",
"each",
"of",
... | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/query.js#L805-L816 | |
54,706 | maidol/cw-logger | logstash/tcp-bunyan.js | LogstashStream | function LogstashStream(options) {
EventEmitter.call(this);
options = options || {};
this.name = 'bunyan';
this.level = options.level || 'info';
this.server = options.server || os.hostname();
this.host = options.host || '127.0.0.1';
this.port = options.port || 9999;
this.application = options.... | javascript | function LogstashStream(options) {
EventEmitter.call(this);
options = options || {};
this.name = 'bunyan';
this.level = options.level || 'info';
this.server = options.server || os.hostname();
this.host = options.host || '127.0.0.1';
this.port = options.port || 9999;
this.application = options.... | [
"function",
"LogstashStream",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"name",
"=",
"'bunyan'",
";",
"this",
".",
"level",
"=",
"options",
".",
"level",
... | This class implements the bunyan stream contract with a stream that
sends data to logstash.
@param {objects} options The constructions options. See the constructor for details.
TODO: Improve this doc.
@constructor | [
"This",
"class",
"implements",
"the",
"bunyan",
"stream",
"contract",
"with",
"a",
"stream",
"that",
"sends",
"data",
"to",
"logstash",
"."
] | 5bdc950113df6306ebfa7a7916a450915422f0ac | https://github.com/maidol/cw-logger/blob/5bdc950113df6306ebfa7a7916a450915422f0ac/logstash/tcp-bunyan.js#L40-L75 |
54,707 | docvy/plugin-installer | lib/installer.js | npmInstall | function npmInstall(packages, callback) {
callback = utils.defineCallback(callback);
if (_.isString(packages)) {
packages = [ packages ];
}
return npm.load({
loglevel: "silent",
prefix: tmpDir,
}, function(loadErr) {
if (loadErr) {
return callback(new errors.NpmLoadError(loadErr));
}... | javascript | function npmInstall(packages, callback) {
callback = utils.defineCallback(callback);
if (_.isString(packages)) {
packages = [ packages ];
}
return npm.load({
loglevel: "silent",
prefix: tmpDir,
}, function(loadErr) {
if (loadErr) {
return callback(new errors.NpmLoadError(loadErr));
}... | [
"function",
"npmInstall",
"(",
"packages",
",",
"callback",
")",
"{",
"callback",
"=",
"utils",
".",
"defineCallback",
"(",
"callback",
")",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"packages",
")",
")",
"{",
"packages",
"=",
"[",
"packages",
"]",
";... | Install plugins using NPM
@param {String|String[]} packages - name of packages
@param {Function} [callback] | [
"Install",
"plugins",
"using",
"NPM"
] | eb645eb21f350a0fbbf783d83b25ab18feeee684 | https://github.com/docvy/plugin-installer/blob/eb645eb21f350a0fbbf783d83b25ab18feeee684/lib/installer.js#L50-L74 |
54,708 | docvy/plugin-installer | lib/installer.js | dirInstall | function dirInstall(dirpath, callback) {
callback = utils.defineCallback(callback);
return fs.exists(dirpath, function(exists) {
if (!exists) {
return callback(new errors.DirectoryNotExistingError());
}
var pluginName = path.basename(dirpath);
var destPath = path.join(pluginsDir, pluginName);
... | javascript | function dirInstall(dirpath, callback) {
callback = utils.defineCallback(callback);
return fs.exists(dirpath, function(exists) {
if (!exists) {
return callback(new errors.DirectoryNotExistingError());
}
var pluginName = path.basename(dirpath);
var destPath = path.join(pluginsDir, pluginName);
... | [
"function",
"dirInstall",
"(",
"dirpath",
",",
"callback",
")",
"{",
"callback",
"=",
"utils",
".",
"defineCallback",
"(",
"callback",
")",
";",
"return",
"fs",
".",
"exists",
"(",
"dirpath",
",",
"function",
"(",
"exists",
")",
"{",
"if",
"(",
"!",
"e... | Install plugins from Directory
@param {String} dirpath - path to directory
@param {Function} [callback] | [
"Install",
"plugins",
"from",
"Directory"
] | eb645eb21f350a0fbbf783d83b25ab18feeee684 | https://github.com/docvy/plugin-installer/blob/eb645eb21f350a0fbbf783d83b25ab18feeee684/lib/installer.js#L83-L98 |
54,709 | docvy/plugin-installer | lib/installer.js | listPlugins | function listPlugins(callback) {
callback = utils.defineCallback(callback);
return fs.readdir(pluginsDir, function(readdirErr, files) {
if (readdirErr) {
return callback(new errors.PluginsListingError(readdirErr));
}
var fullpath, pkg;
var descriptors = [ ];
files.forEach(function (file) {... | javascript | function listPlugins(callback) {
callback = utils.defineCallback(callback);
return fs.readdir(pluginsDir, function(readdirErr, files) {
if (readdirErr) {
return callback(new errors.PluginsListingError(readdirErr));
}
var fullpath, pkg;
var descriptors = [ ];
files.forEach(function (file) {... | [
"function",
"listPlugins",
"(",
"callback",
")",
"{",
"callback",
"=",
"utils",
".",
"defineCallback",
"(",
"callback",
")",
";",
"return",
"fs",
".",
"readdir",
"(",
"pluginsDir",
",",
"function",
"(",
"readdirErr",
",",
"files",
")",
"{",
"if",
"(",
"r... | Listing installed plugins
@param {Function} [callback] - callback(err, descriptors) | [
"Listing",
"installed",
"plugins"
] | eb645eb21f350a0fbbf783d83b25ab18feeee684 | https://github.com/docvy/plugin-installer/blob/eb645eb21f350a0fbbf783d83b25ab18feeee684/lib/installer.js#L106-L135 |
54,710 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/list/plugin.js | inheirtInlineStyles | function inheirtInlineStyles( parent, el ) {
var style = parent.getAttribute( 'style' );
// Put parent styles before child styles.
style && el.setAttribute( 'style', style.replace( /([^;])$/, '$1;' ) + ( el.getAttribute( 'style' ) || '' ) );
} | javascript | function inheirtInlineStyles( parent, el ) {
var style = parent.getAttribute( 'style' );
// Put parent styles before child styles.
style && el.setAttribute( 'style', style.replace( /([^;])$/, '$1;' ) + ( el.getAttribute( 'style' ) || '' ) );
} | [
"function",
"inheirtInlineStyles",
"(",
"parent",
",",
"el",
")",
"{",
"var",
"style",
"=",
"parent",
".",
"getAttribute",
"(",
"'style'",
")",
";",
"// Put parent styles before child styles.\r",
"style",
"&&",
"el",
".",
"setAttribute",
"(",
"'style'",
",",
"st... | Inheirt inline styles from another element. | [
"Inheirt",
"inline",
"styles",
"from",
"another",
"element",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/list/plugin.js#L34-L39 |
54,711 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/list/plugin.js | mergeListSiblings | function mergeListSiblings( listNode )
{
var mergeSibling;
( mergeSibling = function( rtl )
{
var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( nonEmpty );
if ( sibling &&
sibling.type == CKEDITOR.NODE_ELEMENT &&
sibling.is( listNode.getName() ) )
{
// Move childre... | javascript | function mergeListSiblings( listNode )
{
var mergeSibling;
( mergeSibling = function( rtl )
{
var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( nonEmpty );
if ( sibling &&
sibling.type == CKEDITOR.NODE_ELEMENT &&
sibling.is( listNode.getName() ) )
{
// Move childre... | [
"function",
"mergeListSiblings",
"(",
"listNode",
")",
"{",
"var",
"mergeSibling",
";",
"(",
"mergeSibling",
"=",
"function",
"(",
"rtl",
")",
"{",
"var",
"sibling",
"=",
"listNode",
"[",
"rtl",
"?",
"'getPrevious'",
":",
"'getNext'",
"]",
"(",
"nonEmpty",
... | Merge list adjacent, of same type lists. | [
"Merge",
"list",
"adjacent",
"of",
"same",
"type",
"lists",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/list/plugin.js#L680-L698 |
54,712 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/list/plugin.js | isTextBlock | function isTextBlock( node ) {
return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in CKEDITOR.dtd.$block || node.getName() in CKEDITOR.dtd.$listItem ) && CKEDITOR.dtd[ node.getName() ][ '#' ];
} | javascript | function isTextBlock( node ) {
return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in CKEDITOR.dtd.$block || node.getName() in CKEDITOR.dtd.$listItem ) && CKEDITOR.dtd[ node.getName() ][ '#' ];
} | [
"function",
"isTextBlock",
"(",
"node",
")",
"{",
"return",
"node",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_ELEMENT",
"&&",
"(",
"node",
".",
"getName",
"(",
")",
"in",
"CKEDITOR",
".",
"dtd",
".",
"$block",
"||",
"node",
".",
"getName",
"(",
")",
... | Check if node is block element that recieves text. | [
"Check",
"if",
"node",
"is",
"block",
"element",
"that",
"recieves",
"text",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/list/plugin.js#L715-L717 |
54,713 | activethread/vulpejs | lib/routes/index.js | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'SAVE';
options.res = res;
if (req.params.model) {
options.model = req.params.model;
}
if (req.body) {
options.item = req.body;
}
if (req.params.data) {
options.data = req.param... | javascript | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'SAVE';
options.res = res;
if (req.params.model) {
options.model = req.params.model;
}
if (req.body) {
options.item = req.body;
}
if (req.params.data) {
options.data = req.param... | [
"function",
"(",
"req",
",",
"res",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
".",
"operation",
"=",
"'SAVE'",
";",
"options",
".",
"res",
"=",
"res",
";",
"if",
"(",
"req",
".... | Save object in database.
@param {Object} req Request
@param {Object} res Response
@param {Object} options {model, data, callback} | [
"Save",
"object",
"in",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L212-L257 | |
54,714 | activethread/vulpejs | lib/routes/index.js | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'REMOVE';
options.res = res;
if (!options) {
options = {};
}
if (req.params.model) {
options.model = req.params.model;
}
if (req.params.query) {
options.query = req.params.query... | javascript | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'REMOVE';
options.res = res;
if (!options) {
options = {};
}
if (req.params.model) {
options.model = req.params.model;
}
if (req.params.query) {
options.query = req.params.query... | [
"function",
"(",
"req",
",",
"res",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
".",
"operation",
"=",
"'REMOVE'",
";",
"options",
".",
"res",
"=",
"res",
";",
"if",
"(",
"!",
"o... | Remove object from database by id and callback if success.
@param {Object} req Request
@param {Object} res Response
@param {Object} options {model, id, callback} | [
"Remove",
"object",
"from",
"database",
"by",
"id",
"and",
"callback",
"if",
"success",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L269-L319 | |
54,715 | activethread/vulpejs | lib/routes/index.js | function (req, res) {
var options = {
operation: 'LIST',
res: res,
};
exports.list.before(req, res, options);
vulpejs.models.list({
model: req.params.model,
query: req.params.query || {},
populate: req.params.populate || '',
sort: req.params.sort || {},
userId: ... | javascript | function (req, res) {
var options = {
operation: 'LIST',
res: res,
};
exports.list.before(req, res, options);
vulpejs.models.list({
model: req.params.model,
query: req.params.query || {},
populate: req.params.populate || '',
sort: req.params.sort || {},
userId: ... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"options",
"=",
"{",
"operation",
":",
"'LIST'",
",",
"res",
":",
"res",
",",
"}",
";",
"exports",
".",
"list",
".",
"before",
"(",
"req",
",",
"res",
",",
"options",
")",
";",
"vulpejs",
".",
... | List from database.
@param {Object} req Request
@param {Object} res Response | [
"List",
"from",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L330-L354 | |
54,716 | activethread/vulpejs | lib/routes/index.js | function (req, res) {
var options = {
operation: 'PAGINATE',
res: res,
};
exports.paginate.before(req, res, options);
vulpejs.models.paginate({
model: req.params.model,
query: req.params.query || {},
populate: req.params.populate || '',
sort: req.params.sort || {},
... | javascript | function (req, res) {
var options = {
operation: 'PAGINATE',
res: res,
};
exports.paginate.before(req, res, options);
vulpejs.models.paginate({
model: req.params.model,
query: req.params.query || {},
populate: req.params.populate || '',
sort: req.params.sort || {},
... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"options",
"=",
"{",
"operation",
":",
"'PAGINATE'",
",",
"res",
":",
"res",
",",
"}",
";",
"exports",
".",
"paginate",
".",
"before",
"(",
"req",
",",
"res",
",",
"options",
")",
";",
"vulpejs",... | Paginate list from database.
@param {Object} req Request
@param {Object} res Response | [
"Paginate",
"list",
"from",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L365-L392 | |
54,717 | activethread/vulpejs | lib/routes/index.js | function (req, res) {
var options = {
operation: 'DISTINCT',
res: res,
};
exports.distinct.before(req, res, options);
vulpejs.models.distinct({
model: req.params.model,
query: req.params.query || {},
sort: req.params.sort || false,
array: req.params.array || false,
... | javascript | function (req, res) {
var options = {
operation: 'DISTINCT',
res: res,
};
exports.distinct.before(req, res, options);
vulpejs.models.distinct({
model: req.params.model,
query: req.params.query || {},
sort: req.params.sort || false,
array: req.params.array || false,
... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"options",
"=",
"{",
"operation",
":",
"'DISTINCT'",
",",
"res",
":",
"res",
",",
"}",
";",
"exports",
".",
"distinct",
".",
"before",
"(",
"req",
",",
"res",
",",
"options",
")",
";",
"vulpejs",... | Retrive distinct list of objects from database.
@param {Object} req Request
@param {Object} res Response | [
"Retrive",
"distinct",
"list",
"of",
"objects",
"from",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L403-L425 | |
54,718 | activethread/vulpejs | lib/routes/index.js | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'FIND';
options.res = res;
exports.find.before(req, res, options);
vulpejs.models.find({
model: req.params.model,
populate: req.params.populate,
history: true,
id: req.params.id || fa... | javascript | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'FIND';
options.res = res;
exports.find.before(req, res, options);
vulpejs.models.find({
model: req.params.model,
populate: req.params.populate,
history: true,
id: req.params.id || fa... | [
"function",
"(",
"req",
",",
"res",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
".",
"operation",
"=",
"'FIND'",
";",
"options",
".",
"res",
"=",
"res",
";",
"exports",
".",
"find"... | Find object in database.
@param {Object} req Request
@param {Object} res Response
@param {Object} options {model, populate, callback} | [
"Find",
"object",
"in",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L437-L470 | |
54,719 | activethread/vulpejs | lib/routes/index.js | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'STATUS';
options.res = res;
exports.status.before(req, res, options);
vulpejs.models.status({
model: req.params.model,
data: req.body,
callback: {
success: function (item) {
... | javascript | function (req, res, options) {
if (!options) {
options = {};
}
options.operation = 'STATUS';
options.res = res;
exports.status.before(req, res, options);
vulpejs.models.status({
model: req.params.model,
data: req.body,
callback: {
success: function (item) {
... | [
"function",
"(",
"req",
",",
"res",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
".",
"operation",
"=",
"'STATUS'",
";",
"options",
".",
"res",
"=",
"res",
";",
"exports",
".",
"sta... | Change status of object in database.
@param {Object} req Request
@param {Object} res Response
@param {Object} options {model, callback} | [
"Change",
"status",
"of",
"object",
"in",
"database",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L550-L574 | |
54,720 | activethread/vulpejs | lib/routes/index.js | function (configObject) {
if (typeof configObject !== 'undefined') {
configuration.directory = configObject.directory || configuration.directory;
configuration.extension = configObject.extension || configuration.extension;
configuration.objectNotation = configObject.objectNotation || configuration... | javascript | function (configObject) {
if (typeof configObject !== 'undefined') {
configuration.directory = configObject.directory || configuration.directory;
configuration.extension = configObject.extension || configuration.extension;
configuration.objectNotation = configObject.objectNotation || configuration... | [
"function",
"(",
"configObject",
")",
"{",
"if",
"(",
"typeof",
"configObject",
"!==",
"'undefined'",
")",
"{",
"configuration",
".",
"directory",
"=",
"configObject",
".",
"directory",
"||",
"configuration",
".",
"directory",
";",
"configuration",
".",
"extensi... | Configure the express routes through which translations are served.
@param app
@param {Object} [configObject] | [
"Configure",
"the",
"express",
"routes",
"through",
"which",
"translations",
"are",
"served",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L1117-L1128 | |
54,721 | activethread/vulpejs | lib/routes/index.js | function (request, response, next) {
response.locals.i18n = {
getLocale: function () {
return request.cookies.appLanguage || vulpejs.i18n.getLocale.apply(request, arguments);
},
};
// For backwards compatibility, also define 'acceptedLanguage'.
response.locals.acceptedLanguage = res... | javascript | function (request, response, next) {
response.locals.i18n = {
getLocale: function () {
return request.cookies.appLanguage || vulpejs.i18n.getLocale.apply(request, arguments);
},
};
// For backwards compatibility, also define 'acceptedLanguage'.
response.locals.acceptedLanguage = res... | [
"function",
"(",
"request",
",",
"response",
",",
"next",
")",
"{",
"response",
".",
"locals",
".",
"i18n",
"=",
"{",
"getLocale",
":",
"function",
"(",
")",
"{",
"return",
"request",
".",
"cookies",
".",
"appLanguage",
"||",
"vulpejs",
".",
"i18n",
".... | Middleware to allow retrieval of users locale in the template engine.
@param {Object} request
@param {Object} response
@param {Function} [next] | [
"Middleware",
"to",
"allow",
"retrieval",
"of",
"users",
"locale",
"in",
"the",
"template",
"engine",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L1136-L1149 | |
54,722 | activethread/vulpejs | lib/routes/index.js | function (request, response) {
var locale = request.params.locale;
var sendFile = response.sendFile || response.sendfile;
sendFile.apply(response, [path.join(configuration.directory, locale + configuration.extension)]);
} | javascript | function (request, response) {
var locale = request.params.locale;
var sendFile = response.sendFile || response.sendfile;
sendFile.apply(response, [path.join(configuration.directory, locale + configuration.extension)]);
} | [
"function",
"(",
"request",
",",
"response",
")",
"{",
"var",
"locale",
"=",
"request",
".",
"params",
".",
"locale",
";",
"var",
"sendFile",
"=",
"response",
".",
"sendFile",
"||",
"response",
".",
"sendfile",
";",
"sendFile",
".",
"apply",
"(",
"respon... | Sends a translation file to the client.
@param request
@param response | [
"Sends",
"a",
"translation",
"file",
"to",
"the",
"client",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L1157-L1161 | |
54,723 | activethread/vulpejs | lib/routes/index.js | function (request, response) {
var locale = request.params.locale;
var phrase = request.params.phrase;
var result;
if (request.query.plural) {
var singular = phrase;
var plural = request.query.plural;
// Make sure the information is added to the catalog if it doesn't exi... | javascript | function (request, response) {
var locale = request.params.locale;
var phrase = request.params.phrase;
var result;
if (request.query.plural) {
var singular = phrase;
var plural = request.query.plural;
// Make sure the information is added to the catalog if it doesn't exi... | [
"function",
"(",
"request",
",",
"response",
")",
"{",
"var",
"locale",
"=",
"request",
".",
"params",
".",
"locale",
";",
"var",
"phrase",
"=",
"request",
".",
"params",
".",
"phrase",
";",
"var",
"result",
";",
"if",
"(",
"request",
".",
"query",
"... | Translate a given string and provide the result.
@param request
@param response | [
"Translate",
"a",
"given",
"string",
"and",
"provide",
"the",
"result",
"."
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/routes/index.js#L1168-L1195 | |
54,724 | byu-oit/aws-scatter-gather | bin/middleware.js | subscribe | function subscribe(topicArn) {
// validate the topic arn
if (!rxTopicArn.test(topicArn)) throw Error('Cannot subscribe to an invalid AWS Topic Arn: ' + topicArn);
// if already subscribed then return now
if (subscriptions[topicArn]) return subscriptions[topicArn].promise;
// c... | javascript | function subscribe(topicArn) {
// validate the topic arn
if (!rxTopicArn.test(topicArn)) throw Error('Cannot subscribe to an invalid AWS Topic Arn: ' + topicArn);
// if already subscribed then return now
if (subscriptions[topicArn]) return subscriptions[topicArn].promise;
// c... | [
"function",
"subscribe",
"(",
"topicArn",
")",
"{",
"// validate the topic arn",
"if",
"(",
"!",
"rxTopicArn",
".",
"test",
"(",
"topicArn",
")",
")",
"throw",
"Error",
"(",
"'Cannot subscribe to an invalid AWS Topic Arn: '",
"+",
"topicArn",
")",
";",
"// if alread... | Subscribe to an SNS Topic.
@param {string} topicArn
@returns {Promise} | [
"Subscribe",
"to",
"an",
"SNS",
"Topic",
"."
] | 708e7caa6bea706276d55b3678d8468438d6d163 | https://github.com/byu-oit/aws-scatter-gather/blob/708e7caa6bea706276d55b3678d8468438d6d163/bin/middleware.js#L150-L174 |
54,725 | byu-oit/aws-scatter-gather | bin/middleware.js | unsubscribe | function unsubscribe(topicArn) {
// if not subscribed then return now
if (!subscriptions[topicArn]) {
debug('Not subscribed to ' + topicArn);
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
const params = { SubscriptionArn:... | javascript | function unsubscribe(topicArn) {
// if not subscribed then return now
if (!subscriptions[topicArn]) {
debug('Not subscribed to ' + topicArn);
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
const params = { SubscriptionArn:... | [
"function",
"unsubscribe",
"(",
"topicArn",
")",
"{",
"// if not subscribed then return now",
"if",
"(",
"!",
"subscriptions",
"[",
"topicArn",
"]",
")",
"{",
"debug",
"(",
"'Not subscribed to '",
"+",
"topicArn",
")",
";",
"return",
"Promise",
".",
"resolve",
"... | Unsubscribe from an SNS Topic
@param {string} topicArn
@returns {Promise} | [
"Unsubscribe",
"from",
"an",
"SNS",
"Topic"
] | 708e7caa6bea706276d55b3678d8468438d6d163 | https://github.com/byu-oit/aws-scatter-gather/blob/708e7caa6bea706276d55b3678d8468438d6d163/bin/middleware.js#L181-L198 |
54,726 | byu-oit/aws-scatter-gather | bin/middleware.js | parseBody | function parseBody(req) {
return extractBody(req)
.then(() => {
if (req.body && typeof req.body === 'object') return req.body;
try {
return JSON.parse(req.body);
} catch (err) {
throw Error('Unexpected body format received. Expected applica... | javascript | function parseBody(req) {
return extractBody(req)
.then(() => {
if (req.body && typeof req.body === 'object') return req.body;
try {
return JSON.parse(req.body);
} catch (err) {
throw Error('Unexpected body format received. Expected applica... | [
"function",
"parseBody",
"(",
"req",
")",
"{",
"return",
"extractBody",
"(",
"req",
")",
".",
"then",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
"req",
".",
"body",
"&&",
"typeof",
"req",
".",
"body",
"===",
"'object'",
")",
"return",
"req",
".",
"body",... | Parse the response body.
@param {Object} req
@returns {Promise} | [
"Parse",
"the",
"response",
"body",
"."
] | 708e7caa6bea706276d55b3678d8468438d6d163 | https://github.com/byu-oit/aws-scatter-gather/blob/708e7caa6bea706276d55b3678d8468438d6d163/bin/middleware.js#L225-L235 |
54,727 | zouloux/semver-increment | index.js | function (version, semverIndex)
{
const splittedVersion = version.split('.');
splittedVersion[ semverIndex ] = parseInt(splittedVersion[ semverIndex ], 10) + 1;
while (semverIndex < 2)
{
splittedVersion[ ++semverIndex ] = '0';
}
return splittedVersion.join('.');
} | javascript | function (version, semverIndex)
{
const splittedVersion = version.split('.');
splittedVersion[ semverIndex ] = parseInt(splittedVersion[ semverIndex ], 10) + 1;
while (semverIndex < 2)
{
splittedVersion[ ++semverIndex ] = '0';
}
return splittedVersion.join('.');
} | [
"function",
"(",
"version",
",",
"semverIndex",
")",
"{",
"const",
"splittedVersion",
"=",
"version",
".",
"split",
"(",
"'.'",
")",
";",
"splittedVersion",
"[",
"semverIndex",
"]",
"=",
"parseInt",
"(",
"splittedVersion",
"[",
"semverIndex",
"]",
",",
"10",... | Increment a version which is as a string. | [
"Increment",
"a",
"version",
"which",
"is",
"as",
"a",
"string",
"."
] | 4c65abeb42a17ad05d147108d595cd490eaafc4d | https://github.com/zouloux/semver-increment/blob/4c65abeb42a17ad05d147108d595cd490eaafc4d/index.js#L25-L34 | |
54,728 | zouloux/semver-increment | index.js | function (packagePath, semverIndex)
{
// Check if package file exists
if ( !fs.existsSync(packagePath) )
{
throw new Error(`Package file ${packagePath} is not found.`, 1);
}
// Read package file content
const packageData = JSON.parse( fs.readFileSync( packagePath ) );
// Increment version according ... | javascript | function (packagePath, semverIndex)
{
// Check if package file exists
if ( !fs.existsSync(packagePath) )
{
throw new Error(`Package file ${packagePath} is not found.`, 1);
}
// Read package file content
const packageData = JSON.parse( fs.readFileSync( packagePath ) );
// Increment version according ... | [
"function",
"(",
"packagePath",
",",
"semverIndex",
")",
"{",
"// Check if package file exists",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"packagePath",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"packagePath",
"}",
"`",
",",
"1",
")",
... | Increment any package.json version. | [
"Increment",
"any",
"package",
".",
"json",
"version",
"."
] | 4c65abeb42a17ad05d147108d595cd490eaafc4d | https://github.com/zouloux/semver-increment/blob/4c65abeb42a17ad05d147108d595cd490eaafc4d/index.js#L39-L58 | |
54,729 | shenanigans/node-fauxmongo | lib/Project.js | multiproject | function multiproject (pointer, target, path) {
var pointerType = getTypeStr (pointer);
var mainTarget;
if (target)
mainTarget = target;
else
if (pointerType == 'object')
target = {};
else if (pointerType... | javascript | function multiproject (pointer, target, path) {
var pointerType = getTypeStr (pointer);
var mainTarget;
if (target)
mainTarget = target;
else
if (pointerType == 'object')
target = {};
else if (pointerType... | [
"function",
"multiproject",
"(",
"pointer",
",",
"target",
",",
"path",
")",
"{",
"var",
"pointerType",
"=",
"getTypeStr",
"(",
"pointer",
")",
";",
"var",
"mainTarget",
";",
"if",
"(",
"target",
")",
"mainTarget",
"=",
"target",
";",
"else",
"if",
"(",
... | in case we traverse any Arrays during this projection | [
"in",
"case",
"we",
"traverse",
"any",
"Arrays",
"during",
"this",
"projection"
] | 8aa4806f0f1da5dacc59c4fe2c1c7cd48904ce20 | https://github.com/shenanigans/node-fauxmongo/blob/8aa4806f0f1da5dacc59c4fe2c1c7cd48904ce20/lib/Project.js#L29-L101 |
54,730 | wilmoore/node-git-origin-url | index.js | origin | function origin(fn) {
'use strict';
exec('git config --local --get remote.origin.url', function (errors, stdout, stderr) {
var url = "";
if (errors) return fn(errors.stack, url);
if (stderr) return fn(stderr, url);
url = trim.call(stdout);
if (!url) return fn('Unable to find remote origin U... | javascript | function origin(fn) {
'use strict';
exec('git config --local --get remote.origin.url', function (errors, stdout, stderr) {
var url = "";
if (errors) return fn(errors.stack, url);
if (stderr) return fn(stderr, url);
url = trim.call(stdout);
if (!url) return fn('Unable to find remote origin U... | [
"function",
"origin",
"(",
"fn",
")",
"{",
"'use strict'",
";",
"exec",
"(",
"'git config --local --get remote.origin.url'",
",",
"function",
"(",
"errors",
",",
"stdout",
",",
"stderr",
")",
"{",
"var",
"url",
"=",
"\"\"",
";",
"if",
"(",
"errors",
")",
"... | Retrieve the git remote origin URL of the current repo.
@param {Function} fn
Callback to receive the result. | [
"Retrieve",
"the",
"git",
"remote",
"origin",
"URL",
"of",
"the",
"current",
"repo",
"."
] | 881e3c9c7a22c1482b5ca3a7293eb45f8b350223 | https://github.com/wilmoore/node-git-origin-url/blob/881e3c9c7a22c1482b5ca3a7293eb45f8b350223/index.js#L15-L29 |
54,731 | doowb/src-stream | index.js | srcStream | function srcStream(stream) {
var pass = through.obj();
pass.setMaxListeners(0);
var outputstream = duplexify.obj(pass, ms(stream, pass));
outputstream.setMaxListeners(0);
var isReading = false;
outputstream.on('pipe', function (src) {
isReading = true;
src.on('end', function () {
isReading =... | javascript | function srcStream(stream) {
var pass = through.obj();
pass.setMaxListeners(0);
var outputstream = duplexify.obj(pass, ms(stream, pass));
outputstream.setMaxListeners(0);
var isReading = false;
outputstream.on('pipe', function (src) {
isReading = true;
src.on('end', function () {
isReading =... | [
"function",
"srcStream",
"(",
"stream",
")",
"{",
"var",
"pass",
"=",
"through",
".",
"obj",
"(",
")",
";",
"pass",
".",
"setMaxListeners",
"(",
"0",
")",
";",
"var",
"outputstream",
"=",
"duplexify",
".",
"obj",
"(",
"pass",
",",
"ms",
"(",
"stream"... | Wrap a source stream to passthrough any data
that's being written to it.
```js
var src = require('src-stream');
// wrap something that returns a readable stream
var stream = src(plugin());
fs.createReadStream('./package.json')
.pipe(stream)
.on('data', console.log)
.on('end', function () {
console.log();
console.log... | [
"Wrap",
"a",
"source",
"stream",
"to",
"passthrough",
"any",
"data",
"that",
"s",
"being",
"written",
"to",
"it",
"."
] | 943a7222b1f7a72455a4a3f74cb0b8245f90ad81 | https://github.com/doowb/src-stream/blob/943a7222b1f7a72455a4a3f74cb0b8245f90ad81/index.js#L39-L62 |
54,732 | llamadeus/data-to-png | cjs/index.js | createIHDRChunk | function createIHDRChunk(width, height) {
const data = buffer.Buffer.alloc(13);
// Width
data.writeUInt32BE(width);
// Height
data.writeUInt32BE(height, 4);
// Bit depth
data.writeUInt8(8, 8);
// RGBA mode
data.writeUInt8(6, 9);
// No compression
data.writeUInt8(0, 10);
// No filter
data.writeUInt8(0, 11)... | javascript | function createIHDRChunk(width, height) {
const data = buffer.Buffer.alloc(13);
// Width
data.writeUInt32BE(width);
// Height
data.writeUInt32BE(height, 4);
// Bit depth
data.writeUInt8(8, 8);
// RGBA mode
data.writeUInt8(6, 9);
// No compression
data.writeUInt8(0, 10);
// No filter
data.writeUInt8(0, 11)... | [
"function",
"createIHDRChunk",
"(",
"width",
",",
"height",
")",
"{",
"const",
"data",
"=",
"buffer",
".",
"Buffer",
".",
"alloc",
"(",
"13",
")",
";",
"// Width",
"data",
".",
"writeUInt32BE",
"(",
"width",
")",
";",
"// Height",
"data",
".",
"writeUInt... | Create the IHDR chunk.
@param width
@param height
@returns {Buffer} | [
"Create",
"the",
"IHDR",
"chunk",
"."
] | 8170197b4213d86a56c7b0cc4952f80a1e840766 | https://github.com/llamadeus/data-to-png/blob/8170197b4213d86a56c7b0cc4952f80a1e840766/cjs/index.js#L53-L72 |
54,733 | llamadeus/data-to-png | cjs/index.js | createPng | function createPng(pixelData) {
const length = pixelData.length + 4 - (pixelData.length % 4);
const pixels = Math.ceil(length / 4);
const width = Math.min(pixels, MAX_WIDTH);
const height = Math.ceil(pixels / MAX_WIDTH);
const bytesPerRow = width * 4;
const buffer$$1 = buffer.Buffer.alloc((bytesPerRow + 1) * heig... | javascript | function createPng(pixelData) {
const length = pixelData.length + 4 - (pixelData.length % 4);
const pixels = Math.ceil(length / 4);
const width = Math.min(pixels, MAX_WIDTH);
const height = Math.ceil(pixels / MAX_WIDTH);
const bytesPerRow = width * 4;
const buffer$$1 = buffer.Buffer.alloc((bytesPerRow + 1) * heig... | [
"function",
"createPng",
"(",
"pixelData",
")",
"{",
"const",
"length",
"=",
"pixelData",
".",
"length",
"+",
"4",
"-",
"(",
"pixelData",
".",
"length",
"%",
"4",
")",
";",
"const",
"pixels",
"=",
"Math",
".",
"ceil",
"(",
"length",
"/",
"4",
")",
... | Create a png from the given pixel data.
@param pixelData
@returns {Promise<Buffer>} | [
"Create",
"a",
"png",
"from",
"the",
"given",
"pixel",
"data",
"."
] | 8170197b4213d86a56c7b0cc4952f80a1e840766 | https://github.com/llamadeus/data-to-png/blob/8170197b4213d86a56c7b0cc4952f80a1e840766/cjs/index.js#L99-L133 |
54,734 | llamadeus/data-to-png | cjs/index.js | prependLength | function prependLength(data) {
const lengthAsBytes = buffer.Buffer.alloc(4);
lengthAsBytes.writeUInt32BE(data.length);
return buffer.Buffer.concat([lengthAsBytes, data]);
} | javascript | function prependLength(data) {
const lengthAsBytes = buffer.Buffer.alloc(4);
lengthAsBytes.writeUInt32BE(data.length);
return buffer.Buffer.concat([lengthAsBytes, data]);
} | [
"function",
"prependLength",
"(",
"data",
")",
"{",
"const",
"lengthAsBytes",
"=",
"buffer",
".",
"Buffer",
".",
"alloc",
"(",
"4",
")",
";",
"lengthAsBytes",
".",
"writeUInt32BE",
"(",
"data",
".",
"length",
")",
";",
"return",
"buffer",
".",
"Buffer",
... | Prepend length to the data.
@param data
@returns {Buffer} | [
"Prepend",
"length",
"to",
"the",
"data",
"."
] | 8170197b4213d86a56c7b0cc4952f80a1e840766 | https://github.com/llamadeus/data-to-png/blob/8170197b4213d86a56c7b0cc4952f80a1e840766/cjs/index.js#L141-L147 |
54,735 | llamadeus/data-to-png | cjs/index.js | encode | function encode(data) {
const bytes = buffer.Buffer.from(data, 'utf8');
const pixelData = prependLength(bytes);
return createPng(pixelData);
} | javascript | function encode(data) {
const bytes = buffer.Buffer.from(data, 'utf8');
const pixelData = prependLength(bytes);
return createPng(pixelData);
} | [
"function",
"encode",
"(",
"data",
")",
"{",
"const",
"bytes",
"=",
"buffer",
".",
"Buffer",
".",
"from",
"(",
"data",
",",
"'utf8'",
")",
";",
"const",
"pixelData",
"=",
"prependLength",
"(",
"bytes",
")",
";",
"return",
"createPng",
"(",
"pixelData",
... | Encode the given data to png.
@param {string} data
@returns {Promise<Buffer>} | [
"Encode",
"the",
"given",
"data",
"to",
"png",
"."
] | 8170197b4213d86a56c7b0cc4952f80a1e840766 | https://github.com/llamadeus/data-to-png/blob/8170197b4213d86a56c7b0cc4952f80a1e840766/cjs/index.js#L155-L160 |
54,736 | jkorona/grunt-release-bower | lib/semver-utils.js | function (increment) {
increment = increment || Semver.PATCH; // default is patch
switch (increment) {
/* jshint indent: false */
case Semver.MAJOR:
this.major++;
this.minor = this.patch = 0;
break;
case Semver.MINOR:
... | javascript | function (increment) {
increment = increment || Semver.PATCH; // default is patch
switch (increment) {
/* jshint indent: false */
case Semver.MAJOR:
this.major++;
this.minor = this.patch = 0;
break;
case Semver.MINOR:
... | [
"function",
"(",
"increment",
")",
"{",
"increment",
"=",
"increment",
"||",
"Semver",
".",
"PATCH",
";",
"// default is patch",
"switch",
"(",
"increment",
")",
"{",
"/* jshint indent: false */",
"case",
"Semver",
".",
"MAJOR",
":",
"this",
".",
"major",
"++"... | Increases version number using increment factor.
@param increment indicates which part of version should be pumped (major, minor, patch).
@returns {*} current Semver instance for method chaining. | [
"Increases",
"version",
"number",
"using",
"increment",
"factor",
"."
] | a1b0e0b4aa85eced889f75ee88f45e187af9ae24 | https://github.com/jkorona/grunt-release-bower/blob/a1b0e0b4aa85eced889f75ee88f45e187af9ae24/lib/semver-utils.js#L22-L39 | |
54,737 | angeloocana/joj-core | dist-esnext/Game.js | isMyTurn | function isMyTurn(game, from) {
if (game.score.ended)
return false;
from = Board.getPositionFromBoard(game.board, from);
return isWhiteTurn(game) ? Position.hasWhitePiece(from) : Position.hasBlackPiece(from);
} | javascript | function isMyTurn(game, from) {
if (game.score.ended)
return false;
from = Board.getPositionFromBoard(game.board, from);
return isWhiteTurn(game) ? Position.hasWhitePiece(from) : Position.hasBlackPiece(from);
} | [
"function",
"isMyTurn",
"(",
"game",
",",
"from",
")",
"{",
"if",
"(",
"game",
".",
"score",
".",
"ended",
")",
"return",
"false",
";",
"from",
"=",
"Board",
".",
"getPositionFromBoard",
"(",
"game",
".",
"board",
",",
"from",
")",
";",
"return",
"is... | Returns true if from piece can be played. | [
"Returns",
"true",
"if",
"from",
"piece",
"can",
"be",
"played",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist-esnext/Game.js#L22-L27 |
54,738 | angeloocana/joj-core | dist-esnext/Game.js | getTurnPieces | function getTurnPieces(game) {
const isBlack = isBlackTurn(game);
return game.board.reduce((piecesRow, row) => {
return piecesRow.concat(row.reduce((pieces, position) => (isBlack !== position.isBlack)
? pieces
: pieces.concat({ x: position.x, y: position.y, isBlack }), []));
... | javascript | function getTurnPieces(game) {
const isBlack = isBlackTurn(game);
return game.board.reduce((piecesRow, row) => {
return piecesRow.concat(row.reduce((pieces, position) => (isBlack !== position.isBlack)
? pieces
: pieces.concat({ x: position.x, y: position.y, isBlack }), []));
... | [
"function",
"getTurnPieces",
"(",
"game",
")",
"{",
"const",
"isBlack",
"=",
"isBlackTurn",
"(",
"game",
")",
";",
"return",
"game",
".",
"board",
".",
"reduce",
"(",
"(",
"piecesRow",
",",
"row",
")",
"=>",
"{",
"return",
"piecesRow",
".",
"concat",
"... | Gets all positions from current player turn. | [
"Gets",
"all",
"positions",
"from",
"current",
"player",
"turn",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist-esnext/Game.js#L32-L39 |
54,739 | wigy/chronicles_of_grunt | lib/cog.js | prefix | function prefix(pattern) {
if (!pattern) {
pattern = 'grunt-available-tasks';
}
pattern = pattern.replace(/^node_modules\//, '');
var ret;
if (grunt.file.expand('node_modules/' + pattern).length) {
ret = 'node_modules/';
} else if (grunt.file.expan... | javascript | function prefix(pattern) {
if (!pattern) {
pattern = 'grunt-available-tasks';
}
pattern = pattern.replace(/^node_modules\//, '');
var ret;
if (grunt.file.expand('node_modules/' + pattern).length) {
ret = 'node_modules/';
} else if (grunt.file.expan... | [
"function",
"prefix",
"(",
"pattern",
")",
"{",
"if",
"(",
"!",
"pattern",
")",
"{",
"pattern",
"=",
"'grunt-available-tasks'",
";",
"}",
"pattern",
"=",
"pattern",
".",
"replace",
"(",
"/",
"^node_modules\\/",
"/",
",",
"''",
")",
";",
"var",
"ret",
"... | Find the path prefix to the node_modules containing needed utilities. | [
"Find",
"the",
"path",
"prefix",
"to",
"the",
"node_modules",
"containing",
"needed",
"utilities",
"."
] | c5f089a6f391a0ca625fcb81ef51907713471bb3 | https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/cog.js#L45-L61 |
54,740 | wigy/chronicles_of_grunt | lib/cog.js | getConfig | function getConfig(name, def) {
var i, j;
// Load initital config.
if (!config) {
var external;
config = grunt.config.get('cog') || {options: {}};
// Expand general external definitions to category specific definitions.
if (config.options.exte... | javascript | function getConfig(name, def) {
var i, j;
// Load initital config.
if (!config) {
var external;
config = grunt.config.get('cog') || {options: {}};
// Expand general external definitions to category specific definitions.
if (config.options.exte... | [
"function",
"getConfig",
"(",
"name",
",",
"def",
")",
"{",
"var",
"i",
",",
"j",
";",
"// Load initital config.",
"if",
"(",
"!",
"config",
")",
"{",
"var",
"external",
";",
"config",
"=",
"grunt",
".",
"config",
".",
"get",
"(",
"'cog'",
")",
"||",... | Safe fetch of configuration variable. | [
"Safe",
"fetch",
"of",
"configuration",
"variable",
"."
] | c5f089a6f391a0ca625fcb81ef51907713471bb3 | https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/cog.js#L76-L133 |
54,741 | wigy/chronicles_of_grunt | lib/cog.js | configuredFramework | function configuredFramework() {
var lib = getConfig('external.lib');
if (!lib) {
return null;
}
if (typeof(lib) === 'string') {
lib = [lib];
}
if (lib.indexOf('ember') >= 0) {
return 'ember';
}
if (lib.indexOf('angular'... | javascript | function configuredFramework() {
var lib = getConfig('external.lib');
if (!lib) {
return null;
}
if (typeof(lib) === 'string') {
lib = [lib];
}
if (lib.indexOf('ember') >= 0) {
return 'ember';
}
if (lib.indexOf('angular'... | [
"function",
"configuredFramework",
"(",
")",
"{",
"var",
"lib",
"=",
"getConfig",
"(",
"'external.lib'",
")",
";",
"if",
"(",
"!",
"lib",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"typeof",
"(",
"lib",
")",
"===",
"'string'",
")",
"{",
"lib",
... | Check the frameworks defined. | [
"Check",
"the",
"frameworks",
"defined",
"."
] | c5f089a6f391a0ca625fcb81ef51907713471bb3 | https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/cog.js#L138-L153 |
54,742 | wigy/chronicles_of_grunt | lib/cog.js | getOption | function getOption(name) {
var ret = getConfig('options.' + name);
if (ret === undefined) {
var framework = configuredFramework();
if (db.frameworks.options[framework] && (name in db.frameworks.options[framework])) {
ret = db.frameworks.options[framework][name];
... | javascript | function getOption(name) {
var ret = getConfig('options.' + name);
if (ret === undefined) {
var framework = configuredFramework();
if (db.frameworks.options[framework] && (name in db.frameworks.options[framework])) {
ret = db.frameworks.options[framework][name];
... | [
"function",
"getOption",
"(",
"name",
")",
"{",
"var",
"ret",
"=",
"getConfig",
"(",
"'options.'",
"+",
"name",
")",
";",
"if",
"(",
"ret",
"===",
"undefined",
")",
"{",
"var",
"framework",
"=",
"configuredFramework",
"(",
")",
";",
"if",
"(",
"db",
... | Get the value of a configuration flag. | [
"Get",
"the",
"value",
"of",
"a",
"configuration",
"flag",
"."
] | c5f089a6f391a0ca625fcb81ef51907713471bb3 | https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/cog.js#L180-L196 |
54,743 | flitbit/oops | examples/browser/vendor/angular-ui.js | function (inst) {
if (inst.isDirty()) {
inst.save();
ngModel.$setViewValue(elm.val());
if (!scope.$$phase)
scope.$apply();
}
} | javascript | function (inst) {
if (inst.isDirty()) {
inst.save();
ngModel.$setViewValue(elm.val());
if (!scope.$$phase)
scope.$apply();
}
} | [
"function",
"(",
"inst",
")",
"{",
"if",
"(",
"inst",
".",
"isDirty",
"(",
")",
")",
"{",
"inst",
".",
"save",
"(",
")",
";",
"ngModel",
".",
"$setViewValue",
"(",
"elm",
".",
"val",
"(",
")",
")",
";",
"if",
"(",
"!",
"scope",
".",
"$$phase",
... | Update model on button click | [
"Update",
"model",
"on",
"button",
"click"
] | 73c36d459b98d1ac9485327ab3d6bf180c78d254 | https://github.com/flitbit/oops/blob/73c36d459b98d1ac9485327ab3d6bf180c78d254/examples/browser/vendor/angular-ui.js#L758-L765 | |
54,744 | flitbit/oops | examples/browser/vendor/angular-ui.js | function(event, jsEvent, view) {
if (view.name !== 'agendaDay') {
$(jsEvent.target).attr('title', event.title);
}
} | javascript | function(event, jsEvent, view) {
if (view.name !== 'agendaDay') {
$(jsEvent.target).attr('title', event.title);
}
} | [
"function",
"(",
"event",
",",
"jsEvent",
",",
"view",
")",
"{",
"if",
"(",
"view",
".",
"name",
"!==",
"'agendaDay'",
")",
"{",
"$",
"(",
"jsEvent",
".",
"target",
")",
".",
"attr",
"(",
"'title'",
",",
"event",
".",
"title",
")",
";",
"}",
"}"
... | add event name to title attribute on mouseover. | [
"add",
"event",
"name",
"to",
"title",
"attribute",
"on",
"mouseover",
"."
] | 73c36d459b98d1ac9485327ab3d6bf180c78d254 | https://github.com/flitbit/oops/blob/73c36d459b98d1ac9485327ab3d6bf180c78d254/examples/browser/vendor/angular-ui.js#L913-L917 | |
54,745 | patgrasso/parsey | lib/cfg.js | CFG | function CFG(rules) {
let arr = [];
arr.__proto__ = CFG.prototype;
if (Array.isArray(rules)) {
rules.forEach(arr.rule.bind(arr));
}
return arr;
} | javascript | function CFG(rules) {
let arr = [];
arr.__proto__ = CFG.prototype;
if (Array.isArray(rules)) {
rules.forEach(arr.rule.bind(arr));
}
return arr;
} | [
"function",
"CFG",
"(",
"rules",
")",
"{",
"let",
"arr",
"=",
"[",
"]",
";",
"arr",
".",
"__proto__",
"=",
"CFG",
".",
"prototype",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"rules",
")",
")",
"{",
"rules",
".",
"forEach",
"(",
"arr",
".",
... | Constructs a new context-free grammar, which is just a container for
production rules
@class CFG
@extends Array
@constructor
@param {rules=} - Optional array of {@link Rule}s to initialize the grammar
with | [
"Constructs",
"a",
"new",
"context",
"-",
"free",
"grammar",
"which",
"is",
"just",
"a",
"container",
"for",
"production",
"rules"
] | d28b3f330ee03b5c273f1ce5871a5b86dac79fb0 | https://github.com/patgrasso/parsey/blob/d28b3f330ee03b5c273f1ce5871a5b86dac79fb0/lib/cfg.js#L27-L36 |
54,746 | wilmoore/reapply.js | index.js | reapply | function reapply (parameters) {
return (arguments.length > 1)
? reapplyer(parameters, arguments[1])
: reapplyer.bind(null, parameters)
} | javascript | function reapply (parameters) {
return (arguments.length > 1)
? reapplyer(parameters, arguments[1])
: reapplyer.bind(null, parameters)
} | [
"function",
"reapply",
"(",
"parameters",
")",
"{",
"return",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"?",
"reapplyer",
"(",
"parameters",
",",
"arguments",
"[",
"1",
"]",
")",
":",
"reapplyer",
".",
"bind",
"(",
"null",
",",
"parameters",
")",... | Curried wrapper.
@param {String} parameters
parameters to pass to applied function.
@return {Function|*}
result of partial or full function application. | [
"Curried",
"wrapper",
"."
] | 77b558bb4a1d9d623bc32a0280e2de5f43a144b7 | https://github.com/wilmoore/reapply.js/blob/77b558bb4a1d9d623bc32a0280e2de5f43a144b7/index.js#L25-L29 |
54,747 | grappler-ci/grappler-hook-github | index.js | handlePush | function handlePush(key, req, log, fn) {
var body = req.body;
var repo = body.repository;
if (!body || !repo) return fn(new Error('missing body'));
var url = repo.url;
var name = repo.name;
var ref = body.ref;
var branch = ref.replace('refs/heads/', '');
var sha = body.after;
var info = {
repo: ... | javascript | function handlePush(key, req, log, fn) {
var body = req.body;
var repo = body.repository;
if (!body || !repo) return fn(new Error('missing body'));
var url = repo.url;
var name = repo.name;
var ref = body.ref;
var branch = ref.replace('refs/heads/', '');
var sha = body.after;
var info = {
repo: ... | [
"function",
"handlePush",
"(",
"key",
",",
"req",
",",
"log",
",",
"fn",
")",
"{",
"var",
"body",
"=",
"req",
".",
"body",
";",
"var",
"repo",
"=",
"body",
".",
"repository",
";",
"if",
"(",
"!",
"body",
"||",
"!",
"repo",
")",
"return",
"fn",
... | Handle a push event
steps:
* git clone sha
* deploy the sha
* listen for success/failure and update the repo status (https://developer.github.com/v3/repos/statuses/)
* create a deployment (https://developer.github.com/v3/repos/deployments/#create-a-deployment) | [
"Handle",
"a",
"push",
"event"
] | acb9a268ee51fd3575739a682ef2ec0ac8403e27 | https://github.com/grappler-ci/grappler-hook-github/blob/acb9a268ee51fd3575739a682ef2ec0ac8403e27/index.js#L75-L98 |
54,748 | grappler-ci/grappler-hook-github | index.js | clone | function clone(url, target, ref, key, log, fn) {
var urlObj = parseurl(url);
urlObj.auth = key + ':x-oauth-basic';
var authurl = formaturl(urlObj) + '.git';
var dir = target + '/.git';
log('creating dir ' + dir);
mkdirp(dir, function(err) {
if (err) return fn(err);
var remote = git.remote(authurl... | javascript | function clone(url, target, ref, key, log, fn) {
var urlObj = parseurl(url);
urlObj.auth = key + ':x-oauth-basic';
var authurl = formaturl(urlObj) + '.git';
var dir = target + '/.git';
log('creating dir ' + dir);
mkdirp(dir, function(err) {
if (err) return fn(err);
var remote = git.remote(authurl... | [
"function",
"clone",
"(",
"url",
",",
"target",
",",
"ref",
",",
"key",
",",
"log",
",",
"fn",
")",
"{",
"var",
"urlObj",
"=",
"parseurl",
"(",
"url",
")",
";",
"urlObj",
".",
"auth",
"=",
"key",
"+",
"':x-oauth-basic'",
";",
"var",
"authurl",
"=",... | Clone a repo
@param {String} url
@param {String} target
@param {String} ref
@param {String} key
@param {Function} log
@param {Function} fn | [
"Clone",
"a",
"repo"
] | acb9a268ee51fd3575739a682ef2ec0ac8403e27 | https://github.com/grappler-ci/grappler-hook-github/blob/acb9a268ee51fd3575739a682ef2ec0ac8403e27/index.js#L149-L180 |
54,749 | yoshuawuyts/base-package-json | index.js | basePackageJson | function basePackageJson (opts) {
opts = opts || {}
const _name = opts.name || '<name>'
const _version = opts.version || '1.0.0'
const _private = opts.private || false
var called = false
return from({ objectMode: true }, function (size, next) {
if (called) return next(null, null)
const res = { na... | javascript | function basePackageJson (opts) {
opts = opts || {}
const _name = opts.name || '<name>'
const _version = opts.version || '1.0.0'
const _private = opts.private || false
var called = false
return from({ objectMode: true }, function (size, next) {
if (called) return next(null, null)
const res = { na... | [
"function",
"basePackageJson",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"const",
"_name",
"=",
"opts",
".",
"name",
"||",
"'<name>'",
"const",
"_version",
"=",
"opts",
".",
"version",
"||",
"'1.0.0'",
"const",
"_private",
"=",
"opts",
... | Basic package.json readable stream obj -> stream | [
"Basic",
"package",
".",
"json",
"readable",
"stream",
"obj",
"-",
">",
"stream"
] | 314a6c830880fd63347775ff4daf33d0eff972e5 | https://github.com/yoshuawuyts/base-package-json/blob/314a6c830880fd63347775ff4daf33d0eff972e5/index.js#L7-L27 |
54,750 | garyns/OneLineLogger | onelinelogger.js | padLeft | function padLeft(width, string, padding) {
return (width <= string.length) ? string : padLeft(width, string + padding, padding);
} | javascript | function padLeft(width, string, padding) {
return (width <= string.length) ? string : padLeft(width, string + padding, padding);
} | [
"function",
"padLeft",
"(",
"width",
",",
"string",
",",
"padding",
")",
"{",
"return",
"(",
"width",
"<=",
"string",
".",
"length",
")",
"?",
"string",
":",
"padLeft",
"(",
"width",
",",
"string",
"+",
"padding",
",",
"padding",
")",
";",
"}"
] | Pad a string. | [
"Pad",
"a",
"string",
"."
] | 92965144fcc87fa54b15b82843b651af4b980c0d | https://github.com/garyns/OneLineLogger/blob/92965144fcc87fa54b15b82843b651af4b980c0d/onelinelogger.js#L227-L229 |
54,751 | garyns/OneLineLogger | onelinelogger.js | writeLogFile | function writeLogFile(file, line) {
if (file === undefined || file === null) {
return;
}
fs.appendFile(file, line + os.EOL, {}, function() {
//
});
} | javascript | function writeLogFile(file, line) {
if (file === undefined || file === null) {
return;
}
fs.appendFile(file, line + os.EOL, {}, function() {
//
});
} | [
"function",
"writeLogFile",
"(",
"file",
",",
"line",
")",
"{",
"if",
"(",
"file",
"===",
"undefined",
"||",
"file",
"===",
"null",
")",
"{",
"return",
";",
"}",
"fs",
".",
"appendFile",
"(",
"file",
",",
"line",
"+",
"os",
".",
"EOL",
",",
"{",
... | Appends line to a file if Logger.file is specified. | [
"Appends",
"line",
"to",
"a",
"file",
"if",
"Logger",
".",
"file",
"is",
"specified",
"."
] | 92965144fcc87fa54b15b82843b651af4b980c0d | https://github.com/garyns/OneLineLogger/blob/92965144fcc87fa54b15b82843b651af4b980c0d/onelinelogger.js#L234-L243 |
54,752 | yoshuawuyts/linkstash | index.js | Stash | function Stash(nlz) {
if (!(this instanceof Stash)) return new Stash(nlz);
nlz = nlz || function(val) {return val};
assert.equal(typeof nlz, 'function', 'linkstash: nlz should be a function');
this._prev = null;
this._next = null;
this._nlz = nlz;
return this;
} | javascript | function Stash(nlz) {
if (!(this instanceof Stash)) return new Stash(nlz);
nlz = nlz || function(val) {return val};
assert.equal(typeof nlz, 'function', 'linkstash: nlz should be a function');
this._prev = null;
this._next = null;
this._nlz = nlz;
return this;
} | [
"function",
"Stash",
"(",
"nlz",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Stash",
")",
")",
"return",
"new",
"Stash",
"(",
"nlz",
")",
";",
"nlz",
"=",
"nlz",
"||",
"function",
"(",
"val",
")",
"{",
"return",
"val",
"}",
";",
"assert... | Update the API links object. Diffs the prev
timestamp in links and updates if
it exceeds the timestamp threshold.
@param {String} prev
@param {String} next
@api private | [
"Update",
"the",
"API",
"links",
"object",
".",
"Diffs",
"the",
"prev",
"timestamp",
"in",
"links",
"and",
"updates",
"if",
"it",
"exceeds",
"the",
"timestamp",
"threshold",
"."
] | 232f576893f7311e2541c5aa5e7d1d5b78eed500 | https://github.com/yoshuawuyts/linkstash/blob/232f576893f7311e2541c5aa5e7d1d5b78eed500/index.js#L29-L40 |
54,753 | raincatcher-beta/raincatcher-sync | lib/client/mediator-subscribers/create-spec.js | checkMocksCalled | function checkMocksCalled(createResult) {
expect(createResult).to.deep.equal(createResult);
sinon.assert.calledOnce(mockDatasetManager.create);
sinon.assert.calledWith(mockDatasetManager.create, sinon.match(mockDataToCreate));
} | javascript | function checkMocksCalled(createResult) {
expect(createResult).to.deep.equal(createResult);
sinon.assert.calledOnce(mockDatasetManager.create);
sinon.assert.calledWith(mockDatasetManager.create, sinon.match(mockDataToCreate));
} | [
"function",
"checkMocksCalled",
"(",
"createResult",
")",
"{",
"expect",
"(",
"createResult",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"createResult",
")",
";",
"sinon",
".",
"assert",
".",
"calledOnce",
"(",
"mockDatasetManager",
".",
"create",
")",
... | Verifying the mocks were called with the correct parameters. | [
"Verifying",
"the",
"mocks",
"were",
"called",
"with",
"the",
"correct",
"parameters",
"."
] | a51eeb8fdea30a6afdcd0587019bd1148bf30468 | https://github.com/raincatcher-beta/raincatcher-sync/blob/a51eeb8fdea30a6afdcd0587019bd1148bf30468/lib/client/mediator-subscribers/create-spec.js#L52-L57 |
54,754 | jldec/pub-preview | jqueryview.js | nav | function nav(path, query, hash, forceReload) {
var reload = forceReload || !path;
path = path || location.pathname;
query = query || (reload && location.search) || '';
hash = hash || (reload && location.hash) || '';
var newpage = generator.findPage(path);
if (!newpage) return generator.... | javascript | function nav(path, query, hash, forceReload) {
var reload = forceReload || !path;
path = path || location.pathname;
query = query || (reload && location.search) || '';
hash = hash || (reload && location.hash) || '';
var newpage = generator.findPage(path);
if (!newpage) return generator.... | [
"function",
"nav",
"(",
"path",
",",
"query",
",",
"hash",
",",
"forceReload",
")",
"{",
"var",
"reload",
"=",
"forceReload",
"||",
"!",
"path",
";",
"path",
"=",
"path",
"||",
"location",
".",
"pathname",
";",
"query",
"=",
"query",
"||",
"(",
"relo... | navigate or reload by regenerating just the page or the whole layout | [
"navigate",
"or",
"reload",
"by",
"regenerating",
"just",
"the",
"page",
"or",
"the",
"whole",
"layout"
] | 55df6500200cbad4a4a03d8da86fef5b3ea9342c | https://github.com/jldec/pub-preview/blob/55df6500200cbad4a4a03d8da86fef5b3ea9342c/jqueryview.js#L49-L106 |
54,755 | jldec/pub-preview | jqueryview.js | layoutChanged | function layoutChanged(oldpage, newpage) {
if (oldpage && oldpage.fixlayout) return true;
if (lang(oldpage) !== lang(newpage)) return true;
var currentlayout = $layout.attr('data-render-layout') || 'main-layout';
var newlayout = generator.layoutTemplate(newpage);
return (newlayout !== curr... | javascript | function layoutChanged(oldpage, newpage) {
if (oldpage && oldpage.fixlayout) return true;
if (lang(oldpage) !== lang(newpage)) return true;
var currentlayout = $layout.attr('data-render-layout') || 'main-layout';
var newlayout = generator.layoutTemplate(newpage);
return (newlayout !== curr... | [
"function",
"layoutChanged",
"(",
"oldpage",
",",
"newpage",
")",
"{",
"if",
"(",
"oldpage",
"&&",
"oldpage",
".",
"fixlayout",
")",
"return",
"true",
";",
"if",
"(",
"lang",
"(",
"oldpage",
")",
"!==",
"lang",
"(",
"newpage",
")",
")",
"return",
"true... | return true if newpage layout is different from current layout | [
"return",
"true",
"if",
"newpage",
"layout",
"is",
"different",
"from",
"current",
"layout"
] | 55df6500200cbad4a4a03d8da86fef5b3ea9342c | https://github.com/jldec/pub-preview/blob/55df6500200cbad4a4a03d8da86fef5b3ea9342c/jqueryview.js#L98-L104 |
54,756 | jldec/pub-preview | jqueryview.js | updateHtml | function updateHtml(href) {
var fragment = generator.fragment$[href];
if (!fragment) return generator.emit('notify', 'Oops, jqueryview cannot find fragment: ' + href);
var $html = $('[data-render-html="' + href + '"]');
if (!$html.length) return generator.emit('notify', 'Oops, jqueryview cannot update ... | javascript | function updateHtml(href) {
var fragment = generator.fragment$[href];
if (!fragment) return generator.emit('notify', 'Oops, jqueryview cannot find fragment: ' + href);
var $html = $('[data-render-html="' + href + '"]');
if (!$html.length) return generator.emit('notify', 'Oops, jqueryview cannot update ... | [
"function",
"updateHtml",
"(",
"href",
")",
"{",
"var",
"fragment",
"=",
"generator",
".",
"fragment$",
"[",
"href",
"]",
";",
"if",
"(",
"!",
"fragment",
")",
"return",
"generator",
".",
"emit",
"(",
"'notify'",
",",
"'Oops, jqueryview cannot find fragment: '... | this won't work if the href of a fragment is edited | [
"this",
"won",
"t",
"work",
"if",
"the",
"href",
"of",
"a",
"fragment",
"is",
"edited"
] | 55df6500200cbad4a4a03d8da86fef5b3ea9342c | https://github.com/jldec/pub-preview/blob/55df6500200cbad4a4a03d8da86fef5b3ea9342c/jqueryview.js#L109-L119 |
54,757 | diggerio/digger-level | db/append.js | appendModel | function appendModel(url, model, done){
var list = utils.flatten_tree(JSON.parse(JSON.stringify(model)))
var errormodel = null
list = list.filter(function(model){
if(!model._digger.path || !model._digger.inode){
errormodel = model;
return false;
}
return true
})
if(errormodel){
return d... | javascript | function appendModel(url, model, done){
var list = utils.flatten_tree(JSON.parse(JSON.stringify(model)))
var errormodel = null
list = list.filter(function(model){
if(!model._digger.path || !model._digger.inode){
errormodel = model;
return false;
}
return true
})
if(errormodel){
return d... | [
"function",
"appendModel",
"(",
"url",
",",
"model",
",",
"done",
")",
"{",
"var",
"list",
"=",
"utils",
".",
"flatten_tree",
"(",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"model",
")",
")",
")",
"var",
"errormodel",
"=",
"null",
"li... | append a single model | [
"append",
"a",
"single",
"model"
] | 5ec947f28dd781171aa9db3fe457aee6b7b8c27d | https://github.com/diggerio/digger-level/blob/5ec947f28dd781171aa9db3fe457aee6b7b8c27d/db/append.js#L13-L42 |
54,758 | wilmoore/string-prepend.js | index.js | prepend | function prepend(pre) {
function prepender(string) { return pre + string; }
return arguments.length > 1
? prepender(arguments[1])
: prepender;
} | javascript | function prepend(pre) {
function prepender(string) { return pre + string; }
return arguments.length > 1
? prepender(arguments[1])
: prepender;
} | [
"function",
"prepend",
"(",
"pre",
")",
"{",
"function",
"prepender",
"(",
"string",
")",
"{",
"return",
"pre",
"+",
"string",
";",
"}",
"return",
"arguments",
".",
"length",
">",
"1",
"?",
"prepender",
"(",
"arguments",
"[",
"1",
"]",
")",
":",
"pre... | Curried `String.prototype.prepend`.
@param {String} pre
String to prepend to original string.
@param {String} string
Original string.
@return {String}
String consisting of prepended and original string. | [
"Curried",
"String",
".",
"prototype",
".",
"prepend",
"."
] | 00089b79d75edb76db27a5750682c418b86218c0 | https://github.com/wilmoore/string-prepend.js/blob/00089b79d75edb76db27a5750682c418b86218c0/index.js#L22-L28 |
54,759 | nwoltman/pro-array | pro-array.js | function(value, compareFunction) {
var low = 0;
var high = this.length;
var mid;
if (compareFunction) {
while (low < high) {
mid = low + high >>> 1;
var direction = compareFunction(this[mid], value);
if (!direction) {
return mid;
}
if (direction <... | javascript | function(value, compareFunction) {
var low = 0;
var high = this.length;
var mid;
if (compareFunction) {
while (low < high) {
mid = low + high >>> 1;
var direction = compareFunction(this[mid], value);
if (!direction) {
return mid;
}
if (direction <... | [
"function",
"(",
"value",
",",
"compareFunction",
")",
"{",
"var",
"low",
"=",
"0",
";",
"var",
"high",
"=",
"this",
".",
"length",
";",
"var",
"mid",
";",
"if",
"(",
"compareFunction",
")",
"{",
"while",
"(",
"low",
"<",
"high",
")",
"{",
"mid",
... | Finds the index of a value in a sorted array using a binary search algorithm.
If no `compareFunction` is supplied, the `>` and `<` relational operators are used to compare values,
which provides optimal performance for arrays of numbers and simple strings.
@function Array#bsearch
@param {*} value - The value to searc... | [
"Finds",
"the",
"index",
"of",
"a",
"value",
"in",
"a",
"sorted",
"array",
"using",
"a",
"binary",
"search",
"algorithm",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L136-L169 | |
54,760 | nwoltman/pro-array | pro-array.js | function(size) {
size = size || 1;
var numChunks = Math.ceil(this.length / size);
var result = new Array(numChunks);
for (var i = 0, index = 0; i < numChunks; i++) {
result[i] = chunkSlice(this, index, index += size);
}
return result;
} | javascript | function(size) {
size = size || 1;
var numChunks = Math.ceil(this.length / size);
var result = new Array(numChunks);
for (var i = 0, index = 0; i < numChunks; i++) {
result[i] = chunkSlice(this, index, index += size);
}
return result;
} | [
"function",
"(",
"size",
")",
"{",
"size",
"=",
"size",
"||",
"1",
";",
"var",
"numChunks",
"=",
"Math",
".",
"ceil",
"(",
"this",
".",
"length",
"/",
"size",
")",
";",
"var",
"result",
"=",
"new",
"Array",
"(",
"numChunks",
")",
";",
"for",
"(",... | Creates an array of elements split into groups the length of `size`. If the array
can't be split evenly, the final chunk will be the remaining elements.
@function Array#chunk
@param {number} [size=1] - The length of each chunk.
@returns {Array} An array containing the chunks.
@throws {RangeError} Throws when `size` is... | [
"Creates",
"an",
"array",
"of",
"elements",
"split",
"into",
"groups",
"the",
"length",
"of",
"size",
".",
"If",
"the",
"array",
"can",
"t",
"be",
"split",
"evenly",
"the",
"final",
"chunk",
"will",
"be",
"the",
"remaining",
"elements",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L187-L198 | |
54,761 | nwoltman/pro-array | pro-array.js | function() {
var result = [];
for (var i = 0; i < this.length; i++) {
var value = this[i];
if (Array.isArray(value)) {
for (var j = 0; j < value.length; j++) {
result.push(value[j]);
}
} else {
result.push(value);
}
}
return result;
} | javascript | function() {
var result = [];
for (var i = 0; i < this.length; i++) {
var value = this[i];
if (Array.isArray(value)) {
for (var j = 0; j < value.length; j++) {
result.push(value[j]);
}
} else {
result.push(value);
}
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"value",
"=",
"this",
"[",
"i",
"]",
";",
"if",
"(",
"Array",
".",
"i... | Flattens a nested array a single level.
@function Array#flatten
@returns {Array} The new flattened array.
@example
[1, [2, 3, [4]], 5].flatten();
// -> [1, 2, 3, [4], 5] | [
"Flattens",
"a",
"nested",
"array",
"a",
"single",
"level",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L402-L417 | |
54,762 | nwoltman/pro-array | pro-array.js | function() {
var remStartIndex = 0;
var numToRemove = 0;
for (var i = 0; i < this.length; i++) {
var removeCurrentIndex = false;
for (var j = 0; j < arguments.length; j++) {
if (this[i] === arguments[j]) {
removeCurrentIndex = true;
break;
}
}
i... | javascript | function() {
var remStartIndex = 0;
var numToRemove = 0;
for (var i = 0; i < this.length; i++) {
var removeCurrentIndex = false;
for (var j = 0; j < arguments.length; j++) {
if (this[i] === arguments[j]) {
removeCurrentIndex = true;
break;
}
}
i... | [
"function",
"(",
")",
"{",
"var",
"remStartIndex",
"=",
"0",
";",
"var",
"numToRemove",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"removeCurrentIndex",
"=",
"false",
";... | Removes all occurrences of the passed in items from the array and returns the array.
__Note:__ Unlike {@link Array#without|`.without()`}, this method mutates the array.
@function Array#remove
@param {...*} items - Items to remove from the array.
@returns {Array} The array this method was called on.
@example
var arra... | [
"Removes",
"all",
"occurrences",
"of",
"the",
"passed",
"in",
"items",
"from",
"the",
"array",
"and",
"returns",
"the",
"array",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L601-L632 | |
54,763 | nwoltman/pro-array | pro-array.js | function(isSorted) {
var result = [];
var length = this.length;
if (!length) {
return result;
}
result[0] = this[0];
var i = 1;
if (isSorted) {
for (; i < length; i++) {
if (this[i] !== this[i - 1]) {
result.push(this[i]);
}
}
} else {
... | javascript | function(isSorted) {
var result = [];
var length = this.length;
if (!length) {
return result;
}
result[0] = this[0];
var i = 1;
if (isSorted) {
for (; i < length; i++) {
if (this[i] !== this[i - 1]) {
result.push(this[i]);
}
}
} else {
... | [
"function",
"(",
"isSorted",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"length",
"=",
"this",
".",
"length",
";",
"if",
"(",
"!",
"length",
")",
"{",
"return",
"result",
";",
"}",
"result",
"[",
"0",
"]",
"=",
"this",
"[",
"0",
"]",... | Returns a duplicate-free clone of the array.
@function Array#unique
@param {boolean} [isSorted=false] - If the array's contents are sorted and this is set to `true`,
a faster algorithm will be used to create the unique array.
@returns {Array} The new, duplicate-free array.
@example
// Unsorted
[4, 2, 3, 2, 1, 4].uniq... | [
"Returns",
"a",
"duplicate",
"-",
"free",
"clone",
"of",
"the",
"array",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L684-L710 | |
54,764 | nwoltman/pro-array | pro-array.js | function() {
var result = [];
next: for (var i = 0; i < this.length; i++) {
for (var j = 0; j < arguments.length; j++) {
if (this[i] === arguments[j]) {
continue next;
}
}
result.push(this[i]);
}
return result;
} | javascript | function() {
var result = [];
next: for (var i = 0; i < this.length; i++) {
for (var j = 0; j < arguments.length; j++) {
if (this[i] === arguments[j]) {
continue next;
}
}
result.push(this[i]);
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"next",
":",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"arguments",
"... | Returns a copy of the array without any elements from the input parameters.
@function Array#without
@param {...*} items - Items to leave out of the returned array.
@returns {Array} The new array of filtered values.
@example
[1, 2, 3, 4].without(2, 4);
// -> [1, 3]
[1, 1].without(1);
// -> [] | [
"Returns",
"a",
"copy",
"of",
"the",
"array",
"without",
"any",
"elements",
"from",
"the",
"input",
"parameters",
"."
] | c61a7be99e932912f95e553b57bf1bca16e3c709 | https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L726-L739 | |
54,765 | Cereceres/flatten-array | index.js | flattenArray | function flattenArray(arrayToFlatten, arrayFlatten) {
// check if the arg is a array, if not a error is thrown
if(!Array.isArray(arrayToFlatten)) throw new Error('Only can flat arrays and you pass a ' + typeof arrayToFlatten)
// set the default value of arrayFlatten, this validation is used only in the firs... | javascript | function flattenArray(arrayToFlatten, arrayFlatten) {
// check if the arg is a array, if not a error is thrown
if(!Array.isArray(arrayToFlatten)) throw new Error('Only can flat arrays and you pass a ' + typeof arrayToFlatten)
// set the default value of arrayFlatten, this validation is used only in the firs... | [
"function",
"flattenArray",
"(",
"arrayToFlatten",
",",
"arrayFlatten",
")",
"{",
"// check if the arg is a array, if not a error is thrown",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arrayToFlatten",
")",
")",
"throw",
"new",
"Error",
"(",
"'Only can flat arrays a... | recursive function to flatten a array of integers given
@func
@param {Array} - arrayToFlatten of integers | [
"recursive",
"function",
"to",
"flatten",
"a",
"array",
"of",
"integers",
"given"
] | 1ce0612a34ef235126384951c4abdef9a81c2099 | https://github.com/Cereceres/flatten-array/blob/1ce0612a34ef235126384951c4abdef9a81c2099/index.js#L7-L27 |
54,766 | RetailMeNotSandbox/grunt-hooks | tasks/grunt-hooks.js | nextQuestion | function nextQuestion() {
if ( !hooks.length ) {
if ( !!options.onDone ) {
grunt.log.writeln( '' );
grunt.log.writeln( options.onDone.blue );
}
done();
} else {
var hookConfig = hooks.shift();
promptHook( hookConfig );
}
} | javascript | function nextQuestion() {
if ( !hooks.length ) {
if ( !!options.onDone ) {
grunt.log.writeln( '' );
grunt.log.writeln( options.onDone.blue );
}
done();
} else {
var hookConfig = hooks.shift();
promptHook( hookConfig );
}
} | [
"function",
"nextQuestion",
"(",
")",
"{",
"if",
"(",
"!",
"hooks",
".",
"length",
")",
"{",
"if",
"(",
"!",
"!",
"options",
".",
"onDone",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"''",
")",
";",
"grunt",
".",
"log",
".",
"writeln",
... | option passed to task via flag | [
"option",
"passed",
"to",
"task",
"via",
"flag"
] | 22611771304fb8a49552d25a10629f47bb415670 | https://github.com/RetailMeNotSandbox/grunt-hooks/blob/22611771304fb8a49552d25a10629f47bb415670/tasks/grunt-hooks.js#L20-L31 |
54,767 | RetailMeNotSandbox/grunt-hooks | tasks/grunt-hooks.js | actuallyInstallHook | function actuallyInstallHook(
hookToCopy,
whereToPutIt,
sourceCanonicalName
) {
mkpath.sync( path.join( './', path.dirname( whereToPutIt ) ) );
exec( 'cp ' + hookToCopy + ' ' + whereToPutIt );
grunt.log.writeln( [
'Installed ', sourceCanonicalName, ' hook in ', whereToPutIt
].join( '' ).green... | javascript | function actuallyInstallHook(
hookToCopy,
whereToPutIt,
sourceCanonicalName
) {
mkpath.sync( path.join( './', path.dirname( whereToPutIt ) ) );
exec( 'cp ' + hookToCopy + ' ' + whereToPutIt );
grunt.log.writeln( [
'Installed ', sourceCanonicalName, ' hook in ', whereToPutIt
].join( '' ).green... | [
"function",
"actuallyInstallHook",
"(",
"hookToCopy",
",",
"whereToPutIt",
",",
"sourceCanonicalName",
")",
"{",
"mkpath",
".",
"sync",
"(",
"path",
".",
"join",
"(",
"'./'",
",",
"path",
".",
"dirname",
"(",
"whereToPutIt",
")",
")",
")",
";",
"exec",
"("... | Installs the hook without checking if it already exists | [
"Installs",
"the",
"hook",
"without",
"checking",
"if",
"it",
"already",
"exists"
] | 22611771304fb8a49552d25a10629f47bb415670 | https://github.com/RetailMeNotSandbox/grunt-hooks/blob/22611771304fb8a49552d25a10629f47bb415670/tasks/grunt-hooks.js#L109-L119 |
54,768 | gregtatum/npm-on-tap | on-tap.js | function(e) {
var touch = e.touches[0]
// Make sure click doesn't fire
touchClientX = touch.clientX
touchClientY = touch.clientY
timestamp = Date.now()
} | javascript | function(e) {
var touch = e.touches[0]
// Make sure click doesn't fire
touchClientX = touch.clientX
touchClientY = touch.clientY
timestamp = Date.now()
} | [
"function",
"(",
"e",
")",
"{",
"var",
"touch",
"=",
"e",
".",
"touches",
"[",
"0",
"]",
"// Make sure click doesn't fire",
"touchClientX",
"=",
"touch",
".",
"clientX",
"touchClientY",
"=",
"touch",
".",
"clientY",
"timestamp",
"=",
"Date",
".",
"now",
"(... | Disable click if touch is fired | [
"Disable",
"click",
"if",
"touch",
"is",
"fired"
] | c0aecdea1edb0ce2b3c50b8e5ae6d09db92f3c78 | https://github.com/gregtatum/npm-on-tap/blob/c0aecdea1edb0ce2b3c50b8e5ae6d09db92f3c78/on-tap.js#L41-L49 | |
54,769 | KyperTech/grout | examples/browser/app.js | login | function login(){
console.log('Login called');
var username = document.getElementById('login-username').value;
var password = document.getElementById('login-password').value;
// {username:username, password:password}
grout.login('google').then(function (loginInfo){
console.log('successful login:',... | javascript | function login(){
console.log('Login called');
var username = document.getElementById('login-username').value;
var password = document.getElementById('login-password').value;
// {username:username, password:password}
grout.login('google').then(function (loginInfo){
console.log('successful login:',... | [
"function",
"login",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Login called'",
")",
";",
"var",
"username",
"=",
"document",
".",
"getElementById",
"(",
"'login-username'",
")",
".",
"value",
";",
"var",
"password",
"=",
"document",
".",
"getElementById",... | Login user based on entered credentials | [
"Login",
"user",
"based",
"on",
"entered",
"credentials"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L25-L36 |
54,770 | KyperTech/grout | examples/browser/app.js | logout | function logout(){
console.log('Logout called');
grout.logout().then(function(){
console.log('successful logout');
setStatus();
}, function (err){
console.error('logout() : Error logging out:', err);
});
} | javascript | function logout(){
console.log('Logout called');
grout.logout().then(function(){
console.log('successful logout');
setStatus();
}, function (err){
console.error('logout() : Error logging out:', err);
});
} | [
"function",
"logout",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Logout called'",
")",
";",
"grout",
".",
"logout",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'successful logout'",
")",
";",
"setStatus",
"(",
... | Log currently logged in user out | [
"Log",
"currently",
"logged",
"in",
"user",
"out"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L38-L46 |
54,771 | KyperTech/grout | examples/browser/app.js | signup | function signup(){
console.log('signup called');
var name = document.getElementById('signup-name').value;
var username = document.getElementById('signup-username').value;
var email = document.getElementById('signup-email').value;
var password = document.getElementById('signup-password').value;
... | javascript | function signup(){
console.log('signup called');
var name = document.getElementById('signup-name').value;
var username = document.getElementById('signup-username').value;
var email = document.getElementById('signup-email').value;
var password = document.getElementById('signup-password').value;
... | [
"function",
"signup",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'signup called'",
")",
";",
"var",
"name",
"=",
"document",
".",
"getElementById",
"(",
"'signup-name'",
")",
".",
"value",
";",
"var",
"username",
"=",
"document",
".",
"getElementById",
"(... | Signup and login as a new user | [
"Signup",
"and",
"login",
"as",
"a",
"new",
"user"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L48-L62 |
54,772 | KyperTech/grout | examples/browser/app.js | getProjects | function getProjects(){
console.log('getProjects called');
grout.Projects.get().then(function(appsList){
console.log('apps list loaded:', appsList);
var outHtml = '<h2>No app data</h2>';
if (appsList) {
outHtml = '<ul>';
appsList.forEach(function(app){
outHtml += '<li... | javascript | function getProjects(){
console.log('getProjects called');
grout.Projects.get().then(function(appsList){
console.log('apps list loaded:', appsList);
var outHtml = '<h2>No app data</h2>';
if (appsList) {
outHtml = '<ul>';
appsList.forEach(function(app){
outHtml += '<li... | [
"function",
"getProjects",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'getProjects called'",
")",
";",
"grout",
".",
"Projects",
".",
"get",
"(",
")",
".",
"then",
"(",
"function",
"(",
"appsList",
")",
"{",
"console",
".",
"log",
"(",
"'apps list loade... | Get list of applications | [
"Get",
"list",
"of",
"applications"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L64-L78 |
54,773 | KyperTech/grout | examples/browser/app.js | getFile | function getFile() {
var file = grout.Project('test', 'scott').File({key: 'index.html', path: 'index.html'});
console.log('fbUrl', file.fbUrl);
console.log('fbRef', file.fbRef);
file.get().then(function(app){
console.log('file loaded:', app);
document.getElementById("output").innerHTML = JSO... | javascript | function getFile() {
var file = grout.Project('test', 'scott').File({key: 'index.html', path: 'index.html'});
console.log('fbUrl', file.fbUrl);
console.log('fbRef', file.fbRef);
file.get().then(function(app){
console.log('file loaded:', app);
document.getElementById("output").innerHTML = JSO... | [
"function",
"getFile",
"(",
")",
"{",
"var",
"file",
"=",
"grout",
".",
"Project",
"(",
"'test'",
",",
"'scott'",
")",
".",
"File",
"(",
"{",
"key",
":",
"'index.html'",
",",
"path",
":",
"'index.html'",
"}",
")",
";",
"console",
".",
"log",
"(",
"... | Get single file content | [
"Get",
"single",
"file",
"content"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L81-L89 |
54,774 | KyperTech/grout | examples/browser/app.js | getUsers | function getUsers(){
console.log('getUsers called');
grout.Users.get().then(function(app){
console.log('apps list loaded:', app);
document.getElementById("output").innerHTML = JSON.stringify(app);
}, function(err){
console.error('Error getting users:', err);
});
} | javascript | function getUsers(){
console.log('getUsers called');
grout.Users.get().then(function(app){
console.log('apps list loaded:', app);
document.getElementById("output").innerHTML = JSON.stringify(app);
}, function(err){
console.error('Error getting users:', err);
});
} | [
"function",
"getUsers",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'getUsers called'",
")",
";",
"grout",
".",
"Users",
".",
"get",
"(",
")",
".",
"then",
"(",
"function",
"(",
"app",
")",
"{",
"console",
".",
"log",
"(",
"'apps list loaded:'",
",",
... | Get list of users | [
"Get",
"list",
"of",
"users"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L134-L142 |
54,775 | KyperTech/grout | examples/browser/app.js | searchUsers | function searchUsers(searchStr){
console.log('getUsers called');
if(!searchStr){
searchStr = document.getElementById('search').value;
}
grout.Users.search(searchStr).then(function(users){
console.log('search users loaded:', users);
document.getElementById("search-output").innerHTML = J... | javascript | function searchUsers(searchStr){
console.log('getUsers called');
if(!searchStr){
searchStr = document.getElementById('search').value;
}
grout.Users.search(searchStr).then(function(users){
console.log('search users loaded:', users);
document.getElementById("search-output").innerHTML = J... | [
"function",
"searchUsers",
"(",
"searchStr",
")",
"{",
"console",
".",
"log",
"(",
"'getUsers called'",
")",
";",
"if",
"(",
"!",
"searchStr",
")",
"{",
"searchStr",
"=",
"document",
".",
"getElementById",
"(",
"'search'",
")",
".",
"value",
";",
"}",
"g... | Search users based on a provided string | [
"Search",
"users",
"based",
"on",
"a",
"provided",
"string"
] | 54e6d7118ce03edc2cf671b28e235be664162a77 | https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L144-L153 |
54,776 | wronex/node-conquer | bin/logger.js | write | function write(msg, color, prefix) {
if (!prefix)
prefix = clc.cyan('[conquer]');
// Print each line of the message on its own line.
var messages = msg.split('\n');
for (var i = 0; i < messages.length; i++) {
var message = messages[i].replace(/(\s?$)|(\n?$)/gm, '');
if (message && message.length > 0)
cons... | javascript | function write(msg, color, prefix) {
if (!prefix)
prefix = clc.cyan('[conquer]');
// Print each line of the message on its own line.
var messages = msg.split('\n');
for (var i = 0; i < messages.length; i++) {
var message = messages[i].replace(/(\s?$)|(\n?$)/gm, '');
if (message && message.length > 0)
cons... | [
"function",
"write",
"(",
"msg",
",",
"color",
",",
"prefix",
")",
"{",
"if",
"(",
"!",
"prefix",
")",
"prefix",
"=",
"clc",
".",
"cyan",
"(",
"'[conquer]'",
")",
";",
"// Print each line of the message on its own line.",
"var",
"messages",
"=",
"msg",
".",
... | Writes the supplied message to the log.
@param {String} msg - the message.
@param {Function} [color] - the clc coloring function to use on each message.
@param {String} [prefix] - a message prefix. Defaults to '[conquer]'. | [
"Writes",
"the",
"supplied",
"message",
"to",
"the",
"log",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L12-L23 |
54,777 | wronex/node-conquer | bin/logger.js | log | function log() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg);
} | javascript | function log() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg);
} | [
"function",
"log",
"(",
")",
"{",
"var",
"msg",
"=",
"util",
".",
"format",
".",
"apply",
"(",
"null",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
")",
";",
"write",
"(",
"msg",
")",
";",
"}"
] | Writes the supplied parameters to the log. | [
"Writes",
"the",
"supplied",
"parameters",
"to",
"the",
"log",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L26-L29 |
54,778 | wronex/node-conquer | bin/logger.js | warn | function warn() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg, clc.yellow);
} | javascript | function warn() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg, clc.yellow);
} | [
"function",
"warn",
"(",
")",
"{",
"var",
"msg",
"=",
"util",
".",
"format",
".",
"apply",
"(",
"null",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
")",
";",
"write",
"(",
"msg",
",",
"clc",
".",
... | Writes the supplied parameters to the log as a warning. | [
"Writes",
"the",
"supplied",
"parameters",
"to",
"the",
"log",
"as",
"a",
"warning",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L32-L35 |
54,779 | wronex/node-conquer | bin/logger.js | error | function error() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg, clc.red);
} | javascript | function error() {
var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
write(msg, clc.red);
} | [
"function",
"error",
"(",
")",
"{",
"var",
"msg",
"=",
"util",
".",
"format",
".",
"apply",
"(",
"null",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
")",
";",
"write",
"(",
"msg",
",",
"clc",
".",
... | Writes the supplied parameters to the log as an error. | [
"Writes",
"the",
"supplied",
"parameters",
"to",
"the",
"log",
"as",
"an",
"error",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L38-L41 |
54,780 | wronex/node-conquer | bin/logger.js | scriptLog | function scriptLog(script, msg, isError) {
write(msg,
isError ? clc.red : null,
clc.yellow('[' + script + ']'));
} | javascript | function scriptLog(script, msg, isError) {
write(msg,
isError ? clc.red : null,
clc.yellow('[' + script + ']'));
} | [
"function",
"scriptLog",
"(",
"script",
",",
"msg",
",",
"isError",
")",
"{",
"write",
"(",
"msg",
",",
"isError",
"?",
"clc",
".",
"red",
":",
"null",
",",
"clc",
".",
"yellow",
"(",
"'['",
"+",
"script",
"+",
"']'",
")",
")",
";",
"}"
] | Writes the supplied message from the running script to the log.
@param {String} script - the name of the running script.
@param {String} msg - the message.
@param {Boolean} isError - indicates if the message is an error message. | [
"Writes",
"the",
"supplied",
"message",
"from",
"the",
"running",
"script",
"to",
"the",
"log",
"."
] | 48fa586d1fad15ad544d143d1ba4b97172fed0f1 | https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L49-L53 |
54,781 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | Plugin | function Plugin(element, options, jsonData) {
// same the DOM element.
this.element = element;
this.jsonData = jsonData;
// merge the options.
// the jQuery extend function, the later object will
// overwrite the former object.
this.options = $.extend({}, defaultO... | javascript | function Plugin(element, options, jsonData) {
// same the DOM element.
this.element = element;
this.jsonData = jsonData;
// merge the options.
// the jQuery extend function, the later object will
// overwrite the former object.
this.options = $.extend({}, defaultO... | [
"function",
"Plugin",
"(",
"element",
",",
"options",
",",
"jsonData",
")",
"{",
"// same the DOM element.",
"this",
".",
"element",
"=",
"element",
";",
"this",
".",
"jsonData",
"=",
"jsonData",
";",
"// merge the options.",
"// the jQuery extend function, the later ... | the constructor for bilevelSunburst plugin. | [
"the",
"constructor",
"for",
"bilevelSunburst",
"plugin",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L35-L47 |
54,782 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function(options, jsonData) {
//console.log(jsonData);
var self = this;
// remove the existing one.
$('#' + self.attrId).empty();
// need merge the options with default options.
self.options = $.extend({}, defaultOptions, options);
se... | javascript | function(options, jsonData) {
//console.log(jsonData);
var self = this;
// remove the existing one.
$('#' + self.attrId).empty();
// need merge the options with default options.
self.options = $.extend({}, defaultOptions, options);
se... | [
"function",
"(",
"options",
",",
"jsonData",
")",
"{",
"//console.log(jsonData);",
"var",
"self",
"=",
"this",
";",
"// remove the existing one.",
"$",
"(",
"'#'",
"+",
"self",
".",
"attrId",
")",
".",
"empty",
"(",
")",
";",
"// need merge the options with defa... | reload the plugin. | [
"reload",
"the",
"plugin",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L128-L139 | |
54,783 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function() {
var self = this;
var bsExplanation = '';
if(self.options.explanationBuilder) {
// call customized explanation builder.
bsExplanation =
self.options.explanationBuilder(self.attrId);
} else {
... | javascript | function() {
var self = this;
var bsExplanation = '';
if(self.options.explanationBuilder) {
// call customized explanation builder.
bsExplanation =
self.options.explanationBuilder(self.attrId);
} else {
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"bsExplanation",
"=",
"''",
";",
"if",
"(",
"self",
".",
"options",
".",
"explanationBuilder",
")",
"{",
"// call customized explanation builder.",
"bsExplanation",
"=",
"self",
".",
"options",... | append the explanation div and the inline styles for it.
the option explanationBuilder will be checked to
allow developer to customize the explanation div
self.options.explanationBuilder(prefix); | [
"append",
"the",
"explanation",
"div",
"and",
"the",
"inline",
"styles",
"for",
"it",
".",
"the",
"option",
"explanationBuilder",
"will",
"be",
"checked",
"to",
"allow",
"developer",
"to",
"customize",
"the",
"explanation",
"div"
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L148-L163 | |
54,784 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function() {
var self = this;
// calculate the location and offset.
// the largest rectangle that can be inscribed in a
// circle is a square.
// calculate the offset for the center of the chart.
var offset = $('#' + self.getGenericId('svg')).... | javascript | function() {
var self = this;
// calculate the location and offset.
// the largest rectangle that can be inscribed in a
// circle is a square.
// calculate the offset for the center of the chart.
var offset = $('#' + self.getGenericId('svg')).... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// calculate the location and offset.",
"// the largest rectangle that can be inscribed in a ",
"// circle is a square.",
"// calculate the offset for the center of the chart.",
"var",
"offset",
"=",
"$",
"(",
"'#'",
... | apply styles for the explanation div.
this should happen after we have the location and offset
of the svg. | [
"apply",
"styles",
"for",
"the",
"explanation",
"div",
".",
"this",
"should",
"happen",
"after",
"we",
"have",
"the",
"location",
"and",
"offset",
"of",
"the",
"svg",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L170-L230 | |
54,785 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function(p) {
var self = this;
if (p.depth > 1) p = p.parent;
// no children
if (!p.children) return;
//console.log("zoom in p.value = " + p.value);
//console.log("zoom in p.name = " + p.name);
self.updateExplanation(p.value, p.name)... | javascript | function(p) {
var self = this;
if (p.depth > 1) p = p.parent;
// no children
if (!p.children) return;
//console.log("zoom in p.value = " + p.value);
//console.log("zoom in p.name = " + p.name);
self.updateExplanation(p.value, p.name)... | [
"function",
"(",
"p",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"p",
".",
"depth",
">",
"1",
")",
"p",
"=",
"p",
".",
"parent",
";",
"// no children",
"if",
"(",
"!",
"p",
".",
"children",
")",
"return",
";",
"//console.log(\"zoom in p.... | handle zoomin, it happen on arcs. | [
"handle",
"zoomin",
"it",
"happen",
"on",
"arcs",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L357-L370 | |
54,786 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function(pageviews, name) {
var self = this;
$("#" + self.getGenericId('pageviews'))
.text(self.formatNumber(pageviews));
$("#" + self.getGenericId("group")).text(name);
var percentage = pageviews / self.totalValue;
$("#" + self.getGenericId(... | javascript | function(pageviews, name) {
var self = this;
$("#" + self.getGenericId('pageviews'))
.text(self.formatNumber(pageviews));
$("#" + self.getGenericId("group")).text(name);
var percentage = pageviews / self.totalValue;
$("#" + self.getGenericId(... | [
"function",
"(",
"pageviews",
",",
"name",
")",
"{",
"var",
"self",
"=",
"this",
";",
"$",
"(",
"\"#\"",
"+",
"self",
".",
"getGenericId",
"(",
"'pageviews'",
")",
")",
".",
"text",
"(",
"self",
".",
"formatNumber",
"(",
"pageviews",
")",
")",
";",
... | update the explanation div.
TODO: Should allow user to update through the
self.options.explanationUpdater. | [
"update",
"the",
"explanation",
"div",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L378-L388 | |
54,787 | leocornus/leocornus-visualdata | src/bilevel-sunburst.js | function(p) {
var self = this;
if (!p) return;
if (!p.parent) return;
//console.log("zoom out p.value = " + p.parent.value);
//console.log("zoom out p.name = " + p.parent.name);
//console.log(p.parent);
self.updateExplanation(p.paren... | javascript | function(p) {
var self = this;
if (!p) return;
if (!p.parent) return;
//console.log("zoom out p.value = " + p.parent.value);
//console.log("zoom out p.name = " + p.parent.name);
//console.log(p.parent);
self.updateExplanation(p.paren... | [
"function",
"(",
"p",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"p",
")",
"return",
";",
"if",
"(",
"!",
"p",
".",
"parent",
")",
"return",
";",
"//console.log(\"zoom out p.value = \" + p.parent.value);",
"//console.log(\"zoom out p.name = \" + ... | handle zoomout, for center circle. | [
"handle",
"zoomout",
"for",
"center",
"circle",
"."
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L393-L406 | |
54,788 | isaacsimmons/cache-manifest-generator | index.js | onFile | function onFile(filePath, stat) {
if (filePath.match(ignore) || filePath.match(globalIgnore)) { return; }
var newTimestamp = updateTimestamp(stat.mtime);
if (manifest['CACHE'].insert(toUrl(cleanPath(filePath))) || newTimestamp) {
updateListener(manifest);
}
} | javascript | function onFile(filePath, stat) {
if (filePath.match(ignore) || filePath.match(globalIgnore)) { return; }
var newTimestamp = updateTimestamp(stat.mtime);
if (manifest['CACHE'].insert(toUrl(cleanPath(filePath))) || newTimestamp) {
updateListener(manifest);
}
} | [
"function",
"onFile",
"(",
"filePath",
",",
"stat",
")",
"{",
"if",
"(",
"filePath",
".",
"match",
"(",
"ignore",
")",
"||",
"filePath",
".",
"match",
"(",
"globalIgnore",
")",
")",
"{",
"return",
";",
"}",
"var",
"newTimestamp",
"=",
"updateTimestamp",
... | If no ignore pattern is given, use one that matches nothing | [
"If",
"no",
"ignore",
"pattern",
"is",
"given",
"use",
"one",
"that",
"matches",
"nothing"
] | 9746c47e33d1febae7639b56383a757d2a138bfe | https://github.com/isaacsimmons/cache-manifest-generator/blob/9746c47e33d1febae7639b56383a757d2a138bfe/index.js#L152-L158 |
54,789 | dan-nl/yeoman-prompting-helpers | src/filter-prompts.js | filterPrompts | function filterPrompts( PromptAnswers, generator_prompts ) {
return filter(
generator_prompts,
function iteratee( prompt ) {
return typeof PromptAnswers.get( prompt.name ) === 'undefined';
}
);
} | javascript | function filterPrompts( PromptAnswers, generator_prompts ) {
return filter(
generator_prompts,
function iteratee( prompt ) {
return typeof PromptAnswers.get( prompt.name ) === 'undefined';
}
);
} | [
"function",
"filterPrompts",
"(",
"PromptAnswers",
",",
"generator_prompts",
")",
"{",
"return",
"filter",
"(",
"generator_prompts",
",",
"function",
"iteratee",
"(",
"prompt",
")",
"{",
"return",
"typeof",
"PromptAnswers",
".",
"get",
"(",
"prompt",
".",
"name"... | if a prompt.name already exists in PromptAnswers.answers that prompt will not be returned in
the resulting Array
@param {PromptAnswers} PromptAnswers
@param {Array} generator_prompts
@returns {Array} | [
"if",
"a",
"prompt",
".",
"name",
"already",
"exists",
"in",
"PromptAnswers",
".",
"answers",
"that",
"prompt",
"will",
"not",
"be",
"returned",
"in",
"the",
"resulting",
"Array"
] | 6b698989f7350f736705bae66d8481d01512612c | https://github.com/dan-nl/yeoman-prompting-helpers/blob/6b698989f7350f736705bae66d8481d01512612c/src/filter-prompts.js#L16-L23 |
54,790 | commenthol/streamss-through | index.js | Through | function Through (options, transform, flush) {
var self = this
if (!(this instanceof Through)) {
return new Through(options, transform, flush)
}
if (typeof options === 'function') {
flush = transform
transform = options
options = {}
}
options = options || {}
Transform.call(this, options... | javascript | function Through (options, transform, flush) {
var self = this
if (!(this instanceof Through)) {
return new Through(options, transform, flush)
}
if (typeof options === 'function') {
flush = transform
transform = options
options = {}
}
options = options || {}
Transform.call(this, options... | [
"function",
"Through",
"(",
"options",
",",
"transform",
",",
"flush",
")",
"{",
"var",
"self",
"=",
"this",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Through",
")",
")",
"{",
"return",
"new",
"Through",
"(",
"options",
",",
"transform",
",",
"flush"... | Stream transformer with functional API
@constructor
@param {Object} [options] - Stream options
@param {Boolean} options.objectMode - Whether this stream should behave as a stream of objects. Default=false
@param {Number} options.highWaterMark - The maximum number of bytes to store in the internal buffer before ceasing... | [
"Stream",
"transformer",
"with",
"functional",
"API"
] | 713b5256db6b0f4d4a3efe2ed4256ef626c753cb | https://github.com/commenthol/streamss-through/blob/713b5256db6b0f4d4a3efe2ed4256ef626c753cb/index.js#L41-L85 |
54,791 | brianloveswords/gogo | lib/field.mysql.js | finishSpec | function finishSpec(spec, opts, field) {
if (opts.unique) {
var keylength = parseInt(opts.unique, 10) ? opts.unique : undefined;
if (opts.unique === true && spec.sql.match(/^(text|blob)/i)) {
var msg = 'When adding a unique key to an unsized type (text or blob), unique must be set with a length e.g... | javascript | function finishSpec(spec, opts, field) {
if (opts.unique) {
var keylength = parseInt(opts.unique, 10) ? opts.unique : undefined;
if (opts.unique === true && spec.sql.match(/^(text|blob)/i)) {
var msg = 'When adding a unique key to an unsized type (text or blob), unique must be set with a length e.g... | [
"function",
"finishSpec",
"(",
"spec",
",",
"opts",
",",
"field",
")",
"{",
"if",
"(",
"opts",
".",
"unique",
")",
"{",
"var",
"keylength",
"=",
"parseInt",
"(",
"opts",
".",
"unique",
",",
"10",
")",
"?",
"opts",
".",
"unique",
":",
"undefined",
"... | Helper for handling generic options for field generators.
@param {Object} spec
@param {Object} opts see below
@param {String} field
@param {Boolean} opts.null when false, adds `required` validator,
`not null` to field
@param {Boolean} opts.required opposite of `opts.null`
@param {Boolean|Integer} opts.unique integer ... | [
"Helper",
"for",
"handling",
"generic",
"options",
"for",
"field",
"generators",
"."
] | f17ee794e0439ed961907f52b91bcb74dcca351a | https://github.com/brianloveswords/gogo/blob/f17ee794e0439ed961907f52b91bcb74dcca351a/lib/field.mysql.js#L22-L57 |
54,792 | darrencruse/sugarlisp-core | sl-types.js | pprintSEXP | function pprintSEXP(formJson, opts, indentLevel, priorNodeStr) {
opts = opts || {};
opts.lbracket = "(";
opts.rbracket = ")";
opts.separator = " ";
opts.bareSymbols = true;
return pprintJSON(formJson, opts, indentLevel, priorNodeStr);
} | javascript | function pprintSEXP(formJson, opts, indentLevel, priorNodeStr) {
opts = opts || {};
opts.lbracket = "(";
opts.rbracket = ")";
opts.separator = " ";
opts.bareSymbols = true;
return pprintJSON(formJson, opts, indentLevel, priorNodeStr);
} | [
"function",
"pprintSEXP",
"(",
"formJson",
",",
"opts",
",",
"indentLevel",
",",
"priorNodeStr",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"opts",
".",
"lbracket",
"=",
"\"(\"",
";",
"opts",
".",
"rbracket",
"=",
"\")\"",
";",
"opts",
".",
... | "pretty print" lisp s-expressions from the form tree to a string | [
"pretty",
"print",
"lisp",
"s",
"-",
"expressions",
"from",
"the",
"form",
"tree",
"to",
"a",
"string"
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L639-L646 |
54,793 | darrencruse/sugarlisp-core | sl-types.js | isQuotedString | function isQuotedString(str) {
var is = false;
if(typeof str === 'string') {
var firstChar = str.charAt(0);
is = (['"', "'", '`'].indexOf(firstChar) !== -1);
}
return is;
} | javascript | function isQuotedString(str) {
var is = false;
if(typeof str === 'string') {
var firstChar = str.charAt(0);
is = (['"', "'", '`'].indexOf(firstChar) !== -1);
}
return is;
} | [
"function",
"isQuotedString",
"(",
"str",
")",
"{",
"var",
"is",
"=",
"false",
";",
"if",
"(",
"typeof",
"str",
"===",
"'string'",
")",
"{",
"var",
"firstChar",
"=",
"str",
".",
"charAt",
"(",
"0",
")",
";",
"is",
"=",
"(",
"[",
"'\"'",
",",
"\"'... | Is the text a quoted string? | [
"Is",
"the",
"text",
"a",
"quoted",
"string?"
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L848-L855 |
54,794 | darrencruse/sugarlisp-core | sl-types.js | stripQuotes | function stripQuotes(text) {
var sansquotes = text;
if(isQuotedString(text)) {
if(text.length === 2) {
sanquotes = ""; // empty string
}
else {
sansquotes = text.substring(1, text.length-1);
// DELETE? sansquotes = unescapeQuotes(sansquotes);
}
}
return sansquotes;
} | javascript | function stripQuotes(text) {
var sansquotes = text;
if(isQuotedString(text)) {
if(text.length === 2) {
sanquotes = ""; // empty string
}
else {
sansquotes = text.substring(1, text.length-1);
// DELETE? sansquotes = unescapeQuotes(sansquotes);
}
}
return sansquotes;
} | [
"function",
"stripQuotes",
"(",
"text",
")",
"{",
"var",
"sansquotes",
"=",
"text",
";",
"if",
"(",
"isQuotedString",
"(",
"text",
")",
")",
"{",
"if",
"(",
"text",
".",
"length",
"===",
"2",
")",
"{",
"sanquotes",
"=",
"\"\"",
";",
"// empty string",
... | strip the quotes from around a string if there are any
otherwise return the string as given.
since we are removing the quotes we also unescape quotes
within the string. | [
"strip",
"the",
"quotes",
"from",
"around",
"a",
"string",
"if",
"there",
"are",
"any",
"otherwise",
"return",
"the",
"string",
"as",
"given",
".",
"since",
"we",
"are",
"removing",
"the",
"quotes",
"we",
"also",
"unescape",
"quotes",
"within",
"the",
"str... | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L877-L889 |
54,795 | darrencruse/sugarlisp-core | sl-types.js | addQuotes | function addQuotes(text, quoteChar) {
var withquotes = text;
if(!isQuotedString(text)) {
var delim = quoteChar && quoteChar.length === 1 ? quoteChar : '"';
withquotes = delim + text + delim;
}
return withquotes;
} | javascript | function addQuotes(text, quoteChar) {
var withquotes = text;
if(!isQuotedString(text)) {
var delim = quoteChar && quoteChar.length === 1 ? quoteChar : '"';
withquotes = delim + text + delim;
}
return withquotes;
} | [
"function",
"addQuotes",
"(",
"text",
",",
"quoteChar",
")",
"{",
"var",
"withquotes",
"=",
"text",
";",
"if",
"(",
"!",
"isQuotedString",
"(",
"text",
")",
")",
"{",
"var",
"delim",
"=",
"quoteChar",
"&&",
"quoteChar",
".",
"length",
"===",
"1",
"?",
... | add quotes around a string if there aren't any
otherwise return the string as given.
since we're adding the quotes we also escape quotes
within the string. | [
"add",
"quotes",
"around",
"a",
"string",
"if",
"there",
"aren",
"t",
"any",
"otherwise",
"return",
"the",
"string",
"as",
"given",
".",
"since",
"we",
"re",
"adding",
"the",
"quotes",
"we",
"also",
"escape",
"quotes",
"within",
"the",
"string",
"."
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L897-L904 |
54,796 | mattdesl/gl-texture2d-pixels | index.js | getPixels | function getPixels(texture, opts) {
var gl = texture.gl
if (!gl)
throw new Error("must provide gl-texture2d object with a valid 'gl' context")
if (!fbo) {
var handle = gl.createFramebuffer()
fbo = {
handle: handle,
dispose: dispose,
gl: gl
... | javascript | function getPixels(texture, opts) {
var gl = texture.gl
if (!gl)
throw new Error("must provide gl-texture2d object with a valid 'gl' context")
if (!fbo) {
var handle = gl.createFramebuffer()
fbo = {
handle: handle,
dispose: dispose,
gl: gl
... | [
"function",
"getPixels",
"(",
"texture",
",",
"opts",
")",
"{",
"var",
"gl",
"=",
"texture",
".",
"gl",
"if",
"(",
"!",
"gl",
")",
"throw",
"new",
"Error",
"(",
"\"must provide gl-texture2d object with a valid 'gl' context\"",
")",
"if",
"(",
"!",
"fbo",
")"... | Split into another module or use gl-fbo somehow | [
"Split",
"into",
"another",
"module",
"or",
"use",
"gl",
"-",
"fbo",
"somehow"
] | 06bdd8a71635414642db025b09b47da05c8953d9 | https://github.com/mattdesl/gl-texture2d-pixels/blob/06bdd8a71635414642db025b09b47da05c8953d9/index.js#L8-L45 |
54,797 | stefanmintert/ep_xmlexport | Line.js | function(listsEnabled, lineAttributesEnabled) {
if ((!hasList() && !hasLineAttributes) || (!listsEnabled && !lineAttributesEnabled)) {
return {
lineAttributes: [],
inlineAttributeString: rawAttributeString,
inlinePlaintext: rawText
... | javascript | function(listsEnabled, lineAttributesEnabled) {
if ((!hasList() && !hasLineAttributes) || (!listsEnabled && !lineAttributesEnabled)) {
return {
lineAttributes: [],
inlineAttributeString: rawAttributeString,
inlinePlaintext: rawText
... | [
"function",
"(",
"listsEnabled",
",",
"lineAttributesEnabled",
")",
"{",
"if",
"(",
"(",
"!",
"hasList",
"(",
")",
"&&",
"!",
"hasLineAttributes",
")",
"||",
"(",
"!",
"listsEnabled",
"&&",
"!",
"lineAttributesEnabled",
")",
")",
"{",
"return",
"{",
"lineA... | splits the line into line attributes and the remaining plain text and inline attributes
depending on the given parameters
@param {Boolean} listsEnabled if the client sent the parameter lists=true
@param {Boolean} lineAttributesEnabled if the client sent the parameter lineattribs=true
@return {lineAttributes: Array, inl... | [
"splits",
"the",
"line",
"into",
"line",
"attributes",
"and",
"the",
"remaining",
"plain",
"text",
"and",
"inline",
"attributes",
"depending",
"on",
"the",
"given",
"parameters"
] | c46a742b66bc048453ebe26c7b3fbd710ae8f7c4 | https://github.com/stefanmintert/ep_xmlexport/blob/c46a742b66bc048453ebe26c7b3fbd710ae8f7c4/Line.js#L128-L182 | |
54,798 | Jam3/innkeeper | lib/storeRedis.js | function( userID ) {
var id = curId;
curId++;
if( curId == Number.MAX_VALUE )
curId = Number.MIN_VALUE;
roomUsers[ id ] = [];
return this.setRoomData( id, {} )
.then( this.joinRoom.bind( this, userID, id ) )
.then( function() {
return id;
});
} | javascript | function( userID ) {
var id = curId;
curId++;
if( curId == Number.MAX_VALUE )
curId = Number.MIN_VALUE;
roomUsers[ id ] = [];
return this.setRoomData( id, {} )
.then( this.joinRoom.bind( this, userID, id ) )
.then( function() {
return id;
});
} | [
"function",
"(",
"userID",
")",
"{",
"var",
"id",
"=",
"curId",
";",
"curId",
"++",
";",
"if",
"(",
"curId",
"==",
"Number",
".",
"MAX_VALUE",
")",
"curId",
"=",
"Number",
".",
"MIN_VALUE",
";",
"roomUsers",
"[",
"id",
"]",
"=",
"[",
"]",
";",
"r... | This will create a roomID, roomDataObject, and users array for the room
@return {Promise} This promise will return a room id once the room is created | [
"This",
"will",
"create",
"a",
"roomID",
"roomDataObject",
"and",
"users",
"array",
"for",
"the",
"room"
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L36-L53 | |
54,799 | Jam3/innkeeper | lib/storeRedis.js | function( userID, roomID ) {
var userCount;
if( roomUsers[ roomID ] === undefined ) {
return promise.reject( 'No room with the id: ' + roomID );
} else {
var userIDX = roomUsers[ roomID ].indexOf( userID );
if( userIDX != -1 ) {
roomUsers[ roomID ].splice( userIDX, 1 );
userCount = roomUse... | javascript | function( userID, roomID ) {
var userCount;
if( roomUsers[ roomID ] === undefined ) {
return promise.reject( 'No room with the id: ' + roomID );
} else {
var userIDX = roomUsers[ roomID ].indexOf( userID );
if( userIDX != -1 ) {
roomUsers[ roomID ].splice( userIDX, 1 );
userCount = roomUse... | [
"function",
"(",
"userID",
",",
"roomID",
")",
"{",
"var",
"userCount",
";",
"if",
"(",
"roomUsers",
"[",
"roomID",
"]",
"===",
"undefined",
")",
"{",
"return",
"promise",
".",
"reject",
"(",
"'No room with the id: '",
"+",
"roomID",
")",
";",
"}",
"else... | Remove a user from a room
@param {String} userID an id for the user whose leaving
@param {String} roomID an id for the room the user is leaving
@return {Promise} When this promise resolves it will send the number of users in the room | [
"Remove",
"a",
"user",
"from",
"a",
"room"
] | 95182271c62cf4416442c825189f025234b6ef1e | https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L81-L109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.