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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
55,700 | AndreasMadsen/immortal | lib/core/process.js | interceptDeath | function interceptDeath(process, events) {
var closeEvent = helpers.support.close;
// all channels are closed
process.once(closeEvent ? 'close' : 'exit', events.close);
// the process died
if (closeEvent) {
process.once('exit', events.exit);
} else {
// intercept internal onexit c... | javascript | function interceptDeath(process, events) {
var closeEvent = helpers.support.close;
// all channels are closed
process.once(closeEvent ? 'close' : 'exit', events.close);
// the process died
if (closeEvent) {
process.once('exit', events.exit);
} else {
// intercept internal onexit c... | [
"function",
"interceptDeath",
"(",
"process",
",",
"events",
")",
"{",
"var",
"closeEvent",
"=",
"helpers",
".",
"support",
".",
"close",
";",
"// all channels are closed",
"process",
".",
"once",
"(",
"closeEvent",
"?",
"'close'",
":",
"'exit'",
",",
"events"... | An helper function there will intercept internal exit event if necessary | [
"An",
"helper",
"function",
"there",
"will",
"intercept",
"internal",
"exit",
"event",
"if",
"necessary"
] | c1ab5a4287a543fdfd980604a9e9927d663a9ef2 | https://github.com/AndreasMadsen/immortal/blob/c1ab5a4287a543fdfd980604a9e9927d663a9ef2/lib/core/process.js#L204-L222 |
55,701 | DearDesi/desirae | lib/browser-adapters.js | hashsum | function hashsum(hash, str) {
// you have to convert from string to array buffer
var ab
// you have to represent the algorithm as an object
, algo = { name: algos[hash] }
;
if ('string' === typeof str) {
ab = str2ab(str);
} else {
ab = str;
}
... | javascript | function hashsum(hash, str) {
// you have to convert from string to array buffer
var ab
// you have to represent the algorithm as an object
, algo = { name: algos[hash] }
;
if ('string' === typeof str) {
ab = str2ab(str);
} else {
ab = str;
}
... | [
"function",
"hashsum",
"(",
"hash",
",",
"str",
")",
"{",
"// you have to convert from string to array buffer",
"var",
"ab",
"// you have to represent the algorithm as an object ",
",",
"algo",
"=",
"{",
"name",
":",
"algos",
"[",
"hash",
"]",
"}",
";",
"if",
"(",
... | a more general convenience function | [
"a",
"more",
"general",
"convenience",
"function"
] | 7b043c898d668b07c39a154e215ddfa55444a5f2 | https://github.com/DearDesi/desirae/blob/7b043c898d668b07c39a154e215ddfa55444a5f2/lib/browser-adapters.js#L26-L49 |
55,702 | DearDesi/desirae | lib/browser-adapters.js | ab2hex | function ab2hex(ab) {
var dv = new DataView(ab)
, i
, len
, hex = ''
, c
;
for (i = 0, len = dv.byteLength; i < len; i += 1) {
c = dv.getUint8(i).toString(16);
if (c.length < 2) {
c = '0' + c;
}
hex += c;
}
ret... | javascript | function ab2hex(ab) {
var dv = new DataView(ab)
, i
, len
, hex = ''
, c
;
for (i = 0, len = dv.byteLength; i < len; i += 1) {
c = dv.getUint8(i).toString(16);
if (c.length < 2) {
c = '0' + c;
}
hex += c;
}
ret... | [
"function",
"ab2hex",
"(",
"ab",
")",
"{",
"var",
"dv",
"=",
"new",
"DataView",
"(",
"ab",
")",
",",
"i",
",",
"len",
",",
"hex",
"=",
"''",
",",
"c",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"dv",
".",
"byteLength",
";",
"i",
"<",
... | convert from arraybuffer to hex | [
"convert",
"from",
"arraybuffer",
"to",
"hex"
] | 7b043c898d668b07c39a154e215ddfa55444a5f2 | https://github.com/DearDesi/desirae/blob/7b043c898d668b07c39a154e215ddfa55444a5f2/lib/browser-adapters.js#L52-L71 |
55,703 | DearDesi/desirae | lib/browser-adapters.js | str2ab | function str2ab(stringToEncode, insertBom) {
stringToEncode = stringToEncode.replace(/\r\n/g,"\n");
var utftext = []
, n
, c
;
if (true === insertBom) {
utftext[0] = 0xef;
utftext[1] = 0xbb;
utftext[2] = 0xbf;
}
for (n = 0; n < stringT... | javascript | function str2ab(stringToEncode, insertBom) {
stringToEncode = stringToEncode.replace(/\r\n/g,"\n");
var utftext = []
, n
, c
;
if (true === insertBom) {
utftext[0] = 0xef;
utftext[1] = 0xbb;
utftext[2] = 0xbf;
}
for (n = 0; n < stringT... | [
"function",
"str2ab",
"(",
"stringToEncode",
",",
"insertBom",
")",
"{",
"stringToEncode",
"=",
"stringToEncode",
".",
"replace",
"(",
"/",
"\\r\\n",
"/",
"g",
",",
"\"\\n\"",
")",
";",
"var",
"utftext",
"=",
"[",
"]",
",",
"n",
",",
"c",
";",
"if",
... | convert from string to arraybuffer | [
"convert",
"from",
"string",
"to",
"arraybuffer"
] | 7b043c898d668b07c39a154e215ddfa55444a5f2 | https://github.com/DearDesi/desirae/blob/7b043c898d668b07c39a154e215ddfa55444a5f2/lib/browser-adapters.js#L74-L107 |
55,704 | espadrine/fleau | fleau.js | escapeCurly | function escapeCurly (text, escapes) {
var newText = text.slice (0, escapes[0]);
for (var i = 0; i < escapes.length; i += 3) {
var from = escapes[i];
var to = escapes[i + 1];
var type = escapes[i + 2];
// Which escape do we have here?
if (type === 0) { newText += '{{';
} else { ... | javascript | function escapeCurly (text, escapes) {
var newText = text.slice (0, escapes[0]);
for (var i = 0; i < escapes.length; i += 3) {
var from = escapes[i];
var to = escapes[i + 1];
var type = escapes[i + 2];
// Which escape do we have here?
if (type === 0) { newText += '{{';
} else { ... | [
"function",
"escapeCurly",
"(",
"text",
",",
"escapes",
")",
"{",
"var",
"newText",
"=",
"text",
".",
"slice",
"(",
"0",
",",
"escapes",
"[",
"0",
"]",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"escapes",
".",
"length",
";",
"i... | Return a text where all escapes as defined in the toplevel function are indeed escaped. | [
"Return",
"a",
"text",
"where",
"all",
"escapes",
"as",
"defined",
"in",
"the",
"toplevel",
"function",
"are",
"indeed",
"escaped",
"."
] | 31b5f7783347deac4527a63afa522bc2e2ca8849 | https://github.com/espadrine/fleau/blob/31b5f7783347deac4527a63afa522bc2e2ca8849/fleau.js#L90-L103 |
55,705 | espadrine/fleau | fleau.js | function(input, output, literal, cb) {
var text = '';
input.on ('data', function gatherer (data) {
text += '' + data; // Converting to UTF-8 string.
});
input.on ('end', function writer () {
try {
var write = function(data) { output.write(data); };
template(text)(write, literal);
} cat... | javascript | function(input, output, literal, cb) {
var text = '';
input.on ('data', function gatherer (data) {
text += '' + data; // Converting to UTF-8 string.
});
input.on ('end', function writer () {
try {
var write = function(data) { output.write(data); };
template(text)(write, literal);
} cat... | [
"function",
"(",
"input",
",",
"output",
",",
"literal",
",",
"cb",
")",
"{",
"var",
"text",
"=",
"''",
";",
"input",
".",
"on",
"(",
"'data'",
",",
"function",
"gatherer",
"(",
"data",
")",
"{",
"text",
"+=",
"''",
"+",
"data",
";",
"// Converting... | Main entry point. input and output are two streams, one readable, the other writable. | [
"Main",
"entry",
"point",
".",
"input",
"and",
"output",
"are",
"two",
"streams",
"one",
"readable",
"the",
"other",
"writable",
"."
] | 31b5f7783347deac4527a63afa522bc2e2ca8849 | https://github.com/espadrine/fleau/blob/31b5f7783347deac4527a63afa522bc2e2ca8849/fleau.js#L138-L158 | |
55,706 | espadrine/fleau | fleau.js | function(input) {
var code = 'var $_isidentifier = ' + $_isidentifier.toString() + ';\n' +
// FIXME: could we remove that eval?
'eval((' + literaltovar.toString() + ')($_scope));\n';
code += 'var $_parsers = {\n';
var parsernames = Object.keys(parsers);
for (var i = 0; i < parsernames.length; i++) {
... | javascript | function(input) {
var code = 'var $_isidentifier = ' + $_isidentifier.toString() + ';\n' +
// FIXME: could we remove that eval?
'eval((' + literaltovar.toString() + ')($_scope));\n';
code += 'var $_parsers = {\n';
var parsernames = Object.keys(parsers);
for (var i = 0; i < parsernames.length; i++) {
... | [
"function",
"(",
"input",
")",
"{",
"var",
"code",
"=",
"'var $_isidentifier = '",
"+",
"$_isidentifier",
".",
"toString",
"(",
")",
"+",
"';\\n'",
"+",
"// FIXME: could we remove that eval?",
"'eval(('",
"+",
"literaltovar",
".",
"toString",
"(",
")",
"+",
"')(... | Like template, with a timeout and sandbox. | [
"Like",
"template",
"with",
"a",
"timeout",
"and",
"sandbox",
"."
] | 31b5f7783347deac4527a63afa522bc2e2ca8849 | https://github.com/espadrine/fleau/blob/31b5f7783347deac4527a63afa522bc2e2ca8849/fleau.js#L177-L205 | |
55,707 | espadrine/fleau | fleau.js | function(input) {
var code = 'var $_parsers = {\n';
var parsernames = Object.keys(parsers);
for (var i = 0; i < parsernames.length; i++) {
code += ' ' + JSON.stringify(parsernames[i]) + ': ' +
parsers[parsernames[i]].toString() + ',\n';
};
code += '}\n';
code += compile(input) + '\nif (typeof $_e... | javascript | function(input) {
var code = 'var $_parsers = {\n';
var parsernames = Object.keys(parsers);
for (var i = 0; i < parsernames.length; i++) {
code += ' ' + JSON.stringify(parsernames[i]) + ': ' +
parsers[parsernames[i]].toString() + ',\n';
};
code += '}\n';
code += compile(input) + '\nif (typeof $_e... | [
"function",
"(",
"input",
")",
"{",
"var",
"code",
"=",
"'var $_parsers = {\\n'",
";",
"var",
"parsernames",
"=",
"Object",
".",
"keys",
"(",
"parsers",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"parsernames",
".",
"length",
";",
"i"... | string is a template. Return a function that takes a scope and returns a readable stream. | [
"string",
"is",
"a",
"template",
".",
"Return",
"a",
"function",
"that",
"takes",
"a",
"scope",
"and",
"returns",
"a",
"readable",
"stream",
"."
] | 31b5f7783347deac4527a63afa522bc2e2ca8849 | https://github.com/espadrine/fleau/blob/31b5f7783347deac4527a63afa522bc2e2ca8849/fleau.js#L209-L252 | |
55,708 | Pocketbrain/native-ads-web-ad-library | src/ads/adManager.js | function (applicationId, deviceDetails, environment) {
if(!applicationId) {
logger.wtf('No applicationID specified');
}
this.applicationId = applicationId;
this.deviceDetails = deviceDetails;
this.environment = environment;
this._currentAds = [];
this._loadingAds = [];
this.... | javascript | function (applicationId, deviceDetails, environment) {
if(!applicationId) {
logger.wtf('No applicationID specified');
}
this.applicationId = applicationId;
this.deviceDetails = deviceDetails;
this.environment = environment;
this._currentAds = [];
this._loadingAds = [];
this.... | [
"function",
"(",
"applicationId",
",",
"deviceDetails",
",",
"environment",
")",
"{",
"if",
"(",
"!",
"applicationId",
")",
"{",
"logger",
".",
"wtf",
"(",
"'No applicationID specified'",
")",
";",
"}",
"this",
".",
"applicationId",
"=",
"applicationId",
";",
... | Creates a new instance of the adManager
@param applicationId - The ID of the application to receive ads for
@param deviceDetails - Details about the current users' device
@param environment - Environment specific functions.
@constructor | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"adManager"
] | aafee1c42e0569ee77f334fc2c4eb71eb146957e | https://github.com/Pocketbrain/native-ads-web-ad-library/blob/aafee1c42e0569ee77f334fc2c4eb71eb146957e/src/ads/adManager.js#L21-L32 | |
55,709 | juttle/juttle-gmail-adapter | create_oauth_token.js | getNewToken | function getNewToken(credentials, oauth2Client, callback) {
var authUrl = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: SCOPES
});
console.log('Authorize this app by visiting this url: ', authUrl);
var rl = readline.createInterface({
input: process.stdin,
... | javascript | function getNewToken(credentials, oauth2Client, callback) {
var authUrl = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: SCOPES
});
console.log('Authorize this app by visiting this url: ', authUrl);
var rl = readline.createInterface({
input: process.stdin,
... | [
"function",
"getNewToken",
"(",
"credentials",
",",
"oauth2Client",
",",
"callback",
")",
"{",
"var",
"authUrl",
"=",
"oauth2Client",
".",
"generateAuthUrl",
"(",
"{",
"access_type",
":",
"'offline'",
",",
"scope",
":",
"SCOPES",
"}",
")",
";",
"console",
".... | Get and store new token after prompting for user authorization, and then
execute the given callback with the authorized OAuth2 client.
@param {Object} credentials The authorization client credentials.
@param {google.auth.OAuth2} oauth2Client The OAuth2 client to get token for.
@param {getEventsCallback} callback The c... | [
"Get",
"and",
"store",
"new",
"token",
"after",
"prompting",
"for",
"user",
"authorization",
"and",
"then",
"execute",
"the",
"given",
"callback",
"with",
"the",
"authorized",
"OAuth2",
"client",
"."
] | f535da123962c5b8e48ba4a2113469fed69248e3 | https://github.com/juttle/juttle-gmail-adapter/blob/f535da123962c5b8e48ba4a2113469fed69248e3/create_oauth_token.js#L56-L78 |
55,710 | juttle/juttle-gmail-adapter | create_oauth_token.js | listLabels | function listLabels(auth) {
var gmail = google.gmail('v1');
gmail.users.labels.list({
auth: auth,
userId: 'me',
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return;
}
var labels = response.labels;
... | javascript | function listLabels(auth) {
var gmail = google.gmail('v1');
gmail.users.labels.list({
auth: auth,
userId: 'me',
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return;
}
var labels = response.labels;
... | [
"function",
"listLabels",
"(",
"auth",
")",
"{",
"var",
"gmail",
"=",
"google",
".",
"gmail",
"(",
"'v1'",
")",
";",
"gmail",
".",
"users",
".",
"labels",
".",
"list",
"(",
"{",
"auth",
":",
"auth",
",",
"userId",
":",
"'me'",
",",
"}",
",",
"fun... | Lists the labels in the user's account.
@param {google.auth.OAuth2} auth An authorized OAuth2 client. | [
"Lists",
"the",
"labels",
"in",
"the",
"user",
"s",
"account",
"."
] | f535da123962c5b8e48ba4a2113469fed69248e3 | https://github.com/juttle/juttle-gmail-adapter/blob/f535da123962c5b8e48ba4a2113469fed69248e3/create_oauth_token.js#L110-L131 |
55,711 | juju/maraca | lib/delta-handlers.js | processDeltas | function processDeltas(deltas) {
let updates = {
changed: {},
removed: {}
};
deltas.forEach(delta => {
const entityType = delta[0];
const changeType = delta[1];
const entity = delta[2];
const key = _getEntityKey(entityType, entity);
if (!key) {
// We don't know how to manage this... | javascript | function processDeltas(deltas) {
let updates = {
changed: {},
removed: {}
};
deltas.forEach(delta => {
const entityType = delta[0];
const changeType = delta[1];
const entity = delta[2];
const key = _getEntityKey(entityType, entity);
if (!key) {
// We don't know how to manage this... | [
"function",
"processDeltas",
"(",
"deltas",
")",
"{",
"let",
"updates",
"=",
"{",
"changed",
":",
"{",
"}",
",",
"removed",
":",
"{",
"}",
"}",
";",
"deltas",
".",
"forEach",
"(",
"delta",
"=>",
"{",
"const",
"entityType",
"=",
"delta",
"[",
"0",
"... | Get the consolidated updates from the deltas.
@param {Array} deltas - The list of deltas.
@returns {Object} return - The delta updates.
@returns {Object} return.changed - The entities to change.
@returns {Object} return.removed - The entities to remove. | [
"Get",
"the",
"consolidated",
"updates",
"from",
"the",
"deltas",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/delta-handlers.js#L13-L35 |
55,712 | juju/maraca | lib/delta-handlers.js | _getEntityKey | function _getEntityKey(entityType, entity) {
switch (entityType) {
case 'remote-application':
case 'application':
case 'unit':
return entity.name;
case 'machine':
case 'relation':
return entity.id;
case 'annotation':
return entity.tag;
default:
// This is an unknown... | javascript | function _getEntityKey(entityType, entity) {
switch (entityType) {
case 'remote-application':
case 'application':
case 'unit':
return entity.name;
case 'machine':
case 'relation':
return entity.id;
case 'annotation':
return entity.tag;
default:
// This is an unknown... | [
"function",
"_getEntityKey",
"(",
"entityType",
",",
"entity",
")",
"{",
"switch",
"(",
"entityType",
")",
"{",
"case",
"'remote-application'",
":",
"case",
"'application'",
":",
"case",
"'unit'",
":",
"return",
"entity",
".",
"name",
";",
"case",
"'machine'",... | Get the identifier for the entity based upon its type.
@param {String} entityType - The type of entity.
@param {Object} entity - The entity details.
@returns {String} The entity key. | [
"Get",
"the",
"identifier",
"for",
"the",
"entity",
"based",
"upon",
"its",
"type",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/delta-handlers.js#L43-L59 |
55,713 | juju/maraca | lib/delta-handlers.js | _parseEntity | function _parseEntity(entityType, entity) {
switch (entityType) {
case 'remote-application':
return parsers.parseRemoteApplication(entity);
case 'application':
return parsers.parseApplication(entity);
case 'unit':
return parsers.parseUnit(entity);
case 'machine':
return parsers... | javascript | function _parseEntity(entityType, entity) {
switch (entityType) {
case 'remote-application':
return parsers.parseRemoteApplication(entity);
case 'application':
return parsers.parseApplication(entity);
case 'unit':
return parsers.parseUnit(entity);
case 'machine':
return parsers... | [
"function",
"_parseEntity",
"(",
"entityType",
",",
"entity",
")",
"{",
"switch",
"(",
"entityType",
")",
"{",
"case",
"'remote-application'",
":",
"return",
"parsers",
".",
"parseRemoteApplication",
"(",
"entity",
")",
";",
"case",
"'application'",
":",
"return... | Parse the entity response into a friendly format.
@param {String} entityType - The type of entity.
@param {Object} entity - The entity details.
@returns {Object} The parsed entity. | [
"Parse",
"the",
"entity",
"response",
"into",
"a",
"friendly",
"format",
"."
] | 0f245c6e09ef215fb4726bf7650320be2f49b6a0 | https://github.com/juju/maraca/blob/0f245c6e09ef215fb4726bf7650320be2f49b6a0/lib/delta-handlers.js#L81-L100 |
55,714 | meepobrother/meepo-loader | demo/assets/meepo.libs/masonry/masonry.pkgd.js | getMilliseconds | function getMilliseconds( time ) {
if ( typeof time == 'number' ) {
return time;
}
var matches = time.match( /(^\d*\.?\d*)(\w*)/ );
var num = matches && matches[1];
var unit = matches && matches[2];
if ( !num.length ) {
return 0;
}
num = parseFloat( num );
var mult = msUnits[ unit ] || 1;
re... | javascript | function getMilliseconds( time ) {
if ( typeof time == 'number' ) {
return time;
}
var matches = time.match( /(^\d*\.?\d*)(\w*)/ );
var num = matches && matches[1];
var unit = matches && matches[2];
if ( !num.length ) {
return 0;
}
num = parseFloat( num );
var mult = msUnits[ unit ] || 1;
re... | [
"function",
"getMilliseconds",
"(",
"time",
")",
"{",
"if",
"(",
"typeof",
"time",
"==",
"'number'",
")",
"{",
"return",
"time",
";",
"}",
"var",
"matches",
"=",
"time",
".",
"match",
"(",
"/",
"(^\\d*\\.?\\d*)(\\w*)",
"/",
")",
";",
"var",
"num",
"=",... | munge time-like parameter into millisecond number '0.4s' -> 40 | [
"munge",
"time",
"-",
"like",
"parameter",
"into",
"millisecond",
"number",
"0",
".",
"4s",
"-",
">",
"40"
] | c0acb052d3c31b15d1b9cbb7b82659df78d50094 | https://github.com/meepobrother/meepo-loader/blob/c0acb052d3c31b15d1b9cbb7b82659df78d50094/demo/assets/meepo.libs/masonry/masonry.pkgd.js#L2239-L2252 |
55,715 | helinjiang/babel-d | lib/babel-compile.js | compileFile | function compileFile(srcFullPath, saveOutFullPath, onlyCopy) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var content = fs.readFileSync(srcFullPath, 'utf8');
//when get file content empty, maybe file is locked
if (!content) {
return;
}
// only copy file cont... | javascript | function compileFile(srcFullPath, saveOutFullPath, onlyCopy) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var content = fs.readFileSync(srcFullPath, 'utf8');
//when get file content empty, maybe file is locked
if (!content) {
return;
}
// only copy file cont... | [
"function",
"compileFile",
"(",
"srcFullPath",
",",
"saveOutFullPath",
",",
"onlyCopy",
")",
"{",
"var",
"options",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
"{"... | compile single file
@param {String} srcFullPath
@param {String} saveOutFullPath
@param {Boolean} [onlyCopy]
@param {Object} [options]
@param {String} [options.debug] only for debug | [
"compile",
"single",
"file"
] | 12e05f8702f850f7427416489097c50b93093abb | https://github.com/helinjiang/babel-d/blob/12e05f8702f850f7427416489097c50b93093abb/lib/babel-compile.js#L118-L158 |
55,716 | helinjiang/babel-d | lib/babel-compile.js | getFiles | function getFiles(paths) {
var result = fileUtil.getAllFiles(paths);
var files = result.map(function (item) {
return item.relativePath;
// return path.join(item.basePath, item.relativePath);
});
return files;
} | javascript | function getFiles(paths) {
var result = fileUtil.getAllFiles(paths);
var files = result.map(function (item) {
return item.relativePath;
// return path.join(item.basePath, item.relativePath);
});
return files;
} | [
"function",
"getFiles",
"(",
"paths",
")",
"{",
"var",
"result",
"=",
"fileUtil",
".",
"getAllFiles",
"(",
"paths",
")",
";",
"var",
"files",
"=",
"result",
".",
"map",
"(",
"function",
"(",
"item",
")",
"{",
"return",
"item",
".",
"relativePath",
";",... | get all files
@param paths | [
"get",
"all",
"files"
] | 12e05f8702f850f7427416489097c50b93093abb | https://github.com/helinjiang/babel-d/blob/12e05f8702f850f7427416489097c50b93093abb/lib/babel-compile.js#L175-L184 |
55,717 | byu-oit/fully-typed | bin/one-of.js | TypedOneOf | function TypedOneOf (config) {
const oneOf = this;
// validate oneOf
if (!config.hasOwnProperty('oneOf')) {
throw Error('Invalid configuration. Missing required one-of property: oneOf. Must be an array of schema configurations.');
}
if (!Array.isArray(config.oneOf) || config.oneOf.filter(v ... | javascript | function TypedOneOf (config) {
const oneOf = this;
// validate oneOf
if (!config.hasOwnProperty('oneOf')) {
throw Error('Invalid configuration. Missing required one-of property: oneOf. Must be an array of schema configurations.');
}
if (!Array.isArray(config.oneOf) || config.oneOf.filter(v ... | [
"function",
"TypedOneOf",
"(",
"config",
")",
"{",
"const",
"oneOf",
"=",
"this",
";",
"// validate oneOf",
"if",
"(",
"!",
"config",
".",
"hasOwnProperty",
"(",
"'oneOf'",
")",
")",
"{",
"throw",
"Error",
"(",
"'Invalid configuration. Missing required one-of prop... | Create a TypedOneOf instance.
@param {object} config
@returns {TypedOneOf}
@augments Typed
@constructor | [
"Create",
"a",
"TypedOneOf",
"instance",
"."
] | ed6b3ed88ffc72990acffb765232eaaee261afef | https://github.com/byu-oit/fully-typed/blob/ed6b3ed88ffc72990acffb765232eaaee261afef/bin/one-of.js#L29-L67 |
55,718 | melvincarvalho/rdf-shell | bin/mv.js | bin | function bin (argv) {
program.version(pkg.version)
.usage('[options] <sourceURI> <destURI>')
.parse(argv)
var sourceURI = program.args[0]
var destURI = program.args[1]
if (!sourceURI || !destURI) {
program.help()
}
shell.mv(sourceURI, destURI, function (err, res, uri) {
if (!err) {
debu... | javascript | function bin (argv) {
program.version(pkg.version)
.usage('[options] <sourceURI> <destURI>')
.parse(argv)
var sourceURI = program.args[0]
var destURI = program.args[1]
if (!sourceURI || !destURI) {
program.help()
}
shell.mv(sourceURI, destURI, function (err, res, uri) {
if (!err) {
debu... | [
"function",
"bin",
"(",
"argv",
")",
"{",
"program",
".",
"version",
"(",
"pkg",
".",
"version",
")",
".",
"usage",
"(",
"'[options] <sourceURI> <destURI>'",
")",
".",
"parse",
"(",
"argv",
")",
"var",
"sourceURI",
"=",
"program",
".",
"args",
"[",
"0",
... | mv as a command.
@param {Array} argv Arguments | [
"mv",
"as",
"a",
"command",
"."
] | bf2015f6f333855e69a18ce3ec9e917bbddfb425 | https://github.com/melvincarvalho/rdf-shell/blob/bf2015f6f333855e69a18ce3ec9e917bbddfb425/bin/mv.js#L12-L31 |
55,719 | waka/node-bowl | lib/watcher.js | function(evt) {
if (evt !== 'change' && evt !== 'rename') {
return;
}
fs.stat(file, function(err, current) {
if (err) {
self.logger_.error(err.message);
self.emit('error.watch', err.message);
return;
}
if (current.size !== prev.size || +current.mtime > +prev.m... | javascript | function(evt) {
if (evt !== 'change' && evt !== 'rename') {
return;
}
fs.stat(file, function(err, current) {
if (err) {
self.logger_.error(err.message);
self.emit('error.watch', err.message);
return;
}
if (current.size !== prev.size || +current.mtime > +prev.m... | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
"!==",
"'change'",
"&&",
"evt",
"!==",
"'rename'",
")",
"{",
"return",
";",
"}",
"fs",
".",
"stat",
"(",
"file",
",",
"function",
"(",
"err",
",",
"current",
")",
"{",
"if",
"(",
"err",
")",
"... | filename is not supported when MacOSX | [
"filename",
"is",
"not",
"supported",
"when",
"MacOSX"
] | 671e8b16371a279e23b65bb9b2ff9dae047b6644 | https://github.com/waka/node-bowl/blob/671e8b16371a279e23b65bb9b2ff9dae047b6644/lib/watcher.js#L166-L182 | |
55,720 | matterial/oknow | oknow.js | function(fn, syntheticArgs) {
var $this = this;
syntheticArgs = syntheticArgs || [];
/**
* Ensure to have it in the next event loop for better async
*/
var processResponder = function() {
try {
if (fn) {
/**
* Insert a done() or ok() argument to other needed arguments
*/
synth... | javascript | function(fn, syntheticArgs) {
var $this = this;
syntheticArgs = syntheticArgs || [];
/**
* Ensure to have it in the next event loop for better async
*/
var processResponder = function() {
try {
if (fn) {
/**
* Insert a done() or ok() argument to other needed arguments
*/
synth... | [
"function",
"(",
"fn",
",",
"syntheticArgs",
")",
"{",
"var",
"$this",
"=",
"this",
";",
"syntheticArgs",
"=",
"syntheticArgs",
"||",
"[",
"]",
";",
"/**\n\t\t * Ensure to have it in the next event loop for better async\n\t\t */",
"var",
"processResponder",
"=",
"functi... | Executes a given function with provided arguments, and then calls the next one in queue
@param {Function} fn Function to execute
@param {Array} syntheticArgs Arguments to be passed to the function called
@return {Promise} Returns self object for chaining | [
"Executes",
"a",
"given",
"function",
"with",
"provided",
"arguments",
"and",
"then",
"calls",
"the",
"next",
"one",
"in",
"queue"
] | 71008691603c776f534eb53fb73a3a0eb137a52a | https://github.com/matterial/oknow/blob/71008691603c776f534eb53fb73a3a0eb137a52a/oknow.js#L47-L96 | |
55,721 | matterial/oknow | oknow.js | function() {
try {
if (fn) {
/**
* Insert a done() or ok() argument to other needed arguments
*/
syntheticArgs.unshift(function() {
/**
* Call the next in queue
*/
$this.next.apply($this, arguments);
});
/**
* Call the function finally
*/
... | javascript | function() {
try {
if (fn) {
/**
* Insert a done() or ok() argument to other needed arguments
*/
syntheticArgs.unshift(function() {
/**
* Call the next in queue
*/
$this.next.apply($this, arguments);
});
/**
* Call the function finally
*/
... | [
"function",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"fn",
")",
"{",
"/**\n\t\t\t\t\t * Insert a done() or ok() argument to other needed arguments\n\t\t\t\t\t */",
"syntheticArgs",
".",
"unshift",
"(",
"function",
"(",
")",
"{",
"/**\n\t\t\t\t\t\t * Call the next in queue\n\t\t\... | Ensure to have it in the next event loop for better async | [
"Ensure",
"to",
"have",
"it",
"in",
"the",
"next",
"event",
"loop",
"for",
"better",
"async"
] | 71008691603c776f534eb53fb73a3a0eb137a52a | https://github.com/matterial/oknow/blob/71008691603c776f534eb53fb73a3a0eb137a52a/oknow.js#L53-L86 | |
55,722 | matterial/oknow | oknow.js | function(err) {
/**
* If err is an Error object, break the chain and call catch
*/
if (err && (err.constructor.name === "Error" || err.constructor.name === "TypeError") && this.onCatch) {
this.onCatch(err);
return;
}
var nextFn = this.fnStack.shift();
if (nextFn) {
/**
* Ensure arguments a... | javascript | function(err) {
/**
* If err is an Error object, break the chain and call catch
*/
if (err && (err.constructor.name === "Error" || err.constructor.name === "TypeError") && this.onCatch) {
this.onCatch(err);
return;
}
var nextFn = this.fnStack.shift();
if (nextFn) {
/**
* Ensure arguments a... | [
"function",
"(",
"err",
")",
"{",
"/**\n\t\t * If err is an Error object, break the chain and call catch\n\t\t */",
"if",
"(",
"err",
"&&",
"(",
"err",
".",
"constructor",
".",
"name",
"===",
"\"Error\"",
"||",
"err",
".",
"constructor",
".",
"name",
"===",
"\"TypeE... | Calls the next function in queue, or calls the function passed in `catch` if error occurs
@param {Error} err Error object optionally passed
@return {Promise} Return self for chaining | [
"Calls",
"the",
"next",
"function",
"in",
"queue",
"or",
"calls",
"the",
"function",
"passed",
"in",
"catch",
"if",
"error",
"occurs"
] | 71008691603c776f534eb53fb73a3a0eb137a52a | https://github.com/matterial/oknow/blob/71008691603c776f534eb53fb73a3a0eb137a52a/oknow.js#L111-L128 | |
55,723 | 4ndr01d3/js-components | biojs-rest-jsdas/src/jsdas.js | function(xml, command, version) {
var formatVersion = version || JSDAS.Formats.current;
var format = JSDAS.Formats[formatVersion][command];
var json = JSDAS.Parser.parseElement(xml, format);
return json;
} | javascript | function(xml, command, version) {
var formatVersion = version || JSDAS.Formats.current;
var format = JSDAS.Formats[formatVersion][command];
var json = JSDAS.Parser.parseElement(xml, format);
return json;
} | [
"function",
"(",
"xml",
",",
"command",
",",
"version",
")",
"{",
"var",
"formatVersion",
"=",
"version",
"||",
"JSDAS",
".",
"Formats",
".",
"current",
";",
"var",
"format",
"=",
"JSDAS",
".",
"Formats",
"[",
"formatVersion",
"]",
"[",
"command",
"]",
... | Private methods Given a valid DAS XML, it returns its translation to JSON | [
"Private",
"methods",
"Given",
"a",
"valid",
"DAS",
"XML",
"it",
"returns",
"its",
"translation",
"to",
"JSON"
] | d6abbc49a79fe89ba9b1b1ef2307790693900440 | https://github.com/4ndr01d3/js-components/blob/d6abbc49a79fe89ba9b1b1ef2307790693900440/biojs-rest-jsdas/src/jsdas.js#L27-L32 | |
55,724 | 4ndr01d3/js-components | biojs-rest-jsdas/src/jsdas.js | function(xml, format) {
var out = {};
//The Document object does not have all the functionality of a standard node (i.e. it can't have attributes).
//So, if we are in the Document element, move to its ¿¿only?? child, the root.
if(xml.nodeType == 9) { //detect the Document node type
xml = xml.firstChild;
... | javascript | function(xml, format) {
var out = {};
//The Document object does not have all the functionality of a standard node (i.e. it can't have attributes).
//So, if we are in the Document element, move to its ¿¿only?? child, the root.
if(xml.nodeType == 9) { //detect the Document node type
xml = xml.firstChild;
... | [
"function",
"(",
"xml",
",",
"format",
")",
"{",
"var",
"out",
"=",
"{",
"}",
";",
"//The Document object does not have all the functionality of a standard node (i.e. it can't have attributes).",
"//So, if we are in the Document element, move to its ¿¿only?? child, the root.",
"if",
... | true to raise an error if a mandatory element is not present Private functions (actually not really private. just not API documented | [
"true",
"to",
"raise",
"an",
"error",
"if",
"a",
"mandatory",
"element",
"is",
"not",
"present",
"Private",
"functions",
"(",
"actually",
"not",
"really",
"private",
".",
"just",
"not",
"API",
"documented"
] | d6abbc49a79fe89ba9b1b1ef2307790693900440 | https://github.com/4ndr01d3/js-components/blob/d6abbc49a79fe89ba9b1b1ef2307790693900440/biojs-rest-jsdas/src/jsdas.js#L2222-L2289 | |
55,725 | 4ndr01d3/js-components | biojs-rest-jsdas/src/jsdas.js | function(url, callback, errorcallback){
if (!this.initialized) {
this.initialize();
}
var xmlloader = JSDAS.XMLLoader; //get a reference to myself
var usingCORS = true;
var xhr = this.xhrCORS('GET', url);
if(!xhr) { //if the browser is not CORS capable, fallback to proxy if available
if(this.pro... | javascript | function(url, callback, errorcallback){
if (!this.initialized) {
this.initialize();
}
var xmlloader = JSDAS.XMLLoader; //get a reference to myself
var usingCORS = true;
var xhr = this.xhrCORS('GET', url);
if(!xhr) { //if the browser is not CORS capable, fallback to proxy if available
if(this.pro... | [
"function",
"(",
"url",
",",
"callback",
",",
"errorcallback",
")",
"{",
"if",
"(",
"!",
"this",
".",
"initialized",
")",
"{",
"this",
".",
"initialize",
"(",
")",
";",
"}",
"var",
"xmlloader",
"=",
"JSDAS",
".",
"XMLLoader",
";",
"//get a reference to m... | This function loads an external XML using a proxy on the server to comply with the SOP
@param {Object} url
@param {Object} callback | [
"This",
"function",
"loads",
"an",
"external",
"XML",
"using",
"a",
"proxy",
"on",
"the",
"server",
"to",
"comply",
"with",
"the",
"SOP"
] | d6abbc49a79fe89ba9b1b1ef2307790693900440 | https://github.com/4ndr01d3/js-components/blob/d6abbc49a79fe89ba9b1b1ef2307790693900440/biojs-rest-jsdas/src/jsdas.js#L2374-L2458 | |
55,726 | 4ndr01d3/js-components | biojs-rest-jsdas/src/jsdas.js | function(xhr){
if (xhr && (xhr.readyState == 4)) {
if (xmlloader.httpSuccess(xhr)) {
processResponse(xhr);
}
else { //if it failed, it mighht be that the source has no CORS enabled. In such case, fallback to proxy before erroring
if(usingCORS && xmlloader.proxyURL) { //if it failed when using C... | javascript | function(xhr){
if (xhr && (xhr.readyState == 4)) {
if (xmlloader.httpSuccess(xhr)) {
processResponse(xhr);
}
else { //if it failed, it mighht be that the source has no CORS enabled. In such case, fallback to proxy before erroring
if(usingCORS && xmlloader.proxyURL) { //if it failed when using C... | [
"function",
"(",
"xhr",
")",
"{",
"if",
"(",
"xhr",
"&&",
"(",
"xhr",
".",
"readyState",
"==",
"4",
")",
")",
"{",
"if",
"(",
"xmlloader",
".",
"httpSuccess",
"(",
"xhr",
")",
")",
"{",
"processResponse",
"(",
"xhr",
")",
";",
"}",
"else",
"{",
... | necessary so the closures get the variable | [
"necessary",
"so",
"the",
"closures",
"get",
"the",
"variable"
] | d6abbc49a79fe89ba9b1b1ef2307790693900440 | https://github.com/4ndr01d3/js-components/blob/d6abbc49a79fe89ba9b1b1ef2307790693900440/biojs-rest-jsdas/src/jsdas.js#L2399-L2419 | |
55,727 | epii-io/epii-node-render | recipe/view.js | writeLaunchCode | function writeLaunchCode(config) {
var { name, stub } = config.holder
if (!name || !stub) {
throw new Error('invalid name or stub')
}
var code = `
;(function () {
var root = document.getElementById('${name}');
if (!root) throw new Error('undefined ${stub} root');
var view = window.${st... | javascript | function writeLaunchCode(config) {
var { name, stub } = config.holder
if (!name || !stub) {
throw new Error('invalid name or stub')
}
var code = `
;(function () {
var root = document.getElementById('${name}');
if (!root) throw new Error('undefined ${stub} root');
var view = window.${st... | [
"function",
"writeLaunchCode",
"(",
"config",
")",
"{",
"var",
"{",
"name",
",",
"stub",
"}",
"=",
"config",
".",
"holder",
"if",
"(",
"!",
"name",
"||",
"!",
"stub",
")",
"{",
"throw",
"new",
"Error",
"(",
"'invalid name or stub'",
")",
"}",
"var",
... | write launch code
@param {Object} config | [
"write",
"launch",
"code"
] | e8afa57066251e173b3a6455d47218c95f30f563 | https://github.com/epii-io/epii-node-render/blob/e8afa57066251e173b3a6455d47218c95f30f563/recipe/view.js#L49-L66 |
55,728 | mattdesl/simplex-sampler | index.js | NoiseSampler | function NoiseSampler(size) {
if (!size)
throw "no size specified to NoiseSampler";
this.size = size;
this.scale = 1;
this.offset = 0;
this.smooth = true;
this.seamless = false;
// this.scales = [
// 10, 0.1, 0.2, 1
// ];
... | javascript | function NoiseSampler(size) {
if (!size)
throw "no size specified to NoiseSampler";
this.size = size;
this.scale = 1;
this.offset = 0;
this.smooth = true;
this.seamless = false;
// this.scales = [
// 10, 0.1, 0.2, 1
// ];
... | [
"function",
"NoiseSampler",
"(",
"size",
")",
"{",
"if",
"(",
"!",
"size",
")",
"throw",
"\"no size specified to NoiseSampler\"",
";",
"this",
".",
"size",
"=",
"size",
";",
"this",
".",
"scale",
"=",
"1",
";",
"this",
".",
"offset",
"=",
"0",
";",
"th... | Samples a 1-component texture, noise in this case | [
"Samples",
"a",
"1",
"-",
"component",
"texture",
"noise",
"in",
"this",
"case"
] | 5900d05b77f876b2d54b88d3017c31b8d4a77587 | https://github.com/mattdesl/simplex-sampler/blob/5900d05b77f876b2d54b88d3017c31b8d4a77587/index.js#L21-L46 |
55,729 | mattdesl/simplex-sampler | index.js | function(x, y) {
//avoid negatives
if (this.seamless) {
x = (x%this.size + this.size)%this.size
y = (y%this.size + this.size)%this.size
} else {
x = clamp(x, 0, this.size)
y = clamp(y, 0, this.size)
}
if (this.smooth)
r... | javascript | function(x, y) {
//avoid negatives
if (this.seamless) {
x = (x%this.size + this.size)%this.size
y = (y%this.size + this.size)%this.size
} else {
x = clamp(x, 0, this.size)
y = clamp(y, 0, this.size)
}
if (this.smooth)
r... | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"//avoid negatives",
"if",
"(",
"this",
".",
"seamless",
")",
"{",
"x",
"=",
"(",
"x",
"%",
"this",
".",
"size",
"+",
"this",
".",
"size",
")",
"%",
"this",
".",
"size",
"y",
"=",
"(",
"y",
"%",
"this... | returns a float, -1 to 1 | [
"returns",
"a",
"float",
"-",
"1",
"to",
"1"
] | 5900d05b77f876b2d54b88d3017c31b8d4a77587 | https://github.com/mattdesl/simplex-sampler/blob/5900d05b77f876b2d54b88d3017c31b8d4a77587/index.js#L99-L113 | |
55,730 | darkobits/interface | src/interface.js | is | function is (constructor, value) {
return value !== null && (value.constructor === constructor || value instanceof constructor);
} | javascript | function is (constructor, value) {
return value !== null && (value.constructor === constructor || value instanceof constructor);
} | [
"function",
"is",
"(",
"constructor",
",",
"value",
")",
"{",
"return",
"value",
"!==",
"null",
"&&",
"(",
"value",
".",
"constructor",
"===",
"constructor",
"||",
"value",
"instanceof",
"constructor",
")",
";",
"}"
] | Determines if 'value' is an instance of 'constructor'.
@private
@param {object} constructor
@param {*} value
@return {boolean} | [
"Determines",
"if",
"value",
"is",
"an",
"instance",
"of",
"constructor",
"."
] | 819aec7ca45484cdd53208864d8fdaad96dad3c2 | https://github.com/darkobits/interface/blob/819aec7ca45484cdd53208864d8fdaad96dad3c2/src/interface.js#L20-L22 |
55,731 | usco/usco-stl-parser | dist/utils.js | isDataBinaryRobust | function isDataBinaryRobust(data) {
// console.log('data is binary ?')
var patternVertex = /vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
var text = ensureString(data);
var isBinary = patternVertex.exec(t... | javascript | function isDataBinaryRobust(data) {
// console.log('data is binary ?')
var patternVertex = /vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
var text = ensureString(data);
var isBinary = patternVertex.exec(t... | [
"function",
"isDataBinaryRobust",
"(",
"data",
")",
"{",
"// console.log('data is binary ?')",
"var",
"patternVertex",
"=",
"/",
"vertex[\\s]+([\\-+]?[0-9]+\\.?[0-9]*([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+[\\s]+([\\-+]?[0-9]*\\.?[0-9]+([eE][\\-+]?[0-9]+)?)+",... | a more robust version of the above, that does NOT require the whole file | [
"a",
"more",
"robust",
"version",
"of",
"the",
"above",
"that",
"does",
"NOT",
"require",
"the",
"whole",
"file"
] | 49eb402f124723d8f74cc67f24a7017c2b99bca4 | https://github.com/usco/usco-stl-parser/blob/49eb402f124723d8f74cc67f24a7017c2b99bca4/dist/utils.js#L53-L59 |
55,732 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/auth/scram.js | function(err, r) {
if (err) {
numberOfValidConnections = numberOfValidConnections - 1;
errorObject = err;
return false;
} else if (r.result['$err']) {
errorObject = r.result;
return false;
} else if (r.result['errmsg']) {
errorObject = r.result;
... | javascript | function(err, r) {
if (err) {
numberOfValidConnections = numberOfValidConnections - 1;
errorObject = err;
return false;
} else if (r.result['$err']) {
errorObject = r.result;
return false;
} else if (r.result['errmsg']) {
errorObject = r.result;
... | [
"function",
"(",
"err",
",",
"r",
")",
"{",
"if",
"(",
"err",
")",
"{",
"numberOfValidConnections",
"=",
"numberOfValidConnections",
"-",
"1",
";",
"errorObject",
"=",
"err",
";",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"r",
".",
"result",
"[",... | Handle the error | [
"Handle",
"the",
"error"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/auth/scram.js#L205-L221 | |
55,733 | dak0rn/espressojs | index.js | function(options) {
Configurable.call(this);
this._resources = [];
this._serializer = require(__dirname + '/lib/Serializer');
this.setAll( _.extend({}, defaults, options) );
// List of IDs used to find duplicate handlers fast
this._ids = {
// id: handler
... | javascript | function(options) {
Configurable.call(this);
this._resources = [];
this._serializer = require(__dirname + '/lib/Serializer');
this.setAll( _.extend({}, defaults, options) );
// List of IDs used to find duplicate handlers fast
this._ids = {
// id: handler
... | [
"function",
"(",
"options",
")",
"{",
"Configurable",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_resources",
"=",
"[",
"]",
";",
"this",
".",
"_serializer",
"=",
"require",
"(",
"__dirname",
"+",
"'/lib/Serializer'",
")",
";",
"this",
".",
"set... | espressojs constructor function
@param {object} options Optional options object | [
"espressojs",
"constructor",
"function"
] | 7f8e015f31113215abbe9988ae7f2c7dd5d8572b | https://github.com/dak0rn/espressojs/blob/7f8e015f31113215abbe9988ae7f2c7dd5d8572b/index.js#L22-L40 | |
55,734 | jshanley/motivejs | dist/motive.cjs.js | makeValidation | function makeValidation(name, exp, parser) {
return function (input) {
if (typeof input !== 'string') {
throw new TypeError('Cannot validate ' + name + '. Input must be a string.');
}
var validate = function () {
return input.match(exp) ? true : false;
};
... | javascript | function makeValidation(name, exp, parser) {
return function (input) {
if (typeof input !== 'string') {
throw new TypeError('Cannot validate ' + name + '. Input must be a string.');
}
var validate = function () {
return input.match(exp) ? true : false;
};
... | [
"function",
"makeValidation",
"(",
"name",
",",
"exp",
",",
"parser",
")",
"{",
"return",
"function",
"(",
"input",
")",
"{",
"if",
"(",
"typeof",
"input",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Cannot validate '",
"+",
"name",
... | this makes a validation function for a string type defined by 'name' | [
"this",
"makes",
"a",
"validation",
"function",
"for",
"a",
"string",
"type",
"defined",
"by",
"name"
] | ba11720e0580da4657374dc47b177be15a723f6a | https://github.com/jshanley/motivejs/blob/ba11720e0580da4657374dc47b177be15a723f6a/dist/motive.cjs.js#L49-L68 |
55,735 | bestander/pong-mmo-server | game/socket/pongSocket.js | pipeEvents | function pipeEvents(source, destination, event) {
source.on(event, function (data) {
destination.emit(event, data);
});
} | javascript | function pipeEvents(source, destination, event) {
source.on(event, function (data) {
destination.emit(event, data);
});
} | [
"function",
"pipeEvents",
"(",
"source",
",",
"destination",
",",
"event",
")",
"{",
"source",
".",
"on",
"(",
"event",
",",
"function",
"(",
"data",
")",
"{",
"destination",
".",
"emit",
"(",
"event",
",",
"data",
")",
";",
"}",
")",
";",
"}"
] | pipe specific events from source event emitter to destination event emitter
@param source event emitter
@param destination event emitter
@param event event name | [
"pipe",
"specific",
"events",
"from",
"source",
"event",
"emitter",
"to",
"destination",
"event",
"emitter"
] | 7a54644bbf8b224f5010a30bacc98778201fe01c | https://github.com/bestander/pong-mmo-server/blob/7a54644bbf8b224f5010a30bacc98778201fe01c/game/socket/pongSocket.js#L70-L74 |
55,736 | danmasta/env | index.js | get | function get(key) {
let val = process.env[key];
return val in types ? types[val] : util.isNumeric(val) ? parseFloat(val) : val;
} | javascript | function get(key) {
let val = process.env[key];
return val in types ? types[val] : util.isNumeric(val) ? parseFloat(val) : val;
} | [
"function",
"get",
"(",
"key",
")",
"{",
"let",
"val",
"=",
"process",
".",
"env",
"[",
"key",
"]",
";",
"return",
"val",
"in",
"types",
"?",
"types",
"[",
"val",
"]",
":",
"util",
".",
"isNumeric",
"(",
"val",
")",
"?",
"parseFloat",
"(",
"val",... | get env variable, converts to native type | [
"get",
"env",
"variable",
"converts",
"to",
"native",
"type"
] | cd6df18f4f837797d47cd96bcfb125c0264685a7 | https://github.com/danmasta/env/blob/cd6df18f4f837797d47cd96bcfb125c0264685a7/index.js#L12-L18 |
55,737 | danmasta/env | index.js | set | function set(key, val) {
return process.env[key] = (process.env[key] === undefined ? val : process.env[key]);
} | javascript | function set(key, val) {
return process.env[key] = (process.env[key] === undefined ? val : process.env[key]);
} | [
"function",
"set",
"(",
"key",
",",
"val",
")",
"{",
"return",
"process",
".",
"env",
"[",
"key",
"]",
"=",
"(",
"process",
".",
"env",
"[",
"key",
"]",
"===",
"undefined",
"?",
"val",
":",
"process",
".",
"env",
"[",
"key",
"]",
")",
";",
"}"
... | sets environment variable if it does not exist already env variables are stringified when set | [
"sets",
"environment",
"variable",
"if",
"it",
"does",
"not",
"exist",
"already",
"env",
"variables",
"are",
"stringified",
"when",
"set"
] | cd6df18f4f837797d47cd96bcfb125c0264685a7 | https://github.com/danmasta/env/blob/cd6df18f4f837797d47cd96bcfb125c0264685a7/index.js#L22-L24 |
55,738 | danmasta/env | index.js | load | function load(file) {
let contents = null;
file = path.resolve(file);
// handle .env files
if (constants.REGEX.envfile.test(file)) {
contents = util.parse(fs.readFileSync(file, 'utf8'));
// handle .js/.json files
} else {
contents = require(file);
}
return env(conten... | javascript | function load(file) {
let contents = null;
file = path.resolve(file);
// handle .env files
if (constants.REGEX.envfile.test(file)) {
contents = util.parse(fs.readFileSync(file, 'utf8'));
// handle .js/.json files
} else {
contents = require(file);
}
return env(conten... | [
"function",
"load",
"(",
"file",
")",
"{",
"let",
"contents",
"=",
"null",
";",
"file",
"=",
"path",
".",
"resolve",
"(",
"file",
")",
";",
"// handle .env files",
"if",
"(",
"constants",
".",
"REGEX",
".",
"envfile",
".",
"test",
"(",
"file",
")",
"... | load a file's contents and add to env | [
"load",
"a",
"file",
"s",
"contents",
"and",
"add",
"to",
"env"
] | cd6df18f4f837797d47cd96bcfb125c0264685a7 | https://github.com/danmasta/env/blob/cd6df18f4f837797d47cd96bcfb125c0264685a7/index.js#L50-L67 |
55,739 | danmasta/env | index.js | init | function init(){
// set NODE_ENV to --env value
if (argv.env) {
set('NODE_ENV', argv.env);
}
// load evironment files
['./.env', './config/.env', './env', './config/env'].map(file => {
try {
load(file);
} catch(err) {
if (env('DEBUG')) {
... | javascript | function init(){
// set NODE_ENV to --env value
if (argv.env) {
set('NODE_ENV', argv.env);
}
// load evironment files
['./.env', './config/.env', './env', './config/env'].map(file => {
try {
load(file);
} catch(err) {
if (env('DEBUG')) {
... | [
"function",
"init",
"(",
")",
"{",
"// set NODE_ENV to --env value",
"if",
"(",
"argv",
".",
"env",
")",
"{",
"set",
"(",
"'NODE_ENV'",
",",
"argv",
".",
"env",
")",
";",
"}",
"// load evironment files",
"[",
"'./.env'",
",",
"'./config/.env'",
",",
"'./env'... | attempt to load env configuration files | [
"attempt",
"to",
"load",
"env",
"configuration",
"files"
] | cd6df18f4f837797d47cd96bcfb125c0264685a7 | https://github.com/danmasta/env/blob/cd6df18f4f837797d47cd96bcfb125c0264685a7/index.js#L70-L101 |
55,740 | jchartrand/CWRC-WriterLayout | src/modules/structureTree.js | _expandParentsForNode | function _expandParentsForNode(node) {
// get the actual parent nodes in the editor
var parents = [];
$(node).parentsUntil('#tinymce').each(function(index, el) {
parents.push(el.id);
});
parents.reverse();
// TODO handling for readonly mode where only... | javascript | function _expandParentsForNode(node) {
// get the actual parent nodes in the editor
var parents = [];
$(node).parentsUntil('#tinymce').each(function(index, el) {
parents.push(el.id);
});
parents.reverse();
// TODO handling for readonly mode where only... | [
"function",
"_expandParentsForNode",
"(",
"node",
")",
"{",
"// get the actual parent nodes in the editor",
"var",
"parents",
"=",
"[",
"]",
";",
"$",
"(",
"node",
")",
".",
"parentsUntil",
"(",
"'#tinymce'",
")",
".",
"each",
"(",
"function",
"(",
"index",
",... | Expands the parents of a particular node
@param {element} node A node that exists in the editor | [
"Expands",
"the",
"parents",
"of",
"a",
"particular",
"node"
] | 4a4b75af695043bc276efd3a9e5eb7e836c52d6e | https://github.com/jchartrand/CWRC-WriterLayout/blob/4a4b75af695043bc276efd3a9e5eb7e836c52d6e/src/modules/structureTree.js#L148-L167 |
55,741 | jchartrand/CWRC-WriterLayout | src/modules/structureTree.js | selectNode | function selectNode($node, selectContents, multiselect, external) {
var id = $node.attr('name');
_removeCustomClasses();
// clear other selections if not multiselect
if (!multiselect) {
if (tree.currentlySelectedNodes.indexOf(id) != -1) {
tre... | javascript | function selectNode($node, selectContents, multiselect, external) {
var id = $node.attr('name');
_removeCustomClasses();
// clear other selections if not multiselect
if (!multiselect) {
if (tree.currentlySelectedNodes.indexOf(id) != -1) {
tre... | [
"function",
"selectNode",
"(",
"$node",
",",
"selectContents",
",",
"multiselect",
",",
"external",
")",
"{",
"var",
"id",
"=",
"$node",
".",
"attr",
"(",
"'name'",
")",
";",
"_removeCustomClasses",
"(",
")",
";",
"// clear other selections if not multiselect",
... | Performs actual selection of a tree node
@param {Element} $node A jquery node (LI) in the tree
@param {Boolean} selectContents True to select contents
@param {Boolean} multiselect True if ctrl or select was held when selecting
@param {Boolean} external True if selectNode came from outside structureTree, i.e. tree.selec... | [
"Performs",
"actual",
"selection",
"of",
"a",
"tree",
"node"
] | 4a4b75af695043bc276efd3a9e5eb7e836c52d6e | https://github.com/jchartrand/CWRC-WriterLayout/blob/4a4b75af695043bc276efd3a9e5eb7e836c52d6e/src/modules/structureTree.js#L243-L300 |
55,742 | themouette/screenstory | lib/runner/resolveWdOptions.js | resolveCapabilities | function resolveCapabilities(capabilities, capabilitiesDictionary) {
if (typeof capabilities !== "string") {
// we do not know how to parse non string capabilities, let's assume it
// is selenium compliant capabilities and return it.
return capabilities;
}
// try to parse as a JSON ... | javascript | function resolveCapabilities(capabilities, capabilitiesDictionary) {
if (typeof capabilities !== "string") {
// we do not know how to parse non string capabilities, let's assume it
// is selenium compliant capabilities and return it.
return capabilities;
}
// try to parse as a JSON ... | [
"function",
"resolveCapabilities",
"(",
"capabilities",
",",
"capabilitiesDictionary",
")",
"{",
"if",
"(",
"typeof",
"capabilities",
"!==",
"\"string\"",
")",
"{",
"// we do not know how to parse non string capabilities, let's assume it",
"// is selenium compliant capabilities and... | Actual resolution for capabilities. | [
"Actual",
"resolution",
"for",
"capabilities",
"."
] | 0c847f5514a55e7c2f59728565591d4bb5788915 | https://github.com/themouette/screenstory/blob/0c847f5514a55e7c2f59728565591d4bb5788915/lib/runner/resolveWdOptions.js#L110-L132 |
55,743 | codeactual/sinon-doublist-fs | lib/sinon-doublist-fs/index.js | sinonDoublistFs | function sinonDoublistFs(test) {
if (module.exports.trace) {
nodeConsole = require('long-con').create();
log = nodeConsole
.set('nlFirst', true)
.set('time', false)
.set('traceDepth', true)
.create(null, console.log); // eslint-disable-line no-console
nodeConsole.traceMethods('File... | javascript | function sinonDoublistFs(test) {
if (module.exports.trace) {
nodeConsole = require('long-con').create();
log = nodeConsole
.set('nlFirst', true)
.set('time', false)
.set('traceDepth', true)
.create(null, console.log); // eslint-disable-line no-console
nodeConsole.traceMethods('File... | [
"function",
"sinonDoublistFs",
"(",
"test",
")",
"{",
"if",
"(",
"module",
".",
"exports",
".",
"trace",
")",
"{",
"nodeConsole",
"=",
"require",
"(",
"'long-con'",
")",
".",
"create",
"(",
")",
";",
"log",
"=",
"nodeConsole",
".",
"set",
"(",
"'nlFirs... | Init `fs` stubs.
@param {object|string} test Test context *OR* name of supported test runner
- `{object}` Context object including `sandbox` from prior `sinonDoublist()` call
- `{string}` Named runner will be configured to automatically set-up/tear-down.
- Supported runners: 'mocha' | [
"Init",
"fs",
"stubs",
"."
] | 7f32af1bba609bccf26ec2ce333dca27efc6f78f | https://github.com/codeactual/sinon-doublist-fs/blob/7f32af1bba609bccf26ec2ce333dca27efc6f78f/lib/sinon-doublist-fs/index.js#L39-L69 |
55,744 | codeactual/sinon-doublist-fs | lib/sinon-doublist-fs/index.js | FileStub | function FileStub() {
this.settings = {
name: '',
buffer: new Buffer(0),
readdir: false,
parentName: '',
stats: {
dev: 2114,
ino: 48064969,
mode: 33188,
nlink: 1,
uid: 85,
gid: 100,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime:... | javascript | function FileStub() {
this.settings = {
name: '',
buffer: new Buffer(0),
readdir: false,
parentName: '',
stats: {
dev: 2114,
ino: 48064969,
mode: 33188,
nlink: 1,
uid: 85,
gid: 100,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime:... | [
"function",
"FileStub",
"(",
")",
"{",
"this",
".",
"settings",
"=",
"{",
"name",
":",
"''",
",",
"buffer",
":",
"new",
"Buffer",
"(",
"0",
")",
",",
"readdir",
":",
"false",
",",
"parentName",
":",
"''",
",",
"stats",
":",
"{",
"dev",
":",
"2114... | FileStub constructor.
An entry in the map of stubbed files/directories.
Usage:
const stub = new FileStub();
stub
.set('name', '/path/to/file')
.stat('size', 50)
.stat('gid', 2000)
.make();
Configuration:
- `{string} name` Absolute path w/out trailing slash
- Trailing slashes will be dropped.
- `{boolean|array} rea... | [
"FileStub",
"constructor",
"."
] | 7f32af1bba609bccf26ec2ce333dca27efc6f78f | https://github.com/codeactual/sinon-doublist-fs/blob/7f32af1bba609bccf26ec2ce333dca27efc6f78f/lib/sinon-doublist-fs/index.js#L533-L555 |
55,745 | codeactual/sinon-doublist-fs | lib/sinon-doublist-fs/index.js | intermediatePaths | function intermediatePaths(sparse) {
const dense = {};
[].concat(sparse).forEach(function forEachPath(path) {
path = rtrimSlash(path);
dense[path] = {}; // Store as keys to omit dupes
const curParts = trimSlash(path).split('/');
const gapParts = [];
curParts.forEach(function forEachPart(part) {
... | javascript | function intermediatePaths(sparse) {
const dense = {};
[].concat(sparse).forEach(function forEachPath(path) {
path = rtrimSlash(path);
dense[path] = {}; // Store as keys to omit dupes
const curParts = trimSlash(path).split('/');
const gapParts = [];
curParts.forEach(function forEachPart(part) {
... | [
"function",
"intermediatePaths",
"(",
"sparse",
")",
"{",
"const",
"dense",
"=",
"{",
"}",
";",
"[",
"]",
".",
"concat",
"(",
"sparse",
")",
".",
"forEach",
"(",
"function",
"forEachPath",
"(",
"path",
")",
"{",
"path",
"=",
"rtrimSlash",
"(",
"path",
... | Given an array files and directories, in any order and relationship,
return an object describing how to build file trees that contain them
all with no directory gaps.
Ex. given just '/path/to/file.js', it include '/path' and '/to' in the
results.
@param {string|array} sparse Normalized, absolute paths
@return {object... | [
"Given",
"an",
"array",
"files",
"and",
"directories",
"in",
"any",
"order",
"and",
"relationship",
"return",
"an",
"object",
"describing",
"how",
"to",
"build",
"file",
"trees",
"that",
"contain",
"them",
"all",
"with",
"no",
"directory",
"gaps",
"."
] | 7f32af1bba609bccf26ec2ce333dca27efc6f78f | https://github.com/codeactual/sinon-doublist-fs/blob/7f32af1bba609bccf26ec2ce333dca27efc6f78f/lib/sinon-doublist-fs/index.js#L764-L795 |
55,746 | elidoran/node-use | lib/index.js | withOptions | function withOptions(scope, defaultOptions) {
return function(plugin, options) {
return scope.use(this, scope, plugin, scope.combine(defaultOptions, options))
}
} | javascript | function withOptions(scope, defaultOptions) {
return function(plugin, options) {
return scope.use(this, scope, plugin, scope.combine(defaultOptions, options))
}
} | [
"function",
"withOptions",
"(",
"scope",
",",
"defaultOptions",
")",
"{",
"return",
"function",
"(",
"plugin",
",",
"options",
")",
"{",
"return",
"scope",
".",
"use",
"(",
"this",
",",
"scope",
",",
"plugin",
",",
"scope",
".",
"combine",
"(",
"defaultO... | create a closure to hold the provided `scope` and `defaultOptions`. | [
"create",
"a",
"closure",
"to",
"hold",
"the",
"provided",
"scope",
"and",
"defaultOptions",
"."
] | 72349bad08f253dc226cbd031a1495ae44bd733c | https://github.com/elidoran/node-use/blob/72349bad08f253dc226cbd031a1495ae44bd733c/lib/index.js#L61-L65 |
55,747 | adiwidjaja/frontend-pagebuilder | js/tinymce/plugins/help/plugin.js | function (o) {
var r = [];
for (var i in o) {
if (o.hasOwnProperty(i)) {
r.push(i);
}
}
return r;
} | javascript | function (o) {
var r = [];
for (var i in o) {
if (o.hasOwnProperty(i)) {
r.push(i);
}
}
return r;
} | [
"function",
"(",
"o",
")",
"{",
"var",
"r",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"o",
")",
"{",
"if",
"(",
"o",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"r",
".",
"push",
"(",
"i",
")",
";",
"}",
"}",
"return",
"r",
... | This technically means that 'each' and 'find' on IE8 iterate through the object twice. This code doesn't run on IE8 much, so it's an acceptable tradeoff. If it becomes a problem we can always duplicate the feature detection inside each and find as well. | [
"This",
"technically",
"means",
"that",
"each",
"and",
"find",
"on",
"IE8",
"iterate",
"through",
"the",
"object",
"twice",
".",
"This",
"code",
"doesn",
"t",
"run",
"on",
"IE8",
"much",
"so",
"it",
"s",
"an",
"acceptable",
"tradeoff",
".",
"If",
"it",
... | a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f | https://github.com/adiwidjaja/frontend-pagebuilder/blob/a08caa06cd9f919d575eb68f0d6b56fdedfb7d0f/js/tinymce/plugins/help/plugin.js#L825-L833 | |
55,748 | commenthol/hashtree | hashtree.js | splitKeys | function splitKeys (keys) {
if (typeof(keys) === 'string') {
return keys.replace(/^\s*\.\s*/,'')
.replace(/(?:\s*\.\s*)+/g, '.')
.split('.');
}
else if (Array.isArray(keys)) {
return [].concat(keys);
}
return;
} | javascript | function splitKeys (keys) {
if (typeof(keys) === 'string') {
return keys.replace(/^\s*\.\s*/,'')
.replace(/(?:\s*\.\s*)+/g, '.')
.split('.');
}
else if (Array.isArray(keys)) {
return [].concat(keys);
}
return;
} | [
"function",
"splitKeys",
"(",
"keys",
")",
"{",
"if",
"(",
"typeof",
"(",
"keys",
")",
"===",
"'string'",
")",
"{",
"return",
"keys",
".",
"replace",
"(",
"/",
"^\\s*\\.\\s*",
"/",
",",
"''",
")",
".",
"replace",
"(",
"/",
"(?:\\s*\\.\\s*)+",
"/",
"g... | Normalize and split `keys` for `get` and `set` method.
Splits by "."
@param {String|Array} keys
@api private | [
"Normalize",
"and",
"split",
"keys",
"for",
"get",
"and",
"set",
"method",
".",
"Splits",
"by",
"."
] | eb66d5b72af17ded1913f5abb9b49ebfb2b000c1 | https://github.com/commenthol/hashtree/blob/eb66d5b72af17ded1913f5abb9b49ebfb2b000c1/hashtree.js#L477-L487 |
55,749 | commenthol/hashtree | hashtree.js | Ops | function Ops (ref, key) {
this.ref = ref;
this.key = key;
if (this.ref[this.key] === undefined) {
this.ref[this.key] = 0;
}
this._toNumber();
this.isNumber = (typeof this.ref[this.key] === 'number');
this.isBoolean = (typeof this.ref[this.key] === 'boolean');
this.isString = (typeof this.ref[this.k... | javascript | function Ops (ref, key) {
this.ref = ref;
this.key = key;
if (this.ref[this.key] === undefined) {
this.ref[this.key] = 0;
}
this._toNumber();
this.isNumber = (typeof this.ref[this.key] === 'number');
this.isBoolean = (typeof this.ref[this.key] === 'boolean');
this.isString = (typeof this.ref[this.k... | [
"function",
"Ops",
"(",
"ref",
",",
"key",
")",
"{",
"this",
".",
"ref",
"=",
"ref",
";",
"this",
".",
"key",
"=",
"key",
";",
"if",
"(",
"this",
".",
"ref",
"[",
"this",
".",
"key",
"]",
"===",
"undefined",
")",
"{",
"this",
".",
"ref",
"[",... | Helper class for hashTree.use
@param {Object} ref : reference in object
@param {String} key : key for value to change | [
"Helper",
"class",
"for",
"hashTree",
".",
"use"
] | eb66d5b72af17ded1913f5abb9b49ebfb2b000c1 | https://github.com/commenthol/hashtree/blob/eb66d5b72af17ded1913f5abb9b49ebfb2b000c1/hashtree.js#L494-L508 |
55,750 | sreenaths/em-tgraph | addon/utils/tip.js | _createList | function _createList(list) {
var listContent = [];
if(list) {
listContent.push("<table>");
Ember.$.each(list, function (property, value) {
listContent.push(
"<tr><td>",
property,
"</td><td>",
value,
"</td></tr>"
);
});
listContent.push("</table>"... | javascript | function _createList(list) {
var listContent = [];
if(list) {
listContent.push("<table>");
Ember.$.each(list, function (property, value) {
listContent.push(
"<tr><td>",
property,
"</td><td>",
value,
"</td></tr>"
);
});
listContent.push("</table>"... | [
"function",
"_createList",
"(",
"list",
")",
"{",
"var",
"listContent",
"=",
"[",
"]",
";",
"if",
"(",
"list",
")",
"{",
"listContent",
".",
"push",
"(",
"\"<table>\"",
")",
";",
"Ember",
".",
"$",
".",
"each",
"(",
"list",
",",
"function",
"(",
"p... | Last node over which tooltip was displayed
Converts the provided list object into a tabular form.
@param list {Object} : An object with properties to be displayed as key value pairs
{
propertyName1: "property value 1",
..
propertyNameN: "property value N",
} | [
"Last",
"node",
"over",
"which",
"tooltip",
"was",
"displayed",
"Converts",
"the",
"provided",
"list",
"object",
"into",
"a",
"tabular",
"form",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/tip.js#L25-L44 |
55,751 | sreenaths/em-tgraph | addon/utils/tip.js | _setData | function _setData(data) {
_element.find('.tip-title').html(data.title || "");
_element.find('.tip-text').html(data.text || "");
_element.find('.tip-text')[data.text ? 'show' : 'hide']();
_element.find('.tip-list').html(_createList(data.kvList) || "");
} | javascript | function _setData(data) {
_element.find('.tip-title').html(data.title || "");
_element.find('.tip-text').html(data.text || "");
_element.find('.tip-text')[data.text ? 'show' : 'hide']();
_element.find('.tip-list').html(_createList(data.kvList) || "");
} | [
"function",
"_setData",
"(",
"data",
")",
"{",
"_element",
".",
"find",
"(",
"'.tip-title'",
")",
".",
"html",
"(",
"data",
".",
"title",
"||",
"\"\"",
")",
";",
"_element",
".",
"find",
"(",
"'.tip-text'",
")",
".",
"html",
"(",
"data",
".",
"text",... | Tip supports 3 visual entities in the tooltip. Title, description text and a list.
_setData sets all these based on the passed data object
@param data {Object} An object of the format
{
title: "tip title",
text: "tip description text",
kvList: {
propertyName1: "property value 1",
..
propertyNameN: "property value N",
}... | [
"Tip",
"supports",
"3",
"visual",
"entities",
"in",
"the",
"tooltip",
".",
"Title",
"description",
"text",
"and",
"a",
"list",
".",
"_setData",
"sets",
"all",
"these",
"based",
"on",
"the",
"passed",
"data",
"object"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/tip.js#L60-L65 |
55,752 | sreenaths/em-tgraph | addon/utils/tip.js | function (tipElement, svg) {
_element = tipElement;
_bubble = _element.find('.bubble');
_svg = svg;
_svgPoint = svg[0].createSVGPoint();
} | javascript | function (tipElement, svg) {
_element = tipElement;
_bubble = _element.find('.bubble');
_svg = svg;
_svgPoint = svg[0].createSVGPoint();
} | [
"function",
"(",
"tipElement",
",",
"svg",
")",
"{",
"_element",
"=",
"tipElement",
";",
"_bubble",
"=",
"_element",
".",
"find",
"(",
"'.bubble'",
")",
";",
"_svg",
"=",
"svg",
";",
"_svgPoint",
"=",
"svg",
"[",
"0",
"]",
".",
"createSVGPoint",
"(",
... | Set the tip defaults
@param tipElement {$} jQuery reference to the tooltip DOM element.
The element must contain 3 children with class tip-title, tip-text & tip-list.
@param svg {$} jQuery reference to svg html element | [
"Set",
"the",
"tip",
"defaults"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/tip.js#L74-L79 | |
55,753 | sreenaths/em-tgraph | addon/utils/tip.js | function (node, data, event) {
var point = data.position || (node.getScreenCTM ? _svgPoint.matrixTransform(
node.getScreenCTM()
) : {
x: event.x,
y: event.y
}),
windMid = _window.height() >> 1,
winWidth = _window.width(),
showAbove = point.y < ... | javascript | function (node, data, event) {
var point = data.position || (node.getScreenCTM ? _svgPoint.matrixTransform(
node.getScreenCTM()
) : {
x: event.x,
y: event.y
}),
windMid = _window.height() >> 1,
winWidth = _window.width(),
showAbove = point.y < ... | [
"function",
"(",
"node",
",",
"data",
",",
"event",
")",
"{",
"var",
"point",
"=",
"data",
".",
"position",
"||",
"(",
"node",
".",
"getScreenCTM",
"?",
"_svgPoint",
".",
"matrixTransform",
"(",
"node",
".",
"getScreenCTM",
"(",
")",
")",
":",
"{",
"... | Display a tooltip over an svg element.
@param node {SVG Element} Svg element over which tooltip must be displayed.
@param data {Object} An object of the format
{
title: "tip title",
text: "tip description text",
kvList: {
propertyName1: "property value 1",
..
propertyNameN: "property value N",
}
}
@param event {MouseEv... | [
"Display",
"a",
"tooltip",
"over",
"an",
"svg",
"element",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/tip.js#L100-L153 | |
55,754 | mongodb-js/mocha-evergreen-reporter | index.js | report | function report(test) {
return {
test_file: test.file + ': ' + test.fullTitle(),
start: test.start,
end: test.end,
exit_code: test.exit_code,
elapsed: test.duration / 1000,
error: errorJSON(test.err || {}),
url: test.url,
status: test.state
};
} | javascript | function report(test) {
return {
test_file: test.file + ': ' + test.fullTitle(),
start: test.start,
end: test.end,
exit_code: test.exit_code,
elapsed: test.duration / 1000,
error: errorJSON(test.err || {}),
url: test.url,
status: test.state
};
} | [
"function",
"report",
"(",
"test",
")",
"{",
"return",
"{",
"test_file",
":",
"test",
".",
"file",
"+",
"': '",
"+",
"test",
".",
"fullTitle",
"(",
")",
",",
"start",
":",
"test",
".",
"start",
",",
"end",
":",
"test",
".",
"end",
",",
"exit_code",... | Return an object with all of the relevant information for the test.
@api private
@param {Object} test
@return {Object} | [
"Return",
"an",
"object",
"with",
"all",
"of",
"the",
"relevant",
"information",
"for",
"the",
"test",
"."
] | b4b25074acf49cb74740688b4afeb161c5e2a64f | https://github.com/mongodb-js/mocha-evergreen-reporter/blob/b4b25074acf49cb74740688b4afeb161c5e2a64f/index.js#L158-L169 |
55,755 | mongodb-js/mocha-evergreen-reporter | index.js | writeLogs | function writeLogs(test, dirName) {
var logs =
test.fullTitle() +
'\n' +
test.file +
'\nStart: ' +
test.start +
'\nEnd: ' +
test.end +
'\nElapsed: ' +
test.duration +
'\nStatus: ' +
test.state;
if (test.state === 'fail') {
logs += '\nError: ' + test.err.stack;
}
m... | javascript | function writeLogs(test, dirName) {
var logs =
test.fullTitle() +
'\n' +
test.file +
'\nStart: ' +
test.start +
'\nEnd: ' +
test.end +
'\nElapsed: ' +
test.duration +
'\nStatus: ' +
test.state;
if (test.state === 'fail') {
logs += '\nError: ' + test.err.stack;
}
m... | [
"function",
"writeLogs",
"(",
"test",
",",
"dirName",
")",
"{",
"var",
"logs",
"=",
"test",
".",
"fullTitle",
"(",
")",
"+",
"'\\n'",
"+",
"test",
".",
"file",
"+",
"'\\nStart: '",
"+",
"test",
".",
"start",
"+",
"'\\nEnd: '",
"+",
"test",
".",
"end"... | Writes logs to a file in the specified directory
@param {test} test
@param {string} dirName | [
"Writes",
"logs",
"to",
"a",
"file",
"in",
"the",
"specified",
"directory"
] | b4b25074acf49cb74740688b4afeb161c5e2a64f | https://github.com/mongodb-js/mocha-evergreen-reporter/blob/b4b25074acf49cb74740688b4afeb161c5e2a64f/index.js#L176-L195 |
55,756 | MCluck90/clairvoyant | src/compiler.js | generateFileName | function generateFileName(className) {
return className
.replace(/component/gi, '')
.replace(/system/gi, '')
.replace('2D', '2d')
.replace('3D', '3d')
.replace(/^[A-Z]/, function(c) {
return c.toLowerCase();
})
.replace(/[A-Z]/g, function(c) {
... | javascript | function generateFileName(className) {
return className
.replace(/component/gi, '')
.replace(/system/gi, '')
.replace('2D', '2d')
.replace('3D', '3d')
.replace(/^[A-Z]/, function(c) {
return c.toLowerCase();
})
.replace(/[A-Z]/g, function(c) {
... | [
"function",
"generateFileName",
"(",
"className",
")",
"{",
"return",
"className",
".",
"replace",
"(",
"/",
"component",
"/",
"gi",
",",
"''",
")",
".",
"replace",
"(",
"/",
"system",
"/",
"gi",
",",
"''",
")",
".",
"replace",
"(",
"'2D'",
",",
"'2d... | Generates a filename based on the class name given
@param {string} className
@returns {string} | [
"Generates",
"a",
"filename",
"based",
"on",
"the",
"class",
"name",
"given"
] | 4c347499c5fe0f561a53e180d141884b1fa8c21b | https://github.com/MCluck90/clairvoyant/blob/4c347499c5fe0f561a53e180d141884b1fa8c21b/src/compiler.js#L17-L29 |
55,757 | MCluck90/clairvoyant | src/compiler.js | function(ast, reporter, version) {
this.ast = ast;
this.reporter = reporter;
this.psykickVersion = 'psykick' + version;
// Store the Templates so the Systems can access them later
this._templatesByName = {};
} | javascript | function(ast, reporter, version) {
this.ast = ast;
this.reporter = reporter;
this.psykickVersion = 'psykick' + version;
// Store the Templates so the Systems can access them later
this._templatesByName = {};
} | [
"function",
"(",
"ast",
",",
"reporter",
",",
"version",
")",
"{",
"this",
".",
"ast",
"=",
"ast",
";",
"this",
".",
"reporter",
"=",
"reporter",
";",
"this",
".",
"psykickVersion",
"=",
"'psykick'",
"+",
"version",
";",
"// Store the Templates so the System... | Compiles the AST into actual code
@param {AST} ast
@param {Reporter} reporter
@param {string} version
@constructor | [
"Compiles",
"the",
"AST",
"into",
"actual",
"code"
] | 4c347499c5fe0f561a53e180d141884b1fa8c21b | https://github.com/MCluck90/clairvoyant/blob/4c347499c5fe0f561a53e180d141884b1fa8c21b/src/compiler.js#L38-L45 | |
55,758 | enbock/corejs-w3c | src/core.js | CoreEvent | function CoreEvent(typeArg, detail) {
if (detail == undefined) {
detail = {};
}
/**
* Error:
* Failed to construct 'CustomEvent': Please use the 'new' operator, this
* DOM object constructor cannot be called as a function.
*
* In reason of that the browser did not allow to extend CustomEvent i... | javascript | function CoreEvent(typeArg, detail) {
if (detail == undefined) {
detail = {};
}
/**
* Error:
* Failed to construct 'CustomEvent': Please use the 'new' operator, this
* DOM object constructor cannot be called as a function.
*
* In reason of that the browser did not allow to extend CustomEvent i... | [
"function",
"CoreEvent",
"(",
"typeArg",
",",
"detail",
")",
"{",
"if",
"(",
"detail",
"==",
"undefined",
")",
"{",
"detail",
"=",
"{",
"}",
";",
"}",
"/**\r\n\t * Error:\r\n\t * Failed to construct 'CustomEvent': Please use the 'new' operator, this \r\n\t * DOM object cons... | CoreJS events.
@constructor
@param {String} typeArg - Is a String representing the name of the event.
@param {(Object|String|Number)} [detail] - Data to transport over the event. | [
"CoreJS",
"events",
"."
] | ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04 | https://github.com/enbock/corejs-w3c/blob/ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04/src/core.js#L132-L145 |
55,759 | enbock/corejs-w3c | src/core.js | Ajax | function Ajax(method, url, sendData) {
DOMEventListener.call(this);
/**
* Request object.
*
* @access protected
* @type {XMLHttpRequest}
*/
this._request = new Ajax.XHRSystem();
/**
* Method of the request.
*
* @access protected
* @type {String}
*/
this._method = method;
... | javascript | function Ajax(method, url, sendData) {
DOMEventListener.call(this);
/**
* Request object.
*
* @access protected
* @type {XMLHttpRequest}
*/
this._request = new Ajax.XHRSystem();
/**
* Method of the request.
*
* @access protected
* @type {String}
*/
this._method = method;
... | [
"function",
"Ajax",
"(",
"method",
",",
"url",
",",
"sendData",
")",
"{",
"DOMEventListener",
".",
"call",
"(",
"this",
")",
";",
"/**\r\n\t * Request object.\r\n\t *\r\n\t * @access protected\r\n\t * @type {XMLHttpRequest}\r\n\t */",
"this",
".",
"_request",
"=",
"new",
... | Asynchronous JavaScript and XML.
Wrapper to equalize and simplify the usage for AJAX calls.
@constructor
@param {String} method - Type of request (get, post, put, ...).
@param {String} url - Request address.
@param {(Object|String)} sendData - Data to send. | [
"Asynchronous",
"JavaScript",
"and",
"XML",
".",
"Wrapper",
"to",
"equalize",
"and",
"simplify",
"the",
"usage",
"for",
"AJAX",
"calls",
"."
] | ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04 | https://github.com/enbock/corejs-w3c/blob/ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04/src/core.js#L162-L244 |
55,760 | enbock/corejs-w3c | src/core.js | use | function use(fullQualifiedClassName) {
var container = use.getContainer(fullQualifiedClassName)
;
if (container._loader === null) {
use.loadCount++;
container._loader = Ajax.factory(
"get", container._path + use.fileExtension
);
container._loader.addEventListener(Ajax.Event.LOAD, function(event... | javascript | function use(fullQualifiedClassName) {
var container = use.getContainer(fullQualifiedClassName)
;
if (container._loader === null) {
use.loadCount++;
container._loader = Ajax.factory(
"get", container._path + use.fileExtension
);
container._loader.addEventListener(Ajax.Event.LOAD, function(event... | [
"function",
"use",
"(",
"fullQualifiedClassName",
")",
"{",
"var",
"container",
"=",
"use",
".",
"getContainer",
"(",
"fullQualifiedClassName",
")",
";",
"if",
"(",
"container",
".",
"_loader",
"===",
"null",
")",
"{",
"use",
".",
"loadCount",
"++",
";",
"... | Auto load system.
@signleton | [
"Auto",
"load",
"system",
"."
] | ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04 | https://github.com/enbock/corejs-w3c/blob/ae6b78f17152b1e8ddf1c0031b4f54cb0e419d04/src/core.js#L399-L455 |
55,761 | SoftEng-HEIGVD/iflux-node-client | lib/client.js | Client | function Client(endpointUrl, sourceId) {
this.restClient = new restClient.Client();
this.endpointUrl = endpointUrl;
if (this.endpointUrl) {
// Remove the trailing slash if necessary
if (this.endpointUrl.indexOf('/', this.endpointUrl.length - 1) !== -1) {
this.endpointUrl = this.endpointUrl.substr(0, t... | javascript | function Client(endpointUrl, sourceId) {
this.restClient = new restClient.Client();
this.endpointUrl = endpointUrl;
if (this.endpointUrl) {
// Remove the trailing slash if necessary
if (this.endpointUrl.indexOf('/', this.endpointUrl.length - 1) !== -1) {
this.endpointUrl = this.endpointUrl.substr(0, t... | [
"function",
"Client",
"(",
"endpointUrl",
",",
"sourceId",
")",
"{",
"this",
".",
"restClient",
"=",
"new",
"restClient",
".",
"Client",
"(",
")",
";",
"this",
".",
"endpointUrl",
"=",
"endpointUrl",
";",
"if",
"(",
"this",
".",
"endpointUrl",
")",
"{",
... | Constructor for the iFLUX Client.
@param {string} endpointUrl The URL prefix for the API (e.g. http://api.iflux.io/api)
@param {string} sourceId The event source id
@constructor | [
"Constructor",
"for",
"the",
"iFLUX",
"Client",
"."
] | 5cb9fb4c0ca34ce120a876f6a64577fa97e3aac5 | https://github.com/SoftEng-HEIGVD/iflux-node-client/blob/5cb9fb4c0ca34ce120a876f6a64577fa97e3aac5/lib/client.js#L11-L32 |
55,762 | fieosa/webcomponent-mdl | src/utils/jsxdom.js | processChildren | function processChildren(ele, children) {
if (children && children.constructor === Array) {
for(var i = 0; i < children.length; i++) {
processChildren(ele, children[i]);
}
} else if (children instanceof Node) {
ele.appendChild(children);
} else if (children) {
ele.appendChild(document.create... | javascript | function processChildren(ele, children) {
if (children && children.constructor === Array) {
for(var i = 0; i < children.length; i++) {
processChildren(ele, children[i]);
}
} else if (children instanceof Node) {
ele.appendChild(children);
} else if (children) {
ele.appendChild(document.create... | [
"function",
"processChildren",
"(",
"ele",
",",
"children",
")",
"{",
"if",
"(",
"children",
"&&",
"children",
".",
"constructor",
"===",
"Array",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
... | Implementation of templating syntax for jsx.
To support tag nesting syntax:
examples:
<p>
<div></div>
<span><span/>
</p>
1. Recursively call processChildren which the 'children' parameter is an instance of n-dimensional array.
The above example is an array of [[div], [span]] as the children of <p> tag.
To support {t... | [
"Implementation",
"of",
"templating",
"syntax",
"for",
"jsx",
"."
] | 5aec1bfd5110addcbeedd01ba07b8a01c836c511 | https://github.com/fieosa/webcomponent-mdl/blob/5aec1bfd5110addcbeedd01ba07b8a01c836c511/src/utils/jsxdom.js#L33-L43 |
55,763 | overlookmotel/drive-watch | lib/index.js | getDrives | function getDrives() {
return getDrivesNow().then(function(drives) {
// if new drive events during scan, redo scan
if (newEvents) return getDrives();
recordDrives(drives);
if (self.options.scanInterval) self.scanTimer = setTimeout(updateDrives, self.options.scanI... | javascript | function getDrives() {
return getDrivesNow().then(function(drives) {
// if new drive events during scan, redo scan
if (newEvents) return getDrives();
recordDrives(drives);
if (self.options.scanInterval) self.scanTimer = setTimeout(updateDrives, self.options.scanI... | [
"function",
"getDrives",
"(",
")",
"{",
"return",
"getDrivesNow",
"(",
")",
".",
"then",
"(",
"function",
"(",
"drives",
")",
"{",
"// if new drive events during scan, redo scan",
"if",
"(",
"newEvents",
")",
"return",
"getDrives",
"(",
")",
";",
"recordDrives",... | get drives initially connected | [
"get",
"drives",
"initially",
"connected"
] | 61ca4c8c82aba06f0c3af3ca17cc4fd15fb78ed4 | https://github.com/overlookmotel/drive-watch/blob/61ca4c8c82aba06f0c3af3ca17cc4fd15fb78ed4/lib/index.js#L65-L76 |
55,764 | overlookmotel/drive-watch | lib/index.js | getDrivesNow | function getDrivesNow() {
reading = true;
newEvents = false;
return fs.readdirAsync(drivesPath)
.then(function(files) {
var drives = files.filter(function(name) {
return name != '.DS_Store';
});
return drives;
});
} | javascript | function getDrivesNow() {
reading = true;
newEvents = false;
return fs.readdirAsync(drivesPath)
.then(function(files) {
var drives = files.filter(function(name) {
return name != '.DS_Store';
});
return drives;
});
} | [
"function",
"getDrivesNow",
"(",
")",
"{",
"reading",
"=",
"true",
";",
"newEvents",
"=",
"false",
";",
"return",
"fs",
".",
"readdirAsync",
"(",
"drivesPath",
")",
".",
"then",
"(",
"function",
"(",
"files",
")",
"{",
"var",
"drives",
"=",
"files",
".... | scan for connected drives | [
"scan",
"for",
"connected",
"drives"
] | 61ca4c8c82aba06f0c3af3ca17cc4fd15fb78ed4 | https://github.com/overlookmotel/drive-watch/blob/61ca4c8c82aba06f0c3af3ca17cc4fd15fb78ed4/lib/index.js#L107-L119 |
55,765 | fazo96/LC2.js | cli.js | onRead | function onRead (key) {
if (key !== null) {
if (cli.debug) console.log('Key:', key)
// Exits on CTRL-C
if (key === '\u0003') process.exit()
// If enter is pressed and the program is waiting for the user to press enter
// so that the emulator can step forward, then call the appropriate callback
... | javascript | function onRead (key) {
if (key !== null) {
if (cli.debug) console.log('Key:', key)
// Exits on CTRL-C
if (key === '\u0003') process.exit()
// If enter is pressed and the program is waiting for the user to press enter
// so that the emulator can step forward, then call the appropriate callback
... | [
"function",
"onRead",
"(",
"key",
")",
"{",
"if",
"(",
"key",
"!==",
"null",
")",
"{",
"if",
"(",
"cli",
".",
"debug",
")",
"console",
".",
"log",
"(",
"'Key:'",
",",
"key",
")",
"// Exits on CTRL-C",
"if",
"(",
"key",
"===",
"'\\u0003'",
")",
"pro... | This function processes an input key from STDIN. | [
"This",
"function",
"processes",
"an",
"input",
"key",
"from",
"STDIN",
"."
] | 33b1d1e84d5da7c0df16290fc1289628ba65b430 | https://github.com/fazo96/LC2.js/blob/33b1d1e84d5da7c0df16290fc1289628ba65b430/cli.js#L48-L63 |
55,766 | fazo96/LC2.js | cli.js | end | function end () {
console.log('\n=== REG DUMP ===\n' + cpu.regdump().join('\n'))
if (options.memDump) console.log('\n\n=== MEM DUMP ===\n' + cpu.memdump(0, 65535).join('\n'))
process.exit() // workaround for stdin event listener hanging
} | javascript | function end () {
console.log('\n=== REG DUMP ===\n' + cpu.regdump().join('\n'))
if (options.memDump) console.log('\n\n=== MEM DUMP ===\n' + cpu.memdump(0, 65535).join('\n'))
process.exit() // workaround for stdin event listener hanging
} | [
"function",
"end",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'\\n=== REG DUMP ===\\n'",
"+",
"cpu",
".",
"regdump",
"(",
")",
".",
"join",
"(",
"'\\n'",
")",
")",
"if",
"(",
"options",
".",
"memDump",
")",
"console",
".",
"log",
"(",
"'\\n\\n=== MEM ... | Called when the LC-2 program has finished running | [
"Called",
"when",
"the",
"LC",
"-",
"2",
"program",
"has",
"finished",
"running"
] | 33b1d1e84d5da7c0df16290fc1289628ba65b430 | https://github.com/fazo96/LC2.js/blob/33b1d1e84d5da7c0df16290fc1289628ba65b430/cli.js#L138-L142 |
55,767 | hitchyjs/server-dev-tools | bin/hitchy-pm.js | processSimple | function processSimple( names, current, stopAt, collector, done ) {
const name = names[current];
File.stat( Path.join( "node_modules", name, "hitchy.json" ), ( error, stat ) => {
if ( error ) {
if ( error.code === "ENOENT" ) {
collector.push( name );
} else {
done( error );
return;
}
} else ... | javascript | function processSimple( names, current, stopAt, collector, done ) {
const name = names[current];
File.stat( Path.join( "node_modules", name, "hitchy.json" ), ( error, stat ) => {
if ( error ) {
if ( error.code === "ENOENT" ) {
collector.push( name );
} else {
done( error );
return;
}
} else ... | [
"function",
"processSimple",
"(",
"names",
",",
"current",
",",
"stopAt",
",",
"collector",
",",
"done",
")",
"{",
"const",
"name",
"=",
"names",
"[",
"current",
"]",
";",
"File",
".",
"stat",
"(",
"Path",
".",
"join",
"(",
"\"node_modules\"",
",",
"na... | Successively tests provided names of dependencies for matching existing
folder in local sub-folder `node_modules` each containing file hitchy.json.
@param {string[]} names list of dependency names to be tested
@param {int} current index of next item in provided list to be processed
@param {int} stopAt index to stop at... | [
"Successively",
"tests",
"provided",
"names",
"of",
"dependencies",
"for",
"matching",
"existing",
"folder",
"in",
"local",
"sub",
"-",
"folder",
"node_modules",
"each",
"containing",
"file",
"hitchy",
".",
"json",
"."
] | 352c0de74b532b474a71816fdc63d2218c126536 | https://github.com/hitchyjs/server-dev-tools/blob/352c0de74b532b474a71816fdc63d2218c126536/bin/hitchy-pm.js#L125-L151 |
55,768 | hitchyjs/server-dev-tools | bin/hitchy-pm.js | installMissing | function installMissing( error, collected ) {
if ( error ) {
console.error( `checking dependencies failed: ${error.message}` );
process.exit( 1 );
return;
}
if ( collected.length < 1 ) {
postProcess( 0 );
} else {
if ( !quiet ) {
console.error( `installing missing dependencies:\n${collected.map( d =>... | javascript | function installMissing( error, collected ) {
if ( error ) {
console.error( `checking dependencies failed: ${error.message}` );
process.exit( 1 );
return;
}
if ( collected.length < 1 ) {
postProcess( 0 );
} else {
if ( !quiet ) {
console.error( `installing missing dependencies:\n${collected.map( d =>... | [
"function",
"installMissing",
"(",
"error",
",",
"collected",
")",
"{",
"if",
"(",
"error",
")",
"{",
"console",
".",
"error",
"(",
"`",
"${",
"error",
".",
"message",
"}",
"`",
")",
";",
"process",
".",
"exit",
"(",
"1",
")",
";",
"return",
";",
... | Installs collected dependencies considered missing or handles provided error.
@param {Error} error encountered error
@param {string[]} collected list of dependencies considered missing | [
"Installs",
"collected",
"dependencies",
"considered",
"missing",
"or",
"handles",
"provided",
"error",
"."
] | 352c0de74b532b474a71816fdc63d2218c126536 | https://github.com/hitchyjs/server-dev-tools/blob/352c0de74b532b474a71816fdc63d2218c126536/bin/hitchy-pm.js#L159-L183 |
55,769 | hitchyjs/server-dev-tools | bin/hitchy-pm.js | postProcess | function postProcess( errorCode ) {
if ( errorCode ) {
console.error( `running npm for installing missing dependencies ${collected.join( ", " )} exited on error (${errorCode})` );
} else if ( exec ) {
const cmd = exec.join( " " );
if ( !quiet ) {
console.error( `invoking follow-up command: ${cmd}` );
}
... | javascript | function postProcess( errorCode ) {
if ( errorCode ) {
console.error( `running npm for installing missing dependencies ${collected.join( ", " )} exited on error (${errorCode})` );
} else if ( exec ) {
const cmd = exec.join( " " );
if ( !quiet ) {
console.error( `invoking follow-up command: ${cmd}` );
}
... | [
"function",
"postProcess",
"(",
"errorCode",
")",
"{",
"if",
"(",
"errorCode",
")",
"{",
"console",
".",
"error",
"(",
"`",
"${",
"collected",
".",
"join",
"(",
"\", \"",
")",
"}",
"${",
"errorCode",
"}",
"`",
")",
";",
"}",
"else",
"if",
"(",
"exe... | Handles event of having passed installation of missing dependencies.
@param {int} errorCode status code on exit of npm installing missing dependencies | [
"Handles",
"event",
"of",
"having",
"passed",
"installation",
"of",
"missing",
"dependencies",
"."
] | 352c0de74b532b474a71816fdc63d2218c126536 | https://github.com/hitchyjs/server-dev-tools/blob/352c0de74b532b474a71816fdc63d2218c126536/bin/hitchy-pm.js#L190-L213 |
55,770 | shinuza/captain-admin | public/js/lib/alertify.js | function (fn) {
var hasOK = (typeof btnOK !== "undefined"),
hasCancel = (typeof btnCancel !== "undefined"),
hasInput = (typeof input !== "undefined"),
val = "",
self = this,
ok, cancel, common, key, reset;
// ok event handler
ok = function (event) {
... | javascript | function (fn) {
var hasOK = (typeof btnOK !== "undefined"),
hasCancel = (typeof btnCancel !== "undefined"),
hasInput = (typeof input !== "undefined"),
val = "",
self = this,
ok, cancel, common, key, reset;
// ok event handler
ok = function (event) {
... | [
"function",
"(",
"fn",
")",
"{",
"var",
"hasOK",
"=",
"(",
"typeof",
"btnOK",
"!==",
"\"undefined\"",
")",
",",
"hasCancel",
"=",
"(",
"typeof",
"btnCancel",
"!==",
"\"undefined\"",
")",
",",
"hasInput",
"=",
"(",
"typeof",
"input",
"!==",
"\"undefined\"",... | Set the proper button click events
@param {Function} fn [Optional] Callback function
@return {undefined} | [
"Set",
"the",
"proper",
"button",
"click",
"events"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L119-L189 | |
55,771 | shinuza/captain-admin | public/js/lib/alertify.js | function (item) {
var html = "",
type = item.type,
message = item.message,
css = item.cssClass || "";
html += "<div class=\"alertify-dialog\">";
if (_alertify.buttonFocus === "none") html += "<a href=\"#\" id=\"alertify-noneFocus\" class=\"alertify-hidden\"></a>";
if... | javascript | function (item) {
var html = "",
type = item.type,
message = item.message,
css = item.cssClass || "";
html += "<div class=\"alertify-dialog\">";
if (_alertify.buttonFocus === "none") html += "<a href=\"#\" id=\"alertify-noneFocus\" class=\"alertify-hidden\"></a>";
if... | [
"function",
"(",
"item",
")",
"{",
"var",
"html",
"=",
"\"\"",
",",
"type",
"=",
"item",
".",
"type",
",",
"message",
"=",
"item",
".",
"message",
",",
"css",
"=",
"item",
".",
"cssClass",
"||",
"\"\"",
";",
"html",
"+=",
"\"<div class=\\\"alertify-dia... | Build the proper message box
@param {Object} item Current object in the queue
@return {String} An HTML string of the message box | [
"Build",
"the",
"proper",
"message",
"box"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L244-L289 | |
55,772 | shinuza/captain-admin | public/js/lib/alertify.js | function (elem, wait) {
// Unary Plus: +"2" === 2
var timer = (wait && !isNaN(wait)) ? +wait : this.delay,
self = this,
hideElement, transitionDone;
// set click event on log messages
this.bind(elem, "click", function () {
hideElement(elem);
});
// Hide the dialog box afte... | javascript | function (elem, wait) {
// Unary Plus: +"2" === 2
var timer = (wait && !isNaN(wait)) ? +wait : this.delay,
self = this,
hideElement, transitionDone;
// set click event on log messages
this.bind(elem, "click", function () {
hideElement(elem);
});
// Hide the dialog box afte... | [
"function",
"(",
"elem",
",",
"wait",
")",
"{",
"// Unary Plus: +\"2\" === 2",
"var",
"timer",
"=",
"(",
"wait",
"&&",
"!",
"isNaN",
"(",
"wait",
")",
")",
"?",
"+",
"wait",
":",
"this",
".",
"delay",
",",
"self",
"=",
"this",
",",
"hideElement",
","... | Close the log messages
@param {Object} elem HTML Element of log message to close
@param {Number} wait [optional] Time (in ms) to wait before automatically hiding the message, if 0 never hide
@return {undefined} | [
"Close",
"the",
"log",
"messages"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L299-L338 | |
55,773 | shinuza/captain-admin | public/js/lib/alertify.js | function (message, type, fn, placeholder, cssClass) {
// set the current active element
// this allows the keyboard focus to be resetted
// after the dialog box is closed
elCallee = document.activeElement;
// check to ensure the alertify dialog element
// has been successfully created
var ch... | javascript | function (message, type, fn, placeholder, cssClass) {
// set the current active element
// this allows the keyboard focus to be resetted
// after the dialog box is closed
elCallee = document.activeElement;
// check to ensure the alertify dialog element
// has been successfully created
var ch... | [
"function",
"(",
"message",
",",
"type",
",",
"fn",
",",
"placeholder",
",",
"cssClass",
")",
"{",
"// set the current active element",
"// this allows the keyboard focus to be resetted",
"// after the dialog box is closed",
"elCallee",
"=",
"document",
".",
"activeElement",
... | Create a dialog box
@param {String} message The message passed from the callee
@param {String} type Type of dialog to create
@param {Function} fn [Optional] Callback function
@param {String} placeholder [Optional] Default value for prompt input field
@param {String} cssClas... | [
"Create",
"a",
"dialog",
"box"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L351-L376 | |
55,774 | shinuza/captain-admin | public/js/lib/alertify.js | function () {
var transitionDone,
self = this;
// remove reference from queue
queue.splice(0,1);
// if items remaining in the queue
if (queue.length > 0) this.setup(true);
else {
isopen = false;
// Hide the dialog box after transition
// This ensure it doens't block any el... | javascript | function () {
var transitionDone,
self = this;
// remove reference from queue
queue.splice(0,1);
// if items remaining in the queue
if (queue.length > 0) this.setup(true);
else {
isopen = false;
// Hide the dialog box after transition
// This ensure it doens't block any el... | [
"function",
"(",
")",
"{",
"var",
"transitionDone",
",",
"self",
"=",
"this",
";",
"// remove reference from queue",
"queue",
".",
"splice",
"(",
"0",
",",
"1",
")",
";",
"// if items remaining in the queue",
"if",
"(",
"queue",
".",
"length",
">",
"0",
")",... | Hide the dialog and rest to defaults
@return {undefined} | [
"Hide",
"the",
"dialog",
"and",
"rest",
"to",
"defaults"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L398-L427 | |
55,775 | shinuza/captain-admin | public/js/lib/alertify.js | function () {
// ensure legacy browsers support html5 tags
document.createElement("nav");
document.createElement("article");
document.createElement("section");
// cover
elCover = document.createElement("div");
elCover.setAttribute("id", "alertify-cover");
elCover.className = "alertify-co... | javascript | function () {
// ensure legacy browsers support html5 tags
document.createElement("nav");
document.createElement("article");
document.createElement("section");
// cover
elCover = document.createElement("div");
elCover.setAttribute("id", "alertify-cover");
elCover.className = "alertify-co... | [
"function",
"(",
")",
"{",
"// ensure legacy browsers support html5 tags",
"document",
".",
"createElement",
"(",
"\"nav\"",
")",
";",
"document",
".",
"createElement",
"(",
"\"article\"",
")",
";",
"document",
".",
"createElement",
"(",
"\"section\"",
")",
";",
"... | Initialize Alertify
Create the 2 main elements
@return {undefined} | [
"Initialize",
"Alertify",
"Create",
"the",
"2",
"main",
"elements"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L435-L463 | |
55,776 | shinuza/captain-admin | public/js/lib/alertify.js | function (message, type, wait) {
// check to ensure the alertify dialog element
// has been successfully created
var check = function () {
if (elLog && elLog.scrollTop !== null) return;
else check();
};
// initialize alertify if it hasn't already been done
if (typeof this.init === "fun... | javascript | function (message, type, wait) {
// check to ensure the alertify dialog element
// has been successfully created
var check = function () {
if (elLog && elLog.scrollTop !== null) return;
else check();
};
// initialize alertify if it hasn't already been done
if (typeof this.init === "fun... | [
"function",
"(",
"message",
",",
"type",
",",
"wait",
")",
"{",
"// check to ensure the alertify dialog element",
"// has been successfully created",
"var",
"check",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"elLog",
"&&",
"elLog",
".",
"scrollTop",
"!==",
"null"... | Show a new log message box
@param {String} message The message passed from the callee
@param {String} type [Optional] Optional type of log message
@param {Number} wait [Optional] Time (in ms) to wait before auto-hiding the log
@return {Object} | [
"Show",
"a",
"new",
"log",
"message",
"box"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L474-L489 | |
55,777 | shinuza/captain-admin | public/js/lib/alertify.js | function (fromQueue) {
var item = queue[0],
self = this,
transitionDone;
// dialog is open
isopen = true;
// Set button focus after transition
transitionDone = function (event) {
event.stopPropagation();
self.setFocus();
// unbind event so function only gets called on... | javascript | function (fromQueue) {
var item = queue[0],
self = this,
transitionDone;
// dialog is open
isopen = true;
// Set button focus after transition
transitionDone = function (event) {
event.stopPropagation();
self.setFocus();
// unbind event so function only gets called on... | [
"function",
"(",
"fromQueue",
")",
"{",
"var",
"item",
"=",
"queue",
"[",
"0",
"]",
",",
"self",
"=",
"this",
",",
"transitionDone",
";",
"// dialog is open",
"isopen",
"=",
"true",
";",
"// Set button focus after transition",
"transitionDone",
"=",
"function",
... | Initiate all the required pieces for the dialog box
@return {undefined} | [
"Initiate",
"all",
"the",
"required",
"pieces",
"for",
"the",
"dialog",
"box"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L550-L581 | |
55,778 | shinuza/captain-admin | public/js/lib/alertify.js | function (el, event, fn) {
if (typeof el.removeEventListener === "function") {
el.removeEventListener(event, fn, false);
} else if (el.detachEvent) {
el.detachEvent("on" + event, fn);
}
} | javascript | function (el, event, fn) {
if (typeof el.removeEventListener === "function") {
el.removeEventListener(event, fn, false);
} else if (el.detachEvent) {
el.detachEvent("on" + event, fn);
}
} | [
"function",
"(",
"el",
",",
"event",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"el",
".",
"removeEventListener",
"===",
"\"function\"",
")",
"{",
"el",
".",
"removeEventListener",
"(",
"event",
",",
"fn",
",",
"false",
")",
";",
"}",
"else",
"if",
"(... | Unbind events to elements
@param {Object} el HTML Object
@param {Event} event Event to detach to element
@param {Function} fn Callback function
@return {undefined} | [
"Unbind",
"events",
"to",
"elements"
] | e63408c5206d22b348580a5e1345f5da1cd1d99f | https://github.com/shinuza/captain-admin/blob/e63408c5206d22b348580a5e1345f5da1cd1d99f/public/js/lib/alertify.js#L592-L598 | |
55,779 | YusukeHirao/sceg | lib/fn/output.js | output | function output(sourceCode, filePath) {
return new Promise(function (resolve, reject) {
mkdirp(path.dirname(filePath), function (ioErr) {
if (ioErr) {
reject(ioErr);
throw ioErr;
}
fs.writeFile(filePath, sourceCode, function (writeErr) {
... | javascript | function output(sourceCode, filePath) {
return new Promise(function (resolve, reject) {
mkdirp(path.dirname(filePath), function (ioErr) {
if (ioErr) {
reject(ioErr);
throw ioErr;
}
fs.writeFile(filePath, sourceCode, function (writeErr) {
... | [
"function",
"output",
"(",
"sourceCode",
",",
"filePath",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"mkdirp",
"(",
"path",
".",
"dirname",
"(",
"filePath",
")",
",",
"function",
"(",
"ioErr",
")",
"... | Output file by source code string
@param sourceCode Source code string
@param filePath Destination path and file name | [
"Output",
"file",
"by",
"source",
"code",
"string"
] | 4cde1e56d48dd3b604cc2ddff36b2e9de3348771 | https://github.com/YusukeHirao/sceg/blob/4cde1e56d48dd3b604cc2ddff36b2e9de3348771/lib/fn/output.js#L13-L29 |
55,780 | amooj/node-xcheck | lib/templates.js | ValueTemplate | function ValueTemplate(type, defaultValue, validator){
this.type = type;
this.defaultValue = defaultValue;
this.validator = validator;
} | javascript | function ValueTemplate(type, defaultValue, validator){
this.type = type;
this.defaultValue = defaultValue;
this.validator = validator;
} | [
"function",
"ValueTemplate",
"(",
"type",
",",
"defaultValue",
",",
"validator",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"defaultValue",
"=",
"defaultValue",
";",
"this",
".",
"validator",
"=",
"validator",
";",
"}"
] | Creates a ValueTemplate.
@param {string} type - type of the value.
@param {Object|undefined} defaultValue - default value.
@param {Object} [validator] - value validator(reserved, not used yet).
@constructor | [
"Creates",
"a",
"ValueTemplate",
"."
] | 33b2b59f7d81a8e0421a468a405f15a19126bedf | https://github.com/amooj/node-xcheck/blob/33b2b59f7d81a8e0421a468a405f15a19126bedf/lib/templates.js#L15-L19 |
55,781 | amooj/node-xcheck | lib/templates.js | PropertyTemplate | function PropertyTemplate(name, required, nullable, template){
this.name = name;
this.required = required;
this.nullable = nullable;
this.template = template;
} | javascript | function PropertyTemplate(name, required, nullable, template){
this.name = name;
this.required = required;
this.nullable = nullable;
this.template = template;
} | [
"function",
"PropertyTemplate",
"(",
"name",
",",
"required",
",",
"nullable",
",",
"template",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"required",
"=",
"required",
";",
"this",
".",
"nullable",
"=",
"nullable",
";",
"this",
".",
... | Creates a PropertyTemplate.
@param {object} name - property name.
@param {boolean} required - whether this property is required.
@param {boolean} nullable - whether this property value can be null.
@param {object} template - property value template.
@constructor | [
"Creates",
"a",
"PropertyTemplate",
"."
] | 33b2b59f7d81a8e0421a468a405f15a19126bedf | https://github.com/amooj/node-xcheck/blob/33b2b59f7d81a8e0421a468a405f15a19126bedf/lib/templates.js#L276-L281 |
55,782 | frnd/metalsmith-imagecover | lib/index.js | getByFirstImage | function getByFirstImage(file, attributes) {
var $ = cheerio.load(file.contents.toString()),
img = $('img').first(),
obj = {};
if (img.length) {
_.forEach(attributes, function(attribute) {
obj[attribute] = img.attr(attribute);
});
return obj;
} else {
return undefined;
}
} | javascript | function getByFirstImage(file, attributes) {
var $ = cheerio.load(file.contents.toString()),
img = $('img').first(),
obj = {};
if (img.length) {
_.forEach(attributes, function(attribute) {
obj[attribute] = img.attr(attribute);
});
return obj;
} else {
return undefined;
}
} | [
"function",
"getByFirstImage",
"(",
"file",
",",
"attributes",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"file",
".",
"contents",
".",
"toString",
"(",
")",
")",
",",
"img",
"=",
"$",
"(",
"'img'",
")",
".",
"first",
"(",
")",
",",
... | retrieve cover from file object by extracting the first image
@param {Object} file file object
@return {Object} cover | [
"retrieve",
"cover",
"from",
"file",
"object",
"by",
"extracting",
"the",
"first",
"image"
] | 7d864004027b01cab2a162bfdc523d9b148c015d | https://github.com/frnd/metalsmith-imagecover/blob/7d864004027b01cab2a162bfdc523d9b148c015d/lib/index.js#L44-L56 |
55,783 | DarkPark/code-proxy | server/wspool.js | function ( name, socket ) {
var self = this;
// check input
if ( name && socket ) {
log('ws', 'init', name, 'connection');
// main data structure
pool[name] = {
socket: socket,
time: +new Date(),
count: 0,
active: true
};
// disable link on close
pool[name].socket.on('close', ... | javascript | function ( name, socket ) {
var self = this;
// check input
if ( name && socket ) {
log('ws', 'init', name, 'connection');
// main data structure
pool[name] = {
socket: socket,
time: +new Date(),
count: 0,
active: true
};
// disable link on close
pool[name].socket.on('close', ... | [
"function",
"(",
"name",
",",
"socket",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// check input",
"if",
"(",
"name",
"&&",
"socket",
")",
"{",
"log",
"(",
"'ws'",
",",
"'init'",
",",
"name",
",",
"'connection'",
")",
";",
"// main data structure",
"... | New WebSocket creation.
@param {String} name unique identifier for session
@param {Object} socket websocket resource
@return {Boolean} true if was deleted successfully | [
"New",
"WebSocket",
"creation",
"."
] | d281c796706e26269bac99c92d5aca7884e68e19 | https://github.com/DarkPark/code-proxy/blob/d281c796706e26269bac99c92d5aca7884e68e19/server/wspool.js#L25-L59 | |
55,784 | DarkPark/code-proxy | server/wspool.js | function ( name ) {
// valid connection
if ( name in pool ) {
log('ws', 'exit', name, 'close');
return delete pool[name];
}
// failure
log('ws', 'del', name, 'fail to remove (invalid connection)');
return false;
} | javascript | function ( name ) {
// valid connection
if ( name in pool ) {
log('ws', 'exit', name, 'close');
return delete pool[name];
}
// failure
log('ws', 'del', name, 'fail to remove (invalid connection)');
return false;
} | [
"function",
"(",
"name",
")",
"{",
"// valid connection",
"if",
"(",
"name",
"in",
"pool",
")",
"{",
"log",
"(",
"'ws'",
",",
"'exit'",
",",
"name",
",",
"'close'",
")",
";",
"return",
"delete",
"pool",
"[",
"name",
"]",
";",
"}",
"// failure",
"log"... | Clear resources on WebSocket deletion.
@param {String} name session name
@return {Boolean} true if was deleted successfully | [
"Clear",
"resources",
"on",
"WebSocket",
"deletion",
"."
] | d281c796706e26269bac99c92d5aca7884e68e19 | https://github.com/DarkPark/code-proxy/blob/d281c796706e26269bac99c92d5aca7884e68e19/server/wspool.js#L67-L77 | |
55,785 | DarkPark/code-proxy | server/wspool.js | function ( name ) {
// valid connection
if ( name in pool ) {
return {
active: pool[name].active,
count: pool[name].count
};
}
// failure
return {active: false};
} | javascript | function ( name ) {
// valid connection
if ( name in pool ) {
return {
active: pool[name].active,
count: pool[name].count
};
}
// failure
return {active: false};
} | [
"function",
"(",
"name",
")",
"{",
"// valid connection",
"if",
"(",
"name",
"in",
"pool",
")",
"{",
"return",
"{",
"active",
":",
"pool",
"[",
"name",
"]",
".",
"active",
",",
"count",
":",
"pool",
"[",
"name",
"]",
".",
"count",
"}",
";",
"}",
... | Detailed information of the named WebSocket instance.
@param {String} name session name
@return {{active:Boolean, count:Number}|{active:Boolean}} info | [
"Detailed",
"information",
"of",
"the",
"named",
"WebSocket",
"instance",
"."
] | d281c796706e26269bac99c92d5aca7884e68e19 | https://github.com/DarkPark/code-proxy/blob/d281c796706e26269bac99c92d5aca7884e68e19/server/wspool.js#L86-L97 | |
55,786 | DarkPark/code-proxy | server/wspool.js | function ( name, data, response ) {
log('ws', 'send', name, data);
// store link to talk back when ready
pool[name].response = response;
// actual post
pool[name].socket.send(data);
pool[name].count++;
} | javascript | function ( name, data, response ) {
log('ws', 'send', name, data);
// store link to talk back when ready
pool[name].response = response;
// actual post
pool[name].socket.send(data);
pool[name].count++;
} | [
"function",
"(",
"name",
",",
"data",
",",
"response",
")",
"{",
"log",
"(",
"'ws'",
",",
"'send'",
",",
"name",
",",
"data",
")",
";",
"// store link to talk back when ready",
"pool",
"[",
"name",
"]",
".",
"response",
"=",
"response",
";",
"// actual pos... | Forward the request to the given session.
@param {String} name session name
@param {String} data post data from guest to host
@param {ServerResponse} response link to HTTP response object to send back data | [
"Forward",
"the",
"request",
"to",
"the",
"given",
"session",
"."
] | d281c796706e26269bac99c92d5aca7884e68e19 | https://github.com/DarkPark/code-proxy/blob/d281c796706e26269bac99c92d5aca7884e68e19/server/wspool.js#L106-L113 | |
55,787 | conoremclaughlin/bones-boiler | server/backbone.js | function(req, res) {
if (res.locals.success) {
options.success(model, response);
} else {
options.error(model, response);
}
} | javascript | function(req, res) {
if (res.locals.success) {
options.success(model, response);
} else {
options.error(model, response);
}
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"res",
".",
"locals",
".",
"success",
")",
"{",
"options",
".",
"success",
"(",
"model",
",",
"response",
")",
";",
"}",
"else",
"{",
"options",
".",
"error",
"(",
"model",
",",
"response",
... | Create a route handler wrapper to call success or error. | [
"Create",
"a",
"route",
"handler",
"wrapper",
"to",
"call",
"success",
"or",
"error",
"."
] | 65e8ce58da75f0f3235342ba3c42084ded0ea450 | https://github.com/conoremclaughlin/bones-boiler/blob/65e8ce58da75f0f3235342ba3c42084ded0ea450/server/backbone.js#L22-L28 | |
55,788 | epferrari/immutable-state | index.js | function(s){
var currentState = history[historyIndex];
if(typeof s === 'function'){
s = s( history[historyIndex].toJS() );
}
var newState = currentState.merge(s);
history = history.slice(0,historyIndex + 1);
history.push(newState);
historyIndex++;
return new Immu... | javascript | function(s){
var currentState = history[historyIndex];
if(typeof s === 'function'){
s = s( history[historyIndex].toJS() );
}
var newState = currentState.merge(s);
history = history.slice(0,historyIndex + 1);
history.push(newState);
historyIndex++;
return new Immu... | [
"function",
"(",
"s",
")",
"{",
"var",
"currentState",
"=",
"history",
"[",
"historyIndex",
"]",
";",
"if",
"(",
"typeof",
"s",
"===",
"'function'",
")",
"{",
"s",
"=",
"s",
"(",
"history",
"[",
"historyIndex",
"]",
".",
"toJS",
"(",
")",
")",
";",... | ensure that setting state via assignment performs an immutable operation | [
"ensure",
"that",
"setting",
"state",
"via",
"assignment",
"performs",
"an",
"immutable",
"operation"
] | fe510a17f2f809032a6c8a9eb2e523b60d9f0e48 | https://github.com/epferrari/immutable-state/blob/fe510a17f2f809032a6c8a9eb2e523b60d9f0e48/index.js#L24-L35 | |
55,789 | kmalakoff/backbone-articulation | vendor/optional/backbone-relational-0.4.0.js | function( name ) {
var type = _.reduce( name.split('.'), function( memo, val ) {
return memo[ val ];
}, exports);
return type !== exports ? type: null;
} | javascript | function( name ) {
var type = _.reduce( name.split('.'), function( memo, val ) {
return memo[ val ];
}, exports);
return type !== exports ? type: null;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"type",
"=",
"_",
".",
"reduce",
"(",
"name",
".",
"split",
"(",
"'.'",
")",
",",
"function",
"(",
"memo",
",",
"val",
")",
"{",
"return",
"memo",
"[",
"val",
"]",
";",
"}",
",",
"exports",
")",
";",
... | Find a type on the global object by name. Splits name on dots.
@param {string} name | [
"Find",
"a",
"type",
"on",
"the",
"global",
"object",
"by",
"name",
".",
"Splits",
"name",
"on",
"dots",
"."
] | ce093551bab078369b5f9f4244873d108a344eb5 | https://github.com/kmalakoff/backbone-articulation/blob/ce093551bab078369b5f9f4244873d108a344eb5/vendor/optional/backbone-relational-0.4.0.js#L179-L184 | |
55,790 | kmalakoff/backbone-articulation | vendor/optional/backbone-relational-0.4.0.js | function( model ) {
var coll = this.getCollection( model );
coll._onModelEvent( 'change:' + model.idAttribute, model, coll );
} | javascript | function( model ) {
var coll = this.getCollection( model );
coll._onModelEvent( 'change:' + model.idAttribute, model, coll );
} | [
"function",
"(",
"model",
")",
"{",
"var",
"coll",
"=",
"this",
".",
"getCollection",
"(",
"model",
")",
";",
"coll",
".",
"_onModelEvent",
"(",
"'change:'",
"+",
"model",
".",
"idAttribute",
",",
"model",
",",
"coll",
")",
";",
"}"
] | Explicitly update a model's id in it's store collection | [
"Explicitly",
"update",
"a",
"model",
"s",
"id",
"in",
"it",
"s",
"store",
"collection"
] | ce093551bab078369b5f9f4244873d108a344eb5 | https://github.com/kmalakoff/backbone-articulation/blob/ce093551bab078369b5f9f4244873d108a344eb5/vendor/optional/backbone-relational-0.4.0.js#L223-L226 | |
55,791 | kmalakoff/backbone-articulation | vendor/optional/backbone-relational-0.4.0.js | function() {
Backbone.Relational.store.getCollection( this.instance )
.unbind( 'relational:remove', this._modelRemovedFromCollection );
Backbone.Relational.store.getCollection( this.relatedModel )
.unbind( 'relational:add', this._relatedModelAdded )
.unbind( 'relational:remove', this._relatedModel... | javascript | function() {
Backbone.Relational.store.getCollection( this.instance )
.unbind( 'relational:remove', this._modelRemovedFromCollection );
Backbone.Relational.store.getCollection( this.relatedModel )
.unbind( 'relational:add', this._relatedModelAdded )
.unbind( 'relational:remove', this._relatedModel... | [
"function",
"(",
")",
"{",
"Backbone",
".",
"Relational",
".",
"store",
".",
"getCollection",
"(",
"this",
".",
"instance",
")",
".",
"unbind",
"(",
"'relational:remove'",
",",
"this",
".",
"_modelRemovedFromCollection",
")",
";",
"Backbone",
".",
"Relational"... | Cleanup. Get reverse relation, call removeRelated on each. | [
"Cleanup",
".",
"Get",
"reverse",
"relation",
"call",
"removeRelated",
"on",
"each",
"."
] | ce093551bab078369b5f9f4244873d108a344eb5 | https://github.com/kmalakoff/backbone-articulation/blob/ce093551bab078369b5f9f4244873d108a344eb5/vendor/optional/backbone-relational-0.4.0.js#L441-L452 | |
55,792 | campsi/campsi-service-auth | lib/passportMiddleware.js | proxyVerifyCallback | function proxyVerifyCallback (fn, args, done) {
const {callback, index} = findCallback(args);
args[index] = function (err, user) {
done(err, user, callback);
};
fn.apply(null, args);
} | javascript | function proxyVerifyCallback (fn, args, done) {
const {callback, index} = findCallback(args);
args[index] = function (err, user) {
done(err, user, callback);
};
fn.apply(null, args);
} | [
"function",
"proxyVerifyCallback",
"(",
"fn",
",",
"args",
",",
"done",
")",
"{",
"const",
"{",
"callback",
",",
"index",
"}",
"=",
"findCallback",
"(",
"args",
")",
";",
"args",
"[",
"index",
"]",
"=",
"function",
"(",
"err",
",",
"user",
")",
"{",
... | Intercepts passport callback
@param fn
@param args
@param done | [
"Intercepts",
"passport",
"callback"
] | f877626496de2288f9cfb50024accca2a88e179d | https://github.com/campsi/campsi-service-auth/blob/f877626496de2288f9cfb50024accca2a88e179d/lib/passportMiddleware.js#L10-L16 |
55,793 | IonicaBizau/set-or-get.js | lib/index.js | SetOrGet | function SetOrGet(input, field, def) {
return input[field] = Deffy(input[field], def);
} | javascript | function SetOrGet(input, field, def) {
return input[field] = Deffy(input[field], def);
} | [
"function",
"SetOrGet",
"(",
"input",
",",
"field",
",",
"def",
")",
"{",
"return",
"input",
"[",
"field",
"]",
"=",
"Deffy",
"(",
"input",
"[",
"field",
"]",
",",
"def",
")",
";",
"}"
] | SetOrGet
Sets or gets an object field value.
@name SetOrGet
@function
@param {Object|Array} input The cache/input object.
@param {String|Number} field The field you want to update/create.
@param {Object|Array} def The default value.
@return {Object|Array} The field value. | [
"SetOrGet",
"Sets",
"or",
"gets",
"an",
"object",
"field",
"value",
"."
] | 65baa42d1188dff894a2497b4cad25bb36a757fa | https://github.com/IonicaBizau/set-or-get.js/blob/65baa42d1188dff894a2497b4cad25bb36a757fa/lib/index.js#L15-L17 |
55,794 | kemitchell/tcp-log-client.js | index.js | proxyEvent | function proxyEvent (emitter, event, optionalCallback) {
emitter.on(event, function () {
if (optionalCallback) {
optionalCallback.apply(client, arguments)
}
client.emit(event)
})
} | javascript | function proxyEvent (emitter, event, optionalCallback) {
emitter.on(event, function () {
if (optionalCallback) {
optionalCallback.apply(client, arguments)
}
client.emit(event)
})
} | [
"function",
"proxyEvent",
"(",
"emitter",
",",
"event",
",",
"optionalCallback",
")",
"{",
"emitter",
".",
"on",
"(",
"event",
",",
"function",
"(",
")",
"{",
"if",
"(",
"optionalCallback",
")",
"{",
"optionalCallback",
".",
"apply",
"(",
"client",
",",
... | Emit events from a stream the client manages as the client's own. | [
"Emit",
"events",
"from",
"a",
"stream",
"the",
"client",
"manages",
"as",
"the",
"client",
"s",
"own",
"."
] | bce29ef06c9306db269a6f3e0de83c48def16654 | https://github.com/kemitchell/tcp-log-client.js/blob/bce29ef06c9306db269a6f3e0de83c48def16654/index.js#L109-L116 |
55,795 | conoremclaughlin/bones-boiler | servers/Middleware.bones.js | function(parent, app) {
this.use(middleware.sanitizeHost(app));
this.use(middleware.bodyParser());
this.use(middleware.cookieParser());
this.use(middleware.fragmentRedirect());
} | javascript | function(parent, app) {
this.use(middleware.sanitizeHost(app));
this.use(middleware.bodyParser());
this.use(middleware.cookieParser());
this.use(middleware.fragmentRedirect());
} | [
"function",
"(",
"parent",
",",
"app",
")",
"{",
"this",
".",
"use",
"(",
"middleware",
".",
"sanitizeHost",
"(",
"app",
")",
")",
";",
"this",
".",
"use",
"(",
"middleware",
".",
"bodyParser",
"(",
")",
")",
";",
"this",
".",
"use",
"(",
"middlewa... | Removing validateCSRFToken to replace with connect's csrf middleware.
Double CSRF protection makes dealing with static forms difficult by default. | [
"Removing",
"validateCSRFToken",
"to",
"replace",
"with",
"connect",
"s",
"csrf",
"middleware",
".",
"Double",
"CSRF",
"protection",
"makes",
"dealing",
"with",
"static",
"forms",
"difficult",
"by",
"default",
"."
] | 65e8ce58da75f0f3235342ba3c42084ded0ea450 | https://github.com/conoremclaughlin/bones-boiler/blob/65e8ce58da75f0f3235342ba3c42084ded0ea450/servers/Middleware.bones.js#L9-L14 | |
55,796 | skira-project/core | src/scope.js | Scope | function Scope(site, page, params) {
this.site = site
this.page = page
this.params = params || {}
this.status = 200
this._headers = {}
this.locale = site.locales.default
// Set default headers.
this.header("Content-Type", "text/html; charset=utf-8")
this.header("Connection", "close")
this.header("Server", "S... | javascript | function Scope(site, page, params) {
this.site = site
this.page = page
this.params = params || {}
this.status = 200
this._headers = {}
this.locale = site.locales.default
// Set default headers.
this.header("Content-Type", "text/html; charset=utf-8")
this.header("Connection", "close")
this.header("Server", "S... | [
"function",
"Scope",
"(",
"site",
",",
"page",
",",
"params",
")",
"{",
"this",
".",
"site",
"=",
"site",
"this",
".",
"page",
"=",
"page",
"this",
".",
"params",
"=",
"params",
"||",
"{",
"}",
"this",
".",
"status",
"=",
"200",
"this",
".",
"_he... | The state object are all variables made available to views and modules.
@param {object} site - global Skira site
@param {object} page - resolved page
@param {object} params - params parsed by the router | [
"The",
"state",
"object",
"are",
"all",
"variables",
"made",
"available",
"to",
"views",
"and",
"modules",
"."
] | 41f93199acad0118aa3d86cc15b3afea67bf2085 | https://github.com/skira-project/core/blob/41f93199acad0118aa3d86cc15b3afea67bf2085/src/scope.js#L8-L20 |
55,797 | OpenCrisp/Crisp.EventJS | dist/crisp-event.js | function( option ) {
if ( this._self === option.exporter ) {
return;
}
if ( this._action && !this._action.test( option.action ) ) {
return;
}
if ( this._path && !this._path.test( option.path ) ) {
return;
... | javascript | function( option ) {
if ( this._self === option.exporter ) {
return;
}
if ( this._action && !this._action.test( option.action ) ) {
return;
}
if ( this._path && !this._path.test( option.path ) ) {
return;
... | [
"function",
"(",
"option",
")",
"{",
"if",
"(",
"this",
".",
"_self",
"===",
"option",
".",
"exporter",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"_action",
"&&",
"!",
"this",
".",
"_action",
".",
"test",
"(",
"option",
".",
"action",
... | execute event list
@param {external:Object} option | [
"execute",
"event",
"list"
] | f9e29899a65cf8a8ab7ba1c04a5f591a64e12059 | https://github.com/OpenCrisp/Crisp.EventJS/blob/f9e29899a65cf8a8ab7ba1c04a5f591a64e12059/dist/crisp-event.js#L415-L437 | |
55,798 | independentgeorge/glupost | index.js | glupost | function glupost(configuration) {
const tasks = configuration.tasks || {}
const template = configuration.template || {}
// Expand template object with defaults.
expand(template, { transforms: [], dest: "." })
// Create tasks.
const names = Object.keys(tasks)
for (const name of names) {
co... | javascript | function glupost(configuration) {
const tasks = configuration.tasks || {}
const template = configuration.template || {}
// Expand template object with defaults.
expand(template, { transforms: [], dest: "." })
// Create tasks.
const names = Object.keys(tasks)
for (const name of names) {
co... | [
"function",
"glupost",
"(",
"configuration",
")",
"{",
"const",
"tasks",
"=",
"configuration",
".",
"tasks",
"||",
"{",
"}",
"const",
"template",
"=",
"configuration",
".",
"template",
"||",
"{",
"}",
"// Expand template object with defaults.",
"expand",
"(",
"t... | Create gulp tasks. | [
"Create",
"gulp",
"tasks",
"."
] | 3a66d6d460d8e63552cecf28c32dfabe98fbd689 | https://github.com/independentgeorge/glupost/blob/3a66d6d460d8e63552cecf28c32dfabe98fbd689/index.js#L40-L62 |
55,799 | independentgeorge/glupost | index.js | compose | function compose(task) {
// Already composed action.
if (task.action)
return task.action
// 1. named task.
if (typeof task === "string")
return task
// 2. a function directly.
if (typeof task === "function")
return task.length ? task : () => Promise.resolve(task())
// 3. task ... | javascript | function compose(task) {
// Already composed action.
if (task.action)
return task.action
// 1. named task.
if (typeof task === "string")
return task
// 2. a function directly.
if (typeof task === "function")
return task.length ? task : () => Promise.resolve(task())
// 3. task ... | [
"function",
"compose",
"(",
"task",
")",
"{",
"// Already composed action.",
"if",
"(",
"task",
".",
"action",
")",
"return",
"task",
".",
"action",
"// 1. named task.",
"if",
"(",
"typeof",
"task",
"===",
"\"string\"",
")",
"return",
"task",
"// 2. a function d... | Convert task object to a function. | [
"Convert",
"task",
"object",
"to",
"a",
"function",
"."
] | 3a66d6d460d8e63552cecf28c32dfabe98fbd689 | https://github.com/independentgeorge/glupost/blob/3a66d6d460d8e63552cecf28c32dfabe98fbd689/index.js#L66-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.