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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56,800 | oleics/node-xcouch | registry.js | setDatabaseSecurity | function setDatabaseSecurity(name, cb) {
// Get _security first
getSecurity(name, function(err, d) {
if(err) return cb(err)
// Make name an admin
if(d.admins.names.indexOf(name) === -1) {
d.admins.names.push(name)
}
// Make name a reader
if(d.readers.names.indexOf(name) === -... | javascript | function setDatabaseSecurity(name, cb) {
// Get _security first
getSecurity(name, function(err, d) {
if(err) return cb(err)
// Make name an admin
if(d.admins.names.indexOf(name) === -1) {
d.admins.names.push(name)
}
// Make name a reader
if(d.readers.names.indexOf(name) === -... | [
"function",
"setDatabaseSecurity",
"(",
"name",
",",
"cb",
")",
"{",
"// Get _security first",
"getSecurity",
"(",
"name",
",",
"function",
"(",
"err",
",",
"d",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
")",
"// Make name an admin",
"if... | Sets the _security document of a database | [
"Sets",
"the",
"_security",
"document",
"of",
"a",
"database"
] | 47e492235b8e6c7235c7f8807725a3bb51fb44ba | https://github.com/oleics/node-xcouch/blob/47e492235b8e6c7235c7f8807725a3bb51fb44ba/registry.js#L217-L241 |
56,801 | oleics/node-xcouch | registry.js | loginUser | function loginUser(name, pass, cb) {
// Get the user
var db = nano().use(user_dbname)
db.get(user_namespace+':'+name, function(err, doc) {
if(err) return cb(err)
// Check pass
var hash = crypto.createHash('sha1')
hash.update(pass)
hash.update(doc.salt)
var password_sha = hash.digest('... | javascript | function loginUser(name, pass, cb) {
// Get the user
var db = nano().use(user_dbname)
db.get(user_namespace+':'+name, function(err, doc) {
if(err) return cb(err)
// Check pass
var hash = crypto.createHash('sha1')
hash.update(pass)
hash.update(doc.salt)
var password_sha = hash.digest('... | [
"function",
"loginUser",
"(",
"name",
",",
"pass",
",",
"cb",
")",
"{",
"// Get the user",
"var",
"db",
"=",
"nano",
"(",
")",
".",
"use",
"(",
"user_dbname",
")",
"db",
".",
"get",
"(",
"user_namespace",
"+",
"':'",
"+",
"name",
",",
"function",
"("... | Checks loginUser credenciales | [
"Checks",
"loginUser",
"credenciales"
] | 47e492235b8e6c7235c7f8807725a3bb51fb44ba | https://github.com/oleics/node-xcouch/blob/47e492235b8e6c7235c7f8807725a3bb51fb44ba/registry.js#L244-L261 |
56,802 | oleics/node-xcouch | registry.js | destroyDatabase | function destroyDatabase(name, cb) {
if(name === user_dbname)
throw new Error('We never ever delete that database.')
nano().db.destroy(name, function(err) {
if(err && err.status_code !== 404) return cb(err)
cb(null, err ? false : true)
})
} | javascript | function destroyDatabase(name, cb) {
if(name === user_dbname)
throw new Error('We never ever delete that database.')
nano().db.destroy(name, function(err) {
if(err && err.status_code !== 404) return cb(err)
cb(null, err ? false : true)
})
} | [
"function",
"destroyDatabase",
"(",
"name",
",",
"cb",
")",
"{",
"if",
"(",
"name",
"===",
"user_dbname",
")",
"throw",
"new",
"Error",
"(",
"'We never ever delete that database.'",
")",
"nano",
"(",
")",
".",
"db",
".",
"destroy",
"(",
"name",
",",
"funct... | Destroys a database | [
"Destroys",
"a",
"database"
] | 47e492235b8e6c7235c7f8807725a3bb51fb44ba | https://github.com/oleics/node-xcouch/blob/47e492235b8e6c7235c7f8807725a3bb51fb44ba/registry.js#L264-L271 |
56,803 | oleics/node-xcouch | registry.js | destroyUser | function destroyUser(name, pass, cb) {
loginUser(name, pass, function(err, user) {
if(err) return cb(err)
nano().use(user_dbname).destroy(user._id, user._rev, function(err, doc) {
if(err) return cb(err)
user._id = doc.id
user._rev = doc.rev
destroyDatabase(name, function(err) {
... | javascript | function destroyUser(name, pass, cb) {
loginUser(name, pass, function(err, user) {
if(err) return cb(err)
nano().use(user_dbname).destroy(user._id, user._rev, function(err, doc) {
if(err) return cb(err)
user._id = doc.id
user._rev = doc.rev
destroyDatabase(name, function(err) {
... | [
"function",
"destroyUser",
"(",
"name",
",",
"pass",
",",
"cb",
")",
"{",
"loginUser",
"(",
"name",
",",
"pass",
",",
"function",
"(",
"err",
",",
"user",
")",
"{",
"if",
"(",
"err",
")",
"return",
"cb",
"(",
"err",
")",
"nano",
"(",
")",
".",
... | Destroys a user AND her database | [
"Destroys",
"a",
"user",
"AND",
"her",
"database"
] | 47e492235b8e6c7235c7f8807725a3bb51fb44ba | https://github.com/oleics/node-xcouch/blob/47e492235b8e6c7235c7f8807725a3bb51fb44ba/registry.js#L274-L298 |
56,804 | commenthol/streamss | lib/jsonarray.js | JsonArray | function JsonArray (options) {
if (!(this instanceof JsonArray)) {
return new JsonArray(options)
}
this.options = Object.assign({}, options, { objectMode: true })
this.count = 0
this.map = ['[\n', ',\n', '\n]\n']
if (this.options.validJson === false) {
this.map = ['', '\n', '\n']
}
if (this.o... | javascript | function JsonArray (options) {
if (!(this instanceof JsonArray)) {
return new JsonArray(options)
}
this.options = Object.assign({}, options, { objectMode: true })
this.count = 0
this.map = ['[\n', ',\n', '\n]\n']
if (this.options.validJson === false) {
this.map = ['', '\n', '\n']
}
if (this.o... | [
"function",
"JsonArray",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"JsonArray",
")",
")",
"{",
"return",
"new",
"JsonArray",
"(",
"options",
")",
"}",
"this",
".",
"options",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
","... | JSON.parse a line and push as object down the pipe.
If `stringify: true` is set, a received object is stringified with JSON.stringify
The output of the stream will be a valid JSON array.
NOTE: Requires that the stream is split beforehand using `Split` or `SplitLine`.
@constructor
@param {Object} [options] - Stream O... | [
"JSON",
".",
"parse",
"a",
"line",
"and",
"push",
"as",
"object",
"down",
"the",
"pipe",
"."
] | cfef5d0ed30c7efe002018886e2e843c91d3558f | https://github.com/commenthol/streamss/blob/cfef5d0ed30c7efe002018886e2e843c91d3558f/lib/jsonarray.js#L29-L57 |
56,805 | seiyugi/debuguy | lib/parser.js | pr_parse | function pr_parse(options) {
this.traverse(options, function (dir, item, out) {
fs.readFile(dir + item, function(err, data) {
console.log('adding log ' + dir + item);
if (err) {
console.log(err);
console.log(data);
return;
}
var source = data.toS... | javascript | function pr_parse(options) {
this.traverse(options, function (dir, item, out) {
fs.readFile(dir + item, function(err, data) {
console.log('adding log ' + dir + item);
if (err) {
console.log(err);
console.log(data);
return;
}
var source = data.toS... | [
"function",
"pr_parse",
"(",
"options",
")",
"{",
"this",
".",
"traverse",
"(",
"options",
",",
"function",
"(",
"dir",
",",
"item",
",",
"out",
")",
"{",
"fs",
".",
"readFile",
"(",
"dir",
"+",
"item",
",",
"function",
"(",
"err",
",",
"data",
")"... | Replace debuguy comments to predifined condole logs.
@param {[type]} options [description]
@return {[type]} [description] | [
"Replace",
"debuguy",
"comments",
"to",
"predifined",
"condole",
"logs",
"."
] | 60b18e44b9dd1bcc7a160aac56b570eec6e5e4b4 | https://github.com/seiyugi/debuguy/blob/60b18e44b9dd1bcc7a160aac56b570eec6e5e4b4/lib/parser.js#L169-L199 |
56,806 | seiyugi/debuguy | lib/parser.js | pr_autolog | function pr_autolog(options) {
function espectRewrite(filepath, outpath, template) {
var autologret = require(template);
autologret(filepath, outpath);
}
function insertReturnLog(source, endLine) {
var sourceRet;
// Insert ending log at return statement.
sourceRet = source.re... | javascript | function pr_autolog(options) {
function espectRewrite(filepath, outpath, template) {
var autologret = require(template);
autologret(filepath, outpath);
}
function insertReturnLog(source, endLine) {
var sourceRet;
// Insert ending log at return statement.
sourceRet = source.re... | [
"function",
"pr_autolog",
"(",
"options",
")",
"{",
"function",
"espectRewrite",
"(",
"filepath",
",",
"outpath",
",",
"template",
")",
"{",
"var",
"autologret",
"=",
"require",
"(",
"template",
")",
";",
"autologret",
"(",
"filepath",
",",
"outpath",
")",
... | Automatically insert console logs in javascript functions.
@param {[type]} options [description]
@return {[type]} [description] | [
"Automatically",
"insert",
"console",
"logs",
"in",
"javascript",
"functions",
"."
] | 60b18e44b9dd1bcc7a160aac56b570eec6e5e4b4 | https://github.com/seiyugi/debuguy/blob/60b18e44b9dd1bcc7a160aac56b570eec6e5e4b4/lib/parser.js#L205-L328 |
56,807 | greggman/hft-game-utils | src/hft/scripts/misc/timeout.js | function(callback, timeInMs) {
var timeout = makeTimeout(callback);
setTriggerTime(timeout, timeInMs);
s_timeoutsToInsert.push(timeout);
return timeout.id;
} | javascript | function(callback, timeInMs) {
var timeout = makeTimeout(callback);
setTriggerTime(timeout, timeInMs);
s_timeoutsToInsert.push(timeout);
return timeout.id;
} | [
"function",
"(",
"callback",
",",
"timeInMs",
")",
"{",
"var",
"timeout",
"=",
"makeTimeout",
"(",
"callback",
")",
";",
"setTriggerTime",
"(",
"timeout",
",",
"timeInMs",
")",
";",
"s_timeoutsToInsert",
".",
"push",
"(",
"timeout",
")",
";",
"return",
"ti... | Same as normal setTimeout
@param {callback} callback function to call when it times out
@param {number} timeInMs duration of timeout
@return {number} id for timeout
@memberOf module:Timeout | [
"Same",
"as",
"normal",
"setTimeout"
] | 071a0feebeed79d3597efd63e682392179cf0d30 | https://github.com/greggman/hft-game-utils/blob/071a0feebeed79d3597efd63e682392179cf0d30/src/hft/scripts/misc/timeout.js#L106-L111 | |
56,808 | greggman/hft-game-utils | src/hft/scripts/misc/timeout.js | function(callback, timeInMs) {
var timeout = makeTimeout(function() {
setTriggerTime(timeout, timeout.timeInMs);
s_timeoutsToInsert.push(timeout);
callback();
});
timeout.timeInMs = timeInMs;
s_timeoutsToInsert.push(timeout);
return timeout.id;
} | javascript | function(callback, timeInMs) {
var timeout = makeTimeout(function() {
setTriggerTime(timeout, timeout.timeInMs);
s_timeoutsToInsert.push(timeout);
callback();
});
timeout.timeInMs = timeInMs;
s_timeoutsToInsert.push(timeout);
return timeout.id;
} | [
"function",
"(",
"callback",
",",
"timeInMs",
")",
"{",
"var",
"timeout",
"=",
"makeTimeout",
"(",
"function",
"(",
")",
"{",
"setTriggerTime",
"(",
"timeout",
",",
"timeout",
".",
"timeInMs",
")",
";",
"s_timeoutsToInsert",
".",
"push",
"(",
"timeout",
")... | Same as normal setInterval
@param {callback} callback function to call at each interval
@param {number} timeInMs duration of internval
@return {number} id for interval
@memberOf module:Timeout | [
"Same",
"as",
"normal",
"setInterval"
] | 071a0feebeed79d3597efd63e682392179cf0d30 | https://github.com/greggman/hft-game-utils/blob/071a0feebeed79d3597efd63e682392179cf0d30/src/hft/scripts/misc/timeout.js#L120-L129 | |
56,809 | greggman/hft-game-utils | src/hft/scripts/misc/timeout.js | function(elapsedTimeInSeconds) {
// insert any unscheduled timeouts
if (s_timeoutsToInsert.length) {
s_timeoutsToInsert.forEach(insertTimeout);
s_timeoutsToInsert = [];
}
// Now remove any
if (s_timeoutsToRemoveById.length) {
s_timeoutsToRemoveById.forEach(removeTimeoutById);
... | javascript | function(elapsedTimeInSeconds) {
// insert any unscheduled timeouts
if (s_timeoutsToInsert.length) {
s_timeoutsToInsert.forEach(insertTimeout);
s_timeoutsToInsert = [];
}
// Now remove any
if (s_timeoutsToRemoveById.length) {
s_timeoutsToRemoveById.forEach(removeTimeoutById);
... | [
"function",
"(",
"elapsedTimeInSeconds",
")",
"{",
"// insert any unscheduled timeouts",
"if",
"(",
"s_timeoutsToInsert",
".",
"length",
")",
"{",
"s_timeoutsToInsert",
".",
"forEach",
"(",
"insertTimeout",
")",
";",
"s_timeoutsToInsert",
"=",
"[",
"]",
";",
"}",
... | Processes the intervals and timeouts
This is how you control the clock for the timouts
A typical usage might be
var g = {};
GameSupport.run(g, mainloop);
function mainloop() {
Timeout.process(globals.elapsedTime);
};
@param {number} elapsedTimeInSeconds number of seconds to advance the clock.
@memberOf module:Tim... | [
"Processes",
"the",
"intervals",
"and",
"timeouts"
] | 071a0feebeed79d3597efd63e682392179cf0d30 | https://github.com/greggman/hft-game-utils/blob/071a0feebeed79d3597efd63e682392179cf0d30/src/hft/scripts/misc/timeout.js#L167-L193 | |
56,810 | node-jpi/jpi-models | array.js | function () {
const result = Array.prototype.pop.apply(arr)
fn('pop', arr, {
value: result
})
return result
} | javascript | function () {
const result = Array.prototype.pop.apply(arr)
fn('pop', arr, {
value: result
})
return result
} | [
"function",
"(",
")",
"{",
"const",
"result",
"=",
"Array",
".",
"prototype",
".",
"pop",
".",
"apply",
"(",
"arr",
")",
"fn",
"(",
"'pop'",
",",
"arr",
",",
"{",
"value",
":",
"result",
"}",
")",
"return",
"result",
"}"
] | Proxied array mutators methods
@param {Object} obj
@return {Object}
@api private | [
"Proxied",
"array",
"mutators",
"methods"
] | f0c34626d004d720cefdbb4ad5d33d84057fd78d | https://github.com/node-jpi/jpi-models/blob/f0c34626d004d720cefdbb4ad5d33d84057fd78d/array.js#L13-L21 | |
56,811 | nodejitsu/npm-dependencies-pagelet | index.js | process | function process(data) {
//
// Apply previous post processing.
//
data = Pagelet.prototype.postprocess.call(this, data);
data.stats = {
outofdate: 0,
uptodate: 0,
pinned: 0
};
data.shrinkwrap.forEach(function shrinkwrap(module) {
if (module.pinned) data.stats.pinned... | javascript | function process(data) {
//
// Apply previous post processing.
//
data = Pagelet.prototype.postprocess.call(this, data);
data.stats = {
outofdate: 0,
uptodate: 0,
pinned: 0
};
data.shrinkwrap.forEach(function shrinkwrap(module) {
if (module.pinned) data.stats.pinned... | [
"function",
"process",
"(",
"data",
")",
"{",
"//",
"// Apply previous post processing.",
"//",
"data",
"=",
"Pagelet",
".",
"prototype",
".",
"postprocess",
".",
"call",
"(",
"this",
",",
"data",
")",
";",
"data",
".",
"stats",
"=",
"{",
"outofdate",
":",... | Remove JS dependency.
Final post processing step on the data.
@param {Object} data The resolved data from cache.
@returns {Object} data
@api private | [
"Remove",
"JS",
"dependency",
".",
"Final",
"post",
"processing",
"step",
"on",
"the",
"data",
"."
] | 5a43cfa31eb0e9ccec609204d0a8dc6a29080e0a | https://github.com/nodejitsu/npm-dependencies-pagelet/blob/5a43cfa31eb0e9ccec609204d0a8dc6a29080e0a/index.js#L22-L41 |
56,812 | muttr/libmuttr | lib/session.js | Session | function Session(identity, connection, options) {
if (!(this instanceof Session)) {
return new Session(identity, connection, options);
}
assert(identity instanceof Identity, 'Invalid identity supplied');
if (!(connection instanceof Connection)) {
options = connection || {};
options.passive = true;... | javascript | function Session(identity, connection, options) {
if (!(this instanceof Session)) {
return new Session(identity, connection, options);
}
assert(identity instanceof Identity, 'Invalid identity supplied');
if (!(connection instanceof Connection)) {
options = connection || {};
options.passive = true;... | [
"function",
"Session",
"(",
"identity",
",",
"connection",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Session",
")",
")",
"{",
"return",
"new",
"Session",
"(",
"identity",
",",
"connection",
",",
"options",
")",
";",
"}",
"as... | Creates a sandbox for Muttr apps by the given identity
@constructor
@param {Identity} identity
@param {Connection} connection
@param {object} options | [
"Creates",
"a",
"sandbox",
"for",
"Muttr",
"apps",
"by",
"the",
"given",
"identity"
] | 2e4fda9cb2b47b8febe30585f54196d39d79e2e5 | https://github.com/muttr/libmuttr/blob/2e4fda9cb2b47b8febe30585f54196d39d79e2e5/lib/session.js#L34-L60 |
56,813 | codenothing/munit | lib/assert.js | function(){
var self = this,
logs = self._filterLogs(),
all = logs.all,
keys = logs.keys,
time = munit._relativeTime( self.end - self.start );
// Root module
if ( ! self.callback ) {
munit.color.green( "=== All submodules of " + self.nsPath + " have finished ===" );
return;
}
// Content
... | javascript | function(){
var self = this,
logs = self._filterLogs(),
all = logs.all,
keys = logs.keys,
time = munit._relativeTime( self.end - self.start );
// Root module
if ( ! self.callback ) {
munit.color.green( "=== All submodules of " + self.nsPath + " have finished ===" );
return;
}
// Content
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"logs",
"=",
"self",
".",
"_filterLogs",
"(",
")",
",",
"all",
"=",
"logs",
".",
"all",
",",
"keys",
"=",
"logs",
".",
"keys",
",",
"time",
"=",
"munit",
".",
"_relativeTime",
"(",
"self... | Prints module results to cli | [
"Prints",
"module",
"results",
"to",
"cli"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L46-L96 | |
56,814 | codenothing/munit | lib/assert.js | function(){
var self = this,
all = [],
keys = {},
current = null;
self._logs.reverse().forEach(function( log ) {
if ( log instanceof AssertResult ) {
current = log.name;
return;
}
var name = log[ 0 ];
if ( log.length > 1 && munit.isString( name ) && self.tests[ name ] ) {
if ( ! k... | javascript | function(){
var self = this,
all = [],
keys = {},
current = null;
self._logs.reverse().forEach(function( log ) {
if ( log instanceof AssertResult ) {
current = log.name;
return;
}
var name = log[ 0 ];
if ( log.length > 1 && munit.isString( name ) && self.tests[ name ] ) {
if ( ! k... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"all",
"=",
"[",
"]",
",",
"keys",
"=",
"{",
"}",
",",
"current",
"=",
"null",
";",
"self",
".",
"_logs",
".",
"reverse",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"log",
")",
... | Generates log arrays based on current test keys | [
"Generates",
"log",
"arrays",
"based",
"on",
"current",
"test",
"keys"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L99-L132 | |
56,815 | codenothing/munit | lib/assert.js | function( name, error, skip ) {
var self = this,
now = Date.now(),
last = ! self.isAsync && self._lastTest ? self._lastTest : self.start,
result = new AssertResult( name, self.nsPath, now - last, error, skip );
self.tests[ name ] = result;
self.list.push( result );
self._logs.push( result );
self._l... | javascript | function( name, error, skip ) {
var self = this,
now = Date.now(),
last = ! self.isAsync && self._lastTest ? self._lastTest : self.start,
result = new AssertResult( name, self.nsPath, now - last, error, skip );
self.tests[ name ] = result;
self.list.push( result );
self._logs.push( result );
self._l... | [
"function",
"(",
"name",
",",
"error",
",",
"skip",
")",
"{",
"var",
"self",
"=",
"this",
",",
"now",
"=",
"Date",
".",
"now",
"(",
")",
",",
"last",
"=",
"!",
"self",
".",
"isAsync",
"&&",
"self",
".",
"_lastTest",
"?",
"self",
".",
"_lastTest",... | Returns a configured result object | [
"Returns",
"a",
"configured",
"result",
"object"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L135-L145 | |
56,816 | codenothing/munit | lib/assert.js | function( actual, expected, prefix ) {
var self = this, keys, expectedKeys;
prefix = prefix || '';
if ( munit.isArray( actual ) && munit.isArray( expected ) ) {
if ( actual.length !== expected.length ) {
throw "\nActual: actual" + prefix + ".length = " + actual.length +
"\nExpected: expected" + prefi... | javascript | function( actual, expected, prefix ) {
var self = this, keys, expectedKeys;
prefix = prefix || '';
if ( munit.isArray( actual ) && munit.isArray( expected ) ) {
if ( actual.length !== expected.length ) {
throw "\nActual: actual" + prefix + ".length = " + actual.length +
"\nExpected: expected" + prefi... | [
"function",
"(",
"actual",
",",
"expected",
",",
"prefix",
")",
"{",
"var",
"self",
"=",
"this",
",",
"keys",
",",
"expectedKeys",
";",
"prefix",
"=",
"prefix",
"||",
"''",
";",
"if",
"(",
"munit",
".",
"isArray",
"(",
"actual",
")",
"&&",
"munit",
... | Key matching for object match | [
"Key",
"matching",
"for",
"object",
"match"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L148-L193 | |
56,817 | codenothing/munit | lib/assert.js | function( e, match ) {
var result = { passed: false }, message = '';
// Get a string for matching on the error
if ( munit.isError( e ) ) {
message = e.message;
}
else if ( munit.isString( e ) ) {
message = e;
}
// No match required
if ( match === undefined ) {
result.passed = true;
}
// N... | javascript | function( e, match ) {
var result = { passed: false }, message = '';
// Get a string for matching on the error
if ( munit.isError( e ) ) {
message = e.message;
}
else if ( munit.isString( e ) ) {
message = e;
}
// No match required
if ( match === undefined ) {
result.passed = true;
}
// N... | [
"function",
"(",
"e",
",",
"match",
")",
"{",
"var",
"result",
"=",
"{",
"passed",
":",
"false",
"}",
",",
"message",
"=",
"''",
";",
"// Get a string for matching on the error",
"if",
"(",
"munit",
".",
"isError",
"(",
"e",
")",
")",
"{",
"message",
"... | Utility for error object matching | [
"Utility",
"for",
"error",
"object",
"matching"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L196-L253 | |
56,818 | codenothing/munit | lib/assert.js | function( name, startFunc, error ) {
var self = this, result;
// Assign proper error
if ( ! error ) {
error = new munit.AssertionError( "'" + name + "' test failed", startFunc );
}
else if ( ! ( error instanceof Error ) ) {
error = new munit.AssertionError( error, startFunc );
}
// Increment error... | javascript | function( name, startFunc, error ) {
var self = this, result;
// Assign proper error
if ( ! error ) {
error = new munit.AssertionError( "'" + name + "' test failed", startFunc );
}
else if ( ! ( error instanceof Error ) ) {
error = new munit.AssertionError( error, startFunc );
}
// Increment error... | [
"function",
"(",
"name",
",",
"startFunc",
",",
"error",
")",
"{",
"var",
"self",
"=",
"this",
",",
"result",
";",
"// Assign proper error",
"if",
"(",
"!",
"error",
")",
"{",
"error",
"=",
"new",
"munit",
".",
"AssertionError",
"(",
"\"'\"",
"+",
"nam... | Failed test storage | [
"Failed",
"test",
"storage"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L256-L278 | |
56,819 | codenothing/munit | lib/assert.js | function( name ) {
var self = this;
self._addResult( name );
self.passed++;
self.count++;
munit.passed++;
} | javascript | function( name ) {
var self = this;
self._addResult( name );
self.passed++;
self.count++;
munit.passed++;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_addResult",
"(",
"name",
")",
";",
"self",
".",
"passed",
"++",
";",
"self",
".",
"count",
"++",
";",
"munit",
".",
"passed",
"++",
";",
"}"
] | Passed test storage | [
"Passed",
"test",
"storage"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L281-L288 | |
56,820 | codenothing/munit | lib/assert.js | function( required, startFunc ) {
var self = this;
if ( required !== self.state ) {
self._stateError( startFunc || self.requireState );
}
return self;
} | javascript | function( required, startFunc ) {
var self = this;
if ( required !== self.state ) {
self._stateError( startFunc || self.requireState );
}
return self;
} | [
"function",
"(",
"required",
",",
"startFunc",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"required",
"!==",
"self",
".",
"state",
")",
"{",
"self",
".",
"_stateError",
"(",
"startFunc",
"||",
"self",
".",
"requireState",
")",
";",
"}",
"r... | Throws an error if module isn't in the required state | [
"Throws",
"an",
"error",
"if",
"module",
"isn",
"t",
"in",
"the",
"required",
"state"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L305-L313 | |
56,821 | codenothing/munit | lib/assert.js | function( time, callback ) {
var self = this, timeid;
// Can only delay an active module
self.requireState( munit.ASSERT_STATE_ACTIVE, self.delay );
// Time parameter is required
if ( ! munit.isNumber( time ) ) {
throw new munit.AssertionError( "Time parameter not passed to assert.delay", self.delay );
... | javascript | function( time, callback ) {
var self = this, timeid;
// Can only delay an active module
self.requireState( munit.ASSERT_STATE_ACTIVE, self.delay );
// Time parameter is required
if ( ! munit.isNumber( time ) ) {
throw new munit.AssertionError( "Time parameter not passed to assert.delay", self.delay );
... | [
"function",
"(",
"time",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"timeid",
";",
"// Can only delay an active module",
"self",
".",
"requireState",
"(",
"munit",
".",
"ASSERT_STATE_ACTIVE",
",",
"self",
".",
"delay",
")",
";",
"// Time param... | Makes module asynchronous | [
"Makes",
"module",
"asynchronous"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L352-L401 | |
56,822 | codenothing/munit | lib/assert.js | function( name, test, startFunc, extra ) {
var self = this;
// Require an active state for tests
self.requireState( munit.ASSERT_STATE_ACTIVE, startFunc || self.ok );
// Prevent non empty string names
if ( ! munit.isString( name ) || ! name.length ) {
throw new munit.AssertionError(
"Name not found f... | javascript | function( name, test, startFunc, extra ) {
var self = this;
// Require an active state for tests
self.requireState( munit.ASSERT_STATE_ACTIVE, startFunc || self.ok );
// Prevent non empty string names
if ( ! munit.isString( name ) || ! name.length ) {
throw new munit.AssertionError(
"Name not found f... | [
"function",
"(",
"name",
",",
"test",
",",
"startFunc",
",",
"extra",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Require an active state for tests",
"self",
".",
"requireState",
"(",
"munit",
".",
"ASSERT_STATE_ACTIVE",
",",
"startFunc",
"||",
"self",
".",... | Basic boolean test | [
"Basic",
"boolean",
"test"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L441-L471 | |
56,823 | codenothing/munit | lib/assert.js | function( name, startFunc, extra ) {
if ( extra === undefined && ! munit.isFunction( startFunc ) ) {
extra = startFunc;
startFunc = undefined;
}
if ( munit.isError( extra ) ) {
extra = extra.message;
}
return this.ok( name, false, startFunc || this.fail, extra );
} | javascript | function( name, startFunc, extra ) {
if ( extra === undefined && ! munit.isFunction( startFunc ) ) {
extra = startFunc;
startFunc = undefined;
}
if ( munit.isError( extra ) ) {
extra = extra.message;
}
return this.ok( name, false, startFunc || this.fail, extra );
} | [
"function",
"(",
"name",
",",
"startFunc",
",",
"extra",
")",
"{",
"if",
"(",
"extra",
"===",
"undefined",
"&&",
"!",
"munit",
".",
"isFunction",
"(",
"startFunc",
")",
")",
"{",
"extra",
"=",
"startFunc",
";",
"startFunc",
"=",
"undefined",
";",
"}",
... | Shortcut for explicit failures | [
"Shortcut",
"for",
"explicit",
"failures"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L479-L490 | |
56,824 | codenothing/munit | lib/assert.js | function( name, value, match ) {
var self = this,
result = munit.isError( value ) ?
self._errorMatch( value, match ) :
{ passed: false, extra: "Value is not an Error '" + value + "'" };
return self.ok( name, result.passed, self.isError, result.extra );
} | javascript | function( name, value, match ) {
var self = this,
result = munit.isError( value ) ?
self._errorMatch( value, match ) :
{ passed: false, extra: "Value is not an Error '" + value + "'" };
return self.ok( name, result.passed, self.isError, result.extra );
} | [
"function",
"(",
"name",
",",
"value",
",",
"match",
")",
"{",
"var",
"self",
"=",
"this",
",",
"result",
"=",
"munit",
".",
"isError",
"(",
"value",
")",
"?",
"self",
".",
"_errorMatch",
"(",
"value",
",",
"match",
")",
":",
"{",
"passed",
":",
... | Testing value for Error object | [
"Testing",
"value",
"for",
"Error",
"object"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L553-L560 | |
56,825 | codenothing/munit | lib/assert.js | function( name, actual, expected ) {
return this.ok( name, actual !== expected, this.notEqual, "\nValues should not match\nActual:" + actual + "\nExpected:" + expected );
} | javascript | function( name, actual, expected ) {
return this.ok( name, actual !== expected, this.notEqual, "\nValues should not match\nActual:" + actual + "\nExpected:" + expected );
} | [
"function",
"(",
"name",
",",
"actual",
",",
"expected",
")",
"{",
"return",
"this",
".",
"ok",
"(",
"name",
",",
"actual",
"!==",
"expected",
",",
"this",
".",
"notEqual",
",",
"\"\\nValues should not match\\nActual:\"",
"+",
"actual",
"+",
"\"\\nExpected:\""... | Strict un-comparison | [
"Strict",
"un",
"-",
"comparison"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L578-L580 | |
56,826 | codenothing/munit | lib/assert.js | function( name, upper, lower ) {
return this.ok( name, upper > lower, this.greaterThan, "\nUpper Value '" + upper + "' is not greater than lower value '" + lower + "'" );
} | javascript | function( name, upper, lower ) {
return this.ok( name, upper > lower, this.greaterThan, "\nUpper Value '" + upper + "' is not greater than lower value '" + lower + "'" );
} | [
"function",
"(",
"name",
",",
"upper",
",",
"lower",
")",
"{",
"return",
"this",
".",
"ok",
"(",
"name",
",",
"upper",
">",
"lower",
",",
"this",
".",
"greaterThan",
",",
"\"\\nUpper Value '\"",
"+",
"upper",
"+",
"\"' is not greater than lower value '\"",
"... | Greater than comparison | [
"Greater",
"than",
"comparison"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L583-L585 | |
56,827 | codenothing/munit | lib/assert.js | function( name, lower, upper ) {
return this.ok( name, lower < upper, this.lessThan, "\nLower Value '" + lower + "' is not less than upper value '" + upper + "'" );
} | javascript | function( name, lower, upper ) {
return this.ok( name, lower < upper, this.lessThan, "\nLower Value '" + lower + "' is not less than upper value '" + upper + "'" );
} | [
"function",
"(",
"name",
",",
"lower",
",",
"upper",
")",
"{",
"return",
"this",
".",
"ok",
"(",
"name",
",",
"lower",
"<",
"upper",
",",
"this",
".",
"lessThan",
",",
"\"\\nLower Value '\"",
"+",
"lower",
"+",
"\"' is not less than upper value '\"",
"+",
... | Less than comparison | [
"Less",
"than",
"comparison"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L588-L590 | |
56,828 | codenothing/munit | lib/assert.js | function( name, value, lower, upper ) {
return this.ok(
name,
value > lower && value < upper,
this.between,
"\nValue '" + value + "' is not inbetween '" + lower + "' and '" + upper + "'"
);
} | javascript | function( name, value, lower, upper ) {
return this.ok(
name,
value > lower && value < upper,
this.between,
"\nValue '" + value + "' is not inbetween '" + lower + "' and '" + upper + "'"
);
} | [
"function",
"(",
"name",
",",
"value",
",",
"lower",
",",
"upper",
")",
"{",
"return",
"this",
".",
"ok",
"(",
"name",
",",
"value",
">",
"lower",
"&&",
"value",
"<",
"upper",
",",
"this",
".",
"between",
",",
"\"\\nValue '\"",
"+",
"value",
"+",
"... | Value between boundary | [
"Value",
"between",
"boundary"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L593-L600 | |
56,829 | codenothing/munit | lib/assert.js | function( name, actual, expected ) {
var self = this, passed = true, extra = '';
try {
self._objectMatch( actual, expected );
}
catch ( e ) {
passed = false;
extra = e;
if ( ! munit.isString( e ) ) {
throw e;
}
}
return self.ok( name, passed, self.deepEqual, extra );
} | javascript | function( name, actual, expected ) {
var self = this, passed = true, extra = '';
try {
self._objectMatch( actual, expected );
}
catch ( e ) {
passed = false;
extra = e;
if ( ! munit.isString( e ) ) {
throw e;
}
}
return self.ok( name, passed, self.deepEqual, extra );
} | [
"function",
"(",
"name",
",",
"actual",
",",
"expected",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"true",
",",
"extra",
"=",
"''",
";",
"try",
"{",
"self",
".",
"_objectMatch",
"(",
"actual",
",",
"expected",
")",
";",
"}",
"catch"... | Deep equal handle | [
"Deep",
"equal",
"handle"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L603-L619 | |
56,830 | codenothing/munit | lib/assert.js | function( name, actual, expected ) {
var self = this, passed = true;
try {
self._objectMatch( actual, expected );
passed = false;
}
catch ( e ) {
}
return self.ok( name, passed, self.notDeepEqual, 'Objects are not supposed to match' );
} | javascript | function( name, actual, expected ) {
var self = this, passed = true;
try {
self._objectMatch( actual, expected );
passed = false;
}
catch ( e ) {
}
return self.ok( name, passed, self.notDeepEqual, 'Objects are not supposed to match' );
} | [
"function",
"(",
"name",
",",
"actual",
",",
"expected",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"true",
";",
"try",
"{",
"self",
".",
"_objectMatch",
"(",
"actual",
",",
"expected",
")",
";",
"passed",
"=",
"false",
";",
"}",
"ca... | Not deep equal handle | [
"Not",
"deep",
"equal",
"handle"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L622-L633 | |
56,831 | codenothing/munit | lib/assert.js | function( name, match, block ) {
var self = this, result = { passed: false, extra: 'Block did not throw error' };
// Variable arguments
if ( block === undefined && munit.isFunction( match ) ) {
block = match;
match = undefined;
}
// Fail quick if block isn't a function
if ( ! munit.isFunction( block... | javascript | function( name, match, block ) {
var self = this, result = { passed: false, extra: 'Block did not throw error' };
// Variable arguments
if ( block === undefined && munit.isFunction( match ) ) {
block = match;
match = undefined;
}
// Fail quick if block isn't a function
if ( ! munit.isFunction( block... | [
"function",
"(",
"name",
",",
"match",
",",
"block",
")",
"{",
"var",
"self",
"=",
"this",
",",
"result",
"=",
"{",
"passed",
":",
"false",
",",
"extra",
":",
"'Block did not throw error'",
"}",
";",
"// Variable arguments",
"if",
"(",
"block",
"===",
"u... | Run internal throw handle | [
"Run",
"internal",
"throw",
"handle"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L636-L659 | |
56,832 | codenothing/munit | lib/assert.js | function( name, block ) {
var self = this, passed = true;
try {
block();
}
catch ( e ) {
passed = false;
}
return self.ok( name, passed, self.doesNotThrow, 'Block does throw error' );
} | javascript | function( name, block ) {
var self = this, passed = true;
try {
block();
}
catch ( e ) {
passed = false;
}
return self.ok( name, passed, self.doesNotThrow, 'Block does throw error' );
} | [
"function",
"(",
"name",
",",
"block",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"true",
";",
"try",
"{",
"block",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"passed",
"=",
"false",
";",
"}",
"return",
"self",
".",
"ok",
... | Run internal notThrow handle | [
"Run",
"internal",
"notThrow",
"handle"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L662-L673 | |
56,833 | codenothing/munit | lib/assert.js | function( name, actual, expected ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( expected ) ) {
passed = actual.getTime() === expected.getTime();
message = "Date '" + actual + "' does not match '" + expected + "'";
}
else {
message = munit.isDate( ... | javascript | function( name, actual, expected ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( expected ) ) {
passed = actual.getTime() === expected.getTime();
message = "Date '" + actual + "' does not match '" + expected + "'";
}
else {
message = munit.isDate( ... | [
"function",
"(",
"name",
",",
"actual",
",",
"expected",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"false",
",",
"message",
"=",
"''",
";",
"if",
"(",
"munit",
".",
"isDate",
"(",
"actual",
")",
"&&",
"munit",
".",
"isDate",
"(",
... | Matching date objects | [
"Matching",
"date",
"objects"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L676-L692 | |
56,834 | codenothing/munit | lib/assert.js | function( name, actual, lower ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( lower ) ) {
passed = actual.getTime() > lower.getTime();
message = "Date '" + actual + "' is not after '" + lower + "'";
}
else {
message = munit.isDate( actual ) ?
"... | javascript | function( name, actual, lower ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( lower ) ) {
passed = actual.getTime() > lower.getTime();
message = "Date '" + actual + "' is not after '" + lower + "'";
}
else {
message = munit.isDate( actual ) ?
"... | [
"function",
"(",
"name",
",",
"actual",
",",
"lower",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"false",
",",
"message",
"=",
"''",
";",
"if",
"(",
"munit",
".",
"isDate",
"(",
"actual",
")",
"&&",
"munit",
".",
"isDate",
"(",
"lo... | Tests date is after another date | [
"Tests",
"date",
"is",
"after",
"another",
"date"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L695-L711 | |
56,835 | codenothing/munit | lib/assert.js | function( name, actual, upper ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( upper ) ) {
passed = actual.getTime() < upper.getTime();
message = "Date '" + actual + "' is not before '" + upper + "'";
}
else {
message = munit.isDate( actual ) ?
... | javascript | function( name, actual, upper ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( upper ) ) {
passed = actual.getTime() < upper.getTime();
message = "Date '" + actual + "' is not before '" + upper + "'";
}
else {
message = munit.isDate( actual ) ?
... | [
"function",
"(",
"name",
",",
"actual",
",",
"upper",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"false",
",",
"message",
"=",
"''",
";",
"if",
"(",
"munit",
".",
"isDate",
"(",
"actual",
")",
"&&",
"munit",
".",
"isDate",
"(",
"up... | Tests date is before another date | [
"Tests",
"date",
"is",
"before",
"another",
"date"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L714-L730 | |
56,836 | codenothing/munit | lib/assert.js | function( name, actual, lower, upper ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( lower ) && munit.isDate( upper ) ) {
passed = actual.getTime() > lower.getTime() && actual.getTime() < upper.getTime();
message = "Date '" + actual + "' is not between '"... | javascript | function( name, actual, lower, upper ) {
var self = this,
passed = false,
message = '';
if ( munit.isDate( actual ) && munit.isDate( lower ) && munit.isDate( upper ) ) {
passed = actual.getTime() > lower.getTime() && actual.getTime() < upper.getTime();
message = "Date '" + actual + "' is not between '"... | [
"function",
"(",
"name",
",",
"actual",
",",
"lower",
",",
"upper",
")",
"{",
"var",
"self",
"=",
"this",
",",
"passed",
"=",
"false",
",",
"message",
"=",
"''",
";",
"if",
"(",
"munit",
".",
"isDate",
"(",
"actual",
")",
"&&",
"munit",
".",
"isD... | Tests date is between two other dates | [
"Tests",
"date",
"is",
"between",
"two",
"other",
"dates"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L733-L749 | |
56,837 | codenothing/munit | lib/assert.js | function( name, handle ) {
var self = this;
// Can only add custom assertions when module hasn't been triggered yet
self.requireMaxState( munit.ASSERT_STATE_DEFAULT, self.custom );
// Block on reserved words
if ( munit.customReserved.indexOf( name ) > -1 ) {
throw new Error( "'" + name + "' is a reserved... | javascript | function( name, handle ) {
var self = this;
// Can only add custom assertions when module hasn't been triggered yet
self.requireMaxState( munit.ASSERT_STATE_DEFAULT, self.custom );
// Block on reserved words
if ( munit.customReserved.indexOf( name ) > -1 ) {
throw new Error( "'" + name + "' is a reserved... | [
"function",
"(",
"name",
",",
"handle",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Can only add custom assertions when module hasn't been triggered yet",
"self",
".",
"requireMaxState",
"(",
"munit",
".",
"ASSERT_STATE_DEFAULT",
",",
"self",
".",
"custom",
")",
... | Custom test additions | [
"Custom",
"test",
"additions"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L787-L805 | |
56,838 | codenothing/munit | lib/assert.js | function(){
var self = this;
// Can only start a module that hasn't been started yet
self.requireState( munit.ASSERT_STATE_DEFAULT, self.trigger );
// Setup and trigger module
self.start = self.end = Date.now();
// Parent namespaces sometimes don't have tests
// Also close out paths that aren't part of... | javascript | function(){
var self = this;
// Can only start a module that hasn't been started yet
self.requireState( munit.ASSERT_STATE_DEFAULT, self.trigger );
// Setup and trigger module
self.start = self.end = Date.now();
// Parent namespaces sometimes don't have tests
// Also close out paths that aren't part of... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Can only start a module that hasn't been started yet",
"self",
".",
"requireState",
"(",
"munit",
".",
"ASSERT_STATE_DEFAULT",
",",
"self",
".",
"trigger",
")",
";",
"// Setup and trigger module",
"self",... | Trigger module's tests | [
"Trigger",
"module",
"s",
"tests"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L900-L946 | |
56,839 | codenothing/munit | lib/assert.js | function(){
var self = this,
nodeVersion = process.version.replace( /\./g, '_' ),
xml = "<testsuite name='" + munit._xmlEncode( nodeVersion + self.nsPath ) + "' tests='" + self.count + "' failures='" + self.failed + "' skipped='" + self.skipped + "' time='" + ( ( self.end - self.start ) / 1000 ) + "'>";
self... | javascript | function(){
var self = this,
nodeVersion = process.version.replace( /\./g, '_' ),
xml = "<testsuite name='" + munit._xmlEncode( nodeVersion + self.nsPath ) + "' tests='" + self.count + "' failures='" + self.failed + "' skipped='" + self.skipped + "' time='" + ( ( self.end - self.start ) / 1000 ) + "'>";
self... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"nodeVersion",
"=",
"process",
".",
"version",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"'_'",
")",
",",
"xml",
"=",
"\"<testsuite name='\"",
"+",
"munit",
".",
"_xmlEncode",
"(",
"no... | Returns XML result format | [
"Returns",
"XML",
"result",
"format"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L949-L960 | |
56,840 | codenothing/munit | lib/assert.js | function(){
var self = this;
return {
name: self.nsPath.split( '.' ).pop(),
nsPath: self.nsPath,
count: self.count,
passed: self.passed,
failed: self.failed,
skipped: self.skipped,
start: self.start,
end: self.end,
time: self.end - self.start,
tests: self.list,
ns: self.ns,
};
} | javascript | function(){
var self = this;
return {
name: self.nsPath.split( '.' ).pop(),
nsPath: self.nsPath,
count: self.count,
passed: self.passed,
failed: self.failed,
skipped: self.skipped,
start: self.start,
end: self.end,
time: self.end - self.start,
tests: self.list,
ns: self.ns,
};
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"return",
"{",
"name",
":",
"self",
".",
"nsPath",
".",
"split",
"(",
"'.'",
")",
".",
"pop",
"(",
")",
",",
"nsPath",
":",
"self",
".",
"nsPath",
",",
"count",
":",
"self",
".",
"coun... | JSON result format | [
"JSON",
"result",
"format"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L963-L979 | |
56,841 | codenothing/munit | lib/assert.js | function( startFunc, forced ) {
var self = this, i, mod;
// Can only close an active module
self.requireState( munit.ASSERT_STATE_ACTIVE, self.close );
// Add fail marker if no tests were ran
if ( self.count < 1 ) {
self.fail( "[munit] No tests ran in this module" );
}
// Auto close out any spies
... | javascript | function( startFunc, forced ) {
var self = this, i, mod;
// Can only close an active module
self.requireState( munit.ASSERT_STATE_ACTIVE, self.close );
// Add fail marker if no tests were ran
if ( self.count < 1 ) {
self.fail( "[munit] No tests ran in this module" );
}
// Auto close out any spies
... | [
"function",
"(",
"startFunc",
",",
"forced",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
",",
"mod",
";",
"// Can only close an active module",
"self",
".",
"requireState",
"(",
"munit",
".",
"ASSERT_STATE_ACTIVE",
",",
"self",
".",
"close",
")",
";",
... | Forcing close of module | [
"Forcing",
"close",
"of",
"module"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L982-L1008 | |
56,842 | codenothing/munit | lib/assert.js | function( startFunc, forced ) {
var self = this, i, mod;
// Handle invalid number of tests ran
if ( self.options.expect > 0 && self.count < self.options.expect && munit.render.focusPath( self.nsPath ) ) {
self._fail(
'[munit] Unexpected End',
startFunc || self._close,
'Expecting ' + self.options.e... | javascript | function( startFunc, forced ) {
var self = this, i, mod;
// Handle invalid number of tests ran
if ( self.options.expect > 0 && self.count < self.options.expect && munit.render.focusPath( self.nsPath ) ) {
self._fail(
'[munit] Unexpected End',
startFunc || self._close,
'Expecting ' + self.options.e... | [
"function",
"(",
"startFunc",
",",
"forced",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
",",
"mod",
";",
"// Handle invalid number of tests ran",
"if",
"(",
"self",
".",
"options",
".",
"expect",
">",
"0",
"&&",
"self",
".",
"count",
"<",
"self",
... | Closing of module after teardown process | [
"Closing",
"of",
"module",
"after",
"teardown",
"process"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L1011-L1061 | |
56,843 | codenothing/munit | lib/assert.js | function( startFunc, forced ) {
var self = this, i, mod;
// Can only finish an module that's in a closed state
self.requireState( munit.ASSERT_STATE_CLOSED, startFunc || self.finish );
// Flip state to finished
self.state = munit.ASSERT_STATE_FINISHED;
// Force close each submodule if necessary
for ( i... | javascript | function( startFunc, forced ) {
var self = this, i, mod;
// Can only finish an module that's in a closed state
self.requireState( munit.ASSERT_STATE_CLOSED, startFunc || self.finish );
// Flip state to finished
self.state = munit.ASSERT_STATE_FINISHED;
// Force close each submodule if necessary
for ( i... | [
"function",
"(",
"startFunc",
",",
"forced",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
",",
"mod",
";",
"// Can only finish an module that's in a closed state",
"self",
".",
"requireState",
"(",
"munit",
".",
"ASSERT_STATE_CLOSED",
",",
"startFunc",
"||",
... | Finish this module and all sub modules | [
"Finish",
"this",
"module",
"and",
"all",
"sub",
"modules"
] | aedf3f31aafc05441970eec49eeeb81174c14033 | https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/assert.js#L1064-L1112 | |
56,844 | davidrayoussef/funcifyr | funcifyr.js | function(n) {
return function chunk(arg) {
if ( Array.isArray(arg) ) {
return arg.reduce((acc,_,i,a) => {
return i % n === 0 ? acc.concat( [a.slice(i, i + n)] ) : acc;
}, []);
}
else if ( typeof arg === 'string' ) {
return arg.match... | javascript | function(n) {
return function chunk(arg) {
if ( Array.isArray(arg) ) {
return arg.reduce((acc,_,i,a) => {
return i % n === 0 ? acc.concat( [a.slice(i, i + n)] ) : acc;
}, []);
}
else if ( typeof arg === 'string' ) {
return arg.match... | [
"function",
"(",
"n",
")",
"{",
"return",
"function",
"chunk",
"(",
"arg",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"arg",
")",
")",
"{",
"return",
"arg",
".",
"reduce",
"(",
"(",
"acc",
",",
"_",
",",
"i",
",",
"a",
")",
"=>",
"{",... | Returns an array of arrays or strings in chunks of n.
chunkBy :: (n) → (a) → arr
@param n - A number to use as chunk's length
@returns function
@param arg - An array or string to chunk
@returns array | [
"Returns",
"an",
"array",
"of",
"arrays",
"or",
"strings",
"in",
"chunks",
"of",
"n",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L56-L68 | |
56,845 | davidrayoussef/funcifyr | funcifyr.js | function(fn1, fn2) {
return function composed() {
return fn1.call(null, fn2.apply(null, arguments));
}
} | javascript | function(fn1, fn2) {
return function composed() {
return fn1.call(null, fn2.apply(null, arguments));
}
} | [
"function",
"(",
"fn1",
",",
"fn2",
")",
"{",
"return",
"function",
"composed",
"(",
")",
"{",
"return",
"fn1",
".",
"call",
"(",
"null",
",",
"fn2",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
")",
";",
"}",
"}"
] | Creates a function from two functions that runs fn1 on the results of fn2.
compose :: (fn, fn) → (a) → r
@param (fn1, fn2) - Two functions
@returns function
@param arguments - Any arguments passed to inner function
@returns Result of fn1(fn2(arguments)) | [
"Creates",
"a",
"function",
"from",
"two",
"functions",
"that",
"runs",
"fn1",
"on",
"the",
"results",
"of",
"fn2",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L80-L84 | |
56,846 | davidrayoussef/funcifyr | funcifyr.js | function(fn) {
return function curried() {
var gatheredArgs = [].slice.call(arguments);
if ( gatheredArgs.length >= fn.length ) {
return fn.apply(null, gatheredArgs);
}
return function(innerArg) {
var newArgs = [].concat(gatheredArgs, innerArg);
... | javascript | function(fn) {
return function curried() {
var gatheredArgs = [].slice.call(arguments);
if ( gatheredArgs.length >= fn.length ) {
return fn.apply(null, gatheredArgs);
}
return function(innerArg) {
var newArgs = [].concat(gatheredArgs, innerArg);
... | [
"function",
"(",
"fn",
")",
"{",
"return",
"function",
"curried",
"(",
")",
"{",
"var",
"gatheredArgs",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"if",
"(",
"gatheredArgs",
".",
"length",
">=",
"fn",
".",
"length",
")",
... | Takes a variadic function and returns unary functions until all parameters are used.
curry :: (fn → (a,b,c,d)) → (a) → (b) → (c) → (d) → r
@param fn - A function to be curried
@returns The curried function
@param arguments - Any arguments passed
@returns Either the result of original function if all params were used,... | [
"Takes",
"a",
"variadic",
"function",
"and",
"returns",
"unary",
"functions",
"until",
"all",
"parameters",
"are",
"used",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L98-L111 | |
56,847 | davidrayoussef/funcifyr | funcifyr.js | function(value, times) {
if (Array.fill) {
return new Array(times).fill(value);
}
return Array.apply(null, Array(+times)).map(function() {
return value;
});
} | javascript | function(value, times) {
if (Array.fill) {
return new Array(times).fill(value);
}
return Array.apply(null, Array(+times)).map(function() {
return value;
});
} | [
"function",
"(",
"value",
",",
"times",
")",
"{",
"if",
"(",
"Array",
".",
"fill",
")",
"{",
"return",
"new",
"Array",
"(",
"times",
")",
".",
"fill",
"(",
"value",
")",
";",
"}",
"return",
"Array",
".",
"apply",
"(",
"null",
",",
"Array",
"(",
... | Returns an array filled with a value repeated a number of times.
fill :: (n, n) → arr
@param (value, times) - The value to fill, and the length of the new array
@returns array | [
"Returns",
"an",
"array",
"filled",
"with",
"a",
"value",
"repeated",
"a",
"number",
"of",
"times",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L121-L128 | |
56,848 | davidrayoussef/funcifyr | funcifyr.js | function(x, fn) {
if (Array.isArray(x) ) {
return x.reduce(function(acc, curr) {
return acc.concat( funcifyr.flatMap(curr, fn) );
}, []);
}
return fn(x);
} | javascript | function(x, fn) {
if (Array.isArray(x) ) {
return x.reduce(function(acc, curr) {
return acc.concat( funcifyr.flatMap(curr, fn) );
}, []);
}
return fn(x);
} | [
"function",
"(",
"x",
",",
"fn",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"x",
")",
")",
"{",
"return",
"x",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"curr",
")",
"{",
"return",
"acc",
".",
"concat",
"(",
"funcifyr",
".",
"fla... | Takes a multidimensional array and a callback function, and returns a new, flattened array with the
results of calling the callback function on each value.
flatMap :: ([a, [b, [c, d]]], fn) → [a, b, c, d]
@param (x, fn) - A multidimensional array and a callback function
@returns array | [
"Takes",
"a",
"multidimensional",
"array",
"and",
"a",
"callback",
"function",
"and",
"returns",
"a",
"new",
"flattened",
"array",
"with",
"the",
"results",
"of",
"calling",
"the",
"callback",
"function",
"on",
"each",
"value",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L139-L146 | |
56,849 | davidrayoussef/funcifyr | funcifyr.js | function(key) {
return function group(arr) {
return arr.reduce(function(obj, item) {
(obj[item[key]] = obj[item[key]] || []).push(item);
return obj;
}, {});
}
} | javascript | function(key) {
return function group(arr) {
return arr.reduce(function(obj, item) {
(obj[item[key]] = obj[item[key]] || []).push(item);
return obj;
}, {});
}
} | [
"function",
"(",
"key",
")",
"{",
"return",
"function",
"group",
"(",
"arr",
")",
"{",
"return",
"arr",
".",
"reduce",
"(",
"function",
"(",
"obj",
",",
"item",
")",
"{",
"(",
"obj",
"[",
"item",
"[",
"key",
"]",
"]",
"=",
"obj",
"[",
"item",
"... | Groups together related prop values from an array of objects.
groupBy :: (a) → (arr) → obj
@param key - A property name used to do the grouping
@returns function
@param arr - An array of objects
@returns An object of key-value pairs grouped by the key | [
"Groups",
"together",
"related",
"prop",
"values",
"from",
"an",
"array",
"of",
"objects",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L189-L196 | |
56,850 | davidrayoussef/funcifyr | funcifyr.js | function(collection, fn) {
if ( Array.isArray(collection) ) {
var result = [];
for (var i = 0; i < collection.length; i++) {
result[i] = fn(collection[i], i, collection);
}
return result;
}
else if ( Object.prototype.toString.call(collection)... | javascript | function(collection, fn) {
if ( Array.isArray(collection) ) {
var result = [];
for (var i = 0; i < collection.length; i++) {
result[i] = fn(collection[i], i, collection);
}
return result;
}
else if ( Object.prototype.toString.call(collection)... | [
"function",
"(",
"collection",
",",
"fn",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"collection",
")",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"collection",
".",
"length",
";",
"i... | Maps over a collection and runs a callback on each item.
map :: (obj, fn) → arr
@param (collection, fn) - An array or object to iterate over, and a callback function to run
@returns array or object | [
"Maps",
"over",
"a",
"collection",
"and",
"runs",
"a",
"callback",
"on",
"each",
"item",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L238-L260 | |
56,851 | davidrayoussef/funcifyr | funcifyr.js | function(fn1, fn2) {
return function orified(arg) {
return fn1.call(null, arg) || fn2.call(null, arg);
}
} | javascript | function(fn1, fn2) {
return function orified(arg) {
return fn1.call(null, arg) || fn2.call(null, arg);
}
} | [
"function",
"(",
"fn1",
",",
"fn2",
")",
"{",
"return",
"function",
"orified",
"(",
"arg",
")",
"{",
"return",
"fn1",
".",
"call",
"(",
"null",
",",
"arg",
")",
"||",
"fn2",
".",
"call",
"(",
"null",
",",
"arg",
")",
";",
"}",
"}"
] | Runs two predicate functions on an argument and returns true if either are true.
or :: (fn, fn) → (a) → bool
@param (fn1, fn2) - Two predicate functions
@returns function
@param arg - An argument to run the two predicate functions on
@returns true or false | [
"Runs",
"two",
"predicate",
"functions",
"on",
"an",
"argument",
"and",
"returns",
"true",
"if",
"either",
"are",
"true",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L304-L308 | |
56,852 | davidrayoussef/funcifyr | funcifyr.js | function(/*fns*/) {
var fns = [].slice.call(arguments);
return function piped(/*args*/) {
var args = [].slice.call(arguments);
fns.forEach(function(fn) {
args = [fn.apply(null, args)];
});
return args[0];
};
} | javascript | function(/*fns*/) {
var fns = [].slice.call(arguments);
return function piped(/*args*/) {
var args = [].slice.call(arguments);
fns.forEach(function(fn) {
args = [fn.apply(null, args)];
});
return args[0];
};
} | [
"function",
"(",
"/*fns*/",
")",
"{",
"var",
"fns",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"return",
"function",
"piped",
"(",
"/*args*/",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arg... | Runs several functions, using the result of one function as the argument for the next.
pipe :: (fns) → (a) → r
@param arguments - A variadic number of functions
@returns function
@param arguments - A variadic number of arguments
@returns The result of calling each function on the arguments | [
"Runs",
"several",
"functions",
"using",
"the",
"result",
"of",
"one",
"function",
"as",
"the",
"argument",
"for",
"the",
"next",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L336-L345 | |
56,853 | davidrayoussef/funcifyr | funcifyr.js | function(start, stop, step) {
if (arguments.length === 1) return funcifyr.range(1, start, 1);
if (arguments.length === 2) return funcifyr.range(start, stop, 1);
var result = [];
for (var i = start; i <= stop; i += step) {
result.push(i);
}
return result;
... | javascript | function(start, stop, step) {
if (arguments.length === 1) return funcifyr.range(1, start, 1);
if (arguments.length === 2) return funcifyr.range(start, stop, 1);
var result = [];
for (var i = start; i <= stop; i += step) {
result.push(i);
}
return result;
... | [
"function",
"(",
"start",
",",
"stop",
",",
"step",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"return",
"funcifyr",
".",
"range",
"(",
"1",
",",
"start",
",",
"1",
")",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"2... | Returns an array of numbers ranging from start to stop, incremented by step.
range :: (n, n, n) → arr
@param (start, stop, step) - A start value, a stop value, and a step value to increment by
@returns An array of the range of numbers | [
"Returns",
"an",
"array",
"of",
"numbers",
"ranging",
"from",
"start",
"to",
"stop",
"incremented",
"by",
"step",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L385-L396 | |
56,854 | davidrayoussef/funcifyr | funcifyr.js | function(str, times) {
if (String.prototype.repeat) return str.repeat(times);
return Array.apply(null, new Array(times)).map(function() {
return str;
}).join('');
} | javascript | function(str, times) {
if (String.prototype.repeat) return str.repeat(times);
return Array.apply(null, new Array(times)).map(function() {
return str;
}).join('');
} | [
"function",
"(",
"str",
",",
"times",
")",
"{",
"if",
"(",
"String",
".",
"prototype",
".",
"repeat",
")",
"return",
"str",
".",
"repeat",
"(",
"times",
")",
";",
"return",
"Array",
".",
"apply",
"(",
"null",
",",
"new",
"Array",
"(",
"times",
")",... | Repeats a string a number of times.
repeat :: (a, n) → r
@param (str, times) - A string to repeat, and a number for the amount of repetitions
@returns A repeated string | [
"Repeats",
"a",
"string",
"a",
"number",
"of",
"times",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L406-L411 | |
56,855 | davidrayoussef/funcifyr | funcifyr.js | function(arr) {
for (var i = 0; i < arr.length; i++) {
var randIndex = Math.floor(Math.random() * arr.length);
var temp = arr[randIndex];
arr[randIndex] = arr[i];
arr[i] = temp;
}
return arr;
} | javascript | function(arr) {
for (var i = 0; i < arr.length; i++) {
var randIndex = Math.floor(Math.random() * arr.length);
var temp = arr[randIndex];
arr[randIndex] = arr[i];
arr[i] = temp;
}
return arr;
} | [
"function",
"(",
"arr",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"randIndex",
"=",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"arr",
".",
"length",... | Randomly shuffles items in an array.
shuffle :: (arr) → arr
@param arr - An array to be shuffled
@returns A shuffled array | [
"Randomly",
"shuffles",
"items",
"in",
"an",
"array",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L436-L444 | |
56,856 | davidrayoussef/funcifyr | funcifyr.js | function(prop) {
return function tallied(arrayOfObjects) {
return arrayOfObjects.reduce(function(acc, curr) {
acc[curr[prop]] = (acc[curr[prop]] || 0) + 1;
return acc;
}, {});
}
} | javascript | function(prop) {
return function tallied(arrayOfObjects) {
return arrayOfObjects.reduce(function(acc, curr) {
acc[curr[prop]] = (acc[curr[prop]] || 0) + 1;
return acc;
}, {});
}
} | [
"function",
"(",
"prop",
")",
"{",
"return",
"function",
"tallied",
"(",
"arrayOfObjects",
")",
"{",
"return",
"arrayOfObjects",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"curr",
")",
"{",
"acc",
"[",
"curr",
"[",
"prop",
"]",
"]",
"=",
"(",
"... | Returns an object with the number of occurrences of a property value found in an array of objects.
tally :: (a) → (arr) → obj
@param prop - A string representation of a property to target
@returns function
@param arrayOfObjects - An array of objects
@returns An object with the prop as a key, and the number of its occ... | [
"Returns",
"an",
"object",
"with",
"the",
"number",
"of",
"occurrences",
"of",
"a",
"property",
"value",
"found",
"in",
"an",
"array",
"of",
"objects",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L456-L463 | |
56,857 | davidrayoussef/funcifyr | funcifyr.js | function(value) {
return {
value: value,
then: function(fn) {
this.value = fn(this.value);
return this;
},
end: function() {
return this.value;
}
};
} | javascript | function(value) {
return {
value: value,
then: function(fn) {
this.value = fn(this.value);
return this;
},
end: function() {
return this.value;
}
};
} | [
"function",
"(",
"value",
")",
"{",
"return",
"{",
"value",
":",
"value",
",",
"then",
":",
"function",
"(",
"fn",
")",
"{",
"this",
".",
"value",
"=",
"fn",
"(",
"this",
".",
"value",
")",
";",
"return",
"this",
";",
"}",
",",
"end",
":",
"fun... | Creates sequence of chainable actions.
thenify :: (a) → obj
@param value - An initial value
@returns An object with a then function to run on the value, and an end function to return the final value | [
"Creates",
"sequence",
"of",
"chainable",
"actions",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L473-L484 | |
56,858 | davidrayoussef/funcifyr | funcifyr.js | function(arr) {
if (Array.prototype.from) return Array.from(new Set(arr));
return arr.filter(function(v,i,a) {
return i === a.indexOf(v);
});
} | javascript | function(arr) {
if (Array.prototype.from) return Array.from(new Set(arr));
return arr.filter(function(v,i,a) {
return i === a.indexOf(v);
});
} | [
"function",
"(",
"arr",
")",
"{",
"if",
"(",
"Array",
".",
"prototype",
".",
"from",
")",
"return",
"Array",
".",
"from",
"(",
"new",
"Set",
"(",
"arr",
")",
")",
";",
"return",
"arr",
".",
"filter",
"(",
"function",
"(",
"v",
",",
"i",
",",
"a... | Takes an array with duplicates and returns a new one with all dupes removed.
unique :: (arr) → arr
@param arr
@returns A new array with duplicates removed | [
"Takes",
"an",
"array",
"with",
"duplicates",
"and",
"returns",
"a",
"new",
"one",
"with",
"all",
"dupes",
"removed",
"."
] | 84042752f605a74953b9698c65db4b90b5c4f484 | https://github.com/davidrayoussef/funcifyr/blob/84042752f605a74953b9698c65db4b90b5c4f484/funcifyr.js#L494-L499 | |
56,859 | winding-lines/ember-cli-typify | lib/typescript-preprocessor.js | typePaths | function typePaths(config) {
var out = [
"node_modules/@types",
];
var paths = (config.compilerOptions && config.compilerOptions.paths) || {};
Object.keys(paths).forEach( function eachEntry(k) {
// paths may contain a /*, eliminate it
paths[k].forEach(function eachPath(a) {
var p = a.split("... | javascript | function typePaths(config) {
var out = [
"node_modules/@types",
];
var paths = (config.compilerOptions && config.compilerOptions.paths) || {};
Object.keys(paths).forEach( function eachEntry(k) {
// paths may contain a /*, eliminate it
paths[k].forEach(function eachPath(a) {
var p = a.split("... | [
"function",
"typePaths",
"(",
"config",
")",
"{",
"var",
"out",
"=",
"[",
"\"node_modules/@types\"",
",",
"]",
";",
"var",
"paths",
"=",
"(",
"config",
".",
"compilerOptions",
"&&",
"config",
".",
"compilerOptions",
".",
"paths",
")",
"||",
"{",
"}",
";"... | Return the paths which contain type information. | [
"Return",
"the",
"paths",
"which",
"contain",
"type",
"information",
"."
] | 3551e75bf6e00850b77365b18c3f6cef8b24137b | https://github.com/winding-lines/ember-cli-typify/blob/3551e75bf6e00850b77365b18c3f6cef8b24137b/lib/typescript-preprocessor.js#L30-L46 |
56,860 | wzrdtales/umigrate-mariadb | index.js | function ( config, callback )
{
var self = this;
var db = Array(),
diff = Array(),
first = true;
for( var c = 0; c < 2; ++c )
{
db[ c ] = Array();
for( var d = 0; d < 2; ++d )
{
db[ c ][ d ] = Array();
... | javascript | function ( config, callback )
{
var self = this;
var db = Array(),
diff = Array(),
first = true;
for( var c = 0; c < 2; ++c )
{
db[ c ] = Array();
for( var d = 0; d < 2; ++d )
{
db[ c ][ d ] = Array();
... | [
"function",
"(",
"config",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"db",
"=",
"Array",
"(",
")",
",",
"diff",
"=",
"Array",
"(",
")",
",",
"first",
"=",
"true",
";",
"for",
"(",
"var",
"c",
"=",
"0",
";",
"c",
"<",
... | Returns an array containing the Tables.
General return information:
This array has 2 layers, the final information layer has
8 elements.
Array Format:
Layer 1:
[0] = real table, [1] = diff table
Layer 3 (Result formatting):
[0] = table array*, [1] = view array*
Table Array (Content)
List of table name per array el... | [
"Returns",
"an",
"array",
"containing",
"the",
"Tables",
"."
] | b3ca76d7adb0660044b464c3564a852a454d24f0 | https://github.com/wzrdtales/umigrate-mariadb/blob/b3ca76d7adb0660044b464c3564a852a454d24f0/index.js#L43-L104 | |
56,861 | wzrdtales/umigrate-mariadb | index.js | function ( config, callback )
{
var self = this;
var db = Array(),
diff = Array(),
first = true;
db[ 0 ] = Array();
db[ 1 ] = Array();
diff[ 0 ] = Array();
diff[ 1 ] = Array();
var query = 'SELECT name, modified, type FROM mysql.proc ... | javascript | function ( config, callback )
{
var self = this;
var db = Array(),
diff = Array(),
first = true;
db[ 0 ] = Array();
db[ 1 ] = Array();
diff[ 0 ] = Array();
diff[ 1 ] = Array();
var query = 'SELECT name, modified, type FROM mysql.proc ... | [
"function",
"(",
"config",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"db",
"=",
"Array",
"(",
")",
",",
"diff",
"=",
"Array",
"(",
")",
",",
"first",
"=",
"true",
";",
"db",
"[",
"0",
"]",
"=",
"Array",
"(",
")",
";",... | No specification yet.
@return useless | [
"No",
"specification",
"yet",
"."
] | b3ca76d7adb0660044b464c3564a852a454d24f0 | https://github.com/wzrdtales/umigrate-mariadb/blob/b3ca76d7adb0660044b464c3564a852a454d24f0/index.js#L222-L278 | |
56,862 | wzrdtales/umigrate-mariadb | index.js | function ( config, tables, context, callback )
{
var self = this;
var db = Array(),
counter = 0,
query = 'SHOW INDEX FROM %s.%s;';
db[ 0 ] = Array();
db[ 1 ] = Array();
var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ?
t... | javascript | function ( config, tables, context, callback )
{
var self = this;
var db = Array(),
counter = 0,
query = 'SHOW INDEX FROM %s.%s;';
db[ 0 ] = Array();
db[ 1 ] = Array();
var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ?
t... | [
"function",
"(",
"config",
",",
"tables",
",",
"context",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"db",
"=",
"Array",
"(",
")",
",",
"counter",
"=",
"0",
",",
"query",
"=",
"'SHOW INDEX FROM %s.%s;'",
";",
"db",
"[",
"0",
... | Returns an array containing the indizies.
General return information:
This array has 3 layers, the final information layer has
6 elements.
Array Format:
Layer 1:
[0] = real table, [1] = diff table
Layer 2:
['tablename'] = Array for final table indizies information
Layer 3 (Result formatting):
[0] = key name, [1] =... | [
"Returns",
"an",
"array",
"containing",
"the",
"indizies",
"."
] | b3ca76d7adb0660044b464c3564a852a454d24f0 | https://github.com/wzrdtales/umigrate-mariadb/blob/b3ca76d7adb0660044b464c3564a852a454d24f0/index.js#L369-L426 | |
56,863 | wzrdtales/umigrate-mariadb | index.js | function ( config, tables, context, callback )
{
var self = this,
db = Array(),
counter = 0;
db[ 0 ] = Array();
db[ 1 ] = Array();
var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ?
tables.tables[ 0 ].length : tables.tab... | javascript | function ( config, tables, context, callback )
{
var self = this,
db = Array(),
counter = 0;
db[ 0 ] = Array();
db[ 1 ] = Array();
var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ?
tables.tables[ 0 ].length : tables.tab... | [
"function",
"(",
"config",
",",
"tables",
",",
"context",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"db",
"=",
"Array",
"(",
")",
",",
"counter",
"=",
"0",
";",
"db",
"[",
"0",
"]",
"=",
"Array",
"(",
")",
";",
"db",
"[",
"1... | Returns an array containing the foreign keys.
General return information:
This array has 3 layers, the final information layer has
8 elements.
Array Format:
Layer 1:
[0] = real table, [1] = diff table
Layer 2:
['tablename'] = Array for final table indizies information
Layer 3 (Result formatting):
[0] = foreign_key... | [
"Returns",
"an",
"array",
"containing",
"the",
"foreign",
"keys",
"."
] | b3ca76d7adb0660044b464c3564a852a454d24f0 | https://github.com/wzrdtales/umigrate-mariadb/blob/b3ca76d7adb0660044b464c3564a852a454d24f0/index.js#L451-L531 | |
56,864 | Arcath/etch-router | docs/js/components/static.js | function (wholeMatch, match, left, right) {
// unescape match to prevent double escaping
match = htmlunencode(match);
return left + hljs.highlightAuto(match).value + right;
} | javascript | function (wholeMatch, match, left, right) {
// unescape match to prevent double escaping
match = htmlunencode(match);
return left + hljs.highlightAuto(match).value + right;
} | [
"function",
"(",
"wholeMatch",
",",
"match",
",",
"left",
",",
"right",
")",
"{",
"// unescape match to prevent double escaping",
"match",
"=",
"htmlunencode",
"(",
"match",
")",
";",
"return",
"left",
"+",
"hljs",
".",
"highlightAuto",
"(",
"match",
")",
".",... | use new shodown's regexp engine to conditionally parse codeblocks | [
"use",
"new",
"shodown",
"s",
"regexp",
"engine",
"to",
"conditionally",
"parse",
"codeblocks"
] | 90b1e2f69c567d6b9f7165a13ca0144e789d7edb | https://github.com/Arcath/etch-router/blob/90b1e2f69c567d6b9f7165a13ca0144e789d7edb/docs/js/components/static.js#L23-L27 | |
56,865 | heroqu/hash-through | index.js | HashThrough | function HashThrough (createHash) {
const hashThrough = new Transform()
const hash = createHash()
hashThrough._transform = function (chunk, encoding, cb) {
setImmediate(_ => {
try {
hash.update(chunk)
cb(null, chunk)
} catch (err) {
cb(err)
}
})
}
// bind t... | javascript | function HashThrough (createHash) {
const hashThrough = new Transform()
const hash = createHash()
hashThrough._transform = function (chunk, encoding, cb) {
setImmediate(_ => {
try {
hash.update(chunk)
cb(null, chunk)
} catch (err) {
cb(err)
}
})
}
// bind t... | [
"function",
"HashThrough",
"(",
"createHash",
")",
"{",
"const",
"hashThrough",
"=",
"new",
"Transform",
"(",
")",
"const",
"hash",
"=",
"createHash",
"(",
")",
"hashThrough",
".",
"_transform",
"=",
"function",
"(",
"chunk",
",",
"encoding",
",",
"cb",
")... | Effectively a PassThrough stream that taps to chunks flow
and accumulating the hash | [
"Effectively",
"a",
"PassThrough",
"stream",
"that",
"taps",
"to",
"chunks",
"flow",
"and",
"accumulating",
"the",
"hash"
] | 47a8d55b581cbc6f22f1b2be4f8f88ceeb5612b3 | https://github.com/heroqu/hash-through/blob/47a8d55b581cbc6f22f1b2be4f8f88ceeb5612b3/index.js#L11-L31 |
56,866 | kuhnza/node-tubesio | lib/tubesio/logging.js | Logger | function Logger(level) {
if (_.isString(level) && _.has(LogLevel, level)) {
this.level = LogLevel[level];
} else if (_.isNumber(level) && level >= 0 && level <= 4) {
this.level = level;
} else {
this.level = LogLevel.info;
}
} | javascript | function Logger(level) {
if (_.isString(level) && _.has(LogLevel, level)) {
this.level = LogLevel[level];
} else if (_.isNumber(level) && level >= 0 && level <= 4) {
this.level = level;
} else {
this.level = LogLevel.info;
}
} | [
"function",
"Logger",
"(",
"level",
")",
"{",
"if",
"(",
"_",
".",
"isString",
"(",
"level",
")",
"&&",
"_",
".",
"has",
"(",
"LogLevel",
",",
"level",
")",
")",
"{",
"this",
".",
"level",
"=",
"LogLevel",
"[",
"level",
"]",
";",
"}",
"else",
"... | Logger that logs exclusively to stderr so that logging doesn't pollute the
scraper result which is written to stdout. | [
"Logger",
"that",
"logs",
"exclusively",
"to",
"stderr",
"so",
"that",
"logging",
"doesn",
"t",
"pollute",
"the",
"scraper",
"result",
"which",
"is",
"written",
"to",
"stdout",
"."
] | 198d005de764480485fe038d1832ccb0f6e0596e | https://github.com/kuhnza/node-tubesio/blob/198d005de764480485fe038d1832ccb0f6e0596e/lib/tubesio/logging.js#L27-L35 |
56,867 | hl198181/neptune | misc/demo/public/vendor/angular/docs/js/docs.js | localSearchFactory | function localSearchFactory($http, $timeout, NG_PAGES) {
console.log('Using Local Search Index');
// Create the lunr index
var index = lunr(function() {
this.ref('path');
this.field('titleWords', {boost: 50});
this.field('members', { boost: 40});
this.field('keywords', { boost : 20... | javascript | function localSearchFactory($http, $timeout, NG_PAGES) {
console.log('Using Local Search Index');
// Create the lunr index
var index = lunr(function() {
this.ref('path');
this.field('titleWords', {boost: 50});
this.field('members', { boost: 40});
this.field('keywords', { boost : 20... | [
"function",
"localSearchFactory",
"(",
"$http",
",",
"$timeout",
",",
"NG_PAGES",
")",
"{",
"console",
".",
"log",
"(",
"'Using Local Search Index'",
")",
";",
"// Create the lunr index",
"var",
"index",
"=",
"lunr",
"(",
"function",
"(",
")",
"{",
"this",
"."... | This version of the service builds the index in the current thread, which blocks rendering and other browser activities. It should only be used where the browser does not support WebWorkers | [
"This",
"version",
"of",
"the",
"service",
"builds",
"the",
"index",
"in",
"the",
"current",
"thread",
"which",
"blocks",
"rendering",
"and",
"other",
"browser",
"activities",
".",
"It",
"should",
"only",
"be",
"used",
"where",
"the",
"browser",
"does",
"not... | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/angular/docs/js/docs.js#L354-L392 |
56,868 | hl198181/neptune | misc/demo/public/vendor/angular/docs/js/docs.js | webWorkerSearchFactory | function webWorkerSearchFactory($q, $rootScope, NG_PAGES) {
console.log('Using WebWorker Search Index')
var searchIndex = $q.defer();
var results;
var worker = new Worker('js/search-worker.js');
// The worker will send us a message in two situations:
// - when the index has been built, ready... | javascript | function webWorkerSearchFactory($q, $rootScope, NG_PAGES) {
console.log('Using WebWorker Search Index')
var searchIndex = $q.defer();
var results;
var worker = new Worker('js/search-worker.js');
// The worker will send us a message in two situations:
// - when the index has been built, ready... | [
"function",
"webWorkerSearchFactory",
"(",
"$q",
",",
"$rootScope",
",",
"NG_PAGES",
")",
"{",
"console",
".",
"log",
"(",
"'Using WebWorker Search Index'",
")",
"var",
"searchIndex",
"=",
"$q",
".",
"defer",
"(",
")",
";",
"var",
"results",
";",
"var",
"wor... | This version of the service builds the index in a WebWorker, which does not block rendering and other browser activities. It should only be used where the browser does support WebWorkers | [
"This",
"version",
"of",
"the",
"service",
"builds",
"the",
"index",
"in",
"a",
"WebWorker",
"which",
"does",
"not",
"block",
"rendering",
"and",
"other",
"browser",
"activities",
".",
"It",
"should",
"only",
"be",
"used",
"where",
"the",
"browser",
"does",
... | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/angular/docs/js/docs.js#L398-L439 |
56,869 | dominictarr/level-queue | index.js | queue | function queue (job, value, put) {
var ts = timestamp()
var key = toKey(job, ts)
var id = hash(job+':'+value)
if(pending[id]) return null //this job is already queued.
pending[id] = Date.now()
if(put === false) {
//return the job to be queued, to include it in a batch inser... | javascript | function queue (job, value, put) {
var ts = timestamp()
var key = toKey(job, ts)
var id = hash(job+':'+value)
if(pending[id]) return null //this job is already queued.
pending[id] = Date.now()
if(put === false) {
//return the job to be queued, to include it in a batch inser... | [
"function",
"queue",
"(",
"job",
",",
"value",
",",
"put",
")",
"{",
"var",
"ts",
"=",
"timestamp",
"(",
")",
"var",
"key",
"=",
"toKey",
"(",
"job",
",",
"ts",
")",
"var",
"id",
"=",
"hash",
"(",
"job",
"+",
"':'",
"+",
"value",
")",
"if",
"... | put=false means return a job to be queued | [
"put",
"=",
"false",
"means",
"return",
"a",
"job",
"to",
"be",
"queued"
] | 2ac2ee1f088a86d14e58e4d5c140498e7ba30875 | https://github.com/dominictarr/level-queue/blob/2ac2ee1f088a86d14e58e4d5c140498e7ba30875/index.js#L117-L135 |
56,870 | pinyin/outline | vendor/transformation-matrix/skew.js | skew | function skew(ax, ay) {
return {
a: 1, c: tan(ax), e: 0,
b: tan(ay), d: 1, f: 0
};
} | javascript | function skew(ax, ay) {
return {
a: 1, c: tan(ax), e: 0,
b: tan(ay), d: 1, f: 0
};
} | [
"function",
"skew",
"(",
"ax",
",",
"ay",
")",
"{",
"return",
"{",
"a",
":",
"1",
",",
"c",
":",
"tan",
"(",
"ax",
")",
",",
"e",
":",
"0",
",",
"b",
":",
"tan",
"(",
"ay",
")",
",",
"d",
":",
"1",
",",
"f",
":",
"0",
"}",
";",
"}"
] | Calculate a skew matrix
@param ax Skew on axis x
@param ay Skew on axis y
@returns {{a: number, b: number, c: number, e: number, d: number, f: number}} Affine matrix | [
"Calculate",
"a",
"skew",
"matrix"
] | e49f05d2f8ab384f5b1d71b2b10875cd48d41051 | https://github.com/pinyin/outline/blob/e49f05d2f8ab384f5b1d71b2b10875cd48d41051/vendor/transformation-matrix/skew.js#L18-L23 |
56,871 | pinyin/outline | vendor/transformation-matrix/skew.js | skewDEG | function skewDEG(ax, ay) {
return skew(ax * Math.PI / 180, ay * Math.PI / 180);
} | javascript | function skewDEG(ax, ay) {
return skew(ax * Math.PI / 180, ay * Math.PI / 180);
} | [
"function",
"skewDEG",
"(",
"ax",
",",
"ay",
")",
"{",
"return",
"skew",
"(",
"ax",
"*",
"Math",
".",
"PI",
"/",
"180",
",",
"ay",
"*",
"Math",
".",
"PI",
"/",
"180",
")",
";",
"}"
] | Calculate a skew matrix using DEG angles
@param ax Skew on axis x
@param ay Skew on axis y
@returns {{a: number, b: number, c: number, e: number, d: number, f: number}} Affine matrix | [
"Calculate",
"a",
"skew",
"matrix",
"using",
"DEG",
"angles"
] | e49f05d2f8ab384f5b1d71b2b10875cd48d41051 | https://github.com/pinyin/outline/blob/e49f05d2f8ab384f5b1d71b2b10875cd48d41051/vendor/transformation-matrix/skew.js#L31-L33 |
56,872 | Industryswarm/isnode-mod-data | lib/mongodb/bson/lib/bson/objectid.js | ObjectID | function ObjectID(id) {
// Duck-typing to support ObjectId from different npm packages
if (id instanceof ObjectID) return id;
if (!(this instanceof ObjectID)) return new ObjectID(id);
this._bsontype = 'ObjectID';
// The most common usecase (blank id, new objectId instance)
if (id == null || typeof id === ... | javascript | function ObjectID(id) {
// Duck-typing to support ObjectId from different npm packages
if (id instanceof ObjectID) return id;
if (!(this instanceof ObjectID)) return new ObjectID(id);
this._bsontype = 'ObjectID';
// The most common usecase (blank id, new objectId instance)
if (id == null || typeof id === ... | [
"function",
"ObjectID",
"(",
"id",
")",
"{",
"// Duck-typing to support ObjectId from different npm packages",
"if",
"(",
"id",
"instanceof",
"ObjectID",
")",
"return",
"id",
";",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"ObjectID",
")",
")",
"return",
"new",
... | Create a new ObjectID instance
@class
@param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number.
@property {number} generationTime The generation time of this ObjectId instance
@return {ObjectID} instance of ObjectID. | [
"Create",
"a",
"new",
"ObjectID",
"instance"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/bson/lib/bson/objectid.js#L35-L77 |
56,873 | nathanfrancy/safetext | lib/index.js | init | function init(masterPassword, map) {
var fileContents = JSON.stringify(map);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileContents);
} | javascript | function init(masterPassword, map) {
var fileContents = JSON.stringify(map);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileContents);
} | [
"function",
"init",
"(",
"masterPassword",
",",
"map",
")",
"{",
"var",
"fileContents",
"=",
"JSON",
".",
"stringify",
"(",
"map",
")",
";",
"var",
"encryptedFileContents",
"=",
"encryption",
".",
"encrypt",
"(",
"fileContents",
",",
"masterPassword",
")",
"... | Make a new safetext file with encrypted contents.
@param masterPassword
@param map
@returns {Promise.<TResult>} | [
"Make",
"a",
"new",
"safetext",
"file",
"with",
"encrypted",
"contents",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L10-L14 |
56,874 | nathanfrancy/safetext | lib/index.js | getContents | function getContents(masterPassword) {
var encryptedContents = file.readFile();
try {
var contents = encryption.decrypt(encryptedContents, masterPassword);
return JSON.parse(contents);
} catch(err) {
console.log(err);
throw new Error("Error reading file contents. This most li... | javascript | function getContents(masterPassword) {
var encryptedContents = file.readFile();
try {
var contents = encryption.decrypt(encryptedContents, masterPassword);
return JSON.parse(contents);
} catch(err) {
console.log(err);
throw new Error("Error reading file contents. This most li... | [
"function",
"getContents",
"(",
"masterPassword",
")",
"{",
"var",
"encryptedContents",
"=",
"file",
".",
"readFile",
"(",
")",
";",
"try",
"{",
"var",
"contents",
"=",
"encryption",
".",
"decrypt",
"(",
"encryptedContents",
",",
"masterPassword",
")",
";",
... | Read object out of safetext, must include master password.
@param masterPassword
@returns {Promise.<TResult>} | [
"Read",
"object",
"out",
"of",
"safetext",
"must",
"include",
"master",
"password",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L21-L30 |
56,875 | nathanfrancy/safetext | lib/index.js | getKey | function getKey(key, masterPassword) {
var contents = getContents(masterPassword);
if (contents[key] != undefined) return contents[key];
else throw new Error(`Unable to find key '${key}' in password safe.`);
} | javascript | function getKey(key, masterPassword) {
var contents = getContents(masterPassword);
if (contents[key] != undefined) return contents[key];
else throw new Error(`Unable to find key '${key}' in password safe.`);
} | [
"function",
"getKey",
"(",
"key",
",",
"masterPassword",
")",
"{",
"var",
"contents",
"=",
"getContents",
"(",
"masterPassword",
")",
";",
"if",
"(",
"contents",
"[",
"key",
"]",
"!=",
"undefined",
")",
"return",
"contents",
"[",
"key",
"]",
";",
"else",... | Get a specific key value from safetext file.
@param key
@param masterPassword
@returns {Promise.<TResult>} | [
"Get",
"a",
"specific",
"key",
"value",
"from",
"safetext",
"file",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L54-L58 |
56,876 | nathanfrancy/safetext | lib/index.js | writeKey | function writeKey(key, value, masterPassword) {
var contents = getContents(masterPassword);
contents[key] = value;
var fileContents = JSON.stringify(contents);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileContents);
} | javascript | function writeKey(key, value, masterPassword) {
var contents = getContents(masterPassword);
contents[key] = value;
var fileContents = JSON.stringify(contents);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileContents);
} | [
"function",
"writeKey",
"(",
"key",
",",
"value",
",",
"masterPassword",
")",
"{",
"var",
"contents",
"=",
"getContents",
"(",
"masterPassword",
")",
";",
"contents",
"[",
"key",
"]",
"=",
"value",
";",
"var",
"fileContents",
"=",
"JSON",
".",
"stringify",... | Writes a key to the safetext file.
@param key
@param value
@param masterPassword
@returns {Promise.<TResult>} | [
"Writes",
"a",
"key",
"to",
"the",
"safetext",
"file",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L67-L73 |
56,877 | nathanfrancy/safetext | lib/index.js | removeKey | function removeKey(key, masterPassword) {
var contents = getContents(masterPassword);
if (contents[key] != undefined) delete contents[key];
var fileContents = JSON.stringify(contents);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileConten... | javascript | function removeKey(key, masterPassword) {
var contents = getContents(masterPassword);
if (contents[key] != undefined) delete contents[key];
var fileContents = JSON.stringify(contents);
var encryptedFileContents = encryption.encrypt(fileContents, masterPassword);
file.writeToFile(encryptedFileConten... | [
"function",
"removeKey",
"(",
"key",
",",
"masterPassword",
")",
"{",
"var",
"contents",
"=",
"getContents",
"(",
"masterPassword",
")",
";",
"if",
"(",
"contents",
"[",
"key",
"]",
"!=",
"undefined",
")",
"delete",
"contents",
"[",
"key",
"]",
";",
"var... | Removes a key from the safetext password file.
@param key
@param masterPassword
@returns {Promise.<TResult>} | [
"Removes",
"a",
"key",
"from",
"the",
"safetext",
"password",
"file",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L81-L88 |
56,878 | nathanfrancy/safetext | lib/index.js | changePassword | function changePassword(masterPassword, newPassword1, newPassword2) {
if (newPassword1 !== newPassword2) throw new Error("New passwords must match.");
else {
var contents = getContents(masterPassword);
init(newPassword1, contents);
}
} | javascript | function changePassword(masterPassword, newPassword1, newPassword2) {
if (newPassword1 !== newPassword2) throw new Error("New passwords must match.");
else {
var contents = getContents(masterPassword);
init(newPassword1, contents);
}
} | [
"function",
"changePassword",
"(",
"masterPassword",
",",
"newPassword1",
",",
"newPassword2",
")",
"{",
"if",
"(",
"newPassword1",
"!==",
"newPassword2",
")",
"throw",
"new",
"Error",
"(",
"\"New passwords must match.\"",
")",
";",
"else",
"{",
"var",
"contents",... | Changes the password of the safetext file.
@param masterPassword
@param newPassword1
@param newPassword2 | [
"Changes",
"the",
"password",
"of",
"the",
"safetext",
"file",
"."
] | 960733dacae4edd522f35178a99fc80e4ac8d096 | https://github.com/nathanfrancy/safetext/blob/960733dacae4edd522f35178a99fc80e4ac8d096/lib/index.js#L96-L102 |
56,879 | ibc/eventcollector | lib/eventcollector.js | function(total, timeout) {
events.EventEmitter.call(this);
if (! isPositiveInteger(total)) {
throw new Error('`total` must be a positive integer');
}
if (timeout && ! isPositiveInteger(timeout)) {
throw new Error('`timeout` must be a positive integer');
}
this.destroyed = false;
this.total = to... | javascript | function(total, timeout) {
events.EventEmitter.call(this);
if (! isPositiveInteger(total)) {
throw new Error('`total` must be a positive integer');
}
if (timeout && ! isPositiveInteger(timeout)) {
throw new Error('`timeout` must be a positive integer');
}
this.destroyed = false;
this.total = to... | [
"function",
"(",
"total",
",",
"timeout",
")",
"{",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"!",
"isPositiveInteger",
"(",
"total",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`total` must be a positive integer'",
"... | EventCollector class.
@class EventCollector
@constructor
@param {Number} total Number of events that must fire. | [
"EventCollector",
"class",
"."
] | 685c533d50076a6d9d5b67bbeb5f9f081f53aa9a | https://github.com/ibc/eventcollector/blob/685c533d50076a6d9d5b67bbeb5f9f081f53aa9a/lib/eventcollector.js#L56-L75 | |
56,880 | switer/block-ast | index.js | _join | function _join(arr1, arr2) {
var len = arr1.length > arr2 ? arr1.length : arr2.length
var joinedArr = []
while(len --) {
joinedArr.push(arr1.shift())
joinedArr.push(arr2.shift())
}
// merge remains
return joinedArr.concat(arr1).concat(arr2)
} | javascript | function _join(arr1, arr2) {
var len = arr1.length > arr2 ? arr1.length : arr2.length
var joinedArr = []
while(len --) {
joinedArr.push(arr1.shift())
joinedArr.push(arr2.shift())
}
// merge remains
return joinedArr.concat(arr1).concat(arr2)
} | [
"function",
"_join",
"(",
"arr1",
",",
"arr2",
")",
"{",
"var",
"len",
"=",
"arr1",
".",
"length",
">",
"arr2",
"?",
"arr1",
".",
"length",
":",
"arr2",
".",
"length",
"var",
"joinedArr",
"=",
"[",
"]",
"while",
"(",
"len",
"--",
")",
"{",
"joine... | join arr2's items to arr
@param {Array} arr1 odd number index items
@param {Array} arr2 even number index items
@return {Array} new array with join result | [
"join",
"arr2",
"s",
"items",
"to",
"arr"
] | cebc9b7671df8088f12538b9d748bbcbd4630f3e | https://github.com/switer/block-ast/blob/cebc9b7671df8088f12538b9d748bbcbd4630f3e/index.js#L14-L23 |
56,881 | jansedivy/potion | examples/demo-pixi-bunny/pixi.dev.js | callCompat | function callCompat(obj) {
if(obj) {
obj = obj.prototype || obj;
PIXI.EventTarget.mixin(obj);
}
} | javascript | function callCompat(obj) {
if(obj) {
obj = obj.prototype || obj;
PIXI.EventTarget.mixin(obj);
}
} | [
"function",
"callCompat",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
")",
"{",
"obj",
"=",
"obj",
".",
"prototype",
"||",
"obj",
";",
"PIXI",
".",
"EventTarget",
".",
"mixin",
"(",
"obj",
")",
";",
"}",
"}"
] | Backward compat from when this used to be a function | [
"Backward",
"compat",
"from",
"when",
"this",
"used",
"to",
"be",
"a",
"function"
] | 2e740ee68898d8ec8a34f8a3b6ee8e8faffce253 | https://github.com/jansedivy/potion/blob/2e740ee68898d8ec8a34f8a3b6ee8e8faffce253/examples/demo-pixi-bunny/pixi.dev.js#L5459-L5464 |
56,882 | jansedivy/potion | examples/demo-pixi-bunny/pixi.dev.js | function () {
var ikConstraints = this.ikConstraints;
var ikConstraintsCount = ikConstraints.length;
var arrayCount = ikConstraintsCount + 1;
var boneCache = this.boneCache;
if (boneCache.length > arrayCount) boneCache.length = arrayCount;
for (var i = 0, n = boneCache.length; i < n; i++)
boneCache[i].l... | javascript | function () {
var ikConstraints = this.ikConstraints;
var ikConstraintsCount = ikConstraints.length;
var arrayCount = ikConstraintsCount + 1;
var boneCache = this.boneCache;
if (boneCache.length > arrayCount) boneCache.length = arrayCount;
for (var i = 0, n = boneCache.length; i < n; i++)
boneCache[i].l... | [
"function",
"(",
")",
"{",
"var",
"ikConstraints",
"=",
"this",
".",
"ikConstraints",
";",
"var",
"ikConstraintsCount",
"=",
"ikConstraints",
".",
"length",
";",
"var",
"arrayCount",
"=",
"ikConstraintsCount",
"+",
"1",
";",
"var",
"boneCache",
"=",
"this",
... | Caches information about bones and IK constraints. Must be called if bones or IK constraints are added or removed. | [
"Caches",
"information",
"about",
"bones",
"and",
"IK",
"constraints",
".",
"Must",
"be",
"called",
"if",
"bones",
"or",
"IK",
"constraints",
"are",
"added",
"or",
"removed",
"."
] | 2e740ee68898d8ec8a34f8a3b6ee8e8faffce253 | https://github.com/jansedivy/potion/blob/2e740ee68898d8ec8a34f8a3b6ee8e8faffce253/examples/demo-pixi-bunny/pixi.dev.js#L15018-L15056 | |
56,883 | darrencruse/sugarlisp-async | gentab.js | asyncifyFunctions | function asyncifyFunctions(forms) {
// for each subexpression form...
forms.forEach(function(form) {
if (sl.isList(form)) {
if(sl.typeOf(form[0]) === 'symbol' &&
sl.valueOf(form[0]) === 'function' &&
asyncNeeded(form)) {
form.unshift(sl.atom("async"));
asyncifyFunctions... | javascript | function asyncifyFunctions(forms) {
// for each subexpression form...
forms.forEach(function(form) {
if (sl.isList(form)) {
if(sl.typeOf(form[0]) === 'symbol' &&
sl.valueOf(form[0]) === 'function' &&
asyncNeeded(form)) {
form.unshift(sl.atom("async"));
asyncifyFunctions... | [
"function",
"asyncifyFunctions",
"(",
"forms",
")",
"{",
"// for each subexpression form...",
"forms",
".",
"forEach",
"(",
"function",
"(",
"form",
")",
"{",
"if",
"(",
"sl",
".",
"isList",
"(",
"form",
")",
")",
"{",
"if",
"(",
"sl",
".",
"typeOf",
"("... | Had to timebox this - double check it later - I've yet to handle functions nested down under other functions - in that case isn't co.wrap needed to be added both at the lowest level and at the higher levels? Right now I stop at the higher levels. | [
"Had",
"to",
"timebox",
"this",
"-",
"double",
"check",
"it",
"later",
"-",
"I",
"ve",
"yet",
"to",
"handle",
"functions",
"nested",
"down",
"under",
"other",
"functions",
"-",
"in",
"that",
"case",
"isn",
"t",
"co",
".",
"wrap",
"needed",
"to",
"be",
... | f7c909da54396165ddc42b73749f98a19e01c595 | https://github.com/darrencruse/sugarlisp-async/blob/f7c909da54396165ddc42b73749f98a19e01c595/gentab.js#L73-L88 |
56,884 | psiolent/trigger-maker | index.js | on | function on(event, fn) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
if (!(fn instanceof Function)) {
throw new Error('"fn" not a Function');
}
if (hasListener(event, fn)) {
return false;
}
if (!hasListeners(event)) {
listeners[event] = [];
}
listeners[eve... | javascript | function on(event, fn) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
if (!(fn instanceof Function)) {
throw new Error('"fn" not a Function');
}
if (hasListener(event, fn)) {
return false;
}
if (!hasListeners(event)) {
listeners[event] = [];
}
listeners[eve... | [
"function",
"on",
"(",
"event",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"event",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\"event\" not a string'",
")",
";",
"}",
"if",
"(",
"!",
"(",
"fn",
"instanceof",
"Function",
")",
")",
"{... | Registers a listener for a type of event.
@param {string} event the event type
@param {Function} fn the function to invoke to handle the event
@return {boolean} true if listener set was modified, false if not | [
"Registers",
"a",
"listener",
"for",
"a",
"type",
"of",
"event",
"."
] | 10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7 | https://github.com/psiolent/trigger-maker/blob/10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7/index.js#L26-L44 |
56,885 | psiolent/trigger-maker | index.js | off | function off(event, fn) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
if (fn !== undefined && !(fn instanceof Function)) {
throw new Error('"fn" not a Function');
}
if (fn) {
// do we event have this listener
if (!hasListener(event, fn)) {
return false;
}
... | javascript | function off(event, fn) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
if (fn !== undefined && !(fn instanceof Function)) {
throw new Error('"fn" not a Function');
}
if (fn) {
// do we event have this listener
if (!hasListener(event, fn)) {
return false;
}
... | [
"function",
"off",
"(",
"event",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"event",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\"event\" not a string'",
")",
";",
"}",
"if",
"(",
"fn",
"!==",
"undefined",
"&&",
"!",
"(",
"fn",
"inst... | Unregisters one or all listeners for an event.
@param event the event to unregister for
@param [fn] if provided, the listener function to unregister; if not
provided, all listeners will be unregistered
@return {boolean} true if listener set was modified, false if not | [
"Unregisters",
"one",
"or",
"all",
"listeners",
"for",
"an",
"event",
"."
] | 10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7 | https://github.com/psiolent/trigger-maker/blob/10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7/index.js#L53-L85 |
56,886 | psiolent/trigger-maker | index.js | fire | function fire(event) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
// any listeners registered?
if (!hasListeners(event)) {
return triggerObject;
}
// get optional arguments
var args = Array.prototype.slice.call(arguments, 1);
// invoke listener functions
liste... | javascript | function fire(event) {
if (typeof event !== 'string') {
throw new Error('"event" not a string');
}
// any listeners registered?
if (!hasListeners(event)) {
return triggerObject;
}
// get optional arguments
var args = Array.prototype.slice.call(arguments, 1);
// invoke listener functions
liste... | [
"function",
"fire",
"(",
"event",
")",
"{",
"if",
"(",
"typeof",
"event",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\"event\" not a string'",
")",
";",
"}",
"// any listeners registered?",
"if",
"(",
"!",
"hasListeners",
"(",
"event",
")",... | Fires an event.
@param {string} event the event to fire
@param {...*} arguments to pass to the event listeners
@returns {Object} this trigger object | [
"Fires",
"an",
"event",
"."
] | 10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7 | https://github.com/psiolent/trigger-maker/blob/10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7/index.js#L93-L112 |
56,887 | psiolent/trigger-maker | index.js | fireAsync | function fireAsync(event) {
var args = Array.prototype.slice.call(arguments);
setTimeout(function() {
fire.apply(triggerObject, args);
}, 0);
return triggerObject;
} | javascript | function fireAsync(event) {
var args = Array.prototype.slice.call(arguments);
setTimeout(function() {
fire.apply(triggerObject, args);
}, 0);
return triggerObject;
} | [
"function",
"fireAsync",
"(",
"event",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"fire",
".",
"apply",
"(",
"triggerObject",
",",
"args"... | Fires an event asynchronously. Event listeners are invoked
on the next tick rather than immediately.
@param {string} event the event to fire
@param {...*} arguments to pass to the event listeners
@returns {Object} this trigger object | [
"Fires",
"an",
"event",
"asynchronously",
".",
"Event",
"listeners",
"are",
"invoked",
"on",
"the",
"next",
"tick",
"rather",
"than",
"immediately",
"."
] | 10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7 | https://github.com/psiolent/trigger-maker/blob/10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7/index.js#L121-L127 |
56,888 | psiolent/trigger-maker | index.js | hasListener | function hasListener(event, fn) {
return listeners[event] ?
listeners[event].some(function(l) {
return l === fn;
}) :
false;
} | javascript | function hasListener(event, fn) {
return listeners[event] ?
listeners[event].some(function(l) {
return l === fn;
}) :
false;
} | [
"function",
"hasListener",
"(",
"event",
",",
"fn",
")",
"{",
"return",
"listeners",
"[",
"event",
"]",
"?",
"listeners",
"[",
"event",
"]",
".",
"some",
"(",
"function",
"(",
"l",
")",
"{",
"return",
"l",
"===",
"fn",
";",
"}",
")",
":",
"false",
... | Returns whether the specified event has the specified listener.
@param event the event to check for the listener
@param fn the listener to check for
@returns {boolean} whether the specified event has the specified listener | [
"Returns",
"whether",
"the",
"specified",
"event",
"has",
"the",
"specified",
"listener",
"."
] | 10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7 | https://github.com/psiolent/trigger-maker/blob/10d6a3e0f204f6d5bc8c4565ee29236158a4c4b7/index.js#L153-L159 |
56,889 | nickschot/lux-jwt | lib/index.js | validCorsPreflight | function validCorsPreflight(request) {
if (request.method === 'OPTIONS' && request.headers.has('access-control-request-headers')) {
return request.headers.get('access-control-request-headers').split(',').map(function (header) {
return header.trim();
}).includes('authorization');
} else {
return fa... | javascript | function validCorsPreflight(request) {
if (request.method === 'OPTIONS' && request.headers.has('access-control-request-headers')) {
return request.headers.get('access-control-request-headers').split(',').map(function (header) {
return header.trim();
}).includes('authorization');
} else {
return fa... | [
"function",
"validCorsPreflight",
"(",
"request",
")",
"{",
"if",
"(",
"request",
".",
"method",
"===",
"'OPTIONS'",
"&&",
"request",
".",
"headers",
".",
"has",
"(",
"'access-control-request-headers'",
")",
")",
"{",
"return",
"request",
".",
"headers",
".",
... | Checks if an OPTIONS request with the access-control-request-headers containing authorization is being made
@param request
@returns {boolean} | [
"Checks",
"if",
"an",
"OPTIONS",
"request",
"with",
"the",
"access",
"-",
"control",
"-",
"request",
"-",
"headers",
"containing",
"authorization",
"is",
"being",
"made"
] | eeb03fefcc954ea675ad44870b4f123a41f0d585 | https://github.com/nickschot/lux-jwt/blob/eeb03fefcc954ea675ad44870b4f123a41f0d585/lib/index.js#L88-L96 |
56,890 | nickschot/lux-jwt | lib/index.js | getTokenFromHeader | function getTokenFromHeader(request) {
if (!request.headers || !request.headers.has('authorization')) {
throw new UnauthorizedError('No authorization header present');
}
const parts = request.headers.get('authorization').split(" ");
if (parts.length === 2) {
const scheme = parts[0];
const credenti... | javascript | function getTokenFromHeader(request) {
if (!request.headers || !request.headers.has('authorization')) {
throw new UnauthorizedError('No authorization header present');
}
const parts = request.headers.get('authorization').split(" ");
if (parts.length === 2) {
const scheme = parts[0];
const credenti... | [
"function",
"getTokenFromHeader",
"(",
"request",
")",
"{",
"if",
"(",
"!",
"request",
".",
"headers",
"||",
"!",
"request",
".",
"headers",
".",
"has",
"(",
"'authorization'",
")",
")",
"{",
"throw",
"new",
"UnauthorizedError",
"(",
"'No authorization header ... | Retrieves the JWT from the authorization header
@param request
@returns {string} The JWT | [
"Retrieves",
"the",
"JWT",
"from",
"the",
"authorization",
"header"
] | eeb03fefcc954ea675ad44870b4f123a41f0d585 | https://github.com/nickschot/lux-jwt/blob/eeb03fefcc954ea675ad44870b4f123a41f0d585/lib/index.js#L103-L122 |
56,891 | pierrec/node-atok-parser | examples/block_stream.js | myParser | function myParser (size) {
if (typeof size !== 'number')
throw new Error('Invalid block size: ' + size)
function isEnd () {
return atok.ending ? atok.length - atok.offset : -1
}
atok
.trim()
.addRule(size, function (data) {
self.emit('data', data)
})
.addRule('', isEnd, function (data) {
var len... | javascript | function myParser (size) {
if (typeof size !== 'number')
throw new Error('Invalid block size: ' + size)
function isEnd () {
return atok.ending ? atok.length - atok.offset : -1
}
atok
.trim()
.addRule(size, function (data) {
self.emit('data', data)
})
.addRule('', isEnd, function (data) {
var len... | [
"function",
"myParser",
"(",
"size",
")",
"{",
"if",
"(",
"typeof",
"size",
"!==",
"'number'",
")",
"throw",
"new",
"Error",
"(",
"'Invalid block size: '",
"+",
"size",
")",
"function",
"isEnd",
"(",
")",
"{",
"return",
"atok",
".",
"ending",
"?",
"atok"... | Stream data in blocks | [
"Stream",
"data",
"in",
"blocks"
] | 414d39904dff73ffdde049212076c14ca40aa20b | https://github.com/pierrec/node-atok-parser/blob/414d39904dff73ffdde049212076c14ca40aa20b/examples/block_stream.js#L4-L32 |
56,892 | AdityaHegde/ember-object-utils | addon/objectWithArrayMixin.js | getArrayFromRange | function getArrayFromRange(l, h, s) {
var a = [];
s = s || 1;
for(var i = l; i < h; i += s) {
a.push(i);
}
return a;
} | javascript | function getArrayFromRange(l, h, s) {
var a = [];
s = s || 1;
for(var i = l; i < h; i += s) {
a.push(i);
}
return a;
} | [
"function",
"getArrayFromRange",
"(",
"l",
",",
"h",
",",
"s",
")",
"{",
"var",
"a",
"=",
"[",
"]",
";",
"s",
"=",
"s",
"||",
"1",
";",
"for",
"(",
"var",
"i",
"=",
"l",
";",
"i",
"<",
"h",
";",
"i",
"+=",
"s",
")",
"{",
"a",
".",
"push... | Returns an array of integers from a starting number to another number with steps.
@method getArrayFromRange
@static
@param {Number} l Starting number.
@param {Number} h Ending number.
@param {Number} s Steps.
@returns {Array} | [
"Returns",
"an",
"array",
"of",
"integers",
"from",
"a",
"starting",
"number",
"to",
"another",
"number",
"with",
"steps",
"."
] | bc57203c4b523fd3a632735b25a5bb1bbf55dbcb | https://github.com/AdityaHegde/ember-object-utils/blob/bc57203c4b523fd3a632735b25a5bb1bbf55dbcb/addon/objectWithArrayMixin.js#L13-L20 |
56,893 | tabone/ipc-emitter | src/master.js | handleMasterPayload | function handleMasterPayload (payload) {
// Parse and validate received payload.
if ((payload = utils.parsePayload(payload)) === null) return
// Notify all workers except the worker who emitted the event.
sendPayload.call(this, payload)
} | javascript | function handleMasterPayload (payload) {
// Parse and validate received payload.
if ((payload = utils.parsePayload(payload)) === null) return
// Notify all workers except the worker who emitted the event.
sendPayload.call(this, payload)
} | [
"function",
"handleMasterPayload",
"(",
"payload",
")",
"{",
"// Parse and validate received payload.",
"if",
"(",
"(",
"payload",
"=",
"utils",
".",
"parsePayload",
"(",
"payload",
")",
")",
"===",
"null",
")",
"return",
"// Notify all workers except the worker who emi... | handleMasterPayload handles the payload recieved by the master process. If
payload is valid it is echoed back to all workers. Note that unlike the
handleWorkerPayload the listeners of the instance won't be notified.
@param {String} payload Payload received from a worker. | [
"handleMasterPayload",
"handles",
"the",
"payload",
"recieved",
"by",
"the",
"master",
"process",
".",
"If",
"payload",
"is",
"valid",
"it",
"is",
"echoed",
"back",
"to",
"all",
"workers",
".",
"Note",
"that",
"unlike",
"the",
"handleWorkerPayload",
"the",
"li... | 4717a9e228ab8b28f2fd6d0966779c452ad38405 | https://github.com/tabone/ipc-emitter/blob/4717a9e228ab8b28f2fd6d0966779c452ad38405/src/master.js#L208-L214 |
56,894 | tabone/ipc-emitter | src/master.js | handleWorkerPayload | function handleWorkerPayload (payload) {
// Parse and validate received payload.
if ((payload = utils.parsePayload(payload)) === null) return
// If the master is configured to echo events to its own master, the event
// emitted by the worker should be echoed to the master.
if (this.__echoEvents === true) {
... | javascript | function handleWorkerPayload (payload) {
// Parse and validate received payload.
if ((payload = utils.parsePayload(payload)) === null) return
// If the master is configured to echo events to its own master, the event
// emitted by the worker should be echoed to the master.
if (this.__echoEvents === true) {
... | [
"function",
"handleWorkerPayload",
"(",
"payload",
")",
"{",
"// Parse and validate received payload.",
"if",
"(",
"(",
"payload",
"=",
"utils",
".",
"parsePayload",
"(",
"payload",
")",
")",
"===",
"null",
")",
"return",
"// If the master is configured to echo events t... | handleWorkerPayload handles the payload received by a worker. If payload is
valid it is echoed back to all workers except the worker that it was received
from.
@param {String} payload Payload received from a worker. | [
"handleWorkerPayload",
"handles",
"the",
"payload",
"received",
"by",
"a",
"worker",
".",
"If",
"payload",
"is",
"valid",
"it",
"is",
"echoed",
"back",
"to",
"all",
"workers",
"except",
"the",
"worker",
"that",
"it",
"was",
"received",
"from",
"."
] | 4717a9e228ab8b28f2fd6d0966779c452ad38405 | https://github.com/tabone/ipc-emitter/blob/4717a9e228ab8b28f2fd6d0966779c452ad38405/src/master.js#L222-L246 |
56,895 | forfuturellc/svc-fbr | src/lib/db.js | getModels | function getModels(done) {
if (models) {
return done(models);
}
return orm.initialize(ormConfig, function(err, m) {
if (err) {
throw err;
}
// make the models available as soon as possible for other functions
models = m;
// ignore error if groups already created
let catcher = ... | javascript | function getModels(done) {
if (models) {
return done(models);
}
return orm.initialize(ormConfig, function(err, m) {
if (err) {
throw err;
}
// make the models available as soon as possible for other functions
models = m;
// ignore error if groups already created
let catcher = ... | [
"function",
"getModels",
"(",
"done",
")",
"{",
"if",
"(",
"models",
")",
"{",
"return",
"done",
"(",
"models",
")",
";",
"}",
"return",
"orm",
".",
"initialize",
"(",
"ormConfig",
",",
"function",
"(",
"err",
",",
"m",
")",
"{",
"if",
"(",
"err",
... | return models. It initializes Waterfall if not yet initialized in
this process.
@param {Function} done - done(models) | [
"return",
"models",
".",
"It",
"initializes",
"Waterfall",
"if",
"not",
"yet",
"initialized",
"in",
"this",
"process",
"."
] | 8c07c71d6423d1dbd4f903a032dea0bfec63894e | https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/db.js#L145-L169 |
56,896 | forfuturellc/svc-fbr | src/lib/db.js | createGroup | function createGroup(name, done) {
return getModels(function(m) {
return m.collections.group.create({ name }, done);
});
} | javascript | function createGroup(name, done) {
return getModels(function(m) {
return m.collections.group.create({ name }, done);
});
} | [
"function",
"createGroup",
"(",
"name",
",",
"done",
")",
"{",
"return",
"getModels",
"(",
"function",
"(",
"m",
")",
"{",
"return",
"m",
".",
"collections",
".",
"group",
".",
"create",
"(",
"{",
"name",
"}",
",",
"done",
")",
";",
"}",
")",
";",
... | Create a new group | [
"Create",
"a",
"new",
"group"
] | 8c07c71d6423d1dbd4f903a032dea0bfec63894e | https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/db.js#L175-L179 |
56,897 | forfuturellc/svc-fbr | src/lib/db.js | getGroup | function getGroup(name, done) {
return getModels(function(m) {
return m.collections.group.findOne({ name })
.populate("members").populate("leaders").exec(done);
});
} | javascript | function getGroup(name, done) {
return getModels(function(m) {
return m.collections.group.findOne({ name })
.populate("members").populate("leaders").exec(done);
});
} | [
"function",
"getGroup",
"(",
"name",
",",
"done",
")",
"{",
"return",
"getModels",
"(",
"function",
"(",
"m",
")",
"{",
"return",
"m",
".",
"collections",
".",
"group",
".",
"findOne",
"(",
"{",
"name",
"}",
")",
".",
"populate",
"(",
"\"members\"",
... | Get a group. It populates the members and leaders automatically.
@param {String} name
@param {Function} done - done(err, group) | [
"Get",
"a",
"group",
".",
"It",
"populates",
"the",
"members",
"and",
"leaders",
"automatically",
"."
] | 8c07c71d6423d1dbd4f903a032dea0bfec63894e | https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/db.js#L188-L193 |
56,898 | forfuturellc/svc-fbr | src/lib/db.js | getGroups | function getGroups(done) {
return getModels(function(m) {
return m.collections.group.find().exec(done);
});
} | javascript | function getGroups(done) {
return getModels(function(m) {
return m.collections.group.find().exec(done);
});
} | [
"function",
"getGroups",
"(",
"done",
")",
"{",
"return",
"getModels",
"(",
"function",
"(",
"m",
")",
"{",
"return",
"m",
".",
"collections",
".",
"group",
".",
"find",
"(",
")",
".",
"exec",
"(",
"done",
")",
";",
"}",
")",
";",
"}"
] | Get all groups. Members and leaders are not loaded automatically.
This is by design; avoid too much data fetching.
@param {Function} done - done(err, groups) | [
"Get",
"all",
"groups",
".",
"Members",
"and",
"leaders",
"are",
"not",
"loaded",
"automatically",
".",
"This",
"is",
"by",
"design",
";",
"avoid",
"too",
"much",
"data",
"fetching",
"."
] | 8c07c71d6423d1dbd4f903a032dea0bfec63894e | https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/db.js#L202-L206 |
56,899 | forfuturellc/svc-fbr | src/lib/db.js | deleteGroup | function deleteGroup(name, done) {
return getGroup(name, function(getGroupErr, group) {
if (getGroupErr) {
return done(getGroupErr);
}
if (!group) {
return done(new Error(`group '${name}' not found`));
}
return group.destroy(done);
});
} | javascript | function deleteGroup(name, done) {
return getGroup(name, function(getGroupErr, group) {
if (getGroupErr) {
return done(getGroupErr);
}
if (!group) {
return done(new Error(`group '${name}' not found`));
}
return group.destroy(done);
});
} | [
"function",
"deleteGroup",
"(",
"name",
",",
"done",
")",
"{",
"return",
"getGroup",
"(",
"name",
",",
"function",
"(",
"getGroupErr",
",",
"group",
")",
"{",
"if",
"(",
"getGroupErr",
")",
"{",
"return",
"done",
"(",
"getGroupErr",
")",
";",
"}",
"if"... | Delete a group
@param {String} name
@param {Function} done - done(err) | [
"Delete",
"a",
"group"
] | 8c07c71d6423d1dbd4f903a032dea0bfec63894e | https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/db.js#L215-L227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.