id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54,900 | gtriggiano/dnsmq-messagebus | src/PubConnection.js | publish | function publish (channel, ...args) {
_publishStream.emit('message', channel, uniqueId(`${node.name}_`), ...args)
} | javascript | function publish (channel, ...args) {
_publishStream.emit('message', channel, uniqueId(`${node.name}_`), ...args)
} | [
"function",
"publish",
"(",
"channel",
",",
"...",
"args",
")",
"{",
"_publishStream",
".",
"emit",
"(",
"'message'",
",",
"channel",
",",
"uniqueId",
"(",
"`",
"${",
"node",
".",
"name",
"}",
"`",
")",
",",
"...",
"args",
")",
"}"
] | takes a list of strings|buffers to publish as message's frames
in the channel passed as first argument;
decorates each message with a uid
@param {string} channel
@param {[string|buffer]} args | [
"takes",
"a",
"list",
"of",
"strings|buffers",
"to",
"publish",
"as",
"message",
"s",
"frames",
"in",
"the",
"channel",
"passed",
"as",
"first",
"argument",
";",
"decorates",
"each",
"message",
"with",
"a",
"uid"
] | ab935cae537f8a7e61a6ed6fba247661281c9374 | https://github.com/gtriggiano/dnsmq-messagebus/blob/ab935cae537f8a7e61a6ed6fba247661281c9374/src/PubConnection.js#L132-L134 |
54,901 | mrdaniellewis/node-tributary | index.js | Tributary | function Tributary( options ) {
options = options || {};
stream.Transform.call( this, { encoding: options.encoding } );
this.getStream = options.getStream || function( filename, cb ) {
return cb();
};
this._matcher = new Matcher(
options.placeholderStart || '<!-- include ',
... | javascript | function Tributary( options ) {
options = options || {};
stream.Transform.call( this, { encoding: options.encoding } );
this.getStream = options.getStream || function( filename, cb ) {
return cb();
};
this._matcher = new Matcher(
options.placeholderStart || '<!-- include ',
... | [
"function",
"Tributary",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"stream",
".",
"Transform",
".",
"call",
"(",
"this",
",",
"{",
"encoding",
":",
"options",
".",
"encoding",
"}",
")",
";",
"this",
".",
"getStream",
"... | Include one stream in another
@param {String} [options.placeholderStart="<!-- include "] The start placeholder
@param {String} [options.placeholderStart=" -->"] The end placeholder
@param {Integer} [options.maxPathLength=512] The maximum length of a path
@param {String} [options.delmiter="] The delimiter to use for fil... | [
"Include",
"one",
"stream",
"in",
"another"
] | 8fb0deee6adf1d1a1b075dd51a0511c88215e49f | https://github.com/mrdaniellewis/node-tributary/blob/8fb0deee6adf1d1a1b075dd51a0511c88215e49f/index.js#L115-L140 |
54,902 | AGCPartners/mysql-transit | index.js | MysqlTransit | function MysqlTransit(dbOriginal, dbTemp, connectionParameters) {
this.dbOriginal = dbOriginal;
this.dbTemp = dbTemp;
this.connectionParameters = connectionParameters;
this.queryQueue = [];
this.tablesToDrop = [];
this.tablesToCreate = [];
this.interactive = true;
return this._init();
} | javascript | function MysqlTransit(dbOriginal, dbTemp, connectionParameters) {
this.dbOriginal = dbOriginal;
this.dbTemp = dbTemp;
this.connectionParameters = connectionParameters;
this.queryQueue = [];
this.tablesToDrop = [];
this.tablesToCreate = [];
this.interactive = true;
return this._init();
} | [
"function",
"MysqlTransit",
"(",
"dbOriginal",
",",
"dbTemp",
",",
"connectionParameters",
")",
"{",
"this",
".",
"dbOriginal",
"=",
"dbOriginal",
";",
"this",
".",
"dbTemp",
"=",
"dbTemp",
";",
"this",
".",
"connectionParameters",
"=",
"connectionParameters",
"... | Initialize the MysqlTransit object
@param dbOriginal name of the database to migrate
@param dbTemp name of the database to be migrated
@param connectionParameters object with
{
port: mysqlParams.options.port,
host: mysqlParams.options.host,
user: mysqlParams.user,
password: mysqlParams.password
} | [
"Initialize",
"the",
"MysqlTransit",
"object"
] | d3cc3701166be3d41826c4b3bf1a596ed4c1f03a | https://github.com/AGCPartners/mysql-transit/blob/d3cc3701166be3d41826c4b3bf1a596ed4c1f03a/index.js#L22-L31 |
54,903 | MiguelCastillo/stream-joint | index.js | joint | function joint(streams) {
if (!(streams instanceof Array)) {
streams = Array.prototype.slice.call(arguments);
}
return streams.reduce(function(thru, stream) {
if (stream) {
thru.pipe(stream);
}
return thru;
}, through());
} | javascript | function joint(streams) {
if (!(streams instanceof Array)) {
streams = Array.prototype.slice.call(arguments);
}
return streams.reduce(function(thru, stream) {
if (stream) {
thru.pipe(stream);
}
return thru;
}, through());
} | [
"function",
"joint",
"(",
"streams",
")",
"{",
"if",
"(",
"!",
"(",
"streams",
"instanceof",
"Array",
")",
")",
"{",
"streams",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"}",
"return",
"streams",
".",
"red... | Take all incoming streams combine them into a single through
stream. Writing to the returned stream will write to all
streams passed in.
Handy for chaining writable streams.
@param {...Streams} List of streams to merge
@returns {Stream} Returns a single through stream | [
"Take",
"all",
"incoming",
"streams",
"combine",
"them",
"into",
"a",
"single",
"through",
"stream",
".",
"Writing",
"to",
"the",
"returned",
"stream",
"will",
"write",
"to",
"all",
"streams",
"passed",
"in",
"."
] | 86986b2611e46be6bd84e27016600fc2e5022834 | https://github.com/MiguelCastillo/stream-joint/blob/86986b2611e46be6bd84e27016600fc2e5022834/index.js#L14-L25 |
54,904 | pine/typescript-after-extends | lib/extends.js | createNamedClass | function createNamedClass (name, klass, baseKlass, superFunc) {
if (!superFunc) {
superFunc = function () {
baseKlass.call(this);
};
}
return new Function(
'klass', 'superFunc',
'return function ' + name + ' () {' +
'superFunc.apply(this... | javascript | function createNamedClass (name, klass, baseKlass, superFunc) {
if (!superFunc) {
superFunc = function () {
baseKlass.call(this);
};
}
return new Function(
'klass', 'superFunc',
'return function ' + name + ' () {' +
'superFunc.apply(this... | [
"function",
"createNamedClass",
"(",
"name",
",",
"klass",
",",
"baseKlass",
",",
"superFunc",
")",
"{",
"if",
"(",
"!",
"superFunc",
")",
"{",
"superFunc",
"=",
"function",
"(",
")",
"{",
"baseKlass",
".",
"call",
"(",
"this",
")",
";",
"}",
";",
"}... | Create named class with extends | [
"Create",
"named",
"class",
"with",
"extends"
] | bbe2523beef3bcd1c836ca74a07ac0eafd1858d3 | https://github.com/pine/typescript-after-extends/blob/bbe2523beef3bcd1c836ca74a07ac0eafd1858d3/lib/extends.js#L18-L32 |
54,905 | pine/typescript-after-extends | lib/extends.js | afterExtends | function afterExtends (klass, baseKlass, superFunc) {
var newKlass = createNamedClass(klass.name, klass, baseKlass, superFunc);
newKlass.prototype = createPrototype(klass, baseKlass, newKlass);
return newKlass;
} | javascript | function afterExtends (klass, baseKlass, superFunc) {
var newKlass = createNamedClass(klass.name, klass, baseKlass, superFunc);
newKlass.prototype = createPrototype(klass, baseKlass, newKlass);
return newKlass;
} | [
"function",
"afterExtends",
"(",
"klass",
",",
"baseKlass",
",",
"superFunc",
")",
"{",
"var",
"newKlass",
"=",
"createNamedClass",
"(",
"klass",
".",
"name",
",",
"klass",
",",
"baseKlass",
",",
"superFunc",
")",
";",
"newKlass",
".",
"prototype",
"=",
"c... | TypeScript extends later | [
"TypeScript",
"extends",
"later"
] | bbe2523beef3bcd1c836ca74a07ac0eafd1858d3 | https://github.com/pine/typescript-after-extends/blob/bbe2523beef3bcd1c836ca74a07ac0eafd1858d3/lib/extends.js#L49-L54 |
54,906 | allanmboyd/docit | lib/docit.js | processMethodOutTag | function processMethodOutTag(tag, typeMarkdown) {
var md = "";
if (tag.type) {
md += applyMarkdown(tag.type, settings.get(typeMarkdown)) + " ";
}
md += tag.comment;
return md;
} | javascript | function processMethodOutTag(tag, typeMarkdown) {
var md = "";
if (tag.type) {
md += applyMarkdown(tag.type, settings.get(typeMarkdown)) + " ";
}
md += tag.comment;
return md;
} | [
"function",
"processMethodOutTag",
"(",
"tag",
",",
"typeMarkdown",
")",
"{",
"var",
"md",
"=",
"\"\"",
";",
"if",
"(",
"tag",
".",
"type",
")",
"{",
"md",
"+=",
"applyMarkdown",
"(",
"tag",
".",
"type",
",",
"settings",
".",
"get",
"(",
"typeMarkdown"... | Process either a return or throws tag.
@param tag the tag
@param {String} typeMarkdown the markdown identifier to associate with the type of the tag if present
@return {String} the markdown for the tag
@private | [
"Process",
"either",
"a",
"return",
"or",
"throws",
"tag",
"."
] | e972b6e3a9792f649e9fed9115b45cb010c90c8f | https://github.com/allanmboyd/docit/blob/e972b6e3a9792f649e9fed9115b45cb010c90c8f/lib/docit.js#L303-L310 |
54,907 | skazska/marking-codes | v0.js | encode | function encode(batch, id, ver) {
//producerId min 2 digits
let producerId = b36.int2Str36(batch.producerId).padStart(2, '0');
//producerId min 3 digits
let batchId = b36.int2Str36(batch.id).padStart(3, '0');
//id min 2 digits
id = b36.int2Str36(id).padStart(3, '0');
let msg = composeCode(p... | javascript | function encode(batch, id, ver) {
//producerId min 2 digits
let producerId = b36.int2Str36(batch.producerId).padStart(2, '0');
//producerId min 3 digits
let batchId = b36.int2Str36(batch.id).padStart(3, '0');
//id min 2 digits
id = b36.int2Str36(id).padStart(3, '0');
let msg = composeCode(p... | [
"function",
"encode",
"(",
"batch",
",",
"id",
",",
"ver",
")",
"{",
"//producerId min 2 digits",
"let",
"producerId",
"=",
"b36",
".",
"int2Str36",
"(",
"batch",
".",
"producerId",
")",
".",
"padStart",
"(",
"2",
",",
"'0'",
")",
";",
"//producerId min 3 ... | creates alphanum representation of marking code
@param {{id: number, dsa: {q: number, p: number, g: number}, version: number, producerId: number, publicKey: number, privateKey: number}} batch
@param {*} id
@param {number} [ver] | [
"creates",
"alphanum",
"representation",
"of",
"marking",
"code"
] | 64c81c39db3dd8a8b17b0bf5e66e4da04d13a846 | https://github.com/skazska/marking-codes/blob/64c81c39db3dd8a8b17b0bf5e66e4da04d13a846/v0.js#L168-L183 |
54,908 | elidoran/node-ansi2 | lib/index.js | build | function build(writable, options) {
return writable && writable._ansi2 || (writable._ansi2 = new Ansi(writable, options))
} | javascript | function build(writable, options) {
return writable && writable._ansi2 || (writable._ansi2 = new Ansi(writable, options))
} | [
"function",
"build",
"(",
"writable",
",",
"options",
")",
"{",
"return",
"writable",
"&&",
"writable",
".",
"_ansi2",
"||",
"(",
"writable",
".",
"_ansi2",
"=",
"new",
"Ansi",
"(",
"writable",
",",
"options",
")",
")",
"}"
] | return one we already made or make a new one | [
"return",
"one",
"we",
"already",
"made",
"or",
"make",
"a",
"new",
"one"
] | 7171989aeaaa917fba925bd676bb89df19b28525 | https://github.com/elidoran/node-ansi2/blob/7171989aeaaa917fba925bd676bb89df19b28525/lib/index.js#L11-L13 |
54,909 | Augmentedjs/augmented | scripts/legacy/legacy.js | loadAndParseFile | function loadAndParseFile(filename, settings) {
Augmented.ajax({
url: filename,
async: true,
cache: settings.cache,
contentType: 'text/plain;charset=' + settings.encoding,
dataType: 'text',
success: function (data, status) {
logger... | javascript | function loadAndParseFile(filename, settings) {
Augmented.ajax({
url: filename,
async: true,
cache: settings.cache,
contentType: 'text/plain;charset=' + settings.encoding,
dataType: 'text',
success: function (data, status) {
logger... | [
"function",
"loadAndParseFile",
"(",
"filename",
",",
"settings",
")",
"{",
"Augmented",
".",
"ajax",
"(",
"{",
"url",
":",
"filename",
",",
"async",
":",
"true",
",",
"cache",
":",
"settings",
".",
"cache",
",",
"contentType",
":",
"'text/plain;charset='",
... | Load and parse .properties files
@method loadAndParseFile
@memberof i18nBase
@param filename
@param settings | [
"Load",
"and",
"parse",
".",
"properties",
"files"
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/legacy/legacy.js#L299-L314 |
54,910 | Augmentedjs/augmented | scripts/legacy/legacy.js | function(array) {
var sarr = [];
var i = 0;
for (i=0; i<array.length;i++) {
var a = array[i];
var o = {};
o.name = a.name;
o.value = a.value;
o.type = a.type;
... | javascript | function(array) {
var sarr = [];
var i = 0;
for (i=0; i<array.length;i++) {
var a = array[i];
var o = {};
o.name = a.name;
o.value = a.value;
o.type = a.type;
... | [
"function",
"(",
"array",
")",
"{",
"var",
"sarr",
"=",
"[",
"]",
";",
"var",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"a",
"=",
"array",
"[",
"i",
"]",
";",
... | Get form data. | [
"Get",
"form",
"data",
"."
] | 430567d411ab9e77953232bb600c08080ed33146 | https://github.com/Augmentedjs/augmented/blob/430567d411ab9e77953232bb600c08080ed33146/scripts/legacy/legacy.js#L742-L758 | |
54,911 | exis-io/ngRiffle | release/ngRiffle.js | success | function success(domain){
if(auth0){
//if auth0 then we don't have user storage
connection.user = new DomainWrapper(domain);
connection.user.join();
sessionPromise.then(resolve);
}else{
//if auth1 ... | javascript | function success(domain){
if(auth0){
//if auth0 then we don't have user storage
connection.user = new DomainWrapper(domain);
connection.user.join();
sessionPromise.then(resolve);
}else{
//if auth1 ... | [
"function",
"success",
"(",
"domain",
")",
"{",
"if",
"(",
"auth0",
")",
"{",
"//if auth0 then we don't have user storage",
"connection",
".",
"user",
"=",
"new",
"DomainWrapper",
"(",
"domain",
")",
";",
"connection",
".",
"user",
".",
"join",
"(",
")",
";"... | if we get success from the registrar on login continue depending on auth level | [
"if",
"we",
"get",
"success",
"from",
"the",
"registrar",
"on",
"login",
"continue",
"depending",
"on",
"auth",
"level"
] | e468353262bbe829e74975def19656fe4a37821f | https://github.com/exis-io/ngRiffle/blob/e468353262bbe829e74975def19656fe4a37821f/release/ngRiffle.js#L938-L950 |
54,912 | Dashron/Roads-Models | libs/model.js | applyModelMethods | function applyModelMethods (model, definition) {
for (var i in definition.methods) {
if (i === 'definition') {
throw new Error('Invalid model definition provided. "definition" is a reserved word');
}
model.prototype[i] = definition.methods[i];
}
} | javascript | function applyModelMethods (model, definition) {
for (var i in definition.methods) {
if (i === 'definition') {
throw new Error('Invalid model definition provided. "definition" is a reserved word');
}
model.prototype[i] = definition.methods[i];
}
} | [
"function",
"applyModelMethods",
"(",
"model",
",",
"definition",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"definition",
".",
"methods",
")",
"{",
"if",
"(",
"i",
"===",
"'definition'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid model definition provid... | Used in setModel
@param {[type]} model [description]
@param {[type]} definition [description]
@return {[type]} [description] | [
"Used",
"in",
"setModel"
] | e7820410ae75a8f579bad59e3047f8b3e3bc01f1 | https://github.com/Dashron/Roads-Models/blob/e7820410ae75a8f579bad59e3047f8b3e3bc01f1/libs/model.js#L470-L478 |
54,913 | zenflow/obs-router | lib/index.js | function(patterns, options) {
var self = this;
if (!(typeof patterns=='object')){throw new Error('ObsRouter constructor expects patterns object as first argument')}
options = options || {};
EventEmitter.call(self);
if (process.browser){
//bind to window by default
self._bindToWindow = 'bindToWindow' in ... | javascript | function(patterns, options) {
var self = this;
if (!(typeof patterns=='object')){throw new Error('ObsRouter constructor expects patterns object as first argument')}
options = options || {};
EventEmitter.call(self);
if (process.browser){
//bind to window by default
self._bindToWindow = 'bindToWindow' in ... | [
"function",
"(",
"patterns",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"(",
"typeof",
"patterns",
"==",
"'object'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'ObsRouter constructor expects patterns object as first argument'",... | Mutable observable abstraction of url as route with parameters
@example
var router = new ObsRouter({
home: '/',
blog: '/blog(/tag/:tag)(/:slug)',
contact: '/contact'
}, {
initialEmit: true,
bindToWindow: false,
url: '/?foo=bar'
});
console.log(router.url, router.name, router.params, router.routes);
-> '/?foo=bar' 'home... | [
"Mutable",
"observable",
"abstraction",
"of",
"url",
"as",
"route",
"with",
"parameters"
] | dd9934bfaa5099f477e7f06d8a3f2deed92ee142 | https://github.com/zenflow/obs-router/blob/dd9934bfaa5099f477e7f06d8a3f2deed92ee142/lib/index.js#L50-L82 | |
54,914 | deepjs/deep-restful | lib/http.js | function(object, options) {
var self = this;
return deep.when(getSchema(this))
.done(function(schema) {
return deep.Arguments([object, options]);
});
} | javascript | function(object, options) {
var self = this;
return deep.when(getSchema(this))
.done(function(schema) {
return deep.Arguments([object, options]);
});
} | [
"function",
"(",
"object",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"return",
"deep",
".",
"when",
"(",
"getSchema",
"(",
"this",
")",
")",
".",
"done",
"(",
"function",
"(",
"schema",
")",
"{",
"return",
"deep",
".",
"Arguments",
... | retrieve Schema if
@param {[type]} object [description]
@param {[type]} options [description]
@return {[type]} [description] | [
"retrieve",
"Schema",
"if"
] | 44c5e1e5526a821522ab5e3004f66ffc7840f551 | https://github.com/deepjs/deep-restful/blob/44c5e1e5526a821522ab5e3004f66ffc7840f551/lib/http.js#L121-L127 | |
54,915 | tracker1/mssql-ng | src/connections/open.js | handleConnectionCallback | function handleConnectionCallback(err, resolve, reject, key, connection) {
debug('handleConnectionCallback','start');
//error, remove cached entry, reject the promise
if (err) {
debug('handleConnectionCallback','error',err);
delete promises[key];
return reject(err);
}
//patch close method for ca... | javascript | function handleConnectionCallback(err, resolve, reject, key, connection) {
debug('handleConnectionCallback','start');
//error, remove cached entry, reject the promise
if (err) {
debug('handleConnectionCallback','error',err);
delete promises[key];
return reject(err);
}
//patch close method for ca... | [
"function",
"handleConnectionCallback",
"(",
"err",
",",
"resolve",
",",
"reject",
",",
"key",
",",
"connection",
")",
"{",
"debug",
"(",
"'handleConnectionCallback'",
",",
"'start'",
")",
";",
"//error, remove cached entry, reject the promise",
"if",
"(",
"err",
")... | handle promise resolution for connection callback | [
"handle",
"promise",
"resolution",
"for",
"connection",
"callback"
] | 7f32135d33f9b8324fdd94656136cae4087464ce | https://github.com/tracker1/mssql-ng/blob/7f32135d33f9b8324fdd94656136cae4087464ce/src/connections/open.js#L80-L102 |
54,916 | MiguelCastillo/spromise | src/samdy.js | load | function load(mod) {
if (typeof(mod.factory) === "function") {
return require(mod.deps, mod.factory);
}
return mod.factory;
} | javascript | function load(mod) {
if (typeof(mod.factory) === "function") {
return require(mod.deps, mod.factory);
}
return mod.factory;
} | [
"function",
"load",
"(",
"mod",
")",
"{",
"if",
"(",
"typeof",
"(",
"mod",
".",
"factory",
")",
"===",
"\"function\"",
")",
"{",
"return",
"require",
"(",
"mod",
".",
"deps",
",",
"mod",
".",
"factory",
")",
";",
"}",
"return",
"mod",
".",
"factory... | Load the module by calling its factory with the appropriate dependencies, if at all possible | [
"Load",
"the",
"module",
"by",
"calling",
"its",
"factory",
"with",
"the",
"appropriate",
"dependencies",
"if",
"at",
"all",
"possible"
] | faef0a81e88a871095393980fccdd7980e7c3f89 | https://github.com/MiguelCastillo/spromise/blob/faef0a81e88a871095393980fccdd7980e7c3f89/src/samdy.js#L14-L19 |
54,917 | vfile/vfile-find-up | index.js | handle | function handle(filePath) {
var file = toVFile(filePath)
var result = test(file)
if (mask(result, INCLUDE)) {
if (one) {
callback(null, file)
return true
}
results.push(file)
}
if (mask(result, BREAK)) {
callback(null, one ? null : results)
return tru... | javascript | function handle(filePath) {
var file = toVFile(filePath)
var result = test(file)
if (mask(result, INCLUDE)) {
if (one) {
callback(null, file)
return true
}
results.push(file)
}
if (mask(result, BREAK)) {
callback(null, one ? null : results)
return tru... | [
"function",
"handle",
"(",
"filePath",
")",
"{",
"var",
"file",
"=",
"toVFile",
"(",
"filePath",
")",
"var",
"result",
"=",
"test",
"(",
"file",
")",
"if",
"(",
"mask",
"(",
"result",
",",
"INCLUDE",
")",
")",
"{",
"if",
"(",
"one",
")",
"{",
"ca... | Test a file and check what should be done with the resulting file. | [
"Test",
"a",
"file",
"and",
"check",
"what",
"should",
"be",
"done",
"with",
"the",
"resulting",
"file",
"."
] | 93dc51a499a7888b11f8d5e01e4fd0ae3615c391 | https://github.com/vfile/vfile-find-up/blob/93dc51a499a7888b11f8d5e01e4fd0ae3615c391/index.js#L47-L64 |
54,918 | vfile/vfile-find-up | index.js | once | function once(child) {
if (handle(current) === true) {
return
}
readdir(current, onread)
function onread(error, entries) {
var length = entries ? entries.length : 0
var index = -1
var entry
if (error) {
entries = []
}
while (++index < length) {
... | javascript | function once(child) {
if (handle(current) === true) {
return
}
readdir(current, onread)
function onread(error, entries) {
var length = entries ? entries.length : 0
var index = -1
var entry
if (error) {
entries = []
}
while (++index < length) {
... | [
"function",
"once",
"(",
"child",
")",
"{",
"if",
"(",
"handle",
"(",
"current",
")",
"===",
"true",
")",
"{",
"return",
"}",
"readdir",
"(",
"current",
",",
"onread",
")",
"function",
"onread",
"(",
"error",
",",
"entries",
")",
"{",
"var",
"length"... | Check one directory. | [
"Check",
"one",
"directory",
"."
] | 93dc51a499a7888b11f8d5e01e4fd0ae3615c391 | https://github.com/vfile/vfile-find-up/blob/93dc51a499a7888b11f8d5e01e4fd0ae3615c391/index.js#L67-L101 |
54,919 | webwallet/sdk-node | sdk.js | generateTransactionRequest | function generateTransactionRequest(signer, transaction, options) {
let iou = {
amt: transaction.amount,
cur: transaction.currency,
sub: signer.address,
aud: transaction.destination,
nce: String(Math.floor(Math.random() * 1000000000))
};
return createTransactionRequestStatement(signer, iou, o... | javascript | function generateTransactionRequest(signer, transaction, options) {
let iou = {
amt: transaction.amount,
cur: transaction.currency,
sub: signer.address,
aud: transaction.destination,
nce: String(Math.floor(Math.random() * 1000000000))
};
return createTransactionRequestStatement(signer, iou, o... | [
"function",
"generateTransactionRequest",
"(",
"signer",
",",
"transaction",
",",
"options",
")",
"{",
"let",
"iou",
"=",
"{",
"amt",
":",
"transaction",
".",
"amount",
",",
"cur",
":",
"transaction",
".",
"currency",
",",
"sub",
":",
"signer",
".",
"addre... | Generates a transaction request document in the form of an IOU
@param {Object} signer - Wallet whose private key is to be used for signing the IOU
@param {Object} transaction - Transaction parameters
@param {Object} options
@return {Object} - A cryptographically signed IOU | [
"Generates",
"a",
"transaction",
"request",
"document",
"in",
"the",
"form",
"of",
"an",
"IOU"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L68-L78 |
54,920 | webwallet/sdk-node | sdk.js | registerWalletAddress | function registerWalletAddress(url, body, options) {
options = options || {};
url = resolveURL(url, '/address');
return new P(function (resolve, reject) {
request({
url: url,
method: options.method || 'POST',
body: body,
json: true,
headers: options.headers
}, function (err,... | javascript | function registerWalletAddress(url, body, options) {
options = options || {};
url = resolveURL(url, '/address');
return new P(function (resolve, reject) {
request({
url: url,
method: options.method || 'POST',
body: body,
json: true,
headers: options.headers
}, function (err,... | [
"function",
"registerWalletAddress",
"(",
"url",
",",
"body",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"url",
"=",
"resolveURL",
"(",
"url",
",",
"'/address'",
")",
";",
"return",
"new",
"P",
"(",
"function",
"(",
"reso... | Sends a wallet address registration request to the supplied URL
@param {string} url - The URL of a webwallet server
@param {Object} body - A wallet address registration statement
@param {Object} options - Request parameters such as method and headers
@return {Promise} - Resolves to the response body | [
"Sends",
"a",
"wallet",
"address",
"registration",
"request",
"to",
"the",
"supplied",
"URL"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L86-L102 |
54,921 | webwallet/sdk-node | sdk.js | checkAddressBalance | function checkAddressBalance(url, address, options) {
options = options || {};
let path = '/address/.../balance'.replace('...', address);
url = resolveURL(url, path);
return new P(function (resolve, reject) {
request({
url: url,
method: 'GET',
headers: options.headers
}, function (err... | javascript | function checkAddressBalance(url, address, options) {
options = options || {};
let path = '/address/.../balance'.replace('...', address);
url = resolveURL(url, path);
return new P(function (resolve, reject) {
request({
url: url,
method: 'GET',
headers: options.headers
}, function (err... | [
"function",
"checkAddressBalance",
"(",
"url",
",",
"address",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"let",
"path",
"=",
"'/address/.../balance'",
".",
"replace",
"(",
"'...'",
",",
"address",
")",
";",
"url",
"=",
"re... | Checks the balance of a wallet address
@param {string} url - The URL of a webwallet server
@param {string} address - A wallet address
@param {Object} options - Request parameters such as headers
@return {Promise} - Resolves to the response body | [
"Checks",
"the",
"balance",
"of",
"a",
"wallet",
"address"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L158-L173 |
54,922 | webwallet/sdk-node | sdk.js | generateKeyPair | function generateKeyPair(scheme) {
let keypair;
let keys;
switch (scheme) {
case 'ed25519':
case 'secp256k1':
keypair = schemes[scheme].genKeyPair();
keys = {
scheme: scheme,
private: keypair.getPrivate('hex'),
public: keypair.getPublic('hex')
};
break;
... | javascript | function generateKeyPair(scheme) {
let keypair;
let keys;
switch (scheme) {
case 'ed25519':
case 'secp256k1':
keypair = schemes[scheme].genKeyPair();
keys = {
scheme: scheme,
private: keypair.getPrivate('hex'),
public: keypair.getPublic('hex')
};
break;
... | [
"function",
"generateKeyPair",
"(",
"scheme",
")",
"{",
"let",
"keypair",
";",
"let",
"keys",
";",
"switch",
"(",
"scheme",
")",
"{",
"case",
"'ed25519'",
":",
"case",
"'secp256k1'",
":",
"keypair",
"=",
"schemes",
"[",
"scheme",
"]",
".",
"genKeyPair",
... | Generates a pair of cryptographic keys
@param {string} scheme - A cryptographic scheme
@return {Object} keys - A cryptographic key pair | [
"Generates",
"a",
"pair",
"of",
"cryptographic",
"keys"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L187-L207 |
54,923 | webwallet/sdk-node | sdk.js | deriveWalletAddress | function deriveWalletAddress(publicKey, type) {
let keyBuffer = new Buffer(publicKey, 'hex');
let firstHash = crypto.createHash('sha256').update(keyBuffer).digest();
let secondHash = ripemd160(firstHash);
let extendedHash = (type === 'issuer' ? '57' : '87') + secondHash.toString('hex');
let base58Public = bs5... | javascript | function deriveWalletAddress(publicKey, type) {
let keyBuffer = new Buffer(publicKey, 'hex');
let firstHash = crypto.createHash('sha256').update(keyBuffer).digest();
let secondHash = ripemd160(firstHash);
let extendedHash = (type === 'issuer' ? '57' : '87') + secondHash.toString('hex');
let base58Public = bs5... | [
"function",
"deriveWalletAddress",
"(",
"publicKey",
",",
"type",
")",
"{",
"let",
"keyBuffer",
"=",
"new",
"Buffer",
"(",
"publicKey",
",",
"'hex'",
")",
";",
"let",
"firstHash",
"=",
"crypto",
".",
"createHash",
"(",
"'sha256'",
")",
".",
"update",
"(",
... | Derives a wallet address from a public key
@param {<type>} publicKey - A public key to derive the address from
@param {string} type - The type of wallet address to derive
@return {string} base58public - A base58check encoded wallet address | [
"Derives",
"a",
"wallet",
"address",
"from",
"a",
"public",
"key"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L214-L222 |
54,924 | webwallet/sdk-node | sdk.js | createAddressRegistrationStatement | function createAddressRegistrationStatement(address, keys, options) {
options = options || {};
/* Create an extended JSON Web Signatures object */
let jws = {
hash: {
type: (hashes.indexOf(options.hash) > -1) ? options.hash : 'sha256',
value: ''
},
payload: {
address: address,
... | javascript | function createAddressRegistrationStatement(address, keys, options) {
options = options || {};
/* Create an extended JSON Web Signatures object */
let jws = {
hash: {
type: (hashes.indexOf(options.hash) > -1) ? options.hash : 'sha256',
value: ''
},
payload: {
address: address,
... | [
"function",
"createAddressRegistrationStatement",
"(",
"address",
",",
"keys",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"/* Create an extended JSON Web Signatures object */",
"let",
"jws",
"=",
"{",
"hash",
":",
"{",
"type",
":",
... | Creates and signs a statement to be sent for registering an address
@param {string} address - A wallet address
@param {Object} keys - An object containing a cryptograhic key pair
@param {Object} options - Parameters such as hash type
@return {Object} - A cryptographically signed statement | [
"Creates",
"and",
"signs",
"a",
"statement",
"to",
"be",
"sent",
"for",
"registering",
"an",
"address"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L230-L266 |
54,925 | webwallet/sdk-node | sdk.js | resolveURL | function resolveURL(url, path) {
if (typeof url !== 'string' || typeof path !== 'string') {
return new Error('url-and-path-required');
}
/* Remove leading and duplicate slashes */
url = url.replace(/\/{2,}/g, '/').replace(/^\//, '').replace(':/','://');
let parsedUrl = urlModule.parse(url);
if (protoc... | javascript | function resolveURL(url, path) {
if (typeof url !== 'string' || typeof path !== 'string') {
return new Error('url-and-path-required');
}
/* Remove leading and duplicate slashes */
url = url.replace(/\/{2,}/g, '/').replace(/^\//, '').replace(':/','://');
let parsedUrl = urlModule.parse(url);
if (protoc... | [
"function",
"resolveURL",
"(",
"url",
",",
"path",
")",
"{",
"if",
"(",
"typeof",
"url",
"!==",
"'string'",
"||",
"typeof",
"path",
"!==",
"'string'",
")",
"{",
"return",
"new",
"Error",
"(",
"'url-and-path-required'",
")",
";",
"}",
"/* Remove leading and d... | Resolves a URL given a path
@param {string} url - URL to resolve
@param {string} path - Path to append to base URL
@return {string} resolvedUrl - A valid URL | [
"Resolves",
"a",
"URL",
"given",
"a",
"path"
] | 594081202f39dd648c33e6ddaa5da0590826a62f | https://github.com/webwallet/sdk-node/blob/594081202f39dd648c33e6ddaa5da0590826a62f/sdk.js#L312-L327 |
54,926 | fhellwig/pkgconfig | pkgconfig.js | merge | function merge(target, source) {
if (source === null) {
return target
}
var props = Object.getOwnPropertyNames(target)
props.forEach(function (name) {
var s = gettype(source[name])
if (s !== 'undefined') {
var t = gettype(target[name])
if (t !== s) {
... | javascript | function merge(target, source) {
if (source === null) {
return target
}
var props = Object.getOwnPropertyNames(target)
props.forEach(function (name) {
var s = gettype(source[name])
if (s !== 'undefined') {
var t = gettype(target[name])
if (t !== s) {
... | [
"function",
"merge",
"(",
"target",
",",
"source",
")",
"{",
"if",
"(",
"source",
"===",
"null",
")",
"{",
"return",
"target",
"}",
"var",
"props",
"=",
"Object",
".",
"getOwnPropertyNames",
"(",
"target",
")",
"props",
".",
"forEach",
"(",
"function",
... | Merges the source with the target. The target is modified and returned. | [
"Merges",
"the",
"source",
"with",
"the",
"target",
".",
"The",
"target",
"is",
"modified",
"and",
"returned",
"."
] | f085bae69877d5a1607088ca71018ecf2839e02d | https://github.com/fhellwig/pkgconfig/blob/f085bae69877d5a1607088ca71018ecf2839e02d/pkgconfig.js#L96-L116 |
54,927 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | findIndexInArray | function findIndexInArray(array, callback) {
var _length = array.length;
for (var i = 0; i < _length; i++) {
if (callback(array[i])) return i;
}
return -1;
} | javascript | function findIndexInArray(array, callback) {
var _length = array.length;
for (var i = 0; i < _length; i++) {
if (callback(array[i])) return i;
}
return -1;
} | [
"function",
"findIndexInArray",
"(",
"array",
",",
"callback",
")",
"{",
"var",
"_length",
"=",
"array",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"_length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"callback",
"(",
"array",
... | Find position of an array element when callback function
return true.
@param array {array} Array to seek
@param callback {function} Callback function to test element
@returns {number} Index of eleement or -1 if not found | [
"Find",
"position",
"of",
"an",
"array",
"element",
"when",
"callback",
"function",
"return",
"true",
"."
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L95-L101 |
54,928 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | replaceInArray | function replaceInArray(array, indexToReplace, indexToInsert) {
var _removedArray = array.splice(indexToReplace, 1);
array.splice(indexToInsert, 0, _removedArray[0]);
return array;
} | javascript | function replaceInArray(array, indexToReplace, indexToInsert) {
var _removedArray = array.splice(indexToReplace, 1);
array.splice(indexToInsert, 0, _removedArray[0]);
return array;
} | [
"function",
"replaceInArray",
"(",
"array",
",",
"indexToReplace",
",",
"indexToInsert",
")",
"{",
"var",
"_removedArray",
"=",
"array",
".",
"splice",
"(",
"indexToReplace",
",",
"1",
")",
";",
"array",
".",
"splice",
"(",
"indexToInsert",
",",
"0",
",",
... | Remove item by its index and place it to another position
@param indexToReplace {number} current item position
@param indexToInsert {number} index where item should be placed | [
"Remove",
"item",
"by",
"its",
"index",
"and",
"place",
"it",
"to",
"another",
"position"
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L109-L113 |
54,929 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | getArrayOfPartials | function getArrayOfPartials() {
var _partialsArr = [];
for (var file in mainPartialList) {
if (mainPartialList.hasOwnProperty(file)) {
_partialsArr.push(file);
}
}
return _partialsArr;
} | javascript | function getArrayOfPartials() {
var _partialsArr = [];
for (var file in mainPartialList) {
if (mainPartialList.hasOwnProperty(file)) {
_partialsArr.push(file);
}
}
return _partialsArr;
} | [
"function",
"getArrayOfPartials",
"(",
")",
"{",
"var",
"_partialsArr",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"file",
"in",
"mainPartialList",
")",
"{",
"if",
"(",
"mainPartialList",
".",
"hasOwnProperty",
"(",
"file",
")",
")",
"{",
"_partialsArr",
".",
... | Get array of partial names from mainPartialList
@returns {Array} Array of partials | [
"Get",
"array",
"of",
"partial",
"names",
"from",
"mainPartialList"
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L138-L146 |
54,930 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | parseFile | function parseFile(importKeyword, requiresKeyword, filePath) {
var _lines = grunt.file.read(filePath).split(NEW_LINE),
_values = {
imports: {},
requires: {}
};
// Search for keywords in file
for (var i = _lines.length - 1; i >= 0; i--) {
... | javascript | function parseFile(importKeyword, requiresKeyword, filePath) {
var _lines = grunt.file.read(filePath).split(NEW_LINE),
_values = {
imports: {},
requires: {}
};
// Search for keywords in file
for (var i = _lines.length - 1; i >= 0; i--) {
... | [
"function",
"parseFile",
"(",
"importKeyword",
",",
"requiresKeyword",
",",
"filePath",
")",
"{",
"var",
"_lines",
"=",
"grunt",
".",
"file",
".",
"read",
"(",
"filePath",
")",
".",
"split",
"(",
"NEW_LINE",
")",
",",
"_values",
"=",
"{",
"imports",
":",... | Parses the given file for import keywords and DI keywords
@param importKeyword {string} sass import keyword
@param requiresKeyword {string} dependency injection keyword
@param filePath {string} file to be parsed
@returns {Object} list of all founded import values | [
"Parses",
"the",
"given",
"file",
"for",
"import",
"keywords",
"and",
"DI",
"keywords"
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L156-L194 |
54,931 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | orderByDependency | function orderByDependency(partialsArray) {
var _doPass = true,
_reqCache = {};
// repeat sorting operation until
// there is no replacing procedure during
// one pass (bubble sorting).
while (_doPass) {
_doPass = false;
// Iterate throu... | javascript | function orderByDependency(partialsArray) {
var _doPass = true,
_reqCache = {};
// repeat sorting operation until
// there is no replacing procedure during
// one pass (bubble sorting).
while (_doPass) {
_doPass = false;
// Iterate throu... | [
"function",
"orderByDependency",
"(",
"partialsArray",
")",
"{",
"var",
"_doPass",
"=",
"true",
",",
"_reqCache",
"=",
"{",
"}",
";",
"// repeat sorting operation until",
"// there is no replacing procedure during",
"// one pass (bubble sorting).",
"while",
"(",
"_doPass",
... | Reorders partials in a given list by their dependencies.
Dependencies are taken from mainPartialList which has to be
generated first.
@param partialsArray {array} array of sass/scss partials
@returns {array} reordered array of partials | [
"Reorders",
"partials",
"in",
"a",
"given",
"list",
"by",
"their",
"dependencies",
".",
"Dependencies",
"are",
"taken",
"from",
"mainPartialList",
"which",
"has",
"to",
"be",
"generated",
"first",
"."
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L204-L271 |
54,932 | NexwayGroup/grunt-sass-bootstrapper | tasks/sass_bootstrapper.js | generateBootstrapContent | function generateBootstrapContent(partialsArray, lineDelimiter) {
var _bootstrapContent = '',
_folderGroup = '';
partialsArray.forEach(function (partialName) {
var _sassPath = mainPartialList[partialName].removedRoot,
_currentRoot = _sassPath.parseRootFo... | javascript | function generateBootstrapContent(partialsArray, lineDelimiter) {
var _bootstrapContent = '',
_folderGroup = '';
partialsArray.forEach(function (partialName) {
var _sassPath = mainPartialList[partialName].removedRoot,
_currentRoot = _sassPath.parseRootFo... | [
"function",
"generateBootstrapContent",
"(",
"partialsArray",
",",
"lineDelimiter",
")",
"{",
"var",
"_bootstrapContent",
"=",
"''",
",",
"_folderGroup",
"=",
"''",
";",
"partialsArray",
".",
"forEach",
"(",
"function",
"(",
"partialName",
")",
"{",
"var",
"_sas... | Generate content for bootstrap file
@param partialsArray {array} list of partials to import by bootstrap file
@param lineDelimiter {string} symbol at the end of the line
@returns {string} formatted file content | [
"Generate",
"content",
"for",
"bootstrap",
"file"
] | 4f152dd7e796e0f289f7085fed28d9e61e8dec47 | https://github.com/NexwayGroup/grunt-sass-bootstrapper/blob/4f152dd7e796e0f289f7085fed28d9e61e8dec47/tasks/sass_bootstrapper.js#L280-L312 |
54,933 | mnichols/ankh | lib/startable-model.js | StartableModel | function StartableModel(model,instance) {
if(!model) {
throw new Error('model is required')
}
if(!instance) {
throw new Error('instance is required')
}
if(!(this instanceof StartableModel)) {
return new StartableModel(model,instance,index)
}
this.model = model
thi... | javascript | function StartableModel(model,instance) {
if(!model) {
throw new Error('model is required')
}
if(!instance) {
throw new Error('instance is required')
}
if(!(this instanceof StartableModel)) {
return new StartableModel(model,instance,index)
}
this.model = model
thi... | [
"function",
"StartableModel",
"(",
"model",
",",
"instance",
")",
"{",
"if",
"(",
"!",
"model",
")",
"{",
"throw",
"new",
"Error",
"(",
"'model is required'",
")",
"}",
"if",
"(",
"!",
"instance",
")",
"{",
"throw",
"new",
"Error",
"(",
"'instance is req... | Encapsulate a startable function description
@class StartableModel | [
"Encapsulate",
"a",
"startable",
"function",
"description"
] | b5f6eae24b2dece4025b4f11cea7f1560d3b345f | https://github.com/mnichols/ankh/blob/b5f6eae24b2dece4025b4f11cea7f1560d3b345f/lib/startable-model.js#L9-L32 |
54,934 | Zingle/fail | fail.js | fail | function fail(err, status=1) {
console.log(process.env.DEBUG ? err.stack : err.message);
process.exit(status);
} | javascript | function fail(err, status=1) {
console.log(process.env.DEBUG ? err.stack : err.message);
process.exit(status);
} | [
"function",
"fail",
"(",
"err",
",",
"status",
"=",
"1",
")",
"{",
"console",
".",
"log",
"(",
"process",
".",
"env",
".",
"DEBUG",
"?",
"err",
".",
"stack",
":",
"err",
".",
"message",
")",
";",
"process",
".",
"exit",
"(",
"status",
")",
";",
... | Print error and exit.
@param {Error} err
@param {number} [status] | [
"Print",
"error",
"and",
"exit",
"."
] | 41bc523da28d222dbcf6be996f5d42b1023a3822 | https://github.com/Zingle/fail/blob/41bc523da28d222dbcf6be996f5d42b1023a3822/fail.js#L6-L9 |
54,935 | relief-melone/limitpromises | src/limitpromises.js | autoSpliceLaunchArray | function autoSpliceLaunchArray(LaunchArray, TypeKey){
var indFirstElement = currentPromiseArrays[TypeKey].indexOf(LaunchArray[0]);
var indLastElement = currentPromiseArrays[TypeKey].indexOf(LaunchArray[LaunchArray.length-1]);
Promise.all(LaunchArray.map(e => {return e.result})).then(() => {
currentP... | javascript | function autoSpliceLaunchArray(LaunchArray, TypeKey){
var indFirstElement = currentPromiseArrays[TypeKey].indexOf(LaunchArray[0]);
var indLastElement = currentPromiseArrays[TypeKey].indexOf(LaunchArray[LaunchArray.length-1]);
Promise.all(LaunchArray.map(e => {return e.result})).then(() => {
currentP... | [
"function",
"autoSpliceLaunchArray",
"(",
"LaunchArray",
",",
"TypeKey",
")",
"{",
"var",
"indFirstElement",
"=",
"currentPromiseArrays",
"[",
"TypeKey",
"]",
".",
"indexOf",
"(",
"LaunchArray",
"[",
"0",
"]",
")",
";",
"var",
"indLastElement",
"=",
"currentProm... | As the stack in currentPromiseArrays might get very long and slow down the application we will splice all of the launchArrays already completely resolved out of the currentPromiseArrays
As currentPromiseArrays can get extremely large and we want to keep the app performant, autoSplice will automatically
remove a Launch... | [
"As",
"the",
"stack",
"in",
"currentPromiseArrays",
"might",
"get",
"very",
"long",
"and",
"slow",
"down",
"the",
"application",
"we",
"will",
"splice",
"all",
"of",
"the",
"launchArrays",
"already",
"completely",
"resolved",
"out",
"of",
"the",
"currentPromiseA... | 1735b92749740204b597c1c6026257d54ade8200 | https://github.com/relief-melone/limitpromises/blob/1735b92749740204b597c1c6026257d54ade8200/src/limitpromises.js#L168-L176 |
54,936 | phated/grunt-enyo | tasks/init/bootplate/root/enyo/source/ajax/Jsonp.js | function(inParams, inCallbackFunctionName) {
if (enyo.isString(inParams)) {
return inParams.replace("=?", "=" + inCallbackFunctionName);
} else {
var params = enyo.mixin({}, inParams);
params[this.callbackName] = inCallbackFunctionName;
return enyo.Ajax.objectToQuery(params);
}
} | javascript | function(inParams, inCallbackFunctionName) {
if (enyo.isString(inParams)) {
return inParams.replace("=?", "=" + inCallbackFunctionName);
} else {
var params = enyo.mixin({}, inParams);
params[this.callbackName] = inCallbackFunctionName;
return enyo.Ajax.objectToQuery(params);
}
} | [
"function",
"(",
"inParams",
",",
"inCallbackFunctionName",
")",
"{",
"if",
"(",
"enyo",
".",
"isString",
"(",
"inParams",
")",
")",
"{",
"return",
"inParams",
".",
"replace",
"(",
"\"=?\"",
",",
"\"=\"",
"+",
"inCallbackFunctionName",
")",
";",
"}",
"else... | for a string version of inParams, we follow the convention of replacing the string "=?" with the callback name. For the more common case of inParams being an object, we'll add a argument named using the callbackName published property. | [
"for",
"a",
"string",
"version",
"of",
"inParams",
"we",
"follow",
"the",
"convention",
"of",
"replacing",
"the",
"string",
"=",
"?",
"with",
"the",
"callback",
"name",
".",
"For",
"the",
"more",
"common",
"case",
"of",
"inParams",
"being",
"an",
"object",... | d2990ee4cd85eea8db4108c43086c6d8c3c90c30 | https://github.com/phated/grunt-enyo/blob/d2990ee4cd85eea8db4108c43086c6d8c3c90c30/tasks/init/bootplate/root/enyo/source/ajax/Jsonp.js#L111-L119 | |
54,937 | intervolga/bem-utils | lib/dirs-exist.js | stupidDirsExist | function stupidDirsExist(dirs) {
const check = [];
dirs.forEach((dir) => {
check.push(dirExist(dir));
});
return Promise.all(check).then((results) => {
// Combine to single object
return dirs.reduce(function(prev, item, i) {
prev[item] = !!results[i];
return prev;
}, {});
});
} | javascript | function stupidDirsExist(dirs) {
const check = [];
dirs.forEach((dir) => {
check.push(dirExist(dir));
});
return Promise.all(check).then((results) => {
// Combine to single object
return dirs.reduce(function(prev, item, i) {
prev[item] = !!results[i];
return prev;
}, {});
});
} | [
"function",
"stupidDirsExist",
"(",
"dirs",
")",
"{",
"const",
"check",
"=",
"[",
"]",
";",
"dirs",
".",
"forEach",
"(",
"(",
"dir",
")",
"=>",
"{",
"check",
".",
"push",
"(",
"dirExist",
"(",
"dir",
")",
")",
";",
"}",
")",
";",
"return",
"Promi... | Check if dirs exist, all at once
@param {Array} dirs
@return {Promise} {dir: exist} | [
"Check",
"if",
"dirs",
"exist",
"all",
"at",
"once"
] | 3b81bb9bc408275486175326dc7f35c563a46563 | https://github.com/intervolga/bem-utils/blob/3b81bb9bc408275486175326dc7f35c563a46563/lib/dirs-exist.js#L9-L23 |
54,938 | intervolga/bem-utils | lib/dirs-exist.js | dirsExist | function dirsExist(dirs) {
if (0 === dirs.length) {
return new Promise((resolve) => {
resolve({});
});
}
// Group dirs by '/' count
const dirsByDepth = dirs.reduce(function(prev, curItem) {
const depth = curItem.split(path.sep).length;
(prev[depth] = prev[depth] || []).push(curItem);
... | javascript | function dirsExist(dirs) {
if (0 === dirs.length) {
return new Promise((resolve) => {
resolve({});
});
}
// Group dirs by '/' count
const dirsByDepth = dirs.reduce(function(prev, curItem) {
const depth = curItem.split(path.sep).length;
(prev[depth] = prev[depth] || []).push(curItem);
... | [
"function",
"dirsExist",
"(",
"dirs",
")",
"{",
"if",
"(",
"0",
"===",
"dirs",
".",
"length",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"resolve",
"(",
"{",
"}",
")",
";",
"}",
")",
";",
"}",
"// Group dirs by '/' c... | Check if directories exist. Step by step. From root to leaves.
@param {Array} dirs
@return {Promise} {dir: exist} | [
"Check",
"if",
"directories",
"exist",
".",
"Step",
"by",
"step",
".",
"From",
"root",
"to",
"leaves",
"."
] | 3b81bb9bc408275486175326dc7f35c563a46563 | https://github.com/intervolga/bem-utils/blob/3b81bb9bc408275486175326dc7f35c563a46563/lib/dirs-exist.js#L31-L92 |
54,939 | usco/usco-stl-parser | dist/parseStream.js | parseASCIIChunk | function parseASCIIChunk(workChunk) {
var data = (0, _utils.ensureString)(workChunk);
// console.log('parseASCII')
var result = void 0,
text = void 0;
var patternNormal = /normal[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE]... | javascript | function parseASCIIChunk(workChunk) {
var data = (0, _utils.ensureString)(workChunk);
// console.log('parseASCII')
var result = void 0,
text = void 0;
var patternNormal = /normal[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE]... | [
"function",
"parseASCIIChunk",
"(",
"workChunk",
")",
"{",
"var",
"data",
"=",
"(",
"0",
",",
"_utils",
".",
"ensureString",
")",
"(",
"workChunk",
")",
";",
"// console.log('parseASCII')",
"var",
"result",
"=",
"void",
"0",
",",
"text",
"=",
"void",
"0",
... | ASCII stl parsing | [
"ASCII",
"stl",
"parsing"
] | 49eb402f124723d8f74cc67f24a7017c2b99bca4 | https://github.com/usco/usco-stl-parser/blob/49eb402f124723d8f74cc67f24a7017c2b99bca4/dist/parseStream.js#L114-L159 |
54,940 | ikondrat/franky | src/ds/Set.js | function (value) {
var res;
if (this.has(value)) {
res = this.items.splice(
x.indexOf(this.items, value),
1
);
}
return res;
} | javascript | function (value) {
var res;
if (this.has(value)) {
res = this.items.splice(
x.indexOf(this.items, value),
1
);
}
return res;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"res",
";",
"if",
"(",
"this",
".",
"has",
"(",
"value",
")",
")",
"{",
"res",
"=",
"this",
".",
"items",
".",
"splice",
"(",
"x",
".",
"indexOf",
"(",
"this",
".",
"items",
",",
"value",
")",
",",
"... | Removes value from Set
@param value
@returns <Item> | [
"Removes",
"value",
"from",
"Set"
] | 6a7368891f39620a225e37c4a56d2bf99644c3e7 | https://github.com/ikondrat/franky/blob/6a7368891f39620a225e37c4a56d2bf99644c3e7/src/ds/Set.js#L37-L46 | |
54,941 | ikondrat/franky | src/ds/Set.js | function (callback) {
for (var i = 0, l = this.items.length; i < l; i++) {
callback(this.items[i], i, this.items);
}
return this;
} | javascript | function (callback) {
for (var i = 0, l = this.items.length; i < l; i++) {
callback(this.items[i], i, this.items);
}
return this;
} | [
"function",
"(",
"callback",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"items",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"callback",
"(",
"this",
".",
"items",
"[",
"i",
"]",
",",
"i",
",",
... | Iterates through values and void callback
@param callback | [
"Iterates",
"through",
"values",
"and",
"void",
"callback"
] | 6a7368891f39620a225e37c4a56d2bf99644c3e7 | https://github.com/ikondrat/franky/blob/6a7368891f39620a225e37c4a56d2bf99644c3e7/src/ds/Set.js#L62-L67 | |
54,942 | ugate/releasebot | lib/committer.js | argv | function argv(k) {
if (!nargv) {
nargv = process.argv.slice(0, 2);
}
var v = '', m = null;
var x = new RegExp(k + regexKeyVal.source);
nargv.every(function(e) {
m = e.match(x);
if (m && m.length) {
v = m[0];
return false;
}
});
return v;
} | javascript | function argv(k) {
if (!nargv) {
nargv = process.argv.slice(0, 2);
}
var v = '', m = null;
var x = new RegExp(k + regexKeyVal.source);
nargv.every(function(e) {
m = e.match(x);
if (m && m.length) {
v = m[0];
return false;
}
});
return v;
} | [
"function",
"argv",
"(",
"k",
")",
"{",
"if",
"(",
"!",
"nargv",
")",
"{",
"nargv",
"=",
"process",
".",
"argv",
".",
"slice",
"(",
"0",
",",
"2",
")",
";",
"}",
"var",
"v",
"=",
"''",
",",
"m",
"=",
"null",
";",
"var",
"x",
"=",
"new",
"... | find via node CLI argument in the format key="value" | [
"find",
"via",
"node",
"CLI",
"argument",
"in",
"the",
"format",
"key",
"=",
"value"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/committer.js#L56-L70 |
54,943 | ugate/releasebot | lib/committer.js | clone | function clone(c, wl, bl) {
var cl = {}, cp, t;
for (var keys = Object.keys(c), l = 0; l < keys.length; l++) {
cp = c[keys[l]];
if (bl && bl.indexOf(cp) >= 0) {
continue;
}
if (Array.isArray(cp)) {
cl[keys[l]] = cp.slice(0);
} else if ((t = typeof cp) === 'function') {
if (!wl || wl.indexOf(cp) >= ... | javascript | function clone(c, wl, bl) {
var cl = {}, cp, t;
for (var keys = Object.keys(c), l = 0; l < keys.length; l++) {
cp = c[keys[l]];
if (bl && bl.indexOf(cp) >= 0) {
continue;
}
if (Array.isArray(cp)) {
cl[keys[l]] = cp.slice(0);
} else if ((t = typeof cp) === 'function') {
if (!wl || wl.indexOf(cp) >= ... | [
"function",
"clone",
"(",
"c",
",",
"wl",
",",
"bl",
")",
"{",
"var",
"cl",
"=",
"{",
"}",
",",
"cp",
",",
"t",
";",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"c",
")",
",",
"l",
"=",
"0",
";",
"l",
"<",
"keys",
".",
"... | Clones an object
@param c
the {Commit} to clone
@param wl
an array of white list functions that will be included in the
clone (null to include all)
@param bl
an array of black list property values that will be excluded from
the clone
@returns {Object} clone | [
"Clones",
"an",
"object"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/committer.js#L352-L373 |
54,944 | ugate/releasebot | lib/committer.js | pkgPropUpd | function pkgPropUpd(pd, u, n, r) {
var v = null;
if (u && pd.oldVer !== self.version && self.version) {
v = self.version;
} else if (n && pd.oldVer !== self.next.version && self.next.version) {
v = self.next.version;
} else if (r && self.prev.version) {
v = self.prev.version;
}
pd.version ... | javascript | function pkgPropUpd(pd, u, n, r) {
var v = null;
if (u && pd.oldVer !== self.version && self.version) {
v = self.version;
} else if (n && pd.oldVer !== self.next.version && self.next.version) {
v = self.next.version;
} else if (r && self.prev.version) {
v = self.prev.version;
}
pd.version ... | [
"function",
"pkgPropUpd",
"(",
"pd",
",",
"u",
",",
"n",
",",
"r",
")",
"{",
"var",
"v",
"=",
"null",
";",
"if",
"(",
"u",
"&&",
"pd",
".",
"oldVer",
"!==",
"self",
".",
"version",
"&&",
"self",
".",
"version",
")",
"{",
"v",
"=",
"self",
"."... | updates the package version or a set of properties from a parent package for a given package data element and flag | [
"updates",
"the",
"package",
"version",
"or",
"a",
"set",
"of",
"properties",
"from",
"a",
"parent",
"package",
"for",
"a",
"given",
"package",
"data",
"element",
"and",
"flag"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/committer.js#L551-L575 |
54,945 | ugate/releasebot | lib/committer.js | vmtchs | function vmtchs(start, end, skips) {
var s = '';
for (var i = start; i <= end; i++) {
if (skips && skips.indexOf(i) >= 0) {
continue;
}
s += self.versionMatch[i] || '';
}
return s;
} | javascript | function vmtchs(start, end, skips) {
var s = '';
for (var i = start; i <= end; i++) {
if (skips && skips.indexOf(i) >= 0) {
continue;
}
s += self.versionMatch[i] || '';
}
return s;
} | [
"function",
"vmtchs",
"(",
"start",
",",
"end",
",",
"skips",
")",
"{",
"var",
"s",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"start",
";",
"i",
"<=",
"end",
";",
"i",
"++",
")",
"{",
"if",
"(",
"skips",
"&&",
"skips",
".",
"indexOf",
"(",... | reconstructs the version matches | [
"reconstructs",
"the",
"version",
"matches"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/committer.js#L708-L717 |
54,946 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/a11yhelp/dialogs/a11yhelp.js | buildHelpContents | function buildHelpContents() {
var pageTpl = '<div class="cke_accessibility_legend" role="document" aria-labelledby="' + id + '_arialbl" tabIndex="-1">%1</div>' +
'<span id="' + id + '_arialbl" class="cke_voice_label">' + lang.contents + ' </span>',
sectionTpl = '<h1>%1</h1><dl>%2</dl>',
itemTpl = '<dt>... | javascript | function buildHelpContents() {
var pageTpl = '<div class="cke_accessibility_legend" role="document" aria-labelledby="' + id + '_arialbl" tabIndex="-1">%1</div>' +
'<span id="' + id + '_arialbl" class="cke_voice_label">' + lang.contents + ' </span>',
sectionTpl = '<h1>%1</h1><dl>%2</dl>',
itemTpl = '<dt>... | [
"function",
"buildHelpContents",
"(",
")",
"{",
"var",
"pageTpl",
"=",
"'<div class=\"cke_accessibility_legend\" role=\"document\" aria-labelledby=\"'",
"+",
"id",
"+",
"'_arialbl\" tabIndex=\"-1\">%1</div>'",
"+",
"'<span id=\"'",
"+",
"id",
"+",
"'_arialbl\" class=\"cke_voice_l... | Create the help list directly from lang file entries. | [
"Create",
"the",
"help",
"list",
"directly",
"from",
"lang",
"file",
"entries",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/a11yhelp/dialogs/a11yhelp.js#L121-L154 |
54,947 | bvalosek/sack | lib/getArguments.js | getArguments | function getArguments(f, amended)
{
var functionCode = f.toString();
if(amended){
//This is a fix for when we are passed anonymous functions (which are passed to us as unassigned)
//ex: "function (a, b, c) { }"
//These are actually parse errors so we'll try adding an assignment to fix the parse error
... | javascript | function getArguments(f, amended)
{
var functionCode = f.toString();
if(amended){
//This is a fix for when we are passed anonymous functions (which are passed to us as unassigned)
//ex: "function (a, b, c) { }"
//These are actually parse errors so we'll try adding an assignment to fix the parse error
... | [
"function",
"getArguments",
"(",
"f",
",",
"amended",
")",
"{",
"var",
"functionCode",
"=",
"f",
".",
"toString",
"(",
")",
";",
"if",
"(",
"amended",
")",
"{",
"//This is a fix for when we are passed anonymous functions (which are passed to us as unassigned)",
"//ex: \... | Get the parameter names of a function.
@param {Function} f A function.
@return {Array.<String>} An array of the argument names of a function. | [
"Get",
"the",
"parameter",
"names",
"of",
"a",
"function",
"."
] | 65e2ab133b6c40400c200c2e071052dea6b23c24 | https://github.com/bvalosek/sack/blob/65e2ab133b6c40400c200c2e071052dea6b23c24/lib/getArguments.js#L10-L34 |
54,948 | ForbesLindesay-Unmaintained/sauce-test | lib/run-chromedriver.js | runChromedriver | function runChromedriver(location, remote, options) {
assert(remote === 'chromedriver', 'expected remote to be chromedriver');
if (!options.chromedriverStarted) {
chromedriver.start();
}
var throttle = options.throttle || function (fn) { return fn(); };
return throttle(function () {
return runSingleBr... | javascript | function runChromedriver(location, remote, options) {
assert(remote === 'chromedriver', 'expected remote to be chromedriver');
if (!options.chromedriverStarted) {
chromedriver.start();
}
var throttle = options.throttle || function (fn) { return fn(); };
return throttle(function () {
return runSingleBr... | [
"function",
"runChromedriver",
"(",
"location",
",",
"remote",
",",
"options",
")",
"{",
"assert",
"(",
"remote",
"===",
"'chromedriver'",
",",
"'expected remote to be chromedriver'",
")",
";",
"if",
"(",
"!",
"options",
".",
"chromedriverStarted",
")",
"{",
"ch... | Run a test using chromedriver, then stops chrome driver and returns the result
@option {Function} throttle
@option {Object} platform|capabilities
@option {Boolean} debug
@option {Boolean} allowExceptions
@option {String|Function} testComplete
@option {String|Function} testPassed
@option... | [
"Run",
"a",
"test",
"using",
"chromedriver",
"then",
"stops",
"chrome",
"driver",
"and",
"returns",
"the",
"result"
] | 7c671b3321dc63aefc00c1c8d49e943ead2e7f5e | https://github.com/ForbesLindesay-Unmaintained/sauce-test/blob/7c671b3321dc63aefc00c1c8d49e943ead2e7f5e/lib/run-chromedriver.js#L33-L61 |
54,949 | OctaveWealth/passy | lib/bitString.js | pad | function pad (n, width, z) {
if (typeof n !== 'string') throw new Error('bitString#pad: Need String');
z = z || '0';
while(n.length < width) {
n = z + n;
}
return n;
} | javascript | function pad (n, width, z) {
if (typeof n !== 'string') throw new Error('bitString#pad: Need String');
z = z || '0';
while(n.length < width) {
n = z + n;
}
return n;
} | [
"function",
"pad",
"(",
"n",
",",
"width",
",",
"z",
")",
"{",
"if",
"(",
"typeof",
"n",
"!==",
"'string'",
")",
"throw",
"new",
"Error",
"(",
"'bitString#pad: Need String'",
")",
";",
"z",
"=",
"z",
"||",
"'0'",
";",
"while",
"(",
"n",
".",
"lengt... | Pad a string to atleast desired width
@param {string} n String to pad
@param {integer} width Width to pad to
@param {char=} z Optional pad char, defaults to '0'
@return {string} Padded string | [
"Pad",
"a",
"string",
"to",
"atleast",
"desired",
"width"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/bitString.js#L48-L55 |
54,950 | OctaveWealth/passy | lib/bitString.js | checksum | function checksum (bits, size) {
if (bits == null || !isValid(bits)) throw new Error('bitString#checksum: Need valid bits');
if (size == null || size % 2 !== 0) throw new Error('bitString#checksum: size needs to be even');
var sumA = 0,
sumB = 0,
i;
for (i = 0; i < bits.length; i++) {
sumA = (... | javascript | function checksum (bits, size) {
if (bits == null || !isValid(bits)) throw new Error('bitString#checksum: Need valid bits');
if (size == null || size % 2 !== 0) throw new Error('bitString#checksum: size needs to be even');
var sumA = 0,
sumB = 0,
i;
for (i = 0; i < bits.length; i++) {
sumA = (... | [
"function",
"checksum",
"(",
"bits",
",",
"size",
")",
"{",
"if",
"(",
"bits",
"==",
"null",
"||",
"!",
"isValid",
"(",
"bits",
")",
")",
"throw",
"new",
"Error",
"(",
"'bitString#checksum: Need valid bits'",
")",
";",
"if",
"(",
"size",
"==",
"null",
... | Fletcher's checksum on a bitstring
@param {string} bits Bitstring to checksum
@param {integer} size Size of checksum, must be divisible by 2
@return {string} Return checksum as bitstring. With BA, ie sumA last; | [
"Fletcher",
"s",
"checksum",
"on",
"a",
"bitstring"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/bitString.js#L72-L86 |
54,951 | OctaveWealth/passy | lib/bitString.js | randomBits | function randomBits (n) {
if (typeof n !== 'number') throw new Error('bitString#randomBits: Need number');
var buf = _randomBytes(Math.ceil(n/8)),
bits = '';
for (var i = 0; i < n; i++) {
bits += (buf[Math.floor(i / 8)] & (0x01 << (i % 8))) ? '1' : '0';
}
return bits;
} | javascript | function randomBits (n) {
if (typeof n !== 'number') throw new Error('bitString#randomBits: Need number');
var buf = _randomBytes(Math.ceil(n/8)),
bits = '';
for (var i = 0; i < n; i++) {
bits += (buf[Math.floor(i / 8)] & (0x01 << (i % 8))) ? '1' : '0';
}
return bits;
} | [
"function",
"randomBits",
"(",
"n",
")",
"{",
"if",
"(",
"typeof",
"n",
"!==",
"'number'",
")",
"throw",
"new",
"Error",
"(",
"'bitString#randomBits: Need number'",
")",
";",
"var",
"buf",
"=",
"_randomBytes",
"(",
"Math",
".",
"ceil",
"(",
"n",
"/",
"8"... | Get n random bits
Get N randomBits as bitstring
@param {integer} n Number of random bits to get
@return {string} The random bitstring | [
"Get",
"n",
"random",
"bits",
"Get",
"N",
"randomBits",
"as",
"bitstring"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/bitString.js#L94-L102 |
54,952 | meisterplayer/js-dev | gulp/changelog.js | createFormatChangelog | function createFormatChangelog(inPath) {
if (!inPath) {
throw new Error('Input path argument is required');
}
return function formatChangelog() {
return gulp.src(inPath)
// Replace all version compare links.
.pipe(replace(/\(http.*\) /g, ' '))
// Replace ... | javascript | function createFormatChangelog(inPath) {
if (!inPath) {
throw new Error('Input path argument is required');
}
return function formatChangelog() {
return gulp.src(inPath)
// Replace all version compare links.
.pipe(replace(/\(http.*\) /g, ' '))
// Replace ... | [
"function",
"createFormatChangelog",
"(",
"inPath",
")",
"{",
"if",
"(",
"!",
"inPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Input path argument is required'",
")",
";",
"}",
"return",
"function",
"formatChangelog",
"(",
")",
"{",
"return",
"gulp",
".",
... | Higher order function to create gulp function that strips links to the git repository from
changelogs generated by conventional changelog.
@param {string} inPath The path for the project's changelog
@return {function} Function that can be used as a gulp task | [
"Higher",
"order",
"function",
"to",
"create",
"gulp",
"function",
"that",
"strips",
"links",
"to",
"the",
"git",
"repository",
"from",
"changelogs",
"generated",
"by",
"conventional",
"changelog",
"."
] | c2646678c49dcdaa120ba3f24824da52b0c63e31 | https://github.com/meisterplayer/js-dev/blob/c2646678c49dcdaa120ba3f24824da52b0c63e31/gulp/changelog.js#L29-L42 |
54,953 | dak0rn/espressojs | lib/espresso/dispatchRequest.js | function(parts) {
var urls = [];
var start = '';
// If the first part is empty
// the original path begins with a slash so we
// do that, too
if( _.isEmpty(parts[0]) ) {
start = '/';
urls[0] = '/'; // would not be generated in reduce()
... | javascript | function(parts) {
var urls = [];
var start = '';
// If the first part is empty
// the original path begins with a slash so we
// do that, too
if( _.isEmpty(parts[0]) ) {
start = '/';
urls[0] = '/'; // would not be generated in reduce()
... | [
"function",
"(",
"parts",
")",
"{",
"var",
"urls",
"=",
"[",
"]",
";",
"var",
"start",
"=",
"''",
";",
"// If the first part is empty",
"// the original path begins with a slash so we",
"// do that, too",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"parts",
"[",
"0",
... | Function that creates a list of parent URLs
for a given relative URL. | [
"Function",
"that",
"creates",
"a",
"list",
"of",
"parent",
"URLs",
"for",
"a",
"given",
"relative",
"URL",
"."
] | 7f8e015f31113215abbe9988ae7f2c7dd5d8572b | https://github.com/dak0rn/espressojs/blob/7f8e015f31113215abbe9988ae7f2c7dd5d8572b/lib/espresso/dispatchRequest.js#L63-L90 | |
54,954 | dak0rn/espressojs | lib/espresso/dispatchRequest.js | function(urls, skipMissing) {
var i = -1;
var j;
var handlers = [];
var url;
var resource;
var urlsLength = urls.length;
var resourcesLength = this._resources.length;
var foundHandler;
// All URLs
while( ++i < urlsLength ) {
u... | javascript | function(urls, skipMissing) {
var i = -1;
var j;
var handlers = [];
var url;
var resource;
var urlsLength = urls.length;
var resourcesLength = this._resources.length;
var foundHandler;
// All URLs
while( ++i < urlsLength ) {
u... | [
"function",
"(",
"urls",
",",
"skipMissing",
")",
"{",
"var",
"i",
"=",
"-",
"1",
";",
"var",
"j",
";",
"var",
"handlers",
"=",
"[",
"]",
";",
"var",
"url",
";",
"var",
"resource",
";",
"var",
"urlsLength",
"=",
"urls",
".",
"length",
";",
"var",... | Finds all handlers for the given URLs.
If `skipMissing` is `false`, `null` will be returned
if a handler was not found.
this = api$this
@param {array} urls List of URLs to handle
@param {boolean} skipMissing Skip missing "holes"? | [
"Finds",
"all",
"handlers",
"for",
"the",
"given",
"URLs",
".",
"If",
"skipMissing",
"is",
"false",
"null",
"will",
"be",
"returned",
"if",
"a",
"handler",
"was",
"not",
"found",
"."
] | 7f8e015f31113215abbe9988ae7f2c7dd5d8572b | https://github.com/dak0rn/espressojs/blob/7f8e015f31113215abbe9988ae7f2c7dd5d8572b/lib/espresso/dispatchRequest.js#L133-L175 | |
54,955 | dak0rn/espressojs | lib/espresso/dispatchRequest.js | function(resource) {
var handler = resource.handler.getCallback(request.method);
request.api.handler = handler;
request.path = resource.path;
var context = resource.handler.getContext();
context.__espressojs = {
chainIsComplete: chainIsComplete,
// Refer... | javascript | function(resource) {
var handler = resource.handler.getCallback(request.method);
request.api.handler = handler;
request.path = resource.path;
var context = resource.handler.getContext();
context.__espressojs = {
chainIsComplete: chainIsComplete,
// Refer... | [
"function",
"(",
"resource",
")",
"{",
"var",
"handler",
"=",
"resource",
".",
"handler",
".",
"getCallback",
"(",
"request",
".",
"method",
")",
";",
"request",
".",
"api",
".",
"handler",
"=",
"handler",
";",
"request",
".",
"path",
"=",
"resource",
... | Helper function used to prepare the handler invokation
Uses and manipulates 'global' state like `chainIsComplete` and `request`.
@param {object} resource A resource entry containing a path (`.path`)
and the corresponding Handler.
@return {object} The `this` context for the resource handler. | [
"Helper",
"function",
"used",
"to",
"prepare",
"the",
"handler",
"invokation",
"Uses",
"and",
"manipulates",
"global",
"state",
"like",
"chainIsComplete",
"and",
"request",
"."
] | 7f8e015f31113215abbe9988ae7f2c7dd5d8572b | https://github.com/dak0rn/espressojs/blob/7f8e015f31113215abbe9988ae7f2c7dd5d8572b/lib/espresso/dispatchRequest.js#L186-L203 | |
54,956 | tether/request-text | index.js | setup | function setup (request, options, ...args) {
const len = request.headers['content-length']
const encoding = request.headers['content-encoding'] || 'identity'
return Object.assign({}, options, {
encoding: options.encoding || 'utf-8',
limit: options.limit || '1mb',
length: (len && encoding === 'identity... | javascript | function setup (request, options, ...args) {
const len = request.headers['content-length']
const encoding = request.headers['content-encoding'] || 'identity'
return Object.assign({}, options, {
encoding: options.encoding || 'utf-8',
limit: options.limit || '1mb',
length: (len && encoding === 'identity... | [
"function",
"setup",
"(",
"request",
",",
"options",
",",
"...",
"args",
")",
"{",
"const",
"len",
"=",
"request",
".",
"headers",
"[",
"'content-length'",
"]",
"const",
"encoding",
"=",
"request",
".",
"headers",
"[",
"'content-encoding'",
"]",
"||",
"'id... | Clone and setup default options.
@param {HttpIncomingMessage} request
@param {Object} options
@param {Object} mixin
@return {Object}
@api private | [
"Clone",
"and",
"setup",
"default",
"options",
"."
] | f3a38bc78dcef21fa495e644c53fc532be6f8bfb | https://github.com/tether/request-text/blob/f3a38bc78dcef21fa495e644c53fc532be6f8bfb/index.js#L33-L41 |
54,957 | blaugold/express-recaptcha-rest | index.js | getRecaptchaResponse | function getRecaptchaResponse(field, req) {
return req.get(field) || (req.query && req.query[field]) || (req.body && req.body[field])
} | javascript | function getRecaptchaResponse(field, req) {
return req.get(field) || (req.query && req.query[field]) || (req.body && req.body[field])
} | [
"function",
"getRecaptchaResponse",
"(",
"field",
",",
"req",
")",
"{",
"return",
"req",
".",
"get",
"(",
"field",
")",
"||",
"(",
"req",
".",
"query",
"&&",
"req",
".",
"query",
"[",
"field",
"]",
")",
"||",
"(",
"req",
".",
"body",
"&&",
"req",
... | Gets recaptcha response from request.
@private
@param {string} field - Key to look for response.
@param {express.req} req - Request object.
@returns {string} - Recaptcha response. | [
"Gets",
"recaptcha",
"response",
"from",
"request",
"."
] | 3993ef63ca4a2bbea6e331dfe2a1acbc83564056 | https://github.com/blaugold/express-recaptcha-rest/blob/3993ef63ca4a2bbea6e331dfe2a1acbc83564056/index.js#L141-L143 |
54,958 | morulus/import-sub | resolve.js | resolveAsync | function resolveAsync(p, base, root) {
if (!path.isAbsolute(p)) {
return new Promise(function(r, j) {
resolve(forceRelative(p), {
basedir: path.resolve(root, base)
}, function(err, res) {
if (err) {
j(err);
} else {
r(res);
}
});
});
} e... | javascript | function resolveAsync(p, base, root) {
if (!path.isAbsolute(p)) {
return new Promise(function(r, j) {
resolve(forceRelative(p), {
basedir: path.resolve(root, base)
}, function(err, res) {
if (err) {
j(err);
} else {
r(res);
}
});
});
} e... | [
"function",
"resolveAsync",
"(",
"p",
",",
"base",
",",
"root",
")",
"{",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
"p",
")",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"r",
",",
"j",
")",
"{",
"resolve",
"(",
"forceRelative"... | Resolve path the same way ans postcss-import
@return {Promise} | [
"Resolve",
"path",
"the",
"same",
"way",
"ans",
"postcss",
"-",
"import"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L81-L99 |
54,959 | morulus/import-sub | resolve.js | object | function object(pairs) {
let obj = {};
for (let i = 0;i<pairs.length;++i) {
obj[pairs[i][0]] = pairs[i][1];
}
return obj;
} | javascript | function object(pairs) {
let obj = {};
for (let i = 0;i<pairs.length;++i) {
obj[pairs[i][0]] = pairs[i][1];
}
return obj;
} | [
"function",
"object",
"(",
"pairs",
")",
"{",
"let",
"obj",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"pairs",
".",
"length",
";",
"++",
"i",
")",
"{",
"obj",
"[",
"pairs",
"[",
"i",
"]",
"[",
"0",
"]",
"]",
"="... | Object fn surrogate | [
"Object",
"fn",
"surrogate"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L112-L118 |
54,960 | morulus/import-sub | resolve.js | matchToHolders | function matchToHolders(match, tag) {
return object(match.map(function(val, index) {
return [tag+":"+index, val];
}));
} | javascript | function matchToHolders(match, tag) {
return object(match.map(function(val, index) {
return [tag+":"+index, val];
}));
} | [
"function",
"matchToHolders",
"(",
"match",
",",
"tag",
")",
"{",
"return",
"object",
"(",
"match",
".",
"map",
"(",
"function",
"(",
"val",
",",
"index",
")",
"{",
"return",
"[",
"tag",
"+",
"\":\"",
"+",
"index",
",",
"val",
"]",
";",
"}",
")",
... | Transform regExpr exec result to hashmap with tagged keys | [
"Transform",
"regExpr",
"exec",
"result",
"to",
"hashmap",
"with",
"tagged",
"keys"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L122-L126 |
54,961 | morulus/import-sub | resolve.js | filterValidRule | function filterValidRule(rule) {
return (rule.hasOwnProperty('match')&&typeof rule.match === "object")
&& (rule.hasOwnProperty('use') && (
typeof rule.use === "object"
|| typeof rule.use === "function"
))
&& (
(rule.match.hasOwnProperty('request'))
|| (rule.match.hasOwnProperty('base'))
)
} | javascript | function filterValidRule(rule) {
return (rule.hasOwnProperty('match')&&typeof rule.match === "object")
&& (rule.hasOwnProperty('use') && (
typeof rule.use === "object"
|| typeof rule.use === "function"
))
&& (
(rule.match.hasOwnProperty('request'))
|| (rule.match.hasOwnProperty('base'))
)
} | [
"function",
"filterValidRule",
"(",
"rule",
")",
"{",
"return",
"(",
"rule",
".",
"hasOwnProperty",
"(",
"'match'",
")",
"&&",
"typeof",
"rule",
".",
"match",
"===",
"\"object\"",
")",
"&&",
"(",
"rule",
".",
"hasOwnProperty",
"(",
"'use'",
")",
"&&",
"(... | Filter rules with `use` prop | [
"Filter",
"rules",
"with",
"use",
"prop"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L130-L140 |
54,962 | morulus/import-sub | resolve.js | mapDefaults | function mapDefaults(rule) {
return Object.assign({}, rule, {
match: Object.assign({
request: defaultExpr,
base: defaultExpr,
module: defaultExpr
}, rule.match),
use: rule.use,
});
} | javascript | function mapDefaults(rule) {
return Object.assign({}, rule, {
match: Object.assign({
request: defaultExpr,
base: defaultExpr,
module: defaultExpr
}, rule.match),
use: rule.use,
});
} | [
"function",
"mapDefaults",
"(",
"rule",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"rule",
",",
"{",
"match",
":",
"Object",
".",
"assign",
"(",
"{",
"request",
":",
"defaultExpr",
",",
"base",
":",
"defaultExpr",
",",
"module",
... | Merge with defaults | [
"Merge",
"with",
"defaults"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L144-L153 |
54,963 | morulus/import-sub | resolve.js | wrapPlaceholders | function wrapPlaceholders(placeholders) {
const keys = Object.keys(placeholders);
const wrappedPlaceholders = {};
for (let i = 0; i < keys.length; i++) {
wrappedPlaceholders['<'+keys[i]+'>'] = placeholders[keys[i]];
}
return wrappedPlaceholders;
} | javascript | function wrapPlaceholders(placeholders) {
const keys = Object.keys(placeholders);
const wrappedPlaceholders = {};
for (let i = 0; i < keys.length; i++) {
wrappedPlaceholders['<'+keys[i]+'>'] = placeholders[keys[i]];
}
return wrappedPlaceholders;
} | [
"function",
"wrapPlaceholders",
"(",
"placeholders",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"placeholders",
")",
";",
"const",
"wrappedPlaceholders",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",... | Wrap placeholders with scobes | [
"Wrap",
"placeholders",
"with",
"scobes"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L157-L166 |
54,964 | morulus/import-sub | resolve.js | isRequiresEarlyResolve | function isRequiresEarlyResolve(rules) {
for (let i = 0; i < rules.length; ++i) {
if (
Object.prototype.hasOwnProperty.call(rules[i], 'module') ||
(Object.prototype.hasOwnProperty.call(rules[i], 'append') && rules[i].append)
) {
return true;
}
}
return false;
} | javascript | function isRequiresEarlyResolve(rules) {
for (let i = 0; i < rules.length; ++i) {
if (
Object.prototype.hasOwnProperty.call(rules[i], 'module') ||
(Object.prototype.hasOwnProperty.call(rules[i], 'append') && rules[i].append)
) {
return true;
}
}
return false;
} | [
"function",
"isRequiresEarlyResolve",
"(",
"rules",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"rules",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"rules",
... | Search module in rules existing | [
"Search",
"module",
"in",
"rules",
"existing"
] | c5e33545bdc2b09714028ef6c44185a3ee59db3c | https://github.com/morulus/import-sub/blob/c5e33545bdc2b09714028ef6c44185a3ee59db3c/resolve.js#L177-L187 |
54,965 | OctaveWealth/passy | lib/random.js | toArray | function toArray (id) {
if (!isValid(id)) throw new Error('random#toArray: Need valid id');
// Decode
var result = [];
for (var i = 0; i < id.length; i++) {
result.push(baseURL.ALPHABET.indexOf(id[i]));
}
return result;
} | javascript | function toArray (id) {
if (!isValid(id)) throw new Error('random#toArray: Need valid id');
// Decode
var result = [];
for (var i = 0; i < id.length; i++) {
result.push(baseURL.ALPHABET.indexOf(id[i]));
}
return result;
} | [
"function",
"toArray",
"(",
"id",
")",
"{",
"if",
"(",
"!",
"isValid",
"(",
"id",
")",
")",
"throw",
"new",
"Error",
"(",
"'random#toArray: Need valid id'",
")",
";",
"// Decode",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",... | Convert a random id to Integer Array
@param {string} id The id to convert.
@return {Array.<number>} result | [
"Convert",
"a",
"random",
"id",
"to",
"Integer",
"Array"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/random.js#L56-L64 |
54,966 | impomezia/sjmp-node | lib/sjmp.js | request | function request(packet, json) {
return _create(packet, 1, (METHODS[packet.method] || '') + packet.resource, json);
} | javascript | function request(packet, json) {
return _create(packet, 1, (METHODS[packet.method] || '') + packet.resource, json);
} | [
"function",
"request",
"(",
"packet",
",",
"json",
")",
"{",
"return",
"_create",
"(",
"packet",
",",
"1",
",",
"(",
"METHODS",
"[",
"packet",
".",
"method",
"]",
"||",
"''",
")",
"+",
"packet",
".",
"resource",
",",
"json",
")",
";",
"}"
] | Serialize request to array or JSON.
@param {Object} packet
@param {String} packet.resource
@param {String} packet.id
@param {*} packet.body
@param {Number|String} [packet.date]
@param {Object} [packet.headers]
@param {String} [packet.method] "get", "search", "post", "put"... | [
"Serialize",
"request",
"to",
"array",
"or",
"JSON",
"."
] | 801a1bbdc8805b2e4c09721148684d43cae5a1e3 | https://github.com/impomezia/sjmp-node/blob/801a1bbdc8805b2e4c09721148684d43cae5a1e3/lib/sjmp.js#L38-L40 |
54,967 | impomezia/sjmp-node | lib/sjmp.js | reply | function reply(packet, json) {
return _create(packet, packet.status || 500, (METHODS[packet.method] || '') + packet.resource, json);
} | javascript | function reply(packet, json) {
return _create(packet, packet.status || 500, (METHODS[packet.method] || '') + packet.resource, json);
} | [
"function",
"reply",
"(",
"packet",
",",
"json",
")",
"{",
"return",
"_create",
"(",
"packet",
",",
"packet",
".",
"status",
"||",
"500",
",",
"(",
"METHODS",
"[",
"packet",
".",
"method",
"]",
"||",
"''",
")",
"+",
"packet",
".",
"resource",
",",
... | Serialize reply to array or JSON.
@param {Object} packet
@param {String} packet.method "get", "search", "post", "put", "delete", "sub", "unsub".
@param {String} packet.resource
@param {String} packet.id
@param {*} packet.body
@param {Number} [packet.status]
@param {Number... | [
"Serialize",
"reply",
"to",
"array",
"or",
"JSON",
"."
] | 801a1bbdc8805b2e4c09721148684d43cae5a1e3 | https://github.com/impomezia/sjmp-node/blob/801a1bbdc8805b2e4c09721148684d43cae5a1e3/lib/sjmp.js#L56-L58 |
54,968 | frozzare/vecka | lib/vecka.js | function () {
var date = new Date();
date.setHours(0, 0, 0);
date.setDate(date.getDate() + 4 - (date.getDay() || 7));
return Math.ceil((((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7);
} | javascript | function () {
var date = new Date();
date.setHours(0, 0, 0);
date.setDate(date.getDate() + 4 - (date.getDay() || 7));
return Math.ceil((((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7);
} | [
"function",
"(",
")",
"{",
"var",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"date",
".",
"setHours",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"date",
".",
"setDate",
"(",
"date",
".",
"getDate",
"(",
")",
"+",
"4",
"-",
"(",
"date",
".",
"g... | Get current week number.
@return {Number} | [
"Get",
"current",
"week",
"number",
"."
] | b9dd4144536b9a29620e668ecbde99aeda1debc0 | https://github.com/frozzare/vecka/blob/b9dd4144536b9a29620e668ecbde99aeda1debc0/lib/vecka.js#L11-L16 | |
54,969 | yaru22/co-couchbase | lib/util.js | methodQualified | function methodQualified(name, func) {
var funcStr = func.toString();
// Only public methodds (i.e. methods that do not start with '_') which have
// 'callback' as last parameter are qualified for thunkification.
return (/^[^_]/.test(name) &&
/function.*\(.*,?.*callback\)/.test(funcStr));
} | javascript | function methodQualified(name, func) {
var funcStr = func.toString();
// Only public methodds (i.e. methods that do not start with '_') which have
// 'callback' as last parameter are qualified for thunkification.
return (/^[^_]/.test(name) &&
/function.*\(.*,?.*callback\)/.test(funcStr));
} | [
"function",
"methodQualified",
"(",
"name",
",",
"func",
")",
"{",
"var",
"funcStr",
"=",
"func",
".",
"toString",
"(",
")",
";",
"// Only public methodds (i.e. methods that do not start with '_') which have",
"// 'callback' as last parameter are qualified for thunkification.",
... | Given method name and its function, determine if it qualifies for thunkification.
@param {String} name Method name.
@param {Function} func Function object for the method.
@return {Boolean} True if the method is qualified for thunkification. | [
"Given",
"method",
"name",
"and",
"its",
"function",
"determine",
"if",
"it",
"qualifies",
"for",
"thunkification",
"."
] | 1937f289a18d4a7ea8cdeac03c245a6a56d9f590 | https://github.com/yaru22/co-couchbase/blob/1937f289a18d4a7ea8cdeac03c245a6a56d9f590/lib/util.js#L9-L15 |
54,970 | ValeriiVasin/grunt-node-deploy | tasks/deployHelper.js | registerUserTasks | function registerUserTasks() {
var tasks = options.tasks,
task = that.task.bind(that),
before = that.before.bind(that),
after = that.after.bind(that),
taskName;
// register user tasks
for (taskName in tasks) {
if ( tasks.hasOwnProperty(taskName) ) {
task(ta... | javascript | function registerUserTasks() {
var tasks = options.tasks,
task = that.task.bind(that),
before = that.before.bind(that),
after = that.after.bind(that),
taskName;
// register user tasks
for (taskName in tasks) {
if ( tasks.hasOwnProperty(taskName) ) {
task(ta... | [
"function",
"registerUserTasks",
"(",
")",
"{",
"var",
"tasks",
"=",
"options",
".",
"tasks",
",",
"task",
"=",
"that",
".",
"task",
".",
"bind",
"(",
"that",
")",
",",
"before",
"=",
"that",
".",
"before",
".",
"bind",
"(",
"that",
")",
",",
"afte... | Register user-callbacks defined tasks | [
"Register",
"user",
"-",
"callbacks",
"defined",
"tasks"
] | 74304c4954732602494b555d98fe359c57b71887 | https://github.com/ValeriiVasin/grunt-node-deploy/blob/74304c4954732602494b555d98fe359c57b71887/tasks/deployHelper.js#L149-L179 |
54,971 | mrwest808/johan | src/object/proto.js | combine | function combine(...objects) {
inv(Array.isArray(objects) && objects.length > 0,
'You must pass at least one object to instantiate'
);
inv(objects.every(isObj),
'Expecting only plain objects as parameter(s)'
);
return assign({}, ...objects);
} | javascript | function combine(...objects) {
inv(Array.isArray(objects) && objects.length > 0,
'You must pass at least one object to instantiate'
);
inv(objects.every(isObj),
'Expecting only plain objects as parameter(s)'
);
return assign({}, ...objects);
} | [
"function",
"combine",
"(",
"...",
"objects",
")",
"{",
"inv",
"(",
"Array",
".",
"isArray",
"(",
"objects",
")",
"&&",
"objects",
".",
"length",
">",
"0",
",",
"'You must pass at least one object to instantiate'",
")",
";",
"inv",
"(",
"objects",
".",
"ever... | Assign one or more objects.
@param {...Object} ...objects
@return {Object} | [
"Assign",
"one",
"or",
"more",
"objects",
"."
] | 9e2bf0c1c924ec548d8f648e8a3a50e6fe3fa15b | https://github.com/mrwest808/johan/blob/9e2bf0c1c924ec548d8f648e8a3a50e6fe3fa15b/src/object/proto.js#L14-L24 |
54,972 | Pocketbrain/native-ads-web-ad-library | src/adConfiguration/fetchConfiguration.js | fetchConfiguration | function fetchConfiguration(environment, applicationId, callback) {
if(!applicationId) {
logger.error("No application ID specified");
return;
}
var deviceDetails = deviceDetector.getDeviceDetails();
var pathname = environment.getPathname();
var formFactor = deviceDetails.formFactor... | javascript | function fetchConfiguration(environment, applicationId, callback) {
if(!applicationId) {
logger.error("No application ID specified");
return;
}
var deviceDetails = deviceDetector.getDeviceDetails();
var pathname = environment.getPathname();
var formFactor = deviceDetails.formFactor... | [
"function",
"fetchConfiguration",
"(",
"environment",
",",
"applicationId",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"applicationId",
")",
"{",
"logger",
".",
"error",
"(",
"\"No application ID specified\"",
")",
";",
"return",
";",
"}",
"var",
"deviceDetails"... | Fetch the ad configurations to load on the current page from the server
@param environment - The environment specific implementations
@param applicationId - The applicationId to fetch ad configurations for
@param callback - The callback to execute when the configurations are retrieved | [
"Fetch",
"the",
"ad",
"configurations",
"to",
"load",
"on",
"the",
"current",
"page",
"from",
"the",
"server"
] | aafee1c42e0569ee77f334fc2c4eb71eb146957e | https://github.com/Pocketbrain/native-ads-web-ad-library/blob/aafee1c42e0569ee77f334fc2c4eb71eb146957e/src/adConfiguration/fetchConfiguration.js#L16-L55 |
54,973 | evaisse/jsonconsole | jsonconsole.js | write | function write(src, lvl, obj) {
var stack = null;
var lvlInt = levels[lvl];
var msg;
if ( typeof process.env.LOG_LEVEL == "string"
&& levels[process.env.LOG_LEVEL.toLowerCase()] > lvlInt) {
return false;
}
if (process.env.JSONCONSOLE_DISABLE_JSON_OUTPUT) {
return sr... | javascript | function write(src, lvl, obj) {
var stack = null;
var lvlInt = levels[lvl];
var msg;
if ( typeof process.env.LOG_LEVEL == "string"
&& levels[process.env.LOG_LEVEL.toLowerCase()] > lvlInt) {
return false;
}
if (process.env.JSONCONSOLE_DISABLE_JSON_OUTPUT) {
return sr... | [
"function",
"write",
"(",
"src",
",",
"lvl",
",",
"obj",
")",
"{",
"var",
"stack",
"=",
"null",
";",
"var",
"lvlInt",
"=",
"levels",
"[",
"lvl",
"]",
";",
"var",
"msg",
";",
"if",
"(",
"typeof",
"process",
".",
"env",
".",
"LOG_LEVEL",
"==",
"\"s... | Write JSON log line to stderr & stdout
@param {Stream} src stderr or stdout
@param {String} lvl a given string level by calling console.{level}()
@param {Object} obj Any object that will be filtered
@return {Boolean} false if logging has aborted | [
"Write",
"JSON",
"log",
"line",
"to",
"stderr",
"&",
"stdout"
] | d5b29d44542d4e276d1660fdda0c6b47436b5774 | https://github.com/evaisse/jsonconsole/blob/d5b29d44542d4e276d1660fdda0c6b47436b5774/jsonconsole.js#L92-L151 |
54,974 | evaisse/jsonconsole | jsonconsole.js | replace | function replace() {
if (!isOriginal) return;
else isOriginal = false;
function replaceWith(fn) {
return function() {
/* eslint prefer-rest-params:0 */
// todo: once node v4 support dropped, use rest parameter instead
fn.apply(logger, Array.from(arguments));
... | javascript | function replace() {
if (!isOriginal) return;
else isOriginal = false;
function replaceWith(fn) {
return function() {
/* eslint prefer-rest-params:0 */
// todo: once node v4 support dropped, use rest parameter instead
fn.apply(logger, Array.from(arguments));
... | [
"function",
"replace",
"(",
")",
"{",
"if",
"(",
"!",
"isOriginal",
")",
"return",
";",
"else",
"isOriginal",
"=",
"false",
";",
"function",
"replaceWith",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"/* eslint prefer-rest-params:0 */",
"// tod... | Replace global console api | [
"Replace",
"global",
"console",
"api"
] | d5b29d44542d4e276d1660fdda0c6b47436b5774 | https://github.com/evaisse/jsonconsole/blob/d5b29d44542d4e276d1660fdda0c6b47436b5774/jsonconsole.js#L165-L186 |
54,975 | evaisse/jsonconsole | jsonconsole.js | restore | function restore() {
if (isOriginal) return;
else isOriginal = true;
['log', 'debug', 'info', 'warn', 'error'].forEach((item) => {
console[item] = originalConsoleFunctions[item];
});
} | javascript | function restore() {
if (isOriginal) return;
else isOriginal = true;
['log', 'debug', 'info', 'warn', 'error'].forEach((item) => {
console[item] = originalConsoleFunctions[item];
});
} | [
"function",
"restore",
"(",
")",
"{",
"if",
"(",
"isOriginal",
")",
"return",
";",
"else",
"isOriginal",
"=",
"true",
";",
"[",
"'log'",
",",
"'debug'",
",",
"'info'",
",",
"'warn'",
",",
"'error'",
"]",
".",
"forEach",
"(",
"(",
"item",
")",
"=>",
... | Restore original console api | [
"Restore",
"original",
"console",
"api"
] | d5b29d44542d4e276d1660fdda0c6b47436b5774 | https://github.com/evaisse/jsonconsole/blob/d5b29d44542d4e276d1660fdda0c6b47436b5774/jsonconsole.js#L191-L197 |
54,976 | evaisse/jsonconsole | jsonconsole.js | setup | function setup(userOptions) {
Object.assign(options, userOptions);
/*
Try to automatically grab the app name from the root directory
*/
if (!options.root) {
try {
var p = require(path.dirname(process.mainModule.filename) + '/package.json');
options.root = pat... | javascript | function setup(userOptions) {
Object.assign(options, userOptions);
/*
Try to automatically grab the app name from the root directory
*/
if (!options.root) {
try {
var p = require(path.dirname(process.mainModule.filename) + '/package.json');
options.root = pat... | [
"function",
"setup",
"(",
"userOptions",
")",
"{",
"Object",
".",
"assign",
"(",
"options",
",",
"userOptions",
")",
";",
"/*\n Try to automatically grab the app name from the root directory\n */",
"if",
"(",
"!",
"options",
".",
"root",
")",
"{",
"try",
... | Setup JSON console
@param {Object} userOptions [description]
@return {Function} a restore function that restore the behavior of classic console | [
"Setup",
"JSON",
"console"
] | d5b29d44542d4e276d1660fdda0c6b47436b5774 | https://github.com/evaisse/jsonconsole/blob/d5b29d44542d4e276d1660fdda0c6b47436b5774/jsonconsole.js#L206-L241 |
54,977 | phated/grunt-enyo | tasks/init/enyo/root/enyo/source/touch/TranslateScrollStrategy.js | function(inX, inY) {
var o = inX + "px, " + inY + "px" + (this.accel ? ",0" : "");
enyo.dom.transformValue(this.$.client, this.translation, o);
} | javascript | function(inX, inY) {
var o = inX + "px, " + inY + "px" + (this.accel ? ",0" : "");
enyo.dom.transformValue(this.$.client, this.translation, o);
} | [
"function",
"(",
"inX",
",",
"inY",
")",
"{",
"var",
"o",
"=",
"inX",
"+",
"\"px, \"",
"+",
"inY",
"+",
"\"px\"",
"+",
"(",
"this",
".",
"accel",
"?",
"\",0\"",
":",
"\"\"",
")",
";",
"enyo",
".",
"dom",
".",
"transformValue",
"(",
"this",
".",
... | While moving, scroller uses translate. | [
"While",
"moving",
"scroller",
"uses",
"translate",
"."
] | d2990ee4cd85eea8db4108c43086c6d8c3c90c30 | https://github.com/phated/grunt-enyo/blob/d2990ee4cd85eea8db4108c43086c6d8c3c90c30/tasks/init/enyo/root/enyo/source/touch/TranslateScrollStrategy.js#L109-L112 | |
54,978 | bredele/deus | index.js | deus | function deus(one, two, fn) {
var types = [one, two];
var type = function(args, arg) {
var idx = index(types, typeof arg);
if(idx > -1 && !args[idx]) args[idx] = arg;
else if(arg) args.splice(args.length, 0, arg);
};
return function() {
var args = [,,];
for(var i = 0, l = arguments.length; ... | javascript | function deus(one, two, fn) {
var types = [one, two];
var type = function(args, arg) {
var idx = index(types, typeof arg);
if(idx > -1 && !args[idx]) args[idx] = arg;
else if(arg) args.splice(args.length, 0, arg);
};
return function() {
var args = [,,];
for(var i = 0, l = arguments.length; ... | [
"function",
"deus",
"(",
"one",
",",
"two",
",",
"fn",
")",
"{",
"var",
"types",
"=",
"[",
"one",
",",
"two",
"]",
";",
"var",
"type",
"=",
"function",
"(",
"args",
",",
"arg",
")",
"{",
"var",
"idx",
"=",
"index",
"(",
"types",
",",
"typeof",
... | Make two arguments function flexible.
@param {String} one
@param {String} two
@return {Function}
@api public | [
"Make",
"two",
"arguments",
"function",
"flexible",
"."
] | 4d6ff76f6e5d2b73361556ab93bbb186729974ea | https://github.com/bredele/deus/blob/4d6ff76f6e5d2b73361556ab93bbb186729974ea/index.js#L26-L41 |
54,979 | wshager/l3n | lib/doc.js | ensureDoc | function ensureDoc($node) {
// FIXME if isVNode(node) use cx on node
var cx = (0, _vnode.getContext)(this, inode);
return (0, _just.default)($node).pipe((0, _operators.concatMap)(function (node) {
if (!(0, _vnode.isVNode)(node)) {
var type = cx.getType(node);
if (type == 9 || type == 11) {
... | javascript | function ensureDoc($node) {
// FIXME if isVNode(node) use cx on node
var cx = (0, _vnode.getContext)(this, inode);
return (0, _just.default)($node).pipe((0, _operators.concatMap)(function (node) {
if (!(0, _vnode.isVNode)(node)) {
var type = cx.getType(node);
if (type == 9 || type == 11) {
... | [
"function",
"ensureDoc",
"(",
"$node",
")",
"{",
"// FIXME if isVNode(node) use cx on node",
"var",
"cx",
"=",
"(",
"0",
",",
"_vnode",
".",
"getContext",
")",
"(",
"this",
",",
"inode",
")",
";",
"return",
"(",
"0",
",",
"_just",
".",
"default",
")",
"(... | Document-related functions
@module doc
Wraps a document into a document-fragment if it doesn't have a document root
@param {any} $node Observable, VNode or any kind of node mathing the provided document implementation context
@return {Observable} Observable yielding a single VNode | [
"Document",
"-",
"related",
"functions"
] | 700496b9172a29efb3864eae920744d08acb1dc8 | https://github.com/wshager/l3n/blob/700496b9172a29efb3864eae920744d08acb1dc8/lib/doc.js#L35-L69 |
54,980 | tjhart/broccoli-tree-to-json | index.js | Tree2Json | function Tree2Json(inputTree) {
if (!(this instanceof Tree2Json)) return new Tree2Json(inputTree);
this.inputTree = inputTree.replace(/\/$/, '');
this.walker = new TreeTraverser(inputTree, this);
} | javascript | function Tree2Json(inputTree) {
if (!(this instanceof Tree2Json)) return new Tree2Json(inputTree);
this.inputTree = inputTree.replace(/\/$/, '');
this.walker = new TreeTraverser(inputTree, this);
} | [
"function",
"Tree2Json",
"(",
"inputTree",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Tree2Json",
")",
")",
"return",
"new",
"Tree2Json",
"(",
"inputTree",
")",
";",
"this",
".",
"inputTree",
"=",
"inputTree",
".",
"replace",
"(",
"/",
"\\/$",... | Take an input tree, and roll it up into a JSON document.
The resulting document will be named `srcDir.json`. it will have
key names associated with each of the file and directories that `srcDir` contains.
If the key represents the file, then the stringified file contents will be the value of the key.
If the key represe... | [
"Take",
"an",
"input",
"tree",
"and",
"roll",
"it",
"up",
"into",
"a",
"JSON",
"document",
".",
"The",
"resulting",
"document",
"will",
"be",
"named",
"srcDir",
".",
"json",
".",
"it",
"will",
"have",
"key",
"names",
"associated",
"with",
"each",
"of",
... | d8e069f35d626a7c86d9857cc45462a7d5c72b97 | https://github.com/tjhart/broccoli-tree-to-json/blob/d8e069f35d626a7c86d9857cc45462a7d5c72b97/index.js#L23-L28 |
54,981 | pwstegman/pw-stat | index.js | cov | function cov(x) {
// Useful variables
let N = x.length;
// Step 1: Find expected value for each variable (columns are variables, rows are samples)
let E = [];
for (let c = 0; c < x[0].length; c++) {
let u = 0;
for (let r = 0; r < N; r++) {
u += x[r][c];
}
E.push(u / N);
}
// Step 2: Center each vari... | javascript | function cov(x) {
// Useful variables
let N = x.length;
// Step 1: Find expected value for each variable (columns are variables, rows are samples)
let E = [];
for (let c = 0; c < x[0].length; c++) {
let u = 0;
for (let r = 0; r < N; r++) {
u += x[r][c];
}
E.push(u / N);
}
// Step 2: Center each vari... | [
"function",
"cov",
"(",
"x",
")",
"{",
"// Useful variables",
"let",
"N",
"=",
"x",
".",
"length",
";",
"// Step 1: Find expected value for each variable (columns are variables, rows are samples)",
"let",
"E",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"c",
"=",
"0",
... | Returns the covariance matrix for a given matrix.
@param {number[][]} x - A matrix where rows are samples and columns are variables. | [
"Returns",
"the",
"covariance",
"matrix",
"for",
"a",
"given",
"matrix",
"."
] | f0d75c54ae5d9484630b568b8077e8271f4caf38 | https://github.com/pwstegman/pw-stat/blob/f0d75c54ae5d9484630b568b8077e8271f4caf38/index.js#L5-L51 |
54,982 | pwstegman/pw-stat | index.js | mean | function mean(x) {
let result = [];
for(let c = 0; c<x[0].length; c++){
result.push(0);
}
for (let r = 0; r < x.length; r++) {
for(let c = 0; c<x[r].length; c++){
result[c] += x[r][c];
}
}
for(let c = 0; c<x[0].length; c++){
result[c] /= x.length;
}
return result;
} | javascript | function mean(x) {
let result = [];
for(let c = 0; c<x[0].length; c++){
result.push(0);
}
for (let r = 0; r < x.length; r++) {
for(let c = 0; c<x[r].length; c++){
result[c] += x[r][c];
}
}
for(let c = 0; c<x[0].length; c++){
result[c] /= x.length;
}
return result;
} | [
"function",
"mean",
"(",
"x",
")",
"{",
"let",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"c",
"=",
"0",
";",
"c",
"<",
"x",
"[",
"0",
"]",
".",
"length",
";",
"c",
"++",
")",
"{",
"result",
".",
"push",
"(",
"0",
")",
";",
"}",
"... | Returns the mean of each column in the provided matrix.
@param {number[][]} x - Two-dimensional matrix. | [
"Returns",
"the",
"mean",
"of",
"each",
"column",
"in",
"the",
"provided",
"matrix",
"."
] | f0d75c54ae5d9484630b568b8077e8271f4caf38 | https://github.com/pwstegman/pw-stat/blob/f0d75c54ae5d9484630b568b8077e8271f4caf38/index.js#L57-L75 |
54,983 | changecoin/changetip-javascript | src/changetip.js | function (config) {
config = config || {};
this.api_key = config.api_key;
this.host = config.host || undefined;
this.api_version = config.api_version || undefined;
this.dev_mode = config.dev_mode || false;
return this;
} | javascript | function (config) {
config = config || {};
this.api_key = config.api_key;
this.host = config.host || undefined;
this.api_version = config.api_version || undefined;
this.dev_mode = config.dev_mode || false;
return this;
} | [
"function",
"(",
"config",
")",
"{",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"api_key",
"=",
"config",
".",
"api_key",
";",
"this",
".",
"host",
"=",
"config",
".",
"host",
"||",
"undefined",
";",
"this",
".",
"api_version",
"=",
... | Initializes the class for remote API Calls
@param {ChangeTipConfig} config
@returns {ChangeTip} | [
"Initializes",
"the",
"class",
"for",
"remote",
"API",
"Calls"
] | 093a7abedbdb69e7ffc08236cec001c1630cf5e1 | https://github.com/changecoin/changetip-javascript/blob/093a7abedbdb69e7ffc08236cec001c1630cf5e1/src/changetip.js#L86-L93 | |
54,984 | changecoin/changetip-javascript | src/changetip.js | function (context_uid, sender, receiver, channel, message, meta) {
if (!this.api_key) throw new ChangeTipException(300);
if (!channel) throw new ChangeTipException(301);
var deferred = Q.defer(),
data;
data = {
context_uid: context_uid,
sender: sende... | javascript | function (context_uid, sender, receiver, channel, message, meta) {
if (!this.api_key) throw new ChangeTipException(300);
if (!channel) throw new ChangeTipException(301);
var deferred = Q.defer(),
data;
data = {
context_uid: context_uid,
sender: sende... | [
"function",
"(",
"context_uid",
",",
"sender",
",",
"receiver",
",",
"channel",
",",
"message",
",",
"meta",
")",
"{",
"if",
"(",
"!",
"this",
".",
"api_key",
")",
"throw",
"new",
"ChangeTipException",
"(",
"300",
")",
";",
"if",
"(",
"!",
"channel",
... | Sends a tip via the ChangeTip API
@param context_uid {number|string} Unique ID for this tip
@param {number|string} sender username/identifier for the tip sender
@param {number|string} receiver username/identifier for the tip receiever
@param {string} channel Origin channel for this tip (twitter, github, slack, etc)
@pa... | [
"Sends",
"a",
"tip",
"via",
"the",
"ChangeTip",
"API"
] | 093a7abedbdb69e7ffc08236cec001c1630cf5e1 | https://github.com/changecoin/changetip-javascript/blob/093a7abedbdb69e7ffc08236cec001c1630cf5e1/src/changetip.js#L105-L123 | |
54,985 | changecoin/changetip-javascript | src/changetip.js | function (tips, channel) {
if (!this.api_key) throw new ChangeTipException(300);
var deferred = Q.defer(),
params;
params = {
tips: tips instanceof Array ? tips.join(",") : tips,
channel: channel || ''
};
this._send_request({}, 'tips', param... | javascript | function (tips, channel) {
if (!this.api_key) throw new ChangeTipException(300);
var deferred = Q.defer(),
params;
params = {
tips: tips instanceof Array ? tips.join(",") : tips,
channel: channel || ''
};
this._send_request({}, 'tips', param... | [
"function",
"(",
"tips",
",",
"channel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"api_key",
")",
"throw",
"new",
"ChangeTipException",
"(",
"300",
")",
";",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"params",
";",
"params",
"=",
"{",... | Retrieve tips from the ChangeTip API
@param {string|string[]} tips Single or collection of tip identifiers to retrieve
@param {string} [channel] Channel to filter results. (github, twitter, slack, etc)
@returns {promise.promise|jQuery.promise|promise|Q.promise|jQuery.ready.promise|l.promise} | [
"Retrieve",
"tips",
"from",
"the",
"ChangeTip",
"API"
] | 093a7abedbdb69e7ffc08236cec001c1630cf5e1 | https://github.com/changecoin/changetip-javascript/blob/093a7abedbdb69e7ffc08236cec001c1630cf5e1/src/changetip.js#L131-L144 | |
54,986 | changecoin/changetip-javascript | src/changetip.js | function (data, path, params, method, deferred) {
var options, query_params, req,
dataString = JSON.stringify(data);
query_params = querystring.stringify(params);
options = {
host: this.host,
port: 443,
path: '/v' + this.api_version + '/' + path ... | javascript | function (data, path, params, method, deferred) {
var options, query_params, req,
dataString = JSON.stringify(data);
query_params = querystring.stringify(params);
options = {
host: this.host,
port: 443,
path: '/v' + this.api_version + '/' + path ... | [
"function",
"(",
"data",
",",
"path",
",",
"params",
",",
"method",
",",
"deferred",
")",
"{",
"var",
"options",
",",
"query_params",
",",
"req",
",",
"dataString",
"=",
"JSON",
".",
"stringify",
"(",
"data",
")",
";",
"query_params",
"=",
"querystring",... | Sends a request
@param {Object} data JSON Object with data payload
@param {String} path API Path
@param {Object} params Query Parameters to be sent along with this request
@param {Methods} method HTTP Method
@param deferred Deferred Object
@param deferred.promise Deferred Promise Object
@param deferred.resolve Deferred... | [
"Sends",
"a",
"request"
] | 093a7abedbdb69e7ffc08236cec001c1630cf5e1 | https://github.com/changecoin/changetip-javascript/blob/093a7abedbdb69e7ffc08236cec001c1630cf5e1/src/changetip.js#L158-L196 | |
54,987 | zouloux/grunt-deployer | tasks/gruntDeployer.js | quickTemplate | function quickTemplate (pTemplate, pValues)
{
return pTemplate.replace(templateRegex, function(i, pMatch) {
return pValues[pMatch];
});
} | javascript | function quickTemplate (pTemplate, pValues)
{
return pTemplate.replace(templateRegex, function(i, pMatch) {
return pValues[pMatch];
});
} | [
"function",
"quickTemplate",
"(",
"pTemplate",
",",
"pValues",
")",
"{",
"return",
"pTemplate",
".",
"replace",
"(",
"templateRegex",
",",
"function",
"(",
"i",
",",
"pMatch",
")",
"{",
"return",
"pValues",
"[",
"pMatch",
"]",
";",
"}",
")",
";",
"}"
] | Quick and dirty template method | [
"Quick",
"and",
"dirty",
"template",
"method"
] | e9877b8683c5c5344b1738677ad07699ee09d051 | https://github.com/zouloux/grunt-deployer/blob/e9877b8683c5c5344b1738677ad07699ee09d051/tasks/gruntDeployer.js#L25-L30 |
54,988 | hpcloud/hpcloud-js | lib/objectstorage/objectinfo.js | ObjectInfo | function ObjectInfo(name, contentType) {
this._name = name;
this._type = contentType || ObjectInfo.DEFAULT_CONTENT_TYPE;
this._partial = false;
} | javascript | function ObjectInfo(name, contentType) {
this._name = name;
this._type = contentType || ObjectInfo.DEFAULT_CONTENT_TYPE;
this._partial = false;
} | [
"function",
"ObjectInfo",
"(",
"name",
",",
"contentType",
")",
"{",
"this",
".",
"_name",
"=",
"name",
";",
"this",
".",
"_type",
"=",
"contentType",
"||",
"ObjectInfo",
".",
"DEFAULT_CONTENT_TYPE",
";",
"this",
".",
"_partial",
"=",
"false",
";",
"}"
] | Build a new ObjectInfo instance.
This represents the data about an object. It is used under the
following circumstances:
- SAVING: When creating a new object, you declare the object as
ObjectInfo. When saving, you will save with an ObjectInfo and a Stream
of data. See Container.save().
- LISTING: When calling Contain... | [
"Build",
"a",
"new",
"ObjectInfo",
"instance",
"."
] | c457ea3ee6a21e361d1af0af70d64622b6910208 | https://github.com/hpcloud/hpcloud-js/blob/c457ea3ee6a21e361d1af0af70d64622b6910208/lib/objectstorage/objectinfo.js#L49-L53 |
54,989 | mazaid/check | examples/functions.js | initCheckApi | function initCheckApi(logger, config) {
return new Promise((resolve, reject) => {
var check = new Check(logger, config);
var promises = [];
var checkers = require('mazaid-checkers');
for (var checker of checkers) {
promises.push(check.add(checker));
}
... | javascript | function initCheckApi(logger, config) {
return new Promise((resolve, reject) => {
var check = new Check(logger, config);
var promises = [];
var checkers = require('mazaid-checkers');
for (var checker of checkers) {
promises.push(check.add(checker));
}
... | [
"function",
"initCheckApi",
"(",
"logger",
",",
"config",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"var",
"check",
"=",
"new",
"Check",
"(",
"logger",
",",
"config",
")",
";",
"var",
"promises",
"=",
"... | init check api, add ping checker
@return {Promise} | [
"init",
"check",
"api",
"add",
"ping",
"checker"
] | 9bd0f7c5b44b1c996c2c805ae2a3c480c7009409 | https://github.com/mazaid/check/blob/9bd0f7c5b44b1c996c2c805ae2a3c480c7009409/examples/functions.js#L19-L45 |
54,990 | mazaid/check | examples/functions.js | runCheckTask | function runCheckTask(logger, checkTask) {
return new Promise((resolve, reject) => {
// create check task object
// raw.id = uuid();
// var checkTask = new CheckTask(raw);
// validate check task
checkTask.validate(logger)
.then((checkTask) => {
... | javascript | function runCheckTask(logger, checkTask) {
return new Promise((resolve, reject) => {
// create check task object
// raw.id = uuid();
// var checkTask = new CheckTask(raw);
// validate check task
checkTask.validate(logger)
.then((checkTask) => {
... | [
"function",
"runCheckTask",
"(",
"logger",
",",
"checkTask",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"// create check task object",
"// raw.id = uuid();",
"// var checkTask = new CheckTask(raw);",
"// validate check task",... | exec check task
@param {Object} checkTask
@return {Promise} | [
"exec",
"check",
"task"
] | 9bd0f7c5b44b1c996c2c805ae2a3c480c7009409 | https://github.com/mazaid/check/blob/9bd0f7c5b44b1c996c2c805ae2a3c480c7009409/examples/functions.js#L54-L123 |
54,991 | peteromano/jetrunner | example/vendor/mocha/support/compile.js | parseRequires | function parseRequires(js) {
return js
.replace(/require\('events'\)/g, "require('browser/events')")
.replace(/require\('debug'\)/g, "require('browser/debug')")
.replace(/require\('path'\)/g, "require('browser/path')")
.replace(/require\('diff'\)/g, "require('browser/diff')")
.replace(/require\('t... | javascript | function parseRequires(js) {
return js
.replace(/require\('events'\)/g, "require('browser/events')")
.replace(/require\('debug'\)/g, "require('browser/debug')")
.replace(/require\('path'\)/g, "require('browser/path')")
.replace(/require\('diff'\)/g, "require('browser/diff')")
.replace(/require\('t... | [
"function",
"parseRequires",
"(",
"js",
")",
"{",
"return",
"js",
".",
"replace",
"(",
"/",
"require\\('events'\\)",
"/",
"g",
",",
"\"require('browser/events')\"",
")",
".",
"replace",
"(",
"/",
"require\\('debug'\\)",
"/",
"g",
",",
"\"require('browser/debug')\"... | Parse requires. | [
"Parse",
"requires",
"."
] | 1882e0ee83d31fe1c799b42848c8c1357a62c995 | https://github.com/peteromano/jetrunner/blob/1882e0ee83d31fe1c799b42848c8c1357a62c995/example/vendor/mocha/support/compile.js#L44-L52 |
54,992 | jlindsey/grunt-reconfigure | tasks/reconfigure.js | function(obj, parts) {
if (parts.length === 0) { return true; }
var key = parts.shift();
if (!_(obj).has(key)) {
return false;
} else {
return hasKeyPath(obj[key], parts);
}
} | javascript | function(obj, parts) {
if (parts.length === 0) { return true; }
var key = parts.shift();
if (!_(obj).has(key)) {
return false;
} else {
return hasKeyPath(obj[key], parts);
}
} | [
"function",
"(",
"obj",
",",
"parts",
")",
"{",
"if",
"(",
"parts",
".",
"length",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"var",
"key",
"=",
"parts",
".",
"shift",
"(",
")",
";",
"if",
"(",
"!",
"_",
"(",
"obj",
")",
".",
"has",
... | Recursively step through the provided object and return whether it contains the provided keypath. | [
"Recursively",
"step",
"through",
"the",
"provided",
"object",
"and",
"return",
"whether",
"it",
"contains",
"the",
"provided",
"keypath",
"."
] | eebb9485eeeea39e3783b54a48792f5e6d956095 | https://github.com/jlindsey/grunt-reconfigure/blob/eebb9485eeeea39e3783b54a48792f5e6d956095/tasks/reconfigure.js#L26-L36 | |
54,993 | jlindsey/grunt-reconfigure | tasks/reconfigure.js | function(obj, env, keypath) {
if (!_.isObject(obj) || _.isArray(obj)) { return; }
if (hasKeyPath(obj, ['options', 'reconfigureOverrides', env])) {
var options = obj.options,
overrides = obj.options.reconfigureOverrides[env];
for (var key in overrides) {
var update = {
... | javascript | function(obj, env, keypath) {
if (!_.isObject(obj) || _.isArray(obj)) { return; }
if (hasKeyPath(obj, ['options', 'reconfigureOverrides', env])) {
var options = obj.options,
overrides = obj.options.reconfigureOverrides[env];
for (var key in overrides) {
var update = {
... | [
"function",
"(",
"obj",
",",
"env",
",",
"keypath",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"obj",
")",
"||",
"_",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"hasKeyPath",
"(",
"obj",
",",
"[",
"'op... | Recursively step through the provided object, searching for an `options` object with `reconfigureOverrides` containing the provided `env`. If it finds one, it resets any keys and values found inside on the containing `options` object. | [
"Recursively",
"step",
"through",
"the",
"provided",
"object",
"searching",
"for",
"an",
"options",
"object",
"with",
"reconfigureOverrides",
"containing",
"the",
"provided",
"env",
".",
"If",
"it",
"finds",
"one",
"it",
"resets",
"any",
"keys",
"and",
"values",... | eebb9485eeeea39e3783b54a48792f5e6d956095 | https://github.com/jlindsey/grunt-reconfigure/blob/eebb9485eeeea39e3783b54a48792f5e6d956095/tasks/reconfigure.js#L44-L72 | |
54,994 | Pocketbrain/native-ads-web-ad-library | src/util/logger.js | pushLogEntry | function pushLogEntry(logEntry) {
var logger = window[appSettings.loggerVar];
if (logger) {
logger.logs.push(logEntry);
if (window.console) {
if (typeof console.error === "function" && typeof console.warn === "function") {
switch (logEntry.type) {
... | javascript | function pushLogEntry(logEntry) {
var logger = window[appSettings.loggerVar];
if (logger) {
logger.logs.push(logEntry);
if (window.console) {
if (typeof console.error === "function" && typeof console.warn === "function") {
switch (logEntry.type) {
... | [
"function",
"pushLogEntry",
"(",
"logEntry",
")",
"{",
"var",
"logger",
"=",
"window",
"[",
"appSettings",
".",
"loggerVar",
"]",
";",
"if",
"(",
"logger",
")",
"{",
"logger",
".",
"logs",
".",
"push",
"(",
"logEntry",
")",
";",
"if",
"(",
"window",
... | Push a logEntry to the array of logs and output it to the console
@param logEntry The logEntry to process | [
"Push",
"a",
"logEntry",
"to",
"the",
"array",
"of",
"logs",
"and",
"output",
"it",
"to",
"the",
"console"
] | aafee1c42e0569ee77f334fc2c4eb71eb146957e | https://github.com/Pocketbrain/native-ads-web-ad-library/blob/aafee1c42e0569ee77f334fc2c4eb71eb146957e/src/util/logger.js#L50-L83 |
54,995 | Pocketbrain/native-ads-web-ad-library | src/util/logger.js | getCurrentTimeString | function getCurrentTimeString() {
var today = new Date();
var hh = today.getHours();
var mm = today.getMinutes(); //January is 0
var ss = today.getSeconds();
var ms = today.getMilliseconds();
if (hh < 10) {
hh = '0' + hh;
}
if (mm < 10) {
mm = '0' + mm;
}
if (s... | javascript | function getCurrentTimeString() {
var today = new Date();
var hh = today.getHours();
var mm = today.getMinutes(); //January is 0
var ss = today.getSeconds();
var ms = today.getMilliseconds();
if (hh < 10) {
hh = '0' + hh;
}
if (mm < 10) {
mm = '0' + mm;
}
if (s... | [
"function",
"getCurrentTimeString",
"(",
")",
"{",
"var",
"today",
"=",
"new",
"Date",
"(",
")",
";",
"var",
"hh",
"=",
"today",
".",
"getHours",
"(",
")",
";",
"var",
"mm",
"=",
"today",
".",
"getMinutes",
"(",
")",
";",
"//January is 0",
"var",
"ss... | Get the current time as a string
@returns {string} - the current time in a hh:mm:ss string | [
"Get",
"the",
"current",
"time",
"as",
"a",
"string"
] | aafee1c42e0569ee77f334fc2c4eb71eb146957e | https://github.com/Pocketbrain/native-ads-web-ad-library/blob/aafee1c42e0569ee77f334fc2c4eb71eb146957e/src/util/logger.js#L89-L113 |
54,996 | darrencruse/sugarlisp-core | reader.js | read_from_source | function read_from_source(codestr, filenameOrLexer, options) {
var lexer;
if(typeof filenameOrLexer === 'string') {
lexer = initLexerFor(codestr, filenameOrLexer, options);
}
else {
lexer = filenameOrLexer;
lexer.set_source_text(codestr, options);
}
// read the forms
var forms = read(lexer);... | javascript | function read_from_source(codestr, filenameOrLexer, options) {
var lexer;
if(typeof filenameOrLexer === 'string') {
lexer = initLexerFor(codestr, filenameOrLexer, options);
}
else {
lexer = filenameOrLexer;
lexer.set_source_text(codestr, options);
}
// read the forms
var forms = read(lexer);... | [
"function",
"read_from_source",
"(",
"codestr",
",",
"filenameOrLexer",
",",
"options",
")",
"{",
"var",
"lexer",
";",
"if",
"(",
"typeof",
"filenameOrLexer",
"===",
"'string'",
")",
"{",
"lexer",
"=",
"initLexerFor",
"(",
"codestr",
",",
"filenameOrLexer",
",... | Read the expressions in the provided source code string.
@param codestr = the source code as a string e.g. from reading a source file.
@param filenameOrLexer = the name of source file (or the Lexer for the file)
@return the list (see sl-types) of the expressions in codestr. | [
"Read",
"the",
"expressions",
"in",
"the",
"provided",
"source",
"code",
"string",
"."
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L55-L77 |
54,997 | darrencruse/sugarlisp-core | reader.js | unuse_dialect | function unuse_dialect(dialectName, lexer, options) {
options = options || {};
if(dialectName && options.validate &&
lexer.dialects[0].name !== dialectName)
{
lexer.error('Attempt to exit dialect "' + dialectName + '" while "' +
lexer.dialects[0].name + '" was still active');
}
slinfo('removing... | javascript | function unuse_dialect(dialectName, lexer, options) {
options = options || {};
if(dialectName && options.validate &&
lexer.dialects[0].name !== dialectName)
{
lexer.error('Attempt to exit dialect "' + dialectName + '" while "' +
lexer.dialects[0].name + '" was still active');
}
slinfo('removing... | [
"function",
"unuse_dialect",
"(",
"dialectName",
",",
"lexer",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"dialectName",
"&&",
"options",
".",
"validate",
"&&",
"lexer",
".",
"dialects",
"[",
"0",
"]",
".",
"na... | stop using a dialect
Whereas "use_dialect" enters the scope of a dialect, "unuse_dialect"
exits that scope.
@params dialectName = the name of the dialect to stop using, or if
undefined the most recent dialect "used" in the one that's "unused"
@params lexer = the lexer for the file being "unused" from.
note: if opti... | [
"stop",
"using",
"a",
"dialect"
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L354-L370 |
54,998 | darrencruse/sugarlisp-core | reader.js | invokeInitDialectFunctions | function invokeInitDialectFunctions(dialect, lexer, options) {
var initfnkey = "__init";
if(dialect[initfnkey]) {
dialect[initfnkey](lexer, dialect, options);
}
if(dialect.lextab[initfnkey]) {
dialect.lextab[initfnkey](lexer, dialect, options);
}
if(dialect.readtab[initfnkey]) {
dialect.readtab[... | javascript | function invokeInitDialectFunctions(dialect, lexer, options) {
var initfnkey = "__init";
if(dialect[initfnkey]) {
dialect[initfnkey](lexer, dialect, options);
}
if(dialect.lextab[initfnkey]) {
dialect.lextab[initfnkey](lexer, dialect, options);
}
if(dialect.readtab[initfnkey]) {
dialect.readtab[... | [
"function",
"invokeInitDialectFunctions",
"(",
"dialect",
",",
"lexer",
",",
"options",
")",
"{",
"var",
"initfnkey",
"=",
"\"__init\"",
";",
"if",
"(",
"dialect",
"[",
"initfnkey",
"]",
")",
"{",
"dialect",
"[",
"initfnkey",
"]",
"(",
"lexer",
",",
"diale... | Init dialect functions can optionally be used to initialize things
at the time a dialect is "used".
They can be placed on the dialect, it's lextab, readtab, or gentab,
under a key named "__init" (note we use two underscores).
They receive as arguments the lexer, the dialect, and the overall
options (as passed to "rea... | [
"Init",
"dialect",
"functions",
"can",
"optionally",
"be",
"used",
"to",
"initialize",
"things",
"at",
"the",
"time",
"a",
"dialect",
"is",
"used",
"."
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L382-L396 |
54,999 | darrencruse/sugarlisp-core | reader.js | read | function read(lexer, precedence) {
precedence = precedence || 0;
var form = read_via_closest_dialect(lexer);
// are we a prefix unary operator?
var leftForm = form;
if(sl.isAtom(form)) {
var opSpec = getOperatorSpecFor(form, lexer.dialects);
if(opSpec && isEnabled(opSpec.prefix) && opSpec.prefix.tr... | javascript | function read(lexer, precedence) {
precedence = precedence || 0;
var form = read_via_closest_dialect(lexer);
// are we a prefix unary operator?
var leftForm = form;
if(sl.isAtom(form)) {
var opSpec = getOperatorSpecFor(form, lexer.dialects);
if(opSpec && isEnabled(opSpec.prefix) && opSpec.prefix.tr... | [
"function",
"read",
"(",
"lexer",
",",
"precedence",
")",
"{",
"precedence",
"=",
"precedence",
"||",
"0",
";",
"var",
"form",
"=",
"read_via_closest_dialect",
"(",
"lexer",
")",
";",
"// are we a prefix unary operator?",
"var",
"leftForm",
"=",
"form",
";",
"... | Read the form at the current position in the source.
@param lexer = the lexer that is reading the source file.
@param precedence = internal use only (don't pass)
@return the list (see sl-types) for the expression that was read. | [
"Read",
"the",
"form",
"at",
"the",
"current",
"position",
"in",
"the",
"source",
"."
] | c6ff983ebc3d60268054d6fe046db4aff6c5f78c | https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L404-L460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.