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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,600 | HumanBrainProject/jsdoc-sphinx | template/view-models/home.js | home | function home(context, cb) {
var viewModel = _.extend(
{
package: helper.find(context.data, {kind: 'package'})[0]
}, util.docletChildren(context, null, util.mainDocletKinds),
util.docletChildren(context, null, util.subDocletKinds),
util.rstMixin,
_.pick(context, ['readme'])
);
logger.de... | javascript | function home(context, cb) {
var viewModel = _.extend(
{
package: helper.find(context.data, {kind: 'package'})[0]
}, util.docletChildren(context, null, util.mainDocletKinds),
util.docletChildren(context, null, util.subDocletKinds),
util.rstMixin,
_.pick(context, ['readme'])
);
logger.de... | [
"function",
"home",
"(",
"context",
",",
"cb",
")",
"{",
"var",
"viewModel",
"=",
"_",
".",
"extend",
"(",
"{",
"package",
":",
"helper",
".",
"find",
"(",
"context",
".",
"data",
",",
"{",
"kind",
":",
"'package'",
"}",
")",
"[",
"0",
"]",
"}",
... | The Mustache template to render the first page.
@param {object} context the current context
@param {Function} cb called after the generation has been done | [
"The",
"Mustache",
"template",
"to",
"render",
"the",
"first",
"page",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/view-models/home.js#L13-L26 |
36,601 | vanwagonet/modules | lib/modules.js | resolve | function resolve(parent, id) {
if (/^\.\.?\//.test(id) && parent) { // is a relative id
id = parent.replace(/[^\/]+$/, id); // prepend parent's dirname
}
var terms = [];
id.split('/').forEach(function(term) {
if ('..' === term) { terms.pop(); } // remove previous, don't add ..
else if ('.' !== term) { terms.p... | javascript | function resolve(parent, id) {
if (/^\.\.?\//.test(id) && parent) { // is a relative id
id = parent.replace(/[^\/]+$/, id); // prepend parent's dirname
}
var terms = [];
id.split('/').forEach(function(term) {
if ('..' === term) { terms.pop(); } // remove previous, don't add ..
else if ('.' !== term) { terms.p... | [
"function",
"resolve",
"(",
"parent",
",",
"id",
")",
"{",
"if",
"(",
"/",
"^\\.\\.?\\/",
"/",
".",
"test",
"(",
"id",
")",
"&&",
"parent",
")",
"{",
"// is a relative id",
"id",
"=",
"parent",
".",
"replace",
"(",
"/",
"[^\\/]+$",
"/",
",",
"id",
... | Turn a relative id to absolute given a parent id | [
"Turn",
"a",
"relative",
"id",
"to",
"absolute",
"given",
"a",
"parent",
"id"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L22-L33 |
36,602 | vanwagonet/modules | lib/modules.js | translate | function translate(id, filename, buffer, options, next) {
var ext = (filename.match(extexp) || [])[1] || '',
encoding = options.encoding || exports.defaults.encoding,
trans = options.translate, js, nowrap;
// make a list of what not to wrap
nowrap = options.nowrap || exports.defaults.nowrap;
nowrap = [ 'define... | javascript | function translate(id, filename, buffer, options, next) {
var ext = (filename.match(extexp) || [])[1] || '',
encoding = options.encoding || exports.defaults.encoding,
trans = options.translate, js, nowrap;
// make a list of what not to wrap
nowrap = options.nowrap || exports.defaults.nowrap;
nowrap = [ 'define... | [
"function",
"translate",
"(",
"id",
",",
"filename",
",",
"buffer",
",",
"options",
",",
"next",
")",
"{",
"var",
"ext",
"=",
"(",
"filename",
".",
"match",
"(",
"extexp",
")",
"||",
"[",
"]",
")",
"[",
"1",
"]",
"||",
"''",
",",
"encoding",
"=",... | Convert arbitrary file to commonjs+return exports | [
"Convert",
"arbitrary",
"file",
"to",
"commonjs",
"+",
"return",
"exports"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L39-L98 |
36,603 | vanwagonet/modules | lib/modules.js | wrap | function wrap(err, js) {
if (err) { return next(err); }
var deps = exports.dependencies(id, js), params = [], undef = '';
// make sure require, exports, and module are properly passed into the factory
if (/\brequire\b/.test(js)) { params.push('require'); }
if (/\bexports\b/.test(js)) { params.push('exports'... | javascript | function wrap(err, js) {
if (err) { return next(err); }
var deps = exports.dependencies(id, js), params = [], undef = '';
// make sure require, exports, and module are properly passed into the factory
if (/\brequire\b/.test(js)) { params.push('require'); }
if (/\bexports\b/.test(js)) { params.push('exports'... | [
"function",
"wrap",
"(",
"err",
",",
"js",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"next",
"(",
"err",
")",
";",
"}",
"var",
"deps",
"=",
"exports",
".",
"dependencies",
"(",
"id",
",",
"js",
")",
",",
"params",
"=",
"[",
"]",
",",
"u... | convert commonjs to amd | [
"convert",
"commonjs",
"to",
"amd"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L53-L76 |
36,604 | vanwagonet/modules | lib/modules.js | getFilename | function getFilename(id, options, next) {
var Path = require('path'),
root = options.root || exports.defaults.root,
map = options.map || {},
forbid = (options.forbid || []).map(function(forbid) {
return forbid.test ? forbid : Path.resolve(root, forbid);
}),
filename;
function test(forbid) {
return for... | javascript | function getFilename(id, options, next) {
var Path = require('path'),
root = options.root || exports.defaults.root,
map = options.map || {},
forbid = (options.forbid || []).map(function(forbid) {
return forbid.test ? forbid : Path.resolve(root, forbid);
}),
filename;
function test(forbid) {
return for... | [
"function",
"getFilename",
"(",
"id",
",",
"options",
",",
"next",
")",
"{",
"var",
"Path",
"=",
"require",
"(",
"'path'",
")",
",",
"root",
"=",
"options",
".",
"root",
"||",
"exports",
".",
"defaults",
".",
"root",
",",
"map",
"=",
"options",
".",
... | convert module id to filename | [
"convert",
"module",
"id",
"to",
"filename"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L104-L150 |
36,605 | vanwagonet/modules | lib/modules.js | moduleToCode | function moduleToCode(id, r) {
exports.module(id, options, done);
function done(err, result) {
if (err) {
next(err);
next = function(){}; // make sure you only call next(err) once
return;
}
if (result && (!modified || result.modified > modified)) {
modified = result.modified; // update lat... | javascript | function moduleToCode(id, r) {
exports.module(id, options, done);
function done(err, result) {
if (err) {
next(err);
next = function(){}; // make sure you only call next(err) once
return;
}
if (result && (!modified || result.modified > modified)) {
modified = result.modified; // update lat... | [
"function",
"moduleToCode",
"(",
"id",
",",
"r",
")",
"{",
"exports",
".",
"module",
"(",
"id",
",",
"options",
",",
"done",
")",
";",
"function",
"done",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"{",
"next",
"(",
"err",
")",
... | convert a module | [
"convert",
"a",
"module"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L264-L281 |
36,606 | vanwagonet/modules | lib/modules.js | alldone | function alldone() {
// combine and compress modules
var module = {
code: results.join(''),
modified: modified
};
// no compressing? done.
if (!compress) { return next(null, module); }
compress(module, function(err, js) {
module.code = js.code || js;
next(err, err ? null : module);
});
} | javascript | function alldone() {
// combine and compress modules
var module = {
code: results.join(''),
modified: modified
};
// no compressing? done.
if (!compress) { return next(null, module); }
compress(module, function(err, js) {
module.code = js.code || js;
next(err, err ? null : module);
});
} | [
"function",
"alldone",
"(",
")",
"{",
"// combine and compress modules",
"var",
"module",
"=",
"{",
"code",
":",
"results",
".",
"join",
"(",
"''",
")",
",",
"modified",
":",
"modified",
"}",
";",
"// no compressing? done.",
"if",
"(",
"!",
"compress",
")",
... | put it all together | [
"put",
"it",
"all",
"together"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/modules.js#L284-L298 |
36,607 | AdminJuwel191/node-mvc | framework/core/logger.js | exec_console | function exec_console(func, log, format) {
if (format === 'json') {
func(JSON.stringify(log));
} else {
func(
' ' + log.type + '\n',
'CREATED: ' + log.created + '\t ' + '\n',
'... | javascript | function exec_console(func, log, format) {
if (format === 'json') {
func(JSON.stringify(log));
} else {
func(
' ' + log.type + '\n',
'CREATED: ' + log.created + '\t ' + '\n',
'... | [
"function",
"exec_console",
"(",
"func",
",",
"log",
",",
"format",
")",
"{",
"if",
"(",
"format",
"===",
"'json'",
")",
"{",
"func",
"(",
"JSON",
".",
"stringify",
"(",
"log",
")",
")",
";",
"}",
"else",
"{",
"func",
"(",
"' '",
"+",
"log",
".",... | Exec console output
@param func
@param log | [
"Exec",
"console",
"output"
] | 07c40ca18962cbd17c6df1d4e4b6de494aceff8d | https://github.com/AdminJuwel191/node-mvc/blob/07c40ca18962cbd17c6df1d4e4b6de494aceff8d/framework/core/logger.js#L209-L221 |
36,608 | thenables/thenify-all | index.js | withCallback | function withCallback(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
} | javascript | function withCallback(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
} | [
"function",
"withCallback",
"(",
"source",
",",
"destination",
",",
"methods",
")",
"{",
"return",
"promisifyAll",
"(",
"source",
",",
"destination",
",",
"methods",
",",
"thenify",
".",
"withCallback",
")",
"}"
] | Promisifies all the selected functions in an object and backward compatible with callback.
@param {Object} source the source object for the async functions
@param {Object} [destination] the destination to set all the promisified methods
@param {Array} [methods] an array of method names of `source`
@return {Object}
@ap... | [
"Promisifies",
"all",
"the",
"selected",
"functions",
"in",
"an",
"object",
"and",
"backward",
"compatible",
"with",
"callback",
"."
] | f436113d8076adb9138c222a61689acdef6f6bd9 | https://github.com/thenables/thenify-all/blob/f436113d8076adb9138c222a61689acdef6f6bd9/index.js#L32-L34 |
36,609 | vanwagonet/modules | lib/define.js | map | function map(arr, fn) {
for (var arr2 = [], a = 0, aa = arr.length; a < aa; ++a) { arr2[a] = fn(arr[a]); }
return arr2;
} | javascript | function map(arr, fn) {
for (var arr2 = [], a = 0, aa = arr.length; a < aa; ++a) { arr2[a] = fn(arr[a]); }
return arr2;
} | [
"function",
"map",
"(",
"arr",
",",
"fn",
")",
"{",
"for",
"(",
"var",
"arr2",
"=",
"[",
"]",
",",
"a",
"=",
"0",
",",
"aa",
"=",
"arr",
".",
"length",
";",
"a",
"<",
"aa",
";",
"++",
"a",
")",
"{",
"arr2",
"[",
"a",
"]",
"=",
"fn",
"("... | a poor-man's Array.prototype.map | [
"a",
"poor",
"-",
"man",
"s",
"Array",
".",
"prototype",
".",
"map"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L9-L12 |
36,610 | vanwagonet/modules | lib/define.js | fireWaits | function fireWaits(module) {
map(waits[module.id], function(fn) { fn(module); });
waits[module.id] = [];
} | javascript | function fireWaits(module) {
map(waits[module.id], function(fn) { fn(module); });
waits[module.id] = [];
} | [
"function",
"fireWaits",
"(",
"module",
")",
"{",
"map",
"(",
"waits",
"[",
"module",
".",
"id",
"]",
",",
"function",
"(",
"fn",
")",
"{",
"fn",
"(",
"module",
")",
";",
"}",
")",
";",
"waits",
"[",
"module",
".",
"id",
"]",
"=",
"[",
"]",
"... | run all functions waiting for the module | [
"run",
"all",
"functions",
"waiting",
"for",
"the",
"module"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L15-L18 |
36,611 | vanwagonet/modules | lib/define.js | define | function define(id, deps, exp) {
if (!exp) { exp = deps; deps = [ 'require', 'exports', 'module' ]; }
var module = getModule(undefined, id);
module.children = map(deps, function(dep) { return getModule(module, dep); });
module.loaded = true;
factories[id] = exp;
fireWaits(module);
} | javascript | function define(id, deps, exp) {
if (!exp) { exp = deps; deps = [ 'require', 'exports', 'module' ]; }
var module = getModule(undefined, id);
module.children = map(deps, function(dep) { return getModule(module, dep); });
module.loaded = true;
factories[id] = exp;
fireWaits(module);
} | [
"function",
"define",
"(",
"id",
",",
"deps",
",",
"exp",
")",
"{",
"if",
"(",
"!",
"exp",
")",
"{",
"exp",
"=",
"deps",
";",
"deps",
"=",
"[",
"'require'",
",",
"'exports'",
",",
"'module'",
"]",
";",
"}",
"var",
"module",
"=",
"getModule",
"(",... | define a new module | [
"define",
"a",
"new",
"module"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L32-L39 |
36,612 | vanwagonet/modules | lib/define.js | makeRequire | function makeRequire(module) {
var mrequire = function(id, fn) { return require(module, id, fn); };
mrequire.resolve = function(id) { return getModule(module, id).uri; };
mrequire.toUrl = function(id) {
return getModule(module, id.replace(/\.[^.\\\/]+$/, ''))
.uri.replace(/\.js$/i, id.match(/\.[^.\\\/]+$/)... | javascript | function makeRequire(module) {
var mrequire = function(id, fn) { return require(module, id, fn); };
mrequire.resolve = function(id) { return getModule(module, id).uri; };
mrequire.toUrl = function(id) {
return getModule(module, id.replace(/\.[^.\\\/]+$/, ''))
.uri.replace(/\.js$/i, id.match(/\.[^.\\\/]+$/)... | [
"function",
"makeRequire",
"(",
"module",
")",
"{",
"var",
"mrequire",
"=",
"function",
"(",
"id",
",",
"fn",
")",
"{",
"return",
"require",
"(",
"module",
",",
"id",
",",
"fn",
")",
";",
"}",
";",
"mrequire",
".",
"resolve",
"=",
"function",
"(",
... | build out the require function specific to the module scope | [
"build",
"out",
"the",
"require",
"function",
"specific",
"to",
"the",
"module",
"scope"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L42-L53 |
36,613 | vanwagonet/modules | lib/define.js | getModule | function getModule(parent, id) {
if ('require' === id || 'exports' === id || 'module' === id) {
return { id:id, loaded:true, exports:parent[id] || parent, children:[] };
}
id = resolve(parent, id).replace(/\.js$/i, '');
if (modules[id]) { return modules[id]; }
var uri = canonicalize(urls[id] ? urls[id] : ... | javascript | function getModule(parent, id) {
if ('require' === id || 'exports' === id || 'module' === id) {
return { id:id, loaded:true, exports:parent[id] || parent, children:[] };
}
id = resolve(parent, id).replace(/\.js$/i, '');
if (modules[id]) { return modules[id]; }
var uri = canonicalize(urls[id] ? urls[id] : ... | [
"function",
"getModule",
"(",
"parent",
",",
"id",
")",
"{",
"if",
"(",
"'require'",
"===",
"id",
"||",
"'exports'",
"===",
"id",
"||",
"'module'",
"===",
"id",
")",
"{",
"return",
"{",
"id",
":",
"id",
",",
"loaded",
":",
"true",
",",
"exports",
"... | build or retrieve a specific module object | [
"build",
"or",
"retrieve",
"a",
"specific",
"module",
"object"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L56-L68 |
36,614 | vanwagonet/modules | lib/define.js | require | function require(parent, id, fn) {
if (fn) { return ensure(parent, id, fn); }
var module = getModule(parent, id);
if (!module.loaded) { throw new Error(id + ' not found'); }
if (!('exports' in module)) {
module.parent = parent; // first module to actually require this one is parent
// if define was passe... | javascript | function require(parent, id, fn) {
if (fn) { return ensure(parent, id, fn); }
var module = getModule(parent, id);
if (!module.loaded) { throw new Error(id + ' not found'); }
if (!('exports' in module)) {
module.parent = parent; // first module to actually require this one is parent
// if define was passe... | [
"function",
"require",
"(",
"parent",
",",
"id",
",",
"fn",
")",
"{",
"if",
"(",
"fn",
")",
"{",
"return",
"ensure",
"(",
"parent",
",",
"id",
",",
"fn",
")",
";",
"}",
"var",
"module",
"=",
"getModule",
"(",
"parent",
",",
"id",
")",
";",
"if"... | execute a module's code, and return its exports | [
"execute",
"a",
"module",
"s",
"code",
"and",
"return",
"its",
"exports"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L71-L88 |
36,615 | vanwagonet/modules | lib/define.js | ensure | function ensure(parent, ids, fn) {
ids = [].concat(ids);
var visited = {}, wait = 0;
function done() {
if (fn) { fn.apply(global, map(ids, function(id) { return require(parent, id); })); }
fn = undefined;
}
function visit(module) {
if (module.id in visited) { return; }
if ((visited[module.id] = m... | javascript | function ensure(parent, ids, fn) {
ids = [].concat(ids);
var visited = {}, wait = 0;
function done() {
if (fn) { fn.apply(global, map(ids, function(id) { return require(parent, id); })); }
fn = undefined;
}
function visit(module) {
if (module.id in visited) { return; }
if ((visited[module.id] = m... | [
"function",
"ensure",
"(",
"parent",
",",
"ids",
",",
"fn",
")",
"{",
"ids",
"=",
"[",
"]",
".",
"concat",
"(",
"ids",
")",
";",
"var",
"visited",
"=",
"{",
"}",
",",
"wait",
"=",
"0",
";",
"function",
"done",
"(",
")",
"{",
"if",
"(",
"fn",
... | make sure the modules are loaded | [
"make",
"sure",
"the",
"modules",
"are",
"loaded"
] | eb2a0c9c54040937f7e361783cbaa0121713498c | https://github.com/vanwagonet/modules/blob/eb2a0c9c54040937f7e361783cbaa0121713498c/lib/define.js#L105-L143 |
36,616 | Dashron/roads | src/middleware/parseBody.js | parseBody | function parseBody (body, content_type) {
if (typeof(body) === "object" || Array.isArray(body) || !body) {
// no need to parse if it's already an object
return body;
}
let parsed_content_type = content_type_module.parse(content_type);
if (parsed_content_type.type === 'application/json') {
// parse json
re... | javascript | function parseBody (body, content_type) {
if (typeof(body) === "object" || Array.isArray(body) || !body) {
// no need to parse if it's already an object
return body;
}
let parsed_content_type = content_type_module.parse(content_type);
if (parsed_content_type.type === 'application/json') {
// parse json
re... | [
"function",
"parseBody",
"(",
"body",
",",
"content_type",
")",
"{",
"if",
"(",
"typeof",
"(",
"body",
")",
"===",
"\"object\"",
"||",
"Array",
".",
"isArray",
"(",
"body",
")",
"||",
"!",
"body",
")",
"{",
"// no need to parse if it's already an object",
"r... | Translate the request body into a usable value.
If the content type is application/json this will attempt to parse that json
If application/x-www-form-urlencoded this will attempt to parse it as a query format
Otherwise this will return a string
@param {mixed} body - request body
@param {string} content_type - medi... | [
"Translate",
"the",
"request",
"body",
"into",
"a",
"usable",
"value",
"."
] | c089d79d8181063c7fae00432a79b7a79a7809d3 | https://github.com/Dashron/roads/blob/c089d79d8181063c7fae00432a79b7a79a7809d3/src/middleware/parseBody.js#L25-L43 |
36,617 | Dashron/roads | src/client/build.js | fixExclude | function fixExclude(exclude_list) {
if (!exclude_list) {
exclude_list = [];
}
exclude_list.push(__filename);
exclude_list.push(__dirname + '/../../tests');
exclude_list.push(__dirname + '/../integrations/koa.js');
exclude_list.push(__dirname + '/../integrations/express.js');
exclude_list.push(__dirname + '/..... | javascript | function fixExclude(exclude_list) {
if (!exclude_list) {
exclude_list = [];
}
exclude_list.push(__filename);
exclude_list.push(__dirname + '/../../tests');
exclude_list.push(__dirname + '/../integrations/koa.js');
exclude_list.push(__dirname + '/../integrations/express.js');
exclude_list.push(__dirname + '/..... | [
"function",
"fixExclude",
"(",
"exclude_list",
")",
"{",
"if",
"(",
"!",
"exclude_list",
")",
"{",
"exclude_list",
"=",
"[",
"]",
";",
"}",
"exclude_list",
".",
"push",
"(",
"__filename",
")",
";",
"exclude_list",
".",
"push",
"(",
"__dirname",
"+",
"'/.... | An array of files or node modules to exclude in browserify. Excluded modules will throw an exception
if they are required
@param {Array} exclude_list - Array of file paths or node module names to exclude
@returns {Array} exclude_list with defaults applied | [
"An",
"array",
"of",
"files",
"or",
"node",
"modules",
"to",
"exclude",
"in",
"browserify",
".",
"Excluded",
"modules",
"will",
"throw",
"an",
"exception",
"if",
"they",
"are",
"required"
] | c089d79d8181063c7fae00432a79b7a79a7809d3 | https://github.com/Dashron/roads/blob/c089d79d8181063c7fae00432a79b7a79a7809d3/src/client/build.js#L63-L74 |
36,618 | Dashron/roads | src/client/build.js | fixOptions | function fixOptions (options) {
if (!options) {
options = {};
}
options.use_sourcemaps = options.use_sourcemaps ? true : false;
options.babelify = fixBabelify(options.babelify);
// options.external = fixExternal(options.external);
options.ignore = fixIgnore(options.ignore);
options.exclude = fixExclude(optio... | javascript | function fixOptions (options) {
if (!options) {
options = {};
}
options.use_sourcemaps = options.use_sourcemaps ? true : false;
options.babelify = fixBabelify(options.babelify);
// options.external = fixExternal(options.external);
options.ignore = fixIgnore(options.ignore);
options.exclude = fixExclude(optio... | [
"function",
"fixOptions",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"options",
".",
"use_sourcemaps",
"=",
"options",
".",
"use_sourcemaps",
"?",
"true",
":",
"false",
";",
"options",
".",
"babel... | Applies defaults and cleanup to the options sent to the method exposed by this file
@param {object} options - The options passed into the function exposed by this file
@returns {object} options with defaults applied | [
"Applies",
"defaults",
"and",
"cleanup",
"to",
"the",
"options",
"sent",
"to",
"the",
"method",
"exposed",
"by",
"this",
"file"
] | c089d79d8181063c7fae00432a79b7a79a7809d3 | https://github.com/Dashron/roads/blob/c089d79d8181063c7fae00432a79b7a79a7809d3/src/client/build.js#L82-L94 |
36,619 | HumanBrainProject/jsdoc-sphinx | template/view-models/doclet.js | docletModel | function docletModel(doclet) {
return function(context, cb) {
logger.debug('doclet', doclet);
var viewModel = _.extend({},
util.rstMixin,
util.docletChildren(context, doclet, util.mainDocletKinds),
// (doclet.kind === 'module' ? {} :
// util.docletChildren(context, doclet, util.subDo... | javascript | function docletModel(doclet) {
return function(context, cb) {
logger.debug('doclet', doclet);
var viewModel = _.extend({},
util.rstMixin,
util.docletChildren(context, doclet, util.mainDocletKinds),
// (doclet.kind === 'module' ? {} :
// util.docletChildren(context, doclet, util.subDo... | [
"function",
"docletModel",
"(",
"doclet",
")",
"{",
"return",
"function",
"(",
"context",
",",
"cb",
")",
"{",
"logger",
".",
"debug",
"(",
"'doclet'",
",",
"doclet",
")",
";",
"var",
"viewModel",
"=",
"_",
".",
"extend",
"(",
"{",
"}",
",",
"util",
... | The Mustache ViewModel to render a doclet.
@param {object} doclet the doclet to render
@return {function} the template helper func | [
"The",
"Mustache",
"ViewModel",
"to",
"render",
"a",
"doclet",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/view-models/doclet.js#L11-L27 |
36,620 | FINRAOS/MSL | msl-client-browser/appcontainer-driver.js | escapeString | function escapeString(str) {
if(str === undefined) {
throw new Error('\'str\' is required');
}
if(str === null) {
throw new Error('\'str\' must not be null');
}
if(typeof str !== 'string') {
throw new Error('\'str\' must be a string');
}
/*
* Need to escape b... | javascript | function escapeString(str) {
if(str === undefined) {
throw new Error('\'str\' is required');
}
if(str === null) {
throw new Error('\'str\' must not be null');
}
if(typeof str !== 'string') {
throw new Error('\'str\' must be a string');
}
/*
* Need to escape b... | [
"function",
"escapeString",
"(",
"str",
")",
"{",
"if",
"(",
"str",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\\'str\\' is required'",
")",
";",
"}",
"if",
"(",
"str",
"===",
"null",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\\'str\... | Escapes single, double quotes, and backslashes of the given string.
@name escapeString
@param {string} str - string to escape
@returns {string} the escaped string | [
"Escapes",
"single",
"double",
"quotes",
"and",
"backslashes",
"of",
"the",
"given",
"string",
"."
] | c8e2d79749551c551fc42b8ed80d3321141df845 | https://github.com/FINRAOS/MSL/blob/c8e2d79749551c551fc42b8ed80d3321141df845/msl-client-browser/appcontainer-driver.js#L189-L217 |
36,621 | blakeembrey/highlighter | highlighter.js | highlight | function highlight (code, lang) {
if (!lang) {
return code
}
var isDiff = DIFF_REGEXP.test(lang)
// Remove the diff suffix. E.g. "javascript.diff".
lang = lang.replace(DIFF_REGEXP, '')
// Ignore unknown languages.
if (!isDiff && !supported(lang)) {
return code
}
return isDiff ? diff(code, ... | javascript | function highlight (code, lang) {
if (!lang) {
return code
}
var isDiff = DIFF_REGEXP.test(lang)
// Remove the diff suffix. E.g. "javascript.diff".
lang = lang.replace(DIFF_REGEXP, '')
// Ignore unknown languages.
if (!isDiff && !supported(lang)) {
return code
}
return isDiff ? diff(code, ... | [
"function",
"highlight",
"(",
"code",
",",
"lang",
")",
"{",
"if",
"(",
"!",
"lang",
")",
"{",
"return",
"code",
"}",
"var",
"isDiff",
"=",
"DIFF_REGEXP",
".",
"test",
"(",
"lang",
")",
"// Remove the diff suffix. E.g. \"javascript.diff\".",
"lang",
"=",
"la... | Syntax highlighting in the format Marked supports.
@param {String} code
@param {String} lang
@return {String} | [
"Syntax",
"highlighting",
"in",
"the",
"format",
"Marked",
"supports",
"."
] | 65d9a2d65ece87f2f245536e94d5eb1dc4707106 | https://github.com/blakeembrey/highlighter/blob/65d9a2d65ece87f2f245536e94d5eb1dc4707106/highlighter.js#L49-L65 |
36,622 | blakeembrey/highlighter | highlighter.js | diff | function diff (code, lang) {
var sections = []
code.split(/\r?\n/g).forEach(function (line) {
var type
if (CHUNK_REGEXP.test(line)) {
type = 'chunk'
} else if (HEADER_REGEXP.test(line)) {
type = 'header'
} else {
type = PATCH_TYPES[line[0]] || 'null'
line = line.replace(/^[... | javascript | function diff (code, lang) {
var sections = []
code.split(/\r?\n/g).forEach(function (line) {
var type
if (CHUNK_REGEXP.test(line)) {
type = 'chunk'
} else if (HEADER_REGEXP.test(line)) {
type = 'header'
} else {
type = PATCH_TYPES[line[0]] || 'null'
line = line.replace(/^[... | [
"function",
"diff",
"(",
"code",
",",
"lang",
")",
"{",
"var",
"sections",
"=",
"[",
"]",
"code",
".",
"split",
"(",
"/",
"\\r?\\n",
"/",
"g",
")",
".",
"forEach",
"(",
"function",
"(",
"line",
")",
"{",
"var",
"type",
"if",
"(",
"CHUNK_REGEXP",
... | Add diff syntax highlighting to code.
@param {String} code
@param {String} lang
@return {String} | [
"Add",
"diff",
"syntax",
"highlighting",
"to",
"code",
"."
] | 65d9a2d65ece87f2f245536e94d5eb1dc4707106 | https://github.com/blakeembrey/highlighter/blob/65d9a2d65ece87f2f245536e94d5eb1dc4707106/highlighter.js#L74-L112 |
36,623 | blakeembrey/highlighter | highlighter.js | highlightSections | function highlightSections (sections, lang) {
if (!supported(lang)) {
return sections
}
// Keep track of the most recent stacks.
var additionStack
var deletionStack
sections
.forEach(function (section) {
var type = section.type
// Reset the stacks for metadata types.
if (type ==... | javascript | function highlightSections (sections, lang) {
if (!supported(lang)) {
return sections
}
// Keep track of the most recent stacks.
var additionStack
var deletionStack
sections
.forEach(function (section) {
var type = section.type
// Reset the stacks for metadata types.
if (type ==... | [
"function",
"highlightSections",
"(",
"sections",
",",
"lang",
")",
"{",
"if",
"(",
"!",
"supported",
"(",
"lang",
")",
")",
"{",
"return",
"sections",
"}",
"// Keep track of the most recent stacks.",
"var",
"additionStack",
"var",
"deletionStack",
"sections",
"."... | Add syntax highlighting to all sections.
@param {Array} sections
@param {String} lang
@return {Array} | [
"Add",
"syntax",
"highlighting",
"to",
"all",
"sections",
"."
] | 65d9a2d65ece87f2f245536e94d5eb1dc4707106 | https://github.com/blakeembrey/highlighter/blob/65d9a2d65ece87f2f245536e94d5eb1dc4707106/highlighter.js#L121-L158 |
36,624 | danigb/smplr | packages/audio-pack/index.js | encode | function encode (filename) {
var ext = path.extname(filename)
var data = fs.readFileSync(filename)
var prefix = 'data:audio/' + ext.substring(1) + ';base64,'
var encoded = new Buffer(data).toString('base64')
return prefix + encoded
} | javascript | function encode (filename) {
var ext = path.extname(filename)
var data = fs.readFileSync(filename)
var prefix = 'data:audio/' + ext.substring(1) + ';base64,'
var encoded = new Buffer(data).toString('base64')
return prefix + encoded
} | [
"function",
"encode",
"(",
"filename",
")",
"{",
"var",
"ext",
"=",
"path",
".",
"extname",
"(",
"filename",
")",
"var",
"data",
"=",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
"var",
"prefix",
"=",
"'data:audio/'",
"+",
"ext",
".",
"substring",
... | Encode an audio file using base64 | [
"Encode",
"an",
"audio",
"file",
"using",
"base64"
] | d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1 | https://github.com/danigb/smplr/blob/d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1/packages/audio-pack/index.js#L7-L13 |
36,625 | danigb/smplr | packages/audio-pack/index.js | audioExt | function audioExt (name) {
var ext = path.extname(name)
return ['.wav', '.ogg', '.mp3'].indexOf(ext) > -1 ? ext : null
} | javascript | function audioExt (name) {
var ext = path.extname(name)
return ['.wav', '.ogg', '.mp3'].indexOf(ext) > -1 ? ext : null
} | [
"function",
"audioExt",
"(",
"name",
")",
"{",
"var",
"ext",
"=",
"path",
".",
"extname",
"(",
"name",
")",
"return",
"[",
"'.wav'",
",",
"'.ogg'",
",",
"'.mp3'",
"]",
".",
"indexOf",
"(",
"ext",
")",
">",
"-",
"1",
"?",
"ext",
":",
"null",
"}"
] | Return the extension of a filename if its a valid web audio format extension | [
"Return",
"the",
"extension",
"of",
"a",
"filename",
"if",
"its",
"a",
"valid",
"web",
"audio",
"format",
"extension"
] | d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1 | https://github.com/danigb/smplr/blob/d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1/packages/audio-pack/index.js#L18-L21 |
36,626 | danigb/smplr | packages/audio-pack/index.js | build | function build (instFile) {
var dir = path.dirname(instFile)
var inst = JSON.parse(fs.readFileSync(instFile))
inst.samples = samples(path.join(dir, 'samples'), true)
return JSON.stringify(inst, null, 2)
} | javascript | function build (instFile) {
var dir = path.dirname(instFile)
var inst = JSON.parse(fs.readFileSync(instFile))
inst.samples = samples(path.join(dir, 'samples'), true)
return JSON.stringify(inst, null, 2)
} | [
"function",
"build",
"(",
"instFile",
")",
"{",
"var",
"dir",
"=",
"path",
".",
"dirname",
"(",
"instFile",
")",
"var",
"inst",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
"(",
"instFile",
")",
")",
"inst",
".",
"samples",
"=",
"sample... | Build a JSON packed file from the instrument.json file | [
"Build",
"a",
"JSON",
"packed",
"file",
"from",
"the",
"instrument",
".",
"json",
"file"
] | d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1 | https://github.com/danigb/smplr/blob/d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1/packages/audio-pack/index.js#L26-L31 |
36,627 | danigb/smplr | packages/audio-pack/index.js | samples | function samples (samplesPath, obj) {
var files = fs.readdirSync(samplesPath).reduce(function (d, name) {
var ext = audioExt(name)
if (ext) d[name.substring(0, name.length - ext.length)] = name
return d
}, {})
var names = Object.keys(files)
var prefix = sharedStart(names)
var len = prefix.length
... | javascript | function samples (samplesPath, obj) {
var files = fs.readdirSync(samplesPath).reduce(function (d, name) {
var ext = audioExt(name)
if (ext) d[name.substring(0, name.length - ext.length)] = name
return d
}, {})
var names = Object.keys(files)
var prefix = sharedStart(names)
var len = prefix.length
... | [
"function",
"samples",
"(",
"samplesPath",
",",
"obj",
")",
"{",
"var",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"samplesPath",
")",
".",
"reduce",
"(",
"function",
"(",
"d",
",",
"name",
")",
"{",
"var",
"ext",
"=",
"audioExt",
"(",
"name",
")",... | Return a JSON with the audio files from a path encoded in base64 | [
"Return",
"a",
"JSON",
"with",
"the",
"audio",
"files",
"from",
"a",
"path",
"encoded",
"in",
"base64"
] | d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1 | https://github.com/danigb/smplr/blob/d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1/packages/audio-pack/index.js#L36-L50 |
36,628 | joshbuddy/tcplock | examples/oo-mutex.js | function(activateNextConnection) {
if ( (count % 20) == 0 || timeoutOccurred) {
timeoutOccurred = false;
exec('killall -9 soffice.bin libreoffice soffice', function(error, stdout, stderr) {
waitForOOState('closed', function() {
exec('libreoffice -headless -nofirststartwizard -accept="socket,host=0.0... | javascript | function(activateNextConnection) {
if ( (count % 20) == 0 || timeoutOccurred) {
timeoutOccurred = false;
exec('killall -9 soffice.bin libreoffice soffice', function(error, stdout, stderr) {
waitForOOState('closed', function() {
exec('libreoffice -headless -nofirststartwizard -accept="socket,host=0.0... | [
"function",
"(",
"activateNextConnection",
")",
"{",
"if",
"(",
"(",
"count",
"%",
"20",
")",
"==",
"0",
"||",
"timeoutOccurred",
")",
"{",
"timeoutOccurred",
"=",
"false",
";",
"exec",
"(",
"'killall -9 soffice.bin libreoffice soffice'",
",",
"function",
"(",
... | Only alow OOP to run for 20 seconds. | [
"Only",
"alow",
"OOP",
"to",
"run",
"for",
"20",
"seconds",
"."
] | 1c50a86fb8da94ea6f7984caadf9682f8875b1e8 | https://github.com/joshbuddy/tcplock/blob/1c50a86fb8da94ea6f7984caadf9682f8875b1e8/examples/oo-mutex.js#L25-L42 | |
36,629 | phphe/helper-js | dist/helper-js.es.js | arraySibling | function arraySibling(arr, item, offset) {
var index = arr.indexOf(item);
if (index === -1) {
throw 'item is not in array';
}
if (isArray(offset)) {
return offset.map(function (v) {
return arr[index + v];
});
}
return arr[index + offset];
} | javascript | function arraySibling(arr, item, offset) {
var index = arr.indexOf(item);
if (index === -1) {
throw 'item is not in array';
}
if (isArray(offset)) {
return offset.map(function (v) {
return arr[index + v];
});
}
return arr[index + offset];
} | [
"function",
"arraySibling",
"(",
"arr",
",",
"item",
",",
"offset",
")",
"{",
"var",
"index",
"=",
"arr",
".",
"indexOf",
"(",
"item",
")",
";",
"if",
"(",
"index",
"===",
"-",
"1",
")",
"{",
"throw",
"'item is not in array'",
";",
"}",
"if",
"(",
... | offset can be many | [
"offset",
"can",
"be",
"many"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L361-L375 |
36,630 | phphe/helper-js | dist/helper-js.es.js | forAll | function forAll(val, handler, reverse) {
if (!reverse) {
if (isArray(val) || isString(val)) {
for (var i = 0; i < val.length; i++) {
if (handler(val[i], i) === false) {
break;
}
}
} else if (isObject(val)) {
for (var _i2 = 0, _Object$keys = Object.keys(val); _i2 < _... | javascript | function forAll(val, handler, reverse) {
if (!reverse) {
if (isArray(val) || isString(val)) {
for (var i = 0; i < val.length; i++) {
if (handler(val[i], i) === false) {
break;
}
}
} else if (isObject(val)) {
for (var _i2 = 0, _Object$keys = Object.keys(val); _i2 < _... | [
"function",
"forAll",
"(",
"val",
",",
"handler",
",",
"reverse",
")",
"{",
"if",
"(",
"!",
"reverse",
")",
"{",
"if",
"(",
"isArray",
"(",
"val",
")",
"||",
"isString",
"(",
"val",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"... | loop for all type | [
"loop",
"for",
"all",
"type"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L487-L536 |
36,631 | phphe/helper-js | dist/helper-js.es.js | executeWithCount | function executeWithCount(func) {
var count = 0;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
args[_key2] = arguments[_key2];
}
return func.call.apply(func, [this, count++].concat(args));
};
} | javascript | function executeWithCount(func) {
var count = 0;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
args[_key2] = arguments[_key2];
}
return func.call.apply(func, [this, count++].concat(args));
};
} | [
"function",
"executeWithCount",
"(",
"func",
")",
"{",
"var",
"count",
"=",
"0",
";",
"return",
"function",
"(",
")",
"{",
"for",
"(",
"var",
"_len",
"=",
"arguments",
".",
"length",
",",
"args",
"=",
"new",
"Array",
"(",
"_len",
")",
",",
"_key2",
... | function helper | method helper | [
"function",
"helper",
"|",
"method",
"helper"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L824-L833 |
36,632 | phphe/helper-js | dist/helper-js.es.js | executePromiseGetters | function executePromiseGetters(getters) {
var concurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var stopped;
var promise = new Promise(function (resolve, reject) {
var r = [];
var chunks = splitArray(getters, concurrent);
var promise = Promise.resolve();
chunks.fo... | javascript | function executePromiseGetters(getters) {
var concurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var stopped;
var promise = new Promise(function (resolve, reject) {
var r = [];
var chunks = splitArray(getters, concurrent);
var promise = Promise.resolve();
chunks.fo... | [
"function",
"executePromiseGetters",
"(",
"getters",
")",
"{",
"var",
"concurrent",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"1",
";",
"var",
"stopped",
";",
... | promise execute promise in sequence | [
"promise",
"execute",
"promise",
"in",
"sequence"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L1031-L1064 |
36,633 | phphe/helper-js | dist/helper-js.es.js | getOffsetParent | function getOffsetParent(el) {
var offsetParent = el.offsetParent;
if (!offsetParent || offsetParent === document.body && getComputedStyle(document.body).position === 'static') {
offsetParent = document.body.parentElement;
}
return offsetParent;
} | javascript | function getOffsetParent(el) {
var offsetParent = el.offsetParent;
if (!offsetParent || offsetParent === document.body && getComputedStyle(document.body).position === 'static') {
offsetParent = document.body.parentElement;
}
return offsetParent;
} | [
"function",
"getOffsetParent",
"(",
"el",
")",
"{",
"var",
"offsetParent",
"=",
"el",
".",
"offsetParent",
";",
"if",
"(",
"!",
"offsetParent",
"||",
"offsetParent",
"===",
"document",
".",
"body",
"&&",
"getComputedStyle",
"(",
"document",
".",
"body",
")",... | there is some trap in el.offsetParent, so use this func to fix | [
"there",
"is",
"some",
"trap",
"in",
"el",
".",
"offsetParent",
"so",
"use",
"this",
"func",
"to",
"fix"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L1171-L1179 |
36,634 | phphe/helper-js | dist/helper-js.es.js | URLHelper | function URLHelper(baseUrl) {
var _this3 = this;
_classCallCheck(this, URLHelper);
_defineProperty(this, "baseUrl", '');
_defineProperty(this, "search", {});
var t = decodeURI(baseUrl).split('?');
this.baseUrl = t[0];
if (t[1]) {
t[1].split('&').forEach(function (v) {
var ... | javascript | function URLHelper(baseUrl) {
var _this3 = this;
_classCallCheck(this, URLHelper);
_defineProperty(this, "baseUrl", '');
_defineProperty(this, "search", {});
var t = decodeURI(baseUrl).split('?');
this.baseUrl = t[0];
if (t[1]) {
t[1].split('&').forEach(function (v) {
var ... | [
"function",
"URLHelper",
"(",
"baseUrl",
")",
"{",
"var",
"_this3",
"=",
"this",
";",
"_classCallCheck",
"(",
"this",
",",
"URLHelper",
")",
";",
"_defineProperty",
"(",
"this",
",",
"\"baseUrl\"",
",",
"''",
")",
";",
"_defineProperty",
"(",
"this",
",",
... | protocol, hostname, port, pastname | [
"protocol",
"hostname",
"port",
"pastname"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L1821-L1839 |
36,635 | phphe/helper-js | dist/helper-js.es.js | makeStorageHelper | function makeStorageHelper(storage) {
return {
storage: storage,
set: function set(name, value, minutes) {
if (value == null) {
this.storage.removeItem(name);
} else {
this.storage.setItem(name, JSON.stringify({
value: value,
expired_at: minutes ? new Date().get... | javascript | function makeStorageHelper(storage) {
return {
storage: storage,
set: function set(name, value, minutes) {
if (value == null) {
this.storage.removeItem(name);
} else {
this.storage.setItem(name, JSON.stringify({
value: value,
expired_at: minutes ? new Date().get... | [
"function",
"makeStorageHelper",
"(",
"storage",
")",
"{",
"return",
"{",
"storage",
":",
"storage",
",",
"set",
":",
"function",
"set",
"(",
"name",
",",
"value",
",",
"minutes",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"this",
".",
"st... | set null can remove a item | [
"set",
"null",
"can",
"remove",
"a",
"item"
] | ba605006bb9c9434f2402c57e4cc50f145628558 | https://github.com/phphe/helper-js/blob/ba605006bb9c9434f2402c57e4cc50f145628558/dist/helper-js.es.js#L1903-L1935 |
36,636 | nodef/extra-ffmpeg | index.js | command | function command(os) {
var z = 'ffmpeg';
var os = os||[];
for(var o of os) {
var o = o||{};
for(var k in o) {
if(o[k]==null) continue;
if(k==='stdio') continue;
if(k==='o' || k==='outfile') z += ` "${o[k]}"`;
else if(typeof o[k]==='boolean') z += o[k]? ` -${k}`:'';
else z += ... | javascript | function command(os) {
var z = 'ffmpeg';
var os = os||[];
for(var o of os) {
var o = o||{};
for(var k in o) {
if(o[k]==null) continue;
if(k==='stdio') continue;
if(k==='o' || k==='outfile') z += ` "${o[k]}"`;
else if(typeof o[k]==='boolean') z += o[k]? ` -${k}`:'';
else z += ... | [
"function",
"command",
"(",
"os",
")",
"{",
"var",
"z",
"=",
"'ffmpeg'",
";",
"var",
"os",
"=",
"os",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"o",
"of",
"os",
")",
"{",
"var",
"o",
"=",
"o",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"k",
"i... | Generate command for ffmpeg. | [
"Generate",
"command",
"for",
"ffmpeg",
"."
] | 5f0ad08e8be923c417dcd550d896e8c50c38b871 | https://github.com/nodef/extra-ffmpeg/blob/5f0ad08e8be923c417dcd550d896e8c50c38b871/index.js#L9-L23 |
36,637 | nodef/extra-ffmpeg | index.js | sync | function sync(os) {
var stdio = os.stdio===undefined? STDIO:os.stdio;
return cp.execSync(command(os), {stdio});
} | javascript | function sync(os) {
var stdio = os.stdio===undefined? STDIO:os.stdio;
return cp.execSync(command(os), {stdio});
} | [
"function",
"sync",
"(",
"os",
")",
"{",
"var",
"stdio",
"=",
"os",
".",
"stdio",
"===",
"undefined",
"?",
"STDIO",
":",
"os",
".",
"stdio",
";",
"return",
"cp",
".",
"execSync",
"(",
"command",
"(",
"os",
")",
",",
"{",
"stdio",
"}",
")",
";",
... | Invoke "ffmpeg" synchronously.
@param {object} os ffmpeg options. | [
"Invoke",
"ffmpeg",
"synchronously",
"."
] | 5f0ad08e8be923c417dcd550d896e8c50c38b871 | https://github.com/nodef/extra-ffmpeg/blob/5f0ad08e8be923c417dcd550d896e8c50c38b871/index.js#L29-L32 |
36,638 | nodef/extra-ffmpeg | index.js | ffmpeg | function ffmpeg(os) {
var stdio = os.stdio===undefined? STDIO:os.stdio;
return new Promise((fres, frej) => cp.exec(command(os), {stdio}, (err, stdout, stderr) => {
if(err) frej(err);
else fres({stdout, stderr});
}));
} | javascript | function ffmpeg(os) {
var stdio = os.stdio===undefined? STDIO:os.stdio;
return new Promise((fres, frej) => cp.exec(command(os), {stdio}, (err, stdout, stderr) => {
if(err) frej(err);
else fres({stdout, stderr});
}));
} | [
"function",
"ffmpeg",
"(",
"os",
")",
"{",
"var",
"stdio",
"=",
"os",
".",
"stdio",
"===",
"undefined",
"?",
"STDIO",
":",
"os",
".",
"stdio",
";",
"return",
"new",
"Promise",
"(",
"(",
"fres",
",",
"frej",
")",
"=>",
"cp",
".",
"exec",
"(",
"com... | Invoke "ffmpeg" asynchronously.
@param {object} os ffmpeg options. | [
"Invoke",
"ffmpeg",
"asynchronously",
"."
] | 5f0ad08e8be923c417dcd550d896e8c50c38b871 | https://github.com/nodef/extra-ffmpeg/blob/5f0ad08e8be923c417dcd550d896e8c50c38b871/index.js#L38-L44 |
36,639 | ocadotechnology/quantumjs | quantum-core/lib/parse.js | tokenize | function tokenize (str) {
let pos = 0
let row = 1
let col = 1
let newline = true
let state = CONTENT
let start = 0
let consumingSameLineContent = false
let escapedInlineCounter = 0
let escapedParamCounter = 0
let consumingEscapedParams = false
let consumingUnparsed = false // true when in an @@ bl... | javascript | function tokenize (str) {
let pos = 0
let row = 1
let col = 1
let newline = true
let state = CONTENT
let start = 0
let consumingSameLineContent = false
let escapedInlineCounter = 0
let escapedParamCounter = 0
let consumingEscapedParams = false
let consumingUnparsed = false // true when in an @@ bl... | [
"function",
"tokenize",
"(",
"str",
")",
"{",
"let",
"pos",
"=",
"0",
"let",
"row",
"=",
"1",
"let",
"col",
"=",
"1",
"let",
"newline",
"=",
"true",
"let",
"state",
"=",
"CONTENT",
"let",
"start",
"=",
"0",
"let",
"consumingSameLineContent",
"=",
"fa... | turns the input into an array of tokens | [
"turns",
"the",
"input",
"into",
"an",
"array",
"of",
"tokens"
] | 5bc684b750472296f186a816529272c36218db04 | https://github.com/ocadotechnology/quantumjs/blob/5bc684b750472296f186a816529272c36218db04/quantum-core/lib/parse.js#L45-L315 |
36,640 | gulp-cookery/gulp-chef | lib/task/factory.js | simple | function simple() {
var recipe, configs;
recipe = recipes.inline(taskInfo) || recipes.plugin(taskInfo) || recipes.task(taskInfo);
if (recipe) {
configs = Configuration.sort(taskInfo, rawConfig, parentConfig, recipe.schema);
if (!configs.taskInfo.name) {
configs.taskInfo.visibility = CONSTANT.VISIBILITY... | javascript | function simple() {
var recipe, configs;
recipe = recipes.inline(taskInfo) || recipes.plugin(taskInfo) || recipes.task(taskInfo);
if (recipe) {
configs = Configuration.sort(taskInfo, rawConfig, parentConfig, recipe.schema);
if (!configs.taskInfo.name) {
configs.taskInfo.visibility = CONSTANT.VISIBILITY... | [
"function",
"simple",
"(",
")",
"{",
"var",
"recipe",
",",
"configs",
";",
"recipe",
"=",
"recipes",
".",
"inline",
"(",
"taskInfo",
")",
"||",
"recipes",
".",
"plugin",
"(",
"taskInfo",
")",
"||",
"recipes",
".",
"task",
"(",
"taskInfo",
")",
";",
"... | Simple task should show up in task tree and cli, unless anonymous. | [
"Simple",
"task",
"should",
"show",
"up",
"in",
"task",
"tree",
"and",
"cli",
"unless",
"anonymous",
"."
] | 6a8b6b4d20a9f8a36bc74f2beb74524c7338788f | https://github.com/gulp-cookery/gulp-chef/blob/6a8b6b4d20a9f8a36bc74f2beb74524c7338788f/lib/task/factory.js#L93-L104 |
36,641 | gulp-cookery/gulp-chef | lib/task/factory.js | auxiliary | function auxiliary() {
var recipe, configs, tasks;
recipe = recipes.stream(taskInfo) || recipes.flow(taskInfo);
if (recipe) {
configs = Configuration.sort(taskInfo, rawConfig, parentConfig, recipe.schema);
if (configs.taskInfo.name !== 'watch' && (!configs.taskInfo.name || !('visibility' in configs.taskInf... | javascript | function auxiliary() {
var recipe, configs, tasks;
recipe = recipes.stream(taskInfo) || recipes.flow(taskInfo);
if (recipe) {
configs = Configuration.sort(taskInfo, rawConfig, parentConfig, recipe.schema);
if (configs.taskInfo.name !== 'watch' && (!configs.taskInfo.name || !('visibility' in configs.taskInf... | [
"function",
"auxiliary",
"(",
")",
"{",
"var",
"recipe",
",",
"configs",
",",
"tasks",
";",
"recipe",
"=",
"recipes",
".",
"stream",
"(",
"taskInfo",
")",
"||",
"recipes",
".",
"flow",
"(",
"taskInfo",
")",
";",
"if",
"(",
"recipe",
")",
"{",
"config... | Auxiliary task should show up in task tree, but not in cli by default for simplicity. | [
"Auxiliary",
"task",
"should",
"show",
"up",
"in",
"task",
"tree",
"but",
"not",
"in",
"cli",
"by",
"default",
"for",
"simplicity",
"."
] | 6a8b6b4d20a9f8a36bc74f2beb74524c7338788f | https://github.com/gulp-cookery/gulp-chef/blob/6a8b6b4d20a9f8a36bc74f2beb74524c7338788f/lib/task/factory.js#L196-L209 |
36,642 | gulp-cookery/gulp-chef | lib/task/factory.js | composite | function composite() {
var configs, type, recipe, tasks, wrapper;
configs = Configuration.sort(taskInfo, rawConfig, parentConfig);
tasks = configs.taskInfo.parallel || configs.taskInfo.series || configs.taskInfo.task || configs.subTaskConfigs;
type = _type();
if (type) {
tasks = createTasks(configs);
r... | javascript | function composite() {
var configs, type, recipe, tasks, wrapper;
configs = Configuration.sort(taskInfo, rawConfig, parentConfig);
tasks = configs.taskInfo.parallel || configs.taskInfo.series || configs.taskInfo.task || configs.subTaskConfigs;
type = _type();
if (type) {
tasks = createTasks(configs);
r... | [
"function",
"composite",
"(",
")",
"{",
"var",
"configs",
",",
"type",
",",
"recipe",
",",
"tasks",
",",
"wrapper",
";",
"configs",
"=",
"Configuration",
".",
"sort",
"(",
"taskInfo",
",",
"rawConfig",
",",
"parentConfig",
")",
";",
"tasks",
"=",
"config... | Composite task should show up in task treem, and show up in cli if holding task is a named task. | [
"Composite",
"task",
"should",
"show",
"up",
"in",
"task",
"treem",
"and",
"show",
"up",
"in",
"cli",
"if",
"holding",
"task",
"is",
"a",
"named",
"task",
"."
] | 6a8b6b4d20a9f8a36bc74f2beb74524c7338788f | https://github.com/gulp-cookery/gulp-chef/blob/6a8b6b4d20a9f8a36bc74f2beb74524c7338788f/lib/task/factory.js#L212-L257 |
36,643 | mmattozzi/webrepl | webrepl.js | function(port, options) {
var stream = new SimpleStream();
var prompt = 'node> ';
var rs = repl.start({ prompt: prompt, input: stream, output: stream});
var replHttpServer = new ReplHttpServer(prompt, stream, rs, options);
replHttpServer.start(port);
return rs;
} | javascript | function(port, options) {
var stream = new SimpleStream();
var prompt = 'node> ';
var rs = repl.start({ prompt: prompt, input: stream, output: stream});
var replHttpServer = new ReplHttpServer(prompt, stream, rs, options);
replHttpServer.start(port);
return rs;
} | [
"function",
"(",
"port",
",",
"options",
")",
"{",
"var",
"stream",
"=",
"new",
"SimpleStream",
"(",
")",
";",
"var",
"prompt",
"=",
"'node> '",
";",
"var",
"rs",
"=",
"repl",
".",
"start",
"(",
"{",
"prompt",
":",
"prompt",
",",
"input",
":",
"str... | Starts a repl served via a web console.
@param {Integer} port Port to serve web console
@param {Object} options Set username, password, and hostname options
@return Return the REPLServer. Context can be set on this variable. | [
"Starts",
"a",
"repl",
"served",
"via",
"a",
"web",
"console",
"."
] | af10029031502bce3bb46b660e65d8a768a5eb80 | https://github.com/mmattozzi/webrepl/blob/af10029031502bce3bb46b660e65d8a768a5eb80/webrepl.js#L228-L235 | |
36,644 | misoproject/storyboard | dist/node/miso.storyboard.deps.0.0.1.js | function(context) {
this._context = context;
if (this.scenes) {
_.each(this.scenes, function(scene) {
scene.setContext(context);
});
}
} | javascript | function(context) {
this._context = context;
if (this.scenes) {
_.each(this.scenes, function(scene) {
scene.setContext(context);
});
}
} | [
"function",
"(",
"context",
")",
"{",
"this",
".",
"_context",
"=",
"context",
";",
"if",
"(",
"this",
".",
"scenes",
")",
"{",
"_",
".",
"each",
"(",
"this",
".",
"scenes",
",",
"function",
"(",
"scene",
")",
"{",
"scene",
".",
"setContext",
"(",
... | Allows the changing of context. This will alter what 'this'
will be set to inside the transition methods. | [
"Allows",
"the",
"changing",
"of",
"context",
".",
"This",
"will",
"alter",
"what",
"this",
"will",
"be",
"set",
"to",
"inside",
"the",
"transition",
"methods",
"."
] | 96d6cdfe756e0e4f2df7c9a55c414fe93a4c38ec | https://github.com/misoproject/storyboard/blob/96d6cdfe756e0e4f2df7c9a55c414fe93a4c38ec/dist/node/miso.storyboard.deps.0.0.1.js#L314-L321 | |
36,645 | misoproject/storyboard | dist/node/miso.storyboard.deps.0.0.1.js | leaf_to | function leaf_to( sceneName, argsArr, deferred ) {
this._transitioning = true;
var complete = this._complete = deferred || _.Deferred(),
args = argsArr ? argsArr : [],
handlerComplete = _.Deferred()
.done(_.bind(function() {
this._transitioning = false;
this._current = sceneNa... | javascript | function leaf_to( sceneName, argsArr, deferred ) {
this._transitioning = true;
var complete = this._complete = deferred || _.Deferred(),
args = argsArr ? argsArr : [],
handlerComplete = _.Deferred()
.done(_.bind(function() {
this._transitioning = false;
this._current = sceneNa... | [
"function",
"leaf_to",
"(",
"sceneName",
",",
"argsArr",
",",
"deferred",
")",
"{",
"this",
".",
"_transitioning",
"=",
"true",
";",
"var",
"complete",
"=",
"this",
".",
"_complete",
"=",
"deferred",
"||",
"_",
".",
"Deferred",
"(",
")",
",",
"args",
"... | Used as the to function to scenes which do not have children These scenes only have their own enter and exit. | [
"Used",
"as",
"the",
"to",
"function",
"to",
"scenes",
"which",
"do",
"not",
"have",
"children",
"These",
"scenes",
"only",
"have",
"their",
"own",
"enter",
"and",
"exit",
"."
] | 96d6cdfe756e0e4f2df7c9a55c414fe93a4c38ec | https://github.com/misoproject/storyboard/blob/96d6cdfe756e0e4f2df7c9a55c414fe93a4c38ec/dist/node/miso.storyboard.deps.0.0.1.js#L334-L353 |
36,646 | coderigo/node-highcharts-exporter | lib/node-highcharts-exporter/main.js | function(hcExportRequest,asyncCallback){
var makeThisExportDir = function(mkExportDirErr){
var thisExportDir = [config.processingDir, crypto.createHash('md5').update(Date().toString()+hcExportRequest.svg).digest('hex'),''].join('/');
fs.mkdir(thisExportDir, function(error){
asyncCallbac... | javascript | function(hcExportRequest,asyncCallback){
var makeThisExportDir = function(mkExportDirErr){
var thisExportDir = [config.processingDir, crypto.createHash('md5').update(Date().toString()+hcExportRequest.svg).digest('hex'),''].join('/');
fs.mkdir(thisExportDir, function(error){
asyncCallbac... | [
"function",
"(",
"hcExportRequest",
",",
"asyncCallback",
")",
"{",
"var",
"makeThisExportDir",
"=",
"function",
"(",
"mkExportDirErr",
")",
"{",
"var",
"thisExportDir",
"=",
"[",
"config",
".",
"processingDir",
",",
"crypto",
".",
"createHash",
"(",
"'md5'",
... | Makes the directory to process and store the requested chart
@param {object} hcExportRequest The Highcharts POSTed export request object
@param {function} asyncCallback A reference to the async callback
@return {void} Nothing | [
"Makes",
"the",
"directory",
"to",
"process",
"and",
"store",
"the",
"requested",
"chart"
] | 25da7a92af3f1e70802271080854a1d423588a08 | https://github.com/coderigo/node-highcharts-exporter/blob/25da7a92af3f1e70802271080854a1d423588a08/lib/node-highcharts-exporter/main.js#L47-L64 | |
36,647 | coderigo/node-highcharts-exporter | lib/node-highcharts-exporter/main.js | function(processingDir, hcExportRequest, callback){
var outputChartName = hcExportRequest.filename,
outputFormat = hcExportRequest.type.split('/')[1],
outputExtension = outputFormat == 'svg+xml' ? '.svg' : '.' + outputFormat,
outputFile = outputChartName + outputExtension,
ou... | javascript | function(processingDir, hcExportRequest, callback){
var outputChartName = hcExportRequest.filename,
outputFormat = hcExportRequest.type.split('/')[1],
outputExtension = outputFormat == 'svg+xml' ? '.svg' : '.' + outputFormat,
outputFile = outputChartName + outputExtension,
ou... | [
"function",
"(",
"processingDir",
",",
"hcExportRequest",
",",
"callback",
")",
"{",
"var",
"outputChartName",
"=",
"hcExportRequest",
".",
"filename",
",",
"outputFormat",
"=",
"hcExportRequest",
".",
"type",
".",
"split",
"(",
"'/'",
")",
"[",
"1",
"]",
",... | Exports chart into desired format
@param {string} processingDir The processing directory to export the chart to (returned by _makeDirs() function)
@param {object} hcExportRequest The Highcharts POSTed export request object
@param {Function} asyncCallback A reference to the async callback
@return {void} ... | [
"Exports",
"chart",
"into",
"desired",
"format"
] | 25da7a92af3f1e70802271080854a1d423588a08 | https://github.com/coderigo/node-highcharts-exporter/blob/25da7a92af3f1e70802271080854a1d423588a08/lib/node-highcharts-exporter/main.js#L76-L123 | |
36,648 | platformsh/platformsh-nodejs-helper | src/platformsh.js | num_of_cpus | function num_of_cpus() {
try {
if(process.env['OMP_NUM_THREADS']) {
return process.env['OMP_NUM_THREADS'];
}
return Math.ceil(jsonConfig.info.limits.cpu);
} catch (err) {
throw new Error('Could not get number of cpus');
}
} | javascript | function num_of_cpus() {
try {
if(process.env['OMP_NUM_THREADS']) {
return process.env['OMP_NUM_THREADS'];
}
return Math.ceil(jsonConfig.info.limits.cpu);
} catch (err) {
throw new Error('Could not get number of cpus');
}
} | [
"function",
"num_of_cpus",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"process",
".",
"env",
"[",
"'OMP_NUM_THREADS'",
"]",
")",
"{",
"return",
"process",
".",
"env",
"[",
"'OMP_NUM_THREADS'",
"]",
";",
"}",
"return",
"Math",
".",
"ceil",
"(",
"jsonConfig",
... | Read number of CPUs from environment or fallback to the _private_ configuration property
Useful for determining the number of processes to fork. | [
"Read",
"number",
"of",
"CPUs",
"from",
"environment",
"or",
"fallback",
"to",
"the",
"_private_",
"configuration",
"property",
"Useful",
"for",
"determining",
"the",
"number",
"of",
"processes",
"to",
"fork",
"."
] | c614422f4534f67b9c72f13cc1a4498f9a3a7108 | https://github.com/platformsh/platformsh-nodejs-helper/blob/c614422f4534f67b9c72f13cc1a4498f9a3a7108/src/platformsh.js#L19-L29 |
36,649 | platformsh/platformsh-nodejs-helper | src/platformsh.js | config | function config() {
if(!process.env.PLATFORM_PROJECT) {
throw Error('This is not running on platform.sh');
}
return {
application: read_base64_json('PLATFORM_APPLICATION'),
relationships: read_base64_json('PLATFORM_RELATIONSHIPS'),
variables: read_base64_json('PLATFORM_VARIABLES'),
applicatio... | javascript | function config() {
if(!process.env.PLATFORM_PROJECT) {
throw Error('This is not running on platform.sh');
}
return {
application: read_base64_json('PLATFORM_APPLICATION'),
relationships: read_base64_json('PLATFORM_RELATIONSHIPS'),
variables: read_base64_json('PLATFORM_VARIABLES'),
applicatio... | [
"function",
"config",
"(",
")",
"{",
"if",
"(",
"!",
"process",
".",
"env",
".",
"PLATFORM_PROJECT",
")",
"{",
"throw",
"Error",
"(",
"'This is not running on platform.sh'",
")",
";",
"}",
"return",
"{",
"application",
":",
"read_base64_json",
"(",
"'PLATFORM_... | Reads Platform.sh configuration from environment and returns a single object | [
"Reads",
"Platform",
".",
"sh",
"configuration",
"from",
"environment",
"and",
"returns",
"a",
"single",
"object"
] | c614422f4534f67b9c72f13cc1a4498f9a3a7108 | https://github.com/platformsh/platformsh-nodejs-helper/blob/c614422f4534f67b9c72f13cc1a4498f9a3a7108/src/platformsh.js#L42-L63 |
36,650 | huffpostdata/in-memory-website | lib/protobuf.js | StaticEndpoint | function StaticEndpoint(properties) {
this.headers = {};
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function StaticEndpoint(properties) {
this.headers = {};
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"StaticEndpoint",
"(",
"properties",
")",
"{",
"this",
".",
"headers",
"=",
"{",
"}",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
... | Properties of a StaticEndpoint.
@memberof staticwebsite
@interface IStaticEndpoint
@property {string} [path] StaticEndpoint path
@property {Object.<string,string>} [headers] StaticEndpoint headers
@property {Uint8Array} [body] StaticEndpoint body
Constructs a new StaticEndpoint.
@memberof staticwebsite
@classdesc Rep... | [
"Properties",
"of",
"a",
"StaticEndpoint",
"."
] | d12048a81ef389ccb522425378f3db99ac071598 | https://github.com/huffpostdata/in-memory-website/blob/d12048a81ef389ccb522425378f3db99ac071598/lib/protobuf.js#L39-L45 |
36,651 | huffpostdata/in-memory-website | lib/protobuf.js | StaticWebsite | function StaticWebsite(properties) {
this.endpoints = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function StaticWebsite(properties) {
this.endpoints = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"StaticWebsite",
"(",
"properties",
")",
"{",
"this",
".",
"endpoints",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
... | Properties of a StaticWebsite.
@memberof staticwebsite
@interface IStaticWebsite
@property {Array.<staticwebsite.IStaticEndpoint>} [endpoints] StaticWebsite endpoints
Constructs a new StaticWebsite.
@memberof staticwebsite
@classdesc Represents a StaticWebsite.
@constructor
@param {staticwebsite.IStaticWebsite=} [pro... | [
"Properties",
"of",
"a",
"StaticWebsite",
"."
] | d12048a81ef389ccb522425378f3db99ac071598 | https://github.com/huffpostdata/in-memory-website/blob/d12048a81ef389ccb522425378f3db99ac071598/lib/protobuf.js#L293-L299 |
36,652 | Banno/polymer-lint | src/gulp-task/index.js | transform | function transform(transform, flush) {
const stream = new Transform({ objectMode: true });
stream._transform = transform;
if (typeof flush === 'function') {
stream._flush = flush;
}
return stream;
} | javascript | function transform(transform, flush) {
const stream = new Transform({ objectMode: true });
stream._transform = transform;
if (typeof flush === 'function') {
stream._flush = flush;
}
return stream;
} | [
"function",
"transform",
"(",
"transform",
",",
"flush",
")",
"{",
"const",
"stream",
"=",
"new",
"Transform",
"(",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"stream",
".",
"_transform",
"=",
"transform",
";",
"if",
"(",
"typeof",
"flush",
"===",
... | Convenience function for creating a Transform stream
@param {Function} transform - A function to be called for each File received
@param {Function} [flush] - A function to be called when the stream ends
@returns {external:stream.Transform} | [
"Convenience",
"function",
"for",
"creating",
"a",
"Transform",
"stream"
] | cf4ffdc63837280080b67f496d038d33a3975b6f | https://github.com/Banno/polymer-lint/blob/cf4ffdc63837280080b67f496d038d33a3975b6f/src/gulp-task/index.js#L36-L43 |
36,653 | spyfu/spyfu-vuex-helpers | lib/helpers/simple_instance_setters.js | findInstance | function findInstance(state, stateKey, instanceKey, payload) {
return state[stateKey].find(obj => obj[instanceKey] === payload[instanceKey]);
} | javascript | function findInstance(state, stateKey, instanceKey, payload) {
return state[stateKey].find(obj => obj[instanceKey] === payload[instanceKey]);
} | [
"function",
"findInstance",
"(",
"state",
",",
"stateKey",
",",
"instanceKey",
",",
"payload",
")",
"{",
"return",
"state",
"[",
"stateKey",
"]",
".",
"find",
"(",
"obj",
"=>",
"obj",
"[",
"instanceKey",
"]",
"===",
"payload",
"[",
"instanceKey",
"]",
")... | helper function to find the correct instance | [
"helper",
"function",
"to",
"find",
"the",
"correct",
"instance"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/lib/helpers/simple_instance_setters.js#L49-L51 |
36,654 | spyfu/spyfu-vuex-helpers | lib/helpers/simple_instance_setters.js | findValue | function findValue(payload, instanceKey) {
for (let key in payload) {
if (key !== instanceKey) {
return payload[key];
}
}
// if we don't have a value, throw an error because the payload is invalid.
/* istanbul ignore next */
throw new Error('Failed to mutate instance, no... | javascript | function findValue(payload, instanceKey) {
for (let key in payload) {
if (key !== instanceKey) {
return payload[key];
}
}
// if we don't have a value, throw an error because the payload is invalid.
/* istanbul ignore next */
throw new Error('Failed to mutate instance, no... | [
"function",
"findValue",
"(",
"payload",
",",
"instanceKey",
")",
"{",
"for",
"(",
"let",
"key",
"in",
"payload",
")",
"{",
"if",
"(",
"key",
"!==",
"instanceKey",
")",
"{",
"return",
"payload",
"[",
"key",
"]",
";",
"}",
"}",
"// if we don't have a valu... | helper function to find the payload value | [
"helper",
"function",
"to",
"find",
"the",
"payload",
"value"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/lib/helpers/simple_instance_setters.js#L54-L64 |
36,655 | jhermsmeier/node-flightstats | lib/alerts/index.js | function( maxId, callback ) {
if( typeof maxId === 'function' ) {
callback = maxId
maxId = null
}
var self = this
var id = maxId ? '/' + maxId : ''
return this.client._clientRequest({
url: '/alerts/rest/v1/json/list' + id,
}, function( error, data ) {
callback.call( se... | javascript | function( maxId, callback ) {
if( typeof maxId === 'function' ) {
callback = maxId
maxId = null
}
var self = this
var id = maxId ? '/' + maxId : ''
return this.client._clientRequest({
url: '/alerts/rest/v1/json/list' + id,
}, function( error, data ) {
callback.call( se... | [
"function",
"(",
"maxId",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"maxId",
"===",
"'function'",
")",
"{",
"callback",
"=",
"maxId",
"maxId",
"=",
"null",
"}",
"var",
"self",
"=",
"this",
"var",
"id",
"=",
"maxId",
"?",
"'/'",
"+",
"maxId",
... | List all registered rule IDs,
optionally only up to a given `maxId`
@param {String} maxId - optional, list only rules that are less than the specified max Rule ID
@param {Function} callback( error, rules )
@return {Request} | [
"List",
"all",
"registered",
"rule",
"IDs",
"optionally",
"only",
"up",
"to",
"a",
"given",
"maxId"
] | 023d46e11db4f4ba45ed414b1dc23084b1c9749d | https://github.com/jhermsmeier/node-flightstats/blob/023d46e11db4f4ba45ed414b1dc23084b1c9749d/lib/alerts/index.js#L33-L49 | |
36,656 | jhermsmeier/node-flightstats | lib/alerts/index.js | function( id, callback ) {
var self = this
return this.client._clientRequest({
url: '/alerts/rest/v1/json/get/' + id,
}, function( error, data ) {
callback.call( self.client, error, data )
})
} | javascript | function( id, callback ) {
var self = this
return this.client._clientRequest({
url: '/alerts/rest/v1/json/get/' + id,
}, function( error, data ) {
callback.call( self.client, error, data )
})
} | [
"function",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"return",
"this",
".",
"client",
".",
"_clientRequest",
"(",
"{",
"url",
":",
"'/alerts/rest/v1/json/get/'",
"+",
"id",
",",
"}",
",",
"function",
"(",
"error",
",",
"data",
... | Retrieve a registered rule by it's ID
@param {String} id
@param {Function} callback( error, result )
@return {Request} | [
"Retrieve",
"a",
"registered",
"rule",
"by",
"it",
"s",
"ID"
] | 023d46e11db4f4ba45ed414b1dc23084b1c9749d | https://github.com/jhermsmeier/node-flightstats/blob/023d46e11db4f4ba45ed414b1dc23084b1c9749d/lib/alerts/index.js#L57-L64 | |
36,657 | jhermsmeier/node-flightstats | lib/alerts/index.js | function( options, callback ) {
var self = this
var path = '/alerts/rest/v1/json/testdelivery/' +
options.airlineCode + '/' + options.flightNumber +
'/from/' + options.departureAirport +
'/to/' + options.arrivalAirport
var extensions = [
'includeNewFields',
'useInlinedRefere... | javascript | function( options, callback ) {
var self = this
var path = '/alerts/rest/v1/json/testdelivery/' +
options.airlineCode + '/' + options.flightNumber +
'/from/' + options.departureAirport +
'/to/' + options.arrivalAirport
var extensions = [
'includeNewFields',
'useInlinedRefere... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"path",
"=",
"'/alerts/rest/v1/json/testdelivery/'",
"+",
"options",
".",
"airlineCode",
"+",
"'/'",
"+",
"options",
".",
"flightNumber",
"+",
"'/from/'",
"+",
"options",... | Simulate a fake event for a fake flight
@param {Object} options
@param {String} options.airlineCode
@param {String} options.arrivalAirport
@param {String} options.deliverTo (can be smtp://username@domain.com for testing)
@param {String} options.departureAirport
@param {String} options.flightNumber
@param {?Array<String... | [
"Simulate",
"a",
"fake",
"event",
"for",
"a",
"fake",
"flight"
] | 023d46e11db4f4ba45ed414b1dc23084b1c9749d | https://github.com/jhermsmeier/node-flightstats/blob/023d46e11db4f4ba45ed414b1dc23084b1c9749d/lib/alerts/index.js#L94-L123 | |
36,658 | jhermsmeier/node-flightstats | lib/alerts/index.js | function( options, callback ) {
var self = this
var events = options.events || [ 'all' ]
var year = options.date.getFullYear()
var month = options.date.getMonth() + 1
var day = options.date.getDate()
var direction = /^dep/i.test( options.direction ) ?
'departing' : 'arriving'
var pat... | javascript | function( options, callback ) {
var self = this
var events = options.events || [ 'all' ]
var year = options.date.getFullYear()
var month = options.date.getMonth() + 1
var day = options.date.getDate()
var direction = /^dep/i.test( options.direction ) ?
'departing' : 'arriving'
var pat... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"events",
"=",
"options",
".",
"events",
"||",
"[",
"'all'",
"]",
"var",
"year",
"=",
"options",
".",
"date",
".",
"getFullYear",
"(",
")",
"var",
"month",
"=",... | Create an flight alert rule
@param {Object} options
@param {String} options.airlineCode
@param {String} options.arrivalAirport
@param {String} options.codeType
@param {String} options.data - optional, custom key/value pairs to be included in delivered alerts
@param {String} options.date
@param {String} options.deliverT... | [
"Create",
"an",
"flight",
"alert",
"rule"
] | 023d46e11db4f4ba45ed414b1dc23084b1c9749d | https://github.com/jhermsmeier/node-flightstats/blob/023d46e11db4f4ba45ed414b1dc23084b1c9749d/lib/alerts/index.js#L145-L195 | |
36,659 | GeoXForm/esri-to-geojson | src/index.js | csvFieldNames | function csvFieldNames (inFields) {
const fieldNames = _.map(inFields, (field) => {
return convertFieldName(field)
})
return fieldNames
} | javascript | function csvFieldNames (inFields) {
const fieldNames = _.map(inFields, (field) => {
return convertFieldName(field)
})
return fieldNames
} | [
"function",
"csvFieldNames",
"(",
"inFields",
")",
"{",
"const",
"fieldNames",
"=",
"_",
".",
"map",
"(",
"inFields",
",",
"(",
"field",
")",
"=>",
"{",
"return",
"convertFieldName",
"(",
"field",
")",
"}",
")",
"return",
"fieldNames",
"}"
] | Parse array of field names and sanitize them
@param {array} inFields - array of field names
@returns {array} fieldNames - array of sanitized field Names | [
"Parse",
"array",
"of",
"field",
"names",
"and",
"sanitize",
"them"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L35-L40 |
36,660 | GeoXForm/esri-to-geojson | src/index.js | convertCSVGeom | function convertCSVGeom (columns, row) {
const geometry = _.reduce(columns, (tempGeom, colName, i) => {
if (isLongitudeField(colName)) tempGeom.coordinates[0] = parseFloat(row[i])
else if (isLatitudeField(colName)) tempGeom.coordinates[1] = parseFloat(row[i])
return tempGeom
}, { type: 'Point', coordina... | javascript | function convertCSVGeom (columns, row) {
const geometry = _.reduce(columns, (tempGeom, colName, i) => {
if (isLongitudeField(colName)) tempGeom.coordinates[0] = parseFloat(row[i])
else if (isLatitudeField(colName)) tempGeom.coordinates[1] = parseFloat(row[i])
return tempGeom
}, { type: 'Point', coordina... | [
"function",
"convertCSVGeom",
"(",
"columns",
",",
"row",
")",
"{",
"const",
"geometry",
"=",
"_",
".",
"reduce",
"(",
"columns",
",",
"(",
"tempGeom",
",",
"colName",
",",
"i",
")",
"=>",
"{",
"if",
"(",
"isLongitudeField",
"(",
"colName",
")",
")",
... | Convert CSV geom to geojson
@param {array} fieldNames - array of field names
@param {array} feature - individual feature
@returns {object} geometry - geometry object | [
"Convert",
"CSV",
"geom",
"to",
"geojson"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L50-L57 |
36,661 | GeoXForm/esri-to-geojson | src/index.js | validGeometry | function validGeometry (geometry) {
return geometry.coordinates.length === 2 && (geometry.coordinates[0] && geometry.coordinates[1]) ? true : false
} | javascript | function validGeometry (geometry) {
return geometry.coordinates.length === 2 && (geometry.coordinates[0] && geometry.coordinates[1]) ? true : false
} | [
"function",
"validGeometry",
"(",
"geometry",
")",
"{",
"return",
"geometry",
".",
"coordinates",
".",
"length",
"===",
"2",
"&&",
"(",
"geometry",
".",
"coordinates",
"[",
"0",
"]",
"&&",
"geometry",
".",
"coordinates",
"[",
"1",
"]",
")",
"?",
"true",
... | Check to see if geometry object is valid
@param {object} geometry - built geometry object
@return {boolean} validGeom - whether or not geom is valid | [
"Check",
"to",
"see",
"if",
"geometry",
"object",
"is",
"valid"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L88-L90 |
36,662 | GeoXForm/esri-to-geojson | src/index.js | constructProps | function constructProps (fieldNames, feature) {
const properties = _.reduce(fieldNames, (tempProps, fieldName, key) => {
tempProps[fieldName] = (!isNaN(feature[key])) ? parseFloat(feature[key]) : feature[key]
return tempProps
}, {})
return properties
} | javascript | function constructProps (fieldNames, feature) {
const properties = _.reduce(fieldNames, (tempProps, fieldName, key) => {
tempProps[fieldName] = (!isNaN(feature[key])) ? parseFloat(feature[key]) : feature[key]
return tempProps
}, {})
return properties
} | [
"function",
"constructProps",
"(",
"fieldNames",
",",
"feature",
")",
"{",
"const",
"properties",
"=",
"_",
".",
"reduce",
"(",
"fieldNames",
",",
"(",
"tempProps",
",",
"fieldName",
",",
"key",
")",
"=>",
"{",
"tempProps",
"[",
"fieldName",
"]",
"=",
"(... | Covert fields into properties object
@param {array} fieldNames - array of field names
@param {array} feature - individual feature
@returns {object} properties - property object | [
"Covert",
"fields",
"into",
"properties",
"object"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L99-L105 |
36,663 | GeoXForm/esri-to-geojson | src/index.js | convertFields | function convertFields (infields) {
const fields = {}
_.each(infields, (field) => {
field.outName = convertFieldName(field.name)
fields[field.name] = field
})
return fields
} | javascript | function convertFields (infields) {
const fields = {}
_.each(infields, (field) => {
field.outName = convertFieldName(field.name)
fields[field.name] = field
})
return fields
} | [
"function",
"convertFields",
"(",
"infields",
")",
"{",
"const",
"fields",
"=",
"{",
"}",
"_",
".",
"each",
"(",
"infields",
",",
"(",
"field",
")",
"=>",
"{",
"field",
".",
"outName",
"=",
"convertFieldName",
"(",
"field",
".",
"name",
")",
"fields",
... | Converts a set of fields to have names that work well in JS
@params {object} inFields - the original fields object from the esri json
@returns {object} fields - converted fields
@private | [
"Converts",
"a",
"set",
"of",
"fields",
"to",
"have",
"names",
"that",
"work",
"well",
"in",
"JS"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L138-L146 |
36,664 | GeoXForm/esri-to-geojson | src/index.js | convertFieldName | function convertFieldName (name) {
const regex = new RegExp(/\.|\(|\)/g)
return name.replace(regex, '').replace(/\s/g, '_')
} | javascript | function convertFieldName (name) {
const regex = new RegExp(/\.|\(|\)/g)
return name.replace(regex, '').replace(/\s/g, '_')
} | [
"function",
"convertFieldName",
"(",
"name",
")",
"{",
"const",
"regex",
"=",
"new",
"RegExp",
"(",
"/",
"\\.|\\(|\\)",
"/",
"g",
")",
"return",
"name",
".",
"replace",
"(",
"regex",
",",
"''",
")",
".",
"replace",
"(",
"/",
"\\s",
"/",
"g",
",",
"... | Converts a single field name to a legal javascript object key
@params {string} name - the original field name
@returns {string} outName - a cleansed field name
@private | [
"Converts",
"a",
"single",
"field",
"name",
"to",
"a",
"legal",
"javascript",
"object",
"key"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L156-L159 |
36,665 | GeoXForm/esri-to-geojson | src/index.js | transformFeature | function transformFeature (feature, fields) {
const attributes = {}
// first transform each of the features to the converted field name and transformed value
if (feature.attributes && Object.keys(feature.attributes)) {
_.each(Object.keys(feature.attributes), (name) => {
let attr = {}
attr[name] =... | javascript | function transformFeature (feature, fields) {
const attributes = {}
// first transform each of the features to the converted field name and transformed value
if (feature.attributes && Object.keys(feature.attributes)) {
_.each(Object.keys(feature.attributes), (name) => {
let attr = {}
attr[name] =... | [
"function",
"transformFeature",
"(",
"feature",
",",
"fields",
")",
"{",
"const",
"attributes",
"=",
"{",
"}",
"// first transform each of the features to the converted field name and transformed value",
"if",
"(",
"feature",
".",
"attributes",
"&&",
"Object",
".",
"keys"... | Converts a single feature from esri json to geojson
@param {object} feature - a single esri feature
@param {object} fields - the fields object from the service
@returns {object} feature - a geojson feature
@private | [
"Converts",
"a",
"single",
"feature",
"from",
"esri",
"json",
"to",
"geojson"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L170-L191 |
36,666 | GeoXForm/esri-to-geojson | src/index.js | convertAttribute | function convertAttribute (attribute, field) {
const inValue = attribute[field.name]
let value
if (inValue === null) return inValue
if (field.domain && field.domain.type === 'codedValue') {
value = cvd(inValue, field)
} else if (field.type === 'esriFieldTypeDate') {
try {
value = new Date(inVa... | javascript | function convertAttribute (attribute, field) {
const inValue = attribute[field.name]
let value
if (inValue === null) return inValue
if (field.domain && field.domain.type === 'codedValue') {
value = cvd(inValue, field)
} else if (field.type === 'esriFieldTypeDate') {
try {
value = new Date(inVa... | [
"function",
"convertAttribute",
"(",
"attribute",
",",
"field",
")",
"{",
"const",
"inValue",
"=",
"attribute",
"[",
"field",
".",
"name",
"]",
"let",
"value",
"if",
"(",
"inValue",
"===",
"null",
")",
"return",
"inValue",
"if",
"(",
"field",
".",
"domai... | Decodes an attributes CVD and standardizes any date fields
@params {object} attribute - a single esri feature attribute
@params {object} field - the field metadata describing that attribute
@returns {object} outAttribute - the converted attribute
@private | [
"Decodes",
"an",
"attributes",
"CVD",
"and",
"standardizes",
"any",
"date",
"fields"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L202-L220 |
36,667 | GeoXForm/esri-to-geojson | src/index.js | cvd | function cvd (value, field) {
const domain = _.find(field.domain.codedValues, (d) => {
return value === d.code
})
return domain ? domain.name : value
} | javascript | function cvd (value, field) {
const domain = _.find(field.domain.codedValues, (d) => {
return value === d.code
})
return domain ? domain.name : value
} | [
"function",
"cvd",
"(",
"value",
",",
"field",
")",
"{",
"const",
"domain",
"=",
"_",
".",
"find",
"(",
"field",
".",
"domain",
".",
"codedValues",
",",
"(",
"d",
")",
"=>",
"{",
"return",
"value",
"===",
"d",
".",
"code",
"}",
")",
"return",
"do... | Looks up a value from a coded domain
@params {integer} value - The original field value
@params {object} field - metadata describing the attribute field
@returns {string/integerfloat} - The decoded field value | [
"Looks",
"up",
"a",
"value",
"from",
"a",
"coded",
"domain"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L230-L235 |
36,668 | GeoXForm/esri-to-geojson | src/index.js | parseGeometry | function parseGeometry (geometry) {
try {
const parsed = geometry ? arcgisToGeoJSON(geometry) : null
if (parsed && parsed.type && parsed.coordinates) return parsed
else {
return null
}
} catch (e) {
console.error(e)
return null
}
} | javascript | function parseGeometry (geometry) {
try {
const parsed = geometry ? arcgisToGeoJSON(geometry) : null
if (parsed && parsed.type && parsed.coordinates) return parsed
else {
return null
}
} catch (e) {
console.error(e)
return null
}
} | [
"function",
"parseGeometry",
"(",
"geometry",
")",
"{",
"try",
"{",
"const",
"parsed",
"=",
"geometry",
"?",
"arcgisToGeoJSON",
"(",
"geometry",
")",
":",
"null",
"if",
"(",
"parsed",
"&&",
"parsed",
".",
"type",
"&&",
"parsed",
".",
"coordinates",
")",
... | Convert an esri geometry to a geojson geometry
@param {object} geometry - an esri geometry object
@return {object} geojson geometry
@private | [
"Convert",
"an",
"esri",
"geometry",
"to",
"a",
"geojson",
"geometry"
] | 55d32955d8ef0acb26de70025539e7c7a37d838e | https://github.com/GeoXForm/esri-to-geojson/blob/55d32955d8ef0acb26de70025539e7c7a37d838e/src/index.js#L245-L256 |
36,669 | spyfu/spyfu-vuex-helpers | lib/helpers/map_two_way_state.js | createSetter | function createSetter(namespace, mappings) {
let mutation = mappings.mutation;
if (namespace) {
mutation = namespace + '/' + mutation;
}
return function (value) {
this.$store.commit(mutation, value)
};
} | javascript | function createSetter(namespace, mappings) {
let mutation = mappings.mutation;
if (namespace) {
mutation = namespace + '/' + mutation;
}
return function (value) {
this.$store.commit(mutation, value)
};
} | [
"function",
"createSetter",
"(",
"namespace",
",",
"mappings",
")",
"{",
"let",
"mutation",
"=",
"mappings",
".",
"mutation",
";",
"if",
"(",
"namespace",
")",
"{",
"mutation",
"=",
"namespace",
"+",
"'/'",
"+",
"mutation",
";",
"}",
"return",
"function",
... | create a setter for computed properties | [
"create",
"a",
"setter",
"for",
"computed",
"properties"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/lib/helpers/map_two_way_state.js#L82-L92 |
36,670 | Banno/polymer-lint | lib/util/filterErrors.js | disabledRules | function disabledRules(directives) {
return directives.reduce((disabled, _ref) => {
let name = _ref.name;
let args = _ref.args;
if (name === 'bplint-disable') {
for (const ruleName of args) {
disabled[ruleName] = true;
}
} else if (name === 'bplint-enable') {
for (const rule... | javascript | function disabledRules(directives) {
return directives.reduce((disabled, _ref) => {
let name = _ref.name;
let args = _ref.args;
if (name === 'bplint-disable') {
for (const ruleName of args) {
disabled[ruleName] = true;
}
} else if (name === 'bplint-enable') {
for (const rule... | [
"function",
"disabledRules",
"(",
"directives",
")",
"{",
"return",
"directives",
".",
"reduce",
"(",
"(",
"disabled",
",",
"_ref",
")",
"=>",
"{",
"let",
"name",
"=",
"_ref",
".",
"name",
";",
"let",
"args",
"=",
"_ref",
".",
"args",
";",
"if",
"(",... | Given an array of directives, returns the names of rules disabled by bplint-disable directives and not subsequently re-enabled by bplint-enable. | [
"Given",
"an",
"array",
"of",
"directives",
"returns",
"the",
"names",
"of",
"rules",
"disabled",
"by",
"bplint",
"-",
"disable",
"directives",
"and",
"not",
"subsequently",
"re",
"-",
"enabled",
"by",
"bplint",
"-",
"enable",
"."
] | cf4ffdc63837280080b67f496d038d33a3975b6f | https://github.com/Banno/polymer-lint/blob/cf4ffdc63837280080b67f496d038d33a3975b6f/lib/util/filterErrors.js#L7-L26 |
36,671 | simonepri/phc-bcrypt | bcrypt-b64.js | decode | function decode(str) {
let off = 0;
let olen = 0;
const slen = str.length;
const stra = [];
const len = str.length;
while (off < slen - 1 && olen < len) {
let code = str.charCodeAt(off++);
const c1 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
code = str.charCodeAt(off++);
const c... | javascript | function decode(str) {
let off = 0;
let olen = 0;
const slen = str.length;
const stra = [];
const len = str.length;
while (off < slen - 1 && olen < len) {
let code = str.charCodeAt(off++);
const c1 = code < BASE64_INDEX.length ? BASE64_INDEX[code] : -1;
code = str.charCodeAt(off++);
const c... | [
"function",
"decode",
"(",
"str",
")",
"{",
"let",
"off",
"=",
"0",
";",
"let",
"olen",
"=",
"0",
";",
"const",
"slen",
"=",
"str",
".",
"length",
";",
"const",
"stra",
"=",
"[",
"]",
";",
"const",
"len",
"=",
"str",
".",
"length",
";",
"while"... | Decodes a base64 encoded string using the bcrypt's base64 dictionary.
@param {string} str String to decode.
@returns {Buffer} The string decoded as a Buffer.
@inner | [
"Decodes",
"a",
"base64",
"encoded",
"string",
"using",
"the",
"bcrypt",
"s",
"base64",
"dictionary",
"."
] | 225fe73d3458a8f35f664f21e1cedd5545c256b4 | https://github.com/simonepri/phc-bcrypt/blob/225fe73d3458a8f35f664f21e1cedd5545c256b4/bcrypt-b64.js#L63-L97 |
36,672 | danigb/smplr | packages/sampler-instrument/lib/midi.js | midi | function midi (instrument, options) {
options = options || {}
var midi = {}
var unused = []
instrument.names().forEach(function (name) {
var m = toMidi(name)
if (m) midi[m] = instrument.get(name)
else unused.push(name)
})
if (options.map) addMap(midi, instrument, options.map)
return {
un... | javascript | function midi (instrument, options) {
options = options || {}
var midi = {}
var unused = []
instrument.names().forEach(function (name) {
var m = toMidi(name)
if (m) midi[m] = instrument.get(name)
else unused.push(name)
})
if (options.map) addMap(midi, instrument, options.map)
return {
un... | [
"function",
"midi",
"(",
"instrument",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"var",
"midi",
"=",
"{",
"}",
"var",
"unused",
"=",
"[",
"]",
"instrument",
".",
"names",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"n... | Create midi mappings for an instrument
@param {Instrument} instrument - the instrument. An instrument is an object
with names() and get() methods
@param {HashMap} options - (Optional) the midi mapping options. A hash may
with:
- map: a hash map of notes or a range of notes mapped to a sample name and
sample playing o... | [
"Create",
"midi",
"mappings",
"for",
"an",
"instrument"
] | d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1 | https://github.com/danigb/smplr/blob/d2ef6b41dfea486cb5eeaa320f5a75efe9ae9bb1/packages/sampler-instrument/lib/midi.js#L17-L34 |
36,673 | gulp-cookery/gulp-chef | lib/configuration/sort.js | sort | function sort(taskInfo, rawConfig, parentConfig, optionalSchema) {
var schema, subTaskConfigs, taskConfig, value;
schema = optionalSchema || {};
from(schema).to(taskInfo).imply(TASK_SCHEMA_MAPPINGS);
schema = defaults({}, schema, SCHEMA_DEFAULTS);
taskConfig = rawConfig;
// NOTE: If schema provided, try to norm... | javascript | function sort(taskInfo, rawConfig, parentConfig, optionalSchema) {
var schema, subTaskConfigs, taskConfig, value;
schema = optionalSchema || {};
from(schema).to(taskInfo).imply(TASK_SCHEMA_MAPPINGS);
schema = defaults({}, schema, SCHEMA_DEFAULTS);
taskConfig = rawConfig;
// NOTE: If schema provided, try to norm... | [
"function",
"sort",
"(",
"taskInfo",
",",
"rawConfig",
",",
"parentConfig",
",",
"optionalSchema",
")",
"{",
"var",
"schema",
",",
"subTaskConfigs",
",",
"taskConfig",
",",
"value",
";",
"schema",
"=",
"optionalSchema",
"||",
"{",
"}",
";",
"from",
"(",
"s... | If both parentConfig and taskConfig specified src property
then try to join paths. | [
"If",
"both",
"parentConfig",
"and",
"taskConfig",
"specified",
"src",
"property",
"then",
"try",
"to",
"join",
"paths",
"."
] | 6a8b6b4d20a9f8a36bc74f2beb74524c7338788f | https://github.com/gulp-cookery/gulp-chef/blob/6a8b6b4d20a9f8a36bc74f2beb74524c7338788f/lib/configuration/sort.js#L109-L181 |
36,674 | angelozerr/tern-browser-extension | browser-extension.js | createElement | function createElement (tagName) {
if (!tagName || tagName.length < 1) return new infer.Obj(infer.def.parsePath('HTMLElement.prototype'))
var cx = infer.cx(), server = cx.parent, name = getHTMLElementName(tagName),
locals = infer.def.parsePath(name + '.prototype')
if (locals && locals != infer.ANull) ... | javascript | function createElement (tagName) {
if (!tagName || tagName.length < 1) return new infer.Obj(infer.def.parsePath('HTMLElement.prototype'))
var cx = infer.cx(), server = cx.parent, name = getHTMLElementName(tagName),
locals = infer.def.parsePath(name + '.prototype')
if (locals && locals != infer.ANull) ... | [
"function",
"createElement",
"(",
"tagName",
")",
"{",
"if",
"(",
"!",
"tagName",
"||",
"tagName",
".",
"length",
"<",
"1",
")",
"return",
"new",
"infer",
".",
"Obj",
"(",
"infer",
".",
"def",
".",
"parsePath",
"(",
"'HTMLElement.prototype'",
")",
")",
... | Custom tern function | [
"Custom",
"tern",
"function"
] | b362729530727cfde0ec96289775d4363c40a17c | https://github.com/angelozerr/tern-browser-extension/blob/b362729530727cfde0ec96289775d4363c40a17c/browser-extension.js#L148-L154 |
36,675 | angelozerr/tern-browser-extension | browser-extension.js | findTypeAt | function findTypeAt (_file, _pos, expr, type) {
if (!expr) return type
var isStringLiteral = expr.node.type === 'Literal' &&
typeof expr.node.value === 'string'
if (isStringLiteral) {
var attr = null
if (!!expr.node.dom) {
attr = expr.node.dom
} else if (!!expr.node.eventTyp... | javascript | function findTypeAt (_file, _pos, expr, type) {
if (!expr) return type
var isStringLiteral = expr.node.type === 'Literal' &&
typeof expr.node.value === 'string'
if (isStringLiteral) {
var attr = null
if (!!expr.node.dom) {
attr = expr.node.dom
} else if (!!expr.node.eventTyp... | [
"function",
"findTypeAt",
"(",
"_file",
",",
"_pos",
",",
"expr",
",",
"type",
")",
"{",
"if",
"(",
"!",
"expr",
")",
"return",
"type",
"var",
"isStringLiteral",
"=",
"expr",
".",
"node",
".",
"type",
"===",
"'Literal'",
"&&",
"typeof",
"expr",
".",
... | Find type at | [
"Find",
"type",
"at"
] | b362729530727cfde0ec96289775d4363c40a17c | https://github.com/angelozerr/tern-browser-extension/blob/b362729530727cfde0ec96289775d4363c40a17c/browser-extension.js#L370-L403 |
36,676 | simonepri/phc-bcrypt | index.js | hash | function hash(password, options) {
options = options || {};
const rounds = options.rounds || defaults.rounds;
const saltSize = options.saltSize || defaults.saltSize;
const version = versions[versions.length - 1];
// Rounds Validation
if (typeof rounds !== 'number' || !Number.isInteger(rounds)) {
return... | javascript | function hash(password, options) {
options = options || {};
const rounds = options.rounds || defaults.rounds;
const saltSize = options.saltSize || defaults.saltSize;
const version = versions[versions.length - 1];
// Rounds Validation
if (typeof rounds !== 'number' || !Number.isInteger(rounds)) {
return... | [
"function",
"hash",
"(",
"password",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"const",
"rounds",
"=",
"options",
".",
"rounds",
"||",
"defaults",
".",
"rounds",
";",
"const",
"saltSize",
"=",
"options",
".",
"saltSize",
... | Computes the hash string of the given password in the PHC format using bcrypt
package.
@public
@param {string} password The password to hash.
@param {Object} [options] Optional configurations related to the hashing
function.
@param {number} [options.rounds=10] Optional
Must be an integer within the range (`4` <= `ro... | [
"Computes",
"the",
"hash",
"string",
"of",
"the",
"given",
"password",
"in",
"the",
"PHC",
"format",
"using",
"bcrypt",
"package",
"."
] | 225fe73d3458a8f35f664f21e1cedd5545c256b4 | https://github.com/simonepri/phc-bcrypt/blob/225fe73d3458a8f35f664f21e1cedd5545c256b4/index.js#L45-L93 |
36,677 | Banno/polymer-lint | src/reporters/ConsoleReporter.js | formatLine | function formatLine({ rule, message, location }, metrics) {
const { line, col } = location;
const { line: lineW, col: colW, message: msgW } = metrics;
const loc = sprintf(`%${lineW}d:%-${colW}d`, line, col);
const msg = sprintf(`%-${msgW}s`, message);
return ` ${loc} ${msg} ${rule}`;
} | javascript | function formatLine({ rule, message, location }, metrics) {
const { line, col } = location;
const { line: lineW, col: colW, message: msgW } = metrics;
const loc = sprintf(`%${lineW}d:%-${colW}d`, line, col);
const msg = sprintf(`%-${msgW}s`, message);
return ` ${loc} ${msg} ${rule}`;
} | [
"function",
"formatLine",
"(",
"{",
"rule",
",",
"message",
",",
"location",
"}",
",",
"metrics",
")",
"{",
"const",
"{",
"line",
",",
"col",
"}",
"=",
"location",
";",
"const",
"{",
"line",
":",
"lineW",
",",
"col",
":",
"colW",
",",
"message",
":... | Formats the output line with the widths given in `metrics`
@private
@param {{
rule: string,
message: string,
location: parse5.LocationInfo
}} error
@param {{line: number, col: number, message: number}} metrics
@return {string} | [
"Formats",
"the",
"output",
"line",
"with",
"the",
"widths",
"given",
"in",
"metrics"
] | cf4ffdc63837280080b67f496d038d33a3975b6f | https://github.com/Banno/polymer-lint/blob/cf4ffdc63837280080b67f496d038d33a3975b6f/src/reporters/ConsoleReporter.js#L50-L56 |
36,678 | ocadotechnology/quantumjs | quantum-html/lib/index.js | prepareTransforms | function prepareTransforms (entityTransforms, namespace, target) {
const resolvedNamespace = namespace || ''
const resolvedTarget = target || {}
for (const d in entityTransforms) {
if (typeof (entityTransforms[d]) === 'function') {
resolvedTarget[resolvedNamespace + d] = entityTransforms[d]
resolv... | javascript | function prepareTransforms (entityTransforms, namespace, target) {
const resolvedNamespace = namespace || ''
const resolvedTarget = target || {}
for (const d in entityTransforms) {
if (typeof (entityTransforms[d]) === 'function') {
resolvedTarget[resolvedNamespace + d] = entityTransforms[d]
resolv... | [
"function",
"prepareTransforms",
"(",
"entityTransforms",
",",
"namespace",
",",
"target",
")",
"{",
"const",
"resolvedNamespace",
"=",
"namespace",
"||",
"''",
"const",
"resolvedTarget",
"=",
"target",
"||",
"{",
"}",
"for",
"(",
"const",
"d",
"in",
"entityTr... | flattens out namespaced renderers into a single object | [
"flattens",
"out",
"namespaced",
"renderers",
"into",
"a",
"single",
"object"
] | 5bc684b750472296f186a816529272c36218db04 | https://github.com/ocadotechnology/quantumjs/blob/5bc684b750472296f186a816529272c36218db04/quantum-html/lib/index.js#L147-L160 |
36,679 | ocadotechnology/quantumjs | quantum-html/lib/index.js | transformer | function transformer (selection) {
const type = quantum.isSelection(selection) ? selection.type() : undefined
const entityTransform = transformMap[type] || defaultTransform
return entityTransform(selection, transformer, meta) // bootstrap to itself to make the transformer accessible to children
} | javascript | function transformer (selection) {
const type = quantum.isSelection(selection) ? selection.type() : undefined
const entityTransform = transformMap[type] || defaultTransform
return entityTransform(selection, transformer, meta) // bootstrap to itself to make the transformer accessible to children
} | [
"function",
"transformer",
"(",
"selection",
")",
"{",
"const",
"type",
"=",
"quantum",
".",
"isSelection",
"(",
"selection",
")",
"?",
"selection",
".",
"type",
"(",
")",
":",
"undefined",
"const",
"entityTransform",
"=",
"transformMap",
"[",
"type",
"]",
... | renders an selection by looking at its type and selecting the transform from the list | [
"renders",
"an",
"selection",
"by",
"looking",
"at",
"its",
"type",
"and",
"selecting",
"the",
"transform",
"from",
"the",
"list"
] | 5bc684b750472296f186a816529272c36218db04 | https://github.com/ocadotechnology/quantumjs/blob/5bc684b750472296f186a816529272c36218db04/quantum-html/lib/index.js#L188-L192 |
36,680 | bigpipe/illuminati | bootstrap.js | Error | function Error() {
Illuminati.apply(this, arguments);
var backtrace = new Backtrace({ error: this })
, sourcemap = stackmap(Error.sourcemap).map(backtrace.traces);
this.stringify(backtrace.traces, sourcemap);
} | javascript | function Error() {
Illuminati.apply(this, arguments);
var backtrace = new Backtrace({ error: this })
, sourcemap = stackmap(Error.sourcemap).map(backtrace.traces);
this.stringify(backtrace.traces, sourcemap);
} | [
"function",
"Error",
"(",
")",
"{",
"Illuminati",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"backtrace",
"=",
"new",
"Backtrace",
"(",
"{",
"error",
":",
"this",
"}",
")",
",",
"sourcemap",
"=",
"stackmap",
"(",
"Error",
".",
"sou... | Create a custom error instance that will automatically map a given source map
to the received or internal `stack` property.
@constructor
@api public | [
"Create",
"a",
"custom",
"error",
"instance",
"that",
"will",
"automatically",
"map",
"a",
"given",
"source",
"map",
"to",
"the",
"received",
"or",
"internal",
"stack",
"property",
"."
] | f32ee3d0980bdb5fe23945dd9f8da63f2f737303 | https://github.com/bigpipe/illuminati/blob/f32ee3d0980bdb5fe23945dd9f8da63f2f737303/bootstrap.js#L20-L27 |
36,681 | ibolmo/grunt-mootools-packager | tasks/packager.js | getKeys | function getKeys(definition){
return definition.provides.map(function(component){
return definition.package + '/' + component;
}).concat(getPrimaryKey(definition));
} | javascript | function getKeys(definition){
return definition.provides.map(function(component){
return definition.package + '/' + component;
}).concat(getPrimaryKey(definition));
} | [
"function",
"getKeys",
"(",
"definition",
")",
"{",
"return",
"definition",
".",
"provides",
".",
"map",
"(",
"function",
"(",
"component",
")",
"{",
"return",
"definition",
".",
"package",
"+",
"'/'",
"+",
"component",
";",
"}",
")",
".",
"concat",
"(",... | provides keys to the source file based on the name and the components provided | [
"provides",
"keys",
"to",
"the",
"source",
"file",
"based",
"on",
"the",
"name",
"and",
"the",
"components",
"provided"
] | fde35544d09c9ca4efc83bf386310ce8f022fd16 | https://github.com/ibolmo/grunt-mootools-packager/blob/fde35544d09c9ca4efc83bf386310ce8f022fd16/tasks/packager.js#L31-L35 |
36,682 | ibolmo/grunt-mootools-packager | tasks/packager.js | getProjectName | function getProjectName(componentPath, optionsName){
if (typeof optionsName == 'string') return optionsName;
var projectName;
for (var prj in optionsName){
if(~componentPath.indexOf(optionsName[prj])) projectName = prj;
}
if (!projectName) grunt.fail.warn('Missing name in options for component with path: '... | javascript | function getProjectName(componentPath, optionsName){
if (typeof optionsName == 'string') return optionsName;
var projectName;
for (var prj in optionsName){
if(~componentPath.indexOf(optionsName[prj])) projectName = prj;
}
if (!projectName) grunt.fail.warn('Missing name in options for component with path: '... | [
"function",
"getProjectName",
"(",
"componentPath",
",",
"optionsName",
")",
"{",
"if",
"(",
"typeof",
"optionsName",
"==",
"'string'",
")",
"return",
"optionsName",
";",
"var",
"projectName",
";",
"for",
"(",
"var",
"prj",
"in",
"optionsName",
")",
"{",
"if... | matches project name with component's path | [
"matches",
"project",
"name",
"with",
"component",
"s",
"path"
] | fde35544d09c9ca4efc83bf386310ce8f022fd16 | https://github.com/ibolmo/grunt-mootools-packager/blob/fde35544d09c9ca4efc83bf386310ce8f022fd16/tasks/packager.js#L38-L46 |
36,683 | ibolmo/grunt-mootools-packager | tasks/packager.js | toArray | function toArray(object){
if (!object) return [];
if (object.charAt) return [object];
return grunt.util.toArray(object);
} | javascript | function toArray(object){
if (!object) return [];
if (object.charAt) return [object];
return grunt.util.toArray(object);
} | [
"function",
"toArray",
"(",
"object",
")",
"{",
"if",
"(",
"!",
"object",
")",
"return",
"[",
"]",
";",
"if",
"(",
"object",
".",
"charAt",
")",
"return",
"[",
"object",
"]",
";",
"return",
"grunt",
".",
"util",
".",
"toArray",
"(",
"object",
")",
... | wraps item in an array if it isn't one | [
"wraps",
"item",
"in",
"an",
"array",
"if",
"it",
"isn",
"t",
"one"
] | fde35544d09c9ca4efc83bf386310ce8f022fd16 | https://github.com/ibolmo/grunt-mootools-packager/blob/fde35544d09c9ca4efc83bf386310ce8f022fd16/tasks/packager.js#L49-L53 |
36,684 | ibolmo/grunt-mootools-packager | tasks/packager.js | checkRegistry | function checkRegistry(registry, key, path){
if (registry[key] == undefined){
throw new Error('Dependency not found: ' + key + ' in ' + path);
}
} | javascript | function checkRegistry(registry, key, path){
if (registry[key] == undefined){
throw new Error('Dependency not found: ' + key + ' in ' + path);
}
} | [
"function",
"checkRegistry",
"(",
"registry",
",",
"key",
",",
"path",
")",
"{",
"if",
"(",
"registry",
"[",
"key",
"]",
"==",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Dependency not found: '",
"+",
"key",
"+",
"' in '",
"+",
"path",
")",
... | verifies that an item is in the registry of components | [
"verifies",
"that",
"an",
"item",
"is",
"in",
"the",
"registry",
"of",
"components"
] | fde35544d09c9ca4efc83bf386310ce8f022fd16 | https://github.com/ibolmo/grunt-mootools-packager/blob/fde35544d09c9ca4efc83bf386310ce8f022fd16/tasks/packager.js#L56-L60 |
36,685 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | findInstanceThen | function findInstanceThen() {
// this function supports two argument signatures. if the
// first argument is an object, we will use that as the
// config, and the second arg as the mutation handler
var _parseArguments = parseArguments(arguments),
config = _parseArguments.conf... | javascript | function findInstanceThen() {
// this function supports two argument signatures. if the
// first argument is an object, we will use that as the
// config, and the second arg as the mutation handler
var _parseArguments = parseArguments(arguments),
config = _parseArguments.conf... | [
"function",
"findInstanceThen",
"(",
")",
"{",
"// this function supports two argument signatures. if the",
"// first argument is an object, we will use that as the",
"// config, and the second arg as the mutation handler",
"var",
"_parseArguments",
"=",
"parseArguments",
"(",
"arguments",... | Find a state instance, and execute a callback if found.
@param {Object|Function} required the config object, or mutation callback
@param {Function} optional mutation callback
@return {Function} | [
"Find",
"a",
"state",
"instance",
"and",
"execute",
"a",
"callback",
"if",
"found",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L99-L121 |
36,686 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | parseArguments | function parseArguments(args) {
var defaultConfig = {
stateKey: 'instances',
instanceKey: 'id'
};
if (typeof args[0] === 'function') {
return {
callback: args[0],
config: defaultConfig
};
} else {
... | javascript | function parseArguments(args) {
var defaultConfig = {
stateKey: 'instances',
instanceKey: 'id'
};
if (typeof args[0] === 'function') {
return {
callback: args[0],
config: defaultConfig
};
} else {
... | [
"function",
"parseArguments",
"(",
"args",
")",
"{",
"var",
"defaultConfig",
"=",
"{",
"stateKey",
":",
"'instances'",
",",
"instanceKey",
":",
"'id'",
"}",
";",
"if",
"(",
"typeof",
"args",
"[",
"0",
"]",
"===",
"'function'",
")",
"{",
"return",
"{",
... | helper to get config and callback from the arguments | [
"helper",
"to",
"get",
"config",
"and",
"callback",
"from",
"the",
"arguments"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L129-L146 |
36,687 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | stateAndPayloadAreValid | function stateAndPayloadAreValid(config, state, payload) {
// ensure that the instances array exists
if (!Array.isArray(state[config.stateKey])) {
console.error('State does not contain an "' + config.stateKey + '" array.');
return false;
}
// ensure that the pay... | javascript | function stateAndPayloadAreValid(config, state, payload) {
// ensure that the instances array exists
if (!Array.isArray(state[config.stateKey])) {
console.error('State does not contain an "' + config.stateKey + '" array.');
return false;
}
// ensure that the pay... | [
"function",
"stateAndPayloadAreValid",
"(",
"config",
",",
"state",
",",
"payload",
")",
"{",
"// ensure that the instances array exists",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"state",
"[",
"config",
".",
"stateKey",
"]",
")",
")",
"{",
"console",
"."... | check if the state or payload is malformed | [
"check",
"if",
"the",
"state",
"or",
"payload",
"is",
"malformed"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L149-L164 |
36,688 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | instance_getters | function instance_getters () {
var _parseArguments = parseArguments$1(arguments),
getters = _parseArguments.getters,
options = _parseArguments.options;
return Object.keys(getters).reduce(function (instanceGetters, name) {
instanceGetters[name] = function (state, othe... | javascript | function instance_getters () {
var _parseArguments = parseArguments$1(arguments),
getters = _parseArguments.getters,
options = _parseArguments.options;
return Object.keys(getters).reduce(function (instanceGetters, name) {
instanceGetters[name] = function (state, othe... | [
"function",
"instance_getters",
"(",
")",
"{",
"var",
"_parseArguments",
"=",
"parseArguments$1",
"(",
"arguments",
")",
",",
"getters",
"=",
"_parseArguments",
".",
"getters",
",",
"options",
"=",
"_parseArguments",
".",
"options",
";",
"return",
"Object",
".",... | Instance getters.
@return {Object} | [
"Instance",
"getters",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L171-L191 |
36,689 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | instance_mutations | function instance_mutations () {
var _parseArguments = parseArguments$2(arguments),
options = _parseArguments.options,
mutations = _parseArguments.mutations;
return Object.keys(mutations).reduce(function (instanceMutations, name) {
instanceMutations[name] = findInsta... | javascript | function instance_mutations () {
var _parseArguments = parseArguments$2(arguments),
options = _parseArguments.options,
mutations = _parseArguments.mutations;
return Object.keys(mutations).reduce(function (instanceMutations, name) {
instanceMutations[name] = findInsta... | [
"function",
"instance_mutations",
"(",
")",
"{",
"var",
"_parseArguments",
"=",
"parseArguments$2",
"(",
"arguments",
")",
",",
"options",
"=",
"_parseArguments",
".",
"options",
",",
"mutations",
"=",
"_parseArguments",
".",
"mutations",
";",
"return",
"Object",
... | Instance mutations.
@return {Object} | [
"Instance",
"mutations",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L208-L218 |
36,690 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | getEntries | function getEntries (obj) {
return Object.keys(obj).map(function (key) {
return [key, obj[key]];
});
} | javascript | function getEntries (obj) {
return Object.keys(obj).map(function (key) {
return [key, obj[key]];
});
} | [
"function",
"getEntries",
"(",
"obj",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"[",
"key",
",",
"obj",
"[",
"key",
"]",
"]",
";",
"}",
")",
";",
"}"
] | Similar to Object.entries but without using polyfill | [
"Similar",
"to",
"Object",
".",
"entries",
"but",
"without",
"using",
"polyfill"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L236-L240 |
36,691 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | wrapGetterFn | function wrapGetterFn(_ref) {
var _ref2 = slicedToArray(_ref, 2),
key = _ref2[0],
originalFn = _ref2[1];
var newFn = function newFn() {
var innerFn = originalFn.apply(this, arguments);
if (typeof innerFn !== 'function') {
/* istanbul igno... | javascript | function wrapGetterFn(_ref) {
var _ref2 = slicedToArray(_ref, 2),
key = _ref2[0],
originalFn = _ref2[1];
var newFn = function newFn() {
var innerFn = originalFn.apply(this, arguments);
if (typeof innerFn !== 'function') {
/* istanbul igno... | [
"function",
"wrapGetterFn",
"(",
"_ref",
")",
"{",
"var",
"_ref2",
"=",
"slicedToArray",
"(",
"_ref",
",",
"2",
")",
",",
"key",
"=",
"_ref2",
"[",
"0",
"]",
",",
"originalFn",
"=",
"_ref2",
"[",
"1",
"]",
";",
"var",
"newFn",
"=",
"function",
"new... | Create a wrapper function which invokes the original function passing in `this.id` | [
"Create",
"a",
"wrapper",
"function",
"which",
"invokes",
"the",
"original",
"function",
"passing",
"in",
"this",
".",
"id"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L274-L291 |
36,692 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | resolveObjectPath | function resolveObjectPath (obj, path) {
var delimeter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
var pathArray = Array.isArray(path) ? path : path.split(delimeter);
return pathArray.reduce(function (p, item) {
return p && p[item];
}, obj);
... | javascript | function resolveObjectPath (obj, path) {
var delimeter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
var pathArray = Array.isArray(path) ? path : path.split(delimeter);
return pathArray.reduce(function (p, item) {
return p && p[item];
}, obj);
... | [
"function",
"resolveObjectPath",
"(",
"obj",
",",
"path",
")",
"{",
"var",
"delimeter",
"=",
"arguments",
".",
"length",
">",
"2",
"&&",
"arguments",
"[",
"2",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"2",
"]",
":",
"'.'",
";",
"var",
"pathArray... | Helper function for resolving nested object values.
@param {Object} obj source object
@param {Array|String} path path to nested value
@param {String|RegExp} delimeter characters / pattern to split path on
@return {mixed} | [
"Helper",
"function",
"for",
"resolving",
"nested",
"object",
"values",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L332-L340 |
36,693 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | normalizeMappings | function normalizeMappings(mappings) {
if (Array.isArray(mappings)) {
return mappings.reduce(function (normalizedMappings, key) {
normalizedMappings[key] = key;
return normalizedMappings;
}, {});
}
return mappings;
} | javascript | function normalizeMappings(mappings) {
if (Array.isArray(mappings)) {
return mappings.reduce(function (normalizedMappings, key) {
normalizedMappings[key] = key;
return normalizedMappings;
}, {});
}
return mappings;
} | [
"function",
"normalizeMappings",
"(",
"mappings",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"mappings",
")",
")",
"{",
"return",
"mappings",
".",
"reduce",
"(",
"function",
"(",
"normalizedMappings",
",",
"key",
")",
"{",
"normalizedMappings",
"[",
... | normalize the mappings into a consistent object format | [
"normalize",
"the",
"mappings",
"into",
"a",
"consistent",
"object",
"format"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L376-L386 |
36,694 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | error | function error (message) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
throw new (Function.prototype.bind.apply(Error, [null].concat(['[spyfu-vuex-helpers]: ' + message], args)))();
... | javascript | function error (message) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
throw new (Function.prototype.bind.apply(Error, [null].concat(['[spyfu-vuex-helpers]: ' + message], args)))();
... | [
"function",
"error",
"(",
"message",
")",
"{",
"for",
"(",
"var",
"_len",
"=",
"arguments",
".",
"length",
",",
"args",
"=",
"Array",
"(",
"_len",
">",
"1",
"?",
"_len",
"-",
"1",
":",
"0",
")",
",",
"_key",
"=",
"1",
";",
"_key",
"<",
"_len",
... | helper to throw consistent errors this is useful in testing to make sure caught errors are ours | [
"helper",
"to",
"throw",
"consistent",
"errors",
"this",
"is",
"useful",
"in",
"testing",
"to",
"make",
"sure",
"caught",
"errors",
"are",
"ours"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L420-L426 |
36,695 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | map_two_way_state | function map_two_way_state () {
// this function supports two argument signatures. if the
// first argument is a string, we will use that as the
// namespace, and the next arg as the state mapping
var _parseArguments = parseArguments$3(arguments),
namespace = _parseArguments.... | javascript | function map_two_way_state () {
// this function supports two argument signatures. if the
// first argument is a string, we will use that as the
// namespace, and the next arg as the state mapping
var _parseArguments = parseArguments$3(arguments),
namespace = _parseArguments.... | [
"function",
"map_two_way_state",
"(",
")",
"{",
"// this function supports two argument signatures. if the",
"// first argument is a string, we will use that as the",
"// namespace, and the next arg as the state mapping",
"var",
"_parseArguments",
"=",
"parseArguments$3",
"(",
"arguments",... | Map vuex state with two way computed properties
@param {string|Object} required the module namespace, or state mappings
@param {Object} optional state mappings
@return {Object} | [
"Map",
"vuex",
"state",
"with",
"two",
"way",
"computed",
"properties"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L435-L459 |
36,696 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | parseMappings | function parseMappings(obj) {
var mapping = {};
// throw a helpful error when mapTwoWayState is mixed up with mapState
if (Array.isArray(obj)) {
error('Invalid arguments for mapTwoWayState. State mapping must be an object in { \'path.to.state\': \'mutationName\' } format.');
... | javascript | function parseMappings(obj) {
var mapping = {};
// throw a helpful error when mapTwoWayState is mixed up with mapState
if (Array.isArray(obj)) {
error('Invalid arguments for mapTwoWayState. State mapping must be an object in { \'path.to.state\': \'mutationName\' } format.');
... | [
"function",
"parseMappings",
"(",
"obj",
")",
"{",
"var",
"mapping",
"=",
"{",
"}",
";",
"// throw a helpful error when mapTwoWayState is mixed up with mapState",
"if",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"error",
"(",
"'Invalid arguments for ma... | determine our key and mutation values | [
"determine",
"our",
"key",
"and",
"mutation",
"values"
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L470-L490 |
36,697 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | simple_instance_setters | function simple_instance_setters (setters) {
var stateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'instances';
var instanceKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
// loop over the setter keys and make a mutation for each
... | javascript | function simple_instance_setters (setters) {
var stateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'instances';
var instanceKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
// loop over the setter keys and make a mutation for each
... | [
"function",
"simple_instance_setters",
"(",
"setters",
")",
"{",
"var",
"stateKey",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"'instances'",
";",
"var",
"instanceK... | Simple mutations that set an instance's state equal to a value.
@param {Object}
@param {String}
@param {String}
@return {Object} | [
"Simple",
"mutations",
"that",
"set",
"an",
"instance",
"s",
"state",
"equal",
"to",
"a",
"value",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L528-L560 |
36,698 | spyfu/spyfu-vuex-helpers | dist/spyfu-vuex-helpers.js | simple_setters | function simple_setters (setters) {
// loop over the setter keys and make a mutation for each
return Object.keys(setters).reduce(function (mutations, name) {
// attach our new mutation to result
return Object.assign({}, mutations, defineProperty({}, name, function (state, value)... | javascript | function simple_setters (setters) {
// loop over the setter keys and make a mutation for each
return Object.keys(setters).reduce(function (mutations, name) {
// attach our new mutation to result
return Object.assign({}, mutations, defineProperty({}, name, function (state, value)... | [
"function",
"simple_setters",
"(",
"setters",
")",
"{",
"// loop over the setter keys and make a mutation for each",
"return",
"Object",
".",
"keys",
"(",
"setters",
")",
".",
"reduce",
"(",
"function",
"(",
"mutations",
",",
"name",
")",
"{",
"// attach our new mutat... | Simple mutations that set a piece of state equal to a value.
@param {Object} setters Object mapping mutations to state
@return {Object} | [
"Simple",
"mutations",
"that",
"set",
"a",
"piece",
"of",
"state",
"equal",
"to",
"a",
"value",
"."
] | 64742e0cbadb3e6ee62d722b26dbc27b87e1a378 | https://github.com/spyfu/spyfu-vuex-helpers/blob/64742e0cbadb3e6ee62d722b26dbc27b87e1a378/dist/spyfu-vuex-helpers.js#L695-L715 |
36,699 | SuneBear/midi.js | examples/inc/event.js | function(event) {
event = event || window.event;
self.state = count++ ? "change" : "start";
self.wheelDelta = event.detail ? event.detail * -20 : event.wheelDelta;
conf.listener(event, self);
clearTimeout(interval);
interval = setTimeout(function() {
count = 0;
self.state = "end";
self.wheelDelta =... | javascript | function(event) {
event = event || window.event;
self.state = count++ ? "change" : "start";
self.wheelDelta = event.detail ? event.detail * -20 : event.wheelDelta;
conf.listener(event, self);
clearTimeout(interval);
interval = setTimeout(function() {
count = 0;
self.state = "end";
self.wheelDelta =... | [
"function",
"(",
"event",
")",
"{",
"event",
"=",
"event",
"||",
"window",
".",
"event",
";",
"self",
".",
"state",
"=",
"count",
"++",
"?",
"\"change\"",
":",
"\"start\"",
";",
"self",
".",
"wheelDelta",
"=",
"event",
".",
"detail",
"?",
"event",
".... | Tracking the events. | [
"Tracking",
"the",
"events",
"."
] | 46856c7c18b13938ef4167a5f49114cd487802c0 | https://github.com/SuneBear/midi.js/blob/46856c7c18b13938ef4167a5f49114cd487802c0/examples/inc/event.js#L1860-L1872 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.