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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52,100 | tolokoban/ToloFrameWork | lib/boilerplate.view.js | outputAll | function outputAll( code, moduleName ) {
try {
let out = outputComments( code );
out += " module.exports = function() {\n";
out += outputNeededConstants( code );
out += ` //-------------------
// Class definition.
const ViewClass = function( args ) {
try {
i... | javascript | function outputAll( code, moduleName ) {
try {
let out = outputComments( code );
out += " module.exports = function() {\n";
out += outputNeededConstants( code );
out += ` //-------------------
// Class definition.
const ViewClass = function( args ) {
try {
i... | [
"function",
"outputAll",
"(",
"code",
",",
"moduleName",
")",
"{",
"try",
"{",
"let",
"out",
"=",
"outputComments",
"(",
"code",
")",
";",
"out",
"+=",
"\" module.exports = function() {\\n\"",
";",
"out",
"+=",
"outputNeededConstants",
"(",
"code",
")",
";",
... | Generate the JS code for the XJS module.
@param {object} code - Helper for Javascript code writing.
@param {string} moduleName - Javascript module name.
@return {string} Resulting JS code. | [
"Generate",
"the",
"JS",
"code",
"for",
"the",
"XJS",
"module",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.js#L1460-L1486 |
52,101 | tolokoban/ToloFrameWork | lib/boilerplate.view.js | outputComments | function outputComments( code ) {
try {
let out = '';
if ( code.section.comments.length > 0 ) {
out += ` /**\n * ${code.section.comments.join("\n * ")}\n */\n`;
}
return out;
} catch ( ex ) {
bubble( ex, "outputComments" );
return null;
}
} | javascript | function outputComments( code ) {
try {
let out = '';
if ( code.section.comments.length > 0 ) {
out += ` /**\n * ${code.section.comments.join("\n * ")}\n */\n`;
}
return out;
} catch ( ex ) {
bubble( ex, "outputComments" );
return null;
}
} | [
"function",
"outputComments",
"(",
"code",
")",
"{",
"try",
"{",
"let",
"out",
"=",
"''",
";",
"if",
"(",
"code",
".",
"section",
".",
"comments",
".",
"length",
">",
"0",
")",
"{",
"out",
"+=",
"`",
"\\n",
"${",
"code",
".",
"section",
".",
"com... | Possible comments.
@param {object} code - See below.
@param {array} code.section.comments - Lines of comments.
@return {string} Resulting JS code. | [
"Possible",
"comments",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.js#L1496-L1507 |
52,102 | tolokoban/ToloFrameWork | lib/boilerplate.view.js | outputNeededConstants | function outputNeededConstants( code ) {
try {
let out = arrayToCodeWithNewLine( code.generateRequires(), " " );
out += arrayToCodeWithNewLine( code.generateNeededBehindFunctions(), " " );
out += arrayToCodeWithNewLine( code.generateFunctions(), " " );
out += arrayToCodeWith... | javascript | function outputNeededConstants( code ) {
try {
let out = arrayToCodeWithNewLine( code.generateRequires(), " " );
out += arrayToCodeWithNewLine( code.generateNeededBehindFunctions(), " " );
out += arrayToCodeWithNewLine( code.generateFunctions(), " " );
out += arrayToCodeWith... | [
"function",
"outputNeededConstants",
"(",
"code",
")",
"{",
"try",
"{",
"let",
"out",
"=",
"arrayToCodeWithNewLine",
"(",
"code",
".",
"generateRequires",
"(",
")",
",",
"\" \"",
")",
";",
"out",
"+=",
"arrayToCodeWithNewLine",
"(",
"code",
".",
"generateNe... | Declare requires, converters, global variables, list of needed behind functions, ...
@param {object} code - Helper for Javascript code writing.
@return {string} Resulting JS code. | [
"Declare",
"requires",
"converters",
"global",
"variables",
"list",
"of",
"needed",
"behind",
"functions",
"..."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.js#L1516-L1527 |
52,103 | tolokoban/ToloFrameWork | lib/boilerplate.view.js | outputClassBody | function outputClassBody( code ) {
try {
let out = '';
if ( code.that ) out += " const that = this;\n";
if ( code.pm ) out += " const pm = PM(this);\n";
out += generate( code.section.attribs.define, "Create attributes", " " );
out += generate( code.sectio... | javascript | function outputClassBody( code ) {
try {
let out = '';
if ( code.that ) out += " const that = this;\n";
if ( code.pm ) out += " const pm = PM(this);\n";
out += generate( code.section.attribs.define, "Create attributes", " " );
out += generate( code.sectio... | [
"function",
"outputClassBody",
"(",
"code",
")",
"{",
"try",
"{",
"let",
"out",
"=",
"''",
";",
"if",
"(",
"code",
".",
"that",
")",
"out",
"+=",
"\" const that = this;\\n\"",
";",
"if",
"(",
"code",
".",
"pm",
")",
"out",
"+=",
"\" const p... | Class body.
@param {object} code - Helper for Javascript code writing.
@return {string} Resulting JS code. | [
"Class",
"body",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.js#L1536-L1558 |
52,104 | tolokoban/ToloFrameWork | lib/boilerplate.view.js | bubble | function bubble( ex, origin ) {
if ( typeof ex === 'string' ) {
throw Error( `${ex}\n...in ${origin}` );
}
throw Error( `${ex.message}\n...in ${origin}` );
} | javascript | function bubble( ex, origin ) {
if ( typeof ex === 'string' ) {
throw Error( `${ex}\n...in ${origin}` );
}
throw Error( `${ex.message}\n...in ${origin}` );
} | [
"function",
"bubble",
"(",
"ex",
",",
"origin",
")",
"{",
"if",
"(",
"typeof",
"ex",
"===",
"'string'",
")",
"{",
"throw",
"Error",
"(",
"`",
"${",
"ex",
"}",
"\\n",
"${",
"origin",
"}",
"`",
")",
";",
"}",
"throw",
"Error",
"(",
"`",
"${",
"ex... | Bubble an exception by providing it's origin.
@param {string|Error} ex - Exception.
@param {string} origin - From where the exception has been thrown.
@return {undefined} | [
"Bubble",
"an",
"exception",
"by",
"providing",
"it",
"s",
"origin",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.js#L1568-L1573 |
52,105 | strekmann/libby | lib/mongostore.js | MongoStore | function MongoStore(uri, options) {
var self = this;
this.options = options || (options = {});
options.collectionName = options.collectionName || 'sessions';
// 1 day
options.ttl = options.ttl || 24 * 60 * 60 * 1000;
// 60 s
options.cleanupInterval = options.clea... | javascript | function MongoStore(uri, options) {
var self = this;
this.options = options || (options = {});
options.collectionName = options.collectionName || 'sessions';
// 1 day
options.ttl = options.ttl || 24 * 60 * 60 * 1000;
// 60 s
options.cleanupInterval = options.clea... | [
"function",
"MongoStore",
"(",
"uri",
",",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"options",
"=",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"options",
".",
"collectionName",
"=",
"options",
".",
"collectionNa... | Initialize a new `MongoStore`.
@api public | [
"Initialize",
"a",
"new",
"MongoStore",
"."
] | 9a43f756cf5f43771fa70514f352a16276eb0c98 | https://github.com/strekmann/libby/blob/9a43f756cf5f43771fa70514f352a16276eb0c98/lib/mongostore.js#L19-L46 |
52,106 | jaredhanson/crane-amqp | lib/message.js | Message | function Message(message, headers, deliveryInfo, obj) {
// Crane uses slash ('/') separators rather than period ('.')
this.topic = deliveryInfo.routingKey.replace(/\./g, '/');
this.headers = headers;
if (deliveryInfo.contentType) { this.headers['content-type'] = deliveryInfo.contentType; }
if (Buffer.isBuf... | javascript | function Message(message, headers, deliveryInfo, obj) {
// Crane uses slash ('/') separators rather than period ('.')
this.topic = deliveryInfo.routingKey.replace(/\./g, '/');
this.headers = headers;
if (deliveryInfo.contentType) { this.headers['content-type'] = deliveryInfo.contentType; }
if (Buffer.isBuf... | [
"function",
"Message",
"(",
"message",
",",
"headers",
",",
"deliveryInfo",
",",
"obj",
")",
"{",
"// Crane uses slash ('/') separators rather than period ('.')",
"this",
".",
"topic",
"=",
"deliveryInfo",
".",
"routingKey",
".",
"replace",
"(",
"/",
"\\.",
"/",
"... | `Message` constructor.
@api protected | [
"Message",
"constructor",
"."
] | 2f2a653a5567550d035daf8a2587fac0ebc9d8ce | https://github.com/jaredhanson/crane-amqp/blob/2f2a653a5567550d035daf8a2587fac0ebc9d8ce/lib/message.js#L6-L19 |
52,107 | tombenke/proper | processor.js | function(processingQueue, phase) {
var that = this;
verbose && console.log('phase is: ' + phase, processors);
processingQueue.forEach(function(context) {
var processor = processors[phase][context.fileType];
verbose && console.log('runProcessor with ', that, context );
... | javascript | function(processingQueue, phase) {
var that = this;
verbose && console.log('phase is: ' + phase, processors);
processingQueue.forEach(function(context) {
var processor = processors[phase][context.fileType];
verbose && console.log('runProcessor with ', that, context );
... | [
"function",
"(",
"processingQueue",
",",
"phase",
")",
"{",
"var",
"that",
"=",
"this",
";",
"verbose",
"&&",
"console",
".",
"log",
"(",
"'phase is: '",
"+",
"phase",
",",
"processors",
")",
";",
"processingQueue",
".",
"forEach",
"(",
"function",
"(",
... | Runs a set of processors using their configurations
@param {Array} processingQueue The processor set with their configuration data
@return {Object} The result graph of processing | [
"Runs",
"a",
"set",
"of",
"processors",
"using",
"their",
"configurations"
] | 3f766df6ec7dbb0c4d136373a94002d00d340a48 | https://github.com/tombenke/proper/blob/3f766df6ec7dbb0c4d136373a94002d00d340a48/processor.js#L260-L271 | |
52,108 | IMCampbell/ubcscrapr | src/index.js | getRoomSlots | function getRoomSlots (semester, minRequestSpace = 1000, verbose = false, departments = []) {
validateInput("semester", semester, [1, 2], "set");
validateInput("minRequestSpace", minRequestSpace, [0, 100000], "range");
validateInput("verbose", verbose, [true, false], "set");
validateInput("departments",... | javascript | function getRoomSlots (semester, minRequestSpace = 1000, verbose = false, departments = []) {
validateInput("semester", semester, [1, 2], "set");
validateInput("minRequestSpace", minRequestSpace, [0, 100000], "range");
validateInput("verbose", verbose, [true, false], "set");
validateInput("departments",... | [
"function",
"getRoomSlots",
"(",
"semester",
",",
"minRequestSpace",
"=",
"1000",
",",
"verbose",
"=",
"false",
",",
"departments",
"=",
"[",
"]",
")",
"{",
"validateInput",
"(",
"\"semester\"",
",",
"semester",
",",
"[",
"1",
",",
"2",
"]",
",",
"\"set\... | Returns an object containing all class sections with their weekday, time, room, building, and address
@param semester: the semester that the classes belong to
@param minRequestSpace: the minimum amount of time between requests to UBCs webserver in milliseconds
@param verbose: whether or not you want to see console.logs... | [
"Returns",
"an",
"object",
"containing",
"all",
"class",
"sections",
"with",
"their",
"weekday",
"time",
"room",
"building",
"and",
"address"
] | 42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c | https://github.com/IMCampbell/ubcscrapr/blob/42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c/src/index.js#L11-L17 |
52,109 | IMCampbell/ubcscrapr | src/index.js | getHours | function getHours (verbose = false, minRequestSpace = 500) {
validateInput("verbose", verbose, [true, false], "set");
validateInput("minRequestSpace", minRequestSpace, [0, 100000], "range");
return scrapeBuildings(verbose, minRequestSpace);
} | javascript | function getHours (verbose = false, minRequestSpace = 500) {
validateInput("verbose", verbose, [true, false], "set");
validateInput("minRequestSpace", minRequestSpace, [0, 100000], "range");
return scrapeBuildings(verbose, minRequestSpace);
} | [
"function",
"getHours",
"(",
"verbose",
"=",
"false",
",",
"minRequestSpace",
"=",
"500",
")",
"{",
"validateInput",
"(",
"\"verbose\"",
",",
"verbose",
",",
"[",
"true",
",",
"false",
"]",
",",
"\"set\"",
")",
";",
"validateInput",
"(",
"\"minRequestSpace\"... | Gets the hours for all buildings listed on the Buildings and classrooms section of the student services page
@param verbose: whether or not you want to see console.logs
@param minRequestSpace: the minimum amount of time between requests to UBCs webserver in milliseconds | [
"Gets",
"the",
"hours",
"for",
"all",
"buildings",
"listed",
"on",
"the",
"Buildings",
"and",
"classrooms",
"section",
"of",
"the",
"student",
"services",
"page"
] | 42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c | https://github.com/IMCampbell/ubcscrapr/blob/42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c/src/index.js#L24-L28 |
52,110 | IMCampbell/ubcscrapr | src/index.js | validateInput | function validateInput(inputName, input, acceptableValues, acceptableValueType) {
let validInput = true;
if (acceptableValueType == "range") {
if (input < Math.min(...acceptableValues) || input > Math.max(...acceptableValues)) {
validInput = false;
}
} else if (acceptableValueTyp... | javascript | function validateInput(inputName, input, acceptableValues, acceptableValueType) {
let validInput = true;
if (acceptableValueType == "range") {
if (input < Math.min(...acceptableValues) || input > Math.max(...acceptableValues)) {
validInput = false;
}
} else if (acceptableValueTyp... | [
"function",
"validateInput",
"(",
"inputName",
",",
"input",
",",
"acceptableValues",
",",
"acceptableValueType",
")",
"{",
"let",
"validInput",
"=",
"true",
";",
"if",
"(",
"acceptableValueType",
"==",
"\"range\"",
")",
"{",
"if",
"(",
"input",
"<",
"Math",
... | Function to ensure that variables passed to API are of the correct types and bounded by reasonable values.
@param inputName: the name of the variable
@param input: the value of the variable
@param acceptableValues: parameter containing valid values for input to take
@param acceptableValueType: a flag
range means that t... | [
"Function",
"to",
"ensure",
"that",
"variables",
"passed",
"to",
"API",
"are",
"of",
"the",
"correct",
"types",
"and",
"bounded",
"by",
"reasonable",
"values",
"."
] | 42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c | https://github.com/IMCampbell/ubcscrapr/blob/42b2d5acfae16f55772f548bb5ca1ac2d2a07a4c/src/index.js#L39-L57 |
52,111 | oodolabs/cupsdm | lib/parser.js | parseLine | function parseLine(line, lineno, options) {
let command = null;
const lineContinuationRegex = (options && options.lineContinuationRegex
|| TOKEN_LINE_CONTINUATION);
line = line.trim();
if (!line) {
// Ignore empty lines
return { command: null, remainder: '' };
}
if (isComment(line)) {
// Handle comment... | javascript | function parseLine(line, lineno, options) {
let command = null;
const lineContinuationRegex = (options && options.lineContinuationRegex
|| TOKEN_LINE_CONTINUATION);
line = line.trim();
if (!line) {
// Ignore empty lines
return { command: null, remainder: '' };
}
if (isComment(line)) {
// Handle comment... | [
"function",
"parseLine",
"(",
"line",
",",
"lineno",
",",
"options",
")",
"{",
"let",
"command",
"=",
"null",
";",
"const",
"lineContinuationRegex",
"=",
"(",
"options",
"&&",
"options",
".",
"lineContinuationRegex",
"||",
"TOKEN_LINE_CONTINUATION",
")",
";",
... | parse a line and return the remainder. | [
"parse",
"a",
"line",
"and",
"return",
"the",
"remainder",
"."
] | 6567c0d6fcfe6cfe999f6c13ea3b1d7ca5f529f7 | https://github.com/oodolabs/cupsdm/blob/6567c0d6fcfe6cfe999f6c13ea3b1d7ca5f529f7/lib/parser.js#L303-L344 |
52,112 | phelpstream/svp | lib/functions/dig.js | dig | function dig(obj) {
var iterateeFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val, key, iterableParent) {
return val;
};
// eslint-disable-line no-unused-vars
// modifierFn = v => v,
return (0, _each2.default)(obj, function iterator(itValue, key, itObj) {
var proce... | javascript | function dig(obj) {
var iterateeFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val, key, iterableParent) {
return val;
};
// eslint-disable-line no-unused-vars
// modifierFn = v => v,
return (0, _each2.default)(obj, function iterator(itValue, key, itObj) {
var proce... | [
"function",
"dig",
"(",
"obj",
")",
"{",
"var",
"iterateeFn",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"function",
"(",
"val",
",",
"key",
",",
"iterablePar... | Loop recursively through an iterable data structure.
@param {*} obj The value to iterate over.
@param {Function} iterateeFn The iterateeFn to look at the data. | [
"Loop",
"recursively",
"through",
"an",
"iterable",
"data",
"structure",
"."
] | 2f99adb9c5d0709e567264bba896d6a59f6a0a59 | https://github.com/phelpstream/svp/blob/2f99adb9c5d0709e567264bba896d6a59f6a0a59/lib/functions/dig.js#L29-L55 |
52,113 | asciidisco/grunt-backbonebuilder | lib/builder.js | function (bbsource) {
var parts = {
Header: '',
Setup: '// Initial Setup',
Events: '// Backbone.Events',
Model: '// Backbone.Model',
Collection: '// Backbone.Collection',
Router: '// Backbone.Router',
History: '// Backbone.History',
View: '// Backbone.View',
Syn... | javascript | function (bbsource) {
var parts = {
Header: '',
Setup: '// Initial Setup',
Events: '// Backbone.Events',
Model: '// Backbone.Model',
Collection: '// Backbone.Collection',
Router: '// Backbone.Router',
History: '// Backbone.History',
View: '// Backbone.View',
Syn... | [
"function",
"(",
"bbsource",
")",
"{",
"var",
"parts",
"=",
"{",
"Header",
":",
"''",
",",
"Setup",
":",
"'// Initial Setup'",
",",
"Events",
":",
"'// Backbone.Events'",
",",
"Model",
":",
"'// Backbone.Model'",
",",
"Collection",
":",
"'// Backbone.Collection'... | parts are seperated by annotations | [
"parts",
"are",
"seperated",
"by",
"annotations"
] | 767fc145bb6f713c3e3daba2fc62c2b8cd02ca67 | https://github.com/asciidisco/grunt-backbonebuilder/blob/767fc145bb6f713c3e3daba2fc62c2b8cd02ca67/lib/builder.js#L29-L57 | |
52,114 | asciidisco/grunt-backbonebuilder | lib/builder.js | function (combinations, parts, backboneSrc) {
var src = '';
var allCombinations = [];
parts.forEach(function (part) {
allCombinations.push(combinations[_.str.capitalize(part.toLowerCase())]);
});
var neededParts = _.union.apply(_, allCombinations);
var backboneParts = getBackboneParts(ba... | javascript | function (combinations, parts, backboneSrc) {
var src = '';
var allCombinations = [];
parts.forEach(function (part) {
allCombinations.push(combinations[_.str.capitalize(part.toLowerCase())]);
});
var neededParts = _.union.apply(_, allCombinations);
var backboneParts = getBackboneParts(ba... | [
"function",
"(",
"combinations",
",",
"parts",
",",
"backboneSrc",
")",
"{",
"var",
"src",
"=",
"''",
";",
"var",
"allCombinations",
"=",
"[",
"]",
";",
"parts",
".",
"forEach",
"(",
"function",
"(",
"part",
")",
"{",
"allCombinations",
".",
"push",
"(... | glues the backbone parts together again | [
"glues",
"the",
"backbone",
"parts",
"together",
"again"
] | 767fc145bb6f713c3e3daba2fc62c2b8cd02ca67 | https://github.com/asciidisco/grunt-backbonebuilder/blob/767fc145bb6f713c3e3daba2fc62c2b8cd02ca67/lib/builder.js#L60-L114 | |
52,115 | yoshuawuyts/named-level-store | index.js | namedLevelStore | function namedLevelStore (name) {
assert.equal(typeof name, 'string', 'named-level-store: name should be a string')
const location = path.join(process.env.HOME, '.leveldb', name)
mkdirp.sync(location)
const db = level(location)
db.location = location
return db
} | javascript | function namedLevelStore (name) {
assert.equal(typeof name, 'string', 'named-level-store: name should be a string')
const location = path.join(process.env.HOME, '.leveldb', name)
mkdirp.sync(location)
const db = level(location)
db.location = location
return db
} | [
"function",
"namedLevelStore",
"(",
"name",
")",
"{",
"assert",
".",
"equal",
"(",
"typeof",
"name",
",",
"'string'",
",",
"'named-level-store: name should be a string'",
")",
"const",
"location",
"=",
"path",
".",
"join",
"(",
"process",
".",
"env",
".",
"HOM... | Create a levelDB instance on your local machine str -> obj | [
"Create",
"a",
"levelDB",
"instance",
"on",
"your",
"local",
"machine",
"str",
"-",
">",
"obj"
] | 8a7448ff89d192a07ac718731f0680d6d4b1cff0 | https://github.com/yoshuawuyts/named-level-store/blob/8a7448ff89d192a07ac718731f0680d6d4b1cff0/index.js#L10-L17 |
52,116 | tolokoban/ToloFrameWork | lib/source.js | removeSrcDirPrefixFromFile | function removeSrcDirPrefixFromFile( srcDir, file ) {
if ( typeof srcDir !== 'string' ) return file;
if ( typeof file !== 'string' ) return file;
if ( file.substr( 0, srcDir.length ) !== srcDir ) {
return file;
}
return file.substr( srcDir.length );
} | javascript | function removeSrcDirPrefixFromFile( srcDir, file ) {
if ( typeof srcDir !== 'string' ) return file;
if ( typeof file !== 'string' ) return file;
if ( file.substr( 0, srcDir.length ) !== srcDir ) {
return file;
}
return file.substr( srcDir.length );
} | [
"function",
"removeSrcDirPrefixFromFile",
"(",
"srcDir",
",",
"file",
")",
"{",
"if",
"(",
"typeof",
"srcDir",
"!==",
"'string'",
")",
"return",
"file",
";",
"if",
"(",
"typeof",
"file",
"!==",
"'string'",
")",
"return",
"file",
";",
"if",
"(",
"file",
"... | If present, remove the `srcDir` prefix of `file`.
@param {[type]} srcDir [description]
@param {[type]} file [description]
@returns {[type]} [description]
@example
const f = removeSrcDirPrefixFromFile;
f("/src/", "/myfile.cpp") === "/myfile.cpp";
f("/src/", "/src/myfile2.cpp") === "myfile2.cpp"; | [
"If",
"present",
"remove",
"the",
"srcDir",
"prefix",
"of",
"file",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/source.js#L233-L241 |
52,117 | elantion/handyJS | raw/browser/ajax.js | function (value) {
if (value === null) {
return '';
}
if (value === undefined) {
return '';
}
switch (typeof value) {
case 'object' :
if (value instanceof Blob) {
return value;
} else {
return JSON.stringify(value);
}
break;
case 'string':
return value;
default :
... | javascript | function (value) {
if (value === null) {
return '';
}
if (value === undefined) {
return '';
}
switch (typeof value) {
case 'object' :
if (value instanceof Blob) {
return value;
} else {
return JSON.stringify(value);
}
break;
case 'string':
return value;
default :
... | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"null",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"return",
"''",
";",
"}",
"switch",
"(",
"typeof",
"value",
")",
"{",
"case",
"'object'",
... | transform some type of value | [
"transform",
"some",
"type",
"of",
"value"
] | 7c503d33b668434dd70cefefd6d2f2586c069bd2 | https://github.com/elantion/handyJS/blob/7c503d33b668434dd70cefefd6d2f2586c069bd2/raw/browser/ajax.js#L57-L77 | |
52,118 | philipbordallo/eslint-config | src/utilities/createConfig.js | createConfig | async function createConfig(optionsArgs) {
const options = {
...DEFAULT_OPTIONS,
...optionsArgs,
};
const { rules, base } = options;
const config = {
...base,
rules: base.rules || {},
};
return Object.keys(config)
.reduce(async (collection, key) => {
const previous = await collec... | javascript | async function createConfig(optionsArgs) {
const options = {
...DEFAULT_OPTIONS,
...optionsArgs,
};
const { rules, base } = options;
const config = {
...base,
rules: base.rules || {},
};
return Object.keys(config)
.reduce(async (collection, key) => {
const previous = await collec... | [
"async",
"function",
"createConfig",
"(",
"optionsArgs",
")",
"{",
"const",
"options",
"=",
"{",
"...",
"DEFAULT_OPTIONS",
",",
"...",
"optionsArgs",
",",
"}",
";",
"const",
"{",
"rules",
",",
"base",
"}",
"=",
"options",
";",
"const",
"config",
"=",
"{"... | Create an ESLint config given rules and a base config
@param {Object} optionsArgs
@returns {Promise} A promise to return a full config | [
"Create",
"an",
"ESLint",
"config",
"given",
"rules",
"and",
"a",
"base",
"config"
] | a2f1bff442fdb8ee622f842f075fa10d555302a4 | https://github.com/philipbordallo/eslint-config/blob/a2f1bff442fdb8ee622f842f075fa10d555302a4/src/utilities/createConfig.js#L14-L47 |
52,119 | seanpk/simple-command | SimpleCommand.js | SimpleCommand | function SimpleCommand(exec, args, workdir) {
this.exec = /^win/.test(process.platform) ? findWindowsExec(exec) : exec;
this.args = args;
this.workdir = workdir;
this.setOptions();
this.commandLine = util.format('%s %s', this.exec, this.args.join(' '));
} | javascript | function SimpleCommand(exec, args, workdir) {
this.exec = /^win/.test(process.platform) ? findWindowsExec(exec) : exec;
this.args = args;
this.workdir = workdir;
this.setOptions();
this.commandLine = util.format('%s %s', this.exec, this.args.join(' '));
} | [
"function",
"SimpleCommand",
"(",
"exec",
",",
"args",
",",
"workdir",
")",
"{",
"this",
".",
"exec",
"=",
"/",
"^win",
"/",
".",
"test",
"(",
"process",
".",
"platform",
")",
"?",
"findWindowsExec",
"(",
"exec",
")",
":",
"exec",
";",
"this",
".",
... | SimpleCommand - Constructs a command to run.
@param {string} **exec** the program to run
@param {array} **args** arguments to pass to the program <br/>
__Note:__ the program is executed directly, i.e. no subshell is launched to process globs in args
@param {string} **workdir** working directory from which to ... | [
"SimpleCommand",
"-",
"Constructs",
"a",
"command",
"to",
"run",
"."
] | d250b9a9b650d5779c9ed1fbc68d9e17d10d3c87 | https://github.com/seanpk/simple-command/blob/d250b9a9b650d5779c9ed1fbc68d9e17d10d3c87/SimpleCommand.js#L18-L24 |
52,120 | vamship/wysknd-test | lib/fs.js | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no folders specified to create');
}
items.forEach(function(item) {
try {
_fs.mkdirSync(item);
} catch (e) {
// Eat the ex... | javascript | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no folders specified to create');
}
items.forEach(function(item) {
try {
_fs.mkdirSync(item);
} catch (e) {
// Eat the ex... | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"_utils",
".",
"getArgArray",
"(",
"arguments",
")",
";",
"if",
"(",
"items",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'no folders specified to create'",
")",
";",
"}",
"items",
... | Creates all of the folders specified in the array. | [
"Creates",
"all",
"of",
"the",
"folders",
"specified",
"in",
"the",
"array",
"."
] | b7791c42f1c1b36be7738e2c6d24748360634003 | https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/fs.js#L11-L23 | |
52,121 | vamship/wysknd-test | lib/fs.js | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no files specified to create');
}
items.forEach(function(item) {
var contents;
var linkTarget;
var filePath;
if (typeof item === ... | javascript | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no files specified to create');
}
items.forEach(function(item) {
var contents;
var linkTarget;
var filePath;
if (typeof item === ... | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"_utils",
".",
"getArgArray",
"(",
"arguments",
")",
";",
"if",
"(",
"items",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'no files specified to create'",
")",
";",
"}",
"items",
"... | Creates all of the files specified in the array. | [
"Creates",
"all",
"of",
"the",
"files",
"specified",
"in",
"the",
"array",
"."
] | b7791c42f1c1b36be7738e2c6d24748360634003 | https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/fs.js#L28-L60 | |
52,122 | vamship/wysknd-test | lib/fs.js | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no files specified to clean up');
}
items.forEach(function(item) {
try {
var path = (typeof item === 'string') ? item : item.path;
_f... | javascript | function() {
var items = _utils.getArgArray(arguments);
if (items.length === 0) {
throw new Error('no files specified to clean up');
}
items.forEach(function(item) {
try {
var path = (typeof item === 'string') ? item : item.path;
_f... | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"_utils",
".",
"getArgArray",
"(",
"arguments",
")",
";",
"if",
"(",
"items",
".",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"'no files specified to clean up'",
")",
";",
"}",
"items",
... | Cleans up all of the files specified in the array. If the file
does not exist, the resultant error will be ignored. | [
"Cleans",
"up",
"all",
"of",
"the",
"files",
"specified",
"in",
"the",
"array",
".",
"If",
"the",
"file",
"does",
"not",
"exist",
"the",
"resultant",
"error",
"will",
"be",
"ignored",
"."
] | b7791c42f1c1b36be7738e2c6d24748360634003 | https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/fs.js#L84-L97 | |
52,123 | jonasfj/time-chunked-stream | index.js | function(options) {
// Ensure an instance is created
if (!(this instanceof TimeChunkedStream)) {
return new TimeChunkedStream(options);
}
// Always decode strings
options.decodeStrings = true;
// Initialize base class
Transform.call(this, options);
// Create internal buffer
this._buffer = new ... | javascript | function(options) {
// Ensure an instance is created
if (!(this instanceof TimeChunkedStream)) {
return new TimeChunkedStream(options);
}
// Always decode strings
options.decodeStrings = true;
// Initialize base class
Transform.call(this, options);
// Create internal buffer
this._buffer = new ... | [
"function",
"(",
"options",
")",
"{",
"// Ensure an instance is created",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"TimeChunkedStream",
")",
")",
"{",
"return",
"new",
"TimeChunkedStream",
"(",
"options",
")",
";",
"}",
"// Always decode strings",
"options",
"."... | Construct a new TimeChunkedStream, that will buffer data for
`options.timeout` milliseconds | [
"Construct",
"a",
"new",
"TimeChunkedStream",
"that",
"will",
"buffer",
"data",
"for",
"options",
".",
"timeout",
"milliseconds"
] | 06a4378a7e133f495403f96b63cd32a3289baf5a | https://github.com/jonasfj/time-chunked-stream/blob/06a4378a7e133f495403f96b63cd32a3289baf5a/index.js#L32-L48 | |
52,124 | vincentmac/yeoman-bootstrap | install.js | linkBootstrap | function linkBootstrap() {
fs.symlink(bootstrap, path.resolve(yeoman, 'bootstrap-less'), 'dir', function(err) {
if (err) return console.log('symlink error:', err);
return console.log('Successfully installed yeoman-bootstrap in', bootstrap,
' and created a symlink in', yeoman);
});
} | javascript | function linkBootstrap() {
fs.symlink(bootstrap, path.resolve(yeoman, 'bootstrap-less'), 'dir', function(err) {
if (err) return console.log('symlink error:', err);
return console.log('Successfully installed yeoman-bootstrap in', bootstrap,
' and created a symlink in', yeoman);
});
} | [
"function",
"linkBootstrap",
"(",
")",
"{",
"fs",
".",
"symlink",
"(",
"bootstrap",
",",
"path",
".",
"resolve",
"(",
"yeoman",
",",
"'bootstrap-less'",
")",
",",
"'dir'",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"return",
"console... | Create new symlink to the bootstrap generator | [
"Create",
"new",
"symlink",
"to",
"the",
"bootstrap",
"generator"
] | b510ebe30244fdcf957e11fd2197995a3ab71bdc | https://github.com/vincentmac/yeoman-bootstrap/blob/b510ebe30244fdcf957e11fd2197995a3ab71bdc/install.js#L39-L45 |
52,125 | byron-dupreez/aws-stream-consumer-core | settings.js | toPropertyNamesArray | function toPropertyNamesArray(propertyNamesString, separator) {
return propertyNamesString.split(separator || PROPERTY_NAME_SEPARATOR).map(s => trim(s)).filter(s => !!s);
} | javascript | function toPropertyNamesArray(propertyNamesString, separator) {
return propertyNamesString.split(separator || PROPERTY_NAME_SEPARATOR).map(s => trim(s)).filter(s => !!s);
} | [
"function",
"toPropertyNamesArray",
"(",
"propertyNamesString",
",",
"separator",
")",
"{",
"return",
"propertyNamesString",
".",
"split",
"(",
"separator",
"||",
"PROPERTY_NAME_SEPARATOR",
")",
".",
"map",
"(",
"s",
"=>",
"trim",
"(",
"s",
")",
")",
".",
"fil... | Converts the given property names string into an array of property names
@param {string} propertyNamesString - a string of property name(s) separated by the given separator
@param {string|undefined} [separator] - the separator to use to split the property names (defaults to PROPERTY_NAME_SEPARATOR if omitted)
@returns ... | [
"Converts",
"the",
"given",
"property",
"names",
"string",
"into",
"an",
"array",
"of",
"property",
"names"
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/settings.js#L436-L438 |
52,126 | redisjs/jsr-store | lib/command/list.js | linsert | function linsert(key, beforeAfter, pivot, value, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
return val.linsert(beforeAfter, pivot, value);
} | javascript | function linsert(key, beforeAfter, pivot, value, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
return val.linsert(beforeAfter, pivot, value);
} | [
"function",
"linsert",
"(",
"key",
",",
"beforeAfter",
",",
"pivot",
",",
"value",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"0",
";",
"r... | Inserts value in the list stored at key either before
or after the reference value pivot. | [
"Inserts",
"value",
"in",
"the",
"list",
"stored",
"at",
"key",
"either",
"before",
"or",
"after",
"the",
"reference",
"value",
"pivot",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L24-L28 |
52,127 | redisjs/jsr-store | lib/command/list.js | lindex | function lindex(key, index, req) {
var val = this.getKey(key, req);
if(!val) return null;
return val.lindex(index);
} | javascript | function lindex(key, index, req) {
var val = this.getKey(key, req);
if(!val) return null;
return val.lindex(index);
} | [
"function",
"lindex",
"(",
"key",
",",
"index",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"!",
"val",
")",
"return",
"null",
";",
"return",
"val",
".",
"lindex",
"(",
"index",
"... | Returns the list element stored at index. | [
"Returns",
"the",
"list",
"element",
"stored",
"at",
"index",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L33-L37 |
52,128 | redisjs/jsr-store | lib/command/list.js | lpush | function lpush(key /*value-1, value-N, req*/) {
var val = this.getKey(key, req)
, args = slice.call(arguments, 1)
, req;
if(typeof args[args.length - 1] === 'object') {
req = args.pop();
}
if(val === undefined) {
val = new List();
this.setKey(key, val, undefined, undefined, undefined, req);
... | javascript | function lpush(key /*value-1, value-N, req*/) {
var val = this.getKey(key, req)
, args = slice.call(arguments, 1)
, req;
if(typeof args[args.length - 1] === 'object') {
req = args.pop();
}
if(val === undefined) {
val = new List();
this.setKey(key, val, undefined, undefined, undefined, req);
... | [
"function",
"lpush",
"(",
"key",
"/*value-1, value-N, req*/",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
",",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
",",
"req",
";",
"if",
"(",
"typ... | Insert all the specified values at the head of the list stored at key. | [
"Insert",
"all",
"the",
"specified",
"values",
"at",
"the",
"head",
"of",
"the",
"list",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L42-L54 |
52,129 | redisjs/jsr-store | lib/command/list.js | lpushx | function lpushx(key, value, req) {
var val = this.getKey(key, req);
if(val === undefined) {
return 0;
}
return val.lpush([value]);
} | javascript | function lpushx(key, value, req) {
var val = this.getKey(key, req);
if(val === undefined) {
return 0;
}
return val.lpush([value]);
} | [
"function",
"lpushx",
"(",
"key",
",",
"value",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"return",
"0",
";",
"}",
"return",
"val",
".",
"lp... | Insert values at the head of the list stored at key
only if key exists. | [
"Insert",
"values",
"at",
"the",
"head",
"of",
"the",
"list",
"stored",
"at",
"key",
"only",
"if",
"key",
"exists",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L77-L83 |
52,130 | redisjs/jsr-store | lib/command/list.js | rpushx | function rpushx(key, value, req) {
var val = this.getKey(key, req);
if(val === undefined) {
return 0;
}
return val.rpush([value]);
} | javascript | function rpushx(key, value, req) {
var val = this.getKey(key, req);
if(val === undefined) {
return 0;
}
return val.rpush([value]);
} | [
"function",
"rpushx",
"(",
"key",
",",
"value",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"return",
"0",
";",
"}",
"return",
"val",
".",
"rp... | Insert values at the tail of the list stored at key
only if key exists. | [
"Insert",
"values",
"at",
"the",
"tail",
"of",
"the",
"list",
"stored",
"at",
"key",
"only",
"if",
"key",
"exists",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L89-L95 |
52,131 | redisjs/jsr-store | lib/command/list.js | lpop | function lpop(key, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
var element = val.lpop();
if(val.llen() === 0) {
this.delKey(key, req);
}
return element;
} | javascript | function lpop(key, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
var element = val.lpop();
if(val.llen() === 0) {
this.delKey(key, req);
}
return element;
} | [
"function",
"lpop",
"(",
"key",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"null",
";",
"var",
"element",
"=",
"val",
".",
"lpop",
"(",
... | Removes and returns the first element of the list stored at key. | [
"Removes",
"and",
"returns",
"the",
"first",
"element",
"of",
"the",
"list",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L100-L108 |
52,132 | redisjs/jsr-store | lib/command/list.js | lrem | function lrem(key, count, value, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
var deleted = val.lrem(count, value);
if(val.llen() === 0) {
this.delKey(key, req);
}
return deleted;
} | javascript | function lrem(key, count, value, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
var deleted = val.lrem(count, value);
if(val.llen() === 0) {
this.delKey(key, req);
}
return deleted;
} | [
"function",
"lrem",
"(",
"key",
",",
"count",
",",
"value",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"0",
";",
"var",
"deleted",
"=",
... | Removes the first count occurrences of elements equal to value
from the list stored at key. | [
"Removes",
"the",
"first",
"count",
"occurrences",
"of",
"elements",
"equal",
"to",
"value",
"from",
"the",
"list",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L127-L135 |
52,133 | redisjs/jsr-store | lib/command/list.js | ltrim | function ltrim(key, start, stop, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
val.ltrim(start, stop);
if(val.llen() === 0) {
this.delKey(key, req);
}
return OK;
} | javascript | function ltrim(key, start, stop, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
val.ltrim(start, stop);
if(val.llen() === 0) {
this.delKey(key, req);
}
return OK;
} | [
"function",
"ltrim",
"(",
"key",
",",
"start",
",",
"stop",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"null",
";",
"val",
".",
"ltrim",
... | Trim an existing list so that it will contain only the specified
range of elements. | [
"Trim",
"an",
"existing",
"list",
"so",
"that",
"it",
"will",
"contain",
"only",
"the",
"specified",
"range",
"of",
"elements",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L141-L149 |
52,134 | redisjs/jsr-store | lib/command/list.js | lrange | function lrange(key, start, stop, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
return val.lrange(start, stop);
} | javascript | function lrange(key, start, stop, req) {
var val = this.getKey(key, req);
if(val === undefined) return null;
return val.lrange(start, stop);
} | [
"function",
"lrange",
"(",
"key",
",",
"start",
",",
"stop",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"null",
";",
"return",
"val",
".",... | Returns the specified elements of the list stored at key. | [
"Returns",
"the",
"specified",
"elements",
"of",
"the",
"list",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L154-L158 |
52,135 | redisjs/jsr-store | lib/command/list.js | llen | function llen(key, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
return val.llen();
} | javascript | function llen(key, req) {
var val = this.getKey(key, req);
if(val === undefined) return 0;
return val.llen();
} | [
"function",
"llen",
"(",
"key",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
",",
"req",
")",
";",
"if",
"(",
"val",
"===",
"undefined",
")",
"return",
"0",
";",
"return",
"val",
".",
"llen",
"(",
")",
";",
"}"
] | Returns the length of the list stored at key. | [
"Returns",
"the",
"length",
"of",
"the",
"list",
"stored",
"at",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/list.js#L163-L167 |
52,136 | rabchev/passport-oauth-wrap | example/index.js | processToken | function processToken(token, done) {
var user = _.find(users, function (item) {
return item.username === token[claims.username];
});
if (!user) {
user = {
id : token[claims.id] || currId++,
username : token[claims.username],
email : token... | javascript | function processToken(token, done) {
var user = _.find(users, function (item) {
return item.username === token[claims.username];
});
if (!user) {
user = {
id : token[claims.id] || currId++,
username : token[claims.username],
email : token... | [
"function",
"processToken",
"(",
"token",
",",
"done",
")",
"{",
"var",
"user",
"=",
"_",
".",
"find",
"(",
"users",
",",
"function",
"(",
"item",
")",
"{",
"return",
"item",
".",
"username",
"===",
"token",
"[",
"claims",
".",
"username",
"]",
";",
... | We have to build and register the user with the supplied claims from the access token. The token could be either Simple Web Token or JSON Web Token by specification. | [
"We",
"have",
"to",
"build",
"and",
"register",
"the",
"user",
"with",
"the",
"supplied",
"claims",
"from",
"the",
"access",
"token",
".",
"The",
"token",
"could",
"be",
"either",
"Simple",
"Web",
"Token",
"or",
"JSON",
"Web",
"Token",
"by",
"specification... | 7f23fe82b5614859b5024aa3317b7e07f2aecaa5 | https://github.com/rabchev/passport-oauth-wrap/blob/7f23fe82b5614859b5024aa3317b7e07f2aecaa5/example/index.js#L39-L61 |
52,137 | seriousManual/winston-splunkstorm | index.js | function (options) {
winston.Transport.call(this, options);
options = options || {};
var apiKey = options.apiKey;
var projectId = options.projectId;
var apiHostName = options.apiHostName;
var formatter = options.formatter || 'kvp';
if (!apiKey || !projectId || !apiHostName) {
thro... | javascript | function (options) {
winston.Transport.call(this, options);
options = options || {};
var apiKey = options.apiKey;
var projectId = options.projectId;
var apiHostName = options.apiHostName;
var formatter = options.formatter || 'kvp';
if (!apiKey || !projectId || !apiHostName) {
thro... | [
"function",
"(",
"options",
")",
"{",
"winston",
".",
"Transport",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"apiKey",
"=",
"options",
".",
"apiKey",
";",
"var",
"projectId",
"=",
"opti... | Constructor function for the Splunkstorm constructor
@param options
@constructor | [
"Constructor",
"function",
"for",
"the",
"Splunkstorm",
"constructor"
] | 9c37c83c60ad1ac8aee2ea400388805e188de4ed | https://github.com/seriousManual/winston-splunkstorm/blob/9c37c83c60ad1ac8aee2ea400388805e188de4ed/index.js#L15-L40 | |
52,138 | tolokoban/ToloFrameWork | lib/tolojson.js | stringify | function stringify(js, indent, indentUnit) {
if (typeof indent === 'undefined') indent = '';
if (typeof indentUnit === 'undefined') indentUnit = ' ';
var t = typeof js;
if (t === 'string') {
return JSON.stringify(js);
}
if (t === 'number') {
return js;
}
if (t === 'boole... | javascript | function stringify(js, indent, indentUnit) {
if (typeof indent === 'undefined') indent = '';
if (typeof indentUnit === 'undefined') indentUnit = ' ';
var t = typeof js;
if (t === 'string') {
return JSON.stringify(js);
}
if (t === 'number') {
return js;
}
if (t === 'boole... | [
"function",
"stringify",
"(",
"js",
",",
"indent",
",",
"indentUnit",
")",
"{",
"if",
"(",
"typeof",
"indent",
"===",
"'undefined'",
")",
"indent",
"=",
"''",
";",
"if",
"(",
"typeof",
"indentUnit",
"===",
"'undefined'",
")",
"indentUnit",
"=",
"' '",
"... | ToloJSON can parse JSON with comments, and can stringify JSON with indentation and comments.
This is useful for configuration files. | [
"ToloJSON",
"can",
"parse",
"JSON",
"with",
"comments",
"and",
"can",
"stringify",
"JSON",
"with",
"indentation",
"and",
"comments",
".",
"This",
"is",
"useful",
"for",
"configuration",
"files",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/tolojson.js#L6-L56 |
52,139 | kt3k/cli-dispatch | index.js | main | function main (action, argv, options) {
options = options || {}
const cli = new CliDispatch(action, options.actions || 'actions', options.base || callersDir())
setImmediate(() => cli.dispatch(argv))
return cli
} | javascript | function main (action, argv, options) {
options = options || {}
const cli = new CliDispatch(action, options.actions || 'actions', options.base || callersDir())
setImmediate(() => cli.dispatch(argv))
return cli
} | [
"function",
"main",
"(",
"action",
",",
"argv",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"const",
"cli",
"=",
"new",
"CliDispatch",
"(",
"action",
",",
"options",
".",
"actions",
"||",
"'actions'",
",",
"options",
".",
"base... | Dispatches the action by the given paramters.
@param {string} action The action name
@param {object} argv The parameters for the actions
@param {string} [options.actions] The action's directory (relative path)
@param {string} [options.base] The action's base directory (absolute path)
@return {CliDispatch} | [
"Dispatches",
"the",
"action",
"by",
"the",
"given",
"paramters",
"."
] | 26ff44ab019f49bf977f5113cf261129743efcef | https://github.com/kt3k/cli-dispatch/blob/26ff44ab019f49bf977f5113cf261129743efcef/index.js#L21-L28 |
52,140 | kt3k/cli-dispatch | index.js | lookup | function lookup (action, options) {
options = options || {}
const cli = new CliDispatch(action, options.actions || 'actions', options.base || callersDir())
return cli.lookup()
} | javascript | function lookup (action, options) {
options = options || {}
const cli = new CliDispatch(action, options.actions || 'actions', options.base || callersDir())
return cli.lookup()
} | [
"function",
"lookup",
"(",
"action",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"const",
"cli",
"=",
"new",
"CliDispatch",
"(",
"action",
",",
"options",
".",
"actions",
"||",
"'actions'",
",",
"options",
".",
"base",
"||",
"c... | Looks up the action by the given paramters.
@param {string} action The action name
@param {string} [options.actions] The action's directory (relative path)
@param {string} [options.base] The action's base directory (absolute path)
@return {CliDispatch} | [
"Looks",
"up",
"the",
"action",
"by",
"the",
"given",
"paramters",
"."
] | 26ff44ab019f49bf977f5113cf261129743efcef | https://github.com/kt3k/cli-dispatch/blob/26ff44ab019f49bf977f5113cf261129743efcef/index.js#L37-L42 |
52,141 | kt3k/cli-dispatch | index.js | CliDispatch | function CliDispatch (action, dir, baseDir) {
this.action = action
this.dir = dir
this.baseDir = baseDir
} | javascript | function CliDispatch (action, dir, baseDir) {
this.action = action
this.dir = dir
this.baseDir = baseDir
} | [
"function",
"CliDispatch",
"(",
"action",
",",
"dir",
",",
"baseDir",
")",
"{",
"this",
".",
"action",
"=",
"action",
"this",
".",
"dir",
"=",
"dir",
"this",
".",
"baseDir",
"=",
"baseDir",
"}"
] | CliDispatch internal class.
@param {string} action The action name
@param {string} dir The directory name (relative path)
@param {string} baseDir The base directory name (absolute path) | [
"CliDispatch",
"internal",
"class",
"."
] | 26ff44ab019f49bf977f5113cf261129743efcef | https://github.com/kt3k/cli-dispatch/blob/26ff44ab019f49bf977f5113cf261129743efcef/index.js#L50-L54 |
52,142 | ibm-bluemix-mobile-services/bms-mca-oauth-sdk | lib/util/token-util.js | getCliendIdFromCert | function getCliendIdFromCert() {
var x509 = require('x509');
var certJson = x509.parseCert(fs.readFileSync(process.cwd()+Constant.CERTIFICATE_PATH).toString());
var cliendId = cert && cert.subject && cert.subject.commonName;
return clientId;
} | javascript | function getCliendIdFromCert() {
var x509 = require('x509');
var certJson = x509.parseCert(fs.readFileSync(process.cwd()+Constant.CERTIFICATE_PATH).toString());
var cliendId = cert && cert.subject && cert.subject.commonName;
return clientId;
} | [
"function",
"getCliendIdFromCert",
"(",
")",
"{",
"var",
"x509",
"=",
"require",
"(",
"'x509'",
")",
";",
"var",
"certJson",
"=",
"x509",
".",
"parseCert",
"(",
"fs",
".",
"readFileSync",
"(",
"process",
".",
"cwd",
"(",
")",
"+",
"Constant",
".",
"CER... | Parse the certificate, and return the clientId from the commonName field in subject.
@returns | [
"Parse",
"the",
"certificate",
"and",
"return",
"the",
"clientId",
"from",
"the",
"commonName",
"field",
"in",
"subject",
"."
] | 6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83 | https://github.com/ibm-bluemix-mobile-services/bms-mca-oauth-sdk/blob/6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83/lib/util/token-util.js#L130-L136 |
52,143 | ibm-bluemix-mobile-services/bms-mca-oauth-sdk | lib/util/token-util.js | verifyPermission | function verifyPermission(appId,uaaCredential) {
var deferred = Q.defer();
var cloudControllerUrl = process.env.cloudControllerUrl;
if (!cloudControllerUrl) {
var errMsg = "The system variable 'cloudControllerUrl' is missing.";
ibmlogger.getLogger().error(errMsg);
deferred.reject({code:Constant.MISSING_CLOUDC... | javascript | function verifyPermission(appId,uaaCredential) {
var deferred = Q.defer();
var cloudControllerUrl = process.env.cloudControllerUrl;
if (!cloudControllerUrl) {
var errMsg = "The system variable 'cloudControllerUrl' is missing.";
ibmlogger.getLogger().error(errMsg);
deferred.reject({code:Constant.MISSING_CLOUDC... | [
"function",
"verifyPermission",
"(",
"appId",
",",
"uaaCredential",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"cloudControllerUrl",
"=",
"process",
".",
"env",
".",
"cloudControllerUrl",
";",
"if",
"(",
"!",
"cloudControllerU... | Check if the given uaa credential has permisstion to access the appid.
@param appId
@param uaaCredential
@returns | [
"Check",
"if",
"the",
"given",
"uaa",
"credential",
"has",
"permisstion",
"to",
"access",
"the",
"appid",
"."
] | 6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83 | https://github.com/ibm-bluemix-mobile-services/bms-mca-oauth-sdk/blob/6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83/lib/util/token-util.js#L144-L174 |
52,144 | ibm-bluemix-mobile-services/bms-mca-oauth-sdk | lib/util/token-util.js | getOAuthAccessToken | function getOAuthAccessToken(appId,clientId,imfCert,properties) {
var deferred = Q.defer();
var imfServiceUrl = process.env.imfServiceUrl;
var requestUrl = imfServiceUrl+"/authorization/v1/apps/"+appId+"/token";
var requestOptions = {url: requestUrl,headers: {'Authorization': 'IMFCert '+imfCert}, form:{'grant_typ... | javascript | function getOAuthAccessToken(appId,clientId,imfCert,properties) {
var deferred = Q.defer();
var imfServiceUrl = process.env.imfServiceUrl;
var requestUrl = imfServiceUrl+"/authorization/v1/apps/"+appId+"/token";
var requestOptions = {url: requestUrl,headers: {'Authorization': 'IMFCert '+imfCert}, form:{'grant_typ... | [
"function",
"getOAuthAccessToken",
"(",
"appId",
",",
"clientId",
",",
"imfCert",
",",
"properties",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"imfServiceUrl",
"=",
"process",
".",
"env",
".",
"imfServiceUrl",
";",
"var",
... | Get the OAuth access token from IMF AZ service
@param appId
@param clientId
@param imfCert
@param properties | [
"Get",
"the",
"OAuth",
"access",
"token",
"from",
"IMF",
"AZ",
"service"
] | 6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83 | https://github.com/ibm-bluemix-mobile-services/bms-mca-oauth-sdk/blob/6a23ab1353c64ba60d8d75d0b0d3d9eaf60bed83/lib/util/token-util.js#L183-L206 |
52,145 | derdesign/protos | lib/command.js | CommandLine | function CommandLine(commands) {
this.keys = Object.keys(commands);
this.commands = commands;
this.args = process.argv.slice(2);
this.context = this.args[0] || null;
this.help = {
before: '',
after: ''
}
} | javascript | function CommandLine(commands) {
this.keys = Object.keys(commands);
this.commands = commands;
this.args = process.argv.slice(2);
this.context = this.args[0] || null;
this.help = {
before: '',
after: ''
}
} | [
"function",
"CommandLine",
"(",
"commands",
")",
"{",
"this",
".",
"keys",
"=",
"Object",
".",
"keys",
"(",
"commands",
")",
";",
"this",
".",
"commands",
"=",
"commands",
";",
"this",
".",
"args",
"=",
"process",
".",
"argv",
".",
"slice",
"(",
"2",... | Command Line class
@private
@constructor
@class CommandLine
@param {object} commands Commands object to pass | [
"Command",
"Line",
"class"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/command.js#L19-L28 |
52,146 | derdesign/protos | lib/command.js | padString | function padString(str, len) {
return str.split().concat(new Array(len-str.length)).join(' ');
} | javascript | function padString(str, len) {
return str.split().concat(new Array(len-str.length)).join(' ');
} | [
"function",
"padString",
"(",
"str",
",",
"len",
")",
"{",
"return",
"str",
".",
"split",
"(",
")",
".",
"concat",
"(",
"new",
"Array",
"(",
"len",
"-",
"str",
".",
"length",
")",
")",
".",
"join",
"(",
"' '",
")",
";",
"}"
] | Pads a string a certain amount of characters | [
"Pads",
"a",
"string",
"a",
"certain",
"amount",
"of",
"characters"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/command.js#L227-L229 |
52,147 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/data.src.js | function () {
if (this.options.switchRowsAndColumns) {
this.columns = this.rowsToColumns(this.columns);
}
// Interpret the info about series and columns
this.getColumnDistribution();
// Interpret the values into right types
this.parseTypes();
// Handle columns if a handleColumns callback is giv... | javascript | function () {
if (this.options.switchRowsAndColumns) {
this.columns = this.rowsToColumns(this.columns);
}
// Interpret the info about series and columns
this.getColumnDistribution();
// Interpret the values into right types
this.parseTypes();
// Handle columns if a handleColumns callback is giv... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"switchRowsAndColumns",
")",
"{",
"this",
".",
"columns",
"=",
"this",
".",
"rowsToColumns",
"(",
"this",
".",
"columns",
")",
";",
"}",
"// Interpret the info about series and columns",
"this"... | When the data is parsed into columns, either by CSV, table, GS or direct input,
continue with other operations. | [
"When",
"the",
"data",
"is",
"parsed",
"into",
"columns",
"either",
"by",
"CSV",
"table",
"GS",
"or",
"direct",
"input",
"continue",
"with",
"other",
"operations",
"."
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/data.src.js#L153-L172 | |
52,148 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/data.src.js | function (str, inside) {
if (typeof str === 'string') {
str = str.replace(/^\s+|\s+$/g, '');
// Clear white space insdie the string, like thousands separators
if (inside && /^[0-9\s]+$/.test(str)) {
str = str.replace(/\s/g, '');
}
if (this.decimalRegex) {
str = str.replace(this.decimalRegex,... | javascript | function (str, inside) {
if (typeof str === 'string') {
str = str.replace(/^\s+|\s+$/g, '');
// Clear white space insdie the string, like thousands separators
if (inside && /^[0-9\s]+$/.test(str)) {
str = str.replace(/\s/g, '');
}
if (this.decimalRegex) {
str = str.replace(this.decimalRegex,... | [
"function",
"(",
"str",
",",
"inside",
")",
"{",
"if",
"(",
"typeof",
"str",
"===",
"'string'",
")",
"{",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"^\\s+|\\s+$",
"/",
"g",
",",
"''",
")",
";",
"// Clear white space insdie the string, like thousands separ... | Trim a string from whitespace | [
"Trim",
"a",
"string",
"from",
"whitespace"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/data.src.js#L332-L346 | |
52,149 | gethuman/pancakes-angular | lib/ngapp/tap.track.js | doAction | function doAction() {
var now = (new Date()).getTime();
var diff = now - lastTapTime;
var isDiffElemSafeDelay = elem !== lastElemTapped && diff > 200;
var isSameElemSafeDelay = elem === lastElemTapped && diff > sameElemSafeDelay;
if (tapped && (isDiffElemSafe... | javascript | function doAction() {
var now = (new Date()).getTime();
var diff = now - lastTapTime;
var isDiffElemSafeDelay = elem !== lastElemTapped && diff > 200;
var isSameElemSafeDelay = elem === lastElemTapped && diff > sameElemSafeDelay;
if (tapped && (isDiffElemSafe... | [
"function",
"doAction",
"(",
")",
"{",
"var",
"now",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"var",
"diff",
"=",
"now",
"-",
"lastTapTime",
";",
"var",
"isDiffElemSafeDelay",
"=",
"elem",
"!==",
"lastElemTapped",
"&&",
... | Attempt to do the action as long as tap not already in progress | [
"Attempt",
"to",
"do",
"the",
"action",
"as",
"long",
"as",
"tap",
"not",
"already",
"in",
"progress"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/tap.track.js#L29-L43 |
52,150 | pratishshr/sort-o | src/sorto.js | getComparator | function getComparator(sortOrder) {
if (typeof sortOrder === 'function') {
return sortOrder;
}
const comparators = {
[ASC]: ascendingSort,
[DESC]: descendingSort,
[ASC_LENGTH]: lengthSort,
[DESC_LENGTH]: lengthReverseSort
};
return comparators[sortOrder];
} | javascript | function getComparator(sortOrder) {
if (typeof sortOrder === 'function') {
return sortOrder;
}
const comparators = {
[ASC]: ascendingSort,
[DESC]: descendingSort,
[ASC_LENGTH]: lengthSort,
[DESC_LENGTH]: lengthReverseSort
};
return comparators[sortOrder];
} | [
"function",
"getComparator",
"(",
"sortOrder",
")",
"{",
"if",
"(",
"typeof",
"sortOrder",
"===",
"'function'",
")",
"{",
"return",
"sortOrder",
";",
"}",
"const",
"comparators",
"=",
"{",
"[",
"ASC",
"]",
":",
"ascendingSort",
",",
"[",
"DESC",
"]",
":"... | Returns appropriate comparator as per the sort string.
If a function is supplied, it returns the function itself.
@param {String|Function} sortOrder
@returns {Function} | [
"Returns",
"appropriate",
"comparator",
"as",
"per",
"the",
"sort",
"string",
".",
"If",
"a",
"function",
"is",
"supplied",
"it",
"returns",
"the",
"function",
"itself",
"."
] | 5bd5d659f4ea518fd5705d5ab96e2694fb6ecfe6 | https://github.com/pratishshr/sort-o/blob/5bd5d659f4ea518fd5705d5ab96e2694fb6ecfe6/src/sorto.js#L13-L26 |
52,151 | ryanfitzer/comment-serializer | index.js | stripAndSerializeComment | function stripAndSerializeComment( lineNumber, sourceStr ) {
// Strip comment delimiter tokens
let stripped = sourceStr
.replace( patterns.commentBegin, '' )
.replace( patterns.commentEnd, '' )
.split( '\n' )
.map( line => line.replace( rCommentLinePrefix, '' ) );
... | javascript | function stripAndSerializeComment( lineNumber, sourceStr ) {
// Strip comment delimiter tokens
let stripped = sourceStr
.replace( patterns.commentBegin, '' )
.replace( patterns.commentEnd, '' )
.split( '\n' )
.map( line => line.replace( rCommentLinePrefix, '' ) );
... | [
"function",
"stripAndSerializeComment",
"(",
"lineNumber",
",",
"sourceStr",
")",
"{",
"// Strip comment delimiter tokens",
"let",
"stripped",
"=",
"sourceStr",
".",
"replace",
"(",
"patterns",
".",
"commentBegin",
",",
"''",
")",
".",
"replace",
"(",
"patterns",
... | Strip and serialize a comment into its various parts.
- comment: the comment block stripped delimiters and leading spaces.
- preface
- tags
@param {Number} lineNumber The comment's starting line number.
@param {String} sourceStr The comment's source.
@returns {Object} | [
"Strip",
"and",
"serialize",
"a",
"comment",
"into",
"its",
"various",
"parts",
"."
] | 73c2b961f54af42d357737b4f13c137269912549 | https://github.com/ryanfitzer/comment-serializer/blob/73c2b961f54af42d357737b4f13c137269912549/index.js#L81-L123 |
52,152 | ryanfitzer/comment-serializer | index.js | serializeTags | function serializeTags( lineNumber, tags ) {
return tags.split( /\n/ )
.reduce( function ( acc, line, index ) {
if ( !index || rTagName.test( line ) ) {
acc.push( `${line}\n` );
}
else {
acc[ acc.length - 1 ] += `${line}\n`;
... | javascript | function serializeTags( lineNumber, tags ) {
return tags.split( /\n/ )
.reduce( function ( acc, line, index ) {
if ( !index || rTagName.test( line ) ) {
acc.push( `${line}\n` );
}
else {
acc[ acc.length - 1 ] += `${line}\n`;
... | [
"function",
"serializeTags",
"(",
"lineNumber",
",",
"tags",
")",
"{",
"return",
"tags",
".",
"split",
"(",
"/",
"\\n",
"/",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"line",
",",
"index",
")",
"{",
"if",
"(",
"!",
"index",
"||",
"rTagN... | Takes a tags block and serializes it into individual tag objects.
@param {Number} lineNumber The tags block starting line number.
@param {String} tags The tags block.
@returns {Array} | [
"Takes",
"a",
"tags",
"block",
"and",
"serializes",
"it",
"into",
"individual",
"tag",
"objects",
"."
] | 73c2b961f54af42d357737b4f13c137269912549 | https://github.com/ryanfitzer/comment-serializer/blob/73c2b961f54af42d357737b4f13c137269912549/index.js#L132-L182 |
52,153 | iopa-io/iopa-test | src/stubServer.js | StubServer | function StubServer(app) {
_classCallCheck(this, StubServer);
this._app = app;
app.createServer = this.createServer_.bind(this, app.createServer || function () { throw new Error("no registered transport provider"); });
} | javascript | function StubServer(app) {
_classCallCheck(this, StubServer);
this._app = app;
app.createServer = this.createServer_.bind(this, app.createServer || function () { throw new Error("no registered transport provider"); });
} | [
"function",
"StubServer",
"(",
"app",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"StubServer",
")",
";",
"this",
".",
"_app",
"=",
"app",
";",
"app",
".",
"createServer",
"=",
"this",
".",
"createServer_",
".",
"bind",
"(",
"this",
",",
"app",
".",... | Representes Stub Server
@class StubServer
@param app IOPA AppBuilder App
@constructor
@public | [
"Representes",
"Stub",
"Server"
] | 1fac6ea54d4e0e83f4b1278897dfa9a4dc684543 | https://github.com/iopa-io/iopa-test/blob/1fac6ea54d4e0e83f4b1278897dfa9a4dc684543/src/stubServer.js#L37-L43 |
52,154 | Elao/validator-framework | src/validator.js | getValueAt | function getValueAt(dataObject, path)
{
if (_.isUndefined(dataObject)) {
return undefined;
}
if (!_.isString(path)) {
return dataObject;
}
var tokens = path.split('.');
var property = tokens[0];
var subpath = tokens.slice(1).join('.... | javascript | function getValueAt(dataObject, path)
{
if (_.isUndefined(dataObject)) {
return undefined;
}
if (!_.isString(path)) {
return dataObject;
}
var tokens = path.split('.');
var property = tokens[0];
var subpath = tokens.slice(1).join('.... | [
"function",
"getValueAt",
"(",
"dataObject",
",",
"path",
")",
"{",
"if",
"(",
"_",
".",
"isUndefined",
"(",
"dataObject",
")",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"path",
")",
")",
"{",
"return",
"... | Given a data object and a path, return the corresponding value
@param object data A data object
@param string path A value path with dot notation
@return mixed Return the value found at path or undefined if value doesn't exists | [
"Given",
"a",
"data",
"object",
"and",
"a",
"path",
"return",
"the",
"corresponding",
"value"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L38-L58 |
52,155 | Elao/validator-framework | src/validator.js | matchGroups | function matchGroups(groupsConfig, wantedGroups)
{
var defaultGroups = ['default'];
var groups = _.map([groupsConfig, wantedGroups], function(grp) {
if (_.isUndefined(grp)) {
return defaultGroups;
} else if (_.isString(grp)) {
return [grp];
... | javascript | function matchGroups(groupsConfig, wantedGroups)
{
var defaultGroups = ['default'];
var groups = _.map([groupsConfig, wantedGroups], function(grp) {
if (_.isUndefined(grp)) {
return defaultGroups;
} else if (_.isString(grp)) {
return [grp];
... | [
"function",
"matchGroups",
"(",
"groupsConfig",
",",
"wantedGroups",
")",
"{",
"var",
"defaultGroups",
"=",
"[",
"'default'",
"]",
";",
"var",
"groups",
"=",
"_",
".",
"map",
"(",
"[",
"groupsConfig",
",",
"wantedGroups",
"]",
",",
"function",
"(",
"grp",
... | Given 2 lists of groups, return true if the two groups lists share common groups and false otherwise
Return the default group if the group value is invalid
@param array groupsConfig The first groups list
@param array wantedGroups The second groups list
@return boolean true if groups lists match | [
"Given",
"2",
"lists",
"of",
"groups",
"return",
"true",
"if",
"the",
"two",
"groups",
"lists",
"share",
"common",
"groups",
"and",
"false",
"otherwise",
"Return",
"the",
"default",
"group",
"if",
"the",
"group",
"value",
"is",
"invalid"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L67-L88 |
52,156 | Elao/validator-framework | src/validator.js | RulesConfigurationError | function RulesConfigurationError(message, path)
{
var self = new Error();
self.path = path;
self.message = "Rules configuration error : "+message+(path ? " at path : "+path : "");
self.name = 'RulesConfigurationError';
self.__proto__ = RulesConfigurationErro... | javascript | function RulesConfigurationError(message, path)
{
var self = new Error();
self.path = path;
self.message = "Rules configuration error : "+message+(path ? " at path : "+path : "");
self.name = 'RulesConfigurationError';
self.__proto__ = RulesConfigurationErro... | [
"function",
"RulesConfigurationError",
"(",
"message",
",",
"path",
")",
"{",
"var",
"self",
"=",
"new",
"Error",
"(",
")",
";",
"self",
".",
"path",
"=",
"path",
";",
"self",
".",
"message",
"=",
"\"Rules configuration error : \"",
"+",
"message",
"+",
"(... | Error class for invalid rules definition
@param string message The error message
@param string path The path of the invalid definition | [
"Error",
"class",
"for",
"invalid",
"rules",
"definition"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L95-L103 |
52,157 | Elao/validator-framework | src/validator.js | function(path, fieldValue, errors, errorsContent)
{
var e = {};
var er = {};
if (_.isArray(errors) && errors.length > 0) {
er.errors = errors;
}
if (_.isArray(errorsContent) && errorsContent.length > 0) {
er.content = errorsContent;
}
... | javascript | function(path, fieldValue, errors, errorsContent)
{
var e = {};
var er = {};
if (_.isArray(errors) && errors.length > 0) {
er.errors = errors;
}
if (_.isArray(errorsContent) && errorsContent.length > 0) {
er.content = errorsContent;
}
... | [
"function",
"(",
"path",
",",
"fieldValue",
",",
"errors",
",",
"errorsContent",
")",
"{",
"var",
"e",
"=",
"{",
"}",
";",
"var",
"er",
"=",
"{",
"}",
";",
"if",
"(",
"_",
".",
"isArray",
"(",
"errors",
")",
"&&",
"errors",
".",
"length",
">",
... | Error class to handle validation errors on a field
@param string path The field's path
@param mixed fieldValue The field value
@param array errors An array of ValidationError
@param array errorsContent An array of ValidationError on the field children | [
"Error",
"class",
"to",
"handle",
"validation",
"errors",
"on",
"a",
"field"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L313-L334 | |
52,158 | Elao/validator-framework | src/validator.js | FieldValidator | function FieldValidator(rules, config)
{
this.rules = rules;
this.fieldLabel = undefined;
if (config) {
this.setConfig(config);
}
} | javascript | function FieldValidator(rules, config)
{
this.rules = rules;
this.fieldLabel = undefined;
if (config) {
this.setConfig(config);
}
} | [
"function",
"FieldValidator",
"(",
"rules",
",",
"config",
")",
"{",
"this",
".",
"rules",
"=",
"rules",
";",
"this",
".",
"fieldLabel",
"=",
"undefined",
";",
"if",
"(",
"config",
")",
"{",
"this",
".",
"setConfig",
"(",
"config",
")",
";",
"}",
"}"... | Object to validate rules again data field
@param array rules list of rules to apply
@param object config configuration object | [
"Object",
"to",
"validate",
"rules",
"again",
"data",
"field"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L357-L364 |
52,159 | Elao/validator-framework | src/validator.js | Validator | function Validator(type, config)
{
this.type = type;
this.message = undefined;
this.value = undefined;
this.groups = undefined;
this.fieldValidator = undefined;
this.parent = undefined;
if (typeof(config) === 'object'... | javascript | function Validator(type, config)
{
this.type = type;
this.message = undefined;
this.value = undefined;
this.groups = undefined;
this.fieldValidator = undefined;
this.parent = undefined;
if (typeof(config) === 'object'... | [
"function",
"Validator",
"(",
"type",
",",
"config",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"message",
"=",
"undefined",
";",
"this",
".",
"value",
"=",
"undefined",
";",
"this",
".",
"groups",
"=",
"undefined",
";",
"this",
".... | Validator object validate a data based on a configured rule. It raise an error or reject a promise
@param string type The validator type (must be present in the rules objects)
@param object config The validator type configuration | [
"Validator",
"object",
"validate",
"a",
"data",
"based",
"on",
"a",
"configured",
"rule",
".",
"It",
"raise",
"an",
"error",
"or",
"reject",
"a",
"promise"
] | 77a91e655d3a65f1098e868404a59ee60d2a0f95 | https://github.com/Elao/validator-framework/blob/77a91e655d3a65f1098e868404a59ee60d2a0f95/src/validator.js#L521-L544 |
52,160 | origin1tech/chek | dist/modules/to.js | toBoolean | function toBoolean(val, def) {
if (is_1.isBoolean(val))
return val;
if (!is_1.isValue(val))
return toDefault(null, def);
val = val.toString();
return (parseFloat(val) > 0 ||
is_1.isInfinite(val) ||
val === 'true' ||
val === 'yes' ||
val === '1' ||
... | javascript | function toBoolean(val, def) {
if (is_1.isBoolean(val))
return val;
if (!is_1.isValue(val))
return toDefault(null, def);
val = val.toString();
return (parseFloat(val) > 0 ||
is_1.isInfinite(val) ||
val === 'true' ||
val === 'yes' ||
val === '1' ||
... | [
"function",
"toBoolean",
"(",
"val",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isBoolean",
"(",
"val",
")",
")",
"return",
"val",
";",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"toDefault",
"(",
"null",
",",
"de... | To Boolean
Converts value if not boolean to boolean.
Will convert 'true', '1', 'yes' or '+' to true.
@param val the value to inspect.
@param def optional default value on null. | [
"To",
"Boolean",
"Converts",
"value",
"if",
"not",
"boolean",
"to",
"boolean",
".",
"Will",
"convert",
"true",
"1",
"yes",
"or",
"+",
"to",
"true",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L53-L65 |
52,161 | origin1tech/chek | dist/modules/to.js | toDate | function toDate(val, format, def) {
if (is_1.isDate(format)) {
def = format;
format = undefined;
}
var opts = format;
// Date format options a simple timezine
// ex: 'America/Los_Angeles'.
if (is_1.isString(opts)) {
opts = {
timeZone: format
};
}
... | javascript | function toDate(val, format, def) {
if (is_1.isDate(format)) {
def = format;
format = undefined;
}
var opts = format;
// Date format options a simple timezine
// ex: 'America/Los_Angeles'.
if (is_1.isString(opts)) {
opts = {
timeZone: format
};
}
... | [
"function",
"toDate",
"(",
"val",
",",
"format",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isDate",
"(",
"format",
")",
")",
"{",
"def",
"=",
"format",
";",
"format",
"=",
"undefined",
";",
"}",
"var",
"opts",
"=",
"format",
";",
"// Date form... | To Date
Converts value to date using Date.parse when string.
Optionally you can pass a format object containing
Intl.DateFormatOptions and locales. You may also pass
the timezone ONLY as a string. In this case locale en-US
is assumed.
@param val the value to be converted to date.
@param format date locale format optio... | [
"To",
"Date",
"Converts",
"value",
"to",
"date",
"using",
"Date",
".",
"parse",
"when",
"string",
".",
"Optionally",
"you",
"can",
"pass",
"a",
"format",
"object",
"containing",
"Intl",
".",
"DateFormatOptions",
"and",
"locales",
".",
"You",
"may",
"also",
... | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L79-L117 |
52,162 | origin1tech/chek | dist/modules/to.js | canParse | function canParse() {
return !/^[0-9]+$/.test(val) &&
(is_1.isString(val) && /[0-9]/g.test(val) &&
/(\.|\/|-|:)/g.test(val));
} | javascript | function canParse() {
return !/^[0-9]+$/.test(val) &&
(is_1.isString(val) && /[0-9]/g.test(val) &&
/(\.|\/|-|:)/g.test(val));
} | [
"function",
"canParse",
"(",
")",
"{",
"return",
"!",
"/",
"^[0-9]+$",
"/",
".",
"test",
"(",
"val",
")",
"&&",
"(",
"is_1",
".",
"isString",
"(",
"val",
")",
"&&",
"/",
"[0-9]",
"/",
"g",
".",
"test",
"(",
"val",
")",
"&&",
"/",
"(\\.|\\/|-|:)",... | This just checks loosely if string is date like string, below parse should catch majority of scenarios. | [
"This",
"just",
"checks",
"loosely",
"if",
"string",
"is",
"date",
"like",
"string",
"below",
"parse",
"should",
"catch",
"majority",
"of",
"scenarios",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L95-L99 |
52,163 | origin1tech/chek | dist/modules/to.js | toDefault | function toDefault(val, def) {
if (is_1.isValue(val) && !(is_1.isEmpty(val) && !is_1.isEmpty(def)))
return val;
return is_1.isValue(def) ? def : null;
} | javascript | function toDefault(val, def) {
if (is_1.isValue(val) && !(is_1.isEmpty(val) && !is_1.isEmpty(def)))
return val;
return is_1.isValue(def) ? def : null;
} | [
"function",
"toDefault",
"(",
"val",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isValue",
"(",
"val",
")",
"&&",
"!",
"(",
"is_1",
".",
"isEmpty",
"(",
"val",
")",
"&&",
"!",
"is_1",
".",
"isEmpty",
"(",
"def",
")",
")",
")",
"return",
"val... | To Default
Returns a default value when provided if
primary value is null or undefined. If neither
then null is returned.
@param val the value to return if defined.
@param def an optional default value to be returned. | [
"To",
"Default",
"Returns",
"a",
"default",
"value",
"when",
"provided",
"if",
"primary",
"value",
"is",
"null",
"or",
"undefined",
".",
"If",
"neither",
"then",
"null",
"is",
"returned",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L128-L132 |
52,164 | origin1tech/chek | dist/modules/to.js | toEpoch | function toEpoch(val, def) {
return toDefault((is_1.isDate(val) && val.getTime()), def);
} | javascript | function toEpoch(val, def) {
return toDefault((is_1.isDate(val) && val.getTime()), def);
} | [
"function",
"toEpoch",
"(",
"val",
",",
"def",
")",
"{",
"return",
"toDefault",
"(",
"(",
"is_1",
".",
"isDate",
"(",
"val",
")",
"&&",
"val",
".",
"getTime",
"(",
")",
")",
",",
"def",
")",
";",
"}"
] | To Epoch
Converts a Date type to an epoch.
@param val the date value to convert.
@param def optional default value when null. | [
"To",
"Epoch",
"Converts",
"a",
"Date",
"type",
"to",
"an",
"epoch",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L141-L143 |
52,165 | origin1tech/chek | dist/modules/to.js | toFloat | function toFloat(val, def) {
if (is_1.isFloat(val))
return val;
if (!is_1.isValue(val))
return toDefault(null, def);
var parsed = function_1.tryWrap(parseFloat, val)(def);
if (is_1.isFloat(parsed) || is_1.isNumber(parsed))
return parsed;
if (toBoolean(val))
return 1;
... | javascript | function toFloat(val, def) {
if (is_1.isFloat(val))
return val;
if (!is_1.isValue(val))
return toDefault(null, def);
var parsed = function_1.tryWrap(parseFloat, val)(def);
if (is_1.isFloat(parsed) || is_1.isNumber(parsed))
return parsed;
if (toBoolean(val))
return 1;
... | [
"function",
"toFloat",
"(",
"val",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isFloat",
"(",
"val",
")",
")",
"return",
"val",
";",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"toDefault",
"(",
"null",
",",
"def",
... | To Float
Converts value to a float.
@param val the value to convert to float. | [
"To",
"Float",
"Converts",
"value",
"to",
"a",
"float",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L151-L162 |
52,166 | origin1tech/chek | dist/modules/to.js | toJSON | function toJSON(obj, pretty, def) {
if (is_1.isString(pretty)) {
def = pretty;
pretty = undefined;
}
var tabs = 0;
pretty = is_1.isBoolean(pretty) ? 2 : pretty;
tabs = pretty ? pretty : tabs;
if (!is_1.isObject(obj))
return toDefault(null, def);
return function_1.tryW... | javascript | function toJSON(obj, pretty, def) {
if (is_1.isString(pretty)) {
def = pretty;
pretty = undefined;
}
var tabs = 0;
pretty = is_1.isBoolean(pretty) ? 2 : pretty;
tabs = pretty ? pretty : tabs;
if (!is_1.isObject(obj))
return toDefault(null, def);
return function_1.tryW... | [
"function",
"toJSON",
"(",
"obj",
",",
"pretty",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isString",
"(",
"pretty",
")",
")",
"{",
"def",
"=",
"pretty",
";",
"pretty",
"=",
"undefined",
";",
"}",
"var",
"tabs",
"=",
"0",
";",
"pretty",
"=",... | To JSON
Simple wrapper to strinigy using JSON.
@param obj the object to be stringified.
@param pretty an integer or true for tabs in JSON.
@param def optional default value on null. | [
"To",
"JSON",
"Simple",
"wrapper",
"to",
"strinigy",
"using",
"JSON",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L172-L183 |
52,167 | origin1tech/chek | dist/modules/to.js | toInteger | function toInteger(val, def) {
if (!is_1.isValue(val))
return toDefault(null, def);
var parsed = function_1.tryWrap(parseInt, val)(def);
if (is_1.isInteger(parsed))
return parsed;
if (toBoolean(val))
return 1;
return 0;
} | javascript | function toInteger(val, def) {
if (!is_1.isValue(val))
return toDefault(null, def);
var parsed = function_1.tryWrap(parseInt, val)(def);
if (is_1.isInteger(parsed))
return parsed;
if (toBoolean(val))
return 1;
return 0;
} | [
"function",
"toInteger",
"(",
"val",
",",
"def",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isValue",
"(",
"val",
")",
")",
"return",
"toDefault",
"(",
"null",
",",
"def",
")",
";",
"var",
"parsed",
"=",
"function_1",
".",
"tryWrap",
"(",
"parseInt",
... | To Integer
Convert value to integer.
@param val the value to convert to integer.
@param def optional default value on null or error. | [
"To",
"Integer",
"Convert",
"value",
"to",
"integer",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L192-L201 |
52,168 | origin1tech/chek | dist/modules/to.js | toMap | function toMap(val, id, def) {
if (is_1.isValue(id) && !is_1.isString(id)) {
def = id;
id = undefined;
}
if (is_1.isPlainObject(val))
return val;
if (!is_1.isValue(val) || (!is_1.isString(val) && !is_1.isArray(val)))
return toDefault(null, def);
// Default id key.
... | javascript | function toMap(val, id, def) {
if (is_1.isValue(id) && !is_1.isString(id)) {
def = id;
id = undefined;
}
if (is_1.isPlainObject(val))
return val;
if (!is_1.isValue(val) || (!is_1.isString(val) && !is_1.isArray(val)))
return toDefault(null, def);
// Default id key.
... | [
"function",
"toMap",
"(",
"val",
",",
"id",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isValue",
"(",
"id",
")",
"&&",
"!",
"is_1",
".",
"isString",
"(",
"id",
")",
")",
"{",
"def",
"=",
"id",
";",
"id",
"=",
"undefined",
";",
"}",
"if",
... | To Map
Converts arrays, strings, to an object literal.
@example
Array: ['one', 'two', 'three'] Maps To: { 0: 'one', 1: 'two', 2: 'three' }
String: 'Star Wars' Maps To: { 0: 'Star Wars' }
String: 'Star Wars, Star Trek' Maps To { 0: 'Star Wars', 1: 'Star Trek' }
Array: [{ id: '123', name: 'Joe' }] Maps To: { 123: { name... | [
"To",
"Map",
"Converts",
"arrays",
"strings",
"to",
"an",
"object",
"literal",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L221-L256 |
52,169 | origin1tech/chek | dist/modules/to.js | toNested | function toNested(val, def) {
function nest(src) {
var dest = {};
for (var p in src) {
if (src.hasOwnProperty(p))
if (/\./g.test(p))
object_1.set(dest, p, src[p]);
else
dest[p] = src[p];
}
return dest... | javascript | function toNested(val, def) {
function nest(src) {
var dest = {};
for (var p in src) {
if (src.hasOwnProperty(p))
if (/\./g.test(p))
object_1.set(dest, p, src[p]);
else
dest[p] = src[p];
}
return dest... | [
"function",
"toNested",
"(",
"val",
",",
"def",
")",
"{",
"function",
"nest",
"(",
"src",
")",
"{",
"var",
"dest",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"p",
"in",
"src",
")",
"{",
"if",
"(",
"src",
".",
"hasOwnProperty",
"(",
"p",
")",
")",
... | To Nested
Takes an object that was flattened by toUnnested
and re-nests it.
@param val the flattened object to be nested. | [
"To",
"Nested",
"Takes",
"an",
"object",
"that",
"was",
"flattened",
"by",
"toUnnested",
"and",
"re",
"-",
"nests",
"it",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L265-L278 |
52,170 | origin1tech/chek | dist/modules/to.js | toRegExp | function toRegExp(val, def) {
var exp = /^\/.+\/(g|i|m)?([m,i,u,y]{1,4})?/;
var optsExp = /(g|i|m)?([m,i,u,y]{1,4})?$/;
if (is_1.isRegExp(val))
return val;
if (!is_1.isValue(val) || !is_1.isString(val))
return toDefault(null, def);
function regExpFromStr() {
var opts;
... | javascript | function toRegExp(val, def) {
var exp = /^\/.+\/(g|i|m)?([m,i,u,y]{1,4})?/;
var optsExp = /(g|i|m)?([m,i,u,y]{1,4})?$/;
if (is_1.isRegExp(val))
return val;
if (!is_1.isValue(val) || !is_1.isString(val))
return toDefault(null, def);
function regExpFromStr() {
var opts;
... | [
"function",
"toRegExp",
"(",
"val",
",",
"def",
")",
"{",
"var",
"exp",
"=",
"/",
"^\\/.+\\/(g|i|m)?([m,i,u,y]{1,4})?",
"/",
";",
"var",
"optsExp",
"=",
"/",
"(g|i|m)?([m,i,u,y]{1,4})?$",
"/",
";",
"if",
"(",
"is_1",
".",
"isRegExp",
"(",
"val",
")",
")",
... | To Regular Expression
Attempts to convert to a regular expression
from a string.
@param val the value to convert to RegExp.
@param def optional express as default on null. | [
"To",
"Regular",
"Expression",
"Attempts",
"to",
"convert",
"to",
"a",
"regular",
"expression",
"from",
"a",
"string",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L299-L315 |
52,171 | origin1tech/chek | dist/modules/to.js | toUnnested | function toUnnested(obj, prefix, def) {
if (is_1.isValue(prefix) && !is_1.isBoolean(prefix)) {
def = prefix;
prefix = undefined;
}
var dupes = 0;
function unnest(src, dest, pre) {
dest = dest || {};
for (var p in src) {
if (dupes > 0)
return;
... | javascript | function toUnnested(obj, prefix, def) {
if (is_1.isValue(prefix) && !is_1.isBoolean(prefix)) {
def = prefix;
prefix = undefined;
}
var dupes = 0;
function unnest(src, dest, pre) {
dest = dest || {};
for (var p in src) {
if (dupes > 0)
return;
... | [
"function",
"toUnnested",
"(",
"obj",
",",
"prefix",
",",
"def",
")",
"{",
"if",
"(",
"is_1",
".",
"isValue",
"(",
"prefix",
")",
"&&",
"!",
"is_1",
".",
"isBoolean",
"(",
"prefix",
")",
")",
"{",
"def",
"=",
"prefix",
";",
"prefix",
"=",
"undefine... | To Unnested
Takes a nested object and flattens it
to a single level safely. To disable key
prefixing set prefix to false.
@param val the object to be unnested.
@param prefix when NOT false parent key is prefixed to children.
@param def optional default value on null. | [
"To",
"Unnested",
"Takes",
"a",
"nested",
"object",
"and",
"flattens",
"it",
"to",
"a",
"single",
"level",
"safely",
".",
"To",
"disable",
"key",
"prefixing",
"set",
"prefix",
"to",
"false",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L345-L379 |
52,172 | origin1tech/chek | dist/modules/to.js | toWindow | function toWindow(key, val, exclude) {
/* istanbul ignore if */
if (!is_1.isBrowser())
return;
exclude = toArray(exclude);
var _keys, i;
// key/val was passed.
if (is_1.isString(key)) {
if (!is_1.isPlainObject(val)) {
window[key] = val;
}
else {
... | javascript | function toWindow(key, val, exclude) {
/* istanbul ignore if */
if (!is_1.isBrowser())
return;
exclude = toArray(exclude);
var _keys, i;
// key/val was passed.
if (is_1.isString(key)) {
if (!is_1.isPlainObject(val)) {
window[key] = val;
}
else {
... | [
"function",
"toWindow",
"(",
"key",
",",
"val",
",",
"exclude",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"!",
"is_1",
".",
"isBrowser",
"(",
")",
")",
"return",
";",
"exclude",
"=",
"toArray",
"(",
"exclude",
")",
";",
"var",
"_keys",
",",
"i",... | To Window
Adds key to window object if is browser.
@param key the key or object to add to the window object.
@param val the corresponding value to add to window object.
@param exclude string or array of keys to exclude. | [
"To",
"Window",
"Adds",
"key",
"to",
"window",
"object",
"if",
"is",
"browser",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/to.js#L389-L420 |
52,173 | chrisui/Constructr | src/constructr.js | function(child, parent, protoProps, staticProps) {
// Inherit prototype properties from parent
// Set the prototype chain to inherit without calling parent's constructor function.
SharedConstructor.prototype = parent.prototype;
child.prototype = new SharedConstructor();
child.prototype.constructor =... | javascript | function(child, parent, protoProps, staticProps) {
// Inherit prototype properties from parent
// Set the prototype chain to inherit without calling parent's constructor function.
SharedConstructor.prototype = parent.prototype;
child.prototype = new SharedConstructor();
child.prototype.constructor =... | [
"function",
"(",
"child",
",",
"parent",
",",
"protoProps",
",",
"staticProps",
")",
"{",
"// Inherit prototype properties from parent",
"// Set the prototype chain to inherit without calling parent's constructor function.",
"SharedConstructor",
".",
"prototype",
"=",
"parent",
"... | Correctly setup the prototype chain for sub classes while optionally passing
new prototype and static properties to be mixed in with the new child
@return {Constructr} | [
"Correctly",
"setup",
"the",
"prototype",
"chain",
"for",
"sub",
"classes",
"while",
"optionally",
"passing",
"new",
"prototype",
"and",
"static",
"properties",
"to",
"be",
"mixed",
"in",
"with",
"the",
"new",
"child"
] | e970a612acd28ca8e33a755e595823996a5ccd75 | https://github.com/chrisui/Constructr/blob/e970a612acd28ca8e33a755e595823996a5ccd75/src/constructr.js#L49-L70 | |
52,174 | linyngfly/omelo-admin | lib/monitor/monitorAgent.js | function(opts) {
EventEmitter.call(this);
this.reqId = 1;
this.opts = opts;
this.id = opts.id;
this.socket = null;
this.callbacks = {};
this.type = opts.type;
this.info = opts.info;
this.state = ST_INITED;
this.consoleService = opts.consoleService;
} | javascript | function(opts) {
EventEmitter.call(this);
this.reqId = 1;
this.opts = opts;
this.id = opts.id;
this.socket = null;
this.callbacks = {};
this.type = opts.type;
this.info = opts.info;
this.state = ST_INITED;
this.consoleService = opts.consoleService;
} | [
"function",
"(",
"opts",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"reqId",
"=",
"1",
";",
"this",
".",
"opts",
"=",
"opts",
";",
"this",
".",
"id",
"=",
"opts",
".",
"id",
";",
"this",
".",
"socket",
"=",
"null... | 60 seconds
MonitorAgent Constructor
@class MasterAgent
@constructor
@param {Object} opts construct parameter
opts.consoleService {Object} consoleService
opts.id {String} server id
opts.type {String} server type, 'master', 'connector', etc.
opts.info {Object} more server info for curren... | [
"60",
"seconds",
"MonitorAgent",
"Constructor"
] | 1cd692c16ab63b9c0d4009535f300f2ca584b691 | https://github.com/linyngfly/omelo-admin/blob/1cd692c16ab63b9c0d4009535f300f2ca584b691/lib/monitor/monitorAgent.js#L26-L37 | |
52,175 | savushkin-yauheni/our-connect | lib/proto.js | call | function call(handle, route, err, req, res, next) {
var arity = handle.length;
var hasError = Boolean(err);
debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
try {
if (hasError && arity === 4) {
// error-handling middleware
handle(err, req, res, next);
return;
... | javascript | function call(handle, route, err, req, res, next) {
var arity = handle.length;
var hasError = Boolean(err);
debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
try {
if (hasError && arity === 4) {
// error-handling middleware
handle(err, req, res, next);
return;
... | [
"function",
"call",
"(",
"handle",
",",
"route",
",",
"err",
",",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"arity",
"=",
"handle",
".",
"length",
";",
"var",
"hasError",
"=",
"Boolean",
"(",
"err",
")",
";",
"debug",
"(",
"'%s %s : %s'",
",... | Invoke a route handle.
@api private | [
"Invoke",
"a",
"route",
"handle",
"."
] | aa327a2a87a788535b1e5f6be5503a4419d3aabf | https://github.com/savushkin-yauheni/our-connect/blob/aa327a2a87a788535b1e5f6be5503a4419d3aabf/lib/proto.js#L192-L215 |
52,176 | Becklyn/becklyn-gulp | tasks/jshint.js | lintAllFiles | function lintAllFiles (src, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
jsHintHelper.lintFile(files[i], options.rules);
}
}
);
} | javascript | function lintAllFiles (src, options)
{
glob(src,
function (err, files)
{
if (err) throw err;
for (var i = 0, l = files.length; i < l; i++)
{
jsHintHelper.lintFile(files[i], options.rules);
}
}
);
} | [
"function",
"lintAllFiles",
"(",
"src",
",",
"options",
")",
"{",
"glob",
"(",
"src",
",",
"function",
"(",
"err",
",",
"files",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"files",
"."... | Lints all files in a given glob
@param {string} src
@param {JsHintTaskOptions} options | [
"Lints",
"all",
"files",
"in",
"a",
"given",
"glob"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/jshint.js#L25-L38 |
52,177 | jkresner/meanair-server | lib/configure.merge.js | mergeRecursive | function mergeRecursive(key, defaults, app) {
key = key ? key.toUpperCase() : null
if (app === undefined || app == undefine || process.env[key] == undefine)
return undefine
var config = defaults
var atOverrideVal = app === null ? false : atLeaf(app)
var atDefaultVal = defaults === null || atLeaf(defau... | javascript | function mergeRecursive(key, defaults, app) {
key = key ? key.toUpperCase() : null
if (app === undefined || app == undefine || process.env[key] == undefine)
return undefine
var config = defaults
var atOverrideVal = app === null ? false : atLeaf(app)
var atDefaultVal = defaults === null || atLeaf(defau... | [
"function",
"mergeRecursive",
"(",
"key",
",",
"defaults",
",",
"app",
")",
"{",
"key",
"=",
"key",
"?",
"key",
".",
"toUpperCase",
"(",
")",
":",
"null",
"if",
"(",
"app",
"===",
"undefined",
"||",
"app",
"==",
"undefine",
"||",
"process",
".",
"env... | recusiveMerge(
Recursively traverse and merge
String @key to check for environment values to apply
Object @defaults (meanair default base config : configure.defaults.js)
Object @app (application specific sections / exclusions
@return tree (or leaf) of instance of config combining defaults,
app and environm... | [
"recusiveMerge",
"(",
"Recursively",
"traverse",
"and",
"merge"
] | 54acca001b1e185c93992cb64c88478b0289a6e5 | https://github.com/jkresner/meanair-server/blob/54acca001b1e185c93992cb64c88478b0289a6e5/lib/configure.merge.js#L17-L60 |
52,178 | yanatan16/multipart-pipe | index.js | s3streamer | function s3streamer(s3, opts) {
var headers = (opts || {}).headers || { }
return function (file, filename, mimetype, encoding, callback) {
headers['Content-Type'] = mimetype
var buf = Buffer(0)
file.on('data', function (chunk) {
buf = Buffer.concat([buf, chunk])
})
file.on('end', function... | javascript | function s3streamer(s3, opts) {
var headers = (opts || {}).headers || { }
return function (file, filename, mimetype, encoding, callback) {
headers['Content-Type'] = mimetype
var buf = Buffer(0)
file.on('data', function (chunk) {
buf = Buffer.concat([buf, chunk])
})
file.on('end', function... | [
"function",
"s3streamer",
"(",
"s3",
",",
"opts",
")",
"{",
"var",
"headers",
"=",
"(",
"opts",
"||",
"{",
"}",
")",
".",
"headers",
"||",
"{",
"}",
"return",
"function",
"(",
"file",
",",
"filename",
",",
"mimetype",
",",
"encoding",
",",
"callback"... | An s3 streamer | [
"An",
"s3",
"streamer"
] | 676363d98dc04e898206175daa028253ec2f4cb9 | https://github.com/yanatan16/multipart-pipe/blob/676363d98dc04e898206175daa028253ec2f4cb9/index.js#L86-L107 |
52,179 | pattern-library/pattern-library-utilities | lib/gulp-tasks/patterns-import.js | function () {
'use strict';
// default options for angularTemplatecache gulp task
var options = {
config: {
compilePatternsOnImport: false,
dataSource: 'pattern',
dataFileName: 'pattern.yml',
htmlTemplateDest: './source/_patterns',
stylesDest: './source/css/scss',
scriptsD... | javascript | function () {
'use strict';
// default options for angularTemplatecache gulp task
var options = {
config: {
compilePatternsOnImport: false,
dataSource: 'pattern',
dataFileName: 'pattern.yml',
htmlTemplateDest: './source/_patterns',
stylesDest: './source/css/scss',
scriptsD... | [
"function",
"(",
")",
"{",
"'use strict'",
";",
"// default options for angularTemplatecache gulp task",
"var",
"options",
"=",
"{",
"config",
":",
"{",
"compilePatternsOnImport",
":",
"false",
",",
"dataSource",
":",
"'pattern'",
",",
"dataFileName",
":",
"'pattern.y... | Function to get default options for an implementation of patternlab-import
@return {Object} options an object of default patternlab-import options | [
"Function",
"to",
"get",
"default",
"options",
"for",
"an",
"implementation",
"of",
"patternlab",
"-",
"import"
] | a0198f7bb698eb5b859576b11afa3d0ebd3e5911 | https://github.com/pattern-library/pattern-library-utilities/blob/a0198f7bb698eb5b859576b11afa3d0ebd3e5911/lib/gulp-tasks/patterns-import.js#L15-L44 | |
52,180 | sendanor/nor-db | lib/mysql/Pool.js | Pool | function Pool(config) {
if(!(this instanceof Pool)) {
return new Pool(config);
}
var self = this;
if(!config) { throw new TypeError("config not set"); }
self._pool = require('mysql').createPool(config);
self._get_connection = Q.nfbind(self._pool.getConnection.bind(self._pool));
db.Pool.call(this);
} | javascript | function Pool(config) {
if(!(this instanceof Pool)) {
return new Pool(config);
}
var self = this;
if(!config) { throw new TypeError("config not set"); }
self._pool = require('mysql').createPool(config);
self._get_connection = Q.nfbind(self._pool.getConnection.bind(self._pool));
db.Pool.call(this);
} | [
"function",
"Pool",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Pool",
")",
")",
"{",
"return",
"new",
"Pool",
"(",
"config",
")",
";",
"}",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"config",
")",
"{",
"throw",
... | Create MySQL connection pool object | [
"Create",
"MySQL",
"connection",
"pool",
"object"
] | db4b78691956a49370fc9d9a4eed27e7d3720aeb | https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/lib/mysql/Pool.js#L11-L20 |
52,181 | Psychopoulet/node-promfs | lib/extends/_filesToString.js | _filesToString | function _filesToString (files, encoding, separator, callback) {
if ("undefined" === typeof files) {
throw new ReferenceError("missing \"files\" argument");
}
else if ("object" !== typeof files || !(files instanceof Array)) {
throw new TypeError("\"files\" argument is not an Array");
}
else i... | javascript | function _filesToString (files, encoding, separator, callback) {
if ("undefined" === typeof files) {
throw new ReferenceError("missing \"files\" argument");
}
else if ("object" !== typeof files || !(files instanceof Array)) {
throw new TypeError("\"files\" argument is not an Array");
}
else i... | [
"function",
"_filesToString",
"(",
"files",
",",
"encoding",
",",
"separator",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"files",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"files\\\" argument\"",
")",
";",
"}",
... | methods
Async filesToString
@param {Array} files : files to read
@param {string} encoding : encoding
@param {string} separator : files separator
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"filesToString"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_filesToString.js#L25-L84 |
52,182 | fnogatz/tconsole | lib/insert.js | insert | function insert (table, object, fields) {
var input = this
if (input instanceof Array) {
insertArray.call(input, table, object, fields)
} else {
insertObject.call(input, table, object, fields)
}
} | javascript | function insert (table, object, fields) {
var input = this
if (input instanceof Array) {
insertArray.call(input, table, object, fields)
} else {
insertObject.call(input, table, object, fields)
}
} | [
"function",
"insert",
"(",
"table",
",",
"object",
",",
"fields",
")",
"{",
"var",
"input",
"=",
"this",
"if",
"(",
"input",
"instanceof",
"Array",
")",
"{",
"insertArray",
".",
"call",
"(",
"input",
",",
"table",
",",
"object",
",",
"fields",
")",
"... | Default renderer.insert function, `this` bound to the input.
@param {Table} table cli-table
@param {Object} object renderer object
@param {Array} fields fields to show | [
"Default",
"renderer",
".",
"insert",
"function",
"this",
"bound",
"to",
"the",
"input",
"."
] | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/insert.js#L11-L19 |
52,183 | fnogatz/tconsole | lib/insert.js | insertArray | function insertArray (table, object, fields) {
var input = this
input.forEach(function addRow (entry, rowNo) {
var tableRow = fields.map(function cell (fieldName) {
return getCellContent.call(entry, object.fields[fieldName], rowNo)
})
table.push(tableRow)
})
} | javascript | function insertArray (table, object, fields) {
var input = this
input.forEach(function addRow (entry, rowNo) {
var tableRow = fields.map(function cell (fieldName) {
return getCellContent.call(entry, object.fields[fieldName], rowNo)
})
table.push(tableRow)
})
} | [
"function",
"insertArray",
"(",
"table",
",",
"object",
",",
"fields",
")",
"{",
"var",
"input",
"=",
"this",
"input",
".",
"forEach",
"(",
"function",
"addRow",
"(",
"entry",
",",
"rowNo",
")",
"{",
"var",
"tableRow",
"=",
"fields",
".",
"map",
"(",
... | renderer.insert function for rendering arrays,
`this` bound to the input.
@param {Table} table cli-table
@param {Object} object renderer object
@param {Array} fields fields to show | [
"renderer",
".",
"insert",
"function",
"for",
"rendering",
"arrays",
"this",
"bound",
"to",
"the",
"input",
"."
] | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/insert.js#L28-L37 |
52,184 | fnogatz/tconsole | lib/insert.js | insertObject | function insertObject (table, object, fields) {
var input = this
fields.forEach(function addField (field) {
var cells = {}
cells[field] = getCellContent.call(input, object.fields[field])
table.push(cells)
})
} | javascript | function insertObject (table, object, fields) {
var input = this
fields.forEach(function addField (field) {
var cells = {}
cells[field] = getCellContent.call(input, object.fields[field])
table.push(cells)
})
} | [
"function",
"insertObject",
"(",
"table",
",",
"object",
",",
"fields",
")",
"{",
"var",
"input",
"=",
"this",
"fields",
".",
"forEach",
"(",
"function",
"addField",
"(",
"field",
")",
"{",
"var",
"cells",
"=",
"{",
"}",
"cells",
"[",
"field",
"]",
"... | renderer.insert function for rendering objects,
`this` bound to the input.
@param {Table} table cli-table
@param {Object} object renderer object
@param {Array} fields fields to show | [
"renderer",
".",
"insert",
"function",
"for",
"rendering",
"objects",
"this",
"bound",
"to",
"the",
"input",
"."
] | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/insert.js#L46-L54 |
52,185 | fnogatz/tconsole | lib/insert.js | getCellContent | function getCellContent (field) {
var entry = this
var args = Array.prototype.slice.call(arguments, 1)
if (typeof field === 'string') {
return field
}
if (typeof field === 'function') {
var value
try {
value = field.apply(entry, args)
} catch (e) {
value = '(err)'
}
if (va... | javascript | function getCellContent (field) {
var entry = this
var args = Array.prototype.slice.call(arguments, 1)
if (typeof field === 'string') {
return field
}
if (typeof field === 'function') {
var value
try {
value = field.apply(entry, args)
} catch (e) {
value = '(err)'
}
if (va... | [
"function",
"getCellContent",
"(",
"field",
")",
"{",
"var",
"entry",
"=",
"this",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
"if",
"(",
"typeof",
"field",
"===",
"'string'",
")",
"{",
"... | Get the content of a cell. `field` is the function or string
to use. `this` should be bound to the actual entry.
Additional parameters are forwarded to the function `field`.
@param {Function|String} field
@return {String} | [
"Get",
"the",
"content",
"of",
"a",
"cell",
".",
"field",
"is",
"the",
"function",
"or",
"string",
"to",
"use",
".",
"this",
"should",
"be",
"bound",
"to",
"the",
"actual",
"entry",
".",
"Additional",
"parameters",
"are",
"forwarded",
"to",
"the",
"funct... | debcdaf916f7e8f43b35c4c907b585f5c1c69f0f | https://github.com/fnogatz/tconsole/blob/debcdaf916f7e8f43b35c4c907b585f5c1c69f0f/lib/insert.js#L63-L84 |
52,186 | wrote/read | build/index.js | readBuffer | async function readBuffer(path) {
const rs = createReadStream(path)
/** @type {Buffer} */
const res = await collect(rs, { binary: true })
return res
} | javascript | async function readBuffer(path) {
const rs = createReadStream(path)
/** @type {Buffer} */
const res = await collect(rs, { binary: true })
return res
} | [
"async",
"function",
"readBuffer",
"(",
"path",
")",
"{",
"const",
"rs",
"=",
"createReadStream",
"(",
"path",
")",
"/** @type {Buffer} */",
"const",
"res",
"=",
"await",
"collect",
"(",
"rs",
",",
"{",
"binary",
":",
"true",
"}",
")",
"return",
"res",
"... | Read a file as a buffer.
@param {string} path The path to the file to read. | [
"Read",
"a",
"file",
"as",
"a",
"buffer",
"."
] | 503ae9ab03e9654fea77276a076562afff3aeb24 | https://github.com/wrote/read/blob/503ae9ab03e9654fea77276a076562afff3aeb24/build/index.js#L19-L24 |
52,187 | rkamradt/meta-app-mem | index.js | function(data, done) {
this._data.push(this._clone(data));
var ret = this._data.length;
done(null, ret);
} | javascript | function(data, done) {
this._data.push(this._clone(data));
var ret = this._data.length;
done(null, ret);
} | [
"function",
"(",
"data",
",",
"done",
")",
"{",
"this",
".",
"_data",
".",
"push",
"(",
"this",
".",
"_clone",
"(",
"data",
")",
")",
";",
"var",
"ret",
"=",
"this",
".",
"_data",
".",
"length",
";",
"done",
"(",
"null",
",",
"ret",
")",
";",
... | add an item to the store
@param {Object} data The item to store
@param {Function} done The callback when done | [
"add",
"an",
"item",
"to",
"the",
"store"
] | 9602b1eb44fad27cec9a05bcbd652dcf3202dbc7 | https://github.com/rkamradt/meta-app-mem/blob/9602b1eb44fad27cec9a05bcbd652dcf3202dbc7/index.js#L41-L45 | |
52,188 | rkamradt/meta-app-mem | index.js | function(data, done) {
if(!this._key) {
done('no key found for metadata');
return;
}
var key = data[this._key.getName()];
var ix = -1;
for(var i = 0; i < this._data.length; i++) {
if(this._data[i][this._key.getName()] === key) {
ix = i;
break;
... | javascript | function(data, done) {
if(!this._key) {
done('no key found for metadata');
return;
}
var key = data[this._key.getName()];
var ix = -1;
for(var i = 0; i < this._data.length; i++) {
if(this._data[i][this._key.getName()] === key) {
ix = i;
break;
... | [
"function",
"(",
"data",
",",
"done",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_key",
")",
"{",
"done",
"(",
"'no key found for metadata'",
")",
";",
"return",
";",
"}",
"var",
"key",
"=",
"data",
"[",
"this",
".",
"_key",
".",
"getName",
"(",
")",
... | update an item in the store
@param {Object} data The item to update
@param {Function} done The callback when done | [
"update",
"an",
"item",
"in",
"the",
"store"
] | 9602b1eb44fad27cec9a05bcbd652dcf3202dbc7 | https://github.com/rkamradt/meta-app-mem/blob/9602b1eb44fad27cec9a05bcbd652dcf3202dbc7/index.js#L51-L70 | |
52,189 | rkamradt/meta-app-mem | index.js | function(key, done) {
if(!this._key) {
done('no key found for metadata');
return;
}
var ret = null; // if not found return null
for(var i = 0; i < this._data.length; i++) {
if(this._data[i][this._key.getName()] === key) {
ret = this._clone(this._data[i]);
... | javascript | function(key, done) {
if(!this._key) {
done('no key found for metadata');
return;
}
var ret = null; // if not found return null
for(var i = 0; i < this._data.length; i++) {
if(this._data[i][this._key.getName()] === key) {
ret = this._clone(this._data[i]);
... | [
"function",
"(",
"key",
",",
"done",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_key",
")",
"{",
"done",
"(",
"'no key found for metadata'",
")",
";",
"return",
";",
"}",
"var",
"ret",
"=",
"null",
";",
"// if not found return null",
"for",
"(",
"var",
"i... | return an item by id
@param {String} key The key value
@param {Function} done The callback when done | [
"return",
"an",
"item",
"by",
"id"
] | 9602b1eb44fad27cec9a05bcbd652dcf3202dbc7 | https://github.com/rkamradt/meta-app-mem/blob/9602b1eb44fad27cec9a05bcbd652dcf3202dbc7/index.js#L87-L100 | |
52,190 | gethuman/pancakes-recipe | batch/db.purge/db.purge.batch.js | purgeResource | function purgeResource(resource, archive) {
if (!resource.purge) { return true; }
var criteria = resource.purge();
var deferred = Q.defer();
archive.bind(resource.name);
archive[resource.name].remove(criteria, function (err, results) {
err ? deferred.reject(err) : d... | javascript | function purgeResource(resource, archive) {
if (!resource.purge) { return true; }
var criteria = resource.purge();
var deferred = Q.defer();
archive.bind(resource.name);
archive[resource.name].remove(criteria, function (err, results) {
err ? deferred.reject(err) : d... | [
"function",
"purgeResource",
"(",
"resource",
",",
"archive",
")",
"{",
"if",
"(",
"!",
"resource",
".",
"purge",
")",
"{",
"return",
"true",
";",
"}",
"var",
"criteria",
"=",
"resource",
".",
"purge",
"(",
")",
";",
"var",
"deferred",
"=",
"Q",
".",... | Purge one particular resource
@param resource
@param archive | [
"Purge",
"one",
"particular",
"resource"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/batch/db.purge/db.purge.batch.js#L43-L54 |
52,191 | billinghamj/resilient-mailer-mandrill | lib/mandrill-provider.js | MandrillProvider | function MandrillProvider(apiKey, options) {
if (typeof apiKey !== 'string') {
throw new Error('Invalid parameters');
}
options = options || {};
if (typeof options.async === 'undefined')
options.async = false;
if (typeof options.apiSecure === 'undefined')
options.apiSecure = true;
options.apiHostname = ... | javascript | function MandrillProvider(apiKey, options) {
if (typeof apiKey !== 'string') {
throw new Error('Invalid parameters');
}
options = options || {};
if (typeof options.async === 'undefined')
options.async = false;
if (typeof options.apiSecure === 'undefined')
options.apiSecure = true;
options.apiHostname = ... | [
"function",
"MandrillProvider",
"(",
"apiKey",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"apiKey",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Invalid parameters'",
")",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if"... | Creates an instance of the Mandrill email provider.
@constructor
@this {MandrillProvider}
@param {string} apiKey API Key for the Mandrill account.
@param {object} [options] Additional optional configuration.
@param {string} [options.async=false] See 'async' field: {@link https://mandrillapp.com/api/docs/messages.html#... | [
"Creates",
"an",
"instance",
"of",
"the",
"Mandrill",
"email",
"provider",
"."
] | 630e82a8c39d36361c42bde463a40afea993bfb9 | https://github.com/billinghamj/resilient-mailer-mandrill/blob/630e82a8c39d36361c42bde463a40afea993bfb9/lib/mandrill-provider.js#L19-L37 |
52,192 | MarkNijhof/client.express.js | src/client.express.ondomready.js | function (event){
//IE compatibility
event = event || window.event;
//Mozilla, Opera, & Legacy
if(event && event.type && (/DOMContentLoaded|load/).test(event.type)) {
fireDOMReady();
//Legacy
} else if(document.readyState) {
if ((/loaded|complete/).test(doc.readyState)) {
fireDOMReady();
//IE,... | javascript | function (event){
//IE compatibility
event = event || window.event;
//Mozilla, Opera, & Legacy
if(event && event.type && (/DOMContentLoaded|load/).test(event.type)) {
fireDOMReady();
//Legacy
} else if(document.readyState) {
if ((/loaded|complete/).test(doc.readyState)) {
fireDOMReady();
//IE,... | [
"function",
"(",
"event",
")",
"{",
"//IE compatibility",
"event",
"=",
"event",
"||",
"window",
".",
"event",
";",
"//Mozilla, Opera, & Legacy",
"if",
"(",
"event",
"&&",
"event",
".",
"type",
"&&",
"(",
"/",
"DOMContentLoaded|load",
"/",
")",
".",
"test",
... | Responsible for handling events and each tick of the interval | [
"Responsible",
"for",
"handling",
"events",
"and",
"each",
"tick",
"of",
"the",
"interval"
] | 8737f5885014e80f89a5e14cbeed6658e21d1f33 | https://github.com/MarkNijhof/client.express.js/blob/8737f5885014e80f89a5e14cbeed6658e21d1f33/src/client.express.ondomready.js#L12-L33 | |
52,193 | MarkNijhof/client.express.js | src/client.express.ondomready.js | function() {
if (!ready) {
ready = true;
//Call the stack of onload functions in given context or window object
for (var i=0, len=stack.length; i < len; i++) {
stack[i][0].call(stack[i][1]);
}
//Clean up after the DOM is ready
if (document.removeEventListener) {
document.removeEventListener... | javascript | function() {
if (!ready) {
ready = true;
//Call the stack of onload functions in given context or window object
for (var i=0, len=stack.length; i < len; i++) {
stack[i][0].call(stack[i][1]);
}
//Clean up after the DOM is ready
if (document.removeEventListener) {
document.removeEventListener... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"ready",
")",
"{",
"ready",
"=",
"true",
";",
"//Call the stack of onload functions in given context or window object",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"stack",
".",
"length",
";",
"i",
"<",
"le... | Fires all the functions and cleans up memory | [
"Fires",
"all",
"the",
"functions",
"and",
"cleans",
"up",
"memory"
] | 8737f5885014e80f89a5e14cbeed6658e21d1f33 | https://github.com/MarkNijhof/client.express.js/blob/8737f5885014e80f89a5e14cbeed6658e21d1f33/src/client.express.ondomready.js#L36-L52 | |
52,194 | vkiding/judpack-lib | src/hooks/HooksRunner.js | runScript | function runScript(script, context) {
if (typeof script.useModuleLoader == 'undefined') {
// if it is not explicitly defined whether we should use modeule loader or not
// we assume we should use module loader for .js files
script.useModuleLoader = path.extname(script.path).toLowerCase() == ... | javascript | function runScript(script, context) {
if (typeof script.useModuleLoader == 'undefined') {
// if it is not explicitly defined whether we should use modeule loader or not
// we assume we should use module loader for .js files
script.useModuleLoader = path.extname(script.path).toLowerCase() == ... | [
"function",
"runScript",
"(",
"script",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"script",
".",
"useModuleLoader",
"==",
"'undefined'",
")",
"{",
"// if it is not explicitly defined whether we should use modeule loader or not",
"// we assume we should use module loader fo... | Async runs single script file. | [
"Async",
"runs",
"single",
"script",
"file",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/hooks/HooksRunner.js#L141-L169 |
52,195 | vkiding/judpack-lib | src/hooks/HooksRunner.js | runScriptViaModuleLoader | function runScriptViaModuleLoader(script, context) {
if(!fs.existsSync(script.fullPath)) {
events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
return Q();
}
var scriptFn = require(script.fullPath);
context.scriptLocation = script.fullPath;
contex... | javascript | function runScriptViaModuleLoader(script, context) {
if(!fs.existsSync(script.fullPath)) {
events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
return Q();
}
var scriptFn = require(script.fullPath);
context.scriptLocation = script.fullPath;
contex... | [
"function",
"runScriptViaModuleLoader",
"(",
"script",
",",
"context",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"script",
".",
"fullPath",
")",
")",
"{",
"events",
".",
"emit",
"(",
"'warn'",
",",
"'Script file does\\'t exist and will be skipped: ... | Runs script using require.
Returns a promise. | [
"Runs",
"script",
"using",
"require",
".",
"Returns",
"a",
"promise",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/hooks/HooksRunner.js#L174-L191 |
52,196 | vkiding/judpack-lib | src/hooks/HooksRunner.js | runScriptViaChildProcessSpawn | function runScriptViaChildProcessSpawn(script, context) {
var opts = context.opts;
var command = script.fullPath;
var args = [opts.projectRoot];
if (fs.statSync(script.fullPath).isDirectory()) {
events.emit('verbose', 'Skipped directory "' + script.fullPath + '" within hook directory');
... | javascript | function runScriptViaChildProcessSpawn(script, context) {
var opts = context.opts;
var command = script.fullPath;
var args = [opts.projectRoot];
if (fs.statSync(script.fullPath).isDirectory()) {
events.emit('verbose', 'Skipped directory "' + script.fullPath + '" within hook directory');
... | [
"function",
"runScriptViaChildProcessSpawn",
"(",
"script",
",",
"context",
")",
"{",
"var",
"opts",
"=",
"context",
".",
"opts",
";",
"var",
"command",
"=",
"script",
".",
"fullPath",
";",
"var",
"args",
"=",
"[",
"opts",
".",
"projectRoot",
"]",
";",
"... | Runs script using child_process spawn method.
Returns a promise. | [
"Runs",
"script",
"using",
"child_process",
"spawn",
"method",
".",
"Returns",
"a",
"promise",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/hooks/HooksRunner.js#L196-L233 |
52,197 | vkiding/judpack-lib | src/hooks/HooksRunner.js | extractSheBangInterpreter | function extractSheBangInterpreter(fullpath) {
var fileChunk;
var octetsRead;
var fileData;
var hookFd = fs.openSync(fullpath, 'r');
try {
// this is a modern cluster size. no need to read less
fileData = new Buffer(4096);
octetsRead = fs.readSync(hookFd, fileData, 0, 4096, 0... | javascript | function extractSheBangInterpreter(fullpath) {
var fileChunk;
var octetsRead;
var fileData;
var hookFd = fs.openSync(fullpath, 'r');
try {
// this is a modern cluster size. no need to read less
fileData = new Buffer(4096);
octetsRead = fs.readSync(hookFd, fileData, 0, 4096, 0... | [
"function",
"extractSheBangInterpreter",
"(",
"fullpath",
")",
"{",
"var",
"fileChunk",
";",
"var",
"octetsRead",
";",
"var",
"fileData",
";",
"var",
"hookFd",
"=",
"fs",
".",
"openSync",
"(",
"fullpath",
",",
"'r'",
")",
";",
"try",
"{",
"// this is a moder... | Extracts shebang interpreter from script' source. | [
"Extracts",
"shebang",
"interpreter",
"from",
"script",
"source",
"."
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/hooks/HooksRunner.js#L237-L264 |
52,198 | nbrownus/ppunit | lib/PPUnit.js | function (options) {
var self = this
PPUnit.super_.call(self)
options = options || {}
self.concurrency = options.concurrency || -1
self.rootSuite = new Suite(undefined)
self.rootSuite.timeout(2000)
self.rootSuite.globallyExclusive()
self.rootSuite.locallyExclusiveTests()
self.all... | javascript | function (options) {
var self = this
PPUnit.super_.call(self)
options = options || {}
self.concurrency = options.concurrency || -1
self.rootSuite = new Suite(undefined)
self.rootSuite.timeout(2000)
self.rootSuite.globallyExclusive()
self.rootSuite.locallyExclusiveTests()
self.all... | [
"function",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
"PPUnit",
".",
"super_",
".",
"call",
"(",
"self",
")",
"options",
"=",
"options",
"||",
"{",
"}",
"self",
".",
"concurrency",
"=",
"options",
".",
"concurrency",
"||",
"-",
"1",
"self... | Creates a new PPUnit object
@constructor | [
"Creates",
"a",
"new",
"PPUnit",
"object"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/PPUnit.js#L14-L53 | |
52,199 | deftly/node-deftly | src/log.js | addAdapter | function addAdapter (state, name, config, logger) {
if (_.isFunction(name)) {
logger = name
name = logger.name
config = config || {}
} else if (_.isFunction(config)) {
logger = config
if (_.isObject(name)) {
config = name
name = logger.name
} else {
config = {}
}
} el... | javascript | function addAdapter (state, name, config, logger) {
if (_.isFunction(name)) {
logger = name
name = logger.name
config = config || {}
} else if (_.isFunction(config)) {
logger = config
if (_.isObject(name)) {
config = name
name = logger.name
} else {
config = {}
}
} el... | [
"function",
"addAdapter",
"(",
"state",
",",
"name",
",",
"config",
",",
"logger",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"name",
")",
")",
"{",
"logger",
"=",
"name",
"name",
"=",
"logger",
".",
"name",
"config",
"=",
"config",
"||",
"{... | normalizes arguments for logger creation from a user supplied object or function | [
"normalizes",
"arguments",
"for",
"logger",
"creation",
"from",
"a",
"user",
"supplied",
"object",
"or",
"function"
] | 0c34205fd6726356b69bcdd6dec4fcba55027af6 | https://github.com/deftly/node-deftly/blob/0c34205fd6726356b69bcdd6dec4fcba55027af6/src/log.js#L27-L49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.