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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44,200 | dutchenkoOleg/node-w3c-validator | lib/validator.js | getOptions | function getOptions (userOptions = {}) {
let options = _.cloneDeep(userOptions);
if (options.format === 'html') {
options.outputAsHtml = true;
options.verbose = true;
options.format = 'json';
}
return options;
} | javascript | function getOptions (userOptions = {}) {
let options = _.cloneDeep(userOptions);
if (options.format === 'html') {
options.outputAsHtml = true;
options.verbose = true;
options.format = 'json';
}
return options;
} | [
"function",
"getOptions",
"(",
"userOptions",
"=",
"{",
"}",
")",
"{",
"let",
"options",
"=",
"_",
".",
"cloneDeep",
"(",
"userOptions",
")",
";",
"if",
"(",
"options",
".",
"format",
"===",
"'html'",
")",
"{",
"options",
".",
"outputAsHtml",
"=",
"tru... | Get run options from user settled options
@param {Object} [userOptions={}]
@returns {Object}
@private
@sourceCode | [
"Get",
"run",
"options",
"from",
"user",
"settled",
"options"
] | 79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e | https://github.com/dutchenkoOleg/node-w3c-validator/blob/79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e/lib/validator.js#L83-L93 |
44,201 | dutchenkoOleg/node-w3c-validator | lib/validator.js | getArgvFromObject | function getArgvFromObject (options) {
let argv = [];
let format = options.format;
if (formatList.get(format)) {
argv.push(`--format ${format}`);
}
if (options.asciiquotes) {
argv.push('--asciiquotes yes');
}
if (options.stream === false) {
argv.push('--no-stream');
}
if (options.langdetect === false... | javascript | function getArgvFromObject (options) {
let argv = [];
let format = options.format;
if (formatList.get(format)) {
argv.push(`--format ${format}`);
}
if (options.asciiquotes) {
argv.push('--asciiquotes yes');
}
if (options.stream === false) {
argv.push('--no-stream');
}
if (options.langdetect === false... | [
"function",
"getArgvFromObject",
"(",
"options",
")",
"{",
"let",
"argv",
"=",
"[",
"]",
";",
"let",
"format",
"=",
"options",
".",
"format",
";",
"if",
"(",
"formatList",
".",
"get",
"(",
"format",
")",
")",
"{",
"argv",
".",
"push",
"(",
"`",
"${... | Get arguments from given object
@param {Object} options
@returns {Array}
@private
@sourceCode | [
"Get",
"arguments",
"from",
"given",
"object"
] | 79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e | https://github.com/dutchenkoOleg/node-w3c-validator/blob/79bc6ee63bdfad0208c6c6d8dcd5e25a629b006e/lib/validator.js#L102-L137 |
44,202 | flitbit/fpipe | examples/example.js | doSomethingUninteresting | function doSomethingUninteresting(data) {
// simulate latency
var wait = randomWait(1000);
return Promise.delay(wait).then(
() => `It took me ${wait} milliseconds to notice you gave me ${data}.`
);
} | javascript | function doSomethingUninteresting(data) {
// simulate latency
var wait = randomWait(1000);
return Promise.delay(wait).then(
() => `It took me ${wait} milliseconds to notice you gave me ${data}.`
);
} | [
"function",
"doSomethingUninteresting",
"(",
"data",
")",
"{",
"// simulate latency",
"var",
"wait",
"=",
"randomWait",
"(",
"1000",
")",
";",
"return",
"Promise",
".",
"delay",
"(",
"wait",
")",
".",
"then",
"(",
"(",
")",
"=>",
"`",
"${",
"wait",
"}",
... | Waits a random period of time before returning a dumb message to the callback given. | [
"Waits",
"a",
"random",
"period",
"of",
"time",
"before",
"returning",
"a",
"dumb",
"message",
"to",
"the",
"callback",
"given",
"."
] | 39509c0f4e2c46e62c48a94e15b8ba8ed05c7d77 | https://github.com/flitbit/fpipe/blob/39509c0f4e2c46e62c48a94e15b8ba8ed05c7d77/examples/example.js#L12-L18 |
44,203 | andreypopp/rrouter | src/data.js | fetchProps | function fetchProps(props, match) {
var newProps = {};
var deferreds = {};
var promises = {};
var tasks = {};
var name;
for (name in props) {
var m = isPromisePropRe.exec(name);
if (m) {
var promiseName = m[1];
var deferred = Promise.defer();
tasks[promiseName] = makeTask(props[... | javascript | function fetchProps(props, match) {
var newProps = {};
var deferreds = {};
var promises = {};
var tasks = {};
var name;
for (name in props) {
var m = isPromisePropRe.exec(name);
if (m) {
var promiseName = m[1];
var deferred = Promise.defer();
tasks[promiseName] = makeTask(props[... | [
"function",
"fetchProps",
"(",
"props",
",",
"match",
")",
"{",
"var",
"newProps",
"=",
"{",
"}",
";",
"var",
"deferreds",
"=",
"{",
"}",
";",
"var",
"promises",
"=",
"{",
"}",
";",
"var",
"tasks",
"=",
"{",
"}",
";",
"var",
"name",
";",
"for",
... | Fetch all promises defined in props
@param {Object} props
@returns {Promise<Object>} | [
"Fetch",
"all",
"promises",
"defined",
"in",
"props"
] | 4287dc666254af61f1d169c12fb61a1bfd7e2623 | https://github.com/andreypopp/rrouter/blob/4287dc666254af61f1d169c12fb61a1bfd7e2623/src/data.js#L48-L94 |
44,204 | Jam3/gl-pixel-stream | demo.js | renderScene | function renderScene () {
gl.clearColor(0, 0, 0, 1)
gl.clear(gl.COLOR_BUFFER_BIT)
gl.viewport(0, 0, shape[0], shape[1])
shader.bind()
shader.uniforms.iResolution = shape
shader.uniforms.iGlobalTime = 0
triangle(gl)
} | javascript | function renderScene () {
gl.clearColor(0, 0, 0, 1)
gl.clear(gl.COLOR_BUFFER_BIT)
gl.viewport(0, 0, shape[0], shape[1])
shader.bind()
shader.uniforms.iResolution = shape
shader.uniforms.iGlobalTime = 0
triangle(gl)
} | [
"function",
"renderScene",
"(",
")",
"{",
"gl",
".",
"clearColor",
"(",
"0",
",",
"0",
",",
"0",
",",
"1",
")",
"gl",
".",
"clear",
"(",
"gl",
".",
"COLOR_BUFFER_BIT",
")",
"gl",
".",
"viewport",
"(",
"0",
",",
"0",
",",
"shape",
"[",
"0",
"]",... | can be any type of render function | [
"can",
"be",
"any",
"type",
"of",
"render",
"function"
] | 7da1fc9da0b5895d5c5a54d5208193e3cf1ab237 | https://github.com/Jam3/gl-pixel-stream/blob/7da1fc9da0b5895d5c5a54d5208193e3cf1ab237/demo.js#L59-L67 |
44,205 | wyicwx/bone | lib/fs.js | FileSystem | function FileSystem(base, options) {
options || (options = {});
this.base = this.pathResolve(base);
if(options.captureFile) {
this._readFiles = [];
}
if(options.globalAct) {
this.globalAct = options.globalAct;
}
} | javascript | function FileSystem(base, options) {
options || (options = {});
this.base = this.pathResolve(base);
if(options.captureFile) {
this._readFiles = [];
}
if(options.globalAct) {
this.globalAct = options.globalAct;
}
} | [
"function",
"FileSystem",
"(",
"base",
",",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"this",
".",
"base",
"=",
"this",
".",
"pathResolve",
"(",
"base",
")",
";",
"if",
"(",
"options",
".",
"captureFile",
")",
"... | file path src | [
"file",
"path",
"src"
] | eb6c12080f6da8c5a20767d567bf80a49a099430 | https://github.com/wyicwx/bone/blob/eb6c12080f6da8c5a20767d567bf80a49a099430/lib/fs.js#L12-L21 |
44,206 | jdeal/doctor | view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js | function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
} | javascript | function(pos) {
var topOffset = $(this).css(pos).offset().top;
if (topOffset < 0) {
$(this).css('top', pos.top - topOffset);
}
} | [
"function",
"(",
"pos",
")",
"{",
"var",
"topOffset",
"=",
"$",
"(",
"this",
")",
".",
"css",
"(",
"pos",
")",
".",
"offset",
"(",
")",
".",
"top",
";",
"if",
"(",
"topOffset",
"<",
"0",
")",
"{",
"$",
"(",
"this",
")",
".",
"css",
"(",
"'t... | ensure that the titlebar is never outside the document | [
"ensure",
"that",
"the",
"titlebar",
"is",
"never",
"outside",
"the",
"document"
] | e1516f9cac6a899dbf3c624026deac3061f4ec63 | https://github.com/jdeal/doctor/blob/e1516f9cac6a899dbf3c624026deac3061f4ec63/view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js#L6015-L6020 | |
44,207 | jdeal/doctor | view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js | function(force, event) {
var self = this,
options = self.options,
saveScroll;
if ((options.modal && !force) ||
(!options.stack && !options.modal)) {
return self._trigger('focus', event);
}
if (options.zIndex > $.ui.dialog.maxZ) {
$.ui.dialog.maxZ = options.zIndex;
}
if (self.overlay) {
$... | javascript | function(force, event) {
var self = this,
options = self.options,
saveScroll;
if ((options.modal && !force) ||
(!options.stack && !options.modal)) {
return self._trigger('focus', event);
}
if (options.zIndex > $.ui.dialog.maxZ) {
$.ui.dialog.maxZ = options.zIndex;
}
if (self.overlay) {
$... | [
"function",
"(",
"force",
",",
"event",
")",
"{",
"var",
"self",
"=",
"this",
",",
"options",
"=",
"self",
".",
"options",
",",
"saveScroll",
";",
"if",
"(",
"(",
"options",
".",
"modal",
"&&",
"!",
"force",
")",
"||",
"(",
"!",
"options",
".",
"... | the force parameter allows us to move modal dialogs to their correct position on open | [
"the",
"force",
"parameter",
"allows",
"us",
"to",
"move",
"modal",
"dialogs",
"to",
"their",
"correct",
"position",
"on",
"open"
] | e1516f9cac6a899dbf3c624026deac3061f4ec63 | https://github.com/jdeal/doctor/blob/e1516f9cac6a899dbf3c624026deac3061f4ec63/view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js#L6230-L6257 | |
44,208 | jdeal/doctor | view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js | function(match, value, len) {
var num = '' + value;
if (lookAhead(match))
while (num.length < len)
num = '0' + num;
return num;
} | javascript | function(match, value, len) {
var num = '' + value;
if (lookAhead(match))
while (num.length < len)
num = '0' + num;
return num;
} | [
"function",
"(",
"match",
",",
"value",
",",
"len",
")",
"{",
"var",
"num",
"=",
"''",
"+",
"value",
";",
"if",
"(",
"lookAhead",
"(",
"match",
")",
")",
"while",
"(",
"num",
".",
"length",
"<",
"len",
")",
"num",
"=",
"'0'",
"+",
"num",
";",
... | Format a number, with leading zero if necessary | [
"Format",
"a",
"number",
"with",
"leading",
"zero",
"if",
"necessary"
] | e1516f9cac6a899dbf3c624026deac3061f4ec63 | https://github.com/jdeal/doctor/blob/e1516f9cac6a899dbf3c624026deac3061f4ec63/view/default/jquery-ui/development-bundle/ui/jquery-ui-1.8.16.custom.js#L9423-L9429 | |
44,209 | ivee-tech/three-asciieffect | index.js | asciifyImage | function asciifyImage( canvasRenderer, oAscii ) {
oCtx.clearRect( 0, 0, iWidth, iHeight );
oCtx.drawImage( oCanvasImg, 0, 0, iWidth, iHeight );
var oImgData = oCtx.getImageData( 0, 0, iWidth, iHeight ).data;
// Coloring loop starts now
var strChars = "";
// console.time('rendering');
for ( var y = 0; ... | javascript | function asciifyImage( canvasRenderer, oAscii ) {
oCtx.clearRect( 0, 0, iWidth, iHeight );
oCtx.drawImage( oCanvasImg, 0, 0, iWidth, iHeight );
var oImgData = oCtx.getImageData( 0, 0, iWidth, iHeight ).data;
// Coloring loop starts now
var strChars = "";
// console.time('rendering');
for ( var y = 0; ... | [
"function",
"asciifyImage",
"(",
"canvasRenderer",
",",
"oAscii",
")",
"{",
"oCtx",
".",
"clearRect",
"(",
"0",
",",
"0",
",",
"iWidth",
",",
"iHeight",
")",
";",
"oCtx",
".",
"drawImage",
"(",
"oCanvasImg",
",",
"0",
",",
"0",
",",
"iWidth",
",",
"i... | can't get a span or div to flow like an img element, but a table works? convert img element to ascii | [
"can",
"t",
"get",
"a",
"span",
"or",
"div",
"to",
"flow",
"like",
"an",
"img",
"element",
"but",
"a",
"table",
"works?",
"convert",
"img",
"element",
"to",
"ascii"
] | 19194b28547c40a4901bfc0494047cdcc40e02cf | https://github.com/ivee-tech/three-asciieffect/blob/19194b28547c40a4901bfc0494047cdcc40e02cf/index.js#L205-L283 |
44,210 | sergiolepore/hexo-broken-link-checker | lib/core/brokenLinkChecker.js | BrokenLinkChecker | function BrokenLinkChecker(options) {
this.runningScope = options.scope || BrokenLinkChecker.RUNNING_SCOPE_COMMAND;
this.pluginConfig = {};
this.pluginConfig.enabled = (typeof userConfig.enabled !== 'undefined')? userConfig.enabled : true;
this.pluginConfig.storageDir = userConfig.storage_dir || 'temp/link_chec... | javascript | function BrokenLinkChecker(options) {
this.runningScope = options.scope || BrokenLinkChecker.RUNNING_SCOPE_COMMAND;
this.pluginConfig = {};
this.pluginConfig.enabled = (typeof userConfig.enabled !== 'undefined')? userConfig.enabled : true;
this.pluginConfig.storageDir = userConfig.storage_dir || 'temp/link_chec... | [
"function",
"BrokenLinkChecker",
"(",
"options",
")",
"{",
"this",
".",
"runningScope",
"=",
"options",
".",
"scope",
"||",
"BrokenLinkChecker",
".",
"RUNNING_SCOPE_COMMAND",
";",
"this",
".",
"pluginConfig",
"=",
"{",
"}",
";",
"this",
".",
"pluginConfig",
".... | BrokenLinkChecker constructor.
Options:
- `scope`: BrokenLinkChecker.RUNNING_SCOPE_*
- `silentLogs`: output all log info to a file, instead
using the stdout.
@class BrokenLinkChecker
@constructor
@param {Object} options | [
"BrokenLinkChecker",
"constructor",
"."
] | b2da55b87a77609b3e07e34666c32971a523b88d | https://github.com/sergiolepore/hexo-broken-link-checker/blob/b2da55b87a77609b3e07e34666c32971a523b88d/lib/core/brokenLinkChecker.js#L33-L80 |
44,211 | emalherbi/grunt-php-shield | tasks/php_shield.js | function(src, dest) {
if (grunt.file.isDir(src)) {
grunt.file.mkdir(dest);
if (options.log) {
Utils.writeln(chalk.gray.bold(' create dir => ' + dest));
}
return true;
}
return false;
} | javascript | function(src, dest) {
if (grunt.file.isDir(src)) {
grunt.file.mkdir(dest);
if (options.log) {
Utils.writeln(chalk.gray.bold(' create dir => ' + dest));
}
return true;
}
return false;
} | [
"function",
"(",
"src",
",",
"dest",
")",
"{",
"if",
"(",
"grunt",
".",
"file",
".",
"isDir",
"(",
"src",
")",
")",
"{",
"grunt",
".",
"file",
".",
"mkdir",
"(",
"dest",
")",
";",
"if",
"(",
"options",
".",
"log",
")",
"{",
"Utils",
".",
"wri... | create a dir | [
"create",
"a",
"dir"
] | 40eec9f08cd6c88ec93cef3b6cacf977f5b1b1ca | https://github.com/emalherbi/grunt-php-shield/blob/40eec9f08cd6c88ec93cef3b6cacf977f5b1b1ca/tasks/php_shield.js#L46-L55 | |
44,212 | postmanlabs/generic-bitmask | lib/descriptor.js | function (names) {
this.names = Object.keys(names); // store the keys
this.hash = util.map(names, function (value) { // store values for corresponding keys
return parseInt(value, 10);
});
} | javascript | function (names) {
this.names = Object.keys(names); // store the keys
this.hash = util.map(names, function (value) { // store values for corresponding keys
return parseInt(value, 10);
});
} | [
"function",
"(",
"names",
")",
"{",
"this",
".",
"names",
"=",
"Object",
".",
"keys",
"(",
"names",
")",
";",
"// store the keys",
"this",
".",
"hash",
"=",
"util",
".",
"map",
"(",
"names",
",",
"function",
"(",
"value",
")",
"{",
"// store values for... | Set the named bits for the descriptors.
@param {object<number>} values | [
"Set",
"the",
"named",
"bits",
"for",
"the",
"descriptors",
"."
] | 9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d | https://github.com/postmanlabs/generic-bitmask/blob/9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d/lib/descriptor.js#L23-L28 | |
44,213 | postmanlabs/generic-bitmask | lib/descriptor.js | function (name, lazy) {
return Array.isArray(name) ? (name.length ? name.every(function (name) {
return this.defined(name, lazy);
}, this) : !!lazy) : (name ? !!this.hash[name] : !!lazy);
} | javascript | function (name, lazy) {
return Array.isArray(name) ? (name.length ? name.every(function (name) {
return this.defined(name, lazy);
}, this) : !!lazy) : (name ? !!this.hash[name] : !!lazy);
} | [
"function",
"(",
"name",
",",
"lazy",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"name",
")",
"?",
"(",
"name",
".",
"length",
"?",
"name",
".",
"every",
"(",
"function",
"(",
"name",
")",
"{",
"return",
"this",
".",
"defined",
"(",
"name",
... | Verifies whether the specified named bits are defined in the descriptor
@param {Array<string>|string} name
@param {boolean=} [lazy=false] - if set to true, this function will return true for empty names or array
@return {boolean} | [
"Verifies",
"whether",
"the",
"specified",
"named",
"bits",
"are",
"defined",
"in",
"the",
"descriptor"
] | 9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d | https://github.com/postmanlabs/generic-bitmask/blob/9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d/lib/descriptor.js#L36-L40 | |
44,214 | postmanlabs/generic-bitmask | lib/descriptor.js | function (name) {
return Array.isArray(name) ? (name.map(this.valueOf.bind(this))) : this.hash[name];
} | javascript | function (name) {
return Array.isArray(name) ? (name.map(this.valueOf.bind(this))) : this.hash[name];
} | [
"function",
"(",
"name",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"name",
")",
"?",
"(",
"name",
".",
"map",
"(",
"this",
".",
"valueOf",
".",
"bind",
"(",
"this",
")",
")",
")",
":",
"this",
".",
"hash",
"[",
"name",
"]",
";",
"}"
] | Returns the value of a descriptor name
@param {Array<string>|string} name
@returns {number} | [
"Returns",
"the",
"value",
"of",
"a",
"descriptor",
"name"
] | 9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d | https://github.com/postmanlabs/generic-bitmask/blob/9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d/lib/descriptor.js#L48-L50 | |
44,215 | wyicwx/bone | lib/utils.js | function(file) {
var FileSystem = require('./fs.js');
var ReadStream = require('./read_stream.js');
if(FileSystem.fs.existFile(file)) {
file = FileSystem.fs.pathResolve(file);
var readStream = new ReadStream(file);
return _.clone(readStream.trackStack);
... | javascript | function(file) {
var FileSystem = require('./fs.js');
var ReadStream = require('./read_stream.js');
if(FileSystem.fs.existFile(file)) {
file = FileSystem.fs.pathResolve(file);
var readStream = new ReadStream(file);
return _.clone(readStream.trackStack);
... | [
"function",
"(",
"file",
")",
"{",
"var",
"FileSystem",
"=",
"require",
"(",
"'./fs.js'",
")",
";",
"var",
"ReadStream",
"=",
"require",
"(",
"'./read_stream.js'",
")",
";",
"if",
"(",
"FileSystem",
".",
"fs",
".",
"existFile",
"(",
"file",
")",
")",
"... | track file stack | [
"track",
"file",
"stack"
] | eb6c12080f6da8c5a20767d567bf80a49a099430 | https://github.com/wyicwx/bone/blob/eb6c12080f6da8c5a20767d567bf80a49a099430/lib/utils.js#L12-L24 | |
44,216 | simonepri/osm-countries | index.js | get | function get(code) {
if (!Object.prototype.hasOwnProperty.call(osm, code)) {
throw new TypeError('The alpha-3 code provided was not found: ' + code);
}
return osm[code];
} | javascript | function get(code) {
if (!Object.prototype.hasOwnProperty.call(osm, code)) {
throw new TypeError('The alpha-3 code provided was not found: ' + code);
}
return osm[code];
} | [
"function",
"get",
"(",
"code",
")",
"{",
"if",
"(",
"!",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"osm",
",",
"code",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'The alpha-3 code provided was not found: '",
"+",
"code",
... | Converts an alpha-3 iso 3166-1 code to its corrispective relation id on OSM.
@public
@param {string} code Alpha-3 iso 3166-1 country code.
@return {string} OSM relation id of the given country. | [
"Converts",
"an",
"alpha",
"-",
"3",
"iso",
"3166",
"-",
"1",
"code",
"to",
"its",
"corrispective",
"relation",
"id",
"on",
"OSM",
"."
] | 60aa88eb5fd7199f26ac7c5410cbae0936378ebb | https://github.com/simonepri/osm-countries/blob/60aa88eb5fd7199f26ac7c5410cbae0936378ebb/index.js#L11-L16 |
44,217 | clubedaentrega/validate-fields | types/numeric.js | registerDual | function registerDual(numberType, numericType, checkFn, toJSONSchema) {
context.registerType(numberType, 'number', checkFn, numberType, extra => toJSONSchema('number', extra))
context.registerType(numericType, 'string', value => {
let numberValue = toNumber(value)
checkFn(numberValue)
return numberValue
... | javascript | function registerDual(numberType, numericType, checkFn, toJSONSchema) {
context.registerType(numberType, 'number', checkFn, numberType, extra => toJSONSchema('number', extra))
context.registerType(numericType, 'string', value => {
let numberValue = toNumber(value)
checkFn(numberValue)
return numberValue
... | [
"function",
"registerDual",
"(",
"numberType",
",",
"numericType",
",",
"checkFn",
",",
"toJSONSchema",
")",
"{",
"context",
".",
"registerType",
"(",
"numberType",
",",
"'number'",
",",
"checkFn",
",",
"numberType",
",",
"extra",
"=>",
"toJSONSchema",
"(",
"'... | Register number and numeric dual basic types
@param {string} numberType
@param {string} numericType
@param {Function} checkFn
@param {function(string, *):Object} toJSONSchema
@private | [
"Register",
"number",
"and",
"numeric",
"dual",
"basic",
"types"
] | 7213b20c082ddabe4cbe926100d72fc44da69327 | https://github.com/clubedaentrega/validate-fields/blob/7213b20c082ddabe4cbe926100d72fc44da69327/types/numeric.js#L139-L150 |
44,218 | clubedaentrega/validate-fields | types/numeric.js | registerTaggedDual | function registerTaggedDual(numberTag, numericTag, checkFn, toJSONSchema) {
context.registerTaggedType({
tag: numberTag,
jsonType: 'number',
minArgs: 2,
maxArgs: 2,
sparse: true,
numeric: true
}, checkFn, returnOriginal, toJSONSchema)
context.registerTaggedType({
tag: numericTag,
jsonType... | javascript | function registerTaggedDual(numberTag, numericTag, checkFn, toJSONSchema) {
context.registerTaggedType({
tag: numberTag,
jsonType: 'number',
minArgs: 2,
maxArgs: 2,
sparse: true,
numeric: true
}, checkFn, returnOriginal, toJSONSchema)
context.registerTaggedType({
tag: numericTag,
jsonType... | [
"function",
"registerTaggedDual",
"(",
"numberTag",
",",
"numericTag",
",",
"checkFn",
",",
"toJSONSchema",
")",
"{",
"context",
".",
"registerTaggedType",
"(",
"{",
"tag",
":",
"numberTag",
",",
"jsonType",
":",
"'number'",
",",
"minArgs",
":",
"2",
",",
"m... | Register number and numeric dual tagged types
@param {string} numberTag
@param {string} numericTag
@param {Function} checkFn
@param {function(*):Object} toJSONSchema
@private | [
"Register",
"number",
"and",
"numeric",
"dual",
"tagged",
"types"
] | 7213b20c082ddabe4cbe926100d72fc44da69327 | https://github.com/clubedaentrega/validate-fields/blob/7213b20c082ddabe4cbe926100d72fc44da69327/types/numeric.js#L160-L185 |
44,219 | gamtiq/eva | src/eva.js | createFunction | function createFunction(sCode, settings) {
/*jshint evil:true, laxbreak:true, quotmark:false*/
var nI, params, sName;
if (! settings) {
settings = {};
}
params = settings.paramNames;
if (settings.expression) {
sCode = "return (" + sCode + ");";
}
if (settings.scope) {
... | javascript | function createFunction(sCode, settings) {
/*jshint evil:true, laxbreak:true, quotmark:false*/
var nI, params, sName;
if (! settings) {
settings = {};
}
params = settings.paramNames;
if (settings.expression) {
sCode = "return (" + sCode + ");";
}
if (settings.scope) {
... | [
"function",
"createFunction",
"(",
"sCode",
",",
"settings",
")",
"{",
"/*jshint evil:true, laxbreak:true, quotmark:false*/",
"var",
"nI",
",",
"params",
",",
"sName",
";",
"if",
"(",
"!",
"settings",
")",
"{",
"settings",
"=",
"{",
"}",
";",
"}",
"params",
... | Create function to further use.
@param {String} sCode
Function's code.
@param {Object} [settings]
Operation settings. Keys are settings names, values are corresponding settings values.
The following settings are supported (setting's default value is specified in parentheses):
* `debug`: `Boolean` (`false`) - specifie... | [
"Create",
"function",
"to",
"further",
"use",
"."
] | ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5 | https://github.com/gamtiq/eva/blob/ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5/src/eva.js#L47-L85 |
44,220 | gamtiq/eva | src/eva.js | createDelegateMethod | function createDelegateMethod(delegate, sMethod, settings) {
var result = function() {
return delegate[sMethod].apply(delegate, arguments);
};
if (settings && settings.destination) {
settings.destination[settings.destinationMethod || sMethod] = result;
}
return result;
} | javascript | function createDelegateMethod(delegate, sMethod, settings) {
var result = function() {
return delegate[sMethod].apply(delegate, arguments);
};
if (settings && settings.destination) {
settings.destination[settings.destinationMethod || sMethod] = result;
}
return result;
} | [
"function",
"createDelegateMethod",
"(",
"delegate",
",",
"sMethod",
",",
"settings",
")",
"{",
"var",
"result",
"=",
"function",
"(",
")",
"{",
"return",
"delegate",
"[",
"sMethod",
"]",
".",
"apply",
"(",
"delegate",
",",
"arguments",
")",
";",
"}",
";... | Create function that executes specified method of the given object.
@param {Object} delegate
Object whose method will be executed when created function is called.
@param {String} sMethod
Name of method that will be executed.
@param {Object} [settings]
Operation settings. Keys are settings names, values are correspondi... | [
"Create",
"function",
"that",
"executes",
"specified",
"method",
"of",
"the",
"given",
"object",
"."
] | ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5 | https://github.com/gamtiq/eva/blob/ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5/src/eva.js#L125-L133 |
44,221 | gamtiq/eva | src/eva.js | closure | function closure(action, paramList, context, settings) {
if (! settings) {
settings = {};
}
var bUseArgs = ! settings.ignoreArgs,
bAppendArgs = ! settings.prependArgs;
return function() {
var params;
if (bUseArgs) {
params = paramList ? Array.prototype.sl... | javascript | function closure(action, paramList, context, settings) {
if (! settings) {
settings = {};
}
var bUseArgs = ! settings.ignoreArgs,
bAppendArgs = ! settings.prependArgs;
return function() {
var params;
if (bUseArgs) {
params = paramList ? Array.prototype.sl... | [
"function",
"closure",
"(",
"action",
",",
"paramList",
",",
"context",
",",
"settings",
")",
"{",
"if",
"(",
"!",
"settings",
")",
"{",
"settings",
"=",
"{",
"}",
";",
"}",
"var",
"bUseArgs",
"=",
"!",
"settings",
".",
"ignoreArgs",
",",
"bAppendArgs"... | Create function that executes specified function with given parameters and context and returns result of call.
@param {Function} action
Target function that will be executed when created function is called.
@param {Array} [paramList]
Array-like object representing parameters that should be passed into the target funct... | [
"Create",
"function",
"that",
"executes",
"specified",
"function",
"with",
"given",
"parameters",
"and",
"context",
"and",
"returns",
"result",
"of",
"call",
"."
] | ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5 | https://github.com/gamtiq/eva/blob/ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5/src/eva.js#L160-L183 |
44,222 | gamtiq/eva | src/eva.js | map | function map(funcList, paramList, context, settings) {
/*jshint laxbreak:true*/
var result = [],
nL = funcList.length,
bGetContext, bGetParamList, func, nI;
if (! paramList) {
paramList = [];
}
if (! context) {
context = null;
}
if (! settings) {
setti... | javascript | function map(funcList, paramList, context, settings) {
/*jshint laxbreak:true*/
var result = [],
nL = funcList.length,
bGetContext, bGetParamList, func, nI;
if (! paramList) {
paramList = [];
}
if (! context) {
context = null;
}
if (! settings) {
setti... | [
"function",
"map",
"(",
"funcList",
",",
"paramList",
",",
"context",
",",
"settings",
")",
"{",
"/*jshint laxbreak:true*/",
"var",
"result",
"=",
"[",
"]",
",",
"nL",
"=",
"funcList",
".",
"length",
",",
"bGetContext",
",",
"bGetParamList",
",",
"func",
"... | Call each function from specified list and return array containing results of calls.
@param {Array} funcList
Target functions that should be called.
@param {Array | Function} [paramList]
Parameters that should be passed into each target function.
If function is specified it should return array that will be used as par... | [
"Call",
"each",
"function",
"from",
"specified",
"list",
"and",
"return",
"array",
"containing",
"results",
"of",
"calls",
"."
] | ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5 | https://github.com/gamtiq/eva/blob/ae2987da163d7f0a59e4e551cbcc8d4f4dae4cd5/src/eva.js#L213-L239 |
44,223 | klarstil/lifx-http-api | source/utils.js | function(response, body) {
var responseCodes = [
{ codes: 400, message: 'Request was invalid.' },
{ codes: 401, message: 'Bad access token.' },
{ codes: 403, message: 'Bad OAuth scope.' },
{ codes: 404, message: 'Selector did not match any lights.' },
... | javascript | function(response, body) {
var responseCodes = [
{ codes: 400, message: 'Request was invalid.' },
{ codes: 401, message: 'Bad access token.' },
{ codes: 403, message: 'Bad OAuth scope.' },
{ codes: 404, message: 'Selector did not match any lights.' },
... | [
"function",
"(",
"response",
",",
"body",
")",
"{",
"var",
"responseCodes",
"=",
"[",
"{",
"codes",
":",
"400",
",",
"message",
":",
"'Request was invalid.'",
"}",
",",
"{",
"codes",
":",
"401",
",",
"message",
":",
"'Bad access token.'",
"}",
",",
"{",
... | Checks the HTTP response code and returns the according error message.
See: <http://api.developer.lifx.com/docs/errors>
@param {object} response
@param {string} body
@returns {string} | [
"Checks",
"the",
"HTTP",
"response",
"code",
"and",
"returns",
"the",
"according",
"error",
"message",
"."
] | 90afb556c30ea5d1ac14958a159490f6f579241a | https://github.com/klarstil/lifx-http-api/blob/90afb556c30ea5d1ac14958a159490f6f579241a/source/utils.js#L14-L46 | |
44,224 | klarstil/lifx-http-api | source/utils.js | function(selector) {
var validSelectors = [
'all',
'label:',
'id:',
'group_id:',
'group:',
'location_id:',
'location:',
'scene_id:'
], isValid = false;
if(!selector || !selector.length) {
... | javascript | function(selector) {
var validSelectors = [
'all',
'label:',
'id:',
'group_id:',
'group:',
'location_id:',
'location:',
'scene_id:'
], isValid = false;
if(!selector || !selector.length) {
... | [
"function",
"(",
"selector",
")",
"{",
"var",
"validSelectors",
"=",
"[",
"'all'",
",",
"'label:'",
",",
"'id:'",
",",
"'group_id:'",
",",
"'group:'",
",",
"'location_id:'",
",",
"'location:'",
",",
"'scene_id:'",
"]",
",",
"isValid",
"=",
"false",
";",
"i... | Checks the light selector if it's valid.
See: <http://api.developer.lifx.com/docs/selectors>
@param {string} selector
@returns {boolean} | [
"Checks",
"the",
"light",
"selector",
"if",
"it",
"s",
"valid",
"."
] | 90afb556c30ea5d1ac14958a159490f6f579241a | https://github.com/klarstil/lifx-http-api/blob/90afb556c30ea5d1ac14958a159490f6f579241a/source/utils.js#L56-L83 | |
44,225 | clubedaentrega/validate-fields | index.js | context | function context(schema, value, options) {
schema = context.parse(schema)
let ret = schema.validate(value, options)
context.lastError = schema.lastError
context.lastErrorMessage = schema.lastErrorMessage
context.lastErrorPath = schema.lastErrorPath
return ret
} | javascript | function context(schema, value, options) {
schema = context.parse(schema)
let ret = schema.validate(value, options)
context.lastError = schema.lastError
context.lastErrorMessage = schema.lastErrorMessage
context.lastErrorPath = schema.lastErrorPath
return ret
} | [
"function",
"context",
"(",
"schema",
",",
"value",
",",
"options",
")",
"{",
"schema",
"=",
"context",
".",
"parse",
"(",
"schema",
")",
"let",
"ret",
"=",
"schema",
".",
"validate",
"(",
"value",
",",
"options",
")",
"context",
".",
"lastError",
"=",... | Validate the given value against the given schema
@param {*} schema
@param {*} value The value can be altered by the validation
@param {Object} [options] Validation options
@returns {boolean} whether the value is valid or nor
@throw if the schema is invalid | [
"Validate",
"the",
"given",
"value",
"against",
"the",
"given",
"schema"
] | 7213b20c082ddabe4cbe926100d72fc44da69327 | https://github.com/clubedaentrega/validate-fields/blob/7213b20c082ddabe4cbe926100d72fc44da69327/index.js#L36-L43 |
44,226 | clubedaentrega/validate-fields | index.js | parseTagged | function parseTagged(definition, taggedTypes) {
let match = definition.match(/^(\w+)(?:\((.*)\))?$/),
tag, args, typeInfo
if (!match) {
return
}
// Get type info
tag = match[1]
typeInfo = taggedTypes[tag]
if (!typeInfo) {
return
}
// Special no-'()' case: only match 'tag' if minArgs is zero
if (typeIn... | javascript | function parseTagged(definition, taggedTypes) {
let match = definition.match(/^(\w+)(?:\((.*)\))?$/),
tag, args, typeInfo
if (!match) {
return
}
// Get type info
tag = match[1]
typeInfo = taggedTypes[tag]
if (!typeInfo) {
return
}
// Special no-'()' case: only match 'tag' if minArgs is zero
if (typeIn... | [
"function",
"parseTagged",
"(",
"definition",
",",
"taggedTypes",
")",
"{",
"let",
"match",
"=",
"definition",
".",
"match",
"(",
"/",
"^(\\w+)(?:\\((.*)\\))?$",
"/",
")",
",",
"tag",
",",
"args",
",",
"typeInfo",
"if",
"(",
"!",
"match",
")",
"{",
"retu... | Try to parse a string definition as a tagged type
@private
@param {string} definition
@param {Object<String, Object>} taggedTypes
@returns {?Field} | [
"Try",
"to",
"parse",
"a",
"string",
"definition",
"as",
"a",
"tagged",
"type"
] | 7213b20c082ddabe4cbe926100d72fc44da69327 | https://github.com/clubedaentrega/validate-fields/blob/7213b20c082ddabe4cbe926100d72fc44da69327/index.js#L279-L329 |
44,227 | postmanlabs/generic-bitmask | lib/util.js | function (recipient, donor) {
for (var prop in donor) {
donor.hasOwnProperty(prop) && (recipient[prop] = donor[prop]);
}
return recipient;
} | javascript | function (recipient, donor) {
for (var prop in donor) {
donor.hasOwnProperty(prop) && (recipient[prop] = donor[prop]);
}
return recipient;
} | [
"function",
"(",
"recipient",
",",
"donor",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"donor",
")",
"{",
"donor",
".",
"hasOwnProperty",
"(",
"prop",
")",
"&&",
"(",
"recipient",
"[",
"prop",
"]",
"=",
"donor",
"[",
"prop",
"]",
")",
";",
"}",
"... | Performs shallow copy of one object into another.
@param {object} recipient
@param {object} donor
@returns {object} - returns the seeded recipient parameter | [
"Performs",
"shallow",
"copy",
"of",
"one",
"object",
"into",
"another",
"."
] | 9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d | https://github.com/postmanlabs/generic-bitmask/blob/9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d/lib/util.js#L12-L17 | |
44,228 | postmanlabs/generic-bitmask | lib/util.js | function (obj, mapper, scope) {
var map = {},
prop;
scope = scope || obj;
for (prop in obj) {
obj.hasOwnProperty(prop) && (map[prop] = mapper.call(scope, obj[prop], prop, obj));
}
return map;
} | javascript | function (obj, mapper, scope) {
var map = {},
prop;
scope = scope || obj;
for (prop in obj) {
obj.hasOwnProperty(prop) && (map[prop] = mapper.call(scope, obj[prop], prop, obj));
}
return map;
} | [
"function",
"(",
"obj",
",",
"mapper",
",",
"scope",
")",
"{",
"var",
"map",
"=",
"{",
"}",
",",
"prop",
";",
"scope",
"=",
"scope",
"||",
"obj",
";",
"for",
"(",
"prop",
"in",
"obj",
")",
"{",
"obj",
".",
"hasOwnProperty",
"(",
"prop",
")",
"&... | Creates a new object with mapped values from another object
@param {object} obj
@param {function} mapper
@param {*=} [scope]
@returns {object} | [
"Creates",
"a",
"new",
"object",
"with",
"mapped",
"values",
"from",
"another",
"object"
] | 9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d | https://github.com/postmanlabs/generic-bitmask/blob/9c940f6ef7c2fdef2f8523b1cb562ebcc8b8a50d/lib/util.js#L27-L37 | |
44,229 | frankgerhardt/botkit-matrix | matrixClient.js | verifyDevice | async function verifyDevice (userId, deviceId) {
await exports.matrixClient.setDeviceKnown(userId, deviceId, true);
await exports.matrixClient.setDeviceVerified(userId, deviceId, true);
} | javascript | async function verifyDevice (userId, deviceId) {
await exports.matrixClient.setDeviceKnown(userId, deviceId, true);
await exports.matrixClient.setDeviceVerified(userId, deviceId, true);
} | [
"async",
"function",
"verifyDevice",
"(",
"userId",
",",
"deviceId",
")",
"{",
"await",
"exports",
".",
"matrixClient",
".",
"setDeviceKnown",
"(",
"userId",
",",
"deviceId",
",",
"true",
")",
";",
"await",
"exports",
".",
"matrixClient",
".",
"setDeviceVerifi... | This function calls the functions from matrix-js-sdk to verify
the devices.
Implicitly returns a Promise because it's an async function.
@function verifyDevice
@param userId - The user who's devices has to be verified
@param deviceId - The ID of the device which has to be verified
@returns {Promise<void>} | [
"This",
"function",
"calls",
"the",
"functions",
"from",
"matrix",
"-",
"js",
"-",
"sdk",
"to",
"verify",
"the",
"devices",
".",
"Implicitly",
"returns",
"a",
"Promise",
"because",
"it",
"s",
"an",
"async",
"function",
"."
] | 3d7ae1f0c46af6905f6edbe945d43585b5de4bd1 | https://github.com/frankgerhardt/botkit-matrix/blob/3d7ae1f0c46af6905f6edbe945d43585b5de4bd1/matrixClient.js#L54-L57 |
44,230 | azu/textlint-plugin-asciidoc-loose | src/NodeBuilder.js | fixParagraphNode | function fixParagraphNode(node, fullText) {
const firstNode = node.children[0];
const lastNode = node.children[node.children.length - 1];
node.range = [firstNode.range[0], lastNode.range[1]];
node.raw = fullText.slice(node.range[0], node.range[1]);
node.loc = {
start: {
line: fir... | javascript | function fixParagraphNode(node, fullText) {
const firstNode = node.children[0];
const lastNode = node.children[node.children.length - 1];
node.range = [firstNode.range[0], lastNode.range[1]];
node.raw = fullText.slice(node.range[0], node.range[1]);
node.loc = {
start: {
line: fir... | [
"function",
"fixParagraphNode",
"(",
"node",
",",
"fullText",
")",
"{",
"const",
"firstNode",
"=",
"node",
".",
"children",
"[",
"0",
"]",
";",
"const",
"lastNode",
"=",
"node",
".",
"children",
"[",
"node",
".",
"children",
".",
"length",
"-",
"1",
"]... | fill properties of paragraph node.
@param {TxtNode} node - Paragraph node to modify
@param {string} fullText - Full text of the document | [
"fill",
"properties",
"of",
"paragraph",
"node",
"."
] | 7a69051adbb550bcc874fa25d84ebec07fa481ac | https://github.com/azu/textlint-plugin-asciidoc-loose/blob/7a69051adbb550bcc874fa25d84ebec07fa481ac/src/NodeBuilder.js#L25-L40 |
44,231 | jdeal/doctor | report/default.js | fixSignatureParams | function fixSignatureParams(node, item, signature) {
signature.params = [];
for (var i = 0; i < signature.arity; i++) {
var paramCopy = _.extend({}, item.params[i]);
if (node && node.paramTags) {
if (node.paramTags[paramCopy.name]) {
_.extend(paramCopy, node.paramTags[paramCopy.name]);
}... | javascript | function fixSignatureParams(node, item, signature) {
signature.params = [];
for (var i = 0; i < signature.arity; i++) {
var paramCopy = _.extend({}, item.params[i]);
if (node && node.paramTags) {
if (node.paramTags[paramCopy.name]) {
_.extend(paramCopy, node.paramTags[paramCopy.name]);
}... | [
"function",
"fixSignatureParams",
"(",
"node",
",",
"item",
",",
"signature",
")",
"{",
"signature",
".",
"params",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"signature",
".",
"arity",
";",
"i",
"++",
")",
"{",
"var",
"... | make a set of params to match the signature | [
"make",
"a",
"set",
"of",
"params",
"to",
"match",
"the",
"signature"
] | e1516f9cac6a899dbf3c624026deac3061f4ec63 | https://github.com/jdeal/doctor/blob/e1516f9cac6a899dbf3c624026deac3061f4ec63/report/default.js#L7-L18 |
44,232 | enmasseio/distribus | lib/Host.js | closeHost | function closeHost() {
// close the host itself
me.addresses = {};
if (me.server) {
me.server.close();
me.server = null;
me.address = null;
me.port = null;
me.url = null;
}
return me;
} | javascript | function closeHost() {
// close the host itself
me.addresses = {};
if (me.server) {
me.server.close();
me.server = null;
me.address = null;
me.port = null;
me.url = null;
}
return me;
} | [
"function",
"closeHost",
"(",
")",
"{",
"// close the host itself",
"me",
".",
"addresses",
"=",
"{",
"}",
";",
"if",
"(",
"me",
".",
"server",
")",
"{",
"me",
".",
"server",
".",
"close",
"(",
")",
";",
"me",
".",
"server",
"=",
"null",
";",
"me",... | close the host, and clean up cache | [
"close",
"the",
"host",
"and",
"clean",
"up",
"cache"
] | ce8dd12cd2fdf15de7eee89426e291b26e70bdc8 | https://github.com/enmasseio/distribus/blob/ce8dd12cd2fdf15de7eee89426e291b26e70bdc8/lib/Host.js#L562-L575 |
44,233 | filefog/filefog | lib/errors.js | FFParameterRejected | function FFParameterRejected(parameter) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.message = 'A parameter provided is absent, malformed or invalid for other reasons: '+parameter;
} | javascript | function FFParameterRejected(parameter) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.message = 'A parameter provided is absent, malformed or invalid for other reasons: '+parameter;
} | [
"function",
"FFParameterRejected",
"(",
"parameter",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
".",
"message",
"=",
"'A parameter provided is absent... | Thrown when a parameter provided is absent, malformed or invalid for other reasons
@constructor FFParameterRejected
@method FFParameterRejected
@param {String} parameter - the name of the parameter that is invalid
@return | [
"Thrown",
"when",
"a",
"parameter",
"provided",
"is",
"absent",
"malformed",
"or",
"invalid",
"for",
"other",
"reasons"
] | 16040ef431e0af8aeee08b445c046a6805242cf3 | https://github.com/filefog/filefog/blob/16040ef431e0af8aeee08b445c046a6805242cf3/lib/errors.js#L10-L14 |
44,234 | jeremenichelli/web-component-refs | src/web-component-refs.js | collectRefs | function collectRefs() {
// check if there's a shadow root in the element
if (typeof this.shadowRoot === 'undefined') {
throw new Error('You must create a shadowRoot on the element');
}
// create refs base object
this.refs = {};
var refsList = this.shadowRoot.querySelectorAll('[ref]');
// collect r... | javascript | function collectRefs() {
// check if there's a shadow root in the element
if (typeof this.shadowRoot === 'undefined') {
throw new Error('You must create a shadowRoot on the element');
}
// create refs base object
this.refs = {};
var refsList = this.shadowRoot.querySelectorAll('[ref]');
// collect r... | [
"function",
"collectRefs",
"(",
")",
"{",
"// check if there's a shadow root in the element",
"if",
"(",
"typeof",
"this",
".",
"shadowRoot",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'You must create a shadowRoot on the element'",
")",
";",
"}",
... | Inspects shadow root and creates a refs object in a custom element
@method collectRefs
@returns {undefined} | [
"Inspects",
"shadow",
"root",
"and",
"creates",
"a",
"refs",
"object",
"in",
"a",
"custom",
"element"
] | c98c04ee458084773fa5a3eac533da289ba4348c | https://github.com/jeremenichelli/web-component-refs/blob/c98c04ee458084773fa5a3eac533da289ba4348c/src/web-component-refs.js#L6-L31 |
44,235 | jeremenichelli/web-component-refs | src/web-component-refs.js | _isRefNode | function _isRefNode(node) {
return (
node.nodeType
&& node.nodeType === 1
&& (node.hasAttribute('ref') || typeof node.__refString__ === 'string')
);
} | javascript | function _isRefNode(node) {
return (
node.nodeType
&& node.nodeType === 1
&& (node.hasAttribute('ref') || typeof node.__refString__ === 'string')
);
} | [
"function",
"_isRefNode",
"(",
"node",
")",
"{",
"return",
"(",
"node",
".",
"nodeType",
"&&",
"node",
".",
"nodeType",
"===",
"1",
"&&",
"(",
"node",
".",
"hasAttribute",
"(",
"'ref'",
")",
"||",
"typeof",
"node",
".",
"__refString__",
"===",
"'string'"... | Checks if node has a ref attribute
@method _isRefNode
@param {Node} node
@returns {Boolean} | [
"Checks",
"if",
"node",
"has",
"a",
"ref",
"attribute"
] | c98c04ee458084773fa5a3eac533da289ba4348c | https://github.com/jeremenichelli/web-component-refs/blob/c98c04ee458084773fa5a3eac533da289ba4348c/src/web-component-refs.js#L49-L55 |
44,236 | jeremenichelli/web-component-refs | src/web-component-refs.js | _handleSingleMutation | function _handleSingleMutation(mutation) {
var addedNodes = _toArray(mutation.addedNodes);
var addedRefs = addedNodes.filter(_isRefNode);
// assign added nodes
addedRefs.map(_assignRef.bind(this));
var removedNodes = _toArray(mutation.removedNodes);
var removedRefs = removedNodes.filter(_isRefNode);
//... | javascript | function _handleSingleMutation(mutation) {
var addedNodes = _toArray(mutation.addedNodes);
var addedRefs = addedNodes.filter(_isRefNode);
// assign added nodes
addedRefs.map(_assignRef.bind(this));
var removedNodes = _toArray(mutation.removedNodes);
var removedRefs = removedNodes.filter(_isRefNode);
//... | [
"function",
"_handleSingleMutation",
"(",
"mutation",
")",
"{",
"var",
"addedNodes",
"=",
"_toArray",
"(",
"mutation",
".",
"addedNodes",
")",
";",
"var",
"addedRefs",
"=",
"addedNodes",
".",
"filter",
"(",
"_isRefNode",
")",
";",
"// assign added nodes",
"added... | Callback to detect added and removed nodes from a single mutation
@method _handleSingleMutation
@param {MutationRecord} mutation
@returns {undefined} | [
"Callback",
"to",
"detect",
"added",
"and",
"removed",
"nodes",
"from",
"a",
"single",
"mutation"
] | c98c04ee458084773fa5a3eac533da289ba4348c | https://github.com/jeremenichelli/web-component-refs/blob/c98c04ee458084773fa5a3eac533da289ba4348c/src/web-component-refs.js#L91-L103 |
44,237 | rjrodger/seneca-jsonrest-api | jsonrest-api.js | action_putpost | function action_putpost(si,args,done) {
var ent_type = parse_ent(args)
var ent = si.make(ent_type.zone,ent_type.base,ent_type.name)
var data = args.data || {}
var good = _.filter(_.keys(data),function(k){return !~k.indexOf('$')})
var fields = _.pick(data,good)
ent.data$(fields)
if( null... | javascript | function action_putpost(si,args,done) {
var ent_type = parse_ent(args)
var ent = si.make(ent_type.zone,ent_type.base,ent_type.name)
var data = args.data || {}
var good = _.filter(_.keys(data),function(k){return !~k.indexOf('$')})
var fields = _.pick(data,good)
ent.data$(fields)
if( null... | [
"function",
"action_putpost",
"(",
"si",
",",
"args",
",",
"done",
")",
"{",
"var",
"ent_type",
"=",
"parse_ent",
"(",
"args",
")",
"var",
"ent",
"=",
"si",
".",
"make",
"(",
"ent_type",
".",
"zone",
",",
"ent_type",
".",
"base",
",",
"ent_type",
"."... | lenient with PUT and POST - treat them as aliases, and both can create new entities | [
"lenient",
"with",
"PUT",
"and",
"POST",
"-",
"treat",
"them",
"as",
"aliases",
"and",
"both",
"can",
"create",
"new",
"entities"
] | b5c749de78694c599f67b999f1c1e47e36708133 | https://github.com/rjrodger/seneca-jsonrest-api/blob/b5c749de78694c599f67b999f1c1e47e36708133/jsonrest-api.js#L194-L219 |
44,238 | johnsonjo4531/videojs-gifplayer | src/plugin.js | handleVisibilityChange | function handleVisibilityChange() {
if (document[hidden]) {
let gifPlayers = document.querySelectorAll('.vjs-gifplayer');
for (let gifPlayer of gifPlayers) {
let player = gifPlayer.player;
if (player) {
player.pause();
}
}
} else {
autoPlayGifs();
}
} | javascript | function handleVisibilityChange() {
if (document[hidden]) {
let gifPlayers = document.querySelectorAll('.vjs-gifplayer');
for (let gifPlayer of gifPlayers) {
let player = gifPlayer.player;
if (player) {
player.pause();
}
}
} else {
autoPlayGifs();
}
} | [
"function",
"handleVisibilityChange",
"(",
")",
"{",
"if",
"(",
"document",
"[",
"hidden",
"]",
")",
"{",
"let",
"gifPlayers",
"=",
"document",
".",
"querySelectorAll",
"(",
"'.vjs-gifplayer'",
")",
";",
"for",
"(",
"let",
"gifPlayer",
"of",
"gifPlayers",
")... | If the page is hidden, pause the video; if the page is shown, play the video | [
"If",
"the",
"page",
"is",
"hidden",
"pause",
"the",
"video",
";",
"if",
"the",
"page",
"is",
"shown",
"play",
"the",
"video"
] | 101c4f6f791e33c3185e4ba2e380177447bee125 | https://github.com/johnsonjo4531/videojs-gifplayer/blob/101c4f6f791e33c3185e4ba2e380177447bee125/src/plugin.js#L98-L112 |
44,239 | bodil/pink | lib/mousetrap.js | _getKeyInfo | function _getKeyInfo(combination, action) {
var keys,
key,
i,
modifiers = [];
// take the keys from this pattern and figure out what the actual
// pattern is all about
keys = _keysFromString(combination);
for (i = 0; i < keys.length; ++i) {
key = keys[i];
// normalize key names
... | javascript | function _getKeyInfo(combination, action) {
var keys,
key,
i,
modifiers = [];
// take the keys from this pattern and figure out what the actual
// pattern is all about
keys = _keysFromString(combination);
for (i = 0; i < keys.length; ++i) {
key = keys[i];
// normalize key names
... | [
"function",
"_getKeyInfo",
"(",
"combination",
",",
"action",
")",
"{",
"var",
"keys",
",",
"key",
",",
"i",
",",
"modifiers",
"=",
"[",
"]",
";",
"// take the keys from this pattern and figure out what the actual",
"// pattern is all about",
"keys",
"=",
"_keysFromSt... | Gets info for a specific key combination
@param {string} combination key combination ("command+s" or "a" or "*")
@param {string=} action
@returns {Object} | [
"Gets",
"info",
"for",
"a",
"specific",
"key",
"combination"
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/mousetrap.js#L735-L776 |
44,240 | bodil/pink | lib/mousetrap.js | function(keys, callback, action) {
keys = keys instanceof Array ? keys : [keys];
_bindMultiple(keys, callback, action);
return this;
} | javascript | function(keys, callback, action) {
keys = keys instanceof Array ? keys : [keys];
_bindMultiple(keys, callback, action);
return this;
} | [
"function",
"(",
"keys",
",",
"callback",
",",
"action",
")",
"{",
"keys",
"=",
"keys",
"instanceof",
"Array",
"?",
"keys",
":",
"[",
"keys",
"]",
";",
"_bindMultiple",
"(",
"keys",
",",
"callback",
",",
"action",
")",
";",
"return",
"this",
";",
"}"... | binds an event to mousetrap
can be a single key, a combination of keys separated with +,
an array of keys, or a sequence of keys separated by spaces
be sure to list the modifier keys first to make sure that the
correct key ends up getting bound (the last key in the pattern)
@param {string|Array} keys
@param {Functio... | [
"binds",
"an",
"event",
"to",
"mousetrap"
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/mousetrap.js#L866-L870 | |
44,241 | bodil/pink | lib/mousetrap.js | function(e, element) {
// if the element has the class "mousetrap" then no need to stop
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagNa... | javascript | function(e, element) {
// if the element has the class "mousetrap" then no need to stop
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
return false;
}
// stop for input, select, and textarea
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagNa... | [
"function",
"(",
"e",
",",
"element",
")",
"{",
"// if the element has the class \"mousetrap\" then no need to stop",
"if",
"(",
"(",
"' '",
"+",
"element",
".",
"className",
"+",
"' '",
")",
".",
"indexOf",
"(",
"' mousetrap '",
")",
">",
"-",
"1",
")",
"{",
... | should we stop this event before firing off callbacks
@param {Event} e
@param {Element} element
@return {boolean} | [
"should",
"we",
"stop",
"this",
"event",
"before",
"firing",
"off",
"callbacks"
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/mousetrap.js#L927-L936 | |
44,242 | filefog/filefog | lib/wrapper/provider_wrapper.js | function (name, transform, config, filefog_options){
this.name = name;
this.config = config || {};
this._transform = transform;
this.filefog_options = extend(true, {transform:true, include_raw:true, auto_paginate:true,root_identifier:null}, filefog_options || {});
base_provider.c... | javascript | function (name, transform, config, filefog_options){
this.name = name;
this.config = config || {};
this._transform = transform;
this.filefog_options = extend(true, {transform:true, include_raw:true, auto_paginate:true,root_identifier:null}, filefog_options || {});
base_provider.c... | [
"function",
"(",
"name",
",",
"transform",
",",
"config",
",",
"filefog_options",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"_transform",
"=",
"transform",
";",
"this",
".... | Wraps the provided base Provider constructor and provides instance variables.
@constructor ProviderWrapper
@method ProviderWrapper
@param {String} name - the name the provider is registered with (using the use method)
@param {Transform} transform - the provider specified transforms for all the client methods.
@param {O... | [
"Wraps",
"the",
"provided",
"base",
"Provider",
"constructor",
"and",
"provides",
"instance",
"variables",
"."
] | 16040ef431e0af8aeee08b445c046a6805242cf3 | https://github.com/filefog/filefog/blob/16040ef431e0af8aeee08b445c046a6805242cf3/lib/wrapper/provider_wrapper.js#L27-L33 | |
44,243 | bodil/pink | lib/events.js | on | function on(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
emitter.addEventListener(eventName, handler);
return handler;
} | javascript | function on(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
emitter.addEventListener(eventName, handler);
return handler;
} | [
"function",
"on",
"(",
"emitter",
",",
"eventName",
",",
"handler",
",",
"context",
")",
"{",
"handler",
"=",
"context",
"?",
"handler",
".",
"bind",
"(",
"context",
")",
":",
"handler",
";",
"emitter",
".",
"addEventListener",
"(",
"eventName",
",",
"ha... | Register to receive events. | [
"Register",
"to",
"receive",
"events",
"."
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/events.js#L33-L37 |
44,244 | bodil/pink | lib/events.js | once | function once(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
let wrapper = function onceHandler(event) {
emitter.removeEventListener(eventName, onceHandler);
handler(event);
};
emitter.addEventListener(eventName, wrapper);
return wrapper;
} | javascript | function once(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
let wrapper = function onceHandler(event) {
emitter.removeEventListener(eventName, onceHandler);
handler(event);
};
emitter.addEventListener(eventName, wrapper);
return wrapper;
} | [
"function",
"once",
"(",
"emitter",
",",
"eventName",
",",
"handler",
",",
"context",
")",
"{",
"handler",
"=",
"context",
"?",
"handler",
".",
"bind",
"(",
"context",
")",
":",
"handler",
";",
"let",
"wrapper",
"=",
"function",
"onceHandler",
"(",
"even... | Register to receive one single event. | [
"Register",
"to",
"receive",
"one",
"single",
"event",
"."
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/events.js#L40-L48 |
44,245 | bodil/pink | lib/events.js | until | function until(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
let wrapper = function untilHandler(event) {
if (handler(event))
emitter.removeEventListener(eventName, untilHandler);
};
emitter.addEventListener(eventName, wrapper);
return wrapper;
} | javascript | function until(emitter, eventName, handler, context) {
handler = context ? handler.bind(context) : handler;
let wrapper = function untilHandler(event) {
if (handler(event))
emitter.removeEventListener(eventName, untilHandler);
};
emitter.addEventListener(eventName, wrapper);
return wrapper;
} | [
"function",
"until",
"(",
"emitter",
",",
"eventName",
",",
"handler",
",",
"context",
")",
"{",
"handler",
"=",
"context",
"?",
"handler",
".",
"bind",
"(",
"context",
")",
":",
"handler",
";",
"let",
"wrapper",
"=",
"function",
"untilHandler",
"(",
"ev... | Register to receive events until the handler function returns true. | [
"Register",
"to",
"receive",
"events",
"until",
"the",
"handler",
"function",
"returns",
"true",
"."
] | 1c0496e03e39b2bbc0330eb514f5f15ff965a073 | https://github.com/bodil/pink/blob/1c0496e03e39b2bbc0330eb514f5f15ff965a073/lib/events.js#L51-L59 |
44,246 | ololoepepe/vk-openapi | index.js | function(cb, settings) {
if (!VK._apiId) {
return false;
}
var url = VK._domain.main + VK._path.login + '?client_id='+VK._apiId+'&display=popup&redirect_uri=close.html&response_type=token';
if (settings && parseInt(settings, 10) > 0) {
url += '&scope=' + settings;
... | javascript | function(cb, settings) {
if (!VK._apiId) {
return false;
}
var url = VK._domain.main + VK._path.login + '?client_id='+VK._apiId+'&display=popup&redirect_uri=close.html&response_type=token';
if (settings && parseInt(settings, 10) > 0) {
url += '&scope=' + settings;
... | [
"function",
"(",
"cb",
",",
"settings",
")",
"{",
"if",
"(",
"!",
"VK",
".",
"_apiId",
")",
"{",
"return",
"false",
";",
"}",
"var",
"url",
"=",
"VK",
".",
"_domain",
".",
"main",
"+",
"VK",
".",
"_path",
".",
"login",
"+",
"'?client_id='",
"+",
... | Public VK.Auth methods | [
"Public",
"VK",
".",
"Auth",
"methods"
] | 0e2213f78b3e03c27ea908ed6041e268572211db | https://github.com/ololoepepe/vk-openapi/blob/0e2213f78b3e03c27ea908ed6041e268572211db/index.js#L416-L463 | |
44,247 | kevinconway/Defer.js | defer/defer.js | postMessage | function postMessage(ctx) {
var queue = [],
message = "nextTick";
function handle(event) {
if (event.source === ctx && event.data === message) {
if (!!event.stopPropogation) {
event.stopPropogation();
}
if (queue.length > 0) {
queue.shift()();
... | javascript | function postMessage(ctx) {
var queue = [],
message = "nextTick";
function handle(event) {
if (event.source === ctx && event.data === message) {
if (!!event.stopPropogation) {
event.stopPropogation();
}
if (queue.length > 0) {
queue.shift()();
... | [
"function",
"postMessage",
"(",
"ctx",
")",
"{",
"var",
"queue",
"=",
"[",
"]",
",",
"message",
"=",
"\"nextTick\"",
";",
"function",
"handle",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"source",
"===",
"ctx",
"&&",
"event",
".",
"data",
"==="... | window.postMessage is refered to quite a bit in articles discussing a potential setZeroTimeout for browsers. The problem it attempts to solve is that setTimeout has a minimum wait time in all browsers. This means your function is not scheduled to run on the next cycle of the event loop but, rather, at the next cycle of... | [
"window",
".",
"postMessage",
"is",
"refered",
"to",
"quite",
"a",
"bit",
"in",
"articles",
"discussing",
"a",
"potential",
"setZeroTimeout",
"for",
"browsers",
".",
"The",
"problem",
"it",
"attempts",
"to",
"solve",
"is",
"that",
"setTimeout",
"has",
"a",
"... | f8925ff6536d16eb4388487845ed603aa85d4cb4 | https://github.com/kevinconway/Defer.js/blob/f8925ff6536d16eb4388487845ed603aa85d4cb4/defer/defer.js#L58-L98 |
44,248 | mylisabox/lisa-ui | src/scripts/primus.js | send | function send(ev, data, fn) {
/* jshint validthis: true */
// ignore newListener event to avoid this error in node 0.8
// https://github.com/cayasso/primus-emitter/issues/3
if (/^(newListener|removeListener)/.test(ev)) return this;
this.emitter.send.apply(this... | javascript | function send(ev, data, fn) {
/* jshint validthis: true */
// ignore newListener event to avoid this error in node 0.8
// https://github.com/cayasso/primus-emitter/issues/3
if (/^(newListener|removeListener)/.test(ev)) return this;
this.emitter.send.apply(this... | [
"function",
"send",
"(",
"ev",
",",
"data",
",",
"fn",
")",
"{",
"/* jshint validthis: true */",
"// ignore newListener event to avoid this error in node 0.8",
"// https://github.com/cayasso/primus-emitter/issues/3",
"if",
"(",
"/",
"^(newListener|removeListener)",
"/",
".",
"t... | Emits to this Spark.
@param {String} ev The event
@param {Mixed} [data] The data to broadcast
@param {Function} [fn] The callback function
@return {Primus|Spark} this
@api public | [
"Emits",
"to",
"this",
"Spark",
"."
] | 1fa0ef0ff894882d1f982210a796d37d7aeb36e3 | https://github.com/mylisabox/lisa-ui/blob/1fa0ef0ff894882d1f982210a796d37d7aeb36e3/src/scripts/primus.js#L3352-L3359 |
44,249 | mylisabox/lisa-ui | src/scripts/primus.js | Emitter | function Emitter(conn) {
if (!(this instanceof Emitter)) return new Emitter(conn);
this.ids = 1;
this.acks = {};
this.conn = conn;
if (this.conn) this.bind();
} | javascript | function Emitter(conn) {
if (!(this instanceof Emitter)) return new Emitter(conn);
this.ids = 1;
this.acks = {};
this.conn = conn;
if (this.conn) this.bind();
} | [
"function",
"Emitter",
"(",
"conn",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Emitter",
")",
")",
"return",
"new",
"Emitter",
"(",
"conn",
")",
";",
"this",
".",
"ids",
"=",
"1",
";",
"this",
".",
"acks",
"=",
"{",
"}",
";",
"this",
... | Initialize a new `Emitter`.
@param {Primus|Spark} conn
@return {Emitter} `Emitter` instance
@api public | [
"Initialize",
"a",
"new",
"Emitter",
"."
] | 1fa0ef0ff894882d1f982210a796d37d7aeb36e3 | https://github.com/mylisabox/lisa-ui/blob/1fa0ef0ff894882d1f982210a796d37d7aeb36e3/src/scripts/primus.js#L3395-L3401 |
44,250 | Lanfei/webpack-isomorphic | example/ssr.js | renderToString | function renderToString(reactClass, data) {
let classPath = path.join(viewsDir, reactClass);
let element = React.createElement(require(classPath).default, data);
return ReactDOMServer.renderToString(element);
} | javascript | function renderToString(reactClass, data) {
let classPath = path.join(viewsDir, reactClass);
let element = React.createElement(require(classPath).default, data);
return ReactDOMServer.renderToString(element);
} | [
"function",
"renderToString",
"(",
"reactClass",
",",
"data",
")",
"{",
"let",
"classPath",
"=",
"path",
".",
"join",
"(",
"viewsDir",
",",
"reactClass",
")",
";",
"let",
"element",
"=",
"React",
".",
"createElement",
"(",
"require",
"(",
"classPath",
")",... | Render a react class to string | [
"Render",
"a",
"react",
"class",
"to",
"string"
] | 6e808f58681a3c103a81c493fdb38a702ad7daad | https://github.com/Lanfei/webpack-isomorphic/blob/6e808f58681a3c103a81c493fdb38a702ad7daad/example/ssr.js#L13-L17 |
44,251 | tanhauhau/generator-badge | lib/cmd/installed.js | installed | function installed(){
findUp('README.*')
.then(function(filepath){
if(filepath === null){
return process.cwd();
}else{
return path.resolve(filepath[0], '../');
}
})
.then(function(parent){
return config.readLocal(parent);
})
.then(data => {... | javascript | function installed(){
findUp('README.*')
.then(function(filepath){
if(filepath === null){
return process.cwd();
}else{
return path.resolve(filepath[0], '../');
}
})
.then(function(parent){
return config.readLocal(parent);
})
.then(data => {... | [
"function",
"installed",
"(",
")",
"{",
"findUp",
"(",
"'README.*'",
")",
".",
"then",
"(",
"function",
"(",
"filepath",
")",
"{",
"if",
"(",
"filepath",
"===",
"null",
")",
"{",
"return",
"process",
".",
"cwd",
"(",
")",
";",
"}",
"else",
"{",
"re... | List installed badges, based on .badge.json | [
"List",
"installed",
"badges",
"based",
"on",
".",
"badge",
".",
"json"
] | 32279bdf1eeab39fef86d8ece9f2b6b07e2b6baf | https://github.com/tanhauhau/generator-badge/blob/32279bdf1eeab39fef86d8ece9f2b6b07e2b6baf/lib/cmd/installed.js#L9-L30 |
44,252 | filefog/filefog | lib/wrapper/client_wrapper.js | function(name,transform, provider_config, credentials, filefog_options){
this.name = name;
this.config = provider_config || {};
this.credentials = credentials || {};
this.filefog_options = extend(true, {transform:true, include_raw:true, auto_paginate:true,root_identifier:null}, filefog_o... | javascript | function(name,transform, provider_config, credentials, filefog_options){
this.name = name;
this.config = provider_config || {};
this.credentials = credentials || {};
this.filefog_options = extend(true, {transform:true, include_raw:true, auto_paginate:true,root_identifier:null}, filefog_o... | [
"function",
"(",
"name",
",",
"transform",
",",
"provider_config",
",",
"credentials",
",",
"filefog_options",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"config",
"=",
"provider_config",
"||",
"{",
"}",
";",
"this",
".",
"credentials",
... | Wraps the provided base Client constructor and provides instance variables to be used by provider Clients.
@constructor ClientWrapper
@method ClientWrapper
@param {String} name - the name that the provider is registered with.
@param {Transform} transform - the provider specified transforms for all the client methods.
@... | [
"Wraps",
"the",
"provided",
"base",
"Client",
"constructor",
"and",
"provides",
"instance",
"variables",
"to",
"be",
"used",
"by",
"provider",
"Clients",
"."
] | 16040ef431e0af8aeee08b445c046a6805242cf3 | https://github.com/filefog/filefog/blob/16040ef431e0af8aeee08b445c046a6805242cf3/lib/wrapper/client_wrapper.js#L30-L38 | |
44,253 | scripting/reader | davereader.js | convertOutline | function convertOutline (jstruct) { //7/16/14 by DW
var theNewOutline = {}, atts, subs;
if (jstruct ["source:outline"] != undefined) {
if (jstruct ["@"] != undefined) {
atts = jstruct ["@"];
subs = jstruct ["source:outline"];
}
else {
atts = jstruct ["source:outline"] ["@"];
... | javascript | function convertOutline (jstruct) { //7/16/14 by DW
var theNewOutline = {}, atts, subs;
if (jstruct ["source:outline"] != undefined) {
if (jstruct ["@"] != undefined) {
atts = jstruct ["@"];
subs = jstruct ["source:outline"];
}
else {
atts = jstruct ["source:outline"] ["@"];
... | [
"function",
"convertOutline",
"(",
"jstruct",
")",
"{",
"//7/16/14 by DW",
"var",
"theNewOutline",
"=",
"{",
"}",
",",
"atts",
",",
"subs",
";",
"if",
"(",
"jstruct",
"[",
"\"source:outline\"",
"]",
"!=",
"undefined",
")",
"{",
"if",
"(",
"jstruct",
"[",
... | copy selected elements from the object from feedparser, into the item for the river | [
"copy",
"selected",
"elements",
"from",
"the",
"object",
"from",
"feedparser",
"into",
"the",
"item",
"for",
"the",
"river"
] | 40050c7ecffe0512e73c5915436358fd3f3f1032 | https://github.com/scripting/reader/blob/40050c7ecffe0512e73c5915436358fd3f3f1032/davereader.js#L1608-L1643 |
44,254 | carloscuesta/react-native-layout-debug | index.js | getDebugger | function getDebugger() {
const isCustom = arguments.length === 1;
const layoutDebug = isCustom ? new Debugger(arguments[0]) : defaultDebugger;
return isCustom ? debuggerDecorator.bind(layoutDebug) : debuggerDecorator.call(layoutDebug, ...arguments);
} | javascript | function getDebugger() {
const isCustom = arguments.length === 1;
const layoutDebug = isCustom ? new Debugger(arguments[0]) : defaultDebugger;
return isCustom ? debuggerDecorator.bind(layoutDebug) : debuggerDecorator.call(layoutDebug, ...arguments);
} | [
"function",
"getDebugger",
"(",
")",
"{",
"const",
"isCustom",
"=",
"arguments",
".",
"length",
"===",
"1",
";",
"const",
"layoutDebug",
"=",
"isCustom",
"?",
"new",
"Debugger",
"(",
"arguments",
"[",
"0",
"]",
")",
":",
"defaultDebugger",
";",
"return",
... | Wrapper for debugger decorator to allow custom params
@return {Function} | [
"Wrapper",
"for",
"debugger",
"decorator",
"to",
"allow",
"custom",
"params"
] | 77fb74185d4d6cf99f494e6196d3b8101d608e4c | https://github.com/carloscuesta/react-native-layout-debug/blob/77fb74185d4d6cf99f494e6196d3b8101d608e4c/index.js#L32-L36 |
44,255 | audiojs/web-audio-write | index.js | consume | function consume (len) {
count -= len
if (count < 0) {
count = 0;
console.warn('Not enough samples fed for the next data frame. Expected frame is ' + samplesPerFrame + ' samples ' + channels + ' channels')
}
if (!callbackMarks.length) return
for (let i = 0, l = callbackMarks.length; i < l; i++) {
c... | javascript | function consume (len) {
count -= len
if (count < 0) {
count = 0;
console.warn('Not enough samples fed for the next data frame. Expected frame is ' + samplesPerFrame + ' samples ' + channels + ' channels')
}
if (!callbackMarks.length) return
for (let i = 0, l = callbackMarks.length; i < l; i++) {
c... | [
"function",
"consume",
"(",
"len",
")",
"{",
"count",
"-=",
"len",
"if",
"(",
"count",
"<",
"0",
")",
"{",
"count",
"=",
"0",
";",
"console",
".",
"warn",
"(",
"'Not enough samples fed for the next data frame. Expected frame is '",
"+",
"samplesPerFrame",
"+",
... | walk over callback stack, invoke according callbacks | [
"walk",
"over",
"callback",
"stack",
"invoke",
"according",
"callbacks"
] | 2a1a623b98b028a9e6ff5b08601fa0324e010e74 | https://github.com/audiojs/web-audio-write/blob/2a1a623b98b028a9e6ff5b08601fa0324e010e74/index.js#L262-L280 |
44,256 | johanlahti/intro-guide-js | gulpfile.js | getLibPaths | function getLibPaths(libs, inject) {
inject = inject || false;
var libName,
libSrcs = [],
outSrcs = [];
for (libName in libs) {
libSrcs = libs[libName];
if (typeof libSrcs === "string") {
libSrcs = [libSrcs];
}
var basePath;
if (inject === true) {
// Adapt basepath for inject
basePath = path.... | javascript | function getLibPaths(libs, inject) {
inject = inject || false;
var libName,
libSrcs = [],
outSrcs = [];
for (libName in libs) {
libSrcs = libs[libName];
if (typeof libSrcs === "string") {
libSrcs = [libSrcs];
}
var basePath;
if (inject === true) {
// Adapt basepath for inject
basePath = path.... | [
"function",
"getLibPaths",
"(",
"libs",
",",
"inject",
")",
"{",
"inject",
"=",
"inject",
"||",
"false",
";",
"var",
"libName",
",",
"libSrcs",
"=",
"[",
"]",
",",
"outSrcs",
"=",
"[",
"]",
";",
"for",
"(",
"libName",
"in",
"libs",
")",
"{",
"libSr... | Adapts the lib paths for moving and injecting by
adding a basepath.
@param {Object} libs The libs in original key-value format
@param {Boolean} inject Get paths adapted for inject (if false, paths point to the lib source)
@return {Array} Array of libs | [
"Adapts",
"the",
"lib",
"paths",
"for",
"moving",
"and",
"injecting",
"by",
"adding",
"a",
"basepath",
"."
] | 02aa607dfcbe66dd19a4401c8aa900147b409196 | https://github.com/johanlahti/intro-guide-js/blob/02aa607dfcbe66dd19a4401c8aa900147b409196/gulpfile.js#L85-L112 |
44,257 | jasontbradshaw/irobot | lib/sensors.js | function (valueKey, signed) {
return function (bytes) {
var result = {};
result[valueKey] = misc.bufferToInt(bytes, signed);
return result;
};
} | javascript | function (valueKey, signed) {
return function (bytes) {
var result = {};
result[valueKey] = misc.bufferToInt(bytes, signed);
return result;
};
} | [
"function",
"(",
"valueKey",
",",
"signed",
")",
"{",
"return",
"function",
"(",
"bytes",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"result",
"[",
"valueKey",
"]",
"=",
"misc",
".",
"bufferToInt",
"(",
"bytes",
",",
"signed",
")",
";",
"return",... | build a function that takes in some bytes, parses them as an integer, and returns an object with that value assigned to the given key. | [
"build",
"a",
"function",
"that",
"takes",
"in",
"some",
"bytes",
"parses",
"them",
"as",
"an",
"integer",
"and",
"returns",
"an",
"object",
"with",
"that",
"value",
"assigned",
"to",
"the",
"given",
"key",
"."
] | 20efd28ea603c17b9c15701f4e364a4ebb507c45 | https://github.com/jasontbradshaw/irobot/blob/20efd28ea603c17b9c15701f4e364a4ebb507c45/lib/sensors.js#L10-L16 | |
44,258 | jasontbradshaw/irobot | lib/sensors.js | function (options) {
return function (bytes) {
var result = {
min: options.min,
max: options.max,
range: options.max - options.min,
raw: misc.bufferToInt(bytes)
};
result.magnitude = 1.0 * result.raw / result.range;
return result;
};
} | javascript | function (options) {
return function (bytes) {
var result = {
min: options.min,
max: options.max,
range: options.max - options.min,
raw: misc.bufferToInt(bytes)
};
result.magnitude = 1.0 * result.raw / result.range;
return result;
};
} | [
"function",
"(",
"options",
")",
"{",
"return",
"function",
"(",
"bytes",
")",
"{",
"var",
"result",
"=",
"{",
"min",
":",
"options",
".",
"min",
",",
"max",
":",
"options",
".",
"max",
",",
"range",
":",
"options",
".",
"max",
"-",
"options",
".",... | build a function that takes in some bytes, parses them as an unsigned int, and returns an object with useful data about the value's magnitude between some minimum and maximum. | [
"build",
"a",
"function",
"that",
"takes",
"in",
"some",
"bytes",
"parses",
"them",
"as",
"an",
"unsigned",
"int",
"and",
"returns",
"an",
"object",
"with",
"useful",
"data",
"about",
"the",
"value",
"s",
"magnitude",
"between",
"some",
"minimum",
"and",
"... | 20efd28ea603c17b9c15701f4e364a4ebb507c45 | https://github.com/jasontbradshaw/irobot/blob/20efd28ea603c17b9c15701f4e364a4ebb507c45/lib/sensors.js#L37-L50 | |
44,259 | jasontbradshaw/irobot | lib/sensors.js | function (name, id, bytes, parser) {
this.name = name;
this.id = id;
this.bytes = bytes;
// the parser is null by default, otherwise the specified function
this.parser = _.isFunction(parser) ? parser : function () {};
} | javascript | function (name, id, bytes, parser) {
this.name = name;
this.id = id;
this.bytes = bytes;
// the parser is null by default, otherwise the specified function
this.parser = _.isFunction(parser) ? parser : function () {};
} | [
"function",
"(",
"name",
",",
"id",
",",
"bytes",
",",
"parser",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"bytes",
"=",
"bytes",
";",
"// the parser is null by default, otherwise the specified function"... | stores data about a sensor packet, and holds a function that parses its raw bytes into a more descriptive object format. | [
"stores",
"data",
"about",
"a",
"sensor",
"packet",
"and",
"holds",
"a",
"function",
"that",
"parses",
"its",
"raw",
"bytes",
"into",
"a",
"more",
"descriptive",
"object",
"format",
"."
] | 20efd28ea603c17b9c15701f4e364a4ebb507c45 | https://github.com/jasontbradshaw/irobot/blob/20efd28ea603c17b9c15701f4e364a4ebb507c45/lib/sensors.js#L54-L61 | |
44,260 | andrewdavey/vogue | src/VogueClient.js | VogueClient | function VogueClient(clientSocket, watcher) {
this.socket = clientSocket;
this.watcher = watcher;
this.watchedFiles = {};
clientSocket.on('watch', this.handleMessage.bind(this));
clientSocket.on('disconnect', this.disconnect.bind(this));
} | javascript | function VogueClient(clientSocket, watcher) {
this.socket = clientSocket;
this.watcher = watcher;
this.watchedFiles = {};
clientSocket.on('watch', this.handleMessage.bind(this));
clientSocket.on('disconnect', this.disconnect.bind(this));
} | [
"function",
"VogueClient",
"(",
"clientSocket",
",",
"watcher",
")",
"{",
"this",
".",
"socket",
"=",
"clientSocket",
";",
"this",
".",
"watcher",
"=",
"watcher",
";",
"this",
".",
"watchedFiles",
"=",
"{",
"}",
";",
"clientSocket",
".",
"on",
"(",
"'wat... | Encapsulates a web socket client connection from a web browser. | [
"Encapsulates",
"a",
"web",
"socket",
"client",
"connection",
"from",
"a",
"web",
"browser",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/VogueClient.js#L6-L12 |
44,261 | alexindigo/configly | lib/load.js | load | function load(context)
{
var files
, layers
, cacheKey
;
// TODO: make it proper optional param
context = context || {};
// create new context
// in case if `load` called without context
context = typeOf(context) == 'function' ? context : this.new(context);
// fallback to defaults
context... | javascript | function load(context)
{
var files
, layers
, cacheKey
;
// TODO: make it proper optional param
context = context || {};
// create new context
// in case if `load` called without context
context = typeOf(context) == 'function' ? context : this.new(context);
// fallback to defaults
context... | [
"function",
"load",
"(",
"context",
")",
"{",
"var",
"files",
",",
"layers",
",",
"cacheKey",
";",
"// TODO: make it proper optional param",
"context",
"=",
"context",
"||",
"{",
"}",
";",
"// create new context",
"// in case if `load` called without context",
"context"... | Loads config objects from several environment-derived files
and merges them in specific order.
By default it loads JSON files, also custom pluggable parsers are supported.
@param {function|object} [context] - custom context to use for search and loading config files
@returns {object} - result merged config object | [
"Loads",
"config",
"objects",
"from",
"several",
"environment",
"-",
"derived",
"files",
"and",
"merges",
"them",
"in",
"specific",
"order",
".",
"By",
"default",
"it",
"loads",
"JSON",
"files",
"also",
"custom",
"pluggable",
"parsers",
"are",
"supported",
"."... | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/load.js#L20-L54 |
44,262 | simbo/gulp-static-site-generator | index.js | transformChunk | function transformChunk(chunk, encoding, done) {
if (chunk.isNull()) return done();
if (chunk.isStream()) return this.emit('error', new PluginError(logFlag, 'Streaming not supported'));
if (
!(chunk.isMarkdown = options.regexpMarkdown.test(chunk.relative)) &&
!(chunk.isTemplate = options.regexpT... | javascript | function transformChunk(chunk, encoding, done) {
if (chunk.isNull()) return done();
if (chunk.isStream()) return this.emit('error', new PluginError(logFlag, 'Streaming not supported'));
if (
!(chunk.isMarkdown = options.regexpMarkdown.test(chunk.relative)) &&
!(chunk.isTemplate = options.regexpT... | [
"function",
"transformChunk",
"(",
"chunk",
",",
"encoding",
",",
"done",
")",
"{",
"if",
"(",
"chunk",
".",
"isNull",
"(",
")",
")",
"return",
"done",
"(",
")",
";",
"if",
"(",
"chunk",
".",
"isStream",
"(",
")",
")",
"return",
"this",
".",
"emit"... | transforms a stream chunk
@param {object} chunk chunk object
@param {string} encoding file encoding
@param {Function} done callback
@return {undefined} | [
"transforms",
"a",
"stream",
"chunk"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L73-L92 |
44,263 | simbo/gulp-static-site-generator | index.js | transformChunkData | function transformChunkData(chunk) {
var matter = grayMatter(String(chunk.contents)),
relPath = chunk.hasOwnProperty('data') && chunk.data.relativePath ?
chunk.data.relativePath : getRelativePath(chunk.relative),
absPath = path.normalize(path.join(options.basePath, relPath));
chunk.dat... | javascript | function transformChunkData(chunk) {
var matter = grayMatter(String(chunk.contents)),
relPath = chunk.hasOwnProperty('data') && chunk.data.relativePath ?
chunk.data.relativePath : getRelativePath(chunk.relative),
absPath = path.normalize(path.join(options.basePath, relPath));
chunk.dat... | [
"function",
"transformChunkData",
"(",
"chunk",
")",
"{",
"var",
"matter",
"=",
"grayMatter",
"(",
"String",
"(",
"chunk",
".",
"contents",
")",
")",
",",
"relPath",
"=",
"chunk",
".",
"hasOwnProperty",
"(",
"'data'",
")",
"&&",
"chunk",
".",
"data",
"."... | merge site data, options data, frontmatter data into chunk data
@param {object} chunk stream chunk object
@return {object} chunk with transformed data | [
"merge",
"site",
"data",
"options",
"data",
"frontmatter",
"data",
"into",
"chunk",
"data"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L99-L124 |
44,264 | simbo/gulp-static-site-generator | index.js | transformChunkContents | function transformChunkContents(chunk) {
var contents = String(chunk.contents);
try {
if (chunk.isMarkdown) {
contents = options.renderMarkdown(contents);
}
if (chunk.isTemplate) {
contents = options.renderTemplate(contents, chunk.data, chunk.data.srcPath);
}
chunk.... | javascript | function transformChunkContents(chunk) {
var contents = String(chunk.contents);
try {
if (chunk.isMarkdown) {
contents = options.renderMarkdown(contents);
}
if (chunk.isTemplate) {
contents = options.renderTemplate(contents, chunk.data, chunk.data.srcPath);
}
chunk.... | [
"function",
"transformChunkContents",
"(",
"chunk",
")",
"{",
"var",
"contents",
"=",
"String",
"(",
"chunk",
".",
"contents",
")",
";",
"try",
"{",
"if",
"(",
"chunk",
".",
"isMarkdown",
")",
"{",
"contents",
"=",
"options",
".",
"renderMarkdown",
"(",
... | render chunk contents with markdown renderer, wrap layout, render template
@param {object} chunk stream chunk object
@return {object} chunk with transformed contents | [
"render",
"chunk",
"contents",
"with",
"markdown",
"renderer",
"wrap",
"layout",
"render",
"template"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L131-L146 |
44,265 | simbo/gulp-static-site-generator | index.js | renderTemplate | function renderTemplate(contents, data, filename) {
if (!templateCache.hasOwnProperty(contents)) {
var jadeOptions = merge.recursive({}, options.jadeOptions, {filename: filename});
templateCache[contents] = options.jade.compile(contents, jadeOptions);
}
var locals = merge.recursive({}, data, {lo... | javascript | function renderTemplate(contents, data, filename) {
if (!templateCache.hasOwnProperty(contents)) {
var jadeOptions = merge.recursive({}, options.jadeOptions, {filename: filename});
templateCache[contents] = options.jade.compile(contents, jadeOptions);
}
var locals = merge.recursive({}, data, {lo... | [
"function",
"renderTemplate",
"(",
"contents",
",",
"data",
",",
"filename",
")",
"{",
"if",
"(",
"!",
"templateCache",
".",
"hasOwnProperty",
"(",
"contents",
")",
")",
"{",
"var",
"jadeOptions",
"=",
"merge",
".",
"recursive",
"(",
"{",
"}",
",",
"opti... | render a template string with optional data
@param {string} contents template
@param {object} data optional template data
@param {object} filename optional template path for importing/mergeing
@return {string} rendered template | [
"render",
"a",
"template",
"string",
"with",
"optional",
"data"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L155-L162 |
44,266 | simbo/gulp-static-site-generator | index.js | applyLayout | function applyLayout(chunk) {
chunk.data.contents = String(chunk.contents);
var layout = getLayout(chunk.data.layout),
contents = options.renderTemplate(layout.contents, chunk.data, layout.path);
chunk.contents = new Buffer(contents);
return chunk;
} | javascript | function applyLayout(chunk) {
chunk.data.contents = String(chunk.contents);
var layout = getLayout(chunk.data.layout),
contents = options.renderTemplate(layout.contents, chunk.data, layout.path);
chunk.contents = new Buffer(contents);
return chunk;
} | [
"function",
"applyLayout",
"(",
"chunk",
")",
"{",
"chunk",
".",
"data",
".",
"contents",
"=",
"String",
"(",
"chunk",
".",
"contents",
")",
";",
"var",
"layout",
"=",
"getLayout",
"(",
"chunk",
".",
"data",
".",
"layout",
")",
",",
"contents",
"=",
... | set chunk contents as template data property and render it with a layout
@param {object} chunk stream chunk object
@return {object} chunk with applied layout | [
"set",
"chunk",
"contents",
"as",
"template",
"data",
"property",
"and",
"render",
"it",
"with",
"a",
"layout"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L190-L196 |
44,267 | simbo/gulp-static-site-generator | index.js | getRelativePath | function getRelativePath(filePath) {
var urlPath = path.join(
path.dirname(filePath),
path.basename(filePath, path.extname(filePath))
);
if (options.slugify) {
urlPath = urlPath.split('/').map(function(part) {
return slug(part, options.slugOptions);
}).join('/');
}
ur... | javascript | function getRelativePath(filePath) {
var urlPath = path.join(
path.dirname(filePath),
path.basename(filePath, path.extname(filePath))
);
if (options.slugify) {
urlPath = urlPath.split('/').map(function(part) {
return slug(part, options.slugOptions);
}).join('/');
}
ur... | [
"function",
"getRelativePath",
"(",
"filePath",
")",
"{",
"var",
"urlPath",
"=",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"filePath",
")",
",",
"path",
".",
"basename",
"(",
"filePath",
",",
"path",
".",
"extname",
"(",
"filePath",
")",
"... | transform a src file path into an relative url path
@param {string} filePath file path
@return {string} url | [
"transform",
"a",
"src",
"file",
"path",
"into",
"an",
"relative",
"url",
"path"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L203-L216 |
44,268 | simbo/gulp-static-site-generator | index.js | getLayout | function getLayout(layout) {
if (!layoutCache.hasOwnProperty(layout)) {
var layoutContents = false,
layoutPath = path.join(
path.isAbsolute(options.layoutPath) ?
options.layoutPath : path.join(process.cwd(), options.layoutPath),
layout
);
try {
layoutCon... | javascript | function getLayout(layout) {
if (!layoutCache.hasOwnProperty(layout)) {
var layoutContents = false,
layoutPath = path.join(
path.isAbsolute(options.layoutPath) ?
options.layoutPath : path.join(process.cwd(), options.layoutPath),
layout
);
try {
layoutCon... | [
"function",
"getLayout",
"(",
"layout",
")",
"{",
"if",
"(",
"!",
"layoutCache",
".",
"hasOwnProperty",
"(",
"layout",
")",
")",
"{",
"var",
"layoutContents",
"=",
"false",
",",
"layoutPath",
"=",
"path",
".",
"join",
"(",
"path",
".",
"isAbsolute",
"(",... | read a layout file from given path; store it in cache object for further
usage; return object with layout contents and absolute path
@param {string} layout path to layout
@return {object} layout contents and path | [
"read",
"a",
"layout",
"file",
"from",
"given",
"path",
";",
"store",
"it",
"in",
"cache",
"object",
"for",
"further",
"usage",
";",
"return",
"object",
"with",
"layout",
"contents",
"and",
"absolute",
"path"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L224-L243 |
44,269 | simbo/gulp-static-site-generator | index.js | logDuplicate | function logDuplicate(chunk) {
log(logFlag,
chalk.black.bgYellow('WARNING') + ' skipping ' +
chalk.magenta(chunk.data.srcRelativePath) +
' as it would output to same path as ' +
chalk.magenta(buffer[chunk.relative].data.srcRelativePath)
);
} | javascript | function logDuplicate(chunk) {
log(logFlag,
chalk.black.bgYellow('WARNING') + ' skipping ' +
chalk.magenta(chunk.data.srcRelativePath) +
' as it would output to same path as ' +
chalk.magenta(buffer[chunk.relative].data.srcRelativePath)
);
} | [
"function",
"logDuplicate",
"(",
"chunk",
")",
"{",
"log",
"(",
"logFlag",
",",
"chalk",
".",
"black",
".",
"bgYellow",
"(",
"'WARNING'",
")",
"+",
"' skipping '",
"+",
"chalk",
".",
"magenta",
"(",
"chunk",
".",
"data",
".",
"srcRelativePath",
")",
"+",... | log possible output overwrite to console
@param {object} chunk stream chunk object
@return {undefined} | [
"log",
"possible",
"output",
"overwrite",
"to",
"console"
] | 5bedaa01d6da11feb76c4c67a4d40337177d4d4f | https://github.com/simbo/gulp-static-site-generator/blob/5bedaa01d6da11feb76c4c67a4d40337177d4d4f/index.js#L250-L257 |
44,270 | alexindigo/configly | lib/include_files.js | includeFiles | function includeFiles(config, backRef)
{
backRef = backRef || [];
Object.keys(config).forEach(function(key)
{
var value, oneOffContext;
if (typeof config[key] == 'string')
{
// create temp context
oneOffContext = merge.call(cloneFunction, this, { files: [config[key]] });
// try to... | javascript | function includeFiles(config, backRef)
{
backRef = backRef || [];
Object.keys(config).forEach(function(key)
{
var value, oneOffContext;
if (typeof config[key] == 'string')
{
// create temp context
oneOffContext = merge.call(cloneFunction, this, { files: [config[key]] });
// try to... | [
"function",
"includeFiles",
"(",
"config",
",",
"backRef",
")",
"{",
"backRef",
"=",
"backRef",
"||",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"config",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"value",
",",
"oneOffContext",... | Replaces object's elements with content of corresponding files, if exist
@param {object} config - config object to process
@param {array} [backRef] - back reference to the parent element
@returns {object} - resolved object | [
"Replaces",
"object",
"s",
"elements",
"with",
"content",
"of",
"corresponding",
"files",
"if",
"exist"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/include_files.js#L21-L60 |
44,271 | jansanchez/gulp-email | lib/gulp-email.js | GulpEmail | function GulpEmail(opts, cb) {
this.fullContent = '';
this.default = {};
this.cb = cb || this.callback;
this.options = extend(this.default, opts);
this.stream = new Transform({objectMode: true});
this.stream._transform = function(chunk, encoding, callback){
var fullPath = null,
file = {},
relative = chu... | javascript | function GulpEmail(opts, cb) {
this.fullContent = '';
this.default = {};
this.cb = cb || this.callback;
this.options = extend(this.default, opts);
this.stream = new Transform({objectMode: true});
this.stream._transform = function(chunk, encoding, callback){
var fullPath = null,
file = {},
relative = chu... | [
"function",
"GulpEmail",
"(",
"opts",
",",
"cb",
")",
"{",
"this",
".",
"fullContent",
"=",
"''",
";",
"this",
".",
"default",
"=",
"{",
"}",
";",
"this",
".",
"cb",
"=",
"cb",
"||",
"this",
".",
"callback",
";",
"this",
".",
"options",
"=",
"ext... | Gulp Email. | [
"Gulp",
"Email",
"."
] | d0821e3434a13b90780581ef4752b14e422b2726 | https://github.com/jansanchez/gulp-email/blob/d0821e3434a13b90780581ef4752b14e422b2726/lib/gulp-email.js#L19-L54 |
44,272 | akabekobeko/npm-wpxml2md | src/lib/gfm.js | Cell | function Cell (node, content) {
let index = 0
if (node.parentNode && node.parentNode.childNodes) {
index = Util.arrayIndexOf(node.parentNode.childNodes, node)
}
const prefix = (index === 0 ? '| ' : ' ')
return prefix + content + ' |'
} | javascript | function Cell (node, content) {
let index = 0
if (node.parentNode && node.parentNode.childNodes) {
index = Util.arrayIndexOf(node.parentNode.childNodes, node)
}
const prefix = (index === 0 ? '| ' : ' ')
return prefix + content + ' |'
} | [
"function",
"Cell",
"(",
"node",
",",
"content",
")",
"{",
"let",
"index",
"=",
"0",
"if",
"(",
"node",
".",
"parentNode",
"&&",
"node",
".",
"parentNode",
".",
"childNodes",
")",
"{",
"index",
"=",
"Util",
".",
"arrayIndexOf",
"(",
"node",
".",
"par... | Convert the DOM node to cell text of the table.
@param {Node} node DOM node.
@param {String} content Content text.
@return {String} Cell text. | [
"Convert",
"the",
"DOM",
"node",
"to",
"cell",
"text",
"of",
"the",
"table",
"."
] | 87d81074407db4a9b8b62e17a21db13cf5d835dd | https://github.com/akabekobeko/npm-wpxml2md/blob/87d81074407db4a9b8b62e17a21db13cf5d835dd/src/lib/gfm.js#L11-L19 |
44,273 | alexindigo/configly | lib/get_var.js | getVar | function getVar(token, env)
{
var modifiers = token.split(/\s+/)
, name = modifiers.pop()
, result = ''
;
if (typeof env[name] == 'string' && env[name].length > 0)
{
result = env[name];
// process value with modifiers, right to left
result = modifiers.reverse().reduce(function(ac... | javascript | function getVar(token, env)
{
var modifiers = token.split(/\s+/)
, name = modifiers.pop()
, result = ''
;
if (typeof env[name] == 'string' && env[name].length > 0)
{
result = env[name];
// process value with modifiers, right to left
result = modifiers.reverse().reduce(function(ac... | [
"function",
"getVar",
"(",
"token",
",",
"env",
")",
"{",
"var",
"modifiers",
"=",
"token",
".",
"split",
"(",
"/",
"\\s+",
"/",
")",
",",
"name",
"=",
"modifiers",
".",
"pop",
"(",
")",
",",
"result",
"=",
"''",
";",
"if",
"(",
"typeof",
"env",
... | Gets environment variable by provided name,
or return empty string if it doesn't exists
@param {string} token - variable token (name + modifiers) to process
@param {object} env - object to search within
@returns {string} - either variable if it exists or empty string | [
"Gets",
"environment",
"variable",
"by",
"provided",
"name",
"or",
"return",
"empty",
"string",
"if",
"it",
"doesn",
"t",
"exists"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/get_var.js#L14-L36 |
44,274 | sergeche/grunt-frontend | tasks/lib/javascript.js | function(config, env) {
return env.grunt.util._.extend({
banner: '',
compress: {
warnings: false
},
mangle: {},
beautify: false,
report: false
}, env.task.options(config.uglify || {}));
} | javascript | function(config, env) {
return env.grunt.util._.extend({
banner: '',
compress: {
warnings: false
},
mangle: {},
beautify: false,
report: false
}, env.task.options(config.uglify || {}));
} | [
"function",
"(",
"config",
",",
"env",
")",
"{",
"return",
"env",
".",
"grunt",
".",
"util",
".",
"_",
".",
"extend",
"(",
"{",
"banner",
":",
"''",
",",
"compress",
":",
"{",
"warnings",
":",
"false",
"}",
",",
"mangle",
":",
"{",
"}",
",",
"b... | Returns config for UglifyJS
@param {Objecy} config Current config
@param {Objecy} env Task environment (`grunt` and `task` properties)
@return {Object} | [
"Returns",
"config",
"for",
"UglifyJS"
] | e6552c178651b40f20d4ff2e297bc3efa9446f33 | https://github.com/sergeche/grunt-frontend/blob/e6552c178651b40f20d4ff2e297bc3efa9446f33/tasks/lib/javascript.js#L51-L61 | |
44,275 | sergeche/grunt-frontend | tasks/lib/javascript.js | function(files, config, catalog, env) {
var uglifyConfig = this.uglifyConfig(config, env);
var grunt = env.grunt;
var _ = grunt.util._;
files.forEach(function(f) {
var src = validFiles(f.src, grunt, config);
var dest = utils.fileInfo(f.dest, config);
grunt.log.write('Processing ' + dest.catalogPath.cy... | javascript | function(files, config, catalog, env) {
var uglifyConfig = this.uglifyConfig(config, env);
var grunt = env.grunt;
var _ = grunt.util._;
files.forEach(function(f) {
var src = validFiles(f.src, grunt, config);
var dest = utils.fileInfo(f.dest, config);
grunt.log.write('Processing ' + dest.catalogPath.cy... | [
"function",
"(",
"files",
",",
"config",
",",
"catalog",
",",
"env",
")",
"{",
"var",
"uglifyConfig",
"=",
"this",
".",
"uglifyConfig",
"(",
"config",
",",
"env",
")",
";",
"var",
"grunt",
"=",
"env",
".",
"grunt",
";",
"var",
"_",
"=",
"grunt",
".... | Processes given JS files
@param {Array} files Normalized Grunt task file list
@param {Object} config Current task config
@param {Object} catalog Output catalog
@param {Object} env Task environment (`grunt` and `task` properties)
@return {Object} Updated catalog | [
"Processes",
"given",
"JS",
"files"
] | e6552c178651b40f20d4ff2e297bc3efa9446f33 | https://github.com/sergeche/grunt-frontend/blob/e6552c178651b40f20d4ff2e297bc3efa9446f33/tasks/lib/javascript.js#L71-L125 | |
44,276 | alexindigo/configly | lib/get_cache_key.js | getCacheKey | function getCacheKey()
{
// use the one from the context
var directories = this.directories || this.defaults.directories;
return resolveDir(directories)
+ ':'
+ getFiles.call(this, process.env).join(',')
+ ':'
+ resolveExts.call(this).join(',')
;
} | javascript | function getCacheKey()
{
// use the one from the context
var directories = this.directories || this.defaults.directories;
return resolveDir(directories)
+ ':'
+ getFiles.call(this, process.env).join(',')
+ ':'
+ resolveExts.call(this).join(',')
;
} | [
"function",
"getCacheKey",
"(",
")",
"{",
"// use the one from the context",
"var",
"directories",
"=",
"this",
".",
"directories",
"||",
"this",
".",
"defaults",
".",
"directories",
";",
"return",
"resolveDir",
"(",
"directories",
")",
"+",
"':'",
"+",
"getFile... | Generates cache key from the search directories
and provided list of parsers
@returns {string} - cache key | [
"Generates",
"cache",
"key",
"from",
"the",
"search",
"directories",
"and",
"provided",
"list",
"of",
"parsers"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/get_cache_key.js#L16-L27 |
44,277 | alexindigo/configly | lib/get_cache_key.js | resolveDir | function resolveDir(directories)
{
var directoriesAbsPath;
if (typeOf(directories) == 'array')
{
directoriesAbsPath = directories.map(function(d)
{
return path.resolve(d);
}).join('|');
}
else
{
directoriesAbsPath = path.resolve(directories);
}
return directoriesAbsPath;
} | javascript | function resolveDir(directories)
{
var directoriesAbsPath;
if (typeOf(directories) == 'array')
{
directoriesAbsPath = directories.map(function(d)
{
return path.resolve(d);
}).join('|');
}
else
{
directoriesAbsPath = path.resolve(directories);
}
return directoriesAbsPath;
} | [
"function",
"resolveDir",
"(",
"directories",
")",
"{",
"var",
"directoriesAbsPath",
";",
"if",
"(",
"typeOf",
"(",
"directories",
")",
"==",
"'array'",
")",
"{",
"directoriesAbsPath",
"=",
"directories",
".",
"map",
"(",
"function",
"(",
"d",
")",
"{",
"r... | Resolves `directories` argument into a absolute path
@param {array|string} directories - directories to resolve
@returns {string} - absolute path to the directories | [
"Resolves",
"directories",
"argument",
"into",
"a",
"absolute",
"path"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/get_cache_key.js#L35-L52 |
44,278 | CezaryDanielNowak/node-api-cache-proxy | index.js | function(href) {
var url = extract(href)
var queryObj = omit(url.qs, this.config.excludeRequestParams)
var desiredUrlParams = Object.keys(queryObj).map(function(paramName) {
return paramName + '=' + encodeURIComponent(queryObj[paramName])
}).join('&')
return desiredUrlParams ? url.url + '?' + desiredUrlP... | javascript | function(href) {
var url = extract(href)
var queryObj = omit(url.qs, this.config.excludeRequestParams)
var desiredUrlParams = Object.keys(queryObj).map(function(paramName) {
return paramName + '=' + encodeURIComponent(queryObj[paramName])
}).join('&')
return desiredUrlParams ? url.url + '?' + desiredUrlP... | [
"function",
"(",
"href",
")",
"{",
"var",
"url",
"=",
"extract",
"(",
"href",
")",
"var",
"queryObj",
"=",
"omit",
"(",
"url",
".",
"qs",
",",
"this",
".",
"config",
".",
"excludeRequestParams",
")",
"var",
"desiredUrlParams",
"=",
"Object",
".",
"keys... | clearURL takes url string as input and remove parameters, that are
listed in config.excludeRequestParams
@param {string} href
@return {string} | [
"clearURL",
"takes",
"url",
"string",
"as",
"input",
"and",
"remove",
"parameters",
"that",
"are",
"listed",
"in",
"config",
".",
"excludeRequestParams"
] | 7499f9a92161903693a49d51e615ef79b2027cb1 | https://github.com/CezaryDanielNowak/node-api-cache-proxy/blob/7499f9a92161903693a49d51e615ef79b2027cb1/index.js#L143-L152 | |
44,279 | CezaryDanielNowak/node-api-cache-proxy | index.js | function(envelope) {
var filePath = this._getFileName(envelope)
filendir.writeFile(filePath, JSON.stringify(envelope), function(err) {
if (err) {
log('File could not be saved in ' + this.config.cacheDir)
throw err
}
}.bind(this))
} | javascript | function(envelope) {
var filePath = this._getFileName(envelope)
filendir.writeFile(filePath, JSON.stringify(envelope), function(err) {
if (err) {
log('File could not be saved in ' + this.config.cacheDir)
throw err
}
}.bind(this))
} | [
"function",
"(",
"envelope",
")",
"{",
"var",
"filePath",
"=",
"this",
".",
"_getFileName",
"(",
"envelope",
")",
"filendir",
".",
"writeFile",
"(",
"filePath",
",",
"JSON",
".",
"stringify",
"(",
"envelope",
")",
",",
"function",
"(",
"err",
")",
"{",
... | Save request to file
@param {object} envelope
@return {none} | [
"Save",
"request",
"to",
"file"
] | 7499f9a92161903693a49d51e615ef79b2027cb1 | https://github.com/CezaryDanielNowak/node-api-cache-proxy/blob/7499f9a92161903693a49d51e615ef79b2027cb1/index.js#L171-L180 | |
44,280 | CezaryDanielNowak/node-api-cache-proxy | index.js | function(req, returnReference) {
getRawBody(req).then(function(bodyBuffer) {
returnReference.requestBody = bodyBuffer.toString()
}).catch(function() {
log('Unhandled error in getRawBody', arguments)
})
} | javascript | function(req, returnReference) {
getRawBody(req).then(function(bodyBuffer) {
returnReference.requestBody = bodyBuffer.toString()
}).catch(function() {
log('Unhandled error in getRawBody', arguments)
})
} | [
"function",
"(",
"req",
",",
"returnReference",
")",
"{",
"getRawBody",
"(",
"req",
")",
".",
"then",
"(",
"function",
"(",
"bodyBuffer",
")",
"{",
"returnReference",
".",
"requestBody",
"=",
"bodyBuffer",
".",
"toString",
"(",
")",
"}",
")",
".",
"catch... | POST, PUT methods' payload need to be taken out from request object.
@param {object} req Request object | [
"POST",
"PUT",
"methods",
"payload",
"need",
"to",
"be",
"taken",
"out",
"from",
"request",
"object",
"."
] | 7499f9a92161903693a49d51e615ef79b2027cb1 | https://github.com/CezaryDanielNowak/node-api-cache-proxy/blob/7499f9a92161903693a49d51e615ef79b2027cb1/index.js#L196-L202 | |
44,281 | alexindigo/configly | lib/create_new.js | createNew | function createNew(options)
{
var copy = cloneFunction(configly)
, instance = copy.bind(copy)
;
// enrich copy with helper methods
// mind baked-in context of the copies
applyProps.call(this, copy, options);
// get fresh list of filenames
// if needed
copy.files = copy.files || getFilenames.... | javascript | function createNew(options)
{
var copy = cloneFunction(configly)
, instance = copy.bind(copy)
;
// enrich copy with helper methods
// mind baked-in context of the copies
applyProps.call(this, copy, options);
// get fresh list of filenames
// if needed
copy.files = copy.files || getFilenames.... | [
"function",
"createNew",
"(",
"options",
")",
"{",
"var",
"copy",
"=",
"cloneFunction",
"(",
"configly",
")",
",",
"instance",
"=",
"copy",
".",
"bind",
"(",
"copy",
")",
";",
"// enrich copy with helper methods",
"// mind baked-in context of the copies",
"applyProp... | Creates new copy of configly
immutable to singleton modifications
which will help to keep it stable
when used with in the libraries
@param {object} [options] - custom options to set as new defaults on the new instance
@returns {function} - immutable copy of configly | [
"Creates",
"new",
"copy",
"of",
"configly",
"immutable",
"to",
"singleton",
"modifications",
"which",
"will",
"help",
"to",
"keep",
"it",
"stable",
"when",
"used",
"with",
"in",
"the",
"libraries"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/create_new.js#L19-L38 |
44,282 | alexindigo/configly | lib/create_new.js | copyProps | function copyProps(target)
{
Object.keys(this).forEach(function(key)
{
target[key] = typeof this[key] == 'function' ? this[key].bind(this) : this[key];
}.bind(this));
return target;
} | javascript | function copyProps(target)
{
Object.keys(this).forEach(function(key)
{
target[key] = typeof this[key] == 'function' ? this[key].bind(this) : this[key];
}.bind(this));
return target;
} | [
"function",
"copyProps",
"(",
"target",
")",
"{",
"Object",
".",
"keys",
"(",
"this",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"target",
"[",
"key",
"]",
"=",
"typeof",
"this",
"[",
"key",
"]",
"==",
"'function'",
"?",
"this",
"[... | Copies public properties to the provided target
@param {object} target - properties copy destination
@returns {object} - updated target object | [
"Copies",
"public",
"properties",
"to",
"the",
"provided",
"target"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/create_new.js#L80-L88 |
44,283 | alexindigo/configly | lib/create_new.js | getFilenames | function getFilenames()
{
var hostname = getHostname()
, host = hostname.split('.')[0]
;
return [
'default',
'', // allow suffixes as a basename (e.g. `environment`)
host,
hostname,
'local',
this.defaults.customIncludeFiles,
this.defaults.customEnvVars,
'runtime'
];
} | javascript | function getFilenames()
{
var hostname = getHostname()
, host = hostname.split('.')[0]
;
return [
'default',
'', // allow suffixes as a basename (e.g. `environment`)
host,
hostname,
'local',
this.defaults.customIncludeFiles,
this.defaults.customEnvVars,
'runtime'
];
} | [
"function",
"getFilenames",
"(",
")",
"{",
"var",
"hostname",
"=",
"getHostname",
"(",
")",
",",
"host",
"=",
"hostname",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
";",
"return",
"[",
"'default'",
",",
"''",
",",
"// allow suffixes as a basename (e.g. ... | Creates list of filenames to search with
@returns {array} - list of the filenames | [
"Creates",
"list",
"of",
"filenames",
"to",
"search",
"with"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/create_new.js#L105-L121 |
44,284 | kunruch/mmpilot | lib/utils.js | deepMerge | function deepMerge (base, custom) {
Object.keys(custom).forEach(function (key) {
if (!base.hasOwnProperty(key) || typeof base[key] !== 'object') {
base[key] = custom[key]
} else {
base[key] = deepMerge(base[key], custom[key])
}
})
return base
} | javascript | function deepMerge (base, custom) {
Object.keys(custom).forEach(function (key) {
if (!base.hasOwnProperty(key) || typeof base[key] !== 'object') {
base[key] = custom[key]
} else {
base[key] = deepMerge(base[key], custom[key])
}
})
return base
} | [
"function",
"deepMerge",
"(",
"base",
",",
"custom",
")",
"{",
"Object",
".",
"keys",
"(",
"custom",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"base",
".",
"hasOwnProperty",
"(",
"key",
")",
"||",
"typeof",
"base",
... | Recusrsively merge config and custom, overriding the base value with custom values | [
"Recusrsively",
"merge",
"config",
"and",
"custom",
"overriding",
"the",
"base",
"value",
"with",
"custom",
"values"
] | 7a996b632ea244c807d20673d96d4ad564666022 | https://github.com/kunruch/mmpilot/blob/7a996b632ea244c807d20673d96d4ad564666022/lib/utils.js#L6-L16 |
44,285 | kunruch/mmpilot | lib/utils.js | iterateFiles | function iterateFiles (dir, options, cb) {
var iterateOptions = {
ext: [], // extensions to look for
dirs: false, // do callback for dirs too
skip_: true, // skip files & dirs starting with _
recursive: true // do a recursive find
}
options = deepMerge(iterateOptions, options)
// console.log('o... | javascript | function iterateFiles (dir, options, cb) {
var iterateOptions = {
ext: [], // extensions to look for
dirs: false, // do callback for dirs too
skip_: true, // skip files & dirs starting with _
recursive: true // do a recursive find
}
options = deepMerge(iterateOptions, options)
// console.log('o... | [
"function",
"iterateFiles",
"(",
"dir",
",",
"options",
",",
"cb",
")",
"{",
"var",
"iterateOptions",
"=",
"{",
"ext",
":",
"[",
"]",
",",
"// extensions to look for",
"dirs",
":",
"false",
",",
"// do callback for dirs too",
"skip_",
":",
"true",
",",
"// s... | Iterates through a given folder and calls cb for each file found based on given options | [
"Iterates",
"through",
"a",
"given",
"folder",
"and",
"calls",
"cb",
"for",
"each",
"file",
"found",
"based",
"on",
"given",
"options"
] | 7a996b632ea244c807d20673d96d4ad564666022 | https://github.com/kunruch/mmpilot/blob/7a996b632ea244c807d20673d96d4ad564666022/lib/utils.js#L21-L32 |
44,286 | kunruch/mmpilot | lib/utils.js | iterateRecurse | function iterateRecurse (dir, options, cb) {
try {
var files = fs.readdirSync(dir)
files.forEach(function (file, index) {
var parsedPath = path.parse(file)
var name = parsedPath.name
var ext = parsedPath.ext
var srcpath = path.join(dir, file)
if (options.skip_ && name.charAt(0) ... | javascript | function iterateRecurse (dir, options, cb) {
try {
var files = fs.readdirSync(dir)
files.forEach(function (file, index) {
var parsedPath = path.parse(file)
var name = parsedPath.name
var ext = parsedPath.ext
var srcpath = path.join(dir, file)
if (options.skip_ && name.charAt(0) ... | [
"function",
"iterateRecurse",
"(",
"dir",
",",
"options",
",",
"cb",
")",
"{",
"try",
"{",
"var",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
"files",
".",
"forEach",
"(",
"function",
"(",
"file",
",",
"index",
")",
"{",
"var",
"parsedPa... | Private recursive method for doing the above | [
"Private",
"recursive",
"method",
"for",
"doing",
"the",
"above"
] | 7a996b632ea244c807d20673d96d4ad564666022 | https://github.com/kunruch/mmpilot/blob/7a996b632ea244c807d20673d96d4ad564666022/lib/utils.js#L37-L70 |
44,287 | revin/innertext | index.js | innertext | function innertext (html) {
// Drop everything inside <...> (i.e., tags/elements), and keep the text.
// Unlike browser innerText, this removes newlines; it also doesn't handle
// un-encoded `<` or `>` characters very well, so don't feed it malformed HTML
return entities.decode(html.split(/<[^>]+>/)
.map(fu... | javascript | function innertext (html) {
// Drop everything inside <...> (i.e., tags/elements), and keep the text.
// Unlike browser innerText, this removes newlines; it also doesn't handle
// un-encoded `<` or `>` characters very well, so don't feed it malformed HTML
return entities.decode(html.split(/<[^>]+>/)
.map(fu... | [
"function",
"innertext",
"(",
"html",
")",
"{",
"// Drop everything inside <...> (i.e., tags/elements), and keep the text.",
"// Unlike browser innerText, this removes newlines; it also doesn't handle",
"// un-encoded `<` or `>` characters very well, so don't feed it malformed HTML",
"return",
"... | Quick and dirty way of getting the text representation of a string of HTML, basically close to what a DOM node's innerText property would be | [
"Quick",
"and",
"dirty",
"way",
"of",
"getting",
"the",
"text",
"representation",
"of",
"a",
"string",
"of",
"HTML",
"basically",
"close",
"to",
"what",
"a",
"DOM",
"node",
"s",
"innerText",
"property",
"would",
"be"
] | 3fc61111e10d381dc701206e734249793eca8034 | https://github.com/revin/innertext/blob/3fc61111e10d381dc701206e734249793eca8034/index.js#L8-L17 |
44,288 | akabekobeko/npm-wpxml2md | examples/util.js | existsSync | function existsSync (path) {
try {
Fs.accessSync(Path.resolve(path), Fs.F_OK)
return true
} catch (err) {
return false
}
} | javascript | function existsSync (path) {
try {
Fs.accessSync(Path.resolve(path), Fs.F_OK)
return true
} catch (err) {
return false
}
} | [
"function",
"existsSync",
"(",
"path",
")",
"{",
"try",
"{",
"Fs",
".",
"accessSync",
"(",
"Path",
".",
"resolve",
"(",
"path",
")",
",",
"Fs",
".",
"F_OK",
")",
"return",
"true",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"false",
"}",
"}"
] | Check the existence of a file or folder.
@param {String} path Path of the file or folder.
@return {Boolean} True if exists. Otherwise false. | [
"Check",
"the",
"existence",
"of",
"a",
"file",
"or",
"folder",
"."
] | 87d81074407db4a9b8b62e17a21db13cf5d835dd | https://github.com/akabekobeko/npm-wpxml2md/blob/87d81074407db4a9b8b62e17a21db13cf5d835dd/examples/util.js#L11-L18 |
44,289 | alexindigo/configly | lib/get_files.js | getFiles | function getFiles(env)
{
var files = []
, environment = env['NODE_ENV'] || this.defaults.environment
, appInstance = env['NODE_APP_INSTANCE']
;
// generate config files variations
this.files.forEach(function(baseName)
{
// check for variables
// keep baseName if no variables found
... | javascript | function getFiles(env)
{
var files = []
, environment = env['NODE_ENV'] || this.defaults.environment
, appInstance = env['NODE_APP_INSTANCE']
;
// generate config files variations
this.files.forEach(function(baseName)
{
// check for variables
// keep baseName if no variables found
... | [
"function",
"getFiles",
"(",
"env",
")",
"{",
"var",
"files",
"=",
"[",
"]",
",",
"environment",
"=",
"env",
"[",
"'NODE_ENV'",
"]",
"||",
"this",
".",
"defaults",
".",
"environment",
",",
"appInstance",
"=",
"env",
"[",
"'NODE_APP_INSTANCE'",
"]",
";",
... | Creates list of files to load configuration from
derived from the passed environment-like object
@param {object} env - environment-like object (e.g. `process.env`)
@returns {array} - ordered list of config files to load | [
"Creates",
"list",
"of",
"files",
"to",
"load",
"configuration",
"from",
"derived",
"from",
"the",
"passed",
"environment",
"-",
"like",
"object"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/get_files.js#L15-L35 |
44,290 | alexindigo/configly | lib/merge_layers.js | mergeLayers | function mergeLayers(layers)
{
var _instance = this
, result = null
;
layers.forEach(function(layer)
{
layer.exts.forEach(function(ext)
{
ext.dirs.forEach(function(cfg)
{
// have customizable's array merge function
result = merge.call({
useCustomAdapters: ... | javascript | function mergeLayers(layers)
{
var _instance = this
, result = null
;
layers.forEach(function(layer)
{
layer.exts.forEach(function(ext)
{
ext.dirs.forEach(function(cfg)
{
// have customizable's array merge function
result = merge.call({
useCustomAdapters: ... | [
"function",
"mergeLayers",
"(",
"layers",
")",
"{",
"var",
"_instance",
"=",
"this",
",",
"result",
"=",
"null",
";",
"layers",
".",
"forEach",
"(",
"function",
"(",
"layer",
")",
"{",
"layer",
".",
"exts",
".",
"forEach",
"(",
"function",
"(",
"ext",
... | Merges provided layers into a single config object,
respecting order of the layers
@param {array} layers - list of config objects
@returns {object} - single config object | [
"Merges",
"provided",
"layers",
"into",
"a",
"single",
"config",
"object",
"respecting",
"order",
"of",
"the",
"layers"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/merge_layers.js#L13-L39 |
44,291 | noerw/gitbook-plugin-localized-footer | index.js | function() {
cfg = this.config.get('pluginsConfig.localized-footer'), _this = this;
try {
fs.statSync(this.resolve(cfg.filename));
hasFooterFile = true;
} catch (e) {
hasFooterFile = false;
return;
}
... | javascript | function() {
cfg = this.config.get('pluginsConfig.localized-footer'), _this = this;
try {
fs.statSync(this.resolve(cfg.filename));
hasFooterFile = true;
} catch (e) {
hasFooterFile = false;
return;
}
... | [
"function",
"(",
")",
"{",
"cfg",
"=",
"this",
".",
"config",
".",
"get",
"(",
"'pluginsConfig.localized-footer'",
")",
",",
"_this",
"=",
"this",
";",
"try",
"{",
"fs",
".",
"statSync",
"(",
"this",
".",
"resolve",
"(",
"cfg",
".",
"filename",
")",
... | called on each book & each language book | [
"called",
"on",
"each",
"book",
"&",
"each",
"language",
"book"
] | 6dd48632e6c39b8bb223f0aed3ee832be17dab99 | https://github.com/noerw/gitbook-plugin-localized-footer/blob/6dd48632e6c39b8bb223f0aed3ee832be17dab99/index.js#L9-L29 | |
44,292 | alexindigo/configly | lib/apply_hooks.js | applyHooks | function applyHooks(config, filename)
{
// sort hooks short first + alphabetically
Object.keys(this.hooks).sort(compareHooks).forEach(function(hook)
{
// in order to match hook should either the same length
// as the filename or smaller
if (filename.substr(0, hook.length) === hook)
{
config ... | javascript | function applyHooks(config, filename)
{
// sort hooks short first + alphabetically
Object.keys(this.hooks).sort(compareHooks).forEach(function(hook)
{
// in order to match hook should either the same length
// as the filename or smaller
if (filename.substr(0, hook.length) === hook)
{
config ... | [
"function",
"applyHooks",
"(",
"config",
",",
"filename",
")",
"{",
"// sort hooks short first + alphabetically",
"Object",
".",
"keys",
"(",
"this",
".",
"hooks",
")",
".",
"sort",
"(",
"compareHooks",
")",
".",
"forEach",
"(",
"function",
"(",
"hook",
")",
... | Applies matched hooks
@param {object} config - config object to apply hooks to
@param {string} filename - base filename to match hooks against
@returns {object} - modified config object | [
"Applies",
"matched",
"hooks"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/apply_hooks.js#L11-L25 |
44,293 | alexindigo/configly | lib/apply_hooks.js | compareHooks | function compareHooks(a, b)
{
return a.length < b.length ? -1 : (a.length > b.length ? 1 : (a < b ? -1 : (a > b ? 1 : 0)));
} | javascript | function compareHooks(a, b)
{
return a.length < b.length ? -1 : (a.length > b.length ? 1 : (a < b ? -1 : (a > b ? 1 : 0)));
} | [
"function",
"compareHooks",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"length",
"<",
"b",
".",
"length",
"?",
"-",
"1",
":",
"(",
"a",
".",
"length",
">",
"b",
".",
"length",
"?",
"1",
":",
"(",
"a",
"<",
"b",
"?",
"-",
"1",
":",
... | Compares hook names shorter to longer and alphabetically
@param {string} a - first key
@param {string} b - second key
@returns {number} -1 - `a` comes first, 0 - positions unchanged, 1 - `b` comes first | [
"Compares",
"hook",
"names",
"shorter",
"to",
"longer",
"and",
"alphabetically"
] | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/apply_hooks.js#L34-L37 |
44,294 | alexindigo/configly | lib/has_value.js | hasValue | function hasValue(value)
{
if (typeOf(value) === 'string') {
return value.length > 0;
} else {
return typeOf(value) !== 'undefined' && typeOf(value) !== 'nan';
}
} | javascript | function hasValue(value)
{
if (typeOf(value) === 'string') {
return value.length > 0;
} else {
return typeOf(value) !== 'undefined' && typeOf(value) !== 'nan';
}
} | [
"function",
"hasValue",
"(",
"value",
")",
"{",
"if",
"(",
"typeOf",
"(",
"value",
")",
"===",
"'string'",
")",
"{",
"return",
"value",
".",
"length",
">",
"0",
";",
"}",
"else",
"{",
"return",
"typeOf",
"(",
"value",
")",
"!==",
"'undefined'",
"&&",... | Checks if provided variable has value,
consider empty only if it's a string and has zero length, or it's NaN,
or it's `undefined` value, everything else consider a legit value
@param {mixed} value - string to check
@returns {boolean} - true is string is not empty, false otherwise | [
"Checks",
"if",
"provided",
"variable",
"has",
"value",
"consider",
"empty",
"only",
"if",
"it",
"s",
"a",
"string",
"and",
"has",
"zero",
"length",
"or",
"it",
"s",
"NaN",
"or",
"it",
"s",
"undefined",
"value",
"everything",
"else",
"consider",
"a",
"le... | 026423ba0e036cf8ca33cd2fd160df519715272d | https://github.com/alexindigo/configly/blob/026423ba0e036cf8ca33cd2fd160df519715272d/lib/has_value.js#L14-L21 |
44,295 | andrewdavey/vogue | src/client/vogue-client.js | watchAllStylesheets | function watchAllStylesheets() {
var href;
for (href in stylesheets) {
if (hop.call(stylesheets, href)) {
socket.emit("watch", {
href: href
});
}
}
} | javascript | function watchAllStylesheets() {
var href;
for (href in stylesheets) {
if (hop.call(stylesheets, href)) {
socket.emit("watch", {
href: href
});
}
}
} | [
"function",
"watchAllStylesheets",
"(",
")",
"{",
"var",
"href",
";",
"for",
"(",
"href",
"in",
"stylesheets",
")",
"{",
"if",
"(",
"hop",
".",
"call",
"(",
"stylesheets",
",",
"href",
")",
")",
"{",
"socket",
".",
"emit",
"(",
"\"watch\"",
",",
"{",... | Watch for all available stylesheets. | [
"Watch",
"for",
"all",
"available",
"stylesheets",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/client/vogue-client.js#L15-L24 |
44,296 | andrewdavey/vogue | src/client/vogue-client.js | reloadStylesheet | function reloadStylesheet(href) {
var newHref = stylesheets[href].href +
(href.indexOf("?") >= 0 ? "&" : "?") +
"_vogue_nocache=" + (new Date).getTime(),
stylesheet;
// Check if the appropriate DOM Node is there.
if (!stylesheets[href].setAttribute) {
// Creat... | javascript | function reloadStylesheet(href) {
var newHref = stylesheets[href].href +
(href.indexOf("?") >= 0 ? "&" : "?") +
"_vogue_nocache=" + (new Date).getTime(),
stylesheet;
// Check if the appropriate DOM Node is there.
if (!stylesheets[href].setAttribute) {
// Creat... | [
"function",
"reloadStylesheet",
"(",
"href",
")",
"{",
"var",
"newHref",
"=",
"stylesheets",
"[",
"href",
"]",
".",
"href",
"+",
"(",
"href",
".",
"indexOf",
"(",
"\"?\"",
")",
">=",
"0",
"?",
"\"&\"",
":",
"\"?\"",
")",
"+",
"\"_vogue_nocache=\"",
"+"... | Reload a stylesheet.
@param {String} href The URL of the stylesheet to be reloaded. | [
"Reload",
"a",
"stylesheet",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/client/vogue-client.js#L31-L50 |
44,297 | andrewdavey/vogue | src/client/vogue-client.js | getLocalStylesheets | function getLocalStylesheets() {
/**
* Checks if the stylesheet is local.
*
* @param {Object} link The link to check for.
* @returns {Boolean}
*/
function isLocalStylesheet(link) {
var href, i, isExternal = true;
if (link.getAttribute("rel") !== "styleshee... | javascript | function getLocalStylesheets() {
/**
* Checks if the stylesheet is local.
*
* @param {Object} link The link to check for.
* @returns {Boolean}
*/
function isLocalStylesheet(link) {
var href, i, isExternal = true;
if (link.getAttribute("rel") !== "styleshee... | [
"function",
"getLocalStylesheets",
"(",
")",
"{",
"/**\n * Checks if the stylesheet is local.\n *\n * @param {Object} link The link to check for.\n * @returns {Boolean}\n */",
"function",
"isLocalStylesheet",
"(",
"link",
")",
"{",
"var",
"href",
",",
"i",... | Fetch all the local stylesheets from the page.
@returns {Object} The list of local stylesheets keyed by their base URL. | [
"Fetch",
"all",
"the",
"local",
"stylesheets",
"from",
"the",
"page",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/client/vogue-client.js#L68-L162 |
44,298 | andrewdavey/vogue | src/client/vogue-client.js | isLocalStylesheet | function isLocalStylesheet(link) {
var href, i, isExternal = true;
if (link.getAttribute("rel") !== "stylesheet") {
return false;
}
href = link.href;
for (i = 0; i < script.bases.length; i += 1) {
if (href.indexOf(script.bases[i]) > -1) {
isExtern... | javascript | function isLocalStylesheet(link) {
var href, i, isExternal = true;
if (link.getAttribute("rel") !== "stylesheet") {
return false;
}
href = link.href;
for (i = 0; i < script.bases.length; i += 1) {
if (href.indexOf(script.bases[i]) > -1) {
isExtern... | [
"function",
"isLocalStylesheet",
"(",
"link",
")",
"{",
"var",
"href",
",",
"i",
",",
"isExternal",
"=",
"true",
";",
"if",
"(",
"link",
".",
"getAttribute",
"(",
"\"rel\"",
")",
"!==",
"\"stylesheet\"",
")",
"{",
"return",
"false",
";",
"}",
"href",
"... | Checks if the stylesheet is local.
@param {Object} link The link to check for.
@returns {Boolean} | [
"Checks",
"if",
"the",
"stylesheet",
"is",
"local",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/client/vogue-client.js#L76-L91 |
44,299 | andrewdavey/vogue | src/client/vogue-client.js | getBase | function getBase(href) {
var base, j;
for (j = 0; j < script.bases.length; j += 1) {
base = script.bases[j];
if (href.indexOf(base) > -1) {
return href.substr(base.length);
}
}
return false;
} | javascript | function getBase(href) {
var base, j;
for (j = 0; j < script.bases.length; j += 1) {
base = script.bases[j];
if (href.indexOf(base) > -1) {
return href.substr(base.length);
}
}
return false;
} | [
"function",
"getBase",
"(",
"href",
")",
"{",
"var",
"base",
",",
"j",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"script",
".",
"bases",
".",
"length",
";",
"j",
"+=",
"1",
")",
"{",
"base",
"=",
"script",
".",
"bases",
"[",
"j",
"]",
... | Get the link's base URL.
@param {String} href The URL to check.
@returns {String|Boolean} The base URL, or false if no matches found. | [
"Get",
"the",
"link",
"s",
"base",
"URL",
"."
] | 46e38b373c7a86bbbb15177822e1ea3ff1ecda6c | https://github.com/andrewdavey/vogue/blob/46e38b373c7a86bbbb15177822e1ea3ff1ecda6c/src/client/vogue-client.js#L109-L118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.