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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,900 | novadiscovery/nway | lib/parsers/css/injector.js | injector | function injector(css, module, makeModule, options) {
output_css = join(options.output, options.css_folder || 'css');
location_css = options.client + '/' + (options.css_folder || 'css');
output_links = join(options.output, options.links_folder || 'links');
location_links = options.client + '/' + ... | javascript | function injector(css, module, makeModule, options) {
output_css = join(options.output, options.css_folder || 'css');
location_css = options.client + '/' + (options.css_folder || 'css');
output_links = join(options.output, options.links_folder || 'links');
location_links = options.client + '/' + ... | [
"function",
"injector",
"(",
"css",
",",
"module",
",",
"makeModule",
",",
"options",
")",
"{",
"output_css",
"=",
"join",
"(",
"options",
".",
"output",
",",
"options",
".",
"css_folder",
"||",
"'css'",
")",
";",
"location_css",
"=",
"options",
".",
"cl... | Injector module for css source
A nway parser function who create a nway javascript module
that offer a css injector for the css source.
The module exports:
- inject([media]): Inject css in the page (with a loaded promise)
may be called with a media attribute (default:all)
- eject(): remove css off the page
- injecte... | [
"Injector",
"module",
"for",
"css",
"source"
] | fa31c6fe56f2305721e581ac25e8ac9a87e15dda | https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/parsers/css/injector.js#L54-L77 |
51,901 | xsolon/spexplorerjs | webapi/src/components/sp/widgets/treelight.js | function () {
if (!enumer.moveNext()) {
cb(groups);
return;
}
var li = enumer.get_current();
var name = li.get_item("Name");
if (name.search(" ") > 0) {
doNext();
}
else {
var id = li.get_item("ID");
var user = web.ensureUser(name... | javascript | function () {
if (!enumer.moveNext()) {
cb(groups);
return;
}
var li = enumer.get_current();
var name = li.get_item("Name");
if (name.search(" ") > 0) {
doNext();
}
else {
var id = li.get_item("ID");
var user = web.ensureUser(name... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"enumer",
".",
"moveNext",
"(",
")",
")",
"{",
"cb",
"(",
"groups",
")",
";",
"return",
";",
"}",
"var",
"li",
"=",
"enumer",
".",
"get_current",
"(",
")",
";",
"var",
"name",
"=",
"li",
".",
"get_item... | var count = 0; | [
"var",
"count",
"=",
"0",
";"
] | 4e9b410864afb731f88e84414984fa18ac5705f1 | https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/sp/widgets/treelight.js#L121-L146 | |
51,902 | BuZZ-dEE/fussball-de-matchplan-grabber | index.js | parseMatchplan | function parseMatchplan(team, callback) {
/** @type {String[]} */
var matchPlanArr = [],
/** @type {Matchplan} */
matchPlan,
/** @type {String[]} */
matchDetails = [],
/** @type {Encounter[]} */
encounters = [];
jsdom.env({
url: team,
scripts: ["http://code.jquery.com/jque... | javascript | function parseMatchplan(team, callback) {
/** @type {String[]} */
var matchPlanArr = [],
/** @type {Matchplan} */
matchPlan,
/** @type {String[]} */
matchDetails = [],
/** @type {Encounter[]} */
encounters = [];
jsdom.env({
url: team,
scripts: ["http://code.jquery.com/jque... | [
"function",
"parseMatchplan",
"(",
"team",
",",
"callback",
")",
"{",
"/** @type {String[]} */",
"var",
"matchPlanArr",
"=",
"[",
"]",
",",
"/** @type {Matchplan} */",
"matchPlan",
",",
"/** @type {String[]} */",
"matchDetails",
"=",
"[",
"]",
",",
"/** @type {Encount... | Parse the match plan.
@param {String} team - The next matches team URL.
@param {function} callback - The function to call back with the match plan. | [
"Parse",
"the",
"match",
"plan",
"."
] | 01b4766b7cc1ea42e9acb885ca132b5fc0598cd9 | https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L12-L50 |
51,903 | BuZZ-dEE/fussball-de-matchplan-grabber | index.js | parseMatchTime | function parseMatchTime(matchTime) {
/** @type String[] */
var matchTimeArr = matchTime.split(' ');
matchTimeArr = [matchTimeArr[1], matchTimeArr[3]];
var dayMonthYear = matchTimeArr[0].split('.');
var hourMinutes = matchTimeArr[1].split(':');
var date = new Date(dayMonthYear[2], parseInt(dayMo... | javascript | function parseMatchTime(matchTime) {
/** @type String[] */
var matchTimeArr = matchTime.split(' ');
matchTimeArr = [matchTimeArr[1], matchTimeArr[3]];
var dayMonthYear = matchTimeArr[0].split('.');
var hourMinutes = matchTimeArr[1].split(':');
var date = new Date(dayMonthYear[2], parseInt(dayMo... | [
"function",
"parseMatchTime",
"(",
"matchTime",
")",
"{",
"/** @type String[] */",
"var",
"matchTimeArr",
"=",
"matchTime",
".",
"split",
"(",
"' '",
")",
";",
"matchTimeArr",
"=",
"[",
"matchTimeArr",
"[",
"1",
"]",
",",
"matchTimeArr",
"[",
"3",
"]",
"]",
... | Parse the match time.
@param {String} matchTime
@returns {Date} The match date time. | [
"Parse",
"the",
"match",
"time",
"."
] | 01b4766b7cc1ea42e9acb885ca132b5fc0598cd9 | https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L58-L68 |
51,904 | BuZZ-dEE/fussball-de-matchplan-grabber | index.js | createMatchplan | function createMatchplan(matchPlanArr, encounters, matchDetails) {
var matchPlan = new Matchplan();
matchPlanArr.forEach(function(currentValue, index, array) {
matchplanEntry = new MatchplanEntry(currentValue, null, encounters[index], null, matchDetails[index]);
matchPlan.addEntry(matchplanEntry... | javascript | function createMatchplan(matchPlanArr, encounters, matchDetails) {
var matchPlan = new Matchplan();
matchPlanArr.forEach(function(currentValue, index, array) {
matchplanEntry = new MatchplanEntry(currentValue, null, encounters[index], null, matchDetails[index]);
matchPlan.addEntry(matchplanEntry... | [
"function",
"createMatchplan",
"(",
"matchPlanArr",
",",
"encounters",
",",
"matchDetails",
")",
"{",
"var",
"matchPlan",
"=",
"new",
"Matchplan",
"(",
")",
";",
"matchPlanArr",
".",
"forEach",
"(",
"function",
"(",
"currentValue",
",",
"index",
",",
"array",
... | Create the match plan.
@param {String[]} matchPlanArr
@param {Encounter[]} encounters
@param {URL[]} matchDetails
@returns {Matchplan} | [
"Create",
"the",
"match",
"plan",
"."
] | 01b4766b7cc1ea42e9acb885ca132b5fc0598cd9 | https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L78-L85 |
51,905 | bigpipe/bigpipe-watch | index.js | refresh | function refresh(file, event, full) {
views.forEach(function loopViews(path) {
if (path !== full) return;
tempers.forEach(function eachTemper(temper) {
delete temper.file[path];
delete temper.compiled[path];
temper.prefetch(path);
});
});
assets... | javascript | function refresh(file, event, full) {
views.forEach(function loopViews(path) {
if (path !== full) return;
tempers.forEach(function eachTemper(temper) {
delete temper.file[path];
delete temper.compiled[path];
temper.prefetch(path);
});
});
assets... | [
"function",
"refresh",
"(",
"file",
",",
"event",
",",
"full",
")",
"{",
"views",
".",
"forEach",
"(",
"function",
"loopViews",
"(",
"path",
")",
"{",
"if",
"(",
"path",
"!==",
"full",
")",
"return",
";",
"tempers",
".",
"forEach",
"(",
"function",
"... | Check cache and prefetch if the file is part of the compiler.
@param {String} file name
@api private | [
"Check",
"cache",
"and",
"prefetch",
"if",
"the",
"file",
"is",
"part",
"of",
"the",
"compiler",
"."
] | 337ef162a4c5c4533a2120437e5fbb8a300e0bc2 | https://github.com/bigpipe/bigpipe-watch/blob/337ef162a4c5c4533a2120437e5fbb8a300e0bc2/index.js#L78-L102 |
51,906 | thirdcoder/tritwise | tritwise.js | dyadic_pref_op | function dyadic_pref_op(pref, input1, input2, input_width) {
if (pref < -13 || pref > 13) throw new Error('dyadic_pref_op('+pref+'): out of range iii-111');
var bt_pref = pad(3, n2bts(pref), '0');
if (bt_pref.indexOf('i') === -1 || bt_pref.indexOf('0') === -1 || bt_pref.indexOf('1') === -1)
throw new Error('d... | javascript | function dyadic_pref_op(pref, input1, input2, input_width) {
if (pref < -13 || pref > 13) throw new Error('dyadic_pref_op('+pref+'): out of range iii-111');
var bt_pref = pad(3, n2bts(pref), '0');
if (bt_pref.indexOf('i') === -1 || bt_pref.indexOf('0') === -1 || bt_pref.indexOf('1') === -1)
throw new Error('d... | [
"function",
"dyadic_pref_op",
"(",
"pref",
",",
"input1",
",",
"input2",
",",
"input_width",
")",
"{",
"if",
"(",
"pref",
"<",
"-",
"13",
"||",
"pref",
">",
"13",
")",
"throw",
"new",
"Error",
"(",
"'dyadic_pref_op('",
"+",
"pref",
"+",
"'): out of range... | Dyadic preference functions | [
"Dyadic",
"preference",
"functions"
] | d947fa07e88a9e516279c6ac5e9eda6e8228ecf2 | https://github.com/thirdcoder/tritwise/blob/d947fa07e88a9e516279c6ac5e9eda6e8228ecf2/tritwise.js#L46-L73 |
51,907 | glebmachine/node-localcache | index.js | ejectionHandler | function ejectionHandler() {
process.stdin.resume();
log(chalk.yellow('Ejection, swooooooooo-oooopphhhf!'));
_this.fileSynceInstantly(function ejectionComplete() {
log(chalk.green('Everything saved, for god sake'));
log('shittung down, see you next life');
process.exit();
});
} | javascript | function ejectionHandler() {
process.stdin.resume();
log(chalk.yellow('Ejection, swooooooooo-oooopphhhf!'));
_this.fileSynceInstantly(function ejectionComplete() {
log(chalk.green('Everything saved, for god sake'));
log('shittung down, see you next life');
process.exit();
});
} | [
"function",
"ejectionHandler",
"(",
")",
"{",
"process",
".",
"stdin",
".",
"resume",
"(",
")",
";",
"log",
"(",
"chalk",
".",
"yellow",
"(",
"'Ejection, swooooooooo-oooopphhhf!'",
")",
")",
";",
"_this",
".",
"fileSynceInstantly",
"(",
"function",
"ejectionCo... | handler for exit fo nodejs process | [
"handler",
"for",
"exit",
"fo",
"nodejs",
"process"
] | a8ecf248c16e11871faa581d61453bd8f81b6d9c | https://github.com/glebmachine/node-localcache/blob/a8ecf248c16e11871faa581d61453bd8f81b6d9c/index.js#L41-L49 |
51,908 | redisjs/jsr-server | lib/command/server/shutdown.js | execute | function execute(req, res) {
var save = undefined;
if(req.args[0] !== undefined) {
save = req.args[0] === true;
}
this.shutdown({save: save, code: 0}, process.exit);
} | javascript | function execute(req, res) {
var save = undefined;
if(req.args[0] !== undefined) {
save = req.args[0] === true;
}
this.shutdown({save: save, code: 0}, process.exit);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"var",
"save",
"=",
"undefined",
";",
"if",
"(",
"req",
".",
"args",
"[",
"0",
"]",
"!==",
"undefined",
")",
"{",
"save",
"=",
"req",
".",
"args",
"[",
"0",
"]",
"===",
"true",
";",
"}",
... | Respond to the SHUTDOWN command. | [
"Respond",
"to",
"the",
"SHUTDOWN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/shutdown.js#L19-L25 |
51,909 | redisjs/jsr-server | lib/command/server/shutdown.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(args[0]) {
var arg = ('' + args[0]).toLowerCase();
if(arg !== Constants.SHUTDOWN.SAVE && arg !== Constants.SHUTDOWN.NOSAVE) {
throw CommandSyntax;
}
// rewrite with boolean
args[0] = (arg ==... | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
if(args[0]) {
var arg = ('' + args[0]).toLowerCase();
if(arg !== Constants.SHUTDOWN.SAVE && arg !== Constants.SHUTDOWN.NOSAVE) {
throw CommandSyntax;
}
// rewrite with boolean
args[0] = (arg ==... | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"args",
"[",
"0",
"]",
")",
"{",
"var",
"arg",
"=",
"(",... | Validate the SHUTDOWN command. | [
"Validate",
"the",
"SHUTDOWN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/shutdown.js#L30-L41 |
51,910 | Xrew/bobril-chartjs | docs/a.js | function() {
var me = this;
var barCount = 0;
helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) {
var meta = me.chart.getDatasetMeta(datasetIndex);
if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) {
++barCount;
}
}, me);
return barCount;
} | javascript | function() {
var me = this;
var barCount = 0;
helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) {
var meta = me.chart.getDatasetMeta(datasetIndex);
if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) {
++barCount;
}
}, me);
return barCount;
} | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"barCount",
"=",
"0",
";",
"helpers",
".",
"each",
"(",
"me",
".",
"chart",
".",
"data",
".",
"datasets",
",",
"function",
"(",
"dataset",
",",
"datasetIndex",
")",
"{",
"var",
"meta"... | Get the number of datasets that display bars. We use this to correctly calculate the bar width | [
"Get",
"the",
"number",
"of",
"datasets",
"that",
"display",
"bars",
".",
"We",
"use",
"this",
"to",
"correctly",
"calculate",
"the",
"bar",
"width"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L6184-L6194 | |
51,911 | Xrew/bobril-chartjs | docs/a.js | function(datasetIndex) {
var barIndex = 0;
var meta, j;
for (j = 0; j < datasetIndex; ++j) {
meta = this.chart.getDatasetMeta(j);
if (meta.bar && this.chart.isDatasetVisible(j)) {
++barIndex;
}
}
return barIndex;
} | javascript | function(datasetIndex) {
var barIndex = 0;
var meta, j;
for (j = 0; j < datasetIndex; ++j) {
meta = this.chart.getDatasetMeta(j);
if (meta.bar && this.chart.isDatasetVisible(j)) {
++barIndex;
}
}
return barIndex;
} | [
"function",
"(",
"datasetIndex",
")",
"{",
"var",
"barIndex",
"=",
"0",
";",
"var",
"meta",
",",
"j",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"datasetIndex",
";",
"++",
"j",
")",
"{",
"meta",
"=",
"this",
".",
"chart",
".",
"getDatasetMeta... | Get bar index from the given dataset index accounting for the fact that not all bars are visible | [
"Get",
"bar",
"index",
"from",
"the",
"given",
"dataset",
"index",
"accounting",
"for",
"the",
"fact",
"that",
"not",
"all",
"bars",
"are",
"visible"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L6311-L6323 | |
51,912 | Xrew/bobril-chartjs | docs/a.js | function() {
var me = this;
var options = me.options;
var scales = me.scales = {};
var items = [];
if (options.scales) {
items = items.concat(
(options.scales.xAxes || []).map(function(xAxisOptions) {
return {options: xAxisOptions, dtype: 'category'};
}),
(options.scales.yAxes |... | javascript | function() {
var me = this;
var options = me.options;
var scales = me.scales = {};
var items = [];
if (options.scales) {
items = items.concat(
(options.scales.xAxes || []).map(function(xAxisOptions) {
return {options: xAxisOptions, dtype: 'category'};
}),
(options.scales.yAxes |... | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"options",
"=",
"me",
".",
"options",
";",
"var",
"scales",
"=",
"me",
".",
"scales",
"=",
"{",
"}",
";",
"var",
"items",
"=",
"[",
"]",
";",
"if",
"(",
"options",
".",
"scales",
... | Builds a map of scale ID to scale object for future lookup. | [
"Builds",
"a",
"map",
"of",
"scale",
"ID",
"to",
"scale",
"object",
"for",
"future",
"lookup",
"."
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L8439-L8486 | |
51,913 | Xrew/bobril-chartjs | docs/a.js | function() {
if (!stub.ticking) {
stub.ticking = true;
helpers.requestAnimFrame.call(window, function() {
if (stub.resizer) {
stub.ticking = false;
return callback();
}
});
}
} | javascript | function() {
if (!stub.ticking) {
stub.ticking = true;
helpers.requestAnimFrame.call(window, function() {
if (stub.resizer) {
stub.ticking = false;
return callback();
}
});
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"stub",
".",
"ticking",
")",
"{",
"stub",
".",
"ticking",
"=",
"true",
";",
"helpers",
".",
"requestAnimFrame",
".",
"call",
"(",
"window",
",",
"function",
"(",
")",
"{",
"if",
"(",
"stub",
".",
"resizer"... | Throttle the callback notification until the next animation frame. | [
"Throttle",
"the",
"callback",
"notification",
"until",
"the",
"next",
"animation",
"frame",
"."
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10298-L10308 | |
51,914 | Xrew/bobril-chartjs | docs/a.js | function(chart, e) {
var position = helpers.getRelativePosition(e, chart.chart);
return getIntersectItems(chart, position);
} | javascript | function(chart, e) {
var position = helpers.getRelativePosition(e, chart.chart);
return getIntersectItems(chart, position);
} | [
"function",
"(",
"chart",
",",
"e",
")",
"{",
"var",
"position",
"=",
"helpers",
".",
"getRelativePosition",
"(",
"e",
",",
"chart",
".",
"chart",
")",
";",
"return",
"getIntersectItems",
"(",
"chart",
",",
"position",
")",
";",
"}"
] | Point mode returns all elements that hit test based on the event position
of the event
@function Chart.Interaction.modes.intersect
@param chart {chart} the chart we are returning items from
@param e {Event} the event we are find things at
@return {Chart.Element[]} Array of elements that are under the point. If none are... | [
"Point",
"mode",
"returns",
"all",
"elements",
"that",
"hit",
"test",
"based",
"on",
"the",
"event",
"position",
"of",
"the",
"event"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10575-L10578 | |
51,915 | Xrew/bobril-chartjs | docs/a.js | function(chartInstance, box) {
if (!chartInstance.boxes) {
chartInstance.boxes = [];
}
chartInstance.boxes.push(box);
} | javascript | function(chartInstance, box) {
if (!chartInstance.boxes) {
chartInstance.boxes = [];
}
chartInstance.boxes.push(box);
} | [
"function",
"(",
"chartInstance",
",",
"box",
")",
"{",
"if",
"(",
"!",
"chartInstance",
".",
"boxes",
")",
"{",
"chartInstance",
".",
"boxes",
"=",
"[",
"]",
";",
"}",
"chartInstance",
".",
"boxes",
".",
"push",
"(",
"box",
")",
";",
"}"
] | Register a box to a chartInstance. A box is simply a reference to an object that requires layout. eg. Scales, Legend, Plugins. | [
"Register",
"a",
"box",
"to",
"a",
"chartInstance",
".",
"A",
"box",
"is",
"simply",
"a",
"reference",
"to",
"an",
"object",
"that",
"requires",
"layout",
".",
"eg",
".",
"Scales",
"Legend",
"Plugins",
"."
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10749-L10754 | |
51,916 | Xrew/bobril-chartjs | docs/a.js | function(extension, args) {
var plugins = this._plugins;
var ilen = plugins.length;
var i, plugin;
for (i=0; i<ilen; ++i) {
plugin = plugins[i];
if (typeof plugin[extension] === 'function') {
if (plugin[extension].apply(plugin, args || []) === false) {
return false;
}
}
}
... | javascript | function(extension, args) {
var plugins = this._plugins;
var ilen = plugins.length;
var i, plugin;
for (i=0; i<ilen; ++i) {
plugin = plugins[i];
if (typeof plugin[extension] === 'function') {
if (plugin[extension].apply(plugin, args || []) === false) {
return false;
}
}
}
... | [
"function",
"(",
"extension",
",",
"args",
")",
"{",
"var",
"plugins",
"=",
"this",
".",
"_plugins",
";",
"var",
"ilen",
"=",
"plugins",
".",
"length",
";",
"var",
"i",
",",
"plugin",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ilen",
";",
... | Calls registered plugins on the specified extension, with the given args. This
method immediately returns as soon as a plugin explicitly returns false. The
returned value can be used, for instance, to interrupt the current action.
@param {String} extension the name of the plugin method to call (e.g. 'beforeUpdate').
@p... | [
"Calls",
"registered",
"plugins",
"on",
"the",
"specified",
"extension",
"with",
"the",
"given",
"args",
".",
"This",
"method",
"immediately",
"returns",
"as",
"soon",
"as",
"a",
"plugin",
"explicitly",
"returns",
"false",
".",
"The",
"returned",
"value",
"can... | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L11653-L11668 | |
51,917 | Xrew/bobril-chartjs | docs/a.js | function(rawValue) {
// Null and undefined values first
if (rawValue === null || typeof(rawValue) === 'undefined') {
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
if (typeof(rawValue) === 'number' && !isFinite(rawValue)) {
return N... | javascript | function(rawValue) {
// Null and undefined values first
if (rawValue === null || typeof(rawValue) === 'undefined') {
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
if (typeof(rawValue) === 'number' && !isFinite(rawValue)) {
return N... | [
"function",
"(",
"rawValue",
")",
"{",
"// Null and undefined values first",
"if",
"(",
"rawValue",
"===",
"null",
"||",
"typeof",
"(",
"rawValue",
")",
"===",
"'undefined'",
")",
"{",
"return",
"NaN",
";",
"}",
"// isNaN(object) returns true, so make sure NaN is chec... | Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not | [
"Get",
"the",
"correct",
"value",
".",
"NaN",
"bad",
"inputs",
"If",
"the",
"value",
"type",
"is",
"object",
"get",
"the",
"x",
"or",
"y",
"based",
"on",
"whether",
"we",
"are",
"horizontal",
"or",
"not"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12097-L12116 | |
51,918 | Xrew/bobril-chartjs | docs/a.js | function(index, includeOffset) {
var me = this;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var tickWidth = innerWidth / Math.max((me.ticks.length - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
var pixel = (tickWidth * index) + me.paddingLeft;
... | javascript | function(index, includeOffset) {
var me = this;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var tickWidth = innerWidth / Math.max((me.ticks.length - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
var pixel = (tickWidth * index) + me.paddingLeft;
... | [
"function",
"(",
"index",
",",
"includeOffset",
")",
"{",
"var",
"me",
"=",
"this",
";",
"if",
"(",
"me",
".",
"isHorizontal",
"(",
")",
")",
"{",
"var",
"innerWidth",
"=",
"me",
".",
"width",
"-",
"(",
"me",
".",
"paddingLeft",
"+",
"me",
".",
"... | Used for tick location, should | [
"Used",
"for",
"tick",
"location",
"should"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12129-L12146 | |
51,919 | Xrew/bobril-chartjs | docs/a.js | function(decimal /* , includeOffset*/) {
var me = this;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var valueOffset = (innerWidth * decimal) + me.paddingLeft;
var finalVal = me.left + Math.round(valueOffset);
finalVal += me.isFullWidth() ? me.margins.l... | javascript | function(decimal /* , includeOffset*/) {
var me = this;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var valueOffset = (innerWidth * decimal) + me.paddingLeft;
var finalVal = me.left + Math.round(valueOffset);
finalVal += me.isFullWidth() ? me.margins.l... | [
"function",
"(",
"decimal",
"/* , includeOffset*/",
")",
"{",
"var",
"me",
"=",
"this",
";",
"if",
"(",
"me",
".",
"isHorizontal",
"(",
")",
")",
"{",
"var",
"innerWidth",
"=",
"me",
".",
"width",
"-",
"(",
"me",
".",
"paddingLeft",
"+",
"me",
".",
... | Utility for getting the pixel location of a percentage of scale | [
"Utility",
"for",
"getting",
"the",
"pixel",
"location",
"of",
"a",
"percentage",
"of",
"scale"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12149-L12160 | |
51,920 | Xrew/bobril-chartjs | docs/a.js | function(generationOptions, dataRange) {
var ticks = [];
// To get a "nice" value for the tick spacing, we will use the appropriately named
// "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
// for details.
var spacing;
... | javascript | function(generationOptions, dataRange) {
var ticks = [];
// To get a "nice" value for the tick spacing, we will use the appropriately named
// "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
// for details.
var spacing;
... | [
"function",
"(",
"generationOptions",
",",
"dataRange",
")",
"{",
"var",
"ticks",
"=",
"[",
"]",
";",
"// To get a \"nice\" value for the tick spacing, we will use the appropriately named",
"// \"nice number\" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm... | Interface for the options provided to the numeric tick generator
@interface INumericTickGenerationOptions
The maximum number of ticks to display
@name INumericTickGenerationOptions#maxTicks
@type Number
The distance between each tick.
@name INumericTickGenerationOptions#stepSize
@type Number
@optional
Forced mini... | [
"Interface",
"for",
"the",
"options",
"provided",
"to",
"the",
"numeric",
"tick",
"generator"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12555-L12596 | |
51,921 | Xrew/bobril-chartjs | docs/a.js | function() {
var chartOpts = this.chart.options;
if (chartOpts && chartOpts.title) {
this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title);
}
} | javascript | function() {
var chartOpts = this.chart.options;
if (chartOpts && chartOpts.title) {
this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title);
}
} | [
"function",
"(",
")",
"{",
"var",
"chartOpts",
"=",
"this",
".",
"chart",
".",
"options",
";",
"if",
"(",
"chartOpts",
"&&",
"chartOpts",
".",
"title",
")",
"{",
"this",
".",
"options",
"=",
"helpers",
".",
"configMerge",
"(",
"Chart",
".",
"defaults",... | These methods are ordered by lifecycle. Utilities then follow. | [
"These",
"methods",
"are",
"ordered",
"by",
"lifecycle",
".",
"Utilities",
"then",
"follow",
"."
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12740-L12745 | |
51,922 | Xrew/bobril-chartjs | docs/a.js | getBaseModel | function getBaseModel(tooltipOpts) {
var globalDefaults = Chart.defaults.global;
var getValueOrDefault = helpers.getValueOrDefault;
return {
// Positioning
xPadding: tooltipOpts.xPadding,
yPadding: tooltipOpts.yPadding,
xAlign: tooltipOpts.xAlign,
yAlign: tooltipOpts.yAlign,
// Body
bodyFon... | javascript | function getBaseModel(tooltipOpts) {
var globalDefaults = Chart.defaults.global;
var getValueOrDefault = helpers.getValueOrDefault;
return {
// Positioning
xPadding: tooltipOpts.xPadding,
yPadding: tooltipOpts.yPadding,
xAlign: tooltipOpts.xAlign,
yAlign: tooltipOpts.yAlign,
// Body
bodyFon... | [
"function",
"getBaseModel",
"(",
"tooltipOpts",
")",
"{",
"var",
"globalDefaults",
"=",
"Chart",
".",
"defaults",
".",
"global",
";",
"var",
"getValueOrDefault",
"=",
"helpers",
".",
"getValueOrDefault",
";",
"return",
"{",
"// Positioning",
"xPadding",
":",
"to... | Helper to get the reset model for the tooltip
@param tooltipOpts {Object} the tooltip options | [
"Helper",
"to",
"get",
"the",
"reset",
"model",
"for",
"the",
"tooltip"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13047-L13092 |
51,923 | Xrew/bobril-chartjs | docs/a.js | function(elements) {
if (!elements.length) {
return false;
}
var i, len;
var x = 0;
var y = 0;
var count = 0;
for (i = 0, len = elements.length; i < len; ++i) {
var el = elements[i];
if (el && el.hasValue()) {
var pos = el.tooltipPosition();
x += pos.x;
y += pos.y;
... | javascript | function(elements) {
if (!elements.length) {
return false;
}
var i, len;
var x = 0;
var y = 0;
var count = 0;
for (i = 0, len = elements.length; i < len; ++i) {
var el = elements[i];
if (el && el.hasValue()) {
var pos = el.tooltipPosition();
x += pos.x;
y += pos.y;
... | [
"function",
"(",
"elements",
")",
"{",
"if",
"(",
"!",
"elements",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"var",
"i",
",",
"len",
";",
"var",
"x",
"=",
"0",
";",
"var",
"y",
"=",
"0",
";",
"var",
"count",
"=",
"0",
";",
"for",
... | Average mode places the tooltip at the average position of the elements shown
@function Chart.Tooltip.positioners.average
@param elements {ChartElement[]} the elements being displayed in the tooltip
@returns {Point} tooltip position | [
"Average",
"mode",
"places",
"the",
"tooltip",
"at",
"the",
"average",
"position",
"of",
"the",
"elements",
"shown"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13728-L13752 | |
51,924 | Xrew/bobril-chartjs | docs/a.js | lineToPoint | function lineToPoint(previousPoint, point) {
var pointVM = point._view;
if (point._view.steppedLine === true) {
ctx.lineTo(pointVM.x, previousPoint._view.y);
ctx.lineTo(pointVM.x, pointVM.y);
} else if (point._view.tension === 0) {
ctx.lineTo(pointVM.x, pointVM.y);
} else {
ctx.bezie... | javascript | function lineToPoint(previousPoint, point) {
var pointVM = point._view;
if (point._view.steppedLine === true) {
ctx.lineTo(pointVM.x, previousPoint._view.y);
ctx.lineTo(pointVM.x, pointVM.y);
} else if (point._view.tension === 0) {
ctx.lineTo(pointVM.x, pointVM.y);
} else {
ctx.bezie... | [
"function",
"lineToPoint",
"(",
"previousPoint",
",",
"point",
")",
"{",
"var",
"pointVM",
"=",
"point",
".",
"_view",
";",
"if",
"(",
"point",
".",
"_view",
".",
"steppedLine",
"===",
"true",
")",
"{",
"ctx",
".",
"lineTo",
"(",
"pointVM",
".",
"x",
... | Helper function to draw a line to a point | [
"Helper",
"function",
"to",
"draw",
"a",
"line",
"to",
"a",
"point"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13943-L13960 |
51,925 | Xrew/bobril-chartjs | docs/a.js | function() {
var me = this;
var labels = me.getLabels();
me.minIndex = 0;
me.maxIndex = labels.length - 1;
var findIndex;
if (me.options.ticks.min !== undefined) {
// user specified min value
findIndex = helpers.indexOf(labels, me.options.ticks.min);
me.minIndex = findIndex !== -1 ? findI... | javascript | function() {
var me = this;
var labels = me.getLabels();
me.minIndex = 0;
me.maxIndex = labels.length - 1;
var findIndex;
if (me.options.ticks.min !== undefined) {
// user specified min value
findIndex = helpers.indexOf(labels, me.options.ticks.min);
me.minIndex = findIndex !== -1 ? findI... | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"labels",
"=",
"me",
".",
"getLabels",
"(",
")",
";",
"me",
".",
"minIndex",
"=",
"0",
";",
"me",
".",
"maxIndex",
"=",
"labels",
".",
"length",
"-",
"1",
";",
"var",
"findIndex",
... | Implement this so that | [
"Implement",
"this",
"so",
"that"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L14367-L14388 | |
51,926 | Xrew/bobril-chartjs | docs/a.js | function(value, index, datasetIndex, includeOffset) {
var me = this;
// 1 is added because we need the length but we have the indexes
var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
if (value !== undefined && isNaN(index)) {
var labels = ... | javascript | function(value, index, datasetIndex, includeOffset) {
var me = this;
// 1 is added because we need the length but we have the indexes
var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
if (value !== undefined && isNaN(index)) {
var labels = ... | [
"function",
"(",
"value",
",",
"index",
",",
"datasetIndex",
",",
"includeOffset",
")",
"{",
"var",
"me",
"=",
"this",
";",
"// 1 is added because we need the length but we have the indexes",
"var",
"offsetAmt",
"=",
"Math",
".",
"max",
"(",
"(",
"me",
".",
"max... | Used to get data value locations. Value can either be an index or a numerical value | [
"Used",
"to",
"get",
"data",
"value",
"locations",
".",
"Value",
"can",
"either",
"be",
"an",
"index",
"or",
"a",
"numerical",
"value"
] | 8362f4ba54fb216343d30cc6a3ef35e98fa9cb44 | https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L14409-L14440 | |
51,927 | ssmereka/cramit | libs/index.js | function(err, files, results) {
if(err) {
cb(err);
} else {
for(var i = 0; i < results.length; i++) {
if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) {
fixtures[results[i].id] = results[i];
}
}
cb(undefined, fixtures... | javascript | function(err, files, results) {
if(err) {
cb(err);
} else {
for(var i = 0; i < results.length; i++) {
if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) {
fixtures[results[i].id] = results[i];
}
}
cb(undefined, fixtures... | [
"function",
"(",
"err",
",",
"files",
",",
"results",
")",
"{",
"if",
"(",
"err",
")",
"{",
"cb",
"(",
"err",
")",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"results",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Format the returned data object into a fixtures object, with the fixture ID as the key and the fixture class as the value. | [
"Format",
"the",
"returned",
"data",
"object",
"into",
"a",
"fixtures",
"object",
"with",
"the",
"fixture",
"ID",
"as",
"the",
"key",
"and",
"the",
"fixture",
"class",
"as",
"the",
"value",
"."
] | dac45479ca2b9455095624637a4796c1d2a710b9 | https://github.com/ssmereka/cramit/blob/dac45479ca2b9455095624637a4796c1d2a710b9/libs/index.js#L255-L266 | |
51,928 | xsolon/spexplorerjs | webapi/src/components/sp/widgets/field.selector.js | function (listTitle) {
return $.Deferred(function (dfd) {
trace.debug(`loading list ${listTitle}`);
spdal.getList(listTitle).done(function (list) {
onListChange(list);
listCtrl.data("xSPTreeLight").value(list);
}).always(function () {
dfd.resolve();
});
}).promise();
} | javascript | function (listTitle) {
return $.Deferred(function (dfd) {
trace.debug(`loading list ${listTitle}`);
spdal.getList(listTitle).done(function (list) {
onListChange(list);
listCtrl.data("xSPTreeLight").value(list);
}).always(function () {
dfd.resolve();
});
}).promise();
} | [
"function",
"(",
"listTitle",
")",
"{",
"return",
"$",
".",
"Deferred",
"(",
"function",
"(",
"dfd",
")",
"{",
"trace",
".",
"debug",
"(",
"`",
"${",
"listTitle",
"}",
"`",
")",
";",
"spdal",
".",
"getList",
"(",
"listTitle",
")",
".",
"done",
"(",... | hide treelight section | [
"hide",
"treelight",
"section"
] | 4e9b410864afb731f88e84414984fa18ac5705f1 | https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/sp/widgets/field.selector.js#L238-L252 | |
51,929 | labs-js/turbo-git-config | lib/utils.js | checkGitRepoExistence | function checkGitRepoExistence() {
return new Promise(function(resolve, reject) {
var checkRepoCommand = childProcess.exec('git branch');
checkRepoCommand.stderr.on('data', function(err) {
reject(err);
});
checkRepoCommand.on('close', function(co... | javascript | function checkGitRepoExistence() {
return new Promise(function(resolve, reject) {
var checkRepoCommand = childProcess.exec('git branch');
checkRepoCommand.stderr.on('data', function(err) {
reject(err);
});
checkRepoCommand.on('close', function(co... | [
"function",
"checkGitRepoExistence",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"checkRepoCommand",
"=",
"childProcess",
".",
"exec",
"(",
"'git branch'",
")",
";",
"checkRepoCommand",
".",
"stde... | Exec git branch to check if exist .git files | [
"Exec",
"git",
"branch",
"to",
"check",
"if",
"exist",
".",
"git",
"files"
] | b8e540a426cc778df36a62df9807d03a82322c8f | https://github.com/labs-js/turbo-git-config/blob/b8e540a426cc778df36a62df9807d03a82322c8f/lib/utils.js#L36-L50 |
51,930 | bucharest-gold/unifiedpush-admin-client | lib/variants.js | create | function create (client) {
return function create (options) {
options = options || {};
const type = getType(options);
const req = {
url: `${client.baseUrl}/rest/applications/${options.pushAppId}/${type}`,
method: 'POST'
};
const data = {
name: options.name,
description: ... | javascript | function create (client) {
return function create (options) {
options = options || {};
const type = getType(options);
const req = {
url: `${client.baseUrl}/rest/applications/${options.pushAppId}/${type}`,
method: 'POST'
};
const data = {
name: options.name,
description: ... | [
"function",
"create",
"(",
"client",
")",
"{",
"return",
"function",
"create",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"const",
"type",
"=",
"getType",
"(",
"options",
")",
";",
"const",
"req",
"=",
"{",
"url",
":",
... | A function to create a variant of a particular type.
@param {object} options - An options object
@param {string} options.pushAppId - The id of the push application
@param {string} options.type - The type variant. - ex: android, ios, ....
All Variants will have a type, name, and an optional description
@param {string}... | [
"A",
"function",
"to",
"create",
"a",
"variant",
"of",
"a",
"particular",
"type",
"."
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/variants.js#L106-L157 |
51,931 | tolokoban/ToloFrameWork | ker/cls/tfw.CssAnim.js | function(variables) {
var animation = false,
animationstring = 'animation',
keyframeprefix = '',
domPrefixes = ["Webkit", "Moz", "O", "ms", "Khtml"],
pfx = '',
elm = document.querySelector("body");
if( elm.style.animationName !== undefined ) { animation = true; }... | javascript | function(variables) {
var animation = false,
animationstring = 'animation',
keyframeprefix = '',
domPrefixes = ["Webkit", "Moz", "O", "ms", "Khtml"],
pfx = '',
elm = document.querySelector("body");
if( elm.style.animationName !== undefined ) { animation = true; }... | [
"function",
"(",
"variables",
")",
"{",
"var",
"animation",
"=",
"false",
",",
"animationstring",
"=",
"'animation'",
",",
"keyframeprefix",
"=",
"''",
",",
"domPrefixes",
"=",
"[",
"\"Webkit\"",
",",
"\"Moz\"",
",",
"\"O\"",
",",
"\"ms\"",
",",
"\"Khtml\"",... | Look for css prefixes. | [
"Look",
"for",
"css",
"prefixes",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/tfw.CssAnim.js#L16-L42 | |
51,932 | tuunanen/camelton | lib/cli.js | cli | function cli(program) {
var source = program.args[0] ? path.resolve(program.args[0]) : null,
destinations = program.args[1] ? Array.prototype.slice.call(program.args, 1) : [],
options = {},
camelton;
if (!source) {
console.error('Source file not defined.');
program.help();
}
if (!des... | javascript | function cli(program) {
var source = program.args[0] ? path.resolve(program.args[0]) : null,
destinations = program.args[1] ? Array.prototype.slice.call(program.args, 1) : [],
options = {},
camelton;
if (!source) {
console.error('Source file not defined.');
program.help();
}
if (!des... | [
"function",
"cli",
"(",
"program",
")",
"{",
"var",
"source",
"=",
"program",
".",
"args",
"[",
"0",
"]",
"?",
"path",
".",
"resolve",
"(",
"program",
".",
"args",
"[",
"0",
"]",
")",
":",
"null",
",",
"destinations",
"=",
"program",
".",
"args",
... | Command-line program.
@param {object} program - Commander program | [
"Command",
"-",
"line",
"program",
"."
] | 2beee32431e1b2867396e25f560f8dbd53535041 | https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/cli.js#L18-L60 |
51,933 | jaredhanson/connect-lrdd | lib/middleware/lrdd.js | serializeToXRD | function serializeToXRD(descriptor) {
var xml = '<?xml version="1.0" encoding="UTF-8"?>';
xml += '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
if (descriptor.expires) {
xml += '<Expires>' + xsdDateTimeString(descriptor.expires) + '</Expires>'... | javascript | function serializeToXRD(descriptor) {
var xml = '<?xml version="1.0" encoding="UTF-8"?>';
xml += '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
if (descriptor.expires) {
xml += '<Expires>' + xsdDateTimeString(descriptor.expires) + '</Expires>'... | [
"function",
"serializeToXRD",
"(",
"descriptor",
")",
"{",
"var",
"xml",
"=",
"'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'",
";",
"xml",
"+=",
"'<XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'",
";",
"if",
"(",
"de... | Serialize `descriptor` to XRD format.
@param {Descriptor} descriptor
@return {String}
@api private | [
"Serialize",
"descriptor",
"to",
"XRD",
"format",
"."
] | 6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1 | https://github.com/jaredhanson/connect-lrdd/blob/6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1/lib/middleware/lrdd.js#L94-L148 |
51,934 | jaredhanson/connect-lrdd | lib/middleware/lrdd.js | serializeToJRD | function serializeToJRD(descriptor) {
var obj = {};
if (descriptor.expires) { obj.expires = xsdDateTimeString(descriptor.expires); }
if (descriptor.subject) { obj.subject = descriptor.subject; }
if (descriptor.aliases.length > 0) {
obj.aliases = [];
descriptor.aliases.forEach(function(alias) {
obj... | javascript | function serializeToJRD(descriptor) {
var obj = {};
if (descriptor.expires) { obj.expires = xsdDateTimeString(descriptor.expires); }
if (descriptor.subject) { obj.subject = descriptor.subject; }
if (descriptor.aliases.length > 0) {
obj.aliases = [];
descriptor.aliases.forEach(function(alias) {
obj... | [
"function",
"serializeToJRD",
"(",
"descriptor",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"if",
"(",
"descriptor",
".",
"expires",
")",
"{",
"obj",
".",
"expires",
"=",
"xsdDateTimeString",
"(",
"descriptor",
".",
"expires",
")",
";",
"}",
"if",
"("... | Serialize `descriptor` to JRD format.
@param {Descriptor} descriptor
@return {String}
@api private | [
"Serialize",
"descriptor",
"to",
"JRD",
"format",
"."
] | 6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1 | https://github.com/jaredhanson/connect-lrdd/blob/6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1/lib/middleware/lrdd.js#L157-L207 |
51,935 | nickeljew/unjq-ajax | lib/ajax.js | textXml | function textXml(data) {
var xml = undefined,
tmp = undefined;
if (!data || typeof data !== "string") {
return null;
}
// Support: IE9
try {
tmp = new DOMParser();
... | javascript | function textXml(data) {
var xml = undefined,
tmp = undefined;
if (!data || typeof data !== "string") {
return null;
}
// Support: IE9
try {
tmp = new DOMParser();
... | [
"function",
"textXml",
"(",
"data",
")",
"{",
"var",
"xml",
"=",
"undefined",
",",
"tmp",
"=",
"undefined",
";",
"if",
"(",
"!",
"data",
"||",
"typeof",
"data",
"!==",
"\"string\"",
")",
"{",
"return",
"null",
";",
"}",
"// Support: IE9",
"try",
"{",
... | Parse text as xml | [
"Parse",
"text",
"as",
"xml"
] | 126626c08640e9ae386fea4e34b6b10482c5dbd6 | https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L824-L843 |
51,936 | nickeljew/unjq-ajax | lib/ajax.js | ajaxSetup | function ajaxSetup(target, settings) {
return settings ?
// Building a settings object
ajaxExtend(ajaxExtend(target, this.ajaxSettings), settings) :
// Extending ajaxSettings
ajaxExtend(this.ajaxSettings, target);
} | javascript | function ajaxSetup(target, settings) {
return settings ?
// Building a settings object
ajaxExtend(ajaxExtend(target, this.ajaxSettings), settings) :
// Extending ajaxSettings
ajaxExtend(this.ajaxSettings, target);
} | [
"function",
"ajaxSetup",
"(",
"target",
",",
"settings",
")",
"{",
"return",
"settings",
"?",
"// Building a settings object",
"ajaxExtend",
"(",
"ajaxExtend",
"(",
"target",
",",
"this",
".",
"ajaxSettings",
")",
",",
"settings",
")",
":",
"// Extending ajaxSetti... | Creates a full fledged settings object into target with both ajaxSettings and settings fields. If target is omitted, writes into ajaxSettings. | [
"Creates",
"a",
"full",
"fledged",
"settings",
"object",
"into",
"target",
"with",
"both",
"ajaxSettings",
"and",
"settings",
"fields",
".",
"If",
"target",
"is",
"omitted",
"writes",
"into",
"ajaxSettings",
"."
] | 126626c08640e9ae386fea4e34b6b10482c5dbd6 | https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L859-L867 |
51,937 | nickeljew/unjq-ajax | lib/ajax.js | abort | function abort(statusText) {
var finalText = statusText || strAbort;
if (transport) {
transport.abort(finalText);
}
done(0, finalText);
return this;
} | javascript | function abort(statusText) {
var finalText = statusText || strAbort;
if (transport) {
transport.abort(finalText);
}
done(0, finalText);
return this;
} | [
"function",
"abort",
"(",
"statusText",
")",
"{",
"var",
"finalText",
"=",
"statusText",
"||",
"strAbort",
";",
"if",
"(",
"transport",
")",
"{",
"transport",
".",
"abort",
"(",
"finalText",
")",
";",
"}",
"done",
"(",
"0",
",",
"finalText",
")",
";",
... | Cancel the request | [
"Cancel",
"the",
"request"
] | 126626c08640e9ae386fea4e34b6b10482c5dbd6 | https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L997-L1004 |
51,938 | ENOW-IJI/ENOW-console | dist/src/anchors.js | function (endpoint, anchorPos) {
continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ];
continuousAnchorOrientations[endpoint.id] = orientation;
} | javascript | function (endpoint, anchorPos) {
continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ];
continuousAnchorOrientations[endpoint.id] = orientation;
} | [
"function",
"(",
"endpoint",
",",
"anchorPos",
")",
"{",
"continuousAnchorLocations",
"[",
"endpoint",
".",
"id",
"]",
"=",
"[",
"anchorPos",
"[",
"0",
"]",
",",
"anchorPos",
"[",
"1",
"]",
",",
"anchorPos",
"[",
"2",
"]",
",",
"anchorPos",
"[",
"3",
... | takes a computed anchor position and adjusts it for parent offset and scroll, then stores it. | [
"takes",
"a",
"computed",
"anchor",
"position",
"and",
"adjusts",
"it",
"for",
"parent",
"offset",
"and",
"scroll",
"then",
"stores",
"it",
"."
] | f241ed4e645a7da0cd1a6ca86e896a5b73be53e5 | https://github.com/ENOW-IJI/ENOW-console/blob/f241ed4e645a7da0cd1a6ca86e896a5b73be53e5/dist/src/anchors.js#L172-L175 | |
51,939 | vkiding/jud-previewer | build/libs/server.js | sendSocketMessage | function sendSocketMessage(message) {
clients.forEach(function (client) {
if (client.readyState === WebSocket.OPEN) {
client.send(message || 'refresh', function (err) {
if (err) {
npmlog.error(err);
}
});
}
});
} | javascript | function sendSocketMessage(message) {
clients.forEach(function (client) {
if (client.readyState === WebSocket.OPEN) {
client.send(message || 'refresh', function (err) {
if (err) {
npmlog.error(err);
}
});
}
});
} | [
"function",
"sendSocketMessage",
"(",
"message",
")",
"{",
"clients",
".",
"forEach",
"(",
"function",
"(",
"client",
")",
"{",
"if",
"(",
"client",
".",
"readyState",
"===",
"WebSocket",
".",
"OPEN",
")",
"{",
"client",
".",
"send",
"(",
"message",
"||"... | send web socket messsage to client | [
"send",
"web",
"socket",
"messsage",
"to",
"client"
] | 795e2b649f840e9515858332023d5238640730da | https://github.com/vkiding/jud-previewer/blob/795e2b649f840e9515858332023d5238640730da/build/libs/server.js#L100-L110 |
51,940 | tolokoban/ToloFrameWork | ker/mod/tfw.binding.property-manager.js | getProperties | function getProperties( property ) {
var properties = property[ PROPERTY_SYMBOL ];
if ( !Array.isArray( properties ) ) return null;
return properties;
} | javascript | function getProperties( property ) {
var properties = property[ PROPERTY_SYMBOL ];
if ( !Array.isArray( properties ) ) return null;
return properties;
} | [
"function",
"getProperties",
"(",
"property",
")",
"{",
"var",
"properties",
"=",
"property",
"[",
"PROPERTY_SYMBOL",
"]",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"properties",
")",
")",
"return",
"null",
";",
"return",
"properties",
";",
"}"
] | Return the linkable properties which holds this value, or `null`. | [
"Return",
"the",
"linkable",
"properties",
"which",
"holds",
"this",
"value",
"or",
"null",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L219-L223 |
51,941 | tolokoban/ToloFrameWork | ker/mod/tfw.binding.property-manager.js | applyAttributesToTarget | function applyAttributesToTarget( source, target ) {
var attName, attValue;
for ( attName in source ) {
if ( module.exports.isLinkable( target, attName ) ) {
attValue = source[ attName ];
target[ attName ] = attValue;
}
}
} | javascript | function applyAttributesToTarget( source, target ) {
var attName, attValue;
for ( attName in source ) {
if ( module.exports.isLinkable( target, attName ) ) {
attValue = source[ attName ];
target[ attName ] = attValue;
}
}
} | [
"function",
"applyAttributesToTarget",
"(",
"source",
",",
"target",
")",
"{",
"var",
"attName",
",",
"attValue",
";",
"for",
"(",
"attName",
"in",
"source",
")",
"{",
"if",
"(",
"module",
".",
"exports",
".",
"isLinkable",
"(",
"target",
",",
"attName",
... | Copy all the attributes of `source` into `target`. | [
"Copy",
"all",
"the",
"attributes",
"of",
"source",
"into",
"target",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L249-L257 |
51,942 | tolokoban/ToloFrameWork | ker/mod/tfw.binding.property-manager.js | addPropToValue | function addPropToValue( prop, value ) {
if ( value === undefined || value === null ) return;
if ( value.isContentChangeAware !== true ) return;
var properties = value[ PROPERTY_SYMBOL ];
if ( !Array.isArray( properties ) ) {
properties = [ prop ];
} else if ( properties.indexOf( prop ) === ... | javascript | function addPropToValue( prop, value ) {
if ( value === undefined || value === null ) return;
if ( value.isContentChangeAware !== true ) return;
var properties = value[ PROPERTY_SYMBOL ];
if ( !Array.isArray( properties ) ) {
properties = [ prop ];
} else if ( properties.indexOf( prop ) === ... | [
"function",
"addPropToValue",
"(",
"prop",
",",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
"||",
"value",
"===",
"null",
")",
"return",
";",
"if",
"(",
"value",
".",
"isContentChangeAware",
"!==",
"true",
")",
"return",
";",
"var",
"prope... | Add an `info` attribute to the property's value. This is useful to
find the container and the property name from the value. | [
"Add",
"an",
"info",
"attribute",
"to",
"the",
"property",
"s",
"value",
".",
"This",
"is",
"useful",
"to",
"find",
"the",
"container",
"and",
"the",
"property",
"name",
"from",
"the",
"value",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L336-L346 |
51,943 | tolokoban/ToloFrameWork | ker/mod/tfw.binding.property-manager.js | readonly | function readonly( target, attribs ) {
const attribNames = Object.keys( attribs );
attribNames.forEach( function ( attName ) {
const attValue = attribs[ attName ];
if ( typeof attValue === 'function' ) {
Object.defineProperty(
target,
attName, {
... | javascript | function readonly( target, attribs ) {
const attribNames = Object.keys( attribs );
attribNames.forEach( function ( attName ) {
const attValue = attribs[ attName ];
if ( typeof attValue === 'function' ) {
Object.defineProperty(
target,
attName, {
... | [
"function",
"readonly",
"(",
"target",
",",
"attribs",
")",
"{",
"const",
"attribNames",
"=",
"Object",
".",
"keys",
"(",
"attribs",
")",
";",
"attribNames",
".",
"forEach",
"(",
"function",
"(",
"attName",
")",
"{",
"const",
"attValue",
"=",
"attribs",
... | Create a readonly attribute.
@param {object} target - Object which will bear the readonly attribute.
@param {object} attribs - Attributes with their values.
@returns {undefined} | [
"Create",
"a",
"readonly",
"attribute",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L425-L453 |
51,944 | vkiding/judpack-common | src/FileUpdater.js | updatePathInternal | function updatePathInternal(sourcePath, targetPath, options, log) {
var rootDir = (options && options.rootDir) || "";
var targetFullPath = path.join(rootDir, targetPath);
var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
var sourceStats = null;
if (sourcePath) {
... | javascript | function updatePathInternal(sourcePath, targetPath, options, log) {
var rootDir = (options && options.rootDir) || "";
var targetFullPath = path.join(rootDir, targetPath);
var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
var sourceStats = null;
if (sourcePath) {
... | [
"function",
"updatePathInternal",
"(",
"sourcePath",
",",
"targetPath",
",",
"options",
",",
"log",
")",
"{",
"var",
"rootDir",
"=",
"(",
"options",
"&&",
"options",
".",
"rootDir",
")",
"||",
"\"\"",
";",
"var",
"targetFullPath",
"=",
"path",
".",
"join",... | Helper for updatePath and updatePaths functions. Queries stats for source and target
and ensures target directory exists before copying a file. | [
"Helper",
"for",
"updatePath",
"and",
"updatePaths",
"functions",
".",
"Queries",
"stats",
"for",
"source",
"and",
"target",
"and",
"ensures",
"target",
"directory",
"exists",
"before",
"copying",
"a",
"file",
"."
] | 5b87d3f1cb10c2c867243e3a692d39b4bb189dd4 | https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L135-L158 |
51,945 | vkiding/judpack-common | src/FileUpdater.js | updatePaths | function updatePaths(pathMap, options, log) {
if (!pathMap || typeof pathMap !== "object" || Array.isArray(pathMap)) {
throw new Error("An object mapping from target paths to source paths is required.");
}
log = log || function(message) { };
var updated = false;
// Iterate in sorted order... | javascript | function updatePaths(pathMap, options, log) {
if (!pathMap || typeof pathMap !== "object" || Array.isArray(pathMap)) {
throw new Error("An object mapping from target paths to source paths is required.");
}
log = log || function(message) { };
var updated = false;
// Iterate in sorted order... | [
"function",
"updatePaths",
"(",
"pathMap",
",",
"options",
",",
"log",
")",
"{",
"if",
"(",
"!",
"pathMap",
"||",
"typeof",
"pathMap",
"!==",
"\"object\"",
"||",
"Array",
".",
"isArray",
"(",
"pathMap",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"A... | Updates files and directories based on a mapping from target paths to source paths. Targets
with null sources in the map are deleted.
@param {Object} pathMap A dictionary mapping from target paths to source paths.
@param {Object} [options] Optional additional parameters for the update.
@param {string} [options.rootDir... | [
"Updates",
"files",
"and",
"directories",
"based",
"on",
"a",
"mapping",
"from",
"target",
"paths",
"to",
"source",
"paths",
".",
"Targets",
"with",
"null",
"sources",
"in",
"the",
"map",
"are",
"deleted",
"."
] | 5b87d3f1cb10c2c867243e3a692d39b4bb189dd4 | https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L211-L227 |
51,946 | vkiding/judpack-common | src/FileUpdater.js | mergeAndUpdateDir | function mergeAndUpdateDir(sourceDirs, targetDir, options, log) {
if (sourceDirs && typeof sourceDirs === "string") {
sourceDirs = [ sourceDirs ];
} else if (!Array.isArray(sourceDirs)) {
throw new Error("A source directory path or array of paths is required.");
}
if (!targetDir || type... | javascript | function mergeAndUpdateDir(sourceDirs, targetDir, options, log) {
if (sourceDirs && typeof sourceDirs === "string") {
sourceDirs = [ sourceDirs ];
} else if (!Array.isArray(sourceDirs)) {
throw new Error("A source directory path or array of paths is required.");
}
if (!targetDir || type... | [
"function",
"mergeAndUpdateDir",
"(",
"sourceDirs",
",",
"targetDir",
",",
"options",
",",
"log",
")",
"{",
"if",
"(",
"sourceDirs",
"&&",
"typeof",
"sourceDirs",
"===",
"\"string\"",
")",
"{",
"sourceDirs",
"=",
"[",
"sourceDirs",
"]",
";",
"}",
"else",
"... | Updates a target directory with merged files and subdirectories from source directories.
@param {string|string[]} sourceDirs Required source directory or array of source directories
to be merged into the target. The directories are listed in order of precedence; files in
directories later in the array supersede files ... | [
"Updates",
"a",
"target",
"directory",
"with",
"merged",
"files",
"and",
"subdirectories",
"from",
"source",
"directories",
"."
] | 5b87d3f1cb10c2c867243e3a692d39b4bb189dd4 | https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L258-L321 |
51,947 | vkiding/judpack-common | src/FileUpdater.js | mapDirectory | function mapDirectory(rootDir, subDir, include, exclude) {
var dirMap = { "": { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
mapSubdirectory(rootDir, subDir, "", include, exclude, dirMap);
return dirMap;
function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dir... | javascript | function mapDirectory(rootDir, subDir, include, exclude) {
var dirMap = { "": { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
mapSubdirectory(rootDir, subDir, "", include, exclude, dirMap);
return dirMap;
function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dir... | [
"function",
"mapDirectory",
"(",
"rootDir",
",",
"subDir",
",",
"include",
",",
"exclude",
")",
"{",
"var",
"dirMap",
"=",
"{",
"\"\"",
":",
"{",
"subDir",
":",
"subDir",
",",
"stats",
":",
"fs",
".",
"statSync",
"(",
"path",
".",
"join",
"(",
"rootD... | Creates a dictionary map of all files and directories under a path. | [
"Creates",
"a",
"dictionary",
"map",
"of",
"all",
"files",
"and",
"directories",
"under",
"a",
"path",
"."
] | 5b87d3f1cb10c2c867243e3a692d39b4bb189dd4 | https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L326-L369 |
51,948 | vkiding/judpack-common | src/FileUpdater.js | mergePathMaps | function mergePathMaps(sourceMaps, targetMap, targetDir) {
// Merge multiple source maps together, along with target path info.
// Entries in later source maps override those in earlier source maps.
// Target stats will be filled in below for targets that exist.
var pathMap = {};
sourceMaps.forEach(... | javascript | function mergePathMaps(sourceMaps, targetMap, targetDir) {
// Merge multiple source maps together, along with target path info.
// Entries in later source maps override those in earlier source maps.
// Target stats will be filled in below for targets that exist.
var pathMap = {};
sourceMaps.forEach(... | [
"function",
"mergePathMaps",
"(",
"sourceMaps",
",",
"targetMap",
",",
"targetDir",
")",
"{",
"// Merge multiple source maps together, along with target path info.",
"// Entries in later source maps override those in earlier source maps.",
"// Target stats will be filled in below for targets... | Merges together multiple source maps and a target map into a single mapping from
relative paths to objects with target and source paths and stats. | [
"Merges",
"together",
"multiple",
"source",
"maps",
"and",
"a",
"target",
"map",
"into",
"a",
"single",
"mapping",
"from",
"relative",
"paths",
"to",
"objects",
"with",
"target",
"and",
"source",
"paths",
"and",
"stats",
"."
] | 5b87d3f1cb10c2c867243e3a692d39b4bb189dd4 | https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L375-L409 |
51,949 | nivesh2/dotenv-minimal | index.js | readFromEnvFile | function readFromEnvFile() {
try {
// .env file should be in root directory
const data = require('fs').readFileSync(require('path').join(__dirname, '../../.env'), 'utf8')
const env = {}
data.split('\n').filter((v) => {
return v !== ''
}).filter((v) => {
return v.indexOf('#') === -1
... | javascript | function readFromEnvFile() {
try {
// .env file should be in root directory
const data = require('fs').readFileSync(require('path').join(__dirname, '../../.env'), 'utf8')
const env = {}
data.split('\n').filter((v) => {
return v !== ''
}).filter((v) => {
return v.indexOf('#') === -1
... | [
"function",
"readFromEnvFile",
"(",
")",
"{",
"try",
"{",
"// .env file should be in root directory",
"const",
"data",
"=",
"require",
"(",
"'fs'",
")",
".",
"readFileSync",
"(",
"require",
"(",
"'path'",
")",
".",
"join",
"(",
"__dirname",
",",
"'../../.env'",
... | Loads environment variables from .env file
check for the missing environment variables at start
throw exception if .env file doesnot exist
@returns env | [
"Loads",
"environment",
"variables",
"from",
".",
"env",
"file",
"check",
"for",
"the",
"missing",
"environment",
"variables",
"at",
"start",
"throw",
"exception",
"if",
".",
"env",
"file",
"doesnot",
"exist"
] | d93f09a579cd890edb9c37881f6fec6de18c023f | https://github.com/nivesh2/dotenv-minimal/blob/d93f09a579cd890edb9c37881f6fec6de18c023f/index.js#L7-L31 |
51,950 | nivesh2/dotenv-minimal | index.js | splitMultipleValues | function splitMultipleValues(envObject) {
try {
const data = Object.keys(envObject)
return data.reduce((p, v) => {
p[v] = envObject[v]
if (envObject[v].indexOf(',') !== -1) {
p[v] = envObject[v].split(',')
}
return p
}, {})
} catch (err) {
throw err
}
} | javascript | function splitMultipleValues(envObject) {
try {
const data = Object.keys(envObject)
return data.reduce((p, v) => {
p[v] = envObject[v]
if (envObject[v].indexOf(',') !== -1) {
p[v] = envObject[v].split(',')
}
return p
}, {})
} catch (err) {
throw err
}
} | [
"function",
"splitMultipleValues",
"(",
"envObject",
")",
"{",
"try",
"{",
"const",
"data",
"=",
"Object",
".",
"keys",
"(",
"envObject",
")",
"return",
"data",
".",
"reduce",
"(",
"(",
"p",
",",
"v",
")",
"=>",
"{",
"p",
"[",
"v",
"]",
"=",
"envOb... | it only supports spilitting using comma | [
"it",
"only",
"supports",
"spilitting",
"using",
"comma"
] | d93f09a579cd890edb9c37881f6fec6de18c023f | https://github.com/nivesh2/dotenv-minimal/blob/d93f09a579cd890edb9c37881f6fec6de18c023f/index.js#L34-L47 |
51,951 | Digznav/bilberry | promise-read-file.js | promiseReadFile | function promiseReadFile(path, encoding = 'utf-8') {
return new Promise((resolve, reject) => {
fs.readFile(path, encoding, (err, content) => {
if (err) reject(err);
resolve({
path,
fileName: path.split('/').pop(),
content
});
});
});
} | javascript | function promiseReadFile(path, encoding = 'utf-8') {
return new Promise((resolve, reject) => {
fs.readFile(path, encoding, (err, content) => {
if (err) reject(err);
resolve({
path,
fileName: path.split('/').pop(),
content
});
});
});
} | [
"function",
"promiseReadFile",
"(",
"path",
",",
"encoding",
"=",
"'utf-8'",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fs",
".",
"readFile",
"(",
"path",
",",
"encoding",
",",
"(",
"err",
",",
"content",... | Get the content of a single file.
@param {string} path Path to file.
@param {string} encoding Encoding.
@return {promise} Promise to get the content. | [
"Get",
"the",
"content",
"of",
"a",
"single",
"file",
"."
] | ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4 | https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/promise-read-file.js#L9-L21 |
51,952 | woyorus/syncsocket-client | src/connection.js | Connection | function Connection(uri) {
this.channels = {};
let version = require('../package.json').version;
let opts = {
query: 'instanceId=' + 'js_cli_' + version,
'sync disconnect on unload': true,
path: '/syncsocket'
};
this.socket = io.connect(uri, opts);
this.bindEvents();
} | javascript | function Connection(uri) {
this.channels = {};
let version = require('../package.json').version;
let opts = {
query: 'instanceId=' + 'js_cli_' + version,
'sync disconnect on unload': true,
path: '/syncsocket'
};
this.socket = io.connect(uri, opts);
this.bindEvents();
} | [
"function",
"Connection",
"(",
"uri",
")",
"{",
"this",
".",
"channels",
"=",
"{",
"}",
";",
"let",
"version",
"=",
"require",
"(",
"'../package.json'",
")",
".",
"version",
";",
"let",
"opts",
"=",
"{",
"query",
":",
"'instanceId='",
"+",
"'js_cli_'",
... | Creates new `Connection` object
@param uri URI of SyncSocket server (e.g. http://localhost:5579)
@constructor
@public | [
"Creates",
"new",
"Connection",
"object"
] | 3bd023ce3611afd0e19a8234ce9731413bcfc890 | https://github.com/woyorus/syncsocket-client/blob/3bd023ce3611afd0e19a8234ce9731413bcfc890/src/connection.js#L17-L27 |
51,953 | insistime/qiao.util.file | lib/qiao.util.file.js | getFoldersAndFiles | function getFoldersAndFiles(fpath, folders, files){
fs.readdirSync(fpath).forEach(function(name){
var stat = fs.statSync(fpath + name);
if(stat.isDirectory()){
folders.push({
path : fpath,
name : name
});
getFoldersAndFiles(fpath + name + '/', folders, files);
}else{
files.push... | javascript | function getFoldersAndFiles(fpath, folders, files){
fs.readdirSync(fpath).forEach(function(name){
var stat = fs.statSync(fpath + name);
if(stat.isDirectory()){
folders.push({
path : fpath,
name : name
});
getFoldersAndFiles(fpath + name + '/', folders, files);
}else{
files.push... | [
"function",
"getFoldersAndFiles",
"(",
"fpath",
",",
"folders",
",",
"files",
")",
"{",
"fs",
".",
"readdirSync",
"(",
"fpath",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"var",
"stat",
"=",
"fs",
".",
"statSync",
"(",
"fpath",
"+",
... | get folders and files | [
"get",
"folders",
"and",
"files"
] | b359226cfcbb8db9a07153f27c5303b00d01640f | https://github.com/insistime/qiao.util.file/blob/b359226cfcbb8db9a07153f27c5303b00d01640f/lib/qiao.util.file.js#L109-L126 |
51,954 | redisjs/jsr-resp | lib/decoder.js | Decoder | function Decoder(options) {
options = options || {};
Transform.call(this, {});
this._reset();
// maximum length for bulk strings (512MB)
this.maxlen = options.maxlen || 536870912;
// create String instances for simple string replies
this.simple = options.simple !== undefined ? options.simple : false;
... | javascript | function Decoder(options) {
options = options || {};
Transform.call(this, {});
this._reset();
// maximum length for bulk strings (512MB)
this.maxlen = options.maxlen || 536870912;
// create String instances for simple string replies
this.simple = options.simple !== undefined ? options.simple : false;
... | [
"function",
"Decoder",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"Transform",
".",
"call",
"(",
"this",
",",
"{",
"}",
")",
";",
"this",
".",
"_reset",
"(",
")",
";",
"// maximum length for bulk strings (512MB)",
"this",
"... | Class for decoding RESP messages to javascript types.
Emits an error event when an exception occurs. | [
"Class",
"for",
"decoding",
"RESP",
"messages",
"to",
"javascript",
"types",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L23-L46 |
51,955 | redisjs/jsr-resp | lib/decoder.js | _type | function _type(chunk, test) {
var b = chunk[0];
if(b === ERR || b === BST || b === STR || b === INT || b === ARR) {
if(!test) this._offset++;
return b;
}
} | javascript | function _type(chunk, test) {
var b = chunk[0];
if(b === ERR || b === BST || b === STR || b === INT || b === ARR) {
if(!test) this._offset++;
return b;
}
} | [
"function",
"_type",
"(",
"chunk",
",",
"test",
")",
"{",
"var",
"b",
"=",
"chunk",
"[",
"0",
"]",
";",
"if",
"(",
"b",
"===",
"ERR",
"||",
"b",
"===",
"BST",
"||",
"b",
"===",
"STR",
"||",
"b",
"===",
"INT",
"||",
"b",
"===",
"ARR",
")",
"... | Swallow type identifier. | [
"Swallow",
"type",
"identifier",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L135-L141 |
51,956 | redisjs/jsr-resp | lib/decoder.js | _arr | function _arr(chunk, type) {
var len = this._int(chunk, type);
// allow zero length for the empty array
if(typeof len === 'number' && !isNaN(len)) {
var arr = new Array(len);
this._elements += len;
Object.defineProperty(arr, '_index',
{
enumerable: false,
configurable: true,
... | javascript | function _arr(chunk, type) {
var len = this._int(chunk, type);
// allow zero length for the empty array
if(typeof len === 'number' && !isNaN(len)) {
var arr = new Array(len);
this._elements += len;
Object.defineProperty(arr, '_index',
{
enumerable: false,
configurable: true,
... | [
"function",
"_arr",
"(",
"chunk",
",",
"type",
")",
"{",
"var",
"len",
"=",
"this",
".",
"_int",
"(",
"chunk",
",",
"type",
")",
";",
"// allow zero length for the empty array",
"if",
"(",
"typeof",
"len",
"===",
"'number'",
"&&",
"!",
"isNaN",
"(",
"len... | Read an array. | [
"Read",
"an",
"array",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L286-L304 |
51,957 | redisjs/jsr-resp | lib/decoder.js | _int | function _int(chunk, type) {
var b, s = '', i;
while(this._offset < chunk.length) {
b = chunk[this._offset];
if(b === CR && chunk[this._offset + 1] === LF) {
this._offset += 2;
i = parseInt(s);
if(type === BST) {
if(isNaN(i)) {
return this._abort(new Error('bad string len... | javascript | function _int(chunk, type) {
var b, s = '', i;
while(this._offset < chunk.length) {
b = chunk[this._offset];
if(b === CR && chunk[this._offset + 1] === LF) {
this._offset += 2;
i = parseInt(s);
if(type === BST) {
if(isNaN(i)) {
return this._abort(new Error('bad string len... | [
"function",
"_int",
"(",
"chunk",
",",
"type",
")",
"{",
"var",
"b",
",",
"s",
"=",
"''",
",",
"i",
";",
"while",
"(",
"this",
".",
"_offset",
"<",
"chunk",
".",
"length",
")",
"{",
"b",
"=",
"chunk",
"[",
"this",
".",
"_offset",
"]",
";",
"i... | Read an integer. | [
"Read",
"an",
"integer",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L325-L344 |
51,958 | redisjs/jsr-resp | lib/decoder.js | _bst | function _bst(chunk, type) {
// we should have already read the chunk
var len = this._int(chunk, type), buf;
if(!isNaN(len)) {
// read an integer less than zero, treat as null
if(len < 0) return null;
// read in the entire bulk string and swallow the crlf
if((chunk.length - this._offset) >= len + ... | javascript | function _bst(chunk, type) {
// we should have already read the chunk
var len = this._int(chunk, type), buf;
if(!isNaN(len)) {
// read an integer less than zero, treat as null
if(len < 0) return null;
// read in the entire bulk string and swallow the crlf
if((chunk.length - this._offset) >= len + ... | [
"function",
"_bst",
"(",
"chunk",
",",
"type",
")",
"{",
"// we should have already read the chunk",
"var",
"len",
"=",
"this",
".",
"_int",
"(",
"chunk",
",",
"type",
")",
",",
"buf",
";",
"if",
"(",
"!",
"isNaN",
"(",
"len",
")",
")",
"{",
"// read a... | Read a bulk string. | [
"Read",
"a",
"bulk",
"string",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L350-L367 |
51,959 | chatphrase/caress | lib/routes/uuidGet.js | noNew | function noNew() {
return finish(function(err) {
if (err) return next(err);
// If there was a body initially, respond that there's been no change
if (ourEtag) return res.send(304);
// Otherwise, respond that there's no content (yet)
else return res.send(204);
});
... | javascript | function noNew() {
return finish(function(err) {
if (err) return next(err);
// If there was a body initially, respond that there's been no change
if (ourEtag) return res.send(304);
// Otherwise, respond that there's no content (yet)
else return res.send(204);
});
... | [
"function",
"noNew",
"(",
")",
"{",
"return",
"finish",
"(",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"return",
"next",
"(",
"err",
")",
";",
"// If there was a body initially, respond that there's been no change",
"if",
"(",
"ourEtag",
")",
"r... | Callback for if there's no new body by the time we're supposed to respond. | [
"Callback",
"for",
"if",
"there",
"s",
"no",
"new",
"body",
"by",
"the",
"time",
"we",
"re",
"supposed",
"to",
"respond",
"."
] | 1634c127e90c8140baf5e2803a2938ffaf0414c4 | https://github.com/chatphrase/caress/blob/1634c127e90c8140baf5e2803a2938ffaf0414c4/lib/routes/uuidGet.js#L47-L57 |
51,960 | chatphrase/caress | lib/routes/uuidGet.js | getNew | function getNew(body) {
// If we haven't already cleared the callback (we got the body, then the
// message on the subscriber)
if (timer) {
// If the new body is present (say, if it wasn't deleted)
if (body) {
// Calculate the new Etag
ourEtag = '"' + sha1hex(body) ... | javascript | function getNew(body) {
// If we haven't already cleared the callback (we got the body, then the
// message on the subscriber)
if (timer) {
// If the new body is present (say, if it wasn't deleted)
if (body) {
// Calculate the new Etag
ourEtag = '"' + sha1hex(body) ... | [
"function",
"getNew",
"(",
"body",
")",
"{",
"// If we haven't already cleared the callback (we got the body, then the",
"// message on the subscriber)",
"if",
"(",
"timer",
")",
"{",
"// If the new body is present (say, if it wasn't deleted)",
"if",
"(",
"body",
")",
"{",
"// ... | Callback for when we get a mesage that there's a new body. | [
"Callback",
"for",
"when",
"we",
"get",
"a",
"mesage",
"that",
"there",
"s",
"a",
"new",
"body",
"."
] | 1634c127e90c8140baf5e2803a2938ffaf0414c4 | https://github.com/chatphrase/caress/blob/1634c127e90c8140baf5e2803a2938ffaf0414c4/lib/routes/uuidGet.js#L76-L97 |
51,961 | hex7c0/setheaders | index.js | setOverrideHeader | function setOverrideHeader(res, name, value) {
if (res._headers && res._headers[name] !== undefined) {
return true;
}
res.setHeader(name, value);
return true;
} | javascript | function setOverrideHeader(res, name, value) {
if (res._headers && res._headers[name] !== undefined) {
return true;
}
res.setHeader(name, value);
return true;
} | [
"function",
"setOverrideHeader",
"(",
"res",
",",
"name",
",",
"value",
")",
"{",
"if",
"(",
"res",
".",
"_headers",
"&&",
"res",
".",
"_headers",
"[",
"name",
"]",
"!==",
"undefined",
")",
"{",
"return",
"true",
";",
"}",
"res",
".",
"setHeader",
"(... | set override header on response
@function setOverrideHeader
@param {Object} res - response to client
@param {String} name - header's name
@param {String} value - header's value
@return {Boolean} | [
"set",
"override",
"header",
"on",
"response"
] | e2d92bc8f03ec1938036e15ffc2a01b286137f9e | https://github.com/hex7c0/setheaders/blob/e2d92bc8f03ec1938036e15ffc2a01b286137f9e/index.js#L118-L126 |
51,962 | hex7c0/setheaders | index.js | setWritableHeader | function setWritableHeader(res, name, value) {
if (res._headerSent && res.finished) {
return false;
}
res.setHeader(name, value);
return true;
} | javascript | function setWritableHeader(res, name, value) {
if (res._headerSent && res.finished) {
return false;
}
res.setHeader(name, value);
return true;
} | [
"function",
"setWritableHeader",
"(",
"res",
",",
"name",
",",
"value",
")",
"{",
"if",
"(",
"res",
".",
"_headerSent",
"&&",
"res",
".",
"finished",
")",
"{",
"return",
"false",
";",
"}",
"res",
".",
"setHeader",
"(",
"name",
",",
"value",
")",
";",... | set writable header on response
@function setWritableHeader
@param {Object} res - response to client
@param {String} name - header's name
@param {String} value - header's value
@return {Boolean} | [
"set",
"writable",
"header",
"on",
"response"
] | e2d92bc8f03ec1938036e15ffc2a01b286137f9e | https://github.com/hex7c0/setheaders/blob/e2d92bc8f03ec1938036e15ffc2a01b286137f9e/index.js#L138-L146 |
51,963 | repetere/component.collection-linotype | lib/linotype.js | function (options) {
/** call event emitter */
events.EventEmitter.call(this);
/** module default configuration */
var defaults = {
idSelector: 'linotype',
start: 0,
currentSection: 0,
delay: 300,
easingdelay: 700,
easing: false,
isMoving: false,
keyboardScrolling: true,
touchevents: true,
mous... | javascript | function (options) {
/** call event emitter */
events.EventEmitter.call(this);
/** module default configuration */
var defaults = {
idSelector: 'linotype',
start: 0,
currentSection: 0,
delay: 300,
easingdelay: 700,
easing: false,
isMoving: false,
keyboardScrolling: true,
touchevents: true,
mous... | [
"function",
"(",
"options",
")",
"{",
"/** call event emitter */",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"/** module default configuration */",
"var",
"defaults",
"=",
"{",
"idSelector",
":",
"'linotype'",
",",
"start",
":",
"0",
","... | A module that represents a Linotype object, a Linotyper is a page composition tool.
@{@link https://github.com/typesettin/linotype}
@author Yaw Joseph Etse
@copyright Copyright (c) 2014 Typesettin. All rights reserved.
@license MIT
@constructor Linotype
@requires module:classie
@requires module:util-extent
@requires mo... | [
"A",
"module",
"that",
"represents",
"a",
"Linotype",
"object",
"a",
"Linotyper",
"is",
"a",
"page",
"composition",
"tool",
"."
] | c3ddbd4a10ee58171602ec0747bac60064c15403 | https://github.com/repetere/component.collection-linotype/blob/c3ddbd4a10ee58171602ec0747bac60064c15403/lib/linotype.js#L34-L64 | |
51,964 | repetere/component.collection-linotype | lib/linotype.js | function (e) {
var touchEvents = getEventsPage(e);
touchStartY = touchEvents.y;
touchStartX = touchEvents.x;
if (e.touches) {
touchMoveStartY = e.touches[0].screenY;
touchMoveStartX = e.touches[0].screenX;
}
} | javascript | function (e) {
var touchEvents = getEventsPage(e);
touchStartY = touchEvents.y;
touchStartX = touchEvents.x;
if (e.touches) {
touchMoveStartY = e.touches[0].screenY;
touchMoveStartX = e.touches[0].screenX;
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"touchEvents",
"=",
"getEventsPage",
"(",
"e",
")",
";",
"touchStartY",
"=",
"touchEvents",
".",
"y",
";",
"touchStartX",
"=",
"touchEvents",
".",
"x",
";",
"if",
"(",
"e",
".",
"touches",
")",
"{",
"touchMoveStar... | handle touch start events
@event touchStartHandler
@param {object} e touch event object | [
"handle",
"touch",
"start",
"events"
] | c3ddbd4a10ee58171602ec0747bac60064c15403 | https://github.com/repetere/component.collection-linotype/blob/c3ddbd4a10ee58171602ec0747bac60064c15403/lib/linotype.js#L184-L192 | |
51,965 | robotlolita/specify-reporter-tap | index.js | describeFailure | function describeFailure(ex) {
return ex.stack? [' ---'
,' type: ' + ex.name
,' message: >'
, pad(6, ex.message)
,' stack: | '
, pad(6, ex.stack)
... | javascript | function describeFailure(ex) {
return ex.stack? [' ---'
,' type: ' + ex.name
,' message: >'
, pad(6, ex.message)
,' stack: | '
, pad(6, ex.stack)
... | [
"function",
"describeFailure",
"(",
"ex",
")",
"{",
"return",
"ex",
".",
"stack",
"?",
"[",
"' ---'",
",",
"' type: '",
"+",
"ex",
".",
"name",
",",
"' message: >'",
",",
"pad",
"(",
"6",
",",
"ex",
".",
"message",
")",
",",
"' stack: | '",
"... | Returns a YAML serialisation of an exception.
@summary Error → String | [
"Returns",
"a",
"YAML",
"serialisation",
"of",
"an",
"exception",
"."
] | 809a4cf783907c58873e2a329c7e40a9ee25e5e1 | https://github.com/robotlolita/specify-reporter-tap/blob/809a4cf783907c58873e2a329c7e40a9ee25e5e1/index.js#L32-L46 |
51,966 | Nazariglez/perenquen | lib/pixi/src/filters/twist/TwistFilter.js | TwistFilter | function TwistFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/twist.frag', 'utf8'),
// custom uniforms
{
radius: { type: '1f', value: 0.5 },
angle: { type: '1f', value: ... | javascript | function TwistFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/twist.frag', 'utf8'),
// custom uniforms
{
radius: { type: '1f', value: 0.5 },
angle: { type: '1f', value: ... | [
"function",
"TwistFilter",
"(",
")",
"{",
"core",
".",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"// vertex shader",
"null",
",",
"// fragment shader",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/twist.frag'",
",",
"'utf8'",
")",
",",
"// custo... | This filter applies a twist effect making display objects appear twisted in the given direction.
@class
@extends AbstractFilter
@memberof PIXI.filters | [
"This",
"filter",
"applies",
"a",
"twist",
"effect",
"making",
"display",
"objects",
"appear",
"twisted",
"in",
"the",
"given",
"direction",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/twist/TwistFilter.js#L12-L26 |
51,967 | inviqa/deck-task-registry | src/scripts/lintScripts.js | lintScripts | function lintScripts(conf, undertaker) {
const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.js');
// Lint theme scripts with ESLint. This won't touch any TypeScript files.
return undertaker.src(jsSrc)
.pipe(eslint())
.pipe(eslint.format())
.pipe(gulpIf(conf.productionMo... | javascript | function lintScripts(conf, undertaker) {
const jsSrc = path.join(conf.themeConfig.root, conf.themeConfig.js.src, '**', '*.js');
// Lint theme scripts with ESLint. This won't touch any TypeScript files.
return undertaker.src(jsSrc)
.pipe(eslint())
.pipe(eslint.format())
.pipe(gulpIf(conf.productionMo... | [
"function",
"lintScripts",
"(",
"conf",
",",
"undertaker",
")",
"{",
"const",
"jsSrc",
"=",
"path",
".",
"join",
"(",
"conf",
".",
"themeConfig",
".",
"root",
",",
"conf",
".",
"themeConfig",
".",
"js",
".",
"src",
",",
"'**'",
",",
"'*.js'",
")",
";... | Lint project scripts.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Lint",
"project",
"scripts",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/scripts/lintScripts.js#L15-L25 |
51,968 | grownseed/haibu-ishiki | lib/ishiki.js | switchState | function switchState(started, pkg) {
pkg.started = started;
//add available port back into port range
if (!started && pkg.env && pkg.env.PORT)
ports.push(pkg.env.PORT);
console.log((started ? 'Started' : 'Stopped') + ' application ' + pkg.user + '/' + pkg.name);
logInfo('info', 'Application... | javascript | function switchState(started, pkg) {
pkg.started = started;
//add available port back into port range
if (!started && pkg.env && pkg.env.PORT)
ports.push(pkg.env.PORT);
console.log((started ? 'Started' : 'Stopped') + ' application ' + pkg.user + '/' + pkg.name);
logInfo('info', 'Application... | [
"function",
"switchState",
"(",
"started",
",",
"pkg",
")",
"{",
"pkg",
".",
"started",
"=",
"started",
";",
"//add available port back into port range",
"if",
"(",
"!",
"started",
"&&",
"pkg",
".",
"env",
"&&",
"pkg",
".",
"env",
".",
"PORT",
")",
"ports"... | update drone state | [
"update",
"drone",
"state"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L47-L58 |
51,969 | grownseed/haibu-ishiki | lib/ishiki.js | switchAndClear | function switchAndClear(pkg) {
switchState(false, pkg);
//unload proxy routes
proxy.deleteBy(app.config.get('public-port'), {user: pkg.user, appid: pkg.name});
} | javascript | function switchAndClear(pkg) {
switchState(false, pkg);
//unload proxy routes
proxy.deleteBy(app.config.get('public-port'), {user: pkg.user, appid: pkg.name});
} | [
"function",
"switchAndClear",
"(",
"pkg",
")",
"{",
"switchState",
"(",
"false",
",",
"pkg",
")",
";",
"//unload proxy routes",
"proxy",
".",
"deleteBy",
"(",
"app",
".",
"config",
".",
"get",
"(",
"'public-port'",
")",
",",
"{",
"user",
":",
"pkg",
".",... | update drone state and clear proxy routes | [
"update",
"drone",
"state",
"and",
"clear",
"proxy",
"routes"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L61-L66 |
51,970 | grownseed/haibu-ishiki | lib/ishiki.js | findSwitchAndClear | function findSwitchAndClear(uid) {
if (uid) {
droneModel.getProcessed({uid: uid}, function(err, result) {
if (!err && result && result.length == 1) {
switchAndClear(result[0]);
}
});
}
} | javascript | function findSwitchAndClear(uid) {
if (uid) {
droneModel.getProcessed({uid: uid}, function(err, result) {
if (!err && result && result.length == 1) {
switchAndClear(result[0]);
}
});
}
} | [
"function",
"findSwitchAndClear",
"(",
"uid",
")",
"{",
"if",
"(",
"uid",
")",
"{",
"droneModel",
".",
"getProcessed",
"(",
"{",
"uid",
":",
"uid",
"}",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"result",
"&... | find drone by uid, update drone state and clear proxy routes | [
"find",
"drone",
"by",
"uid",
"update",
"drone",
"state",
"and",
"clear",
"proxy",
"routes"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L69-L77 |
51,971 | grownseed/haibu-ishiki | lib/ishiki.js | startDrone | function startDrone(pkg, userid, appid, callback) {
var drone_port = getPort();
if (drone_port) {
pkg.env = pkg.env || {};
pkg.env['PORT'] = drone_port;
//ensure package user and name match internally
pkg.user = userid;
pkg.name = appid;
drone.start(pkg, function(err, resu... | javascript | function startDrone(pkg, userid, appid, callback) {
var drone_port = getPort();
if (drone_port) {
pkg.env = pkg.env || {};
pkg.env['PORT'] = drone_port;
//ensure package user and name match internally
pkg.user = userid;
pkg.name = appid;
drone.start(pkg, function(err, resu... | [
"function",
"startDrone",
"(",
"pkg",
",",
"userid",
",",
"appid",
",",
"callback",
")",
"{",
"var",
"drone_port",
"=",
"getPort",
"(",
")",
";",
"if",
"(",
"drone_port",
")",
"{",
"pkg",
".",
"env",
"=",
"pkg",
".",
"env",
"||",
"{",
"}",
";",
"... | starts a drone and sets up proxy routes for it | [
"starts",
"a",
"drone",
"and",
"sets",
"up",
"proxy",
"routes",
"for",
"it"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L111-L141 |
51,972 | grownseed/haibu-ishiki | lib/ishiki.js | stopDrone | function stopDrone(userid, appid, callback) {
droneModel.getProcessed({user: userid, name: appid}, function(err, result) {
if (err)
return callback(err);
if (result.length == 1) {
if (!result[0].started) {
callback({message: 'Drone is already stopped'});
}else{
... | javascript | function stopDrone(userid, appid, callback) {
droneModel.getProcessed({user: userid, name: appid}, function(err, result) {
if (err)
return callback(err);
if (result.length == 1) {
if (!result[0].started) {
callback({message: 'Drone is already stopped'});
}else{
... | [
"function",
"stopDrone",
"(",
"userid",
",",
"appid",
",",
"callback",
")",
"{",
"droneModel",
".",
"getProcessed",
"(",
"{",
"user",
":",
"userid",
",",
"name",
":",
"appid",
"}",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err... | stops a drone | [
"stops",
"a",
"drone"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L144-L166 |
51,973 | grownseed/haibu-ishiki | lib/ishiki.js | sendDrones | function sendDrones(filter, res) {
droneModel.getProcessed(filter, function(err, result) {
if (err)
return haibu.sendResponse(res, 500, err);
haibu.sendResponse(res, 200, {drones: result});
});
} | javascript | function sendDrones(filter, res) {
droneModel.getProcessed(filter, function(err, result) {
if (err)
return haibu.sendResponse(res, 500, err);
haibu.sendResponse(res, 200, {drones: result});
});
} | [
"function",
"sendDrones",
"(",
"filter",
",",
"res",
")",
"{",
"droneModel",
".",
"getProcessed",
"(",
"filter",
",",
"function",
"(",
"err",
",",
"result",
")",
"{",
"if",
"(",
"err",
")",
"return",
"haibu",
".",
"sendResponse",
"(",
"res",
",",
"500"... | find drones for given filter and sends response | [
"find",
"drones",
"for",
"given",
"filter",
"and",
"sends",
"response"
] | 697e7d5fbc8405654b6cfc30bd5979f76c135421 | https://github.com/grownseed/haibu-ishiki/blob/697e7d5fbc8405654b6cfc30bd5979f76c135421/lib/ishiki.js#L169-L176 |
51,974 | cp2017/sign | index.js | function(ethereumAddress, ethereumDataDir, ethereumAccountPassword, cb = null){
if(isFunction(cb)){
try {
keythereum.importFromFile(ethereumAddress, ethereumDataDir, function(keyObject){
keythereum.recover(ethereumAccountPassword, keyObject, function(privateKey){
... | javascript | function(ethereumAddress, ethereumDataDir, ethereumAccountPassword, cb = null){
if(isFunction(cb)){
try {
keythereum.importFromFile(ethereumAddress, ethereumDataDir, function(keyObject){
keythereum.recover(ethereumAccountPassword, keyObject, function(privateKey){
... | [
"function",
"(",
"ethereumAddress",
",",
"ethereumDataDir",
",",
"ethereumAccountPassword",
",",
"cb",
"=",
"null",
")",
"{",
"if",
"(",
"isFunction",
"(",
"cb",
")",
")",
"{",
"try",
"{",
"keythereum",
".",
"importFromFile",
"(",
"ethereumAddress",
",",
"et... | get the ethereum private key for the specified ethereum account, throws exception in case of any error
@param {String} ethereumAddress address of the ethereum account or empty if default account
@param {String} ethereumDataDir absolute path of the ethereum data, defaults to ~/.ethereum
@param {String... | [
"get",
"the",
"ethereum",
"private",
"key",
"for",
"the",
"specified",
"ethereum",
"account",
"throws",
"exception",
"in",
"case",
"of",
"any",
"error"
] | 9a838d454f862e674a505a09dd31cef93f727b4f | https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L82-L101 | |
51,975 | cp2017/sign | index.js | function(privateKey, cb = null){
if(isFunction(cb)){
try {
return cb(null, ethUtils.privateToPublic(privateKey))
}
catch(err){
return cb(err)
}
} else {
try {
return ethUtils.privateToPublic(priva... | javascript | function(privateKey, cb = null){
if(isFunction(cb)){
try {
return cb(null, ethUtils.privateToPublic(privateKey))
}
catch(err){
return cb(err)
}
} else {
try {
return ethUtils.privateToPublic(priva... | [
"function",
"(",
"privateKey",
",",
"cb",
"=",
"null",
")",
"{",
"if",
"(",
"isFunction",
"(",
"cb",
")",
")",
"{",
"try",
"{",
"return",
"cb",
"(",
"null",
",",
"ethUtils",
".",
"privateToPublic",
"(",
"privateKey",
")",
")",
"}",
"catch",
"(",
"e... | get public key for a given ethereum private key
@param {Buffer} privateKey ethereum private key
@return {Buffer} the associated public key | [
"get",
"public",
"key",
"for",
"a",
"given",
"ethereum",
"private",
"key"
] | 9a838d454f862e674a505a09dd31cef93f727b4f | https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L107-L123 | |
51,976 | cp2017/sign | index.js | function(message, signatureObject, cb = null){
var result = false
var ethSig = toEthUtilsSignature(signatureObject)
try {
var isSigValid = ethUtils.isValidSignature(ethSig.v, ethSig.r, ethSig.s)
var isPubKeyValid = ethUtils.isValidPublic(signatureObject.publicKey)
... | javascript | function(message, signatureObject, cb = null){
var result = false
var ethSig = toEthUtilsSignature(signatureObject)
try {
var isSigValid = ethUtils.isValidSignature(ethSig.v, ethSig.r, ethSig.s)
var isPubKeyValid = ethUtils.isValidPublic(signatureObject.publicKey)
... | [
"function",
"(",
"message",
",",
"signatureObject",
",",
"cb",
"=",
"null",
")",
"{",
"var",
"result",
"=",
"false",
"var",
"ethSig",
"=",
"toEthUtilsSignature",
"(",
"signatureObject",
")",
"try",
"{",
"var",
"isSigValid",
"=",
"ethUtils",
".",
"isValidSign... | verify signature easier handing over the complete signature object containing the signature, recovery and the public key in one object
@param {String} message message to verify
@param {Object} signatureObject Signature object. must contain recovery (Number), signature and publicKey (both buffers)
@param ... | [
"verify",
"signature",
"easier",
"handing",
"over",
"the",
"complete",
"signature",
"object",
"containing",
"the",
"signature",
"recovery",
"and",
"the",
"public",
"key",
"in",
"one",
"object"
] | 9a838d454f862e674a505a09dd31cef93f727b4f | https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L157-L181 | |
51,977 | cp2017/sign | index.js | function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){
var clonedSignatureObj = {
signature: signatureObject.signature,
recovery: signatureObject.recovery,
publicKey: publicKey
}
bufferEncoding = getEncodingOrDefault(bufferEncoding... | javascript | function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){
var clonedSignatureObj = {
signature: signatureObject.signature,
recovery: signatureObject.recovery,
publicKey: publicKey
}
bufferEncoding = getEncodingOrDefault(bufferEncoding... | [
"function",
"(",
"signatureObject",
",",
"publicKey",
",",
"bufferEncoding",
"=",
"DEFAULT_ENCODING",
",",
"cb",
"=",
"null",
")",
"{",
"var",
"clonedSignatureObj",
"=",
"{",
"signature",
":",
"signatureObject",
".",
"signature",
",",
"recovery",
":",
"signature... | creates a new object containing the values of the signature object plus the public key, encoded as a base64 string
@param {Object} signatureObject the signature object containing signature and recovery
@param {Buffer} publicKey the ethereum public key for later signature verification
@param {String} buff... | [
"creates",
"a",
"new",
"object",
"containing",
"the",
"values",
"of",
"the",
"signature",
"object",
"plus",
"the",
"public",
"key",
"encoded",
"as",
"a",
"base64",
"string"
] | 9a838d454f862e674a505a09dd31cef93f727b4f | https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L190-L207 | |
51,978 | cp2017/sign | index.js | function(base64String, bufferEncoding = DEFAULT_ENCODING, cb = null){
bufferEncoding = getEncodingOrDefault(bufferEncoding)
var decodedObj = JSON.parse(Buffer.from(base64String, 'base64').toString())
var result = {}
if('signature' in decodedObj && 'recovery' in decodedObj){
r... | javascript | function(base64String, bufferEncoding = DEFAULT_ENCODING, cb = null){
bufferEncoding = getEncodingOrDefault(bufferEncoding)
var decodedObj = JSON.parse(Buffer.from(base64String, 'base64').toString())
var result = {}
if('signature' in decodedObj && 'recovery' in decodedObj){
r... | [
"function",
"(",
"base64String",
",",
"bufferEncoding",
"=",
"DEFAULT_ENCODING",
",",
"cb",
"=",
"null",
")",
"{",
"bufferEncoding",
"=",
"getEncodingOrDefault",
"(",
"bufferEncoding",
")",
"var",
"decodedObj",
"=",
"JSON",
".",
"parse",
"(",
"Buffer",
".",
"f... | recover signature object from base64-encoded string
@param {String} base64String String to decode
@param {String} bufferEncoding encoding for recovering the buffers inside the object
@param {Function} cb callback function
@return {Object} Signature object recovered from the input s... | [
"recover",
"signature",
"object",
"from",
"base64",
"-",
"encoded",
"string"
] | 9a838d454f862e674a505a09dd31cef93f727b4f | https://github.com/cp2017/sign/blob/9a838d454f862e674a505a09dd31cef93f727b4f/index.js#L215-L238 | |
51,979 | webcredits/wc_db | lib/db.js | getConnection | function getConnection (config) {
var sequelize
var defaultStorage = 'store.db'
var logging = config.logging || false
if (config.dialect === 'sqlite') {
if (!config.storage) {
config.storage = defaultStorage
}
sequelize = new Sequelize(config.database, config.username, config.password, {
... | javascript | function getConnection (config) {
var sequelize
var defaultStorage = 'store.db'
var logging = config.logging || false
if (config.dialect === 'sqlite') {
if (!config.storage) {
config.storage = defaultStorage
}
sequelize = new Sequelize(config.database, config.username, config.password, {
... | [
"function",
"getConnection",
"(",
"config",
")",
"{",
"var",
"sequelize",
"var",
"defaultStorage",
"=",
"'store.db'",
"var",
"logging",
"=",
"config",
".",
"logging",
"||",
"false",
"if",
"(",
"config",
".",
"dialect",
"===",
"'sqlite'",
")",
"{",
"if",
"(... | Setup database.
@param {Object} config The config object.
@param {string} config.dialect The db dialect sqlite | mysql.
@param {string} config.host The db host.
@param {string} config.database The db database name.
@param {string} config.username The db username.
@param {string} config.password The ... | [
"Setup",
"database",
"."
] | a3232a69d31f03da071f6f8a26169ce386b1c231 | https://github.com/webcredits/wc_db/blob/a3232a69d31f03da071f6f8a26169ce386b1c231/lib/db.js#L19-L43 |
51,980 | webcredits/wc_db | lib/db.js | runSQL | function runSQL (sql, config, conn, replacements) {
return new Promise(function (resolve, reject) {
if (!config && !conn) {
reject('Must set config or connection')
}
if (!sql) {
reject('Need some sql')
}
if (!conn) {
conn = getConnection(config)
}
replacements = replac... | javascript | function runSQL (sql, config, conn, replacements) {
return new Promise(function (resolve, reject) {
if (!config && !conn) {
reject('Must set config or connection')
}
if (!sql) {
reject('Need some sql')
}
if (!conn) {
conn = getConnection(config)
}
replacements = replac... | [
"function",
"runSQL",
"(",
"sql",
",",
"config",
",",
"conn",
",",
"replacements",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"!",
"config",
"&&",
"!",
"conn",
")",
"{",
"reject",
"(",
... | Run SQL as promise
@param {string} sql The SQL to run
@param {Object} config The config object.
@param {string} config.dialect The db dialect sqlite | mysql.
@param {string} config.host The db host.
@param {string} config.database The db database name.
@param {string} config.username The db... | [
"Run",
"SQL",
"as",
"promise"
] | a3232a69d31f03da071f6f8a26169ce386b1c231 | https://github.com/webcredits/wc_db/blob/a3232a69d31f03da071f6f8a26169ce386b1c231/lib/db.js#L58-L80 |
51,981 | commenthol/mergee | index.js | _checkCircular | function _checkCircular (opts, obj) {
var key
if (util.isObject(obj)) {
if (~opts._visited.indexOf(obj)) {
return true
}
opts._visited.push(obj)
for (key in obj) {
if (obj.hasOwnProperty(key) && _checkCircular(opts, obj[key])) {
return true
}
}
}
return false
} | javascript | function _checkCircular (opts, obj) {
var key
if (util.isObject(obj)) {
if (~opts._visited.indexOf(obj)) {
return true
}
opts._visited.push(obj)
for (key in obj) {
if (obj.hasOwnProperty(key) && _checkCircular(opts, obj[key])) {
return true
}
}
}
return false
} | [
"function",
"_checkCircular",
"(",
"opts",
",",
"obj",
")",
"{",
"var",
"key",
"if",
"(",
"util",
".",
"isObject",
"(",
"obj",
")",
")",
"{",
"if",
"(",
"~",
"opts",
".",
"_visited",
".",
"indexOf",
"(",
"obj",
")",
")",
"{",
"return",
"true",
"}... | recursive helper function
@api private | [
"recursive",
"helper",
"function"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L54-L68 |
51,982 | commenthol/mergee | index.js | merge | function merge () {
var args = [].slice.call(arguments)
args.unshift({})
return mergeExt.apply(null, args)
} | javascript | function merge () {
var args = [].slice.call(arguments)
args.unshift({})
return mergeExt.apply(null, args)
} | [
"function",
"merge",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"args",
".",
"unshift",
"(",
"{",
"}",
")",
"return",
"mergeExt",
".",
"apply",
"(",
"null",
",",
"args",
")",
"}"
] | merge multiple objects into `target`
#### Example
````js
var merge = require('mergee').merge,
target = { t: 1, x: { y: 'z' } },
source1 = { t: { s1: /source1/ } },
source2 = { t: { s2: new Date(100), x: null } };
merge(target, source1, source2);
// target === { t: { s1: /source1/, s2: Wed Dec 31 1969 17:00:00 GMT-07... | [
"merge",
"multiple",
"objects",
"into",
"target"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L124-L128 |
51,983 | commenthol/mergee | index.js | _segment | function _segment (char) {
var tmp
char = char || '.'
return function (k) {
if (tmp) {
tmp += char + k
if (CLOSE.test(k)) {
k = tmp
tmp = ''
} else {
return
}
} else if (OPEN.test(k)) {
tmp = k
if (CLOSE.test(k)) {
tmp = ''
} else {... | javascript | function _segment (char) {
var tmp
char = char || '.'
return function (k) {
if (tmp) {
tmp += char + k
if (CLOSE.test(k)) {
k = tmp
tmp = ''
} else {
return
}
} else if (OPEN.test(k)) {
tmp = k
if (CLOSE.test(k)) {
tmp = ''
} else {... | [
"function",
"_segment",
"(",
"char",
")",
"{",
"var",
"tmp",
"char",
"=",
"char",
"||",
"'.'",
"return",
"function",
"(",
"k",
")",
"{",
"if",
"(",
"tmp",
")",
"{",
"tmp",
"+=",
"char",
"+",
"k",
"if",
"(",
"CLOSE",
".",
"test",
"(",
"k",
")",
... | segment path or properties string
@api private
@param {String} char - separator char
@return {Function} | [
"segment",
"path",
"or",
"properties",
"string"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L322-L344 |
51,984 | commenthol/mergee | index.js | _splitPath | function _splitPath (keys) {
var out
if (util.isString(keys)) {
out = []
keys
.split('.')
.map(_segment('.'))
.forEach(function (k) {
k = (k || ' ').trim()
.replace(/^([^[]+)\[(["']?)(.+)\2\]$/, function (m, m1, m2, m3) {
if (m1 && m3) {
out.pus... | javascript | function _splitPath (keys) {
var out
if (util.isString(keys)) {
out = []
keys
.split('.')
.map(_segment('.'))
.forEach(function (k) {
k = (k || ' ').trim()
.replace(/^([^[]+)\[(["']?)(.+)\2\]$/, function (m, m1, m2, m3) {
if (m1 && m3) {
out.pus... | [
"function",
"_splitPath",
"(",
"keys",
")",
"{",
"var",
"out",
"if",
"(",
"util",
".",
"isString",
"(",
"keys",
")",
")",
"{",
"out",
"=",
"[",
"]",
"keys",
".",
"split",
"(",
"'.'",
")",
".",
"map",
"(",
"_segment",
"(",
"'.'",
")",
")",
".",
... | split dot separated String or Array into a property path
@private
@param {Array|String} keys
@return {Object} obj for comparison | [
"split",
"dot",
"separated",
"String",
"or",
"Array",
"into",
"a",
"property",
"path"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L352-L375 |
51,985 | commenthol/mergee | index.js | _splitProps | function _splitProps (props) {
var test = {}
if (util.isString(props)) {
props = props
.split(',')
.map(_segment(','))
.filter(function (k) {
return k
})
}
if (util.isArray(props)) {
props.forEach(function (key) {
test[key] = 1
})
return test
}
return {... | javascript | function _splitProps (props) {
var test = {}
if (util.isString(props)) {
props = props
.split(',')
.map(_segment(','))
.filter(function (k) {
return k
})
}
if (util.isArray(props)) {
props.forEach(function (key) {
test[key] = 1
})
return test
}
return {... | [
"function",
"_splitProps",
"(",
"props",
")",
"{",
"var",
"test",
"=",
"{",
"}",
"if",
"(",
"util",
".",
"isString",
"(",
"props",
")",
")",
"{",
"props",
"=",
"props",
".",
"split",
"(",
"','",
")",
".",
"map",
"(",
"_segment",
"(",
"','",
")",
... | split comma separated String or Array into a test hash
@private
@param {Array|String} keys
@return {Object} obj for comparison | [
"split",
"comma",
"separated",
"String",
"or",
"Array",
"into",
"a",
"test",
"hash"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L384-L402 |
51,986 | commenthol/mergee | index.js | pick | function pick (obj, props) {
var key
var val
var out
var test = _splitProps(props)
if (util.isObject(obj)) {
out = {}
for (key in test) {
val = get(obj, key)
if (val !== undefined && val !== null) {
set(out, key, val)
}
}
}
return out
} | javascript | function pick (obj, props) {
var key
var val
var out
var test = _splitProps(props)
if (util.isObject(obj)) {
out = {}
for (key in test) {
val = get(obj, key)
if (val !== undefined && val !== null) {
set(out, key, val)
}
}
}
return out
} | [
"function",
"pick",
"(",
"obj",
",",
"props",
")",
"{",
"var",
"key",
"var",
"val",
"var",
"out",
"var",
"test",
"=",
"_splitProps",
"(",
"props",
")",
"if",
"(",
"util",
".",
"isObject",
"(",
"obj",
")",
")",
"{",
"out",
"=",
"{",
"}",
"for",
... | pick properties from `obj` into a new object
#### Example
```js
var r,
pick = require('mergee').pick,
obj = { a: 1, b: [ 1, 2 ], c: { cc:3, 'c-d':4 }, '0d': { '0d0': 5 } };
r = pick(obj, ['a', 'b[1]', 'c["c-d"]', '0d.0d0']);
//> r = { a: 1, b: { '1': 2 }, c: { 'c-d': 4 }, '0d': { '0d0': 5 } }
r = pick(obj, 'a, b[1], ... | [
"pick",
"properties",
"from",
"obj",
"into",
"a",
"new",
"object"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L424-L440 |
51,987 | commenthol/mergee | index.js | omit | function omit (obj, props) {
var key
var out
var test = _splitProps(props)
if (util.isObject(obj)) {
out = clone(obj)
for (key in test) {
if ((get(obj, key))) {
set(out, key, null)
}
}
}
return out
} | javascript | function omit (obj, props) {
var key
var out
var test = _splitProps(props)
if (util.isObject(obj)) {
out = clone(obj)
for (key in test) {
if ((get(obj, key))) {
set(out, key, null)
}
}
}
return out
} | [
"function",
"omit",
"(",
"obj",
",",
"props",
")",
"{",
"var",
"key",
"var",
"out",
"var",
"test",
"=",
"_splitProps",
"(",
"props",
")",
"if",
"(",
"util",
".",
"isObject",
"(",
"obj",
")",
")",
"{",
"out",
"=",
"clone",
"(",
"obj",
")",
"for",
... | omit properties from `obj` into a new object
#### Example
```js
var r,
omit = require('mergee').omit,
obj = { a: 1, b: [ 1, 2 ], c: { cc:3, 'c-d':4 }, '0d': { '0d0': 5 } };
r = omit(obj, ['a', 'b[1]', 'c["c-d"]', '0d.0d0']);
// r = { b: [ 1, ], c: { cc: 3 }, '0d': {} }
r = omit(obj, 'a, b[1], c["c-d"], 0d.0d0');
// ... | [
"omit",
"properties",
"from",
"obj",
"into",
"a",
"new",
"object"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L462-L476 |
51,988 | commenthol/mergee | index.js | get | function get (obj, keys, _default) {
var i
var key
var tmp = obj || {}
keys = _splitPath(keys)
if (!keys || keys.length === 0) {
return _default
}
for (i = 0; i < keys.length; i++) {
key = keys[i]
if (tmp && tmp.hasOwnProperty(key)) {
tmp = tmp[key]
} else {
return _default
... | javascript | function get (obj, keys, _default) {
var i
var key
var tmp = obj || {}
keys = _splitPath(keys)
if (!keys || keys.length === 0) {
return _default
}
for (i = 0; i < keys.length; i++) {
key = keys[i]
if (tmp && tmp.hasOwnProperty(key)) {
tmp = tmp[key]
} else {
return _default
... | [
"function",
"get",
"(",
"obj",
",",
"keys",
",",
"_default",
")",
"{",
"var",
"i",
"var",
"key",
"var",
"tmp",
"=",
"obj",
"||",
"{",
"}",
"keys",
"=",
"_splitPath",
"(",
"keys",
")",
"if",
"(",
"!",
"keys",
"||",
"keys",
".",
"length",
"===",
... | get properties from `obj`
#### Example
```js
var r,
get = require('mergee').get,
obj = { a: { b: { c: 1 } } };
r = get(obj, ['a', 'b', 'c']);
// r = 1
r = get(obj, 'a.b');
// r = { c: 1 }
r = get(obj, 'there.is.no.such.property'); // this will not throw!
// r = undefined
```
@param {Object} obj - object to select f... | [
"get",
"properties",
"from",
"obj"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L501-L521 |
51,989 | commenthol/mergee | index.js | set | function set (obj, keys, value) {
var i
var key
var last
var tmp = obj || {}
keys = _splitPath(keys)
if (!keys || keys.length === 0) {
return
}
last = keys.pop()
for (i = 0; i < keys.length; i++) {
key = keys[i]
if (!tmp[key]) {
tmp[key] = {}
}
if (tmp.hasOwnProperty(key)... | javascript | function set (obj, keys, value) {
var i
var key
var last
var tmp = obj || {}
keys = _splitPath(keys)
if (!keys || keys.length === 0) {
return
}
last = keys.pop()
for (i = 0; i < keys.length; i++) {
key = keys[i]
if (!tmp[key]) {
tmp[key] = {}
}
if (tmp.hasOwnProperty(key)... | [
"function",
"set",
"(",
"obj",
",",
"keys",
",",
"value",
")",
"{",
"var",
"i",
"var",
"key",
"var",
"last",
"var",
"tmp",
"=",
"obj",
"||",
"{",
"}",
"keys",
"=",
"_splitPath",
"(",
"keys",
")",
"if",
"(",
"!",
"keys",
"||",
"keys",
".",
"leng... | set a property in `obj`
#### Example
```js
var r,
set = require('mergee').set,
obj = {};
r = set(obj, ['a', 'b'], { c:1 });
//> r = { a: { b: { c: 1 } } }
r = set(obj, 'a.b.d', 2);
//> r = { a: { b: { c:1, d:2 } } }
```
@param {Object} obj - object to select from
@param {Array|String} keys - Array of properties or d... | [
"set",
"a",
"property",
"in",
"obj"
] | a4c42223b59b184c8a3034c0be49f0067634ac71 | https://github.com/commenthol/mergee/blob/a4c42223b59b184c8a3034c0be49f0067634ac71/index.js#L550-L579 |
51,990 | rowanmanning/chic-event | lib/chic-event.js | arrayIndexOf | function arrayIndexOf (array, val) {
// Use native indexOf
if (Array.prototype.indexOf) {
return array.indexOf(val);
}
// Use loop/if for environments without native indexOf
var i, len = array.length;
for (i = 0; i < len; len += 1) {
if (array[i]... | javascript | function arrayIndexOf (array, val) {
// Use native indexOf
if (Array.prototype.indexOf) {
return array.indexOf(val);
}
// Use loop/if for environments without native indexOf
var i, len = array.length;
for (i = 0; i < len; len += 1) {
if (array[i]... | [
"function",
"arrayIndexOf",
"(",
"array",
",",
"val",
")",
"{",
"// Use native indexOf",
"if",
"(",
"Array",
".",
"prototype",
".",
"indexOf",
")",
"{",
"return",
"array",
".",
"indexOf",
"(",
"val",
")",
";",
"}",
"// Use loop/if for environments without native... | Utilities Get the index of the first instance of a value in an array | [
"Utilities",
"Get",
"the",
"index",
"of",
"the",
"first",
"instance",
"of",
"a",
"value",
"in",
"an",
"array"
] | 0911e4211be2615ddb06a797e0fe57480cf06972 | https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L21-L37 |
51,991 | rowanmanning/chic-event | lib/chic-event.js | function (type, handler) {
// Validate arguments
if (typeof type !== 'string') {
throw new Error('Type must be a string');
}
if (typeof handler !== 'function') {
throw new Error('Handler must be a function');
}
// ... | javascript | function (type, handler) {
// Validate arguments
if (typeof type !== 'string') {
throw new Error('Type must be a string');
}
if (typeof handler !== 'function') {
throw new Error('Handler must be a function');
}
// ... | [
"function",
"(",
"type",
",",
"handler",
")",
"{",
"// Validate arguments",
"if",
"(",
"typeof",
"type",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Type must be a string'",
")",
";",
"}",
"if",
"(",
"typeof",
"handler",
"!==",
"'function'",... | Bind a handler to an event | [
"Bind",
"a",
"handler",
"to",
"an",
"event"
] | 0911e4211be2615ddb06a797e0fe57480cf06972 | https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L70-L91 | |
51,992 | rowanmanning/chic-event | lib/chic-event.js | function (type, handler) {
// Validate arguments
if (typeof type !== 'undefined' && typeof type !== 'string') {
throw new Error('Type must be a string or undefined');
}
if (typeof handler !== 'undefined' && typeof handler !== 'function') {
... | javascript | function (type, handler) {
// Validate arguments
if (typeof type !== 'undefined' && typeof type !== 'string') {
throw new Error('Type must be a string or undefined');
}
if (typeof handler !== 'undefined' && typeof handler !== 'function') {
... | [
"function",
"(",
"type",
",",
"handler",
")",
"{",
"// Validate arguments",
"if",
"(",
"typeof",
"type",
"!==",
"'undefined'",
"&&",
"typeof",
"type",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Type must be a string or undefined'",
")",
";",
... | Unbind handlers from events | [
"Unbind",
"handlers",
"from",
"events"
] | 0911e4211be2615ddb06a797e0fe57480cf06972 | https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L94-L129 | |
51,993 | rowanmanning/chic-event | lib/chic-event.js | function (type, event) {
// Validate arguments
if (typeof type !== 'string') {
throw new Error('Type must be a string');
}
// Check for presence of event store
if (!this._events || !this._events[type]) { return; }
// Get handlers... | javascript | function (type, event) {
// Validate arguments
if (typeof type !== 'string') {
throw new Error('Type must be a string');
}
// Check for presence of event store
if (!this._events || !this._events[type]) { return; }
// Get handlers... | [
"function",
"(",
"type",
",",
"event",
")",
"{",
"// Validate arguments",
"if",
"(",
"typeof",
"type",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Type must be a string'",
")",
";",
"}",
"// Check for presence of event store",
"if",
"(",
"!",
... | Emit an event | [
"Emit",
"an",
"event"
] | 0911e4211be2615ddb06a797e0fe57480cf06972 | https://github.com/rowanmanning/chic-event/blob/0911e4211be2615ddb06a797e0fe57480cf06972/lib/chic-event.js#L132-L164 | |
51,994 | doowb/macro-store | lib/store.js | Store | function Store(options) {
if (!(this instanceof Store)) {
return new Store(options);
}
if (typeof options === 'string') {
options = { name: options };
}
options = options || {};
var name = options.name || 'macros';
this.store = options.store || new utils.Store(name);
} | javascript | function Store(options) {
if (!(this instanceof Store)) {
return new Store(options);
}
if (typeof options === 'string') {
options = { name: options };
}
options = options || {};
var name = options.name || 'macros';
this.store = options.store || new utils.Store(name);
} | [
"function",
"Store",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Store",
")",
")",
"{",
"return",
"new",
"Store",
"(",
"options",
")",
";",
"}",
"if",
"(",
"typeof",
"options",
"===",
"'string'",
")",
"{",
"options",
"=",
... | Initialize a new `Store` with the given `options`.
```js
var macroStore = new Store();
//=> '~/data-store/macros.json'
var macroStore = new Store({name: 'abc'});
//=> '~/data-store/abc.json'
```
@param {Object} `options`
@param {String} `options.name` Name of the json file to use for storing macros. Defaults to 'ma... | [
"Initialize",
"a",
"new",
"Store",
"with",
"the",
"given",
"options",
"."
] | 29cb4f578e162aab5acedc72a313d97694d58a33 | https://github.com/doowb/macro-store/blob/29cb4f578e162aab5acedc72a313d97694d58a33/lib/store.js#L30-L41 |
51,995 | milojs/ml-mixin | lib/mixin.js | _createProxyMethod | function _createProxyMethod(proxyMethodName, mixinMethodName, hostObject) {
hostObject = hostObject || this._hostObject;
// Mixin class does not allow shadowing methods that exist on the host object
if (hostObject[proxyMethodName])
throw new Error('method ' + proxyMethodName +
... | javascript | function _createProxyMethod(proxyMethodName, mixinMethodName, hostObject) {
hostObject = hostObject || this._hostObject;
// Mixin class does not allow shadowing methods that exist on the host object
if (hostObject[proxyMethodName])
throw new Error('method ' + proxyMethodName +
... | [
"function",
"_createProxyMethod",
"(",
"proxyMethodName",
",",
"mixinMethodName",
",",
"hostObject",
")",
"{",
"hostObject",
"=",
"hostObject",
"||",
"this",
".",
"_hostObject",
";",
"// Mixin class does not allow shadowing methods that exist on the host object",
"if",
"(",
... | Creates a proxied method of Mixin subclass on host object.
@param {String} mixinMethodName name of method in Mixin subclass
@param {String} proxyMethodName name of created proxy method on host object
@param {Object} hostObject Optional reference to the host object; if not specified the host object passed to constructo... | [
"Creates",
"a",
"proxied",
"method",
"of",
"Mixin",
"subclass",
"on",
"host",
"object",
"."
] | 7e6d220d8c8bdd598969edcbbc8886da644b7a24 | https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L69-L89 |
51,996 | milojs/ml-mixin | lib/mixin.js | _createProxyMethods | function _createProxyMethods(proxyMethods, hostObject) {
check(proxyMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String))));
// creating and binding proxy methods on the host object
if (Array.isArray(proxyMethods))
proxyMethods.forEach(function(methodName) {
// method ... | javascript | function _createProxyMethods(proxyMethods, hostObject) {
check(proxyMethods, Match.Optional(Match.OneOf([String], Match.ObjectHash(String))));
// creating and binding proxy methods on the host object
if (Array.isArray(proxyMethods))
proxyMethods.forEach(function(methodName) {
// method ... | [
"function",
"_createProxyMethods",
"(",
"proxyMethods",
",",
"hostObject",
")",
"{",
"check",
"(",
"proxyMethods",
",",
"Match",
".",
"Optional",
"(",
"Match",
".",
"OneOf",
"(",
"[",
"String",
"]",
",",
"Match",
".",
"ObjectHash",
"(",
"String",
")",
")",... | Creates proxied methods of Mixin subclass on host object.
@param {Hash[String]|Array[String]} proxyMethods map of names of methods, key - proxy method name, value - mixin method name. Can be array.
@param {Object} hostObject an optional reference to the host object; if not specified the host object passed to construct... | [
"Creates",
"proxied",
"methods",
"of",
"Mixin",
"subclass",
"on",
"host",
"object",
"."
] | 7e6d220d8c8bdd598969edcbbc8886da644b7a24 | https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L98-L117 |
51,997 | milojs/ml-mixin | lib/mixin.js | Mixin_setInstanceKey | function Mixin_setInstanceKey(hostClass, method, instanceKey) {
check(hostClass, Function);
check(instanceKey, Match.IdentifierString);
var prop = INSTANCE_PROPERTIES_MAP,
instanceKeys = hostClass[prop] = hostClass[prop] || {};
if (instanceKeys[method.name])
throw new Error('Mixin: ins... | javascript | function Mixin_setInstanceKey(hostClass, method, instanceKey) {
check(hostClass, Function);
check(instanceKey, Match.IdentifierString);
var prop = INSTANCE_PROPERTIES_MAP,
instanceKeys = hostClass[prop] = hostClass[prop] || {};
if (instanceKeys[method.name])
throw new Error('Mixin: ins... | [
"function",
"Mixin_setInstanceKey",
"(",
"hostClass",
",",
"method",
",",
"instanceKey",
")",
"{",
"check",
"(",
"hostClass",
",",
"Function",
")",
";",
"check",
"(",
"instanceKey",
",",
"Match",
".",
"IdentifierString",
")",
";",
"var",
"prop",
"=",
"INSTAN... | Sets mixin instance property name on the host class
Can be called only once
@private
@param {Function} this Mixin subclass (not instance)
@param {Function} hostClass
@param {String} instanceKey | [
"Sets",
"mixin",
"instance",
"property",
"name",
"on",
"the",
"host",
"class",
"Can",
"be",
"called",
"only",
"once"
] | 7e6d220d8c8bdd598969edcbbc8886da644b7a24 | https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L129-L141 |
51,998 | milojs/ml-mixin | lib/mixin.js | Mixin_addMethod | function Mixin_addMethod(hostClass, instanceKey, mixinMethodName, hostMethodName) {
var method = this.prototype[mixinMethodName];
check(method, Function);
var wrappedMethod = _wrapMixinMethod.call(this, method);
Object.defineProperty(hostClass.prototype, hostMethodName, {
value: wrappedMethod,... | javascript | function Mixin_addMethod(hostClass, instanceKey, mixinMethodName, hostMethodName) {
var method = this.prototype[mixinMethodName];
check(method, Function);
var wrappedMethod = _wrapMixinMethod.call(this, method);
Object.defineProperty(hostClass.prototype, hostMethodName, {
value: wrappedMethod,... | [
"function",
"Mixin_addMethod",
"(",
"hostClass",
",",
"instanceKey",
",",
"mixinMethodName",
",",
"hostMethodName",
")",
"{",
"var",
"method",
"=",
"this",
".",
"prototype",
"[",
"mixinMethodName",
"]",
";",
"check",
"(",
"method",
",",
"Function",
")",
";",
... | Adds method of Mixin subclass to host class prototype.
@private
@param {Function} this Mixin subclass (not instance)
@param {String} mixinMethodName name of method in Mixin subclass
@param {String} hostMethodName (optional) name of created proxy method on host object, same if not specified
@param {Object} hostObject o... | [
"Adds",
"method",
"of",
"Mixin",
"subclass",
"to",
"host",
"class",
"prototype",
"."
] | 7e6d220d8c8bdd598969edcbbc8886da644b7a24 | https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L153-L167 |
51,999 | milojs/ml-mixin | lib/mixin.js | _wrapMixinMethod | function _wrapMixinMethod(method) {
return function() { // ,... arguments
var mixinInstance = _getMixinInstance.call(this, method.name);
return method.apply(mixinInstance || this, arguments);
};
} | javascript | function _wrapMixinMethod(method) {
return function() { // ,... arguments
var mixinInstance = _getMixinInstance.call(this, method.name);
return method.apply(mixinInstance || this, arguments);
};
} | [
"function",
"_wrapMixinMethod",
"(",
"method",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// ,... arguments",
"var",
"mixinInstance",
"=",
"_getMixinInstance",
".",
"call",
"(",
"this",
",",
"method",
".",
"name",
")",
";",
"return",
"method",
".",
"app... | Returns method that will be exposed on the host class prototype
@private
@param {Function} this Mixin subclass (not instance)
@return {Function} | [
"Returns",
"method",
"that",
"will",
"be",
"exposed",
"on",
"the",
"host",
"class",
"prototype"
] | 7e6d220d8c8bdd598969edcbbc8886da644b7a24 | https://github.com/milojs/ml-mixin/blob/7e6d220d8c8bdd598969edcbbc8886da644b7a24/lib/mixin.js#L177-L182 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.