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,400 | rbackhouse/mpdjs | cordova/mpdjs/jsbuild/r.js | appendToFileContents | function appendToFileContents(fileContents, singleContents, path, config, module, sourceMapGenerator) {
var refPath, sourceMapPath, resourcePath, pluginId, sourceMapLineNumber, lineCount, parts, i;
if (sourceMapGenerator) {
if (config.out) {
refPath = config.baseUrl;
... | javascript | function appendToFileContents(fileContents, singleContents, path, config, module, sourceMapGenerator) {
var refPath, sourceMapPath, resourcePath, pluginId, sourceMapLineNumber, lineCount, parts, i;
if (sourceMapGenerator) {
if (config.out) {
refPath = config.baseUrl;
... | [
"function",
"appendToFileContents",
"(",
"fileContents",
",",
"singleContents",
",",
"path",
",",
"config",
",",
"module",
",",
"sourceMapGenerator",
")",
"{",
"var",
"refPath",
",",
"sourceMapPath",
",",
"resourcePath",
",",
"pluginId",
",",
"sourceMapLineNumber",
... | Appends singleContents to fileContents and returns the result. If a sourceMapGenerator
is provided, adds singleContents to the source map.
@param {string} fileContents - The file contents to which to append singleContents
@param {string} singleContents - The additional contents to append to fileContents
@param {strin... | [
"Appends",
"singleContents",
"to",
"fileContents",
"and",
"returns",
"the",
"result",
".",
"If",
"a",
"sourceMapGenerator",
"is",
"provided",
"adds",
"singleContents",
"to",
"the",
"source",
"map",
"."
] | 23fde33a7a24ba8d516c623643e359a25a46259c | https://github.com/rbackhouse/mpdjs/blob/23fde33a7a24ba8d516c623643e359a25a46259c/cordova/mpdjs/jsbuild/r.js#L28181-L28234 |
44,401 | swordf1zh/mattermoster | app.js | onError | function onError(error) {
if (error.syscall !== 'listen') throw error;
const bind = (typeof port === 'string')
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bin... | javascript | function onError(error) {
if (error.syscall !== 'listen') throw error;
const bind = (typeof port === 'string')
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bin... | [
"function",
"onError",
"(",
"error",
")",
"{",
"if",
"(",
"error",
".",
"syscall",
"!==",
"'listen'",
")",
"throw",
"error",
";",
"const",
"bind",
"=",
"(",
"typeof",
"port",
"===",
"'string'",
")",
"?",
"'Pipe '",
"+",
"port",
":",
"'Port '",
"+",
"... | Event listener for HTTP server "error" event. | [
"Event",
"listener",
"for",
"HTTP",
"server",
"error",
"event",
"."
] | 10e6c37c80eb023ab8ab044c46445a78a18053e7 | https://github.com/swordf1zh/mattermoster/blob/10e6c37c80eb023ab8ab044c46445a78a18053e7/app.js#L119-L141 |
44,402 | KanoComputing/js-api-resource | lib/util.js | addMultipartData | function addMultipartData (formData, data) {
var key, arr, i;
for (key in data) {
if (data.hasOwnProperty(key) && key !== 'files') {
if (data[key] instanceof Array) {
arr = data[key];
for (i = 0; i < arr.length; i += 1) {
formData.append(... | javascript | function addMultipartData (formData, data) {
var key, arr, i;
for (key in data) {
if (data.hasOwnProperty(key) && key !== 'files') {
if (data[key] instanceof Array) {
arr = data[key];
for (i = 0; i < arr.length; i += 1) {
formData.append(... | [
"function",
"addMultipartData",
"(",
"formData",
",",
"data",
")",
"{",
"var",
"key",
",",
"arr",
",",
"i",
";",
"for",
"(",
"key",
"in",
"data",
")",
"{",
"if",
"(",
"data",
".",
"hasOwnProperty",
"(",
"key",
")",
"&&",
"key",
"!==",
"'files'",
")... | Helper used by `formRequestPayload` to append data to FormData instance | [
"Helper",
"used",
"by",
"formRequestPayload",
"to",
"append",
"data",
"to",
"FormData",
"instance"
] | 9f8e5a5a07402411ab2a8bbb91d7d8c094b8d9c5 | https://github.com/KanoComputing/js-api-resource/blob/9f8e5a5a07402411ab2a8bbb91d7d8c094b8d9c5/lib/util.js#L46-L62 |
44,403 | KanoComputing/js-api-resource | lib/util.js | addFiles | function addFiles (formData, files) {
var file, arr, key, i = 0, filename;
for (key in files) {
if (files.hasOwnProperty(key) && files[key]) {
if (files[key] instanceof Array) {
arr = files[key];
filename = getFilename(arr[i]) || null;
for (... | javascript | function addFiles (formData, files) {
var file, arr, key, i = 0, filename;
for (key in files) {
if (files.hasOwnProperty(key) && files[key]) {
if (files[key] instanceof Array) {
arr = files[key];
filename = getFilename(arr[i]) || null;
for (... | [
"function",
"addFiles",
"(",
"formData",
",",
"files",
")",
"{",
"var",
"file",
",",
"arr",
",",
"key",
",",
"i",
"=",
"0",
",",
"filename",
";",
"for",
"(",
"key",
"in",
"files",
")",
"{",
"if",
"(",
"files",
".",
"hasOwnProperty",
"(",
"key",
"... | Helper used by `formRequestPayload` to append files to a FormData instance | [
"Helper",
"used",
"by",
"formRequestPayload",
"to",
"append",
"files",
"to",
"a",
"FormData",
"instance"
] | 9f8e5a5a07402411ab2a8bbb91d7d8c094b8d9c5 | https://github.com/KanoComputing/js-api-resource/blob/9f8e5a5a07402411ab2a8bbb91d7d8c094b8d9c5/lib/util.js#L66-L86 |
44,404 | bigeasy/swimlane | src/swimlane.js | wrap | function wrap (factory, node, tag) {
// If there is a previous node that is not text, insert a new line to
// for
if (node.previousSibling != null && node.previousSibling.nodeType != 3) {
var newline = factory.createTextNode("\n");
body.insertBefore(newline, node);
}
var wrapper = f... | javascript | function wrap (factory, node, tag) {
// If there is a previous node that is not text, insert a new line to
// for
if (node.previousSibling != null && node.previousSibling.nodeType != 3) {
var newline = factory.createTextNode("\n");
body.insertBefore(newline, node);
}
var wrapper = f... | [
"function",
"wrap",
"(",
"factory",
",",
"node",
",",
"tag",
")",
"{",
"// If there is a previous node that is not text, insert a new line to",
"// for ",
"if",
"(",
"node",
".",
"previousSibling",
"!=",
"null",
"&&",
"node",
".",
"previousSibling",
".",
"nodeType",
... | Wraps the given node in a new element with the given tag created using the given factory. | [
"Wraps",
"the",
"given",
"node",
"in",
"a",
"new",
"element",
"with",
"the",
"given",
"tag",
"created",
"using",
"the",
"given",
"factory",
"."
] | 9e4baffa21761248b7c1a902d6a4a65fca02b3e1 | https://github.com/bigeasy/swimlane/blob/9e4baffa21761248b7c1a902d6a4a65fca02b3e1/src/swimlane.js#L615-L626 |
44,405 | bigeasy/swimlane | src/swimlane.js | text | function text (factory, node, cursor) {
// Process a text node.
var parentNode = node.parentNode;
// If the node is CDATA convert it to text.
if (node.nodeType == 4) {
var text = factory.createTextNode(node.data);
parentNode.insertBefore(text, node);
parentNode.removeChild(node);
... | javascript | function text (factory, node, cursor) {
// Process a text node.
var parentNode = node.parentNode;
// If the node is CDATA convert it to text.
if (node.nodeType == 4) {
var text = factory.createTextNode(node.data);
parentNode.insertBefore(text, node);
parentNode.removeChild(node);
... | [
"function",
"text",
"(",
"factory",
",",
"node",
",",
"cursor",
")",
"{",
"// Process a text node. ",
"var",
"parentNode",
"=",
"node",
".",
"parentNode",
";",
"// If the node is CDATA convert it to text.",
"if",
"(",
"node",
".",
"nodeType",
"==",
"4",
")",
"{"... | Called for each node, this method will normalize the node if it is a text element, but if it is not a text element nothing is done. | [
"Called",
"for",
"each",
"node",
"this",
"method",
"will",
"normalize",
"the",
"node",
"if",
"it",
"is",
"a",
"text",
"element",
"but",
"if",
"it",
"is",
"not",
"a",
"text",
"element",
"nothing",
"is",
"done",
"."
] | 9e4baffa21761248b7c1a902d6a4a65fca02b3e1 | https://github.com/bigeasy/swimlane/blob/9e4baffa21761248b7c1a902d6a4a65fca02b3e1/src/swimlane.js#L689-L727 |
44,406 | hhff/spree-ember | docs/theme/assets/vendor/foundation/js/foundation.min.js | function (selector, context) {
if (typeof selector === 'string') {
if (context) {
var cont;
if (context.jquery) {
cont = context[0];
if (!cont) {
return context;
}
} else {
cont = context;
}
return $(cont.querySelector... | javascript | function (selector, context) {
if (typeof selector === 'string') {
if (context) {
var cont;
if (context.jquery) {
cont = context[0];
if (!cont) {
return context;
}
} else {
cont = context;
}
return $(cont.querySelector... | [
"function",
"(",
"selector",
",",
"context",
")",
"{",
"if",
"(",
"typeof",
"selector",
"===",
"'string'",
")",
"{",
"if",
"(",
"context",
")",
"{",
"var",
"cont",
";",
"if",
"(",
"context",
".",
"jquery",
")",
"{",
"cont",
"=",
"context",
"[",
"0"... | private Fast Selector wrapper, returns jQuery object. Only use where getElementById is not available. | [
"private",
"Fast",
"Selector",
"wrapper",
"returns",
"jQuery",
"object",
".",
"Only",
"use",
"where",
"getElementById",
"is",
"not",
"available",
"."
] | 31aeaa7a3b909c6524d193beddea1267b211130f | https://github.com/hhff/spree-ember/blob/31aeaa7a3b909c6524d193beddea1267b211130f/docs/theme/assets/vendor/foundation/js/foundation.min.js#L49-L68 | |
44,407 | hhff/spree-ember | docs/theme/assets/vendor/foundation/js/foundation.min.js | function (init) {
var arr = [];
if (!init) {
arr.push('data');
}
if (this.namespace.length > 0) {
arr.push(this.namespace);
}
arr.push(this.name);
return arr.join('-');
} | javascript | function (init) {
var arr = [];
if (!init) {
arr.push('data');
}
if (this.namespace.length > 0) {
arr.push(this.namespace);
}
arr.push(this.name);
return arr.join('-');
} | [
"function",
"(",
"init",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"init",
")",
"{",
"arr",
".",
"push",
"(",
"'data'",
")",
";",
"}",
"if",
"(",
"this",
".",
"namespace",
".",
"length",
">",
"0",
")",
"{",
"arr",
".",
"pu... | Namespace functions. | [
"Namespace",
"functions",
"."
] | 31aeaa7a3b909c6524d193beddea1267b211130f | https://github.com/hhff/spree-ember/blob/31aeaa7a3b909c6524d193beddea1267b211130f/docs/theme/assets/vendor/foundation/js/foundation.min.js#L72-L83 | |
44,408 | hhff/spree-ember | docs/theme/assets/vendor/foundation/js/foundation.min.js | function (dropdown, target, settings, position) {
var sheet = Foundation.stylesheet,
pip_offset_base = 8;
if (dropdown.hasClass(settings.mega_class)) {
pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
} else if (this.small()) {
pip_offset_base += position.lef... | javascript | function (dropdown, target, settings, position) {
var sheet = Foundation.stylesheet,
pip_offset_base = 8;
if (dropdown.hasClass(settings.mega_class)) {
pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
} else if (this.small()) {
pip_offset_base += position.lef... | [
"function",
"(",
"dropdown",
",",
"target",
",",
"settings",
",",
"position",
")",
"{",
"var",
"sheet",
"=",
"Foundation",
".",
"stylesheet",
",",
"pip_offset_base",
"=",
"8",
";",
"if",
"(",
"dropdown",
".",
"hasClass",
"(",
"settings",
".",
"mega_class",... | Insert rule to style psuedo elements | [
"Insert",
"rule",
"to",
"style",
"psuedo",
"elements"
] | 31aeaa7a3b909c6524d193beddea1267b211130f | https://github.com/hhff/spree-ember/blob/31aeaa7a3b909c6524d193beddea1267b211130f/docs/theme/assets/vendor/foundation/js/foundation.min.js#L2355-L2396 | |
44,409 | davidfig/pixel | pixelart.js | function (x1, y1, w, h, color, c)
{
_c = c || _c
if (color)
{
_c.fillStyle = color
}
box(x1 * _scale, y1 * _scale, w * _scale, h * _scale)
} | javascript | function (x1, y1, w, h, color, c)
{
_c = c || _c
if (color)
{
_c.fillStyle = color
}
box(x1 * _scale, y1 * _scale, w * _scale, h * _scale)
} | [
"function",
"(",
"x1",
",",
"y1",
",",
"w",
",",
"h",
",",
"color",
",",
"c",
")",
"{",
"_c",
"=",
"c",
"||",
"_c",
"if",
"(",
"color",
")",
"{",
"_c",
".",
"fillStyle",
"=",
"color",
"}",
"box",
"(",
"x1",
"*",
"_scale",
",",
"y1",
"*",
... | draw and fill rectangle
@param {number} x1 - x
@param {number} y2 - y
@param {number} radius - radius
@param {string} color
@param {CanvasRenderingContext2D} [c] | [
"draw",
"and",
"fill",
"rectangle"
] | 2713a7922f9e7f4c008c0fc4ec398e9b1b64aace | https://github.com/davidfig/pixel/blob/2713a7922f9e7f4c008c0fc4ec398e9b1b64aace/pixelart.js#L68-L76 | |
44,410 | davidfig/pixel | pixelart.js | function (x0, y0, radius, color, c)
{
_c = c || _c
if (color)
{
_c.fillStyle = color
}
x0 *= _scale
y0 *= _scale
radius *= _scale
let x = radius
let y = 0
let decisionOver2 = 1 - x // Decision criterion divided by 2 evalua... | javascript | function (x0, y0, radius, color, c)
{
_c = c || _c
if (color)
{
_c.fillStyle = color
}
x0 *= _scale
y0 *= _scale
radius *= _scale
let x = radius
let y = 0
let decisionOver2 = 1 - x // Decision criterion divided by 2 evalua... | [
"function",
"(",
"x0",
",",
"y0",
",",
"radius",
",",
"color",
",",
"c",
")",
"{",
"_c",
"=",
"c",
"||",
"_c",
"if",
"(",
"color",
")",
"{",
"_c",
".",
"fillStyle",
"=",
"color",
"}",
"x0",
"*=",
"_scale",
"y0",
"*=",
"_scale",
"radius",
"*=",
... | draw and fill circle
@param {number} x0 - x-center
@param {number} y0 - y-center
@param {number} radius - radius
@param {string} color
@param {CanvasRenderingContext2D} [c] | [
"draw",
"and",
"fill",
"circle"
] | 2713a7922f9e7f4c008c0fc4ec398e9b1b64aace | https://github.com/davidfig/pixel/blob/2713a7922f9e7f4c008c0fc4ec398e9b1b64aace/pixelart.js#L158-L188 | |
44,411 | davidfig/pixel | pixelart.js | function (x0, y0, width, height, c)
{
_c = c || _c
const data = _c.getImageData(x0, y0, width, height)
const bits = data.data
const pixels = []
for (let y = 0; y < height; y += _scale)
{
for (let x = 0; x < width; x += _scale)
{
... | javascript | function (x0, y0, width, height, c)
{
_c = c || _c
const data = _c.getImageData(x0, y0, width, height)
const bits = data.data
const pixels = []
for (let y = 0; y < height; y += _scale)
{
for (let x = 0; x < width; x += _scale)
{
... | [
"function",
"(",
"x0",
",",
"y0",
",",
"width",
",",
"height",
",",
"c",
")",
"{",
"_c",
"=",
"c",
"||",
"_c",
"const",
"data",
"=",
"_c",
".",
"getImageData",
"(",
"x0",
",",
"y0",
",",
"width",
",",
"height",
")",
"const",
"bits",
"=",
"data"... | gets data for use with yy-pixel.Pixel file format
@param {number} x0 - starting point in canvas
@param {number} y0
@param {number} width
@param {number} height
@param {HTMLContext} c | [
"gets",
"data",
"for",
"use",
"with",
"yy",
"-",
"pixel",
".",
"Pixel",
"file",
"format"
] | 2713a7922f9e7f4c008c0fc4ec398e9b1b64aace | https://github.com/davidfig/pixel/blob/2713a7922f9e7f4c008c0fc4ec398e9b1b64aace/pixelart.js#L423-L447 | |
44,412 | kengz/neo4jKB | lib/parse.js | log | function log(arg) {
var str = JSON.stringify(arg)
console.log(str)
return str;
} | javascript | function log(arg) {
var str = JSON.stringify(arg)
console.log(str)
return str;
} | [
"function",
"log",
"(",
"arg",
")",
"{",
"var",
"str",
"=",
"JSON",
".",
"stringify",
"(",
"arg",
")",
"console",
".",
"log",
"(",
"str",
")",
"return",
"str",
";",
"}"
] | A conveience method. JSON-stringify the argument, logs it, and return the string.
@param {JSON} arg The JSON to be stringified.
@return {string} the stringified JSON.
/* istanbul ignore next | [
"A",
"conveience",
"method",
".",
"JSON",
"-",
"stringify",
"the",
"argument",
"logs",
"it",
"and",
"return",
"the",
"string",
"."
] | 8762390ac81974afc6bb44a2dd3c44b44aaaa09a | https://github.com/kengz/neo4jKB/blob/8762390ac81974afc6bb44a2dd3c44b44aaaa09a/lib/parse.js#L12-L16 |
44,413 | kengz/neo4jKB | lib/parse.js | picker | function picker(iteratees) {
iteratees = iteratees || ['name']
return _.partial(_.pick, _, iteratees)
} | javascript | function picker(iteratees) {
iteratees = iteratees || ['name']
return _.partial(_.pick, _, iteratees)
} | [
"function",
"picker",
"(",
"iteratees",
")",
"{",
"iteratees",
"=",
"iteratees",
"||",
"[",
"'name'",
"]",
"return",
"_",
".",
"partial",
"(",
"_",
".",
"pick",
",",
"_",
",",
"iteratees",
")",
"}"
] | For use with transform. Generate a picker function using _.pick with a supplied iteratees.
@param {string|Array} iteratees Of _.pick
@return {Function} That picks iteratees of its argument. | [
"For",
"use",
"with",
"transform",
".",
"Generate",
"a",
"picker",
"function",
"using",
"_",
".",
"pick",
"with",
"a",
"supplied",
"iteratees",
"."
] | 8762390ac81974afc6bb44a2dd3c44b44aaaa09a | https://github.com/kengz/neo4jKB/blob/8762390ac81974afc6bb44a2dd3c44b44aaaa09a/lib/parse.js#L530-L533 |
44,414 | goto-bus-stop/get-artist-title | lib/core.js | combineSplitters | function combineSplitters (splitters) {
var l = splitters.length
return function (str) {
for (var i = 0; i < l; i++) {
var result = splitters[i](str)
if (result) return result
}
}
} | javascript | function combineSplitters (splitters) {
var l = splitters.length
return function (str) {
for (var i = 0; i < l; i++) {
var result = splitters[i](str)
if (result) return result
}
}
} | [
"function",
"combineSplitters",
"(",
"splitters",
")",
"{",
"var",
"l",
"=",
"splitters",
".",
"length",
"return",
"function",
"(",
"str",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"result",
... | Return the result of the first splitter function that matches. | [
"Return",
"the",
"result",
"of",
"the",
"first",
"splitter",
"function",
"that",
"matches",
"."
] | dd233b21dba6f26bc137a68c71c35132a26f68f2 | https://github.com/goto-bus-stop/get-artist-title/blob/dd233b21dba6f26bc137a68c71c35132a26f68f2/lib/core.js#L21-L29 |
44,415 | goto-bus-stop/get-artist-title | lib/core.js | reducePlugins | function reducePlugins (plugins) {
var before = []
var split = []
var after = []
plugins.forEach(function (plugin) {
if (plugin.before) before.push(plugin.before)
if (plugin.split) split.push(plugin.split)
if (plugin.after) after.push(plugin.after)
})
return {
before: flow(before),
split... | javascript | function reducePlugins (plugins) {
var before = []
var split = []
var after = []
plugins.forEach(function (plugin) {
if (plugin.before) before.push(plugin.before)
if (plugin.split) split.push(plugin.split)
if (plugin.after) after.push(plugin.after)
})
return {
before: flow(before),
split... | [
"function",
"reducePlugins",
"(",
"plugins",
")",
"{",
"var",
"before",
"=",
"[",
"]",
"var",
"split",
"=",
"[",
"]",
"var",
"after",
"=",
"[",
"]",
"plugins",
".",
"forEach",
"(",
"function",
"(",
"plugin",
")",
"{",
"if",
"(",
"plugin",
".",
"bef... | Combine multiple plugins into a single plugin. | [
"Combine",
"multiple",
"plugins",
"into",
"a",
"single",
"plugin",
"."
] | dd233b21dba6f26bc137a68c71c35132a26f68f2 | https://github.com/goto-bus-stop/get-artist-title/blob/dd233b21dba6f26bc137a68c71c35132a26f68f2/lib/core.js#L32-L46 |
44,416 | goto-bus-stop/get-artist-title | lib/core.js | getSongArtistTitle | function getSongArtistTitle (str, options, plugins) {
if (options) {
if (options.defaultArtist) {
plugins.push(fallBackToArtist(options.defaultArtist))
}
if (options.defaultTitle) {
plugins.push(fallBackToTitle(options.defaultTitle))
}
}
var plugin = reducePlugins(plugins)
checkPlu... | javascript | function getSongArtistTitle (str, options, plugins) {
if (options) {
if (options.defaultArtist) {
plugins.push(fallBackToArtist(options.defaultArtist))
}
if (options.defaultTitle) {
plugins.push(fallBackToTitle(options.defaultTitle))
}
}
var plugin = reducePlugins(plugins)
checkPlu... | [
"function",
"getSongArtistTitle",
"(",
"str",
",",
"options",
",",
"plugins",
")",
"{",
"if",
"(",
"options",
")",
"{",
"if",
"(",
"options",
".",
"defaultArtist",
")",
"{",
"plugins",
".",
"push",
"(",
"fallBackToArtist",
"(",
"options",
".",
"defaultArti... | Get an artist name and song title from a string. | [
"Get",
"an",
"artist",
"name",
"and",
"song",
"title",
"from",
"a",
"string",
"."
] | dd233b21dba6f26bc137a68c71c35132a26f68f2 | https://github.com/goto-bus-stop/get-artist-title/blob/dd233b21dba6f26bc137a68c71c35132a26f68f2/lib/core.js#L74-L92 |
44,417 | samthor/mocha-headless-server | index.js | flatten | function flatten(test) {
return {
title: test.title,
duration: test.duration,
err: test.err ? Object.assign({}, test.err) : null,
};
} | javascript | function flatten(test) {
return {
title: test.title,
duration: test.duration,
err: test.err ? Object.assign({}, test.err) : null,
};
} | [
"function",
"flatten",
"(",
"test",
")",
"{",
"return",
"{",
"title",
":",
"test",
".",
"title",
",",
"duration",
":",
"test",
".",
"duration",
",",
"err",
":",
"test",
".",
"err",
"?",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"test",
".",
"e... | Flatten Mocha's `Test` object into plain JSON. | [
"Flatten",
"Mocha",
"s",
"Test",
"object",
"into",
"plain",
"JSON",
"."
] | d07e983726b87368160a4f9ebc37f9bbebe4b4e2 | https://github.com/samthor/mocha-headless-server/blob/d07e983726b87368160a4f9ebc37f9bbebe4b4e2/index.js#L73-L79 |
44,418 | rsamec/business-rules | dist/hobbies/node-business-rules.js | BusinessRules | function BusinessRules(Data) {
this.Data = Data;
this.MainValidator = this.createMainValidator().CreateRule("Data");
this.ValidationResult = this.MainValidator.ValidationResult;
this.HobbiesNumberValidator = this.MainValidator.Validators["Hobbies"];
} | javascript | function BusinessRules(Data) {
this.Data = Data;
this.MainValidator = this.createMainValidator().CreateRule("Data");
this.ValidationResult = this.MainValidator.ValidationResult;
this.HobbiesNumberValidator = this.MainValidator.Validators["Hobbies"];
} | [
"function",
"BusinessRules",
"(",
"Data",
")",
"{",
"this",
".",
"Data",
"=",
"Data",
";",
"this",
".",
"MainValidator",
"=",
"this",
".",
"createMainValidator",
"(",
")",
".",
"CreateRule",
"(",
"\"Data\"",
")",
";",
"this",
".",
"ValidationResult",
"=",
... | Default constructor.
@param data | [
"Default",
"constructor",
"."
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/hobbies/node-business-rules.js#L40-L46 |
44,419 | Deathspike/npm-build-tools | src/clean.js | clean | function clean(directoryPath, isRoot, done) {
fs.stat(directoryPath, function(err, stat) {
if (err) return done(isRoot ? undefined : err);
if (stat.isFile()) return fs.unlink(directoryPath, done);
fs.readdir(directoryPath, function(err, relativePaths) {
if (err) return done(err);
each(relative... | javascript | function clean(directoryPath, isRoot, done) {
fs.stat(directoryPath, function(err, stat) {
if (err) return done(isRoot ? undefined : err);
if (stat.isFile()) return fs.unlink(directoryPath, done);
fs.readdir(directoryPath, function(err, relativePaths) {
if (err) return done(err);
each(relative... | [
"function",
"clean",
"(",
"directoryPath",
",",
"isRoot",
",",
"done",
")",
"{",
"fs",
".",
"stat",
"(",
"directoryPath",
",",
"function",
"(",
"err",
",",
"stat",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"isRoot",
"?",
"undefined",
":... | Cleans the files and directories in the directory path.
@param {string} directoryPath
@param {function(Error=)} done | [
"Cleans",
"the",
"files",
"and",
"directories",
"in",
"the",
"directory",
"path",
"."
] | caf2a0933b5900e34dc093f34b070a5b947cce39 | https://github.com/Deathspike/npm-build-tools/blob/caf2a0933b5900e34dc093f34b070a5b947cce39/src/clean.js#L30-L49 |
44,420 | erdtman/content-security-policy | lib/index.js | getDirective | function getDirective (options, name) {
if (!options[name]) {
return null;
}
if (typeof options[name] === 'string') {
return name + ' ' + options[name];
}
if (Array.isArray(options[name])) {
let result = name + ' ';
options[name].forEach(value => {
result += value + ' ';
});
re... | javascript | function getDirective (options, name) {
if (!options[name]) {
return null;
}
if (typeof options[name] === 'string') {
return name + ' ' + options[name];
}
if (Array.isArray(options[name])) {
let result = name + ' ';
options[name].forEach(value => {
result += value + ' ';
});
re... | [
"function",
"getDirective",
"(",
"options",
",",
"name",
")",
"{",
"if",
"(",
"!",
"options",
"[",
"name",
"]",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"typeof",
"options",
"[",
"name",
"]",
"===",
"'string'",
")",
"{",
"return",
"name",
"... | Helper function to compile one directive. handles strings and arrays.
@param options
all options
@param name
name of the one to compile
@returns compilation of named option | [
"Helper",
"function",
"to",
"compile",
"one",
"directive",
".",
"handles",
"strings",
"and",
"arrays",
"."
] | 7803af4bec2b4b0ff7fe85b61403160373b96349 | https://github.com/erdtman/content-security-policy/blob/7803af4bec2b4b0ff7fe85b61403160373b96349/lib/index.js#L107-L125 |
44,421 | rbackhouse/mpdjs | cordova/mpdjs/plugins/cordova-plugin-file/www/requestFileSystem.js | function (file_system) {
if (file_system) {
if (successCallback) {
fileSystems.getFs(file_system.name, function (fs) {
// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)
... | javascript | function (file_system) {
if (file_system) {
if (successCallback) {
fileSystems.getFs(file_system.name, function (fs) {
// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)
... | [
"function",
"(",
"file_system",
")",
"{",
"if",
"(",
"file_system",
")",
"{",
"if",
"(",
"successCallback",
")",
"{",
"fileSystems",
".",
"getFs",
"(",
"file_system",
".",
"name",
",",
"function",
"(",
"fs",
")",
"{",
"// This should happen only on platforms t... | if successful, return a FileSystem object | [
"if",
"successful",
"return",
"a",
"FileSystem",
"object"
] | 23fde33a7a24ba8d516c623643e359a25a46259c | https://github.com/rbackhouse/mpdjs/blob/23fde33a7a24ba8d516c623643e359a25a46259c/cordova/mpdjs/plugins/cordova-plugin-file/www/requestFileSystem.js#L60-L75 | |
44,422 | seriousManual/node-piglow | lib/PiGlowBackend.js | PiGlow | function PiGlow() {
var that = this;
this._wire = null;
this._currentState = null;
Emitter.call(this);
this._initialize(function (error) {
if (error) {
that.emit('error', error);
} else {
that.emit('initialize');
}
});
} | javascript | function PiGlow() {
var that = this;
this._wire = null;
this._currentState = null;
Emitter.call(this);
this._initialize(function (error) {
if (error) {
that.emit('error', error);
} else {
that.emit('initialize');
}
});
} | [
"function",
"PiGlow",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"this",
".",
"_wire",
"=",
"null",
";",
"this",
".",
"_currentState",
"=",
"null",
";",
"Emitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_initialize",
"(",
"function",
... | command that causes the hardware board to update its LED values
PiGlow Backend
@constructor | [
"command",
"that",
"causes",
"the",
"hardware",
"board",
"to",
"update",
"its",
"LED",
"values",
"PiGlow",
"Backend"
] | 2175fda7d56a779adb4aaec29e86cbc7745809ef | https://github.com/seriousManual/node-piglow/blob/2175fda7d56a779adb4aaec29e86cbc7745809ef/lib/PiGlowBackend.js#L19-L34 |
44,423 | serban-petrescu/ui5-jsx-rm | src/visitor.js | buildErrorHandler | function buildErrorHandler(path) {
return function(node, text) {
throw path.hub.file.buildCodeFrameError(node, text);
}
} | javascript | function buildErrorHandler(path) {
return function(node, text) {
throw path.hub.file.buildCodeFrameError(node, text);
}
} | [
"function",
"buildErrorHandler",
"(",
"path",
")",
"{",
"return",
"function",
"(",
"node",
",",
"text",
")",
"{",
"throw",
"path",
".",
"hub",
".",
"file",
".",
"buildCodeFrameError",
"(",
"node",
",",
"text",
")",
";",
"}",
"}"
] | Builds an error handling function for the given path. | [
"Builds",
"an",
"error",
"handling",
"function",
"for",
"the",
"given",
"path",
"."
] | 57beb245a6c70d7fad75a69242deb0a1ee7f3ee0 | https://github.com/serban-petrescu/ui5-jsx-rm/blob/57beb245a6c70d7fad75a69242deb0a1ee7f3ee0/src/visitor.js#L16-L20 |
44,424 | dpw/node-buffer-more-ints | buffer-more-ints.js | check_value | function check_value(val, min, max) {
val = +val;
if (typeof(val) != 'number' || val < min || val > max || Math.floor(val) !== val) {
throw new TypeError("\"value\" argument is out of bounds");
}
return val;
} | javascript | function check_value(val, min, max) {
val = +val;
if (typeof(val) != 'number' || val < min || val > max || Math.floor(val) !== val) {
throw new TypeError("\"value\" argument is out of bounds");
}
return val;
} | [
"function",
"check_value",
"(",
"val",
",",
"min",
",",
"max",
")",
"{",
"val",
"=",
"+",
"val",
";",
"if",
"(",
"typeof",
"(",
"val",
")",
"!=",
"'number'",
"||",
"val",
"<",
"min",
"||",
"val",
">",
"max",
"||",
"Math",
".",
"floor",
"(",
"va... | Check that a value is an integer within the given range | [
"Check",
"that",
"a",
"value",
"is",
"an",
"integer",
"within",
"the",
"given",
"range"
] | e0909f16d6d2c8801ae0119c36486019cfd8cf31 | https://github.com/dpw/node-buffer-more-ints/blob/e0909f16d6d2c8801ae0119c36486019cfd8cf31/buffer-more-ints.js#L49-L55 |
44,425 | dpw/node-buffer-more-ints | buffer-more-ints.js | check_bounds | function check_bounds(buf, offset, len) {
if (offset < 0 || offset + len > buf.length) {
throw new RangeError("Index out of range");
}
} | javascript | function check_bounds(buf, offset, len) {
if (offset < 0 || offset + len > buf.length) {
throw new RangeError("Index out of range");
}
} | [
"function",
"check_bounds",
"(",
"buf",
",",
"offset",
",",
"len",
")",
"{",
"if",
"(",
"offset",
"<",
"0",
"||",
"offset",
"+",
"len",
">",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"RangeError",
"(",
"\"Index out of range\"",
")",
";",
"}",
"... | Check that something is within the Buffer bounds | [
"Check",
"that",
"something",
"is",
"within",
"the",
"Buffer",
"bounds"
] | e0909f16d6d2c8801ae0119c36486019cfd8cf31 | https://github.com/dpw/node-buffer-more-ints/blob/e0909f16d6d2c8801ae0119c36486019cfd8cf31/buffer-more-ints.js#L58-L62 |
44,426 | jugglinmike/compare-ast | lib/compare.js | compareAst | function compareAst(actualSrc, expectedSrc, options) {
var actualAst, expectedAst;
options = options || {};
if (!options.comparators) {
options.comparators = [];
}
/*
* A collection of comparator functions that recognize equivalent nodes
* that would otherwise be reported as unequal by simple object compar... | javascript | function compareAst(actualSrc, expectedSrc, options) {
var actualAst, expectedAst;
options = options || {};
if (!options.comparators) {
options.comparators = [];
}
/*
* A collection of comparator functions that recognize equivalent nodes
* that would otherwise be reported as unequal by simple object compar... | [
"function",
"compareAst",
"(",
"actualSrc",
",",
"expectedSrc",
",",
"options",
")",
"{",
"var",
"actualAst",
",",
"expectedAst",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"comparators",
")",
"{",
"options",
"."... | Given a "template" expected AST that defines abstract identifier names described by `options.varPattern`, "bind" those identifiers to their concrete names in the "actual" AST. | [
"Given",
"a",
"template",
"expected",
"AST",
"that",
"defines",
"abstract",
"identifier",
"names",
"described",
"by",
"options",
".",
"varPattern",
"bind",
"those",
"identifiers",
"to",
"their",
"concrete",
"names",
"in",
"the",
"actual",
"AST",
"."
] | 4329c661186c976ffe556826f518167256ca7ab3 | https://github.com/jugglinmike/compare-ast/blob/4329c661186c976ffe556826f518167256ca7ab3/lib/compare.js#L8-L89 |
44,427 | radiovisual/metalsmith-rootpath | index.js | plugin | function plugin() {
return function (files, metalsmith, done) {
Object.keys(files).forEach(function (file) {
setImmediate(done);
var pathslash = process.platform === 'win32' ? '\\' : '/';
var rootPath = '';
var levels = needles(file, pathslash);
for (var i = 0; i < levels; i++) {
rootPath += '..... | javascript | function plugin() {
return function (files, metalsmith, done) {
Object.keys(files).forEach(function (file) {
setImmediate(done);
var pathslash = process.platform === 'win32' ? '\\' : '/';
var rootPath = '';
var levels = needles(file, pathslash);
for (var i = 0; i < levels; i++) {
rootPath += '..... | [
"function",
"plugin",
"(",
")",
"{",
"return",
"function",
"(",
"files",
",",
"metalsmith",
",",
"done",
")",
"{",
"Object",
".",
"keys",
"(",
"files",
")",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"setImmediate",
"(",
"done",
")",
";"... | Metalsmith plugin that sets a `rootPath` variable on each file's metadata.
This allows you to find relative paths in your templates easily.
@return {Function} | [
"Metalsmith",
"plugin",
"that",
"sets",
"a",
"rootPath",
"variable",
"on",
"each",
"file",
"s",
"metadata",
".",
"This",
"allows",
"you",
"to",
"find",
"relative",
"paths",
"in",
"your",
"templates",
"easily",
"."
] | a649c672e25107ac190969a6db5c6a79ead0c698 | https://github.com/radiovisual/metalsmith-rootpath/blob/a649c672e25107ac190969a6db5c6a79ead0c698/index.js#L17-L32 |
44,428 | bowheart/zedux | src/utils/general.js | getDetailedObjectType | function getDetailedObjectType(thing) {
let prototype = Object.getPrototypeOf(thing)
if (!prototype) return NO_PROTOTYPE
return Object.getPrototypeOf(prototype)
? COMPLEX_OBJECT
: PLAIN_OBJECT
} | javascript | function getDetailedObjectType(thing) {
let prototype = Object.getPrototypeOf(thing)
if (!prototype) return NO_PROTOTYPE
return Object.getPrototypeOf(prototype)
? COMPLEX_OBJECT
: PLAIN_OBJECT
} | [
"function",
"getDetailedObjectType",
"(",
"thing",
")",
"{",
"let",
"prototype",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"thing",
")",
"if",
"(",
"!",
"prototype",
")",
"return",
"NO_PROTOTYPE",
"return",
"Object",
".",
"getPrototypeOf",
"(",
"prototype",
"... | Determines which kind of object an "object" is.
Objects can be prototype-less, complex, or plain. | [
"Determines",
"which",
"kind",
"of",
"object",
"an",
"object",
"is",
"."
] | f817a5e9520e0496628e94e8782134ac53ece858 | https://github.com/bowheart/zedux/blob/f817a5e9520e0496628e94e8782134ac53ece858/src/utils/general.js#L95-L103 |
44,429 | rsamec/business-rules | dist/invoice/node-business-rules.js | BusinessRules | function BusinessRules(Data) {
this.Data = Data;
this.InvoiceValidator = this.createInvoiceValidator().CreateRule("Data");
this.ValidationResult = this.InvoiceValidator.ValidationResult;
} | javascript | function BusinessRules(Data) {
this.Data = Data;
this.InvoiceValidator = this.createInvoiceValidator().CreateRule("Data");
this.ValidationResult = this.InvoiceValidator.ValidationResult;
} | [
"function",
"BusinessRules",
"(",
"Data",
")",
"{",
"this",
".",
"Data",
"=",
"Data",
";",
"this",
".",
"InvoiceValidator",
"=",
"this",
".",
"createInvoiceValidator",
"(",
")",
".",
"CreateRule",
"(",
"\"Data\"",
")",
";",
"this",
".",
"ValidationResult",
... | Default ctor.
@param Data Invoice data | [
"Default",
"ctor",
"."
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/invoice/node-business-rules.js#L25-L30 |
44,430 | rsamec/business-rules | dist/invoice/node-business-rules.js | function (args) {
args.HasError = false;
args.ErrorMessage = "";
if (this.Items !== undefined && this.Items.length === 0) {
args.HasError = true;
args.ErrorMessage = "At least one item must be on invoice.";
args... | javascript | function (args) {
args.HasError = false;
args.ErrorMessage = "";
if (this.Items !== undefined && this.Items.length === 0) {
args.HasError = true;
args.ErrorMessage = "At least one item must be on invoice.";
args... | [
"function",
"(",
"args",
")",
"{",
"args",
".",
"HasError",
"=",
"false",
";",
"args",
".",
"ErrorMessage",
"=",
"\"\"",
";",
"if",
"(",
"this",
".",
"Items",
"!==",
"undefined",
"&&",
"this",
".",
"Items",
".",
"length",
"===",
"0",
")",
"{",
"arg... | at least one item must be filled | [
"at",
"least",
"one",
"item",
"must",
"be",
"filled"
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/invoice/node-business-rules.js#L63-L73 | |
44,431 | seriousManual/node-piglow | index.js | createPiGlow | function createPiGlow(callback) {
var myPiGlow = new PiGlowBackend();
var myInterface = piGlowInterface(myPiGlow);
myPiGlow
.on('initialize', function() {
callback(null, myInterface);
})
.on('error', function(error) {
callback(error, null);
});
} | javascript | function createPiGlow(callback) {
var myPiGlow = new PiGlowBackend();
var myInterface = piGlowInterface(myPiGlow);
myPiGlow
.on('initialize', function() {
callback(null, myInterface);
})
.on('error', function(error) {
callback(error, null);
});
} | [
"function",
"createPiGlow",
"(",
"callback",
")",
"{",
"var",
"myPiGlow",
"=",
"new",
"PiGlowBackend",
"(",
")",
";",
"var",
"myInterface",
"=",
"piGlowInterface",
"(",
"myPiGlow",
")",
";",
"myPiGlow",
".",
"on",
"(",
"'initialize'",
",",
"function",
"(",
... | convenience constructor function | [
"convenience",
"constructor",
"function"
] | 2175fda7d56a779adb4aaec29e86cbc7745809ef | https://github.com/seriousManual/node-piglow/blob/2175fda7d56a779adb4aaec29e86cbc7745809ef/index.js#L10-L21 |
44,432 | dominictarr/line-graph | ruler.js | calcSteps | function calcSteps (min, max, room, width) {
var range = max - min
var i = 0, e
while(true) {
var e = Math.pow(10, i++)
if(e > 10000000000)
throw new Error('oops')
var re = range/e
var space = width*1.25
if(room / (re) > space) return e
if(room*2 / (re) > space) return e*2
... | javascript | function calcSteps (min, max, room, width) {
var range = max - min
var i = 0, e
while(true) {
var e = Math.pow(10, i++)
if(e > 10000000000)
throw new Error('oops')
var re = range/e
var space = width*1.25
if(room / (re) > space) return e
if(room*2 / (re) > space) return e*2
... | [
"function",
"calcSteps",
"(",
"min",
",",
"max",
",",
"room",
",",
"width",
")",
"{",
"var",
"range",
"=",
"max",
"-",
"min",
"var",
"i",
"=",
"0",
",",
"e",
"while",
"(",
"true",
")",
"{",
"var",
"e",
"=",
"Math",
".",
"pow",
"(",
"10",
",",... | must have range, room, and width | [
"must",
"have",
"range",
"room",
"and",
"width"
] | 81b3d0eed7b6b2809a4aff0fc990e00df325ab30 | https://github.com/dominictarr/line-graph/blob/81b3d0eed7b6b2809a4aff0fc990e00df325ab30/ruler.js#L6-L23 |
44,433 | kengz/neo4jKB | lib/query.js | postQuery | function postQuery(statArr) {
var options = {
method: 'POST',
baseUrl: this.NEO4J_BASEURL,
url: this.NEO4J_ENDPT,
headers: {
'Accept': 'application/json; charset=UTF-8',
'Content-type': 'application/json'
},
json: {
statements: statArr
// [{stateme... | javascript | function postQuery(statArr) {
var options = {
method: 'POST',
baseUrl: this.NEO4J_BASEURL,
url: this.NEO4J_ENDPT,
headers: {
'Accept': 'application/json; charset=UTF-8',
'Content-type': 'application/json'
},
json: {
statements: statArr
// [{stateme... | [
"function",
"postQuery",
"(",
"statArr",
")",
"{",
"var",
"options",
"=",
"{",
"method",
":",
"'POST'",
",",
"baseUrl",
":",
"this",
".",
"NEO4J_BASEURL",
",",
"url",
":",
"this",
".",
"NEO4J_ENDPT",
",",
"headers",
":",
"{",
"'Accept'",
":",
"'applicati... | POST a comitting query to the db.
@private
@param {Array} statArr Array of statement objects.
@param {Function} callback Function with (err, res, body) args for the query result.
@return {Promise} A promise object resolved with the query results from the request module. | [
"POST",
"a",
"comitting",
"query",
"to",
"the",
"db",
"."
] | 8762390ac81974afc6bb44a2dd3c44b44aaaa09a | https://github.com/kengz/neo4jKB/blob/8762390ac81974afc6bb44a2dd3c44b44aaaa09a/lib/query.js#L89-L108 |
44,434 | kengz/neo4jKB | lib/query.js | resolver | function resolver(obj) {
return new Promise(function(resolve, reject) {
_.isEmpty(obj.results) ? reject(new Error(JSON.stringify(obj.errors))) : resolve(obj.results);
})
} | javascript | function resolver(obj) {
return new Promise(function(resolve, reject) {
_.isEmpty(obj.results) ? reject(new Error(JSON.stringify(obj.errors))) : resolve(obj.results);
})
} | [
"function",
"resolver",
"(",
"obj",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"_",
".",
"isEmpty",
"(",
"obj",
".",
"results",
")",
"?",
"reject",
"(",
"new",
"Error",
"(",
"JSON",
".",
"stringify... | Resolver function to chain Promise to resolve results or reject errors. Used in postQuery.
@private
@param {JSON} obj Returned from the neo4j server.
@return {Promise} That resolves results or rejects errors. | [
"Resolver",
"function",
"to",
"chain",
"Promise",
"to",
"resolve",
"results",
"or",
"reject",
"errors",
".",
"Used",
"in",
"postQuery",
"."
] | 8762390ac81974afc6bb44a2dd3c44b44aaaa09a | https://github.com/kengz/neo4jKB/blob/8762390ac81974afc6bb44a2dd3c44b44aaaa09a/lib/query.js#L116-L120 |
44,435 | seriousManual/node-piglow | lib/util/valueProcessor.js | processValue | function processValue(value) {
if (isNaN(value)) return 0;
value = Math.max(MIN_VALUE, Math.min(value, MAX_VALUE));
//value is between 0 and 1, thus is interpreted as percentage
if (value < 1) value = value * MAX_VALUE;
value = parseInt(value, 10);
return value;
} | javascript | function processValue(value) {
if (isNaN(value)) return 0;
value = Math.max(MIN_VALUE, Math.min(value, MAX_VALUE));
//value is between 0 and 1, thus is interpreted as percentage
if (value < 1) value = value * MAX_VALUE;
value = parseInt(value, 10);
return value;
} | [
"function",
"processValue",
"(",
"value",
")",
"{",
"if",
"(",
"isNaN",
"(",
"value",
")",
")",
"return",
"0",
";",
"value",
"=",
"Math",
".",
"max",
"(",
"MIN_VALUE",
",",
"Math",
".",
"min",
"(",
"value",
",",
"MAX_VALUE",
")",
")",
";",
"//value... | sanitizes brightness values and does a gamma correction mapping
@param value
@return {*} | [
"sanitizes",
"brightness",
"values",
"and",
"does",
"a",
"gamma",
"correction",
"mapping"
] | 2175fda7d56a779adb4aaec29e86cbc7745809ef | https://github.com/seriousManual/node-piglow/blob/2175fda7d56a779adb4aaec29e86cbc7745809ef/lib/util/valueProcessor.js#L9-L20 |
44,436 | rsamec/business-rules | dist/vacationApproval/node-business-rules.js | function () {
if (this.Data.ExcludedDays == undefined || this.Data.ExcludedDays.length == 0)
return this.ExcludedWeekdays;
return _.union(this.ExcludedWeekdays, this.ExcludedDaysDatePart);
} | javascript | function () {
if (this.Data.ExcludedDays == undefined || this.Data.ExcludedDays.length == 0)
return this.ExcludedWeekdays;
return _.union(this.ExcludedWeekdays, this.ExcludedDaysDatePart);
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"Data",
".",
"ExcludedDays",
"==",
"undefined",
"||",
"this",
".",
"Data",
".",
"ExcludedDays",
".",
"length",
"==",
"0",
")",
"return",
"this",
".",
"ExcludedWeekdays",
";",
"return",
"_",
".",
"union... | Return days excluded out of vacation. | [
"Return",
"days",
"excluded",
"out",
"of",
"vacation",
"."
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/vacationApproval/node-business-rules.js#L289-L293 | |
44,437 | rsamec/business-rules | dist/vacationApproval/node-business-rules.js | function (config, args) {
var msg = config["Msg"];
var format = config["Format"];
if (format != undefined) {
_.extend(args, {
FormatedFrom: moment(args.From).format(format),
FormatedTo: moment(args.To).f... | javascript | function (config, args) {
var msg = config["Msg"];
var format = config["Format"];
if (format != undefined) {
_.extend(args, {
FormatedFrom: moment(args.From).format(format),
FormatedTo: moment(args.To).f... | [
"function",
"(",
"config",
",",
"args",
")",
"{",
"var",
"msg",
"=",
"config",
"[",
"\"Msg\"",
"]",
";",
"var",
"format",
"=",
"config",
"[",
"\"Format\"",
"]",
";",
"if",
"(",
"format",
"!=",
"undefined",
")",
"{",
"_",
".",
"extend",
"(",
"args",... | create custom message for validation | [
"create",
"custom",
"message",
"for",
"validation"
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/vacationApproval/node-business-rules.js#L347-L363 | |
44,438 | rsamec/business-rules | dist/vacationApproval/node-business-rules.js | function (args) {
args.HasError = false;
args.ErrorMessage = "";
//no dates - > nothing to validate
if (!_.isDate(this.From) || !_.isDate(this.To))
return;
if (self.FromDatePart.isAfter(self.ToDatePart)) {
... | javascript | function (args) {
args.HasError = false;
args.ErrorMessage = "";
//no dates - > nothing to validate
if (!_.isDate(this.From) || !_.isDate(this.To))
return;
if (self.FromDatePart.isAfter(self.ToDatePart)) {
... | [
"function",
"(",
"args",
")",
"{",
"args",
".",
"HasError",
"=",
"false",
";",
"args",
".",
"ErrorMessage",
"=",
"\"\"",
";",
"//no dates - > nothing to validate",
"if",
"(",
"!",
"_",
".",
"isDate",
"(",
"this",
".",
"From",
")",
"||",
"!",
"_",
".",
... | create validator function | [
"create",
"validator",
"function"
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/vacationApproval/node-business-rules.js#L368-L405 | |
44,439 | rsamec/business-rules | dist/vacationApproval/node-business-rules.js | function (args) {
args.HasError = false;
args.ErrorMessage = "";
var greaterThanToday = new VacationApproval.FromToDateValidator();
greaterThanToday.FromOperator = 4 /* GreaterThanEqual */;
greaterThanToday.From = new Date();
... | javascript | function (args) {
args.HasError = false;
args.ErrorMessage = "";
var greaterThanToday = new VacationApproval.FromToDateValidator();
greaterThanToday.FromOperator = 4 /* GreaterThanEqual */;
greaterThanToday.From = new Date();
... | [
"function",
"(",
"args",
")",
"{",
"args",
".",
"HasError",
"=",
"false",
";",
"args",
".",
"ErrorMessage",
"=",
"\"\"",
";",
"var",
"greaterThanToday",
"=",
"new",
"VacationApproval",
".",
"FromToDateValidator",
"(",
")",
";",
"greaterThanToday",
".",
"From... | add custom validation | [
"add",
"custom",
"validation"
] | 09be8a3764874fa2b020f0e6eae1241d0a9e94cc | https://github.com/rsamec/business-rules/blob/09be8a3764874fa2b020f0e6eae1241d0a9e94cc/dist/vacationApproval/node-business-rules.js#L517-L537 | |
44,440 | rbackhouse/mpdjs | cordova/mpdjs/plugins/cordova-plugin-file/src/browser/FileProxy.js | onError | function onError (e) {
switch (e.target.errorCode) {
case 12:
console.log('Error - Attempt to open db with a lower version than the ' +
'current one.');
break;
default:
console.log('errorCode: ' + e.target.errorC... | javascript | function onError (e) {
switch (e.target.errorCode) {
case 12:
console.log('Error - Attempt to open db with a lower version than the ' +
'current one.');
break;
default:
console.log('errorCode: ' + e.target.errorC... | [
"function",
"onError",
"(",
"e",
")",
"{",
"switch",
"(",
"e",
".",
"target",
".",
"errorCode",
")",
"{",
"case",
"12",
":",
"console",
".",
"log",
"(",
"'Error - Attempt to open db with a lower version than the '",
"+",
"'current one.'",
")",
";",
"break",
";... | Global error handler. Errors bubble from request, to transaction, to db. | [
"Global",
"error",
"handler",
".",
"Errors",
"bubble",
"from",
"request",
"to",
"transaction",
"to",
"db",
"."
] | 23fde33a7a24ba8d516c623643e359a25a46259c | https://github.com/rbackhouse/mpdjs/blob/23fde33a7a24ba8d516c623643e359a25a46259c/cordova/mpdjs/plugins/cordova-plugin-file/src/browser/FileProxy.js#L968-L979 |
44,441 | Deathspike/npm-build-tools | src/embed.js | embed | function embed(sourcePath, relativePaths, name, done) {
var items = '';
each(relativePaths, function(relativePath, next) {
var fullPath = path.join(sourcePath, relativePath);
fs.readFile(fullPath, 'utf8', function(err, text) {
if (err) return next(err);
items += ' $templateCache.put(\'' +
... | javascript | function embed(sourcePath, relativePaths, name, done) {
var items = '';
each(relativePaths, function(relativePath, next) {
var fullPath = path.join(sourcePath, relativePath);
fs.readFile(fullPath, 'utf8', function(err, text) {
if (err) return next(err);
items += ' $templateCache.put(\'' +
... | [
"function",
"embed",
"(",
"sourcePath",
",",
"relativePaths",
",",
"name",
",",
"done",
")",
"{",
"var",
"items",
"=",
"''",
";",
"each",
"(",
"relativePaths",
",",
"function",
"(",
"relativePath",
",",
"next",
")",
"{",
"var",
"fullPath",
"=",
"path",
... | Embed the relative paths in an angular-specific template wrapper.
@param {string} sourcePath
@param {Array.<string>} relativePaths
@param {string} name
@param {function(Error=)} done | [
"Embed",
"the",
"relative",
"paths",
"in",
"an",
"angular",
"-",
"specific",
"template",
"wrapper",
"."
] | caf2a0933b5900e34dc093f34b070a5b947cce39 | https://github.com/Deathspike/npm-build-tools/blob/caf2a0933b5900e34dc093f34b070a5b947cce39/src/embed.js#L36-L55 |
44,442 | Deathspike/npm-build-tools | src/embed.js | inline | function inline(text) {
var result = '';
for (var i = 0; i < text.length; i += 1) {
var value = text.charAt(i);
if (value === '\'') result += '\\\'';
else if (value === '\\') result += '\\\\';
else if (value === '\b') result += '\\b';
else if (value === '\f') result += '\\f';
else if (value ... | javascript | function inline(text) {
var result = '';
for (var i = 0; i < text.length; i += 1) {
var value = text.charAt(i);
if (value === '\'') result += '\\\'';
else if (value === '\\') result += '\\\\';
else if (value === '\b') result += '\\b';
else if (value === '\f') result += '\\f';
else if (value ... | [
"function",
"inline",
"(",
"text",
")",
"{",
"var",
"result",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"var",
"value",
"=",
"text",
".",
"charAt",
"(",
"i",
")",
... | Escapes for inline embedding.
@param {string} text
@returns {string} | [
"Escapes",
"for",
"inline",
"embedding",
"."
] | caf2a0933b5900e34dc093f34b070a5b947cce39 | https://github.com/Deathspike/npm-build-tools/blob/caf2a0933b5900e34dc093f34b070a5b947cce39/src/embed.js#L62-L76 |
44,443 | raineorshine/generator-yoga | app/index.js | parseArray | function parseArray(str) {
return R.filter(R.identity, str.split(',').map(R.invoker(0, 'trim')))
} | javascript | function parseArray(str) {
return R.filter(R.identity, str.split(',').map(R.invoker(0, 'trim')))
} | [
"function",
"parseArray",
"(",
"str",
")",
"{",
"return",
"R",
".",
"filter",
"(",
"R",
".",
"identity",
",",
"str",
".",
"split",
"(",
"','",
")",
".",
"map",
"(",
"R",
".",
"invoker",
"(",
"0",
",",
"'trim'",
")",
")",
")",
"}"
] | parse an array from a string | [
"parse",
"an",
"array",
"from",
"a",
"string"
] | 26b133ee29a8a690e208efcabbeac28fde4e93a4 | https://github.com/raineorshine/generator-yoga/blob/26b133ee29a8a690e208efcabbeac28fde4e93a4/app/index.js#L16-L18 |
44,444 | raineorshine/generator-yoga | app/index.js | stringifyIndented | function stringifyIndented(value, chr, n) {
return indent(JSON.stringify(value, null, n), chr, n).slice(chr.length * n)
} | javascript | function stringifyIndented(value, chr, n) {
return indent(JSON.stringify(value, null, n), chr, n).slice(chr.length * n)
} | [
"function",
"stringifyIndented",
"(",
"value",
",",
"chr",
",",
"n",
")",
"{",
"return",
"indent",
"(",
"JSON",
".",
"stringify",
"(",
"value",
",",
"null",
",",
"n",
")",
",",
"chr",
",",
"n",
")",
".",
"slice",
"(",
"chr",
".",
"length",
"*",
"... | stringify an object and indent everything after the opening line | [
"stringify",
"an",
"object",
"and",
"indent",
"everything",
"after",
"the",
"opening",
"line"
] | 26b133ee29a8a690e208efcabbeac28fde4e93a4 | https://github.com/raineorshine/generator-yoga/blob/26b133ee29a8a690e208efcabbeac28fde4e93a4/app/index.js#L21-L23 |
44,445 | raineorshine/generator-yoga | app/index.js | function () {
var done = this.async();
if(this.createMode) {
// copy yoga-generator itself
this.fs.copy(path.join(__dirname, '../'), this.destinationPath(), {
globOptions: {
dot: true,
ignore: [
'**/.DS_Store',
'**/.git',
'**/.git/**... | javascript | function () {
var done = this.async();
if(this.createMode) {
// copy yoga-generator itself
this.fs.copy(path.join(__dirname, '../'), this.destinationPath(), {
globOptions: {
dot: true,
ignore: [
'**/.DS_Store',
'**/.git',
'**/.git/**... | [
"function",
"(",
")",
"{",
"var",
"done",
"=",
"this",
".",
"async",
"(",
")",
";",
"if",
"(",
"this",
".",
"createMode",
")",
"{",
"// copy yoga-generator itself",
"this",
".",
"fs",
".",
"copy",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..... | Copies all files from the template directory to the destination path parsing filenames using prefixnote and running them through striate | [
"Copies",
"all",
"files",
"from",
"the",
"template",
"directory",
"to",
"the",
"destination",
"path",
"parsing",
"filenames",
"using",
"prefixnote",
"and",
"running",
"them",
"through",
"striate"
] | 26b133ee29a8a690e208efcabbeac28fde4e93a4 | https://github.com/raineorshine/generator-yoga/blob/26b133ee29a8a690e208efcabbeac28fde4e93a4/app/index.js#L106-L157 | |
44,446 | alexindigo/manifesto | manifesto.js | parseManifest | function parseManifest(manifest, docroot, callback)
{
var inCache = false
, lines = [];
// get manifest file data
fs.readFile(manifest, 'ascii', function(err, data)
{
var counter = 0;
if (err)
{
// to prevent sudden continuation
return callback(err);
}
... | javascript | function parseManifest(manifest, docroot, callback)
{
var inCache = false
, lines = [];
// get manifest file data
fs.readFile(manifest, 'ascii', function(err, data)
{
var counter = 0;
if (err)
{
// to prevent sudden continuation
return callback(err);
}
... | [
"function",
"parseManifest",
"(",
"manifest",
",",
"docroot",
",",
"callback",
")",
"{",
"var",
"inCache",
"=",
"false",
",",
"lines",
"=",
"[",
"]",
";",
"// get manifest file data",
"fs",
".",
"readFile",
"(",
"manifest",
",",
"'ascii'",
",",
"function",
... | strip cacheable items from the manifest file | [
"strip",
"cacheable",
"items",
"from",
"the",
"manifest",
"file"
] | 5ec285d3ef6db35c7c5c017694665e4b0f4119c3 | https://github.com/alexindigo/manifesto/blob/5ec285d3ef6db35c7c5c017694665e4b0f4119c3/manifesto.js#L48-L134 |
44,447 | alexindigo/manifesto | manifesto.js | addWatcher | function addWatcher(file, handler, callback)
{
fs.stat(file, function(err, stat)
{
if (err) return callback(false);
fs.watch(file, handler(file));
callback(true, stat.mtime.getTime());
});
} | javascript | function addWatcher(file, handler, callback)
{
fs.stat(file, function(err, stat)
{
if (err) return callback(false);
fs.watch(file, handler(file));
callback(true, stat.mtime.getTime());
});
} | [
"function",
"addWatcher",
"(",
"file",
",",
"handler",
",",
"callback",
")",
"{",
"fs",
".",
"stat",
"(",
"file",
",",
"function",
"(",
"err",
",",
"stat",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"false",
")",
";",
"fs",
".",
... | gets file's mtime and sets the watcher | [
"gets",
"file",
"s",
"mtime",
"and",
"sets",
"the",
"watcher"
] | 5ec285d3ef6db35c7c5c017694665e4b0f4119c3 | https://github.com/alexindigo/manifesto/blob/5ec285d3ef6db35c7c5c017694665e4b0f4119c3/manifesto.js#L137-L147 |
44,448 | alexindigo/manifesto | manifesto.js | watcher | function watcher(manifest)
{
return function(file)
{
return function(event)
{
if (event == 'change')
{
fs.stat(file, function(err, stat)
{
if (err) return; // do nothing at this point
var mtime = stat.mtime.getTime();
if (cache[manifest].version < ... | javascript | function watcher(manifest)
{
return function(file)
{
return function(event)
{
if (event == 'change')
{
fs.stat(file, function(err, stat)
{
if (err) return; // do nothing at this point
var mtime = stat.mtime.getTime();
if (cache[manifest].version < ... | [
"function",
"watcher",
"(",
"manifest",
")",
"{",
"return",
"function",
"(",
"file",
")",
"{",
"return",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
"==",
"'change'",
")",
"{",
"fs",
".",
"stat",
"(",
"file",
",",
"function",
"(",
"err",
... | generates version watcher callback going total inception | [
"generates",
"version",
"watcher",
"callback",
"going",
"total",
"inception"
] | 5ec285d3ef6db35c7c5c017694665e4b0f4119c3 | https://github.com/alexindigo/manifesto/blob/5ec285d3ef6db35c7c5c017694665e4b0f4119c3/manifesto.js#L151-L172 |
44,449 | sematext/spm-agent | lib/agent.js | Agent | function Agent (plugin) {
var events = require('events')
var util = require('util')
var eventEmitter = new events.EventEmitter()
var cluster = require('cluster')
var workerId = 0 + '-' + process.pid // 0 == Master, default
if (!cluster.isMaster) {
workerId = cluster.worker.id + '-' + process.pid
}
v... | javascript | function Agent (plugin) {
var events = require('events')
var util = require('util')
var eventEmitter = new events.EventEmitter()
var cluster = require('cluster')
var workerId = 0 + '-' + process.pid // 0 == Master, default
if (!cluster.isMaster) {
workerId = cluster.worker.id + '-' + process.pid
}
v... | [
"function",
"Agent",
"(",
"plugin",
")",
"{",
"var",
"events",
"=",
"require",
"(",
"'events'",
")",
"var",
"util",
"=",
"require",
"(",
"'util'",
")",
"var",
"eventEmitter",
"=",
"new",
"events",
".",
"EventEmitter",
"(",
")",
"var",
"cluster",
"=",
"... | Agent super class that provides an EventEmitter for 'metric' event.
In addition it fires for each added metric an event named by the property metric.name
@param {function} plugin - Function providing a plugin having start(agent) and stop method. The plugin can use agent.addMetric function.
@returns {function} an Agen... | [
"Agent",
"super",
"class",
"that",
"provides",
"an",
"EventEmitter",
"for",
"metric",
"event",
".",
"In",
"addition",
"it",
"fires",
"for",
"each",
"added",
"metric",
"an",
"event",
"named",
"by",
"the",
"property",
"metric",
".",
"name"
] | 7b98be0cfc41fb7bf7f7c605e6602148570269a3 | https://github.com/sematext/spm-agent/blob/7b98be0cfc41fb7bf7f7c605e6602148570269a3/lib/agent.js#L29-L147 |
44,450 | sematext/spm-agent | lib/agent.js | function (metric) {
metric.workerId = workerId
metric.pid = process.pid
if (!metric.sct) {
if (metric.name && /collectd/.test(metric.name)) {
metric.sct = 'OS'
} else {
metric.sct = 'APP'
}
}
if (!metric.ts) {
metric.ts = new Date().getTi... | javascript | function (metric) {
metric.workerId = workerId
metric.pid = process.pid
if (!metric.sct) {
if (metric.name && /collectd/.test(metric.name)) {
metric.sct = 'OS'
} else {
metric.sct = 'APP'
}
}
if (!metric.ts) {
metric.ts = new Date().getTi... | [
"function",
"(",
"metric",
")",
"{",
"metric",
".",
"workerId",
"=",
"workerId",
"metric",
".",
"pid",
"=",
"process",
".",
"pid",
"if",
"(",
"!",
"metric",
".",
"sct",
")",
"{",
"if",
"(",
"metric",
".",
"name",
"&&",
"/",
"collectd",
"/",
".",
... | Adds a metric value and emits event to listeners on 'metric' or metric.name
@param metric | [
"Adds",
"a",
"metric",
"value",
"and",
"emits",
"event",
"to",
"listeners",
"on",
"metric",
"or",
"metric",
".",
"name"
] | 7b98be0cfc41fb7bf7f7c605e6602148570269a3 | https://github.com/sematext/spm-agent/blob/7b98be0cfc41fb7bf7f7c605e6602148570269a3/lib/agent.js#L49-L73 | |
44,451 | reelyactive/barterer | lib/routes/whereis.js | redirect | function redirect(id, prefix, suffix, res) {
var validatedID = reelib.identifier.toIdentifierString(id);
if(validatedID && (validatedID !== id)) {
res.redirect(prefix + validatedID + suffix);
return true;
}
return false;
} | javascript | function redirect(id, prefix, suffix, res) {
var validatedID = reelib.identifier.toIdentifierString(id);
if(validatedID && (validatedID !== id)) {
res.redirect(prefix + validatedID + suffix);
return true;
}
return false;
} | [
"function",
"redirect",
"(",
"id",
",",
"prefix",
",",
"suffix",
",",
"res",
")",
"{",
"var",
"validatedID",
"=",
"reelib",
".",
"identifier",
".",
"toIdentifierString",
"(",
"id",
")",
";",
"if",
"(",
"validatedID",
"&&",
"(",
"validatedID",
"!==",
"id"... | Redirect if required and return the status.
@param {String} id The given ID.
@param {String} prefix The prefix to the ID in the path.
@param {String} suffix The suffix to the ID in the path.
@param {Object} res The HTTP result.
@return {boolean} Redirection performed? | [
"Redirect",
"if",
"required",
"and",
"return",
"the",
"status",
"."
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/routes/whereis.js#L58-L67 |
44,452 | yamadapc/airbnb-scrapper | lib/index.js | main | function main(program) {
program || (program = { args: [] });
if(program.args.length === 0) {
program.outputHelp();
return process.exit(1);
}
return Promise
.map(program.args, _.partial(exports.downloadPosting, program))
.map(function(html) {
return cheerio.load(html);
})
.map(exp... | javascript | function main(program) {
program || (program = { args: [] });
if(program.args.length === 0) {
program.outputHelp();
return process.exit(1);
}
return Promise
.map(program.args, _.partial(exports.downloadPosting, program))
.map(function(html) {
return cheerio.load(html);
})
.map(exp... | [
"function",
"main",
"(",
"program",
")",
"{",
"program",
"||",
"(",
"program",
"=",
"{",
"args",
":",
"[",
"]",
"}",
")",
";",
"if",
"(",
"program",
".",
"args",
".",
"length",
"===",
"0",
")",
"{",
"program",
".",
"outputHelp",
"(",
")",
";",
... | Takes a `program` instance from the `commander` module and executes the `cli`
functionality.
@param {Object} program A `program` object from `commander`
@return {Promise} A promise to the execution's result | [
"Takes",
"a",
"program",
"instance",
"from",
"the",
"commander",
"module",
"and",
"executes",
"the",
"cli",
"functionality",
"."
] | 7cf98ecb496e348f91568ceb5aca4cb57205ace5 | https://github.com/yamadapc/airbnb-scrapper/blob/7cf98ecb496e348f91568ceb5aca4cb57205ace5/lib/index.js#L26-L40 |
44,453 | alexindigo/mixly | append.js | mixAppend | function mixAppend(to)
{
var args = Array.prototype.slice.call(arguments)
, i = 0
;
// it will start with `1` – second argument
// leaving `to` out of the loop
while (++i < args.length)
{
copy(to, args[i]);
}
return to;
} | javascript | function mixAppend(to)
{
var args = Array.prototype.slice.call(arguments)
, i = 0
;
// it will start with `1` – second argument
// leaving `to` out of the loop
while (++i < args.length)
{
copy(to, args[i]);
}
return to;
} | [
"function",
"mixAppend",
"(",
"to",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
",",
"i",
"=",
"0",
";",
"// it will start with `1` – second argument",
"// leaving `to` out of the loop",
"while",
"("... | Merges objects into the first one
@param {object} to - object to merge into
@param {...object} from - object(s) to merge with
@returns {object} - mixed result object | [
"Merges",
"objects",
"into",
"the",
"first",
"one"
] | 602081b28806dc46286da783fef4f3ba1ecbb199 | https://github.com/alexindigo/mixly/blob/602081b28806dc46286da783fef4f3ba1ecbb199/append.js#L13-L27 |
44,454 | weswigham/not.js | not.js | function(rec, key) {
return (function() {
if (typeof key === "symbol") {
return undefined;
}
if (key === scopeName) {
return scope;
}
if (key === indicator) {
return proxy;
}
if (key.sli... | javascript | function(rec, key) {
return (function() {
if (typeof key === "symbol") {
return undefined;
}
if (key === scopeName) {
return scope;
}
if (key === indicator) {
return proxy;
}
if (key.sli... | [
"function",
"(",
"rec",
",",
"key",
")",
"{",
"return",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"key",
"===",
"\"symbol\"",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"key",
"===",
"scopeName",
")",
"{",
"return",
"scope",
"... | New version of the has-all-the-things trap | [
"New",
"version",
"of",
"the",
"has",
"-",
"all",
"-",
"the",
"-",
"things",
"trap"
] | 58688349c9945e1d56ab2864e942c8f3e2e7cb55 | https://github.com/weswigham/not.js/blob/58688349c9945e1d56ab2864e942c8f3e2e7cb55/not.js#L264-L333 | |
44,455 | weswigham/not.js | not.js | prepareFunc | function prepareFunc(func, builder, basepath) { //Prepare an implied function for repeated use
funcStringCache[func] = funcStringCache[func] || ('(function() { with (proxy(scope)) { return ('+func.toString()+')('+defaultScopeName+'); } })()');
return function(scope) {
var scope = scope || {};
var builder =... | javascript | function prepareFunc(func, builder, basepath) { //Prepare an implied function for repeated use
funcStringCache[func] = funcStringCache[func] || ('(function() { with (proxy(scope)) { return ('+func.toString()+')('+defaultScopeName+'); } })()');
return function(scope) {
var scope = scope || {};
var builder =... | [
"function",
"prepareFunc",
"(",
"func",
",",
"builder",
",",
"basepath",
")",
"{",
"//Prepare an implied function for repeated use",
"funcStringCache",
"[",
"func",
"]",
"=",
"funcStringCache",
"[",
"func",
"]",
"||",
"(",
"'(function() { with (proxy(scope)) { return ('",... | Cache stringified functions for implied usage | [
"Cache",
"stringified",
"functions",
"for",
"implied",
"usage"
] | 58688349c9945e1d56ab2864e942c8f3e2e7cb55 | https://github.com/weswigham/not.js/blob/58688349c9945e1d56ab2864e942c8f3e2e7cb55/not.js#L358-L372 |
44,456 | alexindigo/mixly | chain.js | mixChain | function mixChain()
{
var args = Array.prototype.slice.call(arguments)
, i = args.length
;
while (--i > 0)
{
args[i-1].__proto__ = args[i];
}
return args[i];
} | javascript | function mixChain()
{
var args = Array.prototype.slice.call(arguments)
, i = args.length
;
while (--i > 0)
{
args[i-1].__proto__ = args[i];
}
return args[i];
} | [
"function",
"mixChain",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
",",
"i",
"=",
"args",
".",
"length",
";",
"while",
"(",
"--",
"i",
">",
"0",
")",
"{",
"args",
"[",
"i",
"-... | Modifies prototype chain for the provided objects,
based on the order of the arguments
@param {...object} object - objects to be part of the prototype chain
@returns {object} - augmented object | [
"Modifies",
"prototype",
"chain",
"for",
"the",
"provided",
"objects",
"based",
"on",
"the",
"order",
"of",
"the",
"arguments"
] | 602081b28806dc46286da783fef4f3ba1ecbb199 | https://github.com/alexindigo/mixly/blob/602081b28806dc46286da783fef4f3ba1ecbb199/chain.js#L11-L23 |
44,457 | Smile-SA/grunt-build-html | tasks/buildHtml.js | function (remoteUrl) {
if (remoteUrl.indexOf('http') !== 0) {
grunt.log.error('Something seems wrong with this remote url: ' + remoteUrl);
}
return remoteUrl.toLowerCase().replace('://', '@@').replace(/\?/g, '@');
} | javascript | function (remoteUrl) {
if (remoteUrl.indexOf('http') !== 0) {
grunt.log.error('Something seems wrong with this remote url: ' + remoteUrl);
}
return remoteUrl.toLowerCase().replace('://', '@@').replace(/\?/g, '@');
} | [
"function",
"(",
"remoteUrl",
")",
"{",
"if",
"(",
"remoteUrl",
".",
"indexOf",
"(",
"'http'",
")",
"!==",
"0",
")",
"{",
"grunt",
".",
"log",
".",
"error",
"(",
"'Something seems wrong with this remote url: '",
"+",
"remoteUrl",
")",
";",
"}",
"return",
"... | Transform URL to cache key in order to dump its content
@param remoteUrl Remote content URL
@returns {string|*} URL as cache key | [
"Transform",
"URL",
"to",
"cache",
"key",
"in",
"order",
"to",
"dump",
"its",
"content"
] | 6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e | https://github.com/Smile-SA/grunt-build-html/blob/6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e/tasks/buildHtml.js#L67-L72 | |
44,458 | Smile-SA/grunt-build-html | tasks/buildHtml.js | function (tplUrl, data) {
if (urlPrefix) {
tplUrl = urlPrefix + tplUrl;
}
if (urlSuffix) {
tplUrl += urlSuffix;
}
var html = '';
debug(' retrieve remote content from ' + tplUrl);
var remoteFragmentKey = getTemplateCacheKeyFromRemoteUrl(tplUrl);
... | javascript | function (tplUrl, data) {
if (urlPrefix) {
tplUrl = urlPrefix + tplUrl;
}
if (urlSuffix) {
tplUrl += urlSuffix;
}
var html = '';
debug(' retrieve remote content from ' + tplUrl);
var remoteFragmentKey = getTemplateCacheKeyFromRemoteUrl(tplUrl);
... | [
"function",
"(",
"tplUrl",
",",
"data",
")",
"{",
"if",
"(",
"urlPrefix",
")",
"{",
"tplUrl",
"=",
"urlPrefix",
"+",
"tplUrl",
";",
"}",
"if",
"(",
"urlSuffix",
")",
"{",
"tplUrl",
"+=",
"urlSuffix",
";",
"}",
"var",
"html",
"=",
"''",
";",
"debug"... | Retrieve remote content method to be used in HTML files.
@param tplUrl
Remote content URL
@param data
Options
@returns {*} Remote content data | [
"Retrieve",
"remote",
"content",
"method",
"to",
"be",
"used",
"in",
"HTML",
"files",
"."
] | 6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e | https://github.com/Smile-SA/grunt-build-html/blob/6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e/tasks/buildHtml.js#L90-L112 | |
44,459 | Smile-SA/grunt-build-html | tasks/buildHtml.js | function (tplName, data, ignoreEvaluation) {
var files, templateData, html = '';
if (typeof data !== 'object') {
ignoreEvaluation = data;
data = {};
}
data = _.extend({}, options.data, data);
if (_.has(templates, tplName)) {
debug(' include ' + templates[tp... | javascript | function (tplName, data, ignoreEvaluation) {
var files, templateData, html = '';
if (typeof data !== 'object') {
ignoreEvaluation = data;
data = {};
}
data = _.extend({}, options.data, data);
if (_.has(templates, tplName)) {
debug(' include ' + templates[tp... | [
"function",
"(",
"tplName",
",",
"data",
",",
"ignoreEvaluation",
")",
"{",
"var",
"files",
",",
"templateData",
",",
"html",
"=",
"''",
";",
"if",
"(",
"typeof",
"data",
"!==",
"'object'",
")",
"{",
"ignoreEvaluation",
"=",
"data",
";",
"data",
"=",
"... | Include method to be used in HTML files.
@param tplName Relative template path
@param data The data object used to populate the text.
@returns {string} Compiled template content | [
"Include",
"method",
"to",
"be",
"used",
"in",
"HTML",
"files",
"."
] | 6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e | https://github.com/Smile-SA/grunt-build-html/blob/6fe1644ff6d08e0eada9482ae9dcdb0d4169ea2e/tasks/buildHtml.js#L120-L150 | |
44,460 | Mogztter/opal-node-runtime | src/opal.js | const_lookup_nesting | function const_lookup_nesting(nesting, name) {
var i, ii, result, constant;
if (nesting.length === 0) return;
// If the nesting is not empty the constant is looked up in its elements
// and in order. The ancestors of those elements are ignored.
for (i = 0, ii = nesting.length; i < ii; i++) {
... | javascript | function const_lookup_nesting(nesting, name) {
var i, ii, result, constant;
if (nesting.length === 0) return;
// If the nesting is not empty the constant is looked up in its elements
// and in order. The ancestors of those elements are ignored.
for (i = 0, ii = nesting.length; i < ii; i++) {
... | [
"function",
"const_lookup_nesting",
"(",
"nesting",
",",
"name",
")",
"{",
"var",
"i",
",",
"ii",
",",
"result",
",",
"constant",
";",
"if",
"(",
"nesting",
".",
"length",
"===",
"0",
")",
"return",
";",
"// If the nesting is not empty the constant is looked up ... | Walk up the nesting array looking for the constant | [
"Walk",
"up",
"the",
"nesting",
"array",
"looking",
"for",
"the",
"constant"
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L185-L196 |
44,461 | Mogztter/opal-node-runtime | src/opal.js | const_lookup_ancestors | function const_lookup_ancestors(cref, name) {
var i, ii, result, ancestors;
if (cref == null) return;
ancestors = Opal.ancestors(cref);
for (i = 0, ii = ancestors.length; i < ii; i++) {
if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) {
return ancestors[i].$$const[n... | javascript | function const_lookup_ancestors(cref, name) {
var i, ii, result, ancestors;
if (cref == null) return;
ancestors = Opal.ancestors(cref);
for (i = 0, ii = ancestors.length; i < ii; i++) {
if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) {
return ancestors[i].$$const[n... | [
"function",
"const_lookup_ancestors",
"(",
"cref",
",",
"name",
")",
"{",
"var",
"i",
",",
"ii",
",",
"result",
",",
"ancestors",
";",
"if",
"(",
"cref",
"==",
"null",
")",
"return",
";",
"ancestors",
"=",
"Opal",
".",
"ancestors",
"(",
"cref",
")",
... | Walk up the ancestors chain looking for the constant | [
"Walk",
"up",
"the",
"ancestors",
"chain",
"looking",
"for",
"the",
"constant"
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L199-L211 |
44,462 | Mogztter/opal-node-runtime | src/opal.js | create_dummy_iclass | function create_dummy_iclass(module) {
var iclass = {},
proto = module.$$prototype;
if (proto.hasOwnProperty('$$dummy')) {
proto = proto.$$define_methods_on;
}
var props = Object.getOwnPropertyNames(proto),
length = props.length, i;
for (i = 0; i < length; i++) {
var p... | javascript | function create_dummy_iclass(module) {
var iclass = {},
proto = module.$$prototype;
if (proto.hasOwnProperty('$$dummy')) {
proto = proto.$$define_methods_on;
}
var props = Object.getOwnPropertyNames(proto),
length = props.length, i;
for (i = 0; i < length; i++) {
var p... | [
"function",
"create_dummy_iclass",
"(",
"module",
")",
"{",
"var",
"iclass",
"=",
"{",
"}",
",",
"proto",
"=",
"module",
".",
"$$prototype",
";",
"if",
"(",
"proto",
".",
"hasOwnProperty",
"(",
"'$$dummy'",
")",
")",
"{",
"proto",
"=",
"proto",
".",
"$... | Dummy iclass doesn't receive updates when the module gets a new method. | [
"Dummy",
"iclass",
"doesn",
"t",
"receive",
"updates",
"when",
"the",
"module",
"gets",
"a",
"new",
"method",
"."
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L1092-L1112 |
44,463 | Mogztter/opal-node-runtime | src/opal.js | descending_factorial | function descending_factorial(from, how_many) {
var count = how_many >= 0 ? 1 : 0;
while (how_many) {
count *= from;
from--;
how_many--;
}
return count;
} | javascript | function descending_factorial(from, how_many) {
var count = how_many >= 0 ? 1 : 0;
while (how_many) {
count *= from;
from--;
how_many--;
}
return count;
} | [
"function",
"descending_factorial",
"(",
"from",
",",
"how_many",
")",
"{",
"var",
"count",
"=",
"how_many",
">=",
"0",
"?",
"1",
":",
"0",
";",
"while",
"(",
"how_many",
")",
"{",
"count",
"*=",
"from",
";",
"from",
"--",
";",
"how_many",
"--",
";",... | Returns the product of from, from-1, ..., from - how_many + 1. | [
"Returns",
"the",
"product",
"of",
"from",
"from",
"-",
"1",
"...",
"from",
"-",
"how_many",
"+",
"1",
"."
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L13635-L13643 |
44,464 | Mogztter/opal-node-runtime | src/opal.js | cutNumber | function cutNumber() {
if (isFloat()) {
var numerator = parseFloat(cutFloat());
if (str[0] === '/') {
// rational real part
str = str.slice(1);
if (isFloat()) {
var denominator = parseFloat(cutFloat());
return self.$Rational(n... | javascript | function cutNumber() {
if (isFloat()) {
var numerator = parseFloat(cutFloat());
if (str[0] === '/') {
// rational real part
str = str.slice(1);
if (isFloat()) {
var denominator = parseFloat(cutFloat());
return self.$Rational(n... | [
"function",
"cutNumber",
"(",
")",
"{",
"if",
"(",
"isFloat",
"(",
")",
")",
"{",
"var",
"numerator",
"=",
"parseFloat",
"(",
"cutFloat",
"(",
")",
")",
";",
"if",
"(",
"str",
"[",
"0",
"]",
"===",
"'/'",
")",
"{",
"// rational real part",
"str",
"... | handles both floats and rationals | [
"handles",
"both",
"floats",
"and",
"rationals"
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L19882-L19905 |
44,465 | Mogztter/opal-node-runtime | src/opal.js | genrand_real | function genrand_real(mt) {
/* mt must be initialized */
var a = genrand_int32(mt), b = genrand_int32(mt);
return int_pair_to_real_exclusive(a, b);
} | javascript | function genrand_real(mt) {
/* mt must be initialized */
var a = genrand_int32(mt), b = genrand_int32(mt);
return int_pair_to_real_exclusive(a, b);
} | [
"function",
"genrand_real",
"(",
"mt",
")",
"{",
"/* mt must be initialized */",
"var",
"a",
"=",
"genrand_int32",
"(",
"mt",
")",
",",
"b",
"=",
"genrand_int32",
"(",
"mt",
")",
";",
"return",
"int_pair_to_real_exclusive",
"(",
"a",
",",
"b",
")",
";",
"}... | generates a random number on [0,1) with 53-bit resolution | [
"generates",
"a",
"random",
"number",
"on",
"[",
"0",
"1",
")",
"with",
"53",
"-",
"bit",
"resolution"
] | cde4c78099358ef47cc30b41f699ee56ff40d5e3 | https://github.com/Mogztter/opal-node-runtime/blob/cde4c78099358ef47cc30b41f699ee56ff40d5e3/src/opal.js#L22784-L22788 |
44,466 | thlorenz/browserify-swap | index.js | browserifySwap | function browserifySwap(file) {
var env = process.env.BROWSERIFYSWAP_ENV
, data = ''
, swapFile;
// no stubbing desired or we already determined that we can't find a swap config => just pipe it through
if (!env || cachedConfig === -1) return through();
if (cachedConfig) {
swapFile = swap(cachedCon... | javascript | function browserifySwap(file) {
var env = process.env.BROWSERIFYSWAP_ENV
, data = ''
, swapFile;
// no stubbing desired or we already determined that we can't find a swap config => just pipe it through
if (!env || cachedConfig === -1) return through();
if (cachedConfig) {
swapFile = swap(cachedCon... | [
"function",
"browserifySwap",
"(",
"file",
")",
"{",
"var",
"env",
"=",
"process",
".",
"env",
".",
"BROWSERIFYSWAP_ENV",
",",
"data",
"=",
"''",
",",
"swapFile",
";",
"// no stubbing desired or we already determined that we can't find a swap config => just pipe it through"... | Looks up browserify_swap configuratios specified for the given file in the environment specified via `BROWSERIFYSWAP_ENV`.
If found the file content is replaced with a require statement to the file to swap in for the original.
Otherwise the file's content is just piped through.
@name browserifySwap
@function
@param {... | [
"Looks",
"up",
"browserify_swap",
"configuratios",
"specified",
"for",
"the",
"given",
"file",
"in",
"the",
"environment",
"specified",
"via",
"BROWSERIFYSWAP_ENV",
"."
] | 2a697cdaec59d2cb83244863616d92dc8eb14137 | https://github.com/thlorenz/browserify-swap/blob/2a697cdaec59d2cb83244863616d92dc8eb14137/index.js#L59-L108 |
44,467 | reelyactive/barterer | lib/responsehandler.js | prepareResponse | function prepareResponse(status, rootUrl, queryPath, data) {
var response = {};
prepareMeta(response, status);
if(rootUrl && queryPath) {
prepareLinks(response, rootUrl, queryPath);
}
if(data) {
prepareData(response, rootUrl, data);
}
return response;
} | javascript | function prepareResponse(status, rootUrl, queryPath, data) {
var response = {};
prepareMeta(response, status);
if(rootUrl && queryPath) {
prepareLinks(response, rootUrl, queryPath);
}
if(data) {
prepareData(response, rootUrl, data);
}
return response;
} | [
"function",
"prepareResponse",
"(",
"status",
",",
"rootUrl",
",",
"queryPath",
",",
"data",
")",
"{",
"var",
"response",
"=",
"{",
"}",
";",
"prepareMeta",
"(",
"response",
",",
"status",
")",
";",
"if",
"(",
"rootUrl",
"&&",
"queryPath",
")",
"{",
"p... | Prepares the JSON for an API query response which is successful
@param {Number} status Integer status code
@param {String} rootUrl The root URL of the original query.
@param {String} queryPath The query path of the original query.
@param {Object} data The data to include in the response | [
"Prepares",
"the",
"JSON",
"for",
"an",
"API",
"query",
"response",
"which",
"is",
"successful"
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/responsehandler.js#L26-L36 |
44,468 | reelyactive/barterer | lib/responsehandler.js | prepareMeta | function prepareMeta(response, status) {
switch(status) {
case CODE_OK:
response._meta = { "message": MESSAGE_OK,
"statusCode": CODE_OK };
break;
case CODE_NOTFOUND:
response._meta = { "message": MESSAGE_NOTFOUND,
"statusCode": CODE_NOTFOUND ... | javascript | function prepareMeta(response, status) {
switch(status) {
case CODE_OK:
response._meta = { "message": MESSAGE_OK,
"statusCode": CODE_OK };
break;
case CODE_NOTFOUND:
response._meta = { "message": MESSAGE_NOTFOUND,
"statusCode": CODE_NOTFOUND ... | [
"function",
"prepareMeta",
"(",
"response",
",",
"status",
")",
"{",
"switch",
"(",
"status",
")",
"{",
"case",
"CODE_OK",
":",
"response",
".",
"_meta",
"=",
"{",
"\"message\"",
":",
"MESSAGE_OK",
",",
"\"statusCode\"",
":",
"CODE_OK",
"}",
";",
"break",
... | Prepares and adds the _meta to the given API query response
@param {Object} response JSON representation of the response
@param {Number} status Integer status code | [
"Prepares",
"and",
"adds",
"the",
"_meta",
"to",
"the",
"given",
"API",
"query",
"response"
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/responsehandler.js#L44-L66 |
44,469 | reelyactive/barterer | lib/responsehandler.js | prepareLinks | function prepareLinks(response, rootUrl, queryPath) {
var selfLink = { "href": rootUrl + queryPath };
response._links = {};
response._links.self = selfLink;
} | javascript | function prepareLinks(response, rootUrl, queryPath) {
var selfLink = { "href": rootUrl + queryPath };
response._links = {};
response._links.self = selfLink;
} | [
"function",
"prepareLinks",
"(",
"response",
",",
"rootUrl",
",",
"queryPath",
")",
"{",
"var",
"selfLink",
"=",
"{",
"\"href\"",
":",
"rootUrl",
"+",
"queryPath",
"}",
";",
"response",
".",
"_links",
"=",
"{",
"}",
";",
"response",
".",
"_links",
".",
... | Prepares and adds the _links to the given API query response
@param {Object} response JSON representation of the response
@param {String} rootUrl The root URL of the original query.
@param {String} queryPath The query path of the original query. | [
"Prepares",
"and",
"adds",
"the",
"_links",
"to",
"the",
"given",
"API",
"query",
"response"
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/responsehandler.js#L75-L79 |
44,470 | watson/mode-s-aircraft-store | lib/cpr.js | cprModFunction | function cprModFunction (a, b) {
let res = a % b
if (res < 0) res += b
return res
} | javascript | function cprModFunction (a, b) {
let res = a % b
if (res < 0) res += b
return res
} | [
"function",
"cprModFunction",
"(",
"a",
",",
"b",
")",
"{",
"let",
"res",
"=",
"a",
"%",
"b",
"if",
"(",
"res",
"<",
"0",
")",
"res",
"+=",
"b",
"return",
"res",
"}"
] | Always positive MOD operation, used for CPR decoding | [
"Always",
"positive",
"MOD",
"operation",
"used",
"for",
"CPR",
"decoding"
] | c8ba99927d5cba1c8fbbf2b90f35cf076360299b | https://github.com/watson/mode-s-aircraft-store/blob/c8ba99927d5cba1c8fbbf2b90f35cf076360299b/lib/cpr.js#L59-L63 |
44,471 | watson/mode-s-aircraft-store | lib/cpr.js | cprNLFunction | function cprNLFunction (lat) {
if (lat < 0) lat = -lat // Table is simmetric about the equator
if (lat < 10.47047130) return 59
if (lat < 14.82817437) return 58
if (lat < 18.18626357) return 57
if (lat < 21.02939493) return 56
if (lat < 23.54504487) return 55
if (lat < 25.82924707) return 54
if (lat < 2... | javascript | function cprNLFunction (lat) {
if (lat < 0) lat = -lat // Table is simmetric about the equator
if (lat < 10.47047130) return 59
if (lat < 14.82817437) return 58
if (lat < 18.18626357) return 57
if (lat < 21.02939493) return 56
if (lat < 23.54504487) return 55
if (lat < 25.82924707) return 54
if (lat < 2... | [
"function",
"cprNLFunction",
"(",
"lat",
")",
"{",
"if",
"(",
"lat",
"<",
"0",
")",
"lat",
"=",
"-",
"lat",
"// Table is simmetric about the equator",
"if",
"(",
"lat",
"<",
"10.47047130",
")",
"return",
"59",
"if",
"(",
"lat",
"<",
"14.82817437",
")",
"... | The NL function uses the precomputed table from 1090-WP-9-14 | [
"The",
"NL",
"function",
"uses",
"the",
"precomputed",
"table",
"from",
"1090",
"-",
"WP",
"-",
"9",
"-",
"14"
] | c8ba99927d5cba1c8fbbf2b90f35cf076360299b | https://github.com/watson/mode-s-aircraft-store/blob/c8ba99927d5cba1c8fbbf2b90f35cf076360299b/lib/cpr.js#L76-L137 |
44,472 | micromatch/bash-glob | index.js | glob | function glob(pattern, options, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
if (Array.isArray(pattern)) {
return glob.each.apply(glob, arguments);
}
if (typeof cb !== 'function') {
if (typeof cb !== 'undefined') {
throw new TypeError('expected callback to b... | javascript | function glob(pattern, options, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
if (Array.isArray(pattern)) {
return glob.each.apply(glob, arguments);
}
if (typeof cb !== 'function') {
if (typeof cb !== 'undefined') {
throw new TypeError('expected callback to b... | [
"function",
"glob",
"(",
"pattern",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"cb",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"pattern... | Asynchronously returns an array of files that match the given pattern
or patterns.
```js
var glob = require('bash-glob');
glob('*.js', function(err, files) {
if (err) return console.log(err);
console.log(files);
});
```
@param {String|Array} `patterns` One or more glob patterns to use for matching.
@param {Object} `op... | [
"Asynchronously",
"returns",
"an",
"array",
"of",
"files",
"that",
"match",
"the",
"given",
"pattern",
"or",
"patterns",
"."
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L30-L77 |
44,473 | micromatch/bash-glob | index.js | bash | function bash(pattern, options, cb) {
if (!isGlob(pattern)) {
return nonGlob(pattern, options, cb);
}
if (typeof options === 'function') {
cb = options;
options = undefined;
}
var opts = extend({cwd: process.cwd()}, options);
fs.stat(opts.cwd, function(err, stat) {
if (err) {
cb(han... | javascript | function bash(pattern, options, cb) {
if (!isGlob(pattern)) {
return nonGlob(pattern, options, cb);
}
if (typeof options === 'function') {
cb = options;
options = undefined;
}
var opts = extend({cwd: process.cwd()}, options);
fs.stat(opts.cwd, function(err, stat) {
if (err) {
cb(han... | [
"function",
"bash",
"(",
"pattern",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"isGlob",
"(",
"pattern",
")",
")",
"{",
"return",
"nonGlob",
"(",
"pattern",
",",
"options",
",",
"cb",
")",
";",
"}",
"if",
"(",
"typeof",
"options",
"===",
... | Base bash function | [
"Base",
"bash",
"function"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L244-L283 |
44,474 | micromatch/bash-glob | index.js | normalize | function normalize(val) {
if (Array.isArray(val)) {
val = val.join(' ');
}
return val.split(' ').join('\\ ');
} | javascript | function normalize(val) {
if (Array.isArray(val)) {
val = val.join(' ');
}
return val.split(' ').join('\\ ');
} | [
"function",
"normalize",
"(",
"val",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"{",
"val",
"=",
"val",
".",
"join",
"(",
"' '",
")",
";",
"}",
"return",
"val",
".",
"split",
"(",
"' '",
")",
".",
"join",
"(",
"'\\\\ '"... | Escape spaces in glob patterns | [
"Escape",
"spaces",
"in",
"glob",
"patterns"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L289-L294 |
44,475 | micromatch/bash-glob | index.js | cmd | function cmd(patterns, options) {
var str = normalize(patterns);
var keys = Object.keys(options);
var args = [];
var valid = [
'dotglob',
'extglob',
'failglob',
'globstar',
'nocaseglob',
'nullglob'
];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (valid.index... | javascript | function cmd(patterns, options) {
var str = normalize(patterns);
var keys = Object.keys(options);
var args = [];
var valid = [
'dotglob',
'extglob',
'failglob',
'globstar',
'nocaseglob',
'nullglob'
];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (valid.index... | [
"function",
"cmd",
"(",
"patterns",
",",
"options",
")",
"{",
"var",
"str",
"=",
"normalize",
"(",
"patterns",
")",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"options",
")",
";",
"var",
"args",
"=",
"[",
"]",
";",
"var",
"valid",
"=",
... | Create the command to use | [
"Create",
"the",
"command",
"to",
"use"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L300-L322 |
44,476 | micromatch/bash-glob | index.js | handleError | function handleError(err, pattern, options) {
var message = err;
if (typeof err === 'string') {
err = new Error(message.trim());
err.pattern = pattern;
err.options = options;
if (/invalid shell option/.test(err)) {
err.code = 'INVALID_SHELL_OPTION';
}
if (/no match:/.test(err)) {
... | javascript | function handleError(err, pattern, options) {
var message = err;
if (typeof err === 'string') {
err = new Error(message.trim());
err.pattern = pattern;
err.options = options;
if (/invalid shell option/.test(err)) {
err.code = 'INVALID_SHELL_OPTION';
}
if (/no match:/.test(err)) {
... | [
"function",
"handleError",
"(",
"err",
",",
"pattern",
",",
"options",
")",
"{",
"var",
"message",
"=",
"err",
";",
"if",
"(",
"typeof",
"err",
"===",
"'string'",
")",
"{",
"err",
"=",
"new",
"Error",
"(",
"message",
".",
"trim",
"(",
")",
")",
";"... | Handle errors to ensure the correct value is returned based on options | [
"Handle",
"errors",
"to",
"ensure",
"the",
"correct",
"value",
"is",
"returned",
"based",
"on",
"options"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L348-L373 |
44,477 | micromatch/bash-glob | index.js | getFiles | function getFiles(res, pattern, options) {
var files = res.split(/\r?\n/).filter(Boolean);
if (files.length === 1 && files[0] === pattern) {
files = [];
} else if (options.realpath === true || options.follow === true) {
files = toAbsolute(files, options);
}
if (files.length === 0) {
if (options.nu... | javascript | function getFiles(res, pattern, options) {
var files = res.split(/\r?\n/).filter(Boolean);
if (files.length === 1 && files[0] === pattern) {
files = [];
} else if (options.realpath === true || options.follow === true) {
files = toAbsolute(files, options);
}
if (files.length === 0) {
if (options.nu... | [
"function",
"getFiles",
"(",
"res",
",",
"pattern",
",",
"options",
")",
"{",
"var",
"files",
"=",
"res",
".",
"split",
"(",
"/",
"\\r?\\n",
"/",
")",
".",
"filter",
"(",
"Boolean",
")",
";",
"if",
"(",
"files",
".",
"length",
"===",
"1",
"&&",
"... | Handle files to ensure the correct value is returned based on options | [
"Handle",
"files",
"to",
"ensure",
"the",
"correct",
"value",
"is",
"returned",
"based",
"on",
"options"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L379-L398 |
44,478 | micromatch/bash-glob | index.js | toAbsolute | function toAbsolute(files, options) {
var len = files.length;
var idx = -1;
var arr = [];
while (++idx < len) {
var file = files[idx];
if (!file.trim()) continue;
if (file && options.cwd) {
file = path.resolve(options.cwd, file);
}
if (file && options.realpath === true) {
file =... | javascript | function toAbsolute(files, options) {
var len = files.length;
var idx = -1;
var arr = [];
while (++idx < len) {
var file = files[idx];
if (!file.trim()) continue;
if (file && options.cwd) {
file = path.resolve(options.cwd, file);
}
if (file && options.realpath === true) {
file =... | [
"function",
"toAbsolute",
"(",
"files",
",",
"options",
")",
"{",
"var",
"len",
"=",
"files",
".",
"length",
";",
"var",
"idx",
"=",
"-",
"1",
";",
"var",
"arr",
"=",
"[",
"]",
";",
"while",
"(",
"++",
"idx",
"<",
"len",
")",
"{",
"var",
"file"... | Make symlinks absolute when `options.follow` is defined. | [
"Make",
"symlinks",
"absolute",
"when",
"options",
".",
"follow",
"is",
"defined",
"."
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L404-L423 |
44,479 | micromatch/bash-glob | index.js | nonGlob | function nonGlob(pattern, options, cb) {
if (options.nullglob) {
cb(null, [pattern]);
return;
}
fs.stat(pattern, callback(null, pattern, options, cb));
return;
} | javascript | function nonGlob(pattern, options, cb) {
if (options.nullglob) {
cb(null, [pattern]);
return;
}
fs.stat(pattern, callback(null, pattern, options, cb));
return;
} | [
"function",
"nonGlob",
"(",
"pattern",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"options",
".",
"nullglob",
")",
"{",
"cb",
"(",
"null",
",",
"[",
"pattern",
"]",
")",
";",
"return",
";",
"}",
"fs",
".",
"stat",
"(",
"pattern",
",",
"callb... | Handle non-globs | [
"Handle",
"non",
"-",
"globs"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L461-L468 |
44,480 | micromatch/bash-glob | index.js | emitMatches | function emitMatches(str, pattern, options) {
glob.emit('match', getFiles(str, pattern, options), options.cwd);
} | javascript | function emitMatches(str, pattern, options) {
glob.emit('match', getFiles(str, pattern, options), options.cwd);
} | [
"function",
"emitMatches",
"(",
"str",
",",
"pattern",
",",
"options",
")",
"{",
"glob",
".",
"emit",
"(",
"'match'",
",",
"getFiles",
"(",
"str",
",",
"pattern",
",",
"options",
")",
",",
"options",
".",
"cwd",
")",
";",
"}"
] | Emit matches for a pattern | [
"Emit",
"matches",
"for",
"a",
"pattern"
] | eddb7de28a22d90c9a26389f7c884af5ddaadead | https://github.com/micromatch/bash-glob/blob/eddb7de28a22d90c9a26389f7c884af5ddaadead/index.js#L474-L476 |
44,481 | reelyactive/barterer | lib/barterer.js | Barterer | function Barterer(options) {
var self = this;
options = options || {};
self.routes = {
"/whereis": require('./routes/whereis'),
"/whatat": require('./routes/whatat'),
"/whatnear": require('./routes/whatnear'),
"/": express.static(path.resolve(__dirname + '/../web'))
};
console.log('reelyActi... | javascript | function Barterer(options) {
var self = this;
options = options || {};
self.routes = {
"/whereis": require('./routes/whereis'),
"/whatat": require('./routes/whatat'),
"/whatnear": require('./routes/whatnear'),
"/": express.static(path.resolve(__dirname + '/../web'))
};
console.log('reelyActi... | [
"function",
"Barterer",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"self",
".",
"routes",
"=",
"{",
"\"/whereis\"",
":",
"require",
"(",
"'./routes/whereis'",
")",
",",
"\"/whatat\"",
":",
... | Barterer Class
API for real-time location and hyperlocal context.
@param {Object} options The options as a JSON object.
@constructor | [
"Barterer",
"Class",
"API",
"for",
"real",
"-",
"time",
"location",
"and",
"hyperlocal",
"context",
"."
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/barterer.js#L19-L31 |
44,482 | reelyactive/barterer | lib/barterer.js | isValidOptions | function isValidOptions(options) {
if(!options) {
return false;
}
if(options.hasOwnProperty('ids') && Array.isArray(options.ids)) {
for(var cId = 0; cId < options.ids.length; cId++) {
if(!reelib.identifier.isValid(options.ids[cId])) {
return false;
}
}
return true;
}
else... | javascript | function isValidOptions(options) {
if(!options) {
return false;
}
if(options.hasOwnProperty('ids') && Array.isArray(options.ids)) {
for(var cId = 0; cId < options.ids.length; cId++) {
if(!reelib.identifier.isValid(options.ids[cId])) {
return false;
}
}
return true;
}
else... | [
"function",
"isValidOptions",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"options",
".",
"hasOwnProperty",
"(",
"'ids'",
")",
"&&",
"Array",
".",
"isArray",
"(",
"options",
".",
"ids",
")",
... | Determine if the given options are valid.
@param {Object} options The given options.
@return {boolean} True if the options are valid, false otherwise. | [
"Determine",
"if",
"the",
"given",
"options",
"are",
"valid",
"."
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/barterer.js#L113-L130 |
44,483 | jossmac/react-deprecate | lib/index.js | getComponentName | function getComponentName(target) {
if (target.displayName && typeof target.displayName === 'string') {
return target.displayName;
}
return target.name || 'Component';
} | javascript | function getComponentName(target) {
if (target.displayName && typeof target.displayName === 'string') {
return target.displayName;
}
return target.name || 'Component';
} | [
"function",
"getComponentName",
"(",
"target",
")",
"{",
"if",
"(",
"target",
".",
"displayName",
"&&",
"typeof",
"target",
".",
"displayName",
"===",
"'string'",
")",
"{",
"return",
"target",
".",
"displayName",
";",
"}",
"return",
"target",
".",
"name",
... | attempt to get the wrapped component's name | [
"attempt",
"to",
"get",
"the",
"wrapped",
"component",
"s",
"name"
] | 4a96b1dff81ffd5eadba480d71b5b99fc91375b1 | https://github.com/jossmac/react-deprecate/blob/4a96b1dff81ffd5eadba480d71b5b99fc91375b1/lib/index.js#L28-L34 |
44,484 | jossmac/react-deprecate | lib/index.js | defaultWarningMessage | function defaultWarningMessage(_ref) {
var componentName = _ref.componentName,
prop = _ref.prop,
renamedProps = _ref.renamedProps;
return componentName + ' Warning: Prop "' + prop + '" is deprecated, use "' + renamedProps[prop] + '" instead.';
} | javascript | function defaultWarningMessage(_ref) {
var componentName = _ref.componentName,
prop = _ref.prop,
renamedProps = _ref.renamedProps;
return componentName + ' Warning: Prop "' + prop + '" is deprecated, use "' + renamedProps[prop] + '" instead.';
} | [
"function",
"defaultWarningMessage",
"(",
"_ref",
")",
"{",
"var",
"componentName",
"=",
"_ref",
".",
"componentName",
",",
"prop",
"=",
"_ref",
".",
"prop",
",",
"renamedProps",
"=",
"_ref",
".",
"renamedProps",
";",
"return",
"componentName",
"+",
"' Warning... | deprecation warning for consumer | [
"deprecation",
"warning",
"for",
"consumer"
] | 4a96b1dff81ffd5eadba480d71b5b99fc91375b1 | https://github.com/jossmac/react-deprecate/blob/4a96b1dff81ffd5eadba480d71b5b99fc91375b1/lib/index.js#L37-L43 |
44,485 | jossmac/react-deprecate | lib/index.js | componentDidMount | function componentDidMount() {
var _this2 = this;
Object.keys(renamedProps).forEach(function (prop) {
if (prop in _this2.props) {
console.warn(warningMessage({
componentName: getComponentName(WrappedComponent),
prop: prop,
renamedProps: re... | javascript | function componentDidMount() {
var _this2 = this;
Object.keys(renamedProps).forEach(function (prop) {
if (prop in _this2.props) {
console.warn(warningMessage({
componentName: getComponentName(WrappedComponent),
prop: prop,
renamedProps: re... | [
"function",
"componentDidMount",
"(",
")",
"{",
"var",
"_this2",
"=",
"this",
";",
"Object",
".",
"keys",
"(",
"renamedProps",
")",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
"{",
"if",
"(",
"prop",
"in",
"_this2",
".",
"props",
")",
"{",
"co... | warn on deprecated props | [
"warn",
"on",
"deprecated",
"props"
] | 4a96b1dff81ffd5eadba480d71b5b99fc91375b1 | https://github.com/jossmac/react-deprecate/blob/4a96b1dff81ffd5eadba480d71b5b99fc91375b1/lib/index.js#L67-L79 |
44,486 | sematext/spm-agent | lib/harvester.js | harvester | function harvester (metricConsumer, agentList) {
var agentsToLoad = []
this.metricConsumer = metricConsumer
this.httpAgent = null
if (agentList) {
agentsToLoad = agentList
}
this.agents = []
for (var x in agentsToLoad) {
try {
var TmpAgentClass = require(agentsToLoad[x])
var tmpAgentIn... | javascript | function harvester (metricConsumer, agentList) {
var agentsToLoad = []
this.metricConsumer = metricConsumer
this.httpAgent = null
if (agentList) {
agentsToLoad = agentList
}
this.agents = []
for (var x in agentsToLoad) {
try {
var TmpAgentClass = require(agentsToLoad[x])
var tmpAgentIn... | [
"function",
"harvester",
"(",
"metricConsumer",
",",
"agentList",
")",
"{",
"var",
"agentsToLoad",
"=",
"[",
"]",
"this",
".",
"metricConsumer",
"=",
"metricConsumer",
"this",
".",
"httpAgent",
"=",
"null",
"if",
"(",
"agentList",
")",
"{",
"agentsToLoad",
"... | This module harvest metrics from agents, registers to all agents and fires own metric events
@metricConsumer - an object that listens on "metric" event. The metric event passes a metric object with (name, value, type, ts) properties
@agentList a list of agents to be created e.g. ['./agents/osAgent.js', './agents/eventL... | [
"This",
"module",
"harvest",
"metrics",
"from",
"agents",
"registers",
"to",
"all",
"agents",
"and",
"fires",
"own",
"metric",
"events"
] | 7b98be0cfc41fb7bf7f7c605e6602148570269a3 | https://github.com/sematext/spm-agent/blob/7b98be0cfc41fb7bf7f7c605e6602148570269a3/lib/harvester.js#L19-L41 |
44,487 | warmsea/node-rfr | lib/rfr.js | coerceRoot | function coerceRoot(root) {
var coerced = root.substring().trim();
var len = coerced.length;
if (len > 0 && coerced[len - 1] !== '/') {
coerced = coerced + '/';
}
return coerced;
} | javascript | function coerceRoot(root) {
var coerced = root.substring().trim();
var len = coerced.length;
if (len > 0 && coerced[len - 1] !== '/') {
coerced = coerced + '/';
}
return coerced;
} | [
"function",
"coerceRoot",
"(",
"root",
")",
"{",
"var",
"coerced",
"=",
"root",
".",
"substring",
"(",
")",
".",
"trim",
"(",
")",
";",
"var",
"len",
"=",
"coerced",
".",
"length",
";",
"if",
"(",
"len",
">",
"0",
"&&",
"coerced",
"[",
"len",
"-"... | Trim a root and add tailing slash if not exists.
@param {String} root A root.
@returns {String} The coerced root.
@private | [
"Trim",
"a",
"root",
"and",
"add",
"tailing",
"slash",
"if",
"not",
"exists",
"."
] | 4c6c62dd5c338824e7eeccb44321942a7c3a8662 | https://github.com/warmsea/node-rfr/blob/4c6c62dd5c338824e7eeccb44321942a7c3a8662/lib/rfr.js#L27-L34 |
44,488 | warmsea/node-rfr | lib/rfr.js | function(callable, root, isMaster) {
rfr = callable.bind(callable);
/**
* A read-only property tells whether this rfr instance is a master one.
* Call `require('rfr')` to get a master rfr instance.
* User created rfr instances, such as `require('rfr')({ root: '...' })` are
* not master ones.
* @type... | javascript | function(callable, root, isMaster) {
rfr = callable.bind(callable);
/**
* A read-only property tells whether this rfr instance is a master one.
* Call `require('rfr')` to get a master rfr instance.
* User created rfr instances, such as `require('rfr')({ root: '...' })` are
* not master ones.
* @type... | [
"function",
"(",
"callable",
",",
"root",
",",
"isMaster",
")",
"{",
"rfr",
"=",
"callable",
".",
"bind",
"(",
"callable",
")",
";",
"/**\n * A read-only property tells whether this rfr instance is a master one.\n * Call `require('rfr')` to get a master rfr instance.\n * Us... | Create a new version of rfr with a function.
@param {Function} callable The rfr require function.
@param {String} root The root for rfr require.
@param {Boolean} isMaster Whether this is a master rfr.
@private | [
"Create",
"a",
"new",
"version",
"of",
"rfr",
"with",
"a",
"function",
"."
] | 4c6c62dd5c338824e7eeccb44321942a7c3a8662 | https://github.com/warmsea/node-rfr/blob/4c6c62dd5c338824e7eeccb44321942a7c3a8662/lib/rfr.js#L59-L122 | |
44,489 | warmsea/node-rfr | lib/rfr.js | createVersion | function createVersion(config) {
if (!(config && (typeof config.root === 'string'
|| config.root === null || config.root === undefined))) {
throw new Error('"config.root" is required and must be a string');
}
var root = config.root;
if (root === null || root === undefined) {
root = defaultRoot;
... | javascript | function createVersion(config) {
if (!(config && (typeof config.root === 'string'
|| config.root === null || config.root === undefined))) {
throw new Error('"config.root" is required and must be a string');
}
var root = config.root;
if (root === null || root === undefined) {
root = defaultRoot;
... | [
"function",
"createVersion",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"(",
"config",
"&&",
"(",
"typeof",
"config",
".",
"root",
"===",
"'string'",
"||",
"config",
".",
"root",
"===",
"null",
"||",
"config",
".",
"root",
"===",
"undefined",
")",
")",
... | Create a new version of rfr.
@param {{root:String}} config config of this version.
@returns {rfr} a new rfr version.
@private | [
"Create",
"a",
"new",
"version",
"of",
"rfr",
"."
] | 4c6c62dd5c338824e7eeccb44321942a7c3a8662 | https://github.com/warmsea/node-rfr/blob/4c6c62dd5c338824e7eeccb44321942a7c3a8662/lib/rfr.js#L130-L147 |
44,490 | hayspec/framework | common/scripts/install-run.js | parsePackageSpecifier | function parsePackageSpecifier(rawPackageSpecifier) {
rawPackageSpecifier = (rawPackageSpecifier || '').trim();
const separatorIndex = rawPackageSpecifier.lastIndexOf('@');
let name;
let version = undefined;
if (separatorIndex === 0) {
// The specifier starts with a scope and doesn't h... | javascript | function parsePackageSpecifier(rawPackageSpecifier) {
rawPackageSpecifier = (rawPackageSpecifier || '').trim();
const separatorIndex = rawPackageSpecifier.lastIndexOf('@');
let name;
let version = undefined;
if (separatorIndex === 0) {
// The specifier starts with a scope and doesn't h... | [
"function",
"parsePackageSpecifier",
"(",
"rawPackageSpecifier",
")",
"{",
"rawPackageSpecifier",
"=",
"(",
"rawPackageSpecifier",
"||",
"''",
")",
".",
"trim",
"(",
")",
";",
"const",
"separatorIndex",
"=",
"rawPackageSpecifier",
".",
"lastIndexOf",
"(",
"'@'",
"... | Parse a package specifier (in the form of name\@version) into name and version parts. | [
"Parse",
"a",
"package",
"specifier",
"(",
"in",
"the",
"form",
"of",
"name",
"\\"
] | 739e2fca2a99ee5cf9f10c658fe0fd0a81129803 | https://github.com/hayspec/framework/blob/739e2fca2a99ee5cf9f10c658fe0fd0a81129803/common/scripts/install-run.js#L26-L47 |
44,491 | hayspec/framework | common/scripts/install-run.js | resolvePackageVersion | function resolvePackageVersion(rushCommonFolder, { name, version }) {
if (!version) {
version = '*'; // If no version is specified, use the latest version
}
if (version.match(/^[a-zA-Z0-9\-\+\.]+$/)) {
// If the version contains only characters that we recognize to be used in static ver... | javascript | function resolvePackageVersion(rushCommonFolder, { name, version }) {
if (!version) {
version = '*'; // If no version is specified, use the latest version
}
if (version.match(/^[a-zA-Z0-9\-\+\.]+$/)) {
// If the version contains only characters that we recognize to be used in static ver... | [
"function",
"resolvePackageVersion",
"(",
"rushCommonFolder",
",",
"{",
"name",
",",
"version",
"}",
")",
"{",
"if",
"(",
"!",
"version",
")",
"{",
"version",
"=",
"'*'",
";",
"// If no version is specified, use the latest version\r",
"}",
"if",
"(",
"version",
... | Resolve a package specifier to a static version | [
"Resolve",
"a",
"package",
"specifier",
"to",
"a",
"static",
"version"
] | 739e2fca2a99ee5cf9f10c658fe0fd0a81129803 | https://github.com/hayspec/framework/blob/739e2fca2a99ee5cf9f10c658fe0fd0a81129803/common/scripts/install-run.js#L51-L96 |
44,492 | hayspec/framework | common/scripts/install-run.js | getNpmPath | function getNpmPath() {
if (!_npmPath) {
try {
if (os.platform() === 'win32') {
// We're on Windows
const whereOutput = childProcess.execSync('where npm', { stdio: [] }).toString();
const lines = whereOutput.split(os.EOL).filter((line) => !!l... | javascript | function getNpmPath() {
if (!_npmPath) {
try {
if (os.platform() === 'win32') {
// We're on Windows
const whereOutput = childProcess.execSync('where npm', { stdio: [] }).toString();
const lines = whereOutput.split(os.EOL).filter((line) => !!l... | [
"function",
"getNpmPath",
"(",
")",
"{",
"if",
"(",
"!",
"_npmPath",
")",
"{",
"try",
"{",
"if",
"(",
"os",
".",
"platform",
"(",
")",
"===",
"'win32'",
")",
"{",
"// We're on Windows\r",
"const",
"whereOutput",
"=",
"childProcess",
".",
"execSync",
"(",... | Get the absolute path to the npm executable | [
"Get",
"the",
"absolute",
"path",
"to",
"the",
"npm",
"executable"
] | 739e2fca2a99ee5cf9f10c658fe0fd0a81129803 | https://github.com/hayspec/framework/blob/739e2fca2a99ee5cf9f10c658fe0fd0a81129803/common/scripts/install-run.js#L101-L126 |
44,493 | justinwilaby/svg-path-interpolator | src/math/utils.js | rotatePoint | function rotatePoint(originX, originY, x, y, radiansX, radiansY) {
const v = {x: x - originX, y: y - originY};
const vx = (v.x * Math.cos(radiansX)) - (v.y * Math.sin(radiansX));
const vy = (v.x * Math.sin(radiansY)) + (v.y * Math.cos(radiansY));
return {x: vx + originX, y: vy + originY};
} | javascript | function rotatePoint(originX, originY, x, y, radiansX, radiansY) {
const v = {x: x - originX, y: y - originY};
const vx = (v.x * Math.cos(radiansX)) - (v.y * Math.sin(radiansX));
const vy = (v.x * Math.sin(radiansY)) + (v.y * Math.cos(radiansY));
return {x: vx + originX, y: vy + originY};
} | [
"function",
"rotatePoint",
"(",
"originX",
",",
"originY",
",",
"x",
",",
"y",
",",
"radiansX",
",",
"radiansY",
")",
"{",
"const",
"v",
"=",
"{",
"x",
":",
"x",
"-",
"originX",
",",
"y",
":",
"y",
"-",
"originY",
"}",
";",
"const",
"vx",
"=",
... | Rotates a point around the given origin
by the specified radians and returns the
rotated point.
@param originX The x coordinate of the point to rotate around.
@param originY The y coordinate of the point to rotate around.
@param x The x coordinate of the point to be rotated.
@param y The y coordinate of the point to b... | [
"Rotates",
"a",
"point",
"around",
"the",
"given",
"origin",
"by",
"the",
"specified",
"radians",
"and",
"returns",
"the",
"rotated",
"point",
"."
] | d88933a89e3dd8eeadd6f5ebb64b341b65d2e42a | https://github.com/justinwilaby/svg-path-interpolator/blob/d88933a89e3dd8eeadd6f5ebb64b341b65d2e42a/src/math/utils.js#L27-L32 |
44,494 | 5orenso/geo-lib | lib/geo-lib.js | isPointOnLineSegment | function isPointOnLineSegment(line1p1, line1p2, point) {
if (line1p2.lat <= Math.max(line1p1.lat, point.lat) && line1p2.lat >= Math.min(line1p1.lat, point.lat) &&
line1p2.lon <= Math.max(line1p1.lon, point.lon) && line1p2.lon >= Math.min(line1p1.lon, point.lon)) {
return true;
}
return false... | javascript | function isPointOnLineSegment(line1p1, line1p2, point) {
if (line1p2.lat <= Math.max(line1p1.lat, point.lat) && line1p2.lat >= Math.min(line1p1.lat, point.lat) &&
line1p2.lon <= Math.max(line1p1.lon, point.lon) && line1p2.lon >= Math.min(line1p1.lon, point.lon)) {
return true;
}
return false... | [
"function",
"isPointOnLineSegment",
"(",
"line1p1",
",",
"line1p2",
",",
"point",
")",
"{",
"if",
"(",
"line1p2",
".",
"lat",
"<=",
"Math",
".",
"max",
"(",
"line1p1",
".",
"lat",
",",
"point",
".",
"lat",
")",
"&&",
"line1p2",
".",
"lat",
">=",
"Mat... | Given three colinear points line1p1, line1p2, point, the function checks if point lies on line segment 'line' | [
"Given",
"three",
"colinear",
"points",
"line1p1",
"line1p2",
"point",
"the",
"function",
"checks",
"if",
"point",
"lies",
"on",
"line",
"segment",
"line"
] | be186a133cea75f77e65d3071c66899cbe2a792e | https://github.com/5orenso/geo-lib/blob/be186a133cea75f77e65d3071c66899cbe2a792e/lib/geo-lib.js#L236-L242 |
44,495 | reelyactive/barterer | lib/routes/whatat.js | retrieveWhatAtTransmitter | function retrieveWhatAtTransmitter(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
case 'html':
res.sendFile(path.resolve(__dirname + '/../../web/response.html'));
break;
default:
var options = {
query: 'receivedBy',
... | javascript | function retrieveWhatAtTransmitter(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
case 'html':
res.sendFile(path.resolve(__dirname + '/../../web/response.html'));
break;
default:
var options = {
query: 'receivedBy',
... | [
"function",
"retrieveWhatAtTransmitter",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"''",
",",
"''",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"req",
".",
"accepts",
"(",
... | Retrieve what is decoded by a specific receiver device.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Retrieve",
"what",
"is",
"decoded",
"by",
"a",
"specific",
"receiver",
"device",
"."
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/routes/whatat.js#L24-L47 |
44,496 | reelyactive/barterer | lib/server.js | BartererServer | function BartererServer(options) {
options = options || {};
var specifiedHttpPort = options.httpPort || HTTP_PORT;
var httpPort = process.env.PORT || specifiedHttpPort;
var app = express();
var instance = new Barterer(options);
options.app = app;
instance.configureRoutes(options);
app.listen(httpPort... | javascript | function BartererServer(options) {
options = options || {};
var specifiedHttpPort = options.httpPort || HTTP_PORT;
var httpPort = process.env.PORT || specifiedHttpPort;
var app = express();
var instance = new Barterer(options);
options.app = app;
instance.configureRoutes(options);
app.listen(httpPort... | [
"function",
"BartererServer",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"specifiedHttpPort",
"=",
"options",
".",
"httpPort",
"||",
"HTTP_PORT",
";",
"var",
"httpPort",
"=",
"process",
".",
"env",
".",
"PORT",
"||",
... | BartererServer Class
Server for barterer, returns an instance of barterer with its own Express
server listening on the given port.
@param {Object} options The options as a JSON object.
@constructor | [
"BartererServer",
"Class",
"Server",
"for",
"barterer",
"returns",
"an",
"instance",
"of",
"barterer",
"with",
"its",
"own",
"Express",
"server",
"listening",
"on",
"the",
"given",
"port",
"."
] | ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c | https://github.com/reelyactive/barterer/blob/ab4caa541b13c78cca3f4df9dcfc8f17c1c14c2c/lib/server.js#L22-L38 |
44,497 | gritzko/stream-url | src/ZeroServer.js | ZeroServer | function ZeroServer (url, options, callback) {
EventEmitter.call(this);
this.id = null;
//this.streams = {};
if (url) {
this.listen(url, options, callback);
}
} | javascript | function ZeroServer (url, options, callback) {
EventEmitter.call(this);
this.id = null;
//this.streams = {};
if (url) {
this.listen(url, options, callback);
}
} | [
"function",
"ZeroServer",
"(",
"url",
",",
"options",
",",
"callback",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"id",
"=",
"null",
";",
"//this.streams = {};",
"if",
"(",
"url",
")",
"{",
"this",
".",
"listen",
"(",
... | Fake server for ZeroStreams. | [
"Fake",
"server",
"for",
"ZeroStreams",
"."
] | 1291ed6a628fe4935a9f960e204f26771f13072b | https://github.com/gritzko/stream-url/blob/1291ed6a628fe4935a9f960e204f26771f13072b/src/ZeroServer.js#L6-L13 |
44,498 | ysugimoto/js-dependency-visualizer | visualize/d3Renderer.js | D3Renderer | function D3Renderer(view, graphData, options) {
/**
* View stack
*
* @property view
* @param Array
*/
this.view = view;
/**
* graph Data
*
* @property graph
* @param Object
*/
this.graph = graphDa... | javascript | function D3Renderer(view, graphData, options) {
/**
* View stack
*
* @property view
* @param Array
*/
this.view = view;
/**
* graph Data
*
* @property graph
* @param Object
*/
this.graph = graphDa... | [
"function",
"D3Renderer",
"(",
"view",
",",
"graphData",
",",
"options",
")",
"{",
"/**\n * View stack\n *\n * @property view\n * @param Array\n */",
"this",
".",
"view",
"=",
"view",
";",
"/**\n * graph Data\n *\n * @... | D3Render main class
@class D3Renderer
@constructor
@param {Array} view : d3.select() returns
@param {Object} graphData : DependencyParser::parse() returns
@param {Object} options | [
"D3Render",
"main",
"class"
] | 0dadd6986f5b585cf70ad6925c5aac33cdc15a69 | https://github.com/ysugimoto/js-dependency-visualizer/blob/0dadd6986f5b585cf70ad6925c5aac33cdc15a69/visualize/d3Renderer.js#L48-L160 |
44,499 | lynx-json/lynx-docs | src/cli/stream-utils.js | function (vinyl) {
return path.extname(vinyl.path) === ".lnxs" ? options.spec.dir : options.output;
} | javascript | function (vinyl) {
return path.extname(vinyl.path) === ".lnxs" ? options.spec.dir : options.output;
} | [
"function",
"(",
"vinyl",
")",
"{",
"return",
"path",
".",
"extname",
"(",
"vinyl",
".",
"path",
")",
"===",
"\".lnxs\"",
"?",
"options",
".",
"spec",
".",
"dir",
":",
"options",
".",
"output",
";",
"}"
] | convert from vinyl stream to regular stream | [
"convert",
"from",
"vinyl",
"stream",
"to",
"regular",
"stream"
] | 7f450fc348fedb4ecd16adeaac0e54bedebadec0 | https://github.com/lynx-json/lynx-docs/blob/7f450fc348fedb4ecd16adeaac0e54bedebadec0/src/cli/stream-utils.js#L17-L19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.