id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,200 | medic/couchdb-audit | couchdb-audit/log.js | function(doc, callback) {
audit([doc], function(err) {
if (err) {
return callback(err);
}
docsDb.saveDoc(doc, callback);
});
} | javascript | function(doc, callback) {
audit([doc], function(err) {
if (err) {
return callback(err);
}
docsDb.saveDoc(doc, callback);
});
} | [
"function",
"(",
"doc",
",",
"callback",
")",
"{",
"audit",
"(",
"[",
"doc",
"]",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"docsDb",
".",
"saveDoc",
"(",
"doc",
",",
"ca... | Saves the given doc with an audit record
@name saveDoc(doc, callback)
@param {Object} doc
@param {Function} callback(err,response)
@api public | [
"Saves",
"the",
"given",
"doc",
"with",
"an",
"audit",
"record"
] | 88a2fde06830e91966fc82c7356ec46da043fc01 | https://github.com/medic/couchdb-audit/blob/88a2fde06830e91966fc82c7356ec46da043fc01/couchdb-audit/log.js#L200-L207 | |
57,201 | medic/couchdb-audit | couchdb-audit/log.js | function(docs, options, callback) {
if (!callback) {
callback = options;
options = {};
}
audit(docs, function(err) {
if (err) {
return callback(err);
}
options.docs = docs;
docsDb.bulkDocs(options, callback);
});
... | javascript | function(docs, options, callback) {
if (!callback) {
callback = options;
options = {};
}
audit(docs, function(err) {
if (err) {
return callback(err);
}
options.docs = docs;
docsDb.bulkDocs(options, callback);
});
... | [
"function",
"(",
"docs",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"callback",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"audit",
"(",
"docs",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",... | Saves the given docs with individual audit records
@name bulkSave(docs, options, callback)
@param {Array} docs An array of documents to be saved
@param {Object} options Optional options to pass through to bulk save
@param {Function} callback(err,response)
@api public | [
"Saves",
"the",
"given",
"docs",
"with",
"individual",
"audit",
"records"
] | 88a2fde06830e91966fc82c7356ec46da043fc01 | https://github.com/medic/couchdb-audit/blob/88a2fde06830e91966fc82c7356ec46da043fc01/couchdb-audit/log.js#L218-L230 | |
57,202 | medic/couchdb-audit | couchdb-audit/log.js | function(doc, callback) {
audit([doc], 'delete', function(err) {
if (err) {
return callback(err);
}
docsDb.removeDoc(doc._id, doc._rev, callback);
});
} | javascript | function(doc, callback) {
audit([doc], 'delete', function(err) {
if (err) {
return callback(err);
}
docsDb.removeDoc(doc._id, doc._rev, callback);
});
} | [
"function",
"(",
"doc",
",",
"callback",
")",
"{",
"audit",
"(",
"[",
"doc",
"]",
",",
"'delete'",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"docsDb",
".",
"removeDoc",
"("... | Deletes the given doc with auditing
@name removeDoc(doc, callback)
@param {Object} doc
@param {Function} callback(err,response)
@api public | [
"Deletes",
"the",
"given",
"doc",
"with",
"auditing"
] | 88a2fde06830e91966fc82c7356ec46da043fc01 | https://github.com/medic/couchdb-audit/blob/88a2fde06830e91966fc82c7356ec46da043fc01/couchdb-audit/log.js#L240-L247 | |
57,203 | zship/grunt-amd-check | tasks/amd-check.js | function(arr, i) {
var ret = arr.slice(0);
for (var j = 0; j < i; j++) {
ret = [ret[ret.length - 1]].concat(ret.slice(0, ret.length - 1));
}
return ret;
} | javascript | function(arr, i) {
var ret = arr.slice(0);
for (var j = 0; j < i; j++) {
ret = [ret[ret.length - 1]].concat(ret.slice(0, ret.length - 1));
}
return ret;
} | [
"function",
"(",
"arr",
",",
"i",
")",
"{",
"var",
"ret",
"=",
"arr",
".",
"slice",
"(",
"0",
")",
";",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"i",
";",
"j",
"++",
")",
"{",
"ret",
"=",
"[",
"ret",
"[",
"ret",
".",
"length",
"... | eliminate duplicate circular dependency loops | [
"eliminate",
"duplicate",
"circular",
"dependency",
"loops"
] | cabd51c2e33c2dae620420b568cc7853ff5e330c | https://github.com/zship/grunt-amd-check/blob/cabd51c2e33c2dae620420b568cc7853ff5e330c/tasks/amd-check.js#L163-L169 | |
57,204 | zship/grunt-amd-check | tasks/amd-check.js | function(first, second) {
if (_equal(first, second)) {
return true;
}
for (var i = 1; i <= first.length; i++) {
if (_equal(first, _rotated(second, i))) {
return true;
}
}
return false;
} | javascript | function(first, second) {
if (_equal(first, second)) {
return true;
}
for (var i = 1; i <= first.length; i++) {
if (_equal(first, _rotated(second, i))) {
return true;
}
}
return false;
} | [
"function",
"(",
"first",
",",
"second",
")",
"{",
"if",
"(",
"_equal",
"(",
"first",
",",
"second",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<=",
"first",
".",
"length",
";",
"i",
"++",
")",
"{"... | loops are "equal" if their elements are equal when "shifted" to the right by some amount | [
"loops",
"are",
"equal",
"if",
"their",
"elements",
"are",
"equal",
"when",
"shifted",
"to",
"the",
"right",
"by",
"some",
"amount"
] | cabd51c2e33c2dae620420b568cc7853ff5e330c | https://github.com/zship/grunt-amd-check/blob/cabd51c2e33c2dae620420b568cc7853ff5e330c/tasks/amd-check.js#L176-L186 | |
57,205 | bvalosek/sql-params | index.js | sqlParams | function sqlParams(sql, params)
{
var args = [];
var keys = sql.match(/@\w+/g);
var aKeys = sql.match(/\$\d+/g);
if (keys && aKeys)
throw new Error(
'Cannot use both array-style and object-style parametric values');
// Array-style (native)
if (aKeys) {
return { text: sql, values: params };
... | javascript | function sqlParams(sql, params)
{
var args = [];
var keys = sql.match(/@\w+/g);
var aKeys = sql.match(/\$\d+/g);
if (keys && aKeys)
throw new Error(
'Cannot use both array-style and object-style parametric values');
// Array-style (native)
if (aKeys) {
return { text: sql, values: params };
... | [
"function",
"sqlParams",
"(",
"sql",
",",
"params",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"var",
"keys",
"=",
"sql",
".",
"match",
"(",
"/",
"@\\w+",
"/",
"g",
")",
";",
"var",
"aKeys",
"=",
"sql",
".",
"match",
"(",
"/",
"\\$\\d+",
"/",... | Given a hash and parametric sql string, swap all of the @vars into $N args
and create an array
@param {string} sql Parametric sql string
@param {object} hash All of the named arguments
@return {{sql:string, args:array.<any>}} | [
"Given",
"a",
"hash",
"and",
"parametric",
"sql",
"string",
"swap",
"all",
"of",
"the"
] | abaa04f95debb23353f214eb5dec27894851d259 | https://github.com/bvalosek/sql-params/blob/abaa04f95debb23353f214eb5dec27894851d259/index.js#L10-L42 |
57,206 | radiovisual/tokenize-whitespace | index.js | getWordToken | function getWordToken(str) {
var word = str.split(/\s/g)[0];
return {text: word, type: 'WORD', length: word.length};
} | javascript | function getWordToken(str) {
var word = str.split(/\s/g)[0];
return {text: word, type: 'WORD', length: word.length};
} | [
"function",
"getWordToken",
"(",
"str",
")",
"{",
"var",
"word",
"=",
"str",
".",
"split",
"(",
"/",
"\\s",
"/",
"g",
")",
"[",
"0",
"]",
";",
"return",
"{",
"text",
":",
"word",
",",
"type",
":",
"'WORD'",
",",
"length",
":",
"word",
".",
"len... | Extract whole word values | [
"Extract",
"whole",
"word",
"values"
] | de6991b9ca6e979202df9708770bd785672f8345 | https://github.com/radiovisual/tokenize-whitespace/blob/de6991b9ca6e979202df9708770bd785672f8345/index.js#L41-L44 |
57,207 | bredele/uri-params-match | index.js | contains | function contains (obj1, obj2) {
const keys = Object.keys(obj1)
let result = keys.length > 0
let l = keys.length
while (l--) {
const key = keys[l]
result = result && match(obj1[key], obj2[key])
}
return result
} | javascript | function contains (obj1, obj2) {
const keys = Object.keys(obj1)
let result = keys.length > 0
let l = keys.length
while (l--) {
const key = keys[l]
result = result && match(obj1[key], obj2[key])
}
return result
} | [
"function",
"contains",
"(",
"obj1",
",",
"obj2",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"obj1",
")",
"let",
"result",
"=",
"keys",
".",
"length",
">",
"0",
"let",
"l",
"=",
"keys",
".",
"length",
"while",
"(",
"l",
"--",
")"... | Return true if second object contains all keys and values
from the first object.
@param {Object} obj1
@param {Object} obj2
@return {Boolean}
@api private | [
"Return",
"true",
"if",
"second",
"object",
"contains",
"all",
"keys",
"and",
"values",
"from",
"the",
"first",
"object",
"."
] | 093666babe2b270a99230358892db8e8651264bc | https://github.com/bredele/uri-params-match/blob/093666babe2b270a99230358892db8e8651264bc/index.js#L37-L46 |
57,208 | Ravenwall/node-ravenwall | index.js | ravenwall | function ravenwall(options) {
if (options instanceof statware) return options
options = options || {}
// set defaults
options.sysstats = !(options.sysstats === false)
options.procstats = !(options.procstats === false)
options.memstats = !(options.memstats === false)
options.push = !(options.push === fal... | javascript | function ravenwall(options) {
if (options instanceof statware) return options
options = options || {}
// set defaults
options.sysstats = !(options.sysstats === false)
options.procstats = !(options.procstats === false)
options.memstats = !(options.memstats === false)
options.push = !(options.push === fal... | [
"function",
"ravenwall",
"(",
"options",
")",
"{",
"if",
"(",
"options",
"instanceof",
"statware",
")",
"return",
"options",
"options",
"=",
"options",
"||",
"{",
"}",
"// set defaults",
"options",
".",
"sysstats",
"=",
"!",
"(",
"options",
".",
"sysstats",
... | The Ravenwall Agent.
@param {Object} options The options to create the agent with.
options.apiToken {string} set your Ravenwall API key. Can also use the RAVENWALL_API_TOKEN environment variable.
options.id {string} set a series id. This defines where your data will be stored. If not specified, a uuid will be generate... | [
"The",
"Ravenwall",
"Agent",
"."
] | 23e6491f0dec26f7879103e3be1c88abad17a58f | https://github.com/Ravenwall/node-ravenwall/blob/23e6491f0dec26f7879103e3be1c88abad17a58f/index.js#L46-L119 |
57,209 | mgesmundo/port-manager | lib/port-manager.js | normalize | function normalize(from, to) {
if (from && (isNaN(from) || from <= 0) || (to && (isNaN(to) || to <= 0))) {
throw new Error('invalid port range: required > 0');
}
if ((from && from > MAX) || (to && to > MAX)) {
throw new Error(f('invalid port range: required < %d', MAX));
}
if (to && to < from) {
t... | javascript | function normalize(from, to) {
if (from && (isNaN(from) || from <= 0) || (to && (isNaN(to) || to <= 0))) {
throw new Error('invalid port range: required > 0');
}
if ((from && from > MAX) || (to && to > MAX)) {
throw new Error(f('invalid port range: required < %d', MAX));
}
if (to && to < from) {
t... | [
"function",
"normalize",
"(",
"from",
",",
"to",
")",
"{",
"if",
"(",
"from",
"&&",
"(",
"isNaN",
"(",
"from",
")",
"||",
"from",
"<=",
"0",
")",
"||",
"(",
"to",
"&&",
"(",
"isNaN",
"(",
"to",
")",
"||",
"to",
"<=",
"0",
")",
")",
")",
"{"... | Normalize a TCP ports range
@param {Number} [from] Start port (included)
@param {Number} [to] End port (included)
@return {{from: {Number}, to: {Number}}}
@private
@ignore | [
"Normalize",
"a",
"TCP",
"ports",
"range"
] | a09356b9063c228616d0ffc56217b93c479f2604 | https://github.com/mgesmundo/port-manager/blob/a09356b9063c228616d0ffc56217b93c479f2604/lib/port-manager.js#L24-L44 |
57,210 | relief-melone/limitpromises | src/services/service.cleanObject.js | cleanObject | function cleanObject(Object){
delete Object.resolve;
delete Object.reject;
delete Object.resolveResult;
delete Object.rejectResult;
delete Object.launchPromise;
delete Object.promiseFunc;
} | javascript | function cleanObject(Object){
delete Object.resolve;
delete Object.reject;
delete Object.resolveResult;
delete Object.rejectResult;
delete Object.launchPromise;
delete Object.promiseFunc;
} | [
"function",
"cleanObject",
"(",
"Object",
")",
"{",
"delete",
"Object",
".",
"resolve",
";",
"delete",
"Object",
".",
"reject",
";",
"delete",
"Object",
".",
"resolveResult",
";",
"delete",
"Object",
".",
"rejectResult",
";",
"delete",
"Object",
".",
"launch... | Will be called if a resultPromise is either rejected or resolved to clean the Object of Attributes you don't want to
send back to the user
@param {Object} Object The Object you want to clean | [
"Will",
"be",
"called",
"if",
"a",
"resultPromise",
"is",
"either",
"rejected",
"or",
"resolved",
"to",
"clean",
"the",
"Object",
"of",
"Attributes",
"you",
"don",
"t",
"want",
"to",
"send",
"back",
"to",
"the",
"user"
] | 1735b92749740204b597c1c6026257d54ade8200 | https://github.com/relief-melone/limitpromises/blob/1735b92749740204b597c1c6026257d54ade8200/src/services/service.cleanObject.js#L8-L15 |
57,211 | update/updater-example | updatefile.js | updateExample | function updateExample(app, str) {
var cwd = app.options.dest || app.cwd;
return app.src('example.txt', {cwd: cwd})
.pipe(append(str))
.pipe(app.dest(cwd));
} | javascript | function updateExample(app, str) {
var cwd = app.options.dest || app.cwd;
return app.src('example.txt', {cwd: cwd})
.pipe(append(str))
.pipe(app.dest(cwd));
} | [
"function",
"updateExample",
"(",
"app",
",",
"str",
")",
"{",
"var",
"cwd",
"=",
"app",
".",
"options",
".",
"dest",
"||",
"app",
".",
"cwd",
";",
"return",
"app",
".",
"src",
"(",
"'example.txt'",
",",
"{",
"cwd",
":",
"cwd",
"}",
")",
".",
"pi... | Append the given string to `example.txt` and re-write the file to the current
working directory.
The `.src` and `.dest` methods work exactly like gulp's (we use the same libs from the
gulp team under the hood)
@param {Object} `app` Instance of update, to get the cwd. Pass `--dest` on the command line to set `app.opti... | [
"Append",
"the",
"given",
"string",
"to",
"example",
".",
"txt",
"and",
"re",
"-",
"write",
"the",
"file",
"to",
"the",
"current",
"working",
"directory",
"."
] | 5e89b9acc78f7789d344d4c2c7d2b94dd348734b | https://github.com/update/updater-example/blob/5e89b9acc78f7789d344d4c2c7d2b94dd348734b/updatefile.js#L58-L63 |
57,212 | update/updater-example | updatefile.js | erase | function erase(num) {
var n = typeof num === 'number' ? num : 1;
return through.obj(function(file, enc, next) {
var lines = file.contents.toString().trim().split('\n');
file.contents = new Buffer(lines.slice(0, -n).join('\n') + '\n');
next(null, file);
});
} | javascript | function erase(num) {
var n = typeof num === 'number' ? num : 1;
return through.obj(function(file, enc, next) {
var lines = file.contents.toString().trim().split('\n');
file.contents = new Buffer(lines.slice(0, -n).join('\n') + '\n');
next(null, file);
});
} | [
"function",
"erase",
"(",
"num",
")",
"{",
"var",
"n",
"=",
"typeof",
"num",
"===",
"'number'",
"?",
"num",
":",
"1",
";",
"return",
"through",
".",
"obj",
"(",
"function",
"(",
"file",
",",
"enc",
",",
"next",
")",
"{",
"var",
"lines",
"=",
"fil... | Erase the given number of lines from the end of a string
@param {String} `str`
@return {Stream} vinyl stream
@api public | [
"Erase",
"the",
"given",
"number",
"of",
"lines",
"from",
"the",
"end",
"of",
"a",
"string"
] | 5e89b9acc78f7789d344d4c2c7d2b94dd348734b | https://github.com/update/updater-example/blob/5e89b9acc78f7789d344d4c2c7d2b94dd348734b/updatefile.js#L88-L95 |
57,213 | yoshuawuyts/virtual-raf | index.js | update | function update (state) {
assert.ifError(inRenderingTransaction, 'infinite loop detected')
// request a redraw for next frame
if (currentState === null && !redrawScheduled) {
redrawScheduled = true
raf(function redraw () {
redrawScheduled = false
if (!currentState) return
... | javascript | function update (state) {
assert.ifError(inRenderingTransaction, 'infinite loop detected')
// request a redraw for next frame
if (currentState === null && !redrawScheduled) {
redrawScheduled = true
raf(function redraw () {
redrawScheduled = false
if (!currentState) return
... | [
"function",
"update",
"(",
"state",
")",
"{",
"assert",
".",
"ifError",
"(",
"inRenderingTransaction",
",",
"'infinite loop detected'",
")",
"// request a redraw for next frame",
"if",
"(",
"currentState",
"===",
"null",
"&&",
"!",
"redrawScheduled",
")",
"{",
"redr... | update the state and render function obj -> null | [
"update",
"the",
"state",
"and",
"render",
"function",
"obj",
"-",
">",
"null"
] | d2a8fcd49a6e55ca135d4a9c002bf6d7ffe0f76b | https://github.com/yoshuawuyts/virtual-raf/blob/d2a8fcd49a6e55ca135d4a9c002bf6d7ffe0f76b/index.js#L33-L57 |
57,214 | commenthol/streamss | lib/split.js | Split | function Split (options) {
if (!(this instanceof Split)) {
return new Split(options)
}
if (options instanceof RegExp || typeof options === 'string') {
options = { matcher: options }
}
this.options = Object.assign({
matcher: /(\r?\n)/, // emits also newlines
encoding: 'utf8'
}, options)
th... | javascript | function Split (options) {
if (!(this instanceof Split)) {
return new Split(options)
}
if (options instanceof RegExp || typeof options === 'string') {
options = { matcher: options }
}
this.options = Object.assign({
matcher: /(\r?\n)/, // emits also newlines
encoding: 'utf8'
}, options)
th... | [
"function",
"Split",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Split",
")",
")",
"{",
"return",
"new",
"Split",
"(",
"options",
")",
"}",
"if",
"(",
"options",
"instanceof",
"RegExp",
"||",
"typeof",
"options",
"===",
"'stri... | Split a stream using a regexp or string based matcher
@constructor
@param {Object} [options] - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`
@param {RegExp|String} options.matcher - RegExp or String use for splitting up the stream. Default=/(\r?\n)/
@return {Transform} A transform stream | [
"Split",
"a",
"stream",
"using",
"a",
"regexp",
"or",
"string",
"based",
"matcher"
] | cfef5d0ed30c7efe002018886e2e843c91d3558f | https://github.com/commenthol/streamss/blob/cfef5d0ed30c7efe002018886e2e843c91d3558f/lib/split.js#L20-L37 |
57,215 | AndreasMadsen/piccolo | lib/modules/url.js | copyObject | function copyObject(obj) {
var ret = {}, name;
for (name in obj) {
if (obj.hasOwnProperty(name)) {
ret[name] = obj[name];
}
}
return ret;
} | javascript | function copyObject(obj) {
var ret = {}, name;
for (name in obj) {
if (obj.hasOwnProperty(name)) {
ret[name] = obj[name];
}
}
return ret;
} | [
"function",
"copyObject",
"(",
"obj",
")",
"{",
"var",
"ret",
"=",
"{",
"}",
",",
"name",
";",
"for",
"(",
"name",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"ret",
"[",
"name",
"]",
"=",
"obj",
... | copy an object without depth | [
"copy",
"an",
"object",
"without",
"depth"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L7-L15 |
57,216 | AndreasMadsen/piccolo | lib/modules/url.js | setHost | function setHost(uri) {
if (uri.auth || uri.hostname || uri.port) {
uri.host = '';
if (uri.auth) uri.host += uri.auth + '@';
if (uri.hostname) uri.host += uri.hostname;
if (uri.port) uri.host += ':' + uri.port;
}
} | javascript | function setHost(uri) {
if (uri.auth || uri.hostname || uri.port) {
uri.host = '';
if (uri.auth) uri.host += uri.auth + '@';
if (uri.hostname) uri.host += uri.hostname;
if (uri.port) uri.host += ':' + uri.port;
}
} | [
"function",
"setHost",
"(",
"uri",
")",
"{",
"if",
"(",
"uri",
".",
"auth",
"||",
"uri",
".",
"hostname",
"||",
"uri",
".",
"port",
")",
"{",
"uri",
".",
"host",
"=",
"''",
";",
"if",
"(",
"uri",
".",
"auth",
")",
"uri",
".",
"host",
"+=",
"u... | construct host property | [
"construct",
"host",
"property"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L18-L25 |
57,217 | AndreasMadsen/piccolo | lib/modules/url.js | setHref | function setHref(uri) {
uri.href = '';
if (uri.protocol) uri.href += uri.protocol + '//';
if (uri.host) uri.href += uri.host;
if (uri.path) uri.href += uri.path;
if (uri.hash) uri.href += uri.hash;
} | javascript | function setHref(uri) {
uri.href = '';
if (uri.protocol) uri.href += uri.protocol + '//';
if (uri.host) uri.href += uri.host;
if (uri.path) uri.href += uri.path;
if (uri.hash) uri.href += uri.hash;
} | [
"function",
"setHref",
"(",
"uri",
")",
"{",
"uri",
".",
"href",
"=",
"''",
";",
"if",
"(",
"uri",
".",
"protocol",
")",
"uri",
".",
"href",
"+=",
"uri",
".",
"protocol",
"+",
"'//'",
";",
"if",
"(",
"uri",
".",
"host",
")",
"uri",
".",
"href",... | construct href property | [
"construct",
"href",
"property"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L28-L34 |
57,218 | AndreasMadsen/piccolo | lib/modules/url.js | setPath | function setPath(uri) {
if (uri.path || (uri.pathname === undefined && uri.search === undefined)) return;
uri.path = '';
if (uri.pathname) uri.path += uri.pathname;
if (uri.search) uri.path += uri.search;
} | javascript | function setPath(uri) {
if (uri.path || (uri.pathname === undefined && uri.search === undefined)) return;
uri.path = '';
if (uri.pathname) uri.path += uri.pathname;
if (uri.search) uri.path += uri.search;
} | [
"function",
"setPath",
"(",
"uri",
")",
"{",
"if",
"(",
"uri",
".",
"path",
"||",
"(",
"uri",
".",
"pathname",
"===",
"undefined",
"&&",
"uri",
".",
"search",
"===",
"undefined",
")",
")",
"return",
";",
"uri",
".",
"path",
"=",
"''",
";",
"if",
... | construct path property | [
"construct",
"path",
"property"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L37-L43 |
57,219 | AndreasMadsen/piccolo | lib/modules/url.js | setSearch | function setSearch(uri) {
if (typeof uri.search === 'string' || uri.query === undefined) return;
if (typeof uri.query === 'string') {
uri.search = '?' + uri.query;
return;
}
var name, filled = false;
uri.search = '?';
for (name in uri.query) {
filled = true;
uri.search += name + '=' + uri... | javascript | function setSearch(uri) {
if (typeof uri.search === 'string' || uri.query === undefined) return;
if (typeof uri.query === 'string') {
uri.search = '?' + uri.query;
return;
}
var name, filled = false;
uri.search = '?';
for (name in uri.query) {
filled = true;
uri.search += name + '=' + uri... | [
"function",
"setSearch",
"(",
"uri",
")",
"{",
"if",
"(",
"typeof",
"uri",
".",
"search",
"===",
"'string'",
"||",
"uri",
".",
"query",
"===",
"undefined",
")",
"return",
";",
"if",
"(",
"typeof",
"uri",
".",
"query",
"===",
"'string'",
")",
"{",
"ur... | construct search property | [
"construct",
"search",
"property"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L46-L63 |
57,220 | AndreasMadsen/piccolo | lib/modules/url.js | parseFilepath | function parseFilepath(path) {
if (path === undefined) {
return {filename: null, list: []};
}
var list = path.split('/'),
isDir = (path[path.length - 1] === '/') || (list[list.length - 1].indexOf('.') === -1);
return {
filename: isDir ? null : list.pop(),
list: list
};
} | javascript | function parseFilepath(path) {
if (path === undefined) {
return {filename: null, list: []};
}
var list = path.split('/'),
isDir = (path[path.length - 1] === '/') || (list[list.length - 1].indexOf('.') === -1);
return {
filename: isDir ? null : list.pop(),
list: list
};
} | [
"function",
"parseFilepath",
"(",
"path",
")",
"{",
"if",
"(",
"path",
"===",
"undefined",
")",
"{",
"return",
"{",
"filename",
":",
"null",
",",
"list",
":",
"[",
"]",
"}",
";",
"}",
"var",
"list",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
","... | split filepath from filename | [
"split",
"filepath",
"from",
"filename"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/url.js#L66-L78 |
57,221 | melvincarvalho/rdf-shell | lib/rm.js | bin | function bin(argv) {
rm(argv, function(err, res, uri) {
console.log('rm of : ' + uri);
});
} | javascript | function bin(argv) {
rm(argv, function(err, res, uri) {
console.log('rm of : ' + uri);
});
} | [
"function",
"bin",
"(",
"argv",
")",
"{",
"rm",
"(",
"argv",
",",
"function",
"(",
"err",
",",
"res",
",",
"uri",
")",
"{",
"console",
".",
"log",
"(",
"'rm of : '",
"+",
"uri",
")",
";",
"}",
")",
";",
"}"
] | rm as a command
@param {String} argv[2] login
@callback {bin~cb} callback | [
"rm",
"as",
"a",
"command"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/rm.js#L29-L33 |
57,222 | iwillwen/co-e | index.js | buildError | function buildError(err, hackErr) {
var stack1 = err.stack;
var stack2 = hackErr.stack;
var label = hackErr.label;
var stack = [];
stack1.split('\n').forEach(function(line, index, arr) {
if (line.match(/^ at GeneratorFunctionPrototype.next/)) {
stack = stack.concat(arr.slice(0, index));
r... | javascript | function buildError(err, hackErr) {
var stack1 = err.stack;
var stack2 = hackErr.stack;
var label = hackErr.label;
var stack = [];
stack1.split('\n').forEach(function(line, index, arr) {
if (line.match(/^ at GeneratorFunctionPrototype.next/)) {
stack = stack.concat(arr.slice(0, index));
r... | [
"function",
"buildError",
"(",
"err",
",",
"hackErr",
")",
"{",
"var",
"stack1",
"=",
"err",
".",
"stack",
";",
"var",
"stack2",
"=",
"hackErr",
".",
"stack",
";",
"var",
"label",
"=",
"hackErr",
".",
"label",
";",
"var",
"stack",
"=",
"[",
"]",
";... | Build the full error stack | [
"Build",
"the",
"full",
"error",
"stack"
] | f8ac569e63028111c1942b6caadb651fc0e2e2a8 | https://github.com/iwillwen/co-e/blob/f8ac569e63028111c1942b6caadb651fc0e2e2a8/index.js#L78-L106 |
57,223 | deepjs/deep-promise | index.js | function(argument) {
//console.log("deep.Deferred.resolve : ", argument);
if (this.rejected || this.resolved)
throw new Error("deferred has already been ended !");
if (argument instanceof Error)
return this.reject(argument);
this._success = argument;
this.resolved = true;
var self = th... | javascript | function(argument) {
//console.log("deep.Deferred.resolve : ", argument);
if (this.rejected || this.resolved)
throw new Error("deferred has already been ended !");
if (argument instanceof Error)
return this.reject(argument);
this._success = argument;
this.resolved = true;
var self = th... | [
"function",
"(",
"argument",
")",
"{",
"//console.log(\"deep.Deferred.resolve : \", argument);",
"if",
"(",
"this",
".",
"rejected",
"||",
"this",
".",
"resolved",
")",
"throw",
"new",
"Error",
"(",
"\"deferred has already been ended !\"",
")",
";",
"if",
"(",
"argu... | resolve the Deferred and so the associated promise
@method resolve
@param {Object} argument the resolved object injected in promise
@return {deep.Deferred} this | [
"resolve",
"the",
"Deferred",
"and",
"so",
"the",
"associated",
"promise"
] | 022fb9d99def95d0017d965efb88cc4c4393bd30 | https://github.com/deepjs/deep-promise/blob/022fb9d99def95d0017d965efb88cc4c4393bd30/index.js#L263-L275 | |
57,224 | deepjs/deep-promise | index.js | function(argument) {
// console.log("DeepDeferred.reject");
if (this.rejected || this.resolved)
throw new Error("deferred has already been ended !");
this._error = argument;
this.rejected = true;
var self = this;
this._promises.forEach(function(promise) {
promise.reject(argument);
... | javascript | function(argument) {
// console.log("DeepDeferred.reject");
if (this.rejected || this.resolved)
throw new Error("deferred has already been ended !");
this._error = argument;
this.rejected = true;
var self = this;
this._promises.forEach(function(promise) {
promise.reject(argument);
... | [
"function",
"(",
"argument",
")",
"{",
"// console.log(\"DeepDeferred.reject\");",
"if",
"(",
"this",
".",
"rejected",
"||",
"this",
".",
"resolved",
")",
"throw",
"new",
"Error",
"(",
"\"deferred has already been ended !\"",
")",
";",
"this",
".",
"_error",
"=",... | reject the Deferred and so the associated promise
@method reject
@param {Object} argument the rejected object injected in promise
@return {deep.Deferred} this | [
"reject",
"the",
"Deferred",
"and",
"so",
"the",
"associated",
"promise"
] | 022fb9d99def95d0017d965efb88cc4c4393bd30 | https://github.com/deepjs/deep-promise/blob/022fb9d99def95d0017d965efb88cc4c4393bd30/index.js#L282-L292 | |
57,225 | deepjs/deep-promise | index.js | function() {
var prom = new promise.Promise();
//console.log("deep2.Deffered.promise : ", prom, " r,r,c : ", this.rejected, this.resolved, this.canceled)
if (this.resolved)
return prom.resolve(this._success);
if (this.rejected)
return prom.reject(this._error);
this._promises.push(prom);
... | javascript | function() {
var prom = new promise.Promise();
//console.log("deep2.Deffered.promise : ", prom, " r,r,c : ", this.rejected, this.resolved, this.canceled)
if (this.resolved)
return prom.resolve(this._success);
if (this.rejected)
return prom.reject(this._error);
this._promises.push(prom);
... | [
"function",
"(",
")",
"{",
"var",
"prom",
"=",
"new",
"promise",
".",
"Promise",
"(",
")",
";",
"//console.log(\"deep2.Deffered.promise : \", prom, \" r,r,c : \", this.rejected, this.resolved, this.canceled)",
"if",
"(",
"this",
".",
"resolved",
")",
"return",
"prom",
"... | return a promise for this deferred
@method promise
@return {deep.Promise} | [
"return",
"a",
"promise",
"for",
"this",
"deferred"
] | 022fb9d99def95d0017d965efb88cc4c4393bd30 | https://github.com/deepjs/deep-promise/blob/022fb9d99def95d0017d965efb88cc4c4393bd30/index.js#L298-L307 | |
57,226 | AlphaReplica/Connecta | lib/client/source/connecta.js | init | function init()
{
scope._servConn = new ConnectaSocket(scope._url,scope._reconnect,scope._encode);
scope._servConn.onConnected = function(e)
{
scope.id = e;
scope.dispatchEvent("connected");
}
scope._servConn.onError = function(e)
{
... | javascript | function init()
{
scope._servConn = new ConnectaSocket(scope._url,scope._reconnect,scope._encode);
scope._servConn.onConnected = function(e)
{
scope.id = e;
scope.dispatchEvent("connected");
}
scope._servConn.onError = function(e)
{
... | [
"function",
"init",
"(",
")",
"{",
"scope",
".",
"_servConn",
"=",
"new",
"ConnectaSocket",
"(",
"scope",
".",
"_url",
",",
"scope",
".",
"_reconnect",
",",
"scope",
".",
"_encode",
")",
";",
"scope",
".",
"_servConn",
".",
"onConnected",
"=",
"function"... | init acts as constructor | [
"init",
"acts",
"as",
"constructor"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L28-L60 |
57,227 | AlphaReplica/Connecta | lib/client/source/connecta.js | createPeerInstance | function createPeerInstance(id)
{
var peer = new ConnectaPeer(id,stunUrls);
peer.onIceCandidate = gotIceCandidate;
peer.onDescription = createdDescription;
peer.onRemoteStream = gotRemoteStream;
peer.onConnected = onPeerConnected;
peer.onMessa... | javascript | function createPeerInstance(id)
{
var peer = new ConnectaPeer(id,stunUrls);
peer.onIceCandidate = gotIceCandidate;
peer.onDescription = createdDescription;
peer.onRemoteStream = gotRemoteStream;
peer.onConnected = onPeerConnected;
peer.onMessa... | [
"function",
"createPeerInstance",
"(",
"id",
")",
"{",
"var",
"peer",
"=",
"new",
"ConnectaPeer",
"(",
"id",
",",
"stunUrls",
")",
";",
"peer",
".",
"onIceCandidate",
"=",
"gotIceCandidate",
";",
"peer",
".",
"onDescription",
"=",
"createdDescription",
";",
... | creates ConnectaPeer Instance and returns | [
"creates",
"ConnectaPeer",
"Instance",
"and",
"returns"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L63-L81 |
57,228 | AlphaReplica/Connecta | lib/client/source/connecta.js | getPeerByRTCId | function getPeerByRTCId(id)
{
for(var num = 0; num < scope._servConn.roomUsers.length; num++)
{
if(scope._servConn.roomUsers[num].rtcId == id)
{
return scope._servConn.roomUsers[num];
}
}
return null;
} | javascript | function getPeerByRTCId(id)
{
for(var num = 0; num < scope._servConn.roomUsers.length; num++)
{
if(scope._servConn.roomUsers[num].rtcId == id)
{
return scope._servConn.roomUsers[num];
}
}
return null;
} | [
"function",
"getPeerByRTCId",
"(",
"id",
")",
"{",
"for",
"(",
"var",
"num",
"=",
"0",
";",
"num",
"<",
"scope",
".",
"_servConn",
".",
"roomUsers",
".",
"length",
";",
"num",
"++",
")",
"{",
"if",
"(",
"scope",
".",
"_servConn",
".",
"roomUsers",
... | gets ConnectaPeer instance by rtcId | [
"gets",
"ConnectaPeer",
"instance",
"by",
"rtcId"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L94-L104 |
57,229 | AlphaReplica/Connecta | lib/client/source/connecta.js | getOrCreatePeer | function getOrCreatePeer(id)
{
if(scope.peers[id])
{
return scope.peers[id];
}
return createPeerInstance(id);
} | javascript | function getOrCreatePeer(id)
{
if(scope.peers[id])
{
return scope.peers[id];
}
return createPeerInstance(id);
} | [
"function",
"getOrCreatePeer",
"(",
"id",
")",
"{",
"if",
"(",
"scope",
".",
"peers",
"[",
"id",
"]",
")",
"{",
"return",
"scope",
".",
"peers",
"[",
"id",
"]",
";",
"}",
"return",
"createPeerInstance",
"(",
"id",
")",
";",
"}"
] | gets ConnectaPeer instance by id, if not exists, creates new and returns | [
"gets",
"ConnectaPeer",
"instance",
"by",
"id",
"if",
"not",
"exists",
"creates",
"new",
"and",
"returns"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L107-L114 |
57,230 | AlphaReplica/Connecta | lib/client/source/connecta.js | onClientJoinedRoom | function onClientJoinedRoom(id)
{
if(scope._servConn.useRTC)
{
if(scope.hasWebRTCSupport())
{
var peer = getOrCreatePeer(id);
peer.createOffer();
}
else
{
scope._servConn.sendRTCState(false,id... | javascript | function onClientJoinedRoom(id)
{
if(scope._servConn.useRTC)
{
if(scope.hasWebRTCSupport())
{
var peer = getOrCreatePeer(id);
peer.createOffer();
}
else
{
scope._servConn.sendRTCState(false,id... | [
"function",
"onClientJoinedRoom",
"(",
"id",
")",
"{",
"if",
"(",
"scope",
".",
"_servConn",
".",
"useRTC",
")",
"{",
"if",
"(",
"scope",
".",
"hasWebRTCSupport",
"(",
")",
")",
"{",
"var",
"peer",
"=",
"getOrCreatePeer",
"(",
"id",
")",
";",
"peer",
... | called when client joined in room, if rtc enabled and browser has support of rtc, creates offer and sends to peer by sending sdp string to server, else notifies server to add connection in fallback list | [
"called",
"when",
"client",
"joined",
"in",
"room",
"if",
"rtc",
"enabled",
"and",
"browser",
"has",
"support",
"of",
"rtc",
"creates",
"offer",
"and",
"sends",
"to",
"peer",
"by",
"sending",
"sdp",
"string",
"to",
"server",
"else",
"notifies",
"server",
"... | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L123-L138 |
57,231 | AlphaReplica/Connecta | lib/client/source/connecta.js | onRTCFallback | function onRTCFallback(from,data,isArray)
{
var peer = getPeerByRTCId(from);
if(peer)
{
if(isArray == true)
{
data = sliceArray(data,0,data.length-2);// data.slice(0,data.length-2);
}
scope.dispatchEvent("peerMessage",{... | javascript | function onRTCFallback(from,data,isArray)
{
var peer = getPeerByRTCId(from);
if(peer)
{
if(isArray == true)
{
data = sliceArray(data,0,data.length-2);// data.slice(0,data.length-2);
}
scope.dispatchEvent("peerMessage",{... | [
"function",
"onRTCFallback",
"(",
"from",
",",
"data",
",",
"isArray",
")",
"{",
"var",
"peer",
"=",
"getPeerByRTCId",
"(",
"from",
")",
";",
"if",
"(",
"peer",
")",
"{",
"if",
"(",
"isArray",
"==",
"true",
")",
"{",
"data",
"=",
"sliceArray",
"(",
... | invoked when fallback message is received | [
"invoked",
"when",
"fallback",
"message",
"is",
"received"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L155-L167 |
57,232 | AlphaReplica/Connecta | lib/client/source/connecta.js | onServerMessage | function onServerMessage(data)
{
if(data.ev)
{
scope.dispatchEvent("onServerMessage",data);
scope.dispatchEvent(data.ev,data);
}
} | javascript | function onServerMessage(data)
{
if(data.ev)
{
scope.dispatchEvent("onServerMessage",data);
scope.dispatchEvent(data.ev,data);
}
} | [
"function",
"onServerMessage",
"(",
"data",
")",
"{",
"if",
"(",
"data",
".",
"ev",
")",
"{",
"scope",
".",
"dispatchEvent",
"(",
"\"onServerMessage\"",
",",
"data",
")",
";",
"scope",
".",
"dispatchEvent",
"(",
"data",
".",
"ev",
",",
"data",
")",
";"... | invoked when server message received | [
"invoked",
"when",
"server",
"message",
"received"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L176-L183 |
57,233 | AlphaReplica/Connecta | lib/client/source/connecta.js | onPeerConnected | function onPeerConnected(peer)
{
if(scope.localStream)
{
peer.updateStream(scope.localStream,false);
}
scope._servConn.sendRTCState(true,peer.id);
scope.dispatchEvent("peerConnected",peer.id);
} | javascript | function onPeerConnected(peer)
{
if(scope.localStream)
{
peer.updateStream(scope.localStream,false);
}
scope._servConn.sendRTCState(true,peer.id);
scope.dispatchEvent("peerConnected",peer.id);
} | [
"function",
"onPeerConnected",
"(",
"peer",
")",
"{",
"if",
"(",
"scope",
".",
"localStream",
")",
"{",
"peer",
".",
"updateStream",
"(",
"scope",
".",
"localStream",
",",
"false",
")",
";",
"}",
"scope",
".",
"_servConn",
".",
"sendRTCState",
"(",
"true... | invoked when peer connection, notifies server and resends offser if stream is enabled | [
"invoked",
"when",
"peer",
"connection",
"notifies",
"server",
"and",
"resends",
"offser",
"if",
"stream",
"is",
"enabled"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L201-L210 |
57,234 | AlphaReplica/Connecta | lib/client/source/connecta.js | onPeerFailed | function onPeerFailed(peer)
{
scope._servConn.sendRTCState(false,peer.id);
scope.dispatchEvent("peerFailed",peer.id);
} | javascript | function onPeerFailed(peer)
{
scope._servConn.sendRTCState(false,peer.id);
scope.dispatchEvent("peerFailed",peer.id);
} | [
"function",
"onPeerFailed",
"(",
"peer",
")",
"{",
"scope",
".",
"_servConn",
".",
"sendRTCState",
"(",
"false",
",",
"peer",
".",
"id",
")",
";",
"scope",
".",
"dispatchEvent",
"(",
"\"peerFailed\"",
",",
"peer",
".",
"id",
")",
";",
"}"
] | invoked when peer fails to connect | [
"invoked",
"when",
"peer",
"fails",
"to",
"connect"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L213-L217 |
57,235 | AlphaReplica/Connecta | lib/client/source/connecta.js | onPeerClose | function onPeerClose(peer)
{
var id = peer.id;
scope.removePeer(peer);
sendPeerClose(id);
scope.dispatchEvent("peerDisconnected",id);
} | javascript | function onPeerClose(peer)
{
var id = peer.id;
scope.removePeer(peer);
sendPeerClose(id);
scope.dispatchEvent("peerDisconnected",id);
} | [
"function",
"onPeerClose",
"(",
"peer",
")",
"{",
"var",
"id",
"=",
"peer",
".",
"id",
";",
"scope",
".",
"removePeer",
"(",
"peer",
")",
";",
"sendPeerClose",
"(",
"id",
")",
";",
"scope",
".",
"dispatchEvent",
"(",
"\"peerDisconnected\"",
",",
"id",
... | invoked when peer closes, this will remove peer from dictionary | [
"invoked",
"when",
"peer",
"closes",
"this",
"will",
"remove",
"peer",
"from",
"dictionary"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L220-L227 |
57,236 | AlphaReplica/Connecta | lib/client/source/connecta.js | onIceCandidate | function onIceCandidate(id,data)
{
if(scope.hasWebRTCSupport())
{
getOrCreatePeer(id).onServerMessage(JSON.parse(data));
}
} | javascript | function onIceCandidate(id,data)
{
if(scope.hasWebRTCSupport())
{
getOrCreatePeer(id).onServerMessage(JSON.parse(data));
}
} | [
"function",
"onIceCandidate",
"(",
"id",
",",
"data",
")",
"{",
"if",
"(",
"scope",
".",
"hasWebRTCSupport",
"(",
")",
")",
"{",
"getOrCreatePeer",
"(",
"id",
")",
".",
"onServerMessage",
"(",
"JSON",
".",
"parse",
"(",
"data",
")",
")",
";",
"}",
"}... | invoked when peer creates ice candidate and it's ready to send | [
"invoked",
"when",
"peer",
"creates",
"ice",
"candidate",
"and",
"it",
"s",
"ready",
"to",
"send"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L266-L272 |
57,237 | AlphaReplica/Connecta | lib/client/source/connecta.js | onPeerMessage | function onPeerMessage(peer,msg)
{
scope.dispatchEvent("peerMessage",{message:msg,id:peer.id,rtc:peer.rtcId,array:false,fallback:false});
} | javascript | function onPeerMessage(peer,msg)
{
scope.dispatchEvent("peerMessage",{message:msg,id:peer.id,rtc:peer.rtcId,array:false,fallback:false});
} | [
"function",
"onPeerMessage",
"(",
"peer",
",",
"msg",
")",
"{",
"scope",
".",
"dispatchEvent",
"(",
"\"peerMessage\"",
",",
"{",
"message",
":",
"msg",
",",
"id",
":",
"peer",
".",
"id",
",",
"rtc",
":",
"peer",
".",
"rtcId",
",",
"array",
":",
"fals... | invoked when string message received from peer | [
"invoked",
"when",
"string",
"message",
"received",
"from",
"peer"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L275-L278 |
57,238 | AlphaReplica/Connecta | lib/client/source/connecta.js | onBytesMessage | function onBytesMessage(peer,data)
{
var arr = bufferToArray(scope._servConn.byteType,data);
if(arr)
{
if(scope._servConn.rtcFallback == true)
{
arr = arr.slice(0,arr.length-2);
}
scope.dispatchEvent("peerMessage",{message:arr,... | javascript | function onBytesMessage(peer,data)
{
var arr = bufferToArray(scope._servConn.byteType,data);
if(arr)
{
if(scope._servConn.rtcFallback == true)
{
arr = arr.slice(0,arr.length-2);
}
scope.dispatchEvent("peerMessage",{message:arr,... | [
"function",
"onBytesMessage",
"(",
"peer",
",",
"data",
")",
"{",
"var",
"arr",
"=",
"bufferToArray",
"(",
"scope",
".",
"_servConn",
".",
"byteType",
",",
"data",
")",
";",
"if",
"(",
"arr",
")",
"{",
"if",
"(",
"scope",
".",
"_servConn",
".",
"rtcF... | invoked when byte message received from peer | [
"invoked",
"when",
"byte",
"message",
"received",
"from",
"peer"
] | bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0 | https://github.com/AlphaReplica/Connecta/blob/bc0ce3fa1ef5ef07526633da5668dcaff5ef29e0/lib/client/source/connecta.js#L281-L293 |
57,239 | compose-ui/dialog | index.js | addText | function addText() {
// Add title
dialogEl.querySelector( '#dialog-title' ).innerHTML = options.title
// Add optional description
var descriptionEl = dialogEl.querySelector( '#dialog-description' )
if ( options.description ) {
descriptionEl.innerHTML = options.description
} else {
descriptionEl.p... | javascript | function addText() {
// Add title
dialogEl.querySelector( '#dialog-title' ).innerHTML = options.title
// Add optional description
var descriptionEl = dialogEl.querySelector( '#dialog-description' )
if ( options.description ) {
descriptionEl.innerHTML = options.description
} else {
descriptionEl.p... | [
"function",
"addText",
"(",
")",
"{",
"// Add title",
"dialogEl",
".",
"querySelector",
"(",
"'#dialog-title'",
")",
".",
"innerHTML",
"=",
"options",
".",
"title",
"// Add optional description",
"var",
"descriptionEl",
"=",
"dialogEl",
".",
"querySelector",
"(",
... | Add title and description from options | [
"Add",
"title",
"and",
"description",
"from",
"options"
] | 5d085394c4414d12ade5b7c864cbef80e2837f44 | https://github.com/compose-ui/dialog/blob/5d085394c4414d12ade5b7c864cbef80e2837f44/index.js#L56-L71 |
57,240 | compose-ui/dialog | index.js | tab | function tab( event ) {
// Find all focusable elements in the dialog card
var focusable = dialogEl.querySelectorAll('input:not([type=hidden]), textarea, select, button'),
last = focusable[focusable.length - 1],
focused = document.activeElement
// If focused on the last focusable element... | javascript | function tab( event ) {
// Find all focusable elements in the dialog card
var focusable = dialogEl.querySelectorAll('input:not([type=hidden]), textarea, select, button'),
last = focusable[focusable.length - 1],
focused = document.activeElement
// If focused on the last focusable element... | [
"function",
"tab",
"(",
"event",
")",
"{",
"// Find all focusable elements in the dialog card",
"var",
"focusable",
"=",
"dialogEl",
".",
"querySelectorAll",
"(",
"'input:not([type=hidden]), textarea, select, button'",
")",
",",
"last",
"=",
"focusable",
"[",
"focusable",
... | In a modal window, `tab` must cycle between elements in the modal. | [
"In",
"a",
"modal",
"window",
"tab",
"must",
"cycle",
"between",
"elements",
"in",
"the",
"modal",
"."
] | 5d085394c4414d12ade5b7c864cbef80e2837f44 | https://github.com/compose-ui/dialog/blob/5d085394c4414d12ade5b7c864cbef80e2837f44/index.js#L98-L115 |
57,241 | muigui/useful-date | index.js | function( d ) { // ISO-8601 year number. This has the same value as Y, except that if the ISO
var m = d.getMonth(), w = DATE_PROTO.getISOWeek.call( d ); // week number (W) belongs to the previous or next year, that year is used instead.
return... | javascript | function( d ) { // ISO-8601 year number. This has the same value as Y, except that if the ISO
var m = d.getMonth(), w = DATE_PROTO.getISOWeek.call( d ); // week number (W) belongs to the previous or next year, that year is used instead.
return... | [
"function",
"(",
"d",
")",
"{",
"// ISO-8601 year number. This has the same value as Y, except that if the ISO",
"var",
"m",
"=",
"d",
".",
"getMonth",
"(",
")",
",",
"w",
"=",
"DATE_PROTO",
".",
"getISOWeek",
".",
"call",
"(",
"d",
")",
";",
"// week number (W) b... | Whether it's a leap year | [
"Whether",
"it",
"s",
"a",
"leap",
"year"
] | 1dd1e82767336f5394bfc38570480340348ba966 | https://github.com/muigui/useful-date/blob/1dd1e82767336f5394bfc38570480340348ba966/index.js#L761-L764 | |
57,242 | ItsAsbreuk/itsa-mojitonthefly-addon | examples/webapp using pjax/mojits/Navigation/controller.server.js | function(ac) {
var data = {},
selectedmojit = ac.params.getFromRoute('mojit') || 'none';
data[selectedmojit] = true;
ac.assets.addCss('./index.css');
ac.done(data);
} | javascript | function(ac) {
var data = {},
selectedmojit = ac.params.getFromRoute('mojit') || 'none';
data[selectedmojit] = true;
ac.assets.addCss('./index.css');
ac.done(data);
} | [
"function",
"(",
"ac",
")",
"{",
"var",
"data",
"=",
"{",
"}",
",",
"selectedmojit",
"=",
"ac",
".",
"params",
".",
"getFromRoute",
"(",
"'mojit'",
")",
"||",
"'none'",
";",
"data",
"[",
"selectedmojit",
"]",
"=",
"true",
";",
"ac",
".",
"assets",
... | Method corresponding to the 'index' action.
@param ac {Object} The ActionContext that provides access
to the Mojito API. | [
"Method",
"corresponding",
"to",
"the",
"index",
"action",
"."
] | 500de397fef8f80f719360d4ac023bb860934ec0 | https://github.com/ItsAsbreuk/itsa-mojitonthefly-addon/blob/500de397fef8f80f719360d4ac023bb860934ec0/examples/webapp using pjax/mojits/Navigation/controller.server.js#L24-L30 | |
57,243 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb/lib/bulk/ordered.js | executeCommands | function executeCommands(bulkOperation, options, callback) {
if (bulkOperation.s.batches.length === 0) {
return handleCallback(callback, null, new BulkWriteResult(bulkOperation.s.bulkResult));
}
// Ordered execution of the command
const batch = bulkOperation.s.batches.shift();
function resultHandler(err... | javascript | function executeCommands(bulkOperation, options, callback) {
if (bulkOperation.s.batches.length === 0) {
return handleCallback(callback, null, new BulkWriteResult(bulkOperation.s.bulkResult));
}
// Ordered execution of the command
const batch = bulkOperation.s.batches.shift();
function resultHandler(err... | [
"function",
"executeCommands",
"(",
"bulkOperation",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"bulkOperation",
".",
"s",
".",
"batches",
".",
"length",
"===",
"0",
")",
"{",
"return",
"handleCallback",
"(",
"callback",
",",
"null",
",",
"new",... | Execute next write command in a chain
@param {OrderedBulkOperation} bulkOperation
@param {object} options
@param {function} callback | [
"Execute",
"next",
"write",
"command",
"in",
"a",
"chain"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/bulk/ordered.js#L132-L166 |
57,244 | mthadley/magnet-plugin-sass | src/index.js | serveSassFiles | function serveSassFiles(magnet, outputDir) {
if (!isServingSassFiles) {
magnet.getServer()
.getEngine()
.use('/css', express.static(outputDir));
}
isServingSassFiles = true;
} | javascript | function serveSassFiles(magnet, outputDir) {
if (!isServingSassFiles) {
magnet.getServer()
.getEngine()
.use('/css', express.static(outputDir));
}
isServingSassFiles = true;
} | [
"function",
"serveSassFiles",
"(",
"magnet",
",",
"outputDir",
")",
"{",
"if",
"(",
"!",
"isServingSassFiles",
")",
"{",
"magnet",
".",
"getServer",
"(",
")",
".",
"getEngine",
"(",
")",
".",
"use",
"(",
"'/css'",
",",
"express",
".",
"static",
"(",
"o... | Serves built sass files using magnet server instance
@param {!Magnet} magnet
@param {!string} outputDir | [
"Serves",
"built",
"sass",
"files",
"using",
"magnet",
"server",
"instance"
] | 60323a1e590534954d813a13a08046eb3c12265f | https://github.com/mthadley/magnet-plugin-sass/blob/60323a1e590534954d813a13a08046eb3c12265f/src/index.js#L22-L29 |
57,245 | mthadley/magnet-plugin-sass | src/index.js | getOutputFile | function getOutputFile(file, outputDir) {
const fileName = path.basename(file).replace('.scss', '.css');
return path.join(outputDir, fileName);
} | javascript | function getOutputFile(file, outputDir) {
const fileName = path.basename(file).replace('.scss', '.css');
return path.join(outputDir, fileName);
} | [
"function",
"getOutputFile",
"(",
"file",
",",
"outputDir",
")",
"{",
"const",
"fileName",
"=",
"path",
".",
"basename",
"(",
"file",
")",
".",
"replace",
"(",
"'.scss'",
",",
"'.css'",
")",
";",
"return",
"path",
".",
"join",
"(",
"outputDir",
",",
"f... | Gets the output file path for a file and a given
output directory.
@param {!string} file
@param {!string} outputDir
@return {!string} | [
"Gets",
"the",
"output",
"file",
"path",
"for",
"a",
"file",
"and",
"a",
"given",
"output",
"directory",
"."
] | 60323a1e590534954d813a13a08046eb3c12265f | https://github.com/mthadley/magnet-plugin-sass/blob/60323a1e590534954d813a13a08046eb3c12265f/src/index.js#L38-L41 |
57,246 | mthadley/magnet-plugin-sass | src/index.js | writeFile | function writeFile(file, css) {
return new Promise((resolve, reject) => {
fs.writeFile(file, css, err => {
if (err) {
return reject(err);
}
resolve();
})
});
} | javascript | function writeFile(file, css) {
return new Promise((resolve, reject) => {
fs.writeFile(file, css, err => {
if (err) {
return reject(err);
}
resolve();
})
});
} | [
"function",
"writeFile",
"(",
"file",
",",
"css",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"writeFile",
"(",
"file",
",",
"css",
",",
"err",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"retur... | Writes css to file
@param {!string} file
@param {!string} css
@return {!Promise} | [
"Writes",
"css",
"to",
"file"
] | 60323a1e590534954d813a13a08046eb3c12265f | https://github.com/mthadley/magnet-plugin-sass/blob/60323a1e590534954d813a13a08046eb3c12265f/src/index.js#L49-L58 |
57,247 | mthadley/magnet-plugin-sass | src/index.js | renderFile | function renderFile(file, config) {
const options = Object.assign({file}, config);
return new Promise((resolve, reject) => {
sass.render(options, (err, result) => {
if (err) {
return reject(err);
}
resolve(result.css);
});
});
} | javascript | function renderFile(file, config) {
const options = Object.assign({file}, config);
return new Promise((resolve, reject) => {
sass.render(options, (err, result) => {
if (err) {
return reject(err);
}
resolve(result.css);
});
});
} | [
"function",
"renderFile",
"(",
"file",
",",
"config",
")",
"{",
"const",
"options",
"=",
"Object",
".",
"assign",
"(",
"{",
"file",
"}",
",",
"config",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"sass",
... | Renders a single sass file
@param {!string} file
@param {!object} config
@return {!Promise.<string>} The resulting css | [
"Renders",
"a",
"single",
"sass",
"file"
] | 60323a1e590534954d813a13a08046eb3c12265f | https://github.com/mthadley/magnet-plugin-sass/blob/60323a1e590534954d813a13a08046eb3c12265f/src/index.js#L66-L77 |
57,248 | mthadley/magnet-plugin-sass | src/index.js | buildSassFiles | async function buildSassFiles(files, outputDir, config) {
const renderedFiles = await Promise.all(files.map(async file => {
const css = await renderFile(file, config);
return {file, css};
}));
await fs.ensureDir(outputDir);
return Promise.all(renderedFiles.map(({file, css}) => {
const outputFile =... | javascript | async function buildSassFiles(files, outputDir, config) {
const renderedFiles = await Promise.all(files.map(async file => {
const css = await renderFile(file, config);
return {file, css};
}));
await fs.ensureDir(outputDir);
return Promise.all(renderedFiles.map(({file, css}) => {
const outputFile =... | [
"async",
"function",
"buildSassFiles",
"(",
"files",
",",
"outputDir",
",",
"config",
")",
"{",
"const",
"renderedFiles",
"=",
"await",
"Promise",
".",
"all",
"(",
"files",
".",
"map",
"(",
"async",
"file",
"=>",
"{",
"const",
"css",
"=",
"await",
"rende... | Builds sass files to output dir
@param {!Array.<string>} files
@param {!string} outputDir
@param {!Object} config
@return {!Promise} | [
"Builds",
"sass",
"files",
"to",
"output",
"dir"
] | 60323a1e590534954d813a13a08046eb3c12265f | https://github.com/mthadley/magnet-plugin-sass/blob/60323a1e590534954d813a13a08046eb3c12265f/src/index.js#L86-L98 |
57,249 | Julien-Cousineau/util | src/index.js | range | function range(n,type) {
n = (typeof n !== 'undefined') ? n : 0;
if (!(Number.isInteger(n))) throw Error("Error in range: Value must be an integer");
let array;
if(type=='Uint8') array = new Uint8Array(n);
if(type=='Uint16') array = new Uint16Array(n);
if(type=='Uint32') array = new Uint32Array(n);
... | javascript | function range(n,type) {
n = (typeof n !== 'undefined') ? n : 0;
if (!(Number.isInteger(n))) throw Error("Error in range: Value must be an integer");
let array;
if(type=='Uint8') array = new Uint8Array(n);
if(type=='Uint16') array = new Uint16Array(n);
if(type=='Uint32') array = new Uint32Array(n);
... | [
"function",
"range",
"(",
"n",
",",
"type",
")",
"{",
"n",
"=",
"(",
"typeof",
"n",
"!==",
"'undefined'",
")",
"?",
"n",
":",
"0",
";",
"if",
"(",
"!",
"(",
"Number",
".",
"isInteger",
"(",
"n",
")",
")",
")",
"throw",
"Error",
"(",
"\"Error in... | module.exports.quickSort = quickSort; module.exports.quickSortIndices = quickSortIndices; | [
"module",
".",
"exports",
".",
"quickSort",
"=",
"quickSort",
";",
"module",
".",
"exports",
".",
"quickSortIndices",
"=",
"quickSortIndices",
";"
] | b52b841288a1d5eb5fd185a42664a75fba42e2da | https://github.com/Julien-Cousineau/util/blob/b52b841288a1d5eb5fd185a42664a75fba42e2da/src/index.js#L291-L307 |
57,250 | Psychopoulet/simplessl | lib/wrapperStdToString.js | _execution | function _execution (spawn, data, options) {
const match = data.match(WATING_STDIN);
if (match) {
if (-1 < match[1].indexOf("Country Name")) {
if (!options.country) {
options.country = match[2] ? match[2] : ".";
}
spawn.stdin.write(options.country + "\n");
}
else if (-1 < match[1].in... | javascript | function _execution (spawn, data, options) {
const match = data.match(WATING_STDIN);
if (match) {
if (-1 < match[1].indexOf("Country Name")) {
if (!options.country) {
options.country = match[2] ? match[2] : ".";
}
spawn.stdin.write(options.country + "\n");
}
else if (-1 < match[1].in... | [
"function",
"_execution",
"(",
"spawn",
",",
"data",
",",
"options",
")",
"{",
"const",
"match",
"=",
"data",
".",
"match",
"(",
"WATING_STDIN",
")",
";",
"if",
"(",
"match",
")",
"{",
"if",
"(",
"-",
"1",
"<",
"match",
"[",
"1",
"]",
".",
"index... | methods
Execute method
@param {child_process} spawn : std process
@param {string} data : data to check
@param {object} options : options for execution
@returns {any} Cloned data | [
"methods",
"Execute",
"method"
] | 22872f3429510a45260ba73158dfdcc44df80700 | https://github.com/Psychopoulet/simplessl/blob/22872f3429510a45260ba73158dfdcc44df80700/lib/wrapperStdToString.js#L27-L98 |
57,251 | panarch/famous-mig | surfaces/CanvasSurface.js | CanvasSurface | function CanvasSurface(options) {
if (options)
options.useTarget = true;
else
options = { useTarget: true };
if (options.canvasSize) this._canvasSize = options.canvasSize;
Surface.apply(this, arguments);
if (!this._canvasSize) this._canvasSize = this.getSize();
this._backBuffer ... | javascript | function CanvasSurface(options) {
if (options)
options.useTarget = true;
else
options = { useTarget: true };
if (options.canvasSize) this._canvasSize = options.canvasSize;
Surface.apply(this, arguments);
if (!this._canvasSize) this._canvasSize = this.getSize();
this._backBuffer ... | [
"function",
"CanvasSurface",
"(",
"options",
")",
"{",
"if",
"(",
"options",
")",
"options",
".",
"useTarget",
"=",
"true",
";",
"else",
"options",
"=",
"{",
"useTarget",
":",
"true",
"}",
";",
"if",
"(",
"options",
".",
"canvasSize",
")",
"this",
".",... | A surface containing an HTML5 Canvas element.
This extends the Surface class.
@class CanvasSurface
@extends Surface
@constructor
@param {Object} [options] overrides of default options
@param {Array.Number} [options.canvasSize] [width, height] for document element | [
"A",
"surface",
"containing",
"an",
"HTML5",
"Canvas",
"element",
".",
"This",
"extends",
"the",
"Surface",
"class",
"."
] | a241d9955d20ceb0fe3ce0a1fb13e9961e1c6878 | https://github.com/panarch/famous-mig/blob/a241d9955d20ceb0fe3ce0a1fb13e9961e1c6878/surfaces/CanvasSurface.js#L17-L32 |
57,252 | melvincarvalho/rdf-shell | lib/cat.js | cat | function cat(uri, callback) {
if (!uri) {
callback(new Error('URI is required'))
}
util.get(uri, function(err, val, uri) {
callback(null, val, uri)
})
} | javascript | function cat(uri, callback) {
if (!uri) {
callback(new Error('URI is required'))
}
util.get(uri, function(err, val, uri) {
callback(null, val, uri)
})
} | [
"function",
"cat",
"(",
"uri",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"uri",
")",
"{",
"callback",
"(",
"new",
"Error",
"(",
"'URI is required'",
")",
")",
"}",
"util",
".",
"get",
"(",
"uri",
",",
"function",
"(",
"err",
",",
"val",
",",
"ur... | cat gets the turtle for a uri
@param {string} uri The URI to get
@param {Function} callback Callback with text and uri | [
"cat",
"gets",
"the",
"turtle",
"for",
"a",
"uri"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/cat.js#L10-L17 |
57,253 | nightshiftjs/nightshift-core | src/utils/functions.js | getParamNames | function getParamNames(fn) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var fnString = fn.toString().replace(STRIP_COMMENTS, '');
var result = fnString.slice(fnString.indexOf('(') + 1, fnString.indexOf(')')).match(/([^\s,]+)/g);
return result || [];
} | javascript | function getParamNames(fn) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var fnString = fn.toString().replace(STRIP_COMMENTS, '');
var result = fnString.slice(fnString.indexOf('(') + 1, fnString.indexOf(')')).match(/([^\s,]+)/g);
return result || [];
} | [
"function",
"getParamNames",
"(",
"fn",
")",
"{",
"var",
"STRIP_COMMENTS",
"=",
"/",
"((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))",
"/",
"mg",
";",
"var",
"fnString",
"=",
"fn",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"STRIP_COMMENTS",
",",
"''",
")",
";"... | This method returns an array listing the names of the parameters of the given function. The array is empty if the
function does not expect any parameter.
@param {function} fn the function to retrieve the parameters names for
@returns {Array|{index: number, input: string}} an array listing the names of the parameters o... | [
"This",
"method",
"returns",
"an",
"array",
"listing",
"the",
"names",
"of",
"the",
"parameters",
"of",
"the",
"given",
"function",
".",
"The",
"array",
"is",
"empty",
"if",
"the",
"function",
"does",
"not",
"expect",
"any",
"parameter",
"."
] | e1dc28b4d551c71dfb09d5b1e939a44d922a89d7 | https://github.com/nightshiftjs/nightshift-core/blob/e1dc28b4d551c71dfb09d5b1e939a44d922a89d7/src/utils/functions.js#L33-L38 |
57,254 | aashay/node-bart | lib/bart.js | merge_objects | function merge_objects(obj1,obj2){
var obj3 = {};
for (var attrname1 in obj1) { obj3[attrname1] = obj1[attrname1]; }
for (var attrname2 in obj2) { obj3[attrname2] = obj2[attrname2]; }
return obj3;
} | javascript | function merge_objects(obj1,obj2){
var obj3 = {};
for (var attrname1 in obj1) { obj3[attrname1] = obj1[attrname1]; }
for (var attrname2 in obj2) { obj3[attrname2] = obj2[attrname2]; }
return obj3;
} | [
"function",
"merge_objects",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"obj3",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"attrname1",
"in",
"obj1",
")",
"{",
"obj3",
"[",
"attrname1",
"]",
"=",
"obj1",
"[",
"attrname1",
"]",
";",
"}",
"for",
"(",
"... | Convenience function to smash two objects together.
@param obj1
@param obj2
@returns obj3, a merged object | [
"Convenience",
"function",
"to",
"smash",
"two",
"objects",
"together",
"."
] | a9fea7e7adb59d44628c05b54547c347c1accd6e | https://github.com/aashay/node-bart/blob/a9fea7e7adb59d44628c05b54547c347c1accd6e/lib/bart.js#L20-L25 |
57,255 | assemble/assemble-fs | index.js | toFiles | function toFiles(app, options) {
let opts = Object.assign({ collection: null }, options);
let name = opts.collection;
let collection = app.collections ? name && app[name] : app;
let view;
if (!collection && name) {
collection = app.create(name, opts);
}
return utils.through.obj(async (file, enc, nex... | javascript | function toFiles(app, options) {
let opts = Object.assign({ collection: null }, options);
let name = opts.collection;
let collection = app.collections ? name && app[name] : app;
let view;
if (!collection && name) {
collection = app.create(name, opts);
}
return utils.through.obj(async (file, enc, nex... | [
"function",
"toFiles",
"(",
"app",
",",
"options",
")",
"{",
"let",
"opts",
"=",
"Object",
".",
"assign",
"(",
"{",
"collection",
":",
"null",
"}",
",",
"options",
")",
";",
"let",
"name",
"=",
"opts",
".",
"collection",
";",
"let",
"collection",
"="... | Make sure vinyl files are assemble files, and add
them to a collection, if specified. | [
"Make",
"sure",
"vinyl",
"files",
"are",
"assemble",
"files",
"and",
"add",
"them",
"to",
"a",
"collection",
"if",
"specified",
"."
] | 708e393935d52bf75659905ca1d658f92c362d7c | https://github.com/assemble/assemble-fs/blob/708e393935d52bf75659905ca1d658f92c362d7c/index.js#L129-L166 |
57,256 | EpiphanySoft/assertly | inspect.js | inspect | function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments[2] !== undefined) ctx.depth = arguments[2];
if (arguments[3] !== undefined) ctx.colors = arguments[3];
if (typeof opts === 'boolean') {
// legacy...
ctx.showHidden =... | javascript | function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments[2] !== undefined) ctx.depth = arguments[2];
if (arguments[3] !== undefined) ctx.colors = arguments[3];
if (typeof opts === 'boolean') {
// legacy...
ctx.showHidden =... | [
"function",
"inspect",
"(",
"obj",
",",
"opts",
")",
"{",
"// default options",
"var",
"ctx",
"=",
"{",
"seen",
":",
"[",
"]",
",",
"stylize",
":",
"stylizeNoColor",
"}",
";",
"// legacy...",
"if",
"(",
"arguments",
"[",
"2",
"]",
"!==",
"undefined",
"... | Echos the value of a value. Tries to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output.
/* legacy: obj, showHidden, depth, colors | [
"Echos",
"the",
"value",
"of",
"a",
"value",
".",
"Tries",
"to",
"print",
"the",
"value",
"out",
"in",
"the",
"best",
"way",
"possible",
"given",
"the",
"different",
"types",
"."
] | 04a62335eb0ebba5308a9b5d2059ee38bcaf1444 | https://github.com/EpiphanySoft/assertly/blob/04a62335eb0ebba5308a9b5d2059ee38bcaf1444/inspect.js#L176-L194 |
57,257 | jtheriault/code-copter-analyzer-jscs | src/index.js | getJscsrc | function getJscsrc () {
var jscsrcPath = process.cwd() + '/.jscsrc';
try {
return JSON.parse(fs.readFileSync(jscsrcPath, 'utf8'));
}
catch (error) {
throw new Error(`Expected to find JSCS configuration ${jscsrcPath}; saw error "${error.message}". Cannot run JSCS analysis.`, error);
... | javascript | function getJscsrc () {
var jscsrcPath = process.cwd() + '/.jscsrc';
try {
return JSON.parse(fs.readFileSync(jscsrcPath, 'utf8'));
}
catch (error) {
throw new Error(`Expected to find JSCS configuration ${jscsrcPath}; saw error "${error.message}". Cannot run JSCS analysis.`, error);
... | [
"function",
"getJscsrc",
"(",
")",
"{",
"var",
"jscsrcPath",
"=",
"process",
".",
"cwd",
"(",
")",
"+",
"'/.jscsrc'",
";",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"jscsrcPath",
",",
"'utf8'",
")",
")",
";",
"}... | Get the object representation of the configuration in .jscsrc in the project
root. | [
"Get",
"the",
"object",
"representation",
"of",
"the",
"configuration",
"in",
".",
"jscsrc",
"in",
"the",
"project",
"root",
"."
] | 81ee8300c1e6017e7e2f3b4ac880bca6f124d601 | https://github.com/jtheriault/code-copter-analyzer-jscs/blob/81ee8300c1e6017e7e2f3b4ac880bca6f124d601/src/index.js#L50-L59 |
57,258 | allanmboyd/formaterrors | lib/formatErrors.js | filterMatch | function filterMatch(s, regExps) {
if (!regExps) {
return false;
}
var match = false;
for (var i = 0; i < regExps.length && !match; i++) {
match = s.match(regExps[i]) !== null;
}
return match;
} | javascript | function filterMatch(s, regExps) {
if (!regExps) {
return false;
}
var match = false;
for (var i = 0; i < regExps.length && !match; i++) {
match = s.match(regExps[i]) !== null;
}
return match;
} | [
"function",
"filterMatch",
"(",
"s",
",",
"regExps",
")",
"{",
"if",
"(",
"!",
"regExps",
")",
"{",
"return",
"false",
";",
"}",
"var",
"match",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"regExps",
".",
"length",
"&&",
... | Determine if a provided array of regular expressions includes a match for a provided String.
@method filterMatch
@private
@param {String} s the String
@param {String[]} regExps an array of reg. exp. Strings
@return {Boolean} true if a match is found; false otherwise | [
"Determine",
"if",
"a",
"provided",
"array",
"of",
"regular",
"expressions",
"includes",
"a",
"match",
"for",
"a",
"provided",
"String",
"."
] | 83c6f0c9d6334e706549db848174fc901e6ce5c3 | https://github.com/allanmboyd/formaterrors/blob/83c6f0c9d6334e706549db848174fc901e6ce5c3/lib/formatErrors.js#L323-L333 |
57,259 | allanmboyd/formaterrors | lib/formatErrors.js | isError | function isError(error) {
return error && (Object.prototype.toString.call(error).slice(8, -1) === "Error" ||
(typeof error.stack !== "undefined" && typeof error.name !== "undefined"));
} | javascript | function isError(error) {
return error && (Object.prototype.toString.call(error).slice(8, -1) === "Error" ||
(typeof error.stack !== "undefined" && typeof error.name !== "undefined"));
} | [
"function",
"isError",
"(",
"error",
")",
"{",
"return",
"error",
"&&",
"(",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"error",
")",
".",
"slice",
"(",
"8",
",",
"-",
"1",
")",
"===",
"\"Error\"",
"||",
"(",
"typeof",
"error",
... | Determine if a given parameter is an Error.
@method isError
@private
@param {Error} error the prospective Error
@return {Boolean} true is 'error' is an Error; false otherwise | [
"Determine",
"if",
"a",
"given",
"parameter",
"is",
"an",
"Error",
"."
] | 83c6f0c9d6334e706549db848174fc901e6ce5c3 | https://github.com/allanmboyd/formaterrors/blob/83c6f0c9d6334e706549db848174fc901e6ce5c3/lib/formatErrors.js#L402-L405 |
57,260 | allanmboyd/formaterrors | lib/formatErrors.js | diffToMessage | function diffToMessage(diffedAssertionError) {
var diff = diffedAssertionError.diff;
var actual = "";
var expected = "";
for (var i = 0; i < diff.length; i++) {
var diffType = diff[i][0];
if (diffType === 1) {
if (actual.length > 0) {
actual += ", ";
... | javascript | function diffToMessage(diffedAssertionError) {
var diff = diffedAssertionError.diff;
var actual = "";
var expected = "";
for (var i = 0; i < diff.length; i++) {
var diffType = diff[i][0];
if (diffType === 1) {
if (actual.length > 0) {
actual += ", ";
... | [
"function",
"diffToMessage",
"(",
"diffedAssertionError",
")",
"{",
"var",
"diff",
"=",
"diffedAssertionError",
".",
"diff",
";",
"var",
"actual",
"=",
"\"\"",
";",
"var",
"expected",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"... | Given an AssertionError that has had diffs applied - and that means it has a diff property - provide the message
for the AssertionError including details of the diffs.
@method diffToMessage
@private
@param {AssertionError} diffedAssertionError an AssertionError that has a diff property containing diffs between the exp... | [
"Given",
"an",
"AssertionError",
"that",
"has",
"had",
"diffs",
"applied",
"-",
"and",
"that",
"means",
"it",
"has",
"a",
"diff",
"property",
"-",
"provide",
"the",
"message",
"for",
"the",
"AssertionError",
"including",
"details",
"of",
"the",
"diffs",
"."
... | 83c6f0c9d6334e706549db848174fc901e6ce5c3 | https://github.com/allanmboyd/formaterrors/blob/83c6f0c9d6334e706549db848174fc901e6ce5c3/lib/formatErrors.js#L547-L578 |
57,261 | greggman/hft-sample-ui | src/hft/scripts/commonui.js | function() {
if (!fullScreen.isFullScreen()) {
touchStartElement.removeEventListener('touchstart', requestFullScreen, false);
touchStartElement.style.display = "none";
fullScreen.requestFullScreen(document.body);
}
} | javascript | function() {
if (!fullScreen.isFullScreen()) {
touchStartElement.removeEventListener('touchstart', requestFullScreen, false);
touchStartElement.style.display = "none";
fullScreen.requestFullScreen(document.body);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"fullScreen",
".",
"isFullScreen",
"(",
")",
")",
"{",
"touchStartElement",
".",
"removeEventListener",
"(",
"'touchstart'",
",",
"requestFullScreen",
",",
"false",
")",
";",
"touchStartElement",
".",
"style",
".",
... | setup full screen support | [
"setup",
"full",
"screen",
"support"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/commonui.js#L220-L226 | |
57,262 | huafu/ember-dev-fixtures | private/utils/dev-fixtures/adapter.js | function (name) {
if (!this.instances[name]) {
this.instances[name] = DevFixturesAdapter.create({name: name});
}
return this.instances[name];
} | javascript | function (name) {
if (!this.instances[name]) {
this.instances[name] = DevFixturesAdapter.create({name: name});
}
return this.instances[name];
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"this",
".",
"instances",
"[",
"name",
"]",
")",
"{",
"this",
".",
"instances",
"[",
"name",
"]",
"=",
"DevFixturesAdapter",
".",
"create",
"(",
"{",
"name",
":",
"name",
"}",
")",
";",
"}",
"ret... | Get or create the singleton instance for given adapter name
@method for
@param {string} name
@return {DevFixturesAdapter} | [
"Get",
"or",
"create",
"the",
"singleton",
"instance",
"for",
"given",
"adapter",
"name"
] | 811ed4d339c2dc840d5b297b5b244726cf1339ca | https://github.com/huafu/ember-dev-fixtures/blob/811ed4d339c2dc840d5b297b5b244726cf1339ca/private/utils/dev-fixtures/adapter.js#L131-L136 | |
57,263 | altshift/altshift | lib/altshift/core/base.js | format | function format(string, args) {
if (
string.length === 0 ||
!args ||
Object.keys(args).length === 0
) {
return string;
}
var matchVar = '[0-9a-zA-Z_$\\.]+',
matchBrackets = '\\[[^\\]]*\\]',
matchParsing = new RegExp(
//"^" +
"((" + ... | javascript | function format(string, args) {
if (
string.length === 0 ||
!args ||
Object.keys(args).length === 0
) {
return string;
}
var matchVar = '[0-9a-zA-Z_$\\.]+',
matchBrackets = '\\[[^\\]]*\\]',
matchParsing = new RegExp(
//"^" +
"((" + ... | [
"function",
"format",
"(",
"string",
",",
"args",
")",
"{",
"if",
"(",
"string",
".",
"length",
"===",
"0",
"||",
"!",
"args",
"||",
"Object",
".",
"keys",
"(",
"args",
")",
".",
"length",
"===",
"0",
")",
"{",
"return",
"string",
";",
"}",
"var"... | Format string with `args`
@see http://docs.python.org/release/3.1.3/library/string.html#format-string-syntax
@param {string} string
@param {Array|Object} args
@return {string} | [
"Format",
"string",
"with",
"args"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L133-L182 |
57,264 | altshift/altshift | lib/altshift/core/base.js | mixin | function mixin(obj, props) {
var argi = 1,
argc = arguments.length,
source, property, value;
if (!obj) {
obj = {};
}
while (argi < argc) {
source = arguments[argi];
for (property in source) {
if (source.hasOwnProperty(property)) {
val... | javascript | function mixin(obj, props) {
var argi = 1,
argc = arguments.length,
source, property, value;
if (!obj) {
obj = {};
}
while (argi < argc) {
source = arguments[argi];
for (property in source) {
if (source.hasOwnProperty(property)) {
val... | [
"function",
"mixin",
"(",
"obj",
",",
"props",
")",
"{",
"var",
"argi",
"=",
"1",
",",
"argc",
"=",
"arguments",
".",
"length",
",",
"source",
",",
"property",
",",
"value",
";",
"if",
"(",
"!",
"obj",
")",
"{",
"obj",
"=",
"{",
"}",
";",
"}",
... | Mix all props, ... into `obj`
@param {Object} obj
@param {Object} props
@return {Object} | [
"Mix",
"all",
"props",
"...",
"into",
"obj"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L191-L213 |
57,265 | altshift/altshift | lib/altshift/core/base.js | isObject | function isObject(obj) {
return obj !== undefined &&
(obj === null || typeof obj === "object" ||
typeof obj === "array" || obj instanceof Array ||
Object.prototype.toString.call(obj) === "[object Function]"
);
} | javascript | function isObject(obj) {
return obj !== undefined &&
(obj === null || typeof obj === "object" ||
typeof obj === "array" || obj instanceof Array ||
Object.prototype.toString.call(obj) === "[object Function]"
);
} | [
"function",
"isObject",
"(",
"obj",
")",
"{",
"return",
"obj",
"!==",
"undefined",
"&&",
"(",
"obj",
"===",
"null",
"||",
"typeof",
"obj",
"===",
"\"object\"",
"||",
"typeof",
"obj",
"===",
"\"array\"",
"||",
"obj",
"instanceof",
"Array",
"||",
"Object",
... | Return true if `obj` is an Object
@param {*} obj
@return {boolean} | [
"Return",
"true",
"if",
"obj",
"is",
"an",
"Object"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L251-L257 |
57,266 | altshift/altshift | lib/altshift/core/base.js | isScalar | function isScalar(obj) {
var type = typeof obj;
return (type !== 'undefined' && (
obj === null ||
type === 'string' ||
type === 'number' ||
type === 'boolean'
));
} | javascript | function isScalar(obj) {
var type = typeof obj;
return (type !== 'undefined' && (
obj === null ||
type === 'string' ||
type === 'number' ||
type === 'boolean'
));
} | [
"function",
"isScalar",
"(",
"obj",
")",
"{",
"var",
"type",
"=",
"typeof",
"obj",
";",
"return",
"(",
"type",
"!==",
"'undefined'",
"&&",
"(",
"obj",
"===",
"null",
"||",
"type",
"===",
"'string'",
"||",
"type",
"===",
"'number'",
"||",
"type",
"===",... | Return true if `obj` is a scalar
@param {*} obj
@return {boolean} | [
"Return",
"true",
"if",
"obj",
"is",
"a",
"scalar"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L265-L273 |
57,267 | altshift/altshift | lib/altshift/core/base.js | destroy | function destroy(object) {
if (isObject(object)) {
if (isFunction(object.finalize)) {
object.finalize();
}
for (var property in object) {
if (true) {//For lint
delete object[property];
}
}
}
} | javascript | function destroy(object) {
if (isObject(object)) {
if (isFunction(object.finalize)) {
object.finalize();
}
for (var property in object) {
if (true) {//For lint
delete object[property];
}
}
}
} | [
"function",
"destroy",
"(",
"object",
")",
"{",
"if",
"(",
"isObject",
"(",
"object",
")",
")",
"{",
"if",
"(",
"isFunction",
"(",
"object",
".",
"finalize",
")",
")",
"{",
"object",
".",
"finalize",
"(",
")",
";",
"}",
"for",
"(",
"var",
"property... | Will destroy object
@param {Object} object
@return undefined | [
"Will",
"destroy",
"object"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L281-L292 |
57,268 | altshift/altshift | lib/altshift/core/base.js | clone | function clone(obj, deep) {
if (!obj || typeof obj !== "object" || isFunction(obj)) {
// null, undefined, any non-object, or function
return obj; // anything
}
if (obj instanceof Date) {
// Date
return new Date(obj.getTime()); // Date
}
var result, index, length,... | javascript | function clone(obj, deep) {
if (!obj || typeof obj !== "object" || isFunction(obj)) {
// null, undefined, any non-object, or function
return obj; // anything
}
if (obj instanceof Date) {
// Date
return new Date(obj.getTime()); // Date
}
var result, index, length,... | [
"function",
"clone",
"(",
"obj",
",",
"deep",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"typeof",
"obj",
"!==",
"\"object\"",
"||",
"isFunction",
"(",
"obj",
")",
")",
"{",
"// null, undefined, any non-object, or function",
"return",
"obj",
";",
"// anything",
... | Clone an object
@param {*} obj
@return {*} | [
"Clone",
"an",
"object"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L301-L354 |
57,269 | altshift/altshift | lib/altshift/core/base.js | forEach | function forEach(object, iterator, thisp) {
if (object) {
if (object.forEach) {
object.forEach(iterator, thisp);
return;
}
//Default implementation
if (! (iterator instanceof Function)) {
throw new TypeError('iterator should be a Function');
... | javascript | function forEach(object, iterator, thisp) {
if (object) {
if (object.forEach) {
object.forEach(iterator, thisp);
return;
}
//Default implementation
if (! (iterator instanceof Function)) {
throw new TypeError('iterator should be a Function');
... | [
"function",
"forEach",
"(",
"object",
",",
"iterator",
",",
"thisp",
")",
"{",
"if",
"(",
"object",
")",
"{",
"if",
"(",
"object",
".",
"forEach",
")",
"{",
"object",
".",
"forEach",
"(",
"iterator",
",",
"thisp",
")",
";",
"return",
";",
"}",
"//D... | Iterate on object
@param {*} object
@param {Function} iterator
@param {*} thisp
@return undefined | [
"Iterate",
"on",
"object"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L364-L391 |
57,270 | altshift/altshift | lib/altshift/core/base.js | hash | function hash(object) {
if (object === undefined || isScalar(object)) {
return '' + object;
}
if (object.hash) {
return object.hash();
}
//Default implementation
var hashes = [],
value, key, hashKey, hashValue;
for (key in object) {
if (object.hasOwnPropert... | javascript | function hash(object) {
if (object === undefined || isScalar(object)) {
return '' + object;
}
if (object.hash) {
return object.hash();
}
//Default implementation
var hashes = [],
value, key, hashKey, hashValue;
for (key in object) {
if (object.hasOwnPropert... | [
"function",
"hash",
"(",
"object",
")",
"{",
"if",
"(",
"object",
"===",
"undefined",
"||",
"isScalar",
"(",
"object",
")",
")",
"{",
"return",
"''",
"+",
"object",
";",
"}",
"if",
"(",
"object",
".",
"hash",
")",
"{",
"return",
"object",
".",
"has... | Return a hash string for the object
@param {*} object
@return {String} | [
"Return",
"a",
"hash",
"string",
"for",
"the",
"object"
] | 5c051157e6f558636c8e12081b6707caa66249de | https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/base.js#L399-L423 |
57,271 | dazeus/dazeus-nodejs | dazeus.js | function (options, onConnect) {
var self = this;
EventEmitter.call(this);
this.options = options;
// debugging
this.debug_enabled = options.debug;
this.handshook = false;
// received data which could not be parsed into messages yet
this.data = '';
// determine correct call of net... | javascript | function (options, onConnect) {
var self = this;
EventEmitter.call(this);
this.options = options;
// debugging
this.debug_enabled = options.debug;
this.handshook = false;
// received data which could not be parsed into messages yet
this.data = '';
// determine correct call of net... | [
"function",
"(",
"options",
",",
"onConnect",
")",
"{",
"var",
"self",
"=",
"this",
";",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"options",
"=",
"options",
";",
"// debugging",
"this",
".",
"debug_enabled",
"=",
"options",
".",
... | DaZeus client connection object
@param {Object} options
@param {Function} onConnect Function to be executed when the connection is established | [
"DaZeus",
"client",
"connection",
"object"
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L23-L78 | |
57,272 | dazeus/dazeus-nodejs | dazeus.js | function (data, callback) {
this.debug("Sending: %s", JSON.stringify(data));
var message = dazeusify.call(this, data);
this.client.write(message, callback);
} | javascript | function (data, callback) {
this.debug("Sending: %s", JSON.stringify(data));
var message = dazeusify.call(this, data);
this.client.write(message, callback);
} | [
"function",
"(",
"data",
",",
"callback",
")",
"{",
"this",
".",
"debug",
"(",
"\"Sending: %s\"",
",",
"JSON",
".",
"stringify",
"(",
"data",
")",
")",
";",
"var",
"message",
"=",
"dazeusify",
".",
"call",
"(",
"this",
",",
"data",
")",
";",
"this",
... | Sends some data to the server and calls a callback as soon as that is done.
@param {Object} data Message to be sent
@param {Function} callback Callback to be executed when sending is finished | [
"Sends",
"some",
"data",
"to",
"the",
"server",
"and",
"calls",
"a",
"callback",
"as",
"soon",
"as",
"that",
"is",
"done",
"."
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L592-L596 | |
57,273 | dazeus/dazeus-nodejs | dazeus.js | function (data, callback) {
if (typeof callback !== 'function') {
this.debug("Registering dummy callback, because a response message is expected");
} else {
this.debug("Registering callback");
}
this.waitingCallbacks.push(callback);
send.call(this, data);
} | javascript | function (data, callback) {
if (typeof callback !== 'function') {
this.debug("Registering dummy callback, because a response message is expected");
} else {
this.debug("Registering callback");
}
this.waitingCallbacks.push(callback);
send.call(this, data);
} | [
"function",
"(",
"data",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"this",
".",
"debug",
"(",
"\"Registering dummy callback, because a response message is expected\"",
")",
";",
"}",
"else",
"{",
"this",
".",
"deb... | Send a message and register a callback
@param {Object} data Message to be sent
@param {Function} callback Callback function to be registered | [
"Send",
"a",
"message",
"and",
"register",
"a",
"callback"
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L603-L611 | |
57,274 | dazeus/dazeus-nodejs | dazeus.js | function (event) {
this.debug("Requesting subscription for " + event);
sendReceive.call(this, {'do': 'subscribe', params: [event]}, function (result) {
if (result.success) {
this.debug("Succesfully subscribed to %s", event);
} else {
this.debug("Subscription request for %... | javascript | function (event) {
this.debug("Requesting subscription for " + event);
sendReceive.call(this, {'do': 'subscribe', params: [event]}, function (result) {
if (result.success) {
this.debug("Succesfully subscribed to %s", event);
} else {
this.debug("Subscription request for %... | [
"function",
"(",
"event",
")",
"{",
"this",
".",
"debug",
"(",
"\"Requesting subscription for \"",
"+",
"event",
")",
";",
"sendReceive",
".",
"call",
"(",
"this",
",",
"{",
"'do'",
":",
"'subscribe'",
",",
"params",
":",
"[",
"event",
"]",
"}",
",",
"... | Request DaZeus to be notified of a certain type of event
@param {String} event Type of event to subscribe to | [
"Request",
"DaZeus",
"to",
"be",
"notified",
"of",
"a",
"certain",
"type",
"of",
"event"
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L617-L627 | |
57,275 | dazeus/dazeus-nodejs | dazeus.js | function (obj) {
this.debug("Received: %s", JSON.stringify(obj));
if (typeof obj.event !== 'undefined') {
this.debug("Received an event-based message, sending off to listeners");
handleEvent.call(this, obj.event, obj.params);
} else {
if (this.waitingCallbacks.length > 0) {
... | javascript | function (obj) {
this.debug("Received: %s", JSON.stringify(obj));
if (typeof obj.event !== 'undefined') {
this.debug("Received an event-based message, sending off to listeners");
handleEvent.call(this, obj.event, obj.params);
} else {
if (this.waitingCallbacks.length > 0) {
... | [
"function",
"(",
"obj",
")",
"{",
"this",
".",
"debug",
"(",
"\"Received: %s\"",
",",
"JSON",
".",
"stringify",
"(",
"obj",
")",
")",
";",
"if",
"(",
"typeof",
"obj",
".",
"event",
"!==",
"'undefined'",
")",
"{",
"this",
".",
"debug",
"(",
"\"Receive... | Receive a new message object from the server.
Either we pass it off to the event-handler if it is an event-based object, or
we look for a corresponding callback that is waiting for a response.
@param {Object} obj The received message as a javascript object | [
"Receive",
"a",
"new",
"message",
"object",
"from",
"the",
"server",
".",
"Either",
"we",
"pass",
"it",
"off",
"to",
"the",
"event",
"-",
"handler",
"if",
"it",
"is",
"an",
"event",
"-",
"based",
"object",
"or",
"we",
"look",
"for",
"a",
"corresponding... | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L635-L653 | |
57,276 | dazeus/dazeus-nodejs | dazeus.js | function (event, parameters) {
if (event === 'COMMAND') {
event = 'command_' + parameters[3];
}
parameters.unshift(event);
this.emit.apply(this, parameters);
} | javascript | function (event, parameters) {
if (event === 'COMMAND') {
event = 'command_' + parameters[3];
}
parameters.unshift(event);
this.emit.apply(this, parameters);
} | [
"function",
"(",
"event",
",",
"parameters",
")",
"{",
"if",
"(",
"event",
"===",
"'COMMAND'",
")",
"{",
"event",
"=",
"'command_'",
"+",
"parameters",
"[",
"3",
"]",
";",
"}",
"parameters",
".",
"unshift",
"(",
"event",
")",
";",
"this",
".",
"emit"... | For event-type messages, this calls the correct event handlers.
@param {String} event Event type name
@param {Array} parameters Parameters for the event | [
"For",
"event",
"-",
"type",
"messages",
"this",
"calls",
"the",
"correct",
"event",
"handlers",
"."
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L660-L666 | |
57,277 | dazeus/dazeus-nodejs | dazeus.js | function (message) {
var objs = [], collector = '', chr, msglen, data;
this.data += message;
data = new Buffer(this.data, 'utf8');
for (var i = 0; i < data.length; i += 1) {
chr = data[i];
if (chr > 47 && chr < 58) {
collector += String.fromCharCode(chr);
} else if ... | javascript | function (message) {
var objs = [], collector = '', chr, msglen, data;
this.data += message;
data = new Buffer(this.data, 'utf8');
for (var i = 0; i < data.length; i += 1) {
chr = data[i];
if (chr > 47 && chr < 58) {
collector += String.fromCharCode(chr);
} else if ... | [
"function",
"(",
"message",
")",
"{",
"var",
"objs",
"=",
"[",
"]",
",",
"collector",
"=",
"''",
",",
"chr",
",",
"msglen",
",",
"data",
";",
"this",
".",
"data",
"+=",
"message",
";",
"data",
"=",
"new",
"Buffer",
"(",
"this",
".",
"data",
",",
... | Transform a string retrieved from DaZeus to it's javascript-object-equivalents.
@param {String} message
@return {Array} Array of parsed messages | [
"Transform",
"a",
"string",
"retrieved",
"from",
"DaZeus",
"to",
"it",
"s",
"javascript",
"-",
"object",
"-",
"equivalents",
"."
] | d62347378bb4cd5939fdabec7e0922548178222c | https://github.com/dazeus/dazeus-nodejs/blob/d62347378bb4cd5939fdabec7e0922548178222c/dazeus.js#L698-L723 | |
57,278 | sebpiq/node-validation-pod | index.js | function(err) {
var validationErrMsg = self.handleError(err)
if (!validationErrMsg) return false
else {
self._merge(validationErrors, validationErrMsg, prefix)
isValid = false
return true
}
} | javascript | function(err) {
var validationErrMsg = self.handleError(err)
if (!validationErrMsg) return false
else {
self._merge(validationErrors, validationErrMsg, prefix)
isValid = false
return true
}
} | [
"function",
"(",
"err",
")",
"{",
"var",
"validationErrMsg",
"=",
"self",
".",
"handleError",
"(",
"err",
")",
"if",
"(",
"!",
"validationErrMsg",
")",
"return",
"false",
"else",
"{",
"self",
".",
"_merge",
"(",
"validationErrors",
",",
"validationErrMsg",
... | Returns true if `err` was handled as a validation error, false otherwise | [
"Returns",
"true",
"if",
"err",
"was",
"handled",
"as",
"a",
"validation",
"error",
"false",
"otherwise"
] | c9a75c94c219a41fa877157a2df102c8fa24efbf | https://github.com/sebpiq/node-validation-pod/blob/c9a75c94c219a41fa877157a2df102c8fa24efbf/index.js#L34-L42 | |
57,279 | ugate/releasebot | tasks/release.js | genTemplateData | function genTemplateData() {
var templateData = {
data : {
process : process,
commit : commit,
env : commitTask.commitOpts,
options : options
}
};
var rtn = {};
var arr = Array.prototype.slice.call(arguments, 0);
arr.forEach(function genIntMsgs(s) {
rtn[s] = options[s] ? r... | javascript | function genTemplateData() {
var templateData = {
data : {
process : process,
commit : commit,
env : commitTask.commitOpts,
options : options
}
};
var rtn = {};
var arr = Array.prototype.slice.call(arguments, 0);
arr.forEach(function genIntMsgs(s) {
rtn[s] = options[s] ? r... | [
"function",
"genTemplateData",
"(",
")",
"{",
"var",
"templateData",
"=",
"{",
"data",
":",
"{",
"process",
":",
"process",
",",
"commit",
":",
"commit",
",",
"env",
":",
"commitTask",
".",
"commitOpts",
",",
"options",
":",
"options",
"}",
"}",
";",
"... | Generates an object that contains each of the passed arguments as a
property with a value of an option with the same name. Each property
will have a value for that option that is parsed using the template
processor.
@returns the parsed template data | [
"Generates",
"an",
"object",
"that",
"contains",
"each",
"of",
"the",
"passed",
"arguments",
"as",
"a",
"property",
"with",
"a",
"value",
"of",
"an",
"option",
"with",
"the",
"same",
"name",
".",
"Each",
"property",
"will",
"have",
"a",
"value",
"for",
"... | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/tasks/release.js#L123-L141 |
57,280 | ugate/releasebot | tasks/release.js | remoteSetup | function remoteSetup() {
var link = '${GH_TOKEN}@' + options.gitHostname + '/' + commit.slug + '.git';
cmd('git config --global user.email "' + options.repoEmail + '"');
cmd('git config --global user.name "' + options.repoUser + '"');
cmd('git remote rm ' + options.repoName);
cmd('git remote add ' + opti... | javascript | function remoteSetup() {
var link = '${GH_TOKEN}@' + options.gitHostname + '/' + commit.slug + '.git';
cmd('git config --global user.email "' + options.repoEmail + '"');
cmd('git config --global user.name "' + options.repoUser + '"');
cmd('git remote rm ' + options.repoName);
cmd('git remote add ' + opti... | [
"function",
"remoteSetup",
"(",
")",
"{",
"var",
"link",
"=",
"'${GH_TOKEN}@'",
"+",
"options",
".",
"gitHostname",
"+",
"'/'",
"+",
"commit",
".",
"slug",
"+",
"'.git'",
";",
"cmd",
"(",
"'git config --global user.email \"'",
"+",
"options",
".",
"repoEmail",... | Remote Git setup to permit pushes | [
"Remote",
"Git",
"setup",
"to",
"permit",
"pushes"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/tasks/release.js#L146-L152 |
57,281 | ugate/releasebot | tasks/release.js | gitRelease | function gitRelease() {
// Tag release
rbot.log.info('Tagging release ' + commit.versionTag + ' via ' + options.gitHostname);
cmd('git tag -f -a ' + commit.versionTag + ' -m "'
+ (chgLogRtn ? chgLogRtn.replace(coopt.regexLines, '$1 \\') : commit.message) + '"');
cmd('git push -f ' + options.repoName + ... | javascript | function gitRelease() {
// Tag release
rbot.log.info('Tagging release ' + commit.versionTag + ' via ' + options.gitHostname);
cmd('git tag -f -a ' + commit.versionTag + ' -m "'
+ (chgLogRtn ? chgLogRtn.replace(coopt.regexLines, '$1 \\') : commit.message) + '"');
cmd('git push -f ' + options.repoName + ... | [
"function",
"gitRelease",
"(",
")",
"{",
"// Tag release",
"rbot",
".",
"log",
".",
"info",
"(",
"'Tagging release '",
"+",
"commit",
".",
"versionTag",
"+",
"' via '",
"+",
"options",
".",
"gitHostname",
")",
";",
"cmd",
"(",
"'git tag -f -a '",
"+",
"commi... | Tags release via standard Git CLI | [
"Tags",
"release",
"via",
"standard",
"Git",
"CLI"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/tasks/release.js#L335-L345 |
57,282 | ugate/releasebot | tasks/release.js | gitHubRelease | function gitHubRelease() {
rbot.log.info('Releasing ' + commit.versionTag + ' via ' + options.gitHostname);
// GitHub Release API will not remove the tag when removing a
// release
github.releaseAndUploadAsset(distAssets, coopt.regexLines, commit, tmpltData.name, chgLogRtn
|| commit.message, options, r... | javascript | function gitHubRelease() {
rbot.log.info('Releasing ' + commit.versionTag + ' via ' + options.gitHostname);
// GitHub Release API will not remove the tag when removing a
// release
github.releaseAndUploadAsset(distAssets, coopt.regexLines, commit, tmpltData.name, chgLogRtn
|| commit.message, options, r... | [
"function",
"gitHubRelease",
"(",
")",
"{",
"rbot",
".",
"log",
".",
"info",
"(",
"'Releasing '",
"+",
"commit",
".",
"versionTag",
"+",
"' via '",
"+",
"options",
".",
"gitHostname",
")",
";",
"// GitHub Release API will not remove the tag when removing a",
"// rel... | Calls the GitHub Release API to tag release and upload optional
distribution asset | [
"Calls",
"the",
"GitHub",
"Release",
"API",
"to",
"tag",
"release",
"and",
"upload",
"optional",
"distribution",
"asset"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/tasks/release.js#L351-L359 |
57,283 | ugate/releasebot | tasks/release.js | rollbackPublish | function rollbackPublish() {
try {
chkoutRun(options.distBranch, function() {
var cph = cmd('git rev-parse HEAD');
if (pubHash && pubHash !== cph) {
cmd('git checkout -qf ' + pubHash);
cmd('git commit -q -m "Rollback: ' + tmpltData.distBranchPubMsg + '"');
cmd('git push -f ' + options... | javascript | function rollbackPublish() {
try {
chkoutRun(options.distBranch, function() {
var cph = cmd('git rev-parse HEAD');
if (pubHash && pubHash !== cph) {
cmd('git checkout -qf ' + pubHash);
cmd('git commit -q -m "Rollback: ' + tmpltData.distBranchPubMsg + '"');
cmd('git push -f ' + options... | [
"function",
"rollbackPublish",
"(",
")",
"{",
"try",
"{",
"chkoutRun",
"(",
"options",
".",
"distBranch",
",",
"function",
"(",
")",
"{",
"var",
"cph",
"=",
"cmd",
"(",
"'git rev-parse HEAD'",
")",
";",
"if",
"(",
"pubHash",
"&&",
"pubHash",
"!==",
"cph"... | Reverts published branch | [
"Reverts",
"published",
"branch"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/tasks/release.js#L428-L447 |
57,284 | d-mon-/typeof-- | index.js | getObjectToStringValue | function getObjectToStringValue(value) {
var result = objectToString.call(value);
switch (result) {
case '[object Undefined]':
return '#Undefined';
case '[object Null]':
return '#Null';
case '[object Object]'... | javascript | function getObjectToStringValue(value) {
var result = objectToString.call(value);
switch (result) {
case '[object Undefined]':
return '#Undefined';
case '[object Null]':
return '#Null';
case '[object Object]'... | [
"function",
"getObjectToStringValue",
"(",
"value",
")",
"{",
"var",
"result",
"=",
"objectToString",
".",
"call",
"(",
"value",
")",
";",
"switch",
"(",
"result",
")",
"{",
"case",
"'[object Undefined]'",
":",
"return",
"'#Undefined'",
";",
"case",
"'[object ... | retrieve type of value after calling Object.prototype.toString
@param value
@returns {String} | [
"retrieve",
"type",
"of",
"value",
"after",
"calling",
"Object",
".",
"prototype",
".",
"toString"
] | 9749072fec62b42a0b35dc00f87c6169f5d93855 | https://github.com/d-mon-/typeof--/blob/9749072fec62b42a0b35dc00f87c6169f5d93855/index.js#L27-L93 |
57,285 | d-mon-/typeof-- | index.js | typeOf | function typeOf(value, options) {
if (value === undefined) return '#Undefined';
if (value === null) return '#Null';
if (options !== 'forceObjectToString') {
var constructor = getConstructor(value);
if (constructor !== null) {
var ty... | javascript | function typeOf(value, options) {
if (value === undefined) return '#Undefined';
if (value === null) return '#Null';
if (options !== 'forceObjectToString') {
var constructor = getConstructor(value);
if (constructor !== null) {
var ty... | [
"function",
"typeOf",
"(",
"value",
",",
"options",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
")",
"return",
"'#Undefined'",
";",
"if",
"(",
"value",
"===",
"null",
")",
"return",
"'#Null'",
";",
"if",
"(",
"options",
"!==",
"'forceObjectToString'"... | return the constructor name if "defined" and "valid" of the value, otherwise return Object.prototype.toString
@param {*} value
@returns {String} | [
"return",
"the",
"constructor",
"name",
"if",
"defined",
"and",
"valid",
"of",
"the",
"value",
"otherwise",
"return",
"Object",
".",
"prototype",
".",
"toString"
] | 9749072fec62b42a0b35dc00f87c6169f5d93855 | https://github.com/d-mon-/typeof--/blob/9749072fec62b42a0b35dc00f87c6169f5d93855/index.js#L100-L114 |
57,286 | gahlotnikhil/bower-component-files | lib/main.js | fetchComponents | function fetchComponents(filter, options) {
console.log('Fetching dependencies...');
var componentList = [];
if (_.isObject(filter) || _.isArray(filter)) {
var dependencies = fetchBowerComponents();
_.each(dependencies, function(dep) {
var bowerObj = getBower(dep);
if (bowerObj... | javascript | function fetchComponents(filter, options) {
console.log('Fetching dependencies...');
var componentList = [];
if (_.isObject(filter) || _.isArray(filter)) {
var dependencies = fetchBowerComponents();
_.each(dependencies, function(dep) {
var bowerObj = getBower(dep);
if (bowerObj... | [
"function",
"fetchComponents",
"(",
"filter",
",",
"options",
")",
"{",
"console",
".",
"log",
"(",
"'Fetching dependencies...'",
")",
";",
"var",
"componentList",
"=",
"[",
"]",
";",
"if",
"(",
"_",
".",
"isObject",
"(",
"filter",
")",
"||",
"_",
".",
... | Get components from bower.json
@param {Object}/{Array} filter
@param {Object} options
@return {Array<Component>} List of components | [
"Get",
"components",
"from",
"bower",
".",
"json"
] | f57111e2718517d2c86995975be0d862dc83c7bd | https://github.com/gahlotnikhil/bower-component-files/blob/f57111e2718517d2c86995975be0d862dc83c7bd/lib/main.js#L188-L223 |
57,287 | gahlotnikhil/bower-component-files | lib/main.js | fetchComponent | function fetchComponent(compName, filter, options) {
var componentFiles = [];
_.each(filter, function(destDir, expression) {
var fileInfo = path.parse(path.resolve(BOWER_DIRECTORY, compName, expression));
var sourceDir = fileInfo.dir;
var dirContent = fs.readdirSync(sourceDir);
var expr... | javascript | function fetchComponent(compName, filter, options) {
var componentFiles = [];
_.each(filter, function(destDir, expression) {
var fileInfo = path.parse(path.resolve(BOWER_DIRECTORY, compName, expression));
var sourceDir = fileInfo.dir;
var dirContent = fs.readdirSync(sourceDir);
var expr... | [
"function",
"fetchComponent",
"(",
"compName",
",",
"filter",
",",
"options",
")",
"{",
"var",
"componentFiles",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"filter",
",",
"function",
"(",
"destDir",
",",
"expression",
")",
"{",
"var",
"fileInfo",
"=",
... | Constructs a Component object
@param {String} compName
@param {Object} filter
@param {Object} options
@return {Component} | [
"Constructs",
"a",
"Component",
"object"
] | f57111e2718517d2c86995975be0d862dc83c7bd | https://github.com/gahlotnikhil/bower-component-files/blob/f57111e2718517d2c86995975be0d862dc83c7bd/lib/main.js#L232-L253 |
57,288 | MiguelCastillo/dis-isa | src/index.js | typeName | function typeName(item) {
if (isNull(item)) {
return "null";
}
else if (isUndefined(item)) {
return "undefined";
}
return /\[.+ ([^\]]+)/.exec(toString(item))[1].toLowerCase();
} | javascript | function typeName(item) {
if (isNull(item)) {
return "null";
}
else if (isUndefined(item)) {
return "undefined";
}
return /\[.+ ([^\]]+)/.exec(toString(item))[1].toLowerCase();
} | [
"function",
"typeName",
"(",
"item",
")",
"{",
"if",
"(",
"isNull",
"(",
"item",
")",
")",
"{",
"return",
"\"null\"",
";",
"}",
"else",
"if",
"(",
"isUndefined",
"(",
"item",
")",
")",
"{",
"return",
"\"undefined\"",
";",
"}",
"return",
"/",
"\\[.+ (... | Extract the type name. This uses Object.prototype.toString
to get the type name.
@param {*} item - Item to get the type for
@returns {string} type of the object | [
"Extract",
"the",
"type",
"name",
".",
"This",
"uses",
"Object",
".",
"prototype",
".",
"toString",
"to",
"get",
"the",
"type",
"name",
"."
] | 11ed2ba864ad8c50b11ce025d345242dd62e4f65 | https://github.com/MiguelCastillo/dis-isa/blob/11ed2ba864ad8c50b11ce025d345242dd62e4f65/src/index.js#L148-L157 |
57,289 | edinella/ploud | public/audiojs/audio.js | function(wrapper, audio) {
if (!audio.settings.createPlayer) return;
var player = audio.settings.createPlayer,
playPause = getByClass(player.playPauseClass, wrapper),
scrubber = getByClass(player.scrubberClass, wrapper),
leftPos = function(elem) {
var curleft = 0;
... | javascript | function(wrapper, audio) {
if (!audio.settings.createPlayer) return;
var player = audio.settings.createPlayer,
playPause = getByClass(player.playPauseClass, wrapper),
scrubber = getByClass(player.scrubberClass, wrapper),
leftPos = function(elem) {
var curleft = 0;
... | [
"function",
"(",
"wrapper",
",",
"audio",
")",
"{",
"if",
"(",
"!",
"audio",
".",
"settings",
".",
"createPlayer",
")",
"return",
";",
"var",
"player",
"=",
"audio",
".",
"settings",
".",
"createPlayer",
",",
"playPause",
"=",
"getByClass",
"(",
"player"... | Attaches useful event callbacks to an `audiojs` instance. | [
"Attaches",
"useful",
"event",
"callbacks",
"to",
"an",
"audiojs",
"instance",
"."
] | ccf01fd213482b320a0a804f100eaae007103b6d | https://github.com/edinella/ploud/blob/ccf01fd213482b320a0a804f100eaae007103b6d/public/audiojs/audio.js#L240-L283 | |
57,290 | cli-kit/cli-property | lib/exec.js | exec | function exec(ptn, source, opts) {
opts = opts || {};
var list = []
, flat = opts.flat = opts.flat !== undefined ? opts.flat : false
, keys = opts.keys = opts.keys !== undefined ? opts.keys : true
, values = opts.values = opts.values !== undefined ? opts.values : false
if(flat) {
source = flatten... | javascript | function exec(ptn, source, opts) {
opts = opts || {};
var list = []
, flat = opts.flat = opts.flat !== undefined ? opts.flat : false
, keys = opts.keys = opts.keys !== undefined ? opts.keys : true
, values = opts.values = opts.values !== undefined ? opts.values : false
if(flat) {
source = flatten... | [
"function",
"exec",
"(",
"ptn",
",",
"source",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"list",
"=",
"[",
"]",
",",
"flat",
"=",
"opts",
".",
"flat",
"=",
"opts",
".",
"flat",
"!==",
"undefined",
"?",
"opts",
".",... | Execute a regular expression pattern against
an object finding all values that match the pattern.
Returns an array of result object.
@param ptn The regular expression to execute.
@param source The source object to search.
@param opts Processing options.
@param opts.flat Compare against flattened object keys.
@param o... | [
"Execute",
"a",
"regular",
"expression",
"pattern",
"against",
"an",
"object",
"finding",
"all",
"values",
"that",
"match",
"the",
"pattern",
"."
] | de6f727af1f8fc1f613fe42200c5e070aa6b0b21 | https://github.com/cli-kit/cli-property/blob/de6f727af1f8fc1f613fe42200c5e070aa6b0b21/lib/exec.js#L18-L55 |
57,291 | mrjoelkemp/ya | helpers/GruntHelper.js | generateGruntfile | function generateGruntfile (generatedConfig) {
return function(grunt) {
var path = require('path'),
fs = require('fs');
require('load-grunt-tasks')(grunt);
grunt.initConfig(generatedConfig);
grunt.registerTask('default', ['watch']);
// Handle new files with that have a new, supported p... | javascript | function generateGruntfile (generatedConfig) {
return function(grunt) {
var path = require('path'),
fs = require('fs');
require('load-grunt-tasks')(grunt);
grunt.initConfig(generatedConfig);
grunt.registerTask('default', ['watch']);
// Handle new files with that have a new, supported p... | [
"function",
"generateGruntfile",
"(",
"generatedConfig",
")",
"{",
"return",
"function",
"(",
"grunt",
")",
"{",
"var",
"path",
"=",
"require",
"(",
"'path'",
")",
",",
"fs",
"=",
"require",
"(",
"'fs'",
")",
";",
"require",
"(",
"'load-grunt-tasks'",
")",... | Helper that returns a function whose body represents a gruntfile definition | [
"Helper",
"that",
"returns",
"a",
"function",
"whose",
"body",
"represents",
"a",
"gruntfile",
"definition"
] | 6cb44f31902daaed32b2d72168b15eebfb7fbfbb | https://github.com/mrjoelkemp/ya/blob/6cb44f31902daaed32b2d72168b15eebfb7fbfbb/helpers/GruntHelper.js#L167-L210 |
57,292 | mrjoelkemp/ya | helpers/GruntHelper.js | getMatches | function getMatches(source, pattern) {
var matches = [],
match;
// Grab all added extensions
while (match = pattern.exec(source)) {
matches.push(match[2]);
}
return matches;
} | javascript | function getMatches(source, pattern) {
var matches = [],
match;
// Grab all added extensions
while (match = pattern.exec(source)) {
matches.push(match[2]);
}
return matches;
} | [
"function",
"getMatches",
"(",
"source",
",",
"pattern",
")",
"{",
"var",
"matches",
"=",
"[",
"]",
",",
"match",
";",
"// Grab all added extensions",
"while",
"(",
"match",
"=",
"pattern",
".",
"exec",
"(",
"source",
")",
")",
"{",
"matches",
".",
"push... | Returns a list of pattern matches against the source string | [
"Returns",
"a",
"list",
"of",
"pattern",
"matches",
"against",
"the",
"source",
"string"
] | 6cb44f31902daaed32b2d72168b15eebfb7fbfbb | https://github.com/mrjoelkemp/ya/blob/6cb44f31902daaed32b2d72168b15eebfb7fbfbb/helpers/GruntHelper.js#L308-L318 |
57,293 | t9md/atom-outlet | lib/index.js | link | function link (outlet, editor) {
if (getLocationForItem(editor) === 'center') {
outlet.element.setAttribute('outlet-linked-editor-id', editor.id)
} else {
outlet.element.removeAttribute('outlet-linked-editor-id')
}
} | javascript | function link (outlet, editor) {
if (getLocationForItem(editor) === 'center') {
outlet.element.setAttribute('outlet-linked-editor-id', editor.id)
} else {
outlet.element.removeAttribute('outlet-linked-editor-id')
}
} | [
"function",
"link",
"(",
"outlet",
",",
"editor",
")",
"{",
"if",
"(",
"getLocationForItem",
"(",
"editor",
")",
"===",
"'center'",
")",
"{",
"outlet",
".",
"element",
".",
"setAttribute",
"(",
"'outlet-linked-editor-id'",
",",
"editor",
".",
"id",
")",
"}... | When outlet was created from an editor. Call this function to link outlet to that editor. Linked editor will not be hidden while outlet relocation. Only editor in center container can be linked. | [
"When",
"outlet",
"was",
"created",
"from",
"an",
"editor",
".",
"Call",
"this",
"function",
"to",
"link",
"outlet",
"to",
"that",
"editor",
".",
"Linked",
"editor",
"will",
"not",
"be",
"hidden",
"while",
"outlet",
"relocation",
".",
"Only",
"editor",
"in... | 6098828c54dbb0b64b14e89c449a04ea1ed069b1 | https://github.com/t9md/atom-outlet/blob/6098828c54dbb0b64b14e89c449a04ea1ed069b1/lib/index.js#L198-L204 |
57,294 | zappan/connect-spa-request-filter | lib/requestFilter.js | _isVoidFilterRoute | function _isVoidFilterRoute(req) {
var reqPathRegex = new RegExp(['^', req.path.replace(/\/$/, ''), '$'].join(''), 'i')
, voidRoute
, i;
for (i=0; i<voidFilterRoutes.length; i++) {
if (reqPathRegex.test(voidFilterRoutes[i])) { return true; }
}
return false;
} | javascript | function _isVoidFilterRoute(req) {
var reqPathRegex = new RegExp(['^', req.path.replace(/\/$/, ''), '$'].join(''), 'i')
, voidRoute
, i;
for (i=0; i<voidFilterRoutes.length; i++) {
if (reqPathRegex.test(voidFilterRoutes[i])) { return true; }
}
return false;
} | [
"function",
"_isVoidFilterRoute",
"(",
"req",
")",
"{",
"var",
"reqPathRegex",
"=",
"new",
"RegExp",
"(",
"[",
"'^'",
",",
"req",
".",
"path",
".",
"replace",
"(",
"/",
"\\/$",
"/",
",",
"''",
")",
",",
"'$'",
"]",
".",
"join",
"(",
"''",
")",
",... | Checks whether the route is in the list of routes to void filtering on
@param {http.ServerRequest} req Node.js HTTP Server request
@return true if request headers match 'application/json', false otherwise
@return {Boolean} true if route (path) in the list of routes to void filtering on, false otherwise
@author To... | [
"Checks",
"whether",
"the",
"route",
"is",
"in",
"the",
"list",
"of",
"routes",
"to",
"void",
"filtering",
"on"
] | 52a497dd8c4b315410322d698089a43ccdb938bc | https://github.com/zappan/connect-spa-request-filter/blob/52a497dd8c4b315410322d698089a43ccdb938bc/lib/requestFilter.js#L28-L37 |
57,295 | zappan/connect-spa-request-filter | lib/requestFilter.js | _renderAppShell | function _renderAppShell(res) {
res.render(appShell.view, {
layout : appShell.layout
, appTitle : appConfig.appTitle
, appConfig : JSON.stringify(appConfig)
, appData : JSON.stringify(appData)
});
} | javascript | function _renderAppShell(res) {
res.render(appShell.view, {
layout : appShell.layout
, appTitle : appConfig.appTitle
, appConfig : JSON.stringify(appConfig)
, appData : JSON.stringify(appData)
});
} | [
"function",
"_renderAppShell",
"(",
"res",
")",
"{",
"res",
".",
"render",
"(",
"appShell",
".",
"view",
",",
"{",
"layout",
":",
"appShell",
".",
"layout",
",",
"appTitle",
":",
"appConfig",
".",
"appTitle",
",",
"appConfig",
":",
"JSON",
".",
"stringif... | Default method to render app shell, could be overriden through init options
@return _void_
@author Tomislav Capan | [
"Default",
"method",
"to",
"render",
"app",
"shell",
"could",
"be",
"overriden",
"through",
"init",
"options"
] | 52a497dd8c4b315410322d698089a43ccdb938bc | https://github.com/zappan/connect-spa-request-filter/blob/52a497dd8c4b315410322d698089a43ccdb938bc/lib/requestFilter.js#L45-L52 |
57,296 | zappan/connect-spa-request-filter | lib/requestFilter.js | configure | function configure(options) {
options = options || {};
var assertErrTemplate = '[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:';
assert(options.appConfig, util.format(assertErrTemplate, 'options.appConfig'));
assert(options.appConfig.appTitle, util.format(assertErrTempla... | javascript | function configure(options) {
options = options || {};
var assertErrTemplate = '[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:';
assert(options.appConfig, util.format(assertErrTemplate, 'options.appConfig'));
assert(options.appConfig.appTitle, util.format(assertErrTempla... | [
"function",
"configure",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"assertErrTemplate",
"=",
"'[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:'",
";",
"assert",
"(",
"options",
".",
"appConfig",... | Initializes the middleware by setting the required options for it to run
and exposing the filtering interface
@param {object} options Options object containing the following:
* app: A reference to the Express app object
* voidFilterRoutes: an array of routes (paths) to void filtering on
@return {function} ... | [
"Initializes",
"the",
"middleware",
"by",
"setting",
"the",
"required",
"options",
"for",
"it",
"to",
"run",
"and",
"exposing",
"the",
"filtering",
"interface"
] | 52a497dd8c4b315410322d698089a43ccdb938bc | https://github.com/zappan/connect-spa-request-filter/blob/52a497dd8c4b315410322d698089a43ccdb938bc/lib/requestFilter.js#L80-L98 |
57,297 | crysalead-js/expand-flatten | expand.js | expand | function expand(object, options) {
var expanded = {};
var options = options || {};
var separator = options.separator || '.';
var affix = options.affix ? separator + options.affix + separator : separator;
for (var path in object) {
var value = object[path];
var pointer = expanded;
if (path.indexO... | javascript | function expand(object, options) {
var expanded = {};
var options = options || {};
var separator = options.separator || '.';
var affix = options.affix ? separator + options.affix + separator : separator;
for (var path in object) {
var value = object[path];
var pointer = expanded;
if (path.indexO... | [
"function",
"expand",
"(",
"object",
",",
"options",
")",
"{",
"var",
"expanded",
"=",
"{",
"}",
";",
"var",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"separator",
"=",
"options",
".",
"separator",
"||",
"'.'",
";",
"var",
"affix",
"=",
... | Expands a "hash" object an object.
@param Object object The object to expand.
@param Object options The options.
@return Object The expanded object. | [
"Expands",
"a",
"hash",
"object",
"an",
"object",
"."
] | dd298e70509a11219603f7eccecd2b0d963da904 | https://github.com/crysalead-js/expand-flatten/blob/dd298e70509a11219603f7eccecd2b0d963da904/expand.js#L8-L36 |
57,298 | melvincarvalho/rdf-shell | lib/touch.js | touch | function touch(argv, callback) {
util.patch(argv[2], 'DELETE {} .', function(err, val) {
if (!err) {
console.log('touch to : ' + argv[2]);
}
});
} | javascript | function touch(argv, callback) {
util.patch(argv[2], 'DELETE {} .', function(err, val) {
if (!err) {
console.log('touch to : ' + argv[2]);
}
});
} | [
"function",
"touch",
"(",
"argv",
",",
"callback",
")",
"{",
"util",
".",
"patch",
"(",
"argv",
"[",
"2",
"]",
",",
"'DELETE {} .'",
",",
"function",
"(",
"err",
",",
"val",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"console",
".",
"log",
"(",
... | touch gets list of files for a given container
@param {String} argv[2] url
@param {String} argv[3] data
@callback {bin~cb} callback | [
"touch",
"gets",
"list",
"of",
"files",
"for",
"a",
"given",
"container"
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/lib/touch.js#L13-L19 |
57,299 | tomek-f/auto-elems-from-dom | autoElemsFromDOM.js | getDocumentFragmentFromString | function getDocumentFragmentFromString(html) {
// return document.createRange().createContextualFragment(html); // FU safari
var range = document.createRange();
range.selectNode(document.body);// safari
return range.createContextualFragment(html);
} | javascript | function getDocumentFragmentFromString(html) {
// return document.createRange().createContextualFragment(html); // FU safari
var range = document.createRange();
range.selectNode(document.body);// safari
return range.createContextualFragment(html);
} | [
"function",
"getDocumentFragmentFromString",
"(",
"html",
")",
"{",
"// return document.createRange().createContextualFragment(html); // FU safari",
"var",
"range",
"=",
"document",
".",
"createRange",
"(",
")",
";",
"range",
".",
"selectNode",
"(",
"document",
".",
"body... | Array.from without additional div | [
"Array",
".",
"from",
"without",
"additional",
"div"
] | 1852d0a3d2d3b5ecb5d0f66c8fbf753e71e699af | https://github.com/tomek-f/auto-elems-from-dom/blob/1852d0a3d2d3b5ecb5d0f66c8fbf753e71e699af/autoElemsFromDOM.js#L4-L9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.