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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,700 | smartface/styler | src/styler.js | styler | function styler(...rawStyles) {
const stylesBundle = buildStyles.apply(null, rawStyles);
/**
* Styling composer
*
* @param {...string} classNames - Class names of desired styles
*/
return function stylingComposer(classNames, error) {
var parsedClassNames;
const styles = [];
const notFoun... | javascript | function styler(...rawStyles) {
const stylesBundle = buildStyles.apply(null, rawStyles);
/**
* Styling composer
*
* @param {...string} classNames - Class names of desired styles
*/
return function stylingComposer(classNames, error) {
var parsedClassNames;
const styles = [];
const notFoun... | [
"function",
"styler",
"(",
"...",
"rawStyles",
")",
"{",
"const",
"stylesBundle",
"=",
"buildStyles",
".",
"apply",
"(",
"null",
",",
"rawStyles",
")",
";",
"/**\n * Styling composer\n * \n * @param {...string} classNames - Class names of desired styles\n */",
"return... | Styling Wrapper. In order to return desired styles. Makes styles flatted then merge all by classNames then pass merged styles to callback.
@example
const styler = require("@smartface/styler").styler or require("@smartface/styler/lib/styler");
const styles = {
".button"{
widht: "100px",
height: "30px",
".blue": {
color... | [
"Styling",
"Wrapper",
".",
"In",
"order",
"to",
"return",
"desired",
"styles",
".",
"Makes",
"styles",
"flatted",
"then",
"merge",
"all",
"by",
"classNames",
"then",
"pass",
"merged",
"styles",
"to",
"callback",
"."
] | fca15ea571a73f0acffa2e6f44668993b127daf1 | https://github.com/smartface/styler/blob/fca15ea571a73f0acffa2e6f44668993b127daf1/src/styler.js#L49-L147 |
53,701 | chrishayesmu/DubBotBase | src/utils.js | checkHasValue | function checkHasValue(value, message) {
checkNotEmpty(message, "No error message passed to checkHasValue");
if (value === null || typeof value === "undefined") {
throw new Error(message);
}
} | javascript | function checkHasValue(value, message) {
checkNotEmpty(message, "No error message passed to checkHasValue");
if (value === null || typeof value === "undefined") {
throw new Error(message);
}
} | [
"function",
"checkHasValue",
"(",
"value",
",",
"message",
")",
"{",
"checkNotEmpty",
"(",
"message",
",",
"\"No error message passed to checkHasValue\"",
")",
";",
"if",
"(",
"value",
"===",
"null",
"||",
"typeof",
"value",
"===",
"\"undefined\"",
")",
"{",
"th... | Ensures that the value passed in is not null or undefined.
If it is, throws an error with the message provided.
@param {mixed} value - Anything which should not be null or undefined
@param {string} message - A message to throw in an Error if no value is present | [
"Ensures",
"that",
"the",
"value",
"passed",
"in",
"is",
"not",
"null",
"or",
"undefined",
".",
"If",
"it",
"is",
"throws",
"an",
"error",
"with",
"the",
"message",
"provided",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L35-L41 |
53,702 | chrishayesmu/DubBotBase | src/utils.js | checkNotEmpty | function checkNotEmpty(string, message) {
if (!message || !message.trim()) {
throw new Error("No error message passed to checkNotEmpty");
}
if (!string || !string.trim()) {
throw new Error(message);
}
} | javascript | function checkNotEmpty(string, message) {
if (!message || !message.trim()) {
throw new Error("No error message passed to checkNotEmpty");
}
if (!string || !string.trim()) {
throw new Error(message);
}
} | [
"function",
"checkNotEmpty",
"(",
"string",
",",
"message",
")",
"{",
"if",
"(",
"!",
"message",
"||",
"!",
"message",
".",
"trim",
"(",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"No error message passed to checkNotEmpty\"",
")",
";",
"}",
"if",
"(",
... | Checks that the string passed in is not null, empty or entirely whitespace.
If this is not the case, throws an error with the message provided.
@param {string} string - The string to check
@param {string} message - A message to throw in an Error if the string is empty | [
"Checks",
"that",
"the",
"string",
"passed",
"in",
"is",
"not",
"null",
"empty",
"or",
"entirely",
"whitespace",
".",
"If",
"this",
"is",
"not",
"the",
"case",
"throws",
"an",
"error",
"with",
"the",
"message",
"provided",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L50-L58 |
53,703 | chrishayesmu/DubBotBase | src/utils.js | checkValueIsInObject | function checkValueIsInObject(value, object, message) {
checkNotEmpty(message, "No error message passed to checkValueIsInObject");
var key = findValueInObject(value, object);
if (typeof key === "undefined") {
// Make sure the value's actually missing and it's not hidden behind undefined
if... | javascript | function checkValueIsInObject(value, object, message) {
checkNotEmpty(message, "No error message passed to checkValueIsInObject");
var key = findValueInObject(value, object);
if (typeof key === "undefined") {
// Make sure the value's actually missing and it's not hidden behind undefined
if... | [
"function",
"checkValueIsInObject",
"(",
"value",
",",
"object",
",",
"message",
")",
"{",
"checkNotEmpty",
"(",
"message",
",",
"\"No error message passed to checkValueIsInObject\"",
")",
";",
"var",
"key",
"=",
"findValueInObject",
"(",
"value",
",",
"object",
")"... | Checks that the value provided exists under one of the top-level
keys in the object provided. If it does not, an error is thrown
containing the message given.
@param {mixed} value - A value to search for
@param {object} object - An object to search in
@param {string} message - A message to throw in an Error if the str... | [
"Checks",
"that",
"the",
"value",
"provided",
"exists",
"under",
"one",
"of",
"the",
"top",
"-",
"level",
"keys",
"in",
"the",
"object",
"provided",
".",
"If",
"it",
"does",
"not",
"an",
"error",
"is",
"thrown",
"containing",
"the",
"message",
"given",
"... | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L69-L80 |
53,704 | chrishayesmu/DubBotBase | src/utils.js | deepEquals | function deepEquals(obj1, obj2) {
if (typeof obj1 !== typeof obj2) {
return false;
}
// NaN check
if (obj1 !== obj1) {
return obj2 !== obj2;
}
// Non-object types will compare correctly with ===
if (typeof obj1 !== "object") {
return obj1 === obj2;
}
if (!_... | javascript | function deepEquals(obj1, obj2) {
if (typeof obj1 !== typeof obj2) {
return false;
}
// NaN check
if (obj1 !== obj1) {
return obj2 !== obj2;
}
// Non-object types will compare correctly with ===
if (typeof obj1 !== "object") {
return obj1 === obj2;
}
if (!_... | [
"function",
"deepEquals",
"(",
"obj1",
",",
"obj2",
")",
"{",
"if",
"(",
"typeof",
"obj1",
"!==",
"typeof",
"obj2",
")",
"{",
"return",
"false",
";",
"}",
"// NaN check",
"if",
"(",
"obj1",
"!==",
"obj1",
")",
"{",
"return",
"obj2",
"!==",
"obj2",
";... | Performs a deep check to see if the two values provided are equal. For
non-object types, this refers to simple equality; for object types, the
two objects must contain all of the same keys and have the same values behind
all of those keys.
THIS METHOD DOES NOT CHECK FOR CYCLES IN THE OBJECTS PROVIDED. Don't try to
use... | [
"Performs",
"a",
"deep",
"check",
"to",
"see",
"if",
"the",
"two",
"values",
"provided",
"are",
"equal",
".",
"For",
"non",
"-",
"object",
"types",
"this",
"refers",
"to",
"simple",
"equality",
";",
"for",
"object",
"types",
"the",
"two",
"objects",
"mus... | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L96-L120 |
53,705 | chrishayesmu/DubBotBase | src/utils.js | findValueInObject | function findValueInObject(value, object) {
checkHasType(object, "object", "Non-object value provided as second argument to findValueInObject");
checkHasValue(object, "Invalid null object provided as second argument to findValueInObject");
for (var key in object) {
var objValue = object[key];
... | javascript | function findValueInObject(value, object) {
checkHasType(object, "object", "Non-object value provided as second argument to findValueInObject");
checkHasValue(object, "Invalid null object provided as second argument to findValueInObject");
for (var key in object) {
var objValue = object[key];
... | [
"function",
"findValueInObject",
"(",
"value",
",",
"object",
")",
"{",
"checkHasType",
"(",
"object",
",",
"\"object\"",
",",
"\"Non-object value provided as second argument to findValueInObject\"",
")",
";",
"checkHasValue",
"(",
"object",
",",
"\"Invalid null object prov... | Locates the value provided under the first level of keys in the given object.
Since this function uses undefined as a return value when the provided value
is not found, it is not possible to directly search for anything where the key
is actually undefined. Anyone interested in this functionality can easily wrap
this me... | [
"Locates",
"the",
"value",
"provided",
"under",
"the",
"first",
"level",
"of",
"keys",
"in",
"the",
"given",
"object",
".",
"Since",
"this",
"function",
"uses",
"undefined",
"as",
"a",
"return",
"value",
"when",
"the",
"provided",
"value",
"is",
"not",
"fo... | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L133-L146 |
53,706 | chrishayesmu/DubBotBase | src/utils.js | getAllFilePathsUnderDirectory | function getAllFilePathsUnderDirectory(directory) {
// TODO: make this run in parallel, async
var filesInBaseDir = fs.readdirSync(directory);
var allFiles = [];
if (!filesInBaseDir) {
return allFiles;
}
for (var i = 0; i < filesInBaseDir.length; i++) {
var filePath = path.reso... | javascript | function getAllFilePathsUnderDirectory(directory) {
// TODO: make this run in parallel, async
var filesInBaseDir = fs.readdirSync(directory);
var allFiles = [];
if (!filesInBaseDir) {
return allFiles;
}
for (var i = 0; i < filesInBaseDir.length; i++) {
var filePath = path.reso... | [
"function",
"getAllFilePathsUnderDirectory",
"(",
"directory",
")",
"{",
"// TODO: make this run in parallel, async",
"var",
"filesInBaseDir",
"=",
"fs",
".",
"readdirSync",
"(",
"directory",
")",
";",
"var",
"allFiles",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"filesI... | Retrieves all of the file paths which can be found in the base directory
provided. The method recurses through all subdirectories within the base
directory. Only file paths are returned; directories, symbolic links, etc,
are not included.
@param {string} directory - The path (relative or absolute) to the base director... | [
"Retrieves",
"all",
"of",
"the",
"file",
"paths",
"which",
"can",
"be",
"found",
"in",
"the",
"base",
"directory",
"provided",
".",
"The",
"method",
"recurses",
"through",
"all",
"subdirectories",
"within",
"the",
"base",
"directory",
".",
"Only",
"file",
"p... | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L157-L180 |
53,707 | chrishayesmu/DubBotBase | src/utils.js | _checkKeysFromFirstAreInSecond | function _checkKeysFromFirstAreInSecond(first, second) {
for (var key in first) {
if (!(key in second)) {
return false;
}
var value1 = first[key];
var value2 = second[key];
if (!deepEquals(value1, value2)) {
return false;
}
}
return ... | javascript | function _checkKeysFromFirstAreInSecond(first, second) {
for (var key in first) {
if (!(key in second)) {
return false;
}
var value1 = first[key];
var value2 = second[key];
if (!deepEquals(value1, value2)) {
return false;
}
}
return ... | [
"function",
"_checkKeysFromFirstAreInSecond",
"(",
"first",
",",
"second",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"first",
")",
"{",
"if",
"(",
"!",
"(",
"key",
"in",
"second",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"value1",
"=",
"fir... | Checks that the keys which are in the first object are also in the second object,
and that they have the same value in both places.
@param {object} first - The first object to check
@param {object} second - The second object to check
@returns {boolean} True if all of the keys from the first are present and equal in th... | [
"Checks",
"that",
"the",
"keys",
"which",
"are",
"in",
"the",
"first",
"object",
"are",
"also",
"in",
"the",
"second",
"object",
"and",
"that",
"they",
"have",
"the",
"same",
"value",
"in",
"both",
"places",
"."
] | 0e4b5e65531c23293d22ac766850c802b1266e48 | https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L210-L225 |
53,708 | Val-istar-Guo/koa-ajax-params | src/index.js | getBody | function getBody(req) {
return new Promise((resolve, reject) => {
let data = '';
req
.on('data', (chunk) => {
data += chunk;
})
.on('end', () => {
resolve(data);
})
.on('error', reject);
});
} | javascript | function getBody(req) {
return new Promise((resolve, reject) => {
let data = '';
req
.on('data', (chunk) => {
data += chunk;
})
.on('end', () => {
resolve(data);
})
.on('error', reject);
});
} | [
"function",
"getBody",
"(",
"req",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"data",
"=",
"''",
";",
"req",
".",
"on",
"(",
"'data'",
",",
"(",
"chunk",
")",
"=>",
"{",
"data",
"+=",
"chunk",... | import querystring from 'querystring'; | [
"import",
"querystring",
"from",
"querystring",
";"
] | 2f51b918421709479469f1e8908917ede25eb306 | https://github.com/Val-istar-Guo/koa-ajax-params/blob/2f51b918421709479469f1e8908917ede25eb306/src/index.js#L4-L16 |
53,709 | CleverStack/clever-accounts | controllers/AccountController.js | function(req, res, next) {
var accData = req.user.Account
, newData = {
name: req.body.name || accData.name,
logo: req.body.logo || accData.logo,
info: req.body.info || accData.info,
email: req.body.email || accData.emai... | javascript | function(req, res, next) {
var accData = req.user.Account
, newData = {
name: req.body.name || accData.name,
logo: req.body.logo || accData.logo,
info: req.body.info || accData.info,
email: req.body.email || accData.emai... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"accData",
"=",
"req",
".",
"user",
".",
"Account",
",",
"newData",
"=",
"{",
"name",
":",
"req",
".",
"body",
".",
"name",
"||",
"accData",
".",
"name",
",",
"logo",
":",
"req",
... | Middleware helper function to format data in POST or PUT requests
@param {Request} req The Request Object
@param {Response} res The response object
@param {Function} next Continue past this middleware
@return {void} | [
"Middleware",
"helper",
"function",
"to",
"format",
"data",
"in",
"POST",
"or",
"PUT",
"requests"
] | d9e136eef41ebd92884bc13d017ba8f5f66e5c67 | https://github.com/CleverStack/clever-accounts/blob/d9e136eef41ebd92884bc13d017ba8f5f66e5c67/controllers/AccountController.js#L36-L48 | |
53,710 | CleverStack/clever-accounts | controllers/AccountController.js | function(req, res, next){
var subdomain = req.body.subdomain;
if (!subdomain) {
return res.json(400, 'Company subdomain is mandatory!');
}
AccountService
.find({
where: {
subdomain: subdomain
}
})
.then(function(result){
... | javascript | function(req, res, next){
var subdomain = req.body.subdomain;
if (!subdomain) {
return res.json(400, 'Company subdomain is mandatory!');
}
AccountService
.find({
where: {
subdomain: subdomain
}
})
.then(function(result){
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"subdomain",
"=",
"req",
".",
"body",
".",
"subdomain",
";",
"if",
"(",
"!",
"subdomain",
")",
"{",
"return",
"res",
".",
"json",
"(",
"400",
",",
"'Company subdomain is mandatory!'",
")... | Middleware helper function for requiring a unique subDomain for a given POST request
@param {Request} req The Request Object
@param {Response} res The response object
@param {Function} next Continue past this middleware
@return {void} | [
"Middleware",
"helper",
"function",
"for",
"requiring",
"a",
"unique",
"subDomain",
"for",
"a",
"given",
"POST",
"request"
] | d9e136eef41ebd92884bc13d017ba8f5f66e5c67 | https://github.com/CleverStack/clever-accounts/blob/d9e136eef41ebd92884bc13d017ba8f5f66e5c67/controllers/AccountController.js#L58-L80 | |
53,711 | liymax/pddux | lib/index.js | finalize | function finalize(base, path, patches, inversePatches) {
if (isProxy(base)) {
var state = base[PROXY_STATE];
if (state.modified === true) {
if (state.finalized === true) return state.copy;
state.finalized = true;
var result = finalizeObject(useProxies ... | javascript | function finalize(base, path, patches, inversePatches) {
if (isProxy(base)) {
var state = base[PROXY_STATE];
if (state.modified === true) {
if (state.finalized === true) return state.copy;
state.finalized = true;
var result = finalizeObject(useProxies ... | [
"function",
"finalize",
"(",
"base",
",",
"path",
",",
"patches",
",",
"inversePatches",
")",
"{",
"if",
"(",
"isProxy",
"(",
"base",
")",
")",
"{",
"var",
"state",
"=",
"base",
"[",
"PROXY_STATE",
"]",
";",
"if",
"(",
"state",
".",
"modified",
"==="... | given a base object, returns it if unmodified, or return the changed cloned if modified | [
"given",
"a",
"base",
"object",
"returns",
"it",
"if",
"unmodified",
"or",
"return",
"the",
"changed",
"cloned",
"if",
"modified"
] | cb1c8c74e5d32bbd9802eb2248cd9bcab8518749 | https://github.com/liymax/pddux/blob/cb1c8c74e5d32bbd9802eb2248cd9bcab8518749/lib/index.js#L167-L182 |
53,712 | liymax/pddux | lib/index.js | produce | function produce(baseState, producer, patchListener) {
// prettier-ignore
if (arguments.length < 1 || arguments.length > 3) throw new Error("produce expects 1 to 3 arguments, got " + arguments.length);
// curried invocation
if (typeof baseState === "function") {
// prettier-ignore
... | javascript | function produce(baseState, producer, patchListener) {
// prettier-ignore
if (arguments.length < 1 || arguments.length > 3) throw new Error("produce expects 1 to 3 arguments, got " + arguments.length);
// curried invocation
if (typeof baseState === "function") {
// prettier-ignore
... | [
"function",
"produce",
"(",
"baseState",
",",
"producer",
",",
"patchListener",
")",
"{",
"// prettier-ignore",
"if",
"(",
"arguments",
".",
"length",
"<",
"1",
"||",
"arguments",
".",
"length",
">",
"3",
")",
"throw",
"new",
"Error",
"(",
"\"produce expects... | produce takes a state, and runs a function against it.
That function can freely mutate the state, as it will create copies-on-write.
This means that the original state will stay unchanged, and once the function finishes, the modified state is returned
@export
@param {any} baseState - the state to start with
@param {Fu... | [
"produce",
"takes",
"a",
"state",
"and",
"runs",
"a",
"function",
"against",
"it",
".",
"That",
"function",
"can",
"freely",
"mutate",
"the",
"state",
"as",
"it",
"will",
"create",
"copies",
"-",
"on",
"-",
"write",
".",
"This",
"means",
"that",
"the",
... | cb1c8c74e5d32bbd9802eb2248cd9bcab8518749 | https://github.com/liymax/pddux/blob/cb1c8c74e5d32bbd9802eb2248cd9bcab8518749/lib/index.js#L639-L677 |
53,713 | lesx/lesx-jsx | lib/babel-core/src/config/option-manager.js | mergeOptions | function mergeOptions(config, pass) {
var _this = this;
var result = loadConfig(config);
var plugins = result.plugins.map(function (descriptor) {
return loadPluginDescriptor(descriptor);
});
var presets = result.presets.map(function (descriptor) {
return loadPresetDescrip... | javascript | function mergeOptions(config, pass) {
var _this = this;
var result = loadConfig(config);
var plugins = result.plugins.map(function (descriptor) {
return loadPluginDescriptor(descriptor);
});
var presets = result.presets.map(function (descriptor) {
return loadPresetDescrip... | [
"function",
"mergeOptions",
"(",
"config",
",",
"pass",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"result",
"=",
"loadConfig",
"(",
"config",
")",
";",
"var",
"plugins",
"=",
"result",
".",
"plugins",
".",
"map",
"(",
"function",
"(",
"descrip... | This is called when we want to merge the input `opts` into the
base options.
- `alias` is used to output pretty traces back to the original source.
- `loc` is used to point to the original config.
- `dirname` is used to resolve plugins relative to it. | [
"This",
"is",
"called",
"when",
"we",
"want",
"to",
"merge",
"the",
"input",
"opts",
"into",
"the",
"base",
"options",
"."
] | 6b82f5ee115add3fb61b83c8e22e83fad66ad437 | https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L143-L188 |
53,714 | lesx/lesx-jsx | lib/babel-core/src/config/option-manager.js | loadConfig | function loadConfig(config) {
var options = normalizeOptions(config);
if (config.options.plugins != null && !Array.isArray(config.options.plugins)) {
throw new Error(".plugins should be an array, null, or undefined");
}
var plugins = (config.options.plugins || []).map(function (plugin, index) {
var _n... | javascript | function loadConfig(config) {
var options = normalizeOptions(config);
if (config.options.plugins != null && !Array.isArray(config.options.plugins)) {
throw new Error(".plugins should be an array, null, or undefined");
}
var plugins = (config.options.plugins || []).map(function (plugin, index) {
var _n... | [
"function",
"loadConfig",
"(",
"config",
")",
"{",
"var",
"options",
"=",
"normalizeOptions",
"(",
"config",
")",
";",
"if",
"(",
"config",
".",
"options",
".",
"plugins",
"!=",
"null",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"config",
".",
"options",
... | Load and validate the given config into a set of options, plugins, and presets. | [
"Load",
"and",
"validate",
"the",
"given",
"config",
"into",
"a",
"set",
"of",
"options",
"plugins",
"and",
"presets",
"."
] | 6b82f5ee115add3fb61b83c8e22e83fad66ad437 | https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L281-L323 |
53,715 | lesx/lesx-jsx | lib/babel-core/src/config/option-manager.js | loadPresetDescriptor | function loadPresetDescriptor(descriptor) {
return {
type: "preset",
options: loadDescriptor(descriptor).value,
alias: descriptor.alias,
loc: descriptor.loc,
dirname: descriptor.dirname
};
} | javascript | function loadPresetDescriptor(descriptor) {
return {
type: "preset",
options: loadDescriptor(descriptor).value,
alias: descriptor.alias,
loc: descriptor.loc,
dirname: descriptor.dirname
};
} | [
"function",
"loadPresetDescriptor",
"(",
"descriptor",
")",
"{",
"return",
"{",
"type",
":",
"\"preset\"",
",",
"options",
":",
"loadDescriptor",
"(",
"descriptor",
")",
".",
"value",
",",
"alias",
":",
"descriptor",
".",
"alias",
",",
"loc",
":",
"descripto... | Generate a config object that will act as the root of a new nested config. | [
"Generate",
"a",
"config",
"object",
"that",
"will",
"act",
"as",
"the",
"root",
"of",
"a",
"new",
"nested",
"config",
"."
] | 6b82f5ee115add3fb61b83c8e22e83fad66ad437 | https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L419-L427 |
53,716 | karfcz/kff | src/View.js | function(options)
{
options = options || {};
this._modelBindersMap = null;
this._collectionBinder = null;
this._bindingIndex = null;
this._itemAlias = null;
this._subviewsStruct = null;
this._explicitSubviewsStruct = null;
this._pendingRefresh = false;
this._pendingRefreshRoot = false;
this._subv... | javascript | function(options)
{
options = options || {};
this._modelBindersMap = null;
this._collectionBinder = null;
this._bindingIndex = null;
this._itemAlias = null;
this._subviewsStruct = null;
this._explicitSubviewsStruct = null;
this._pendingRefresh = false;
this._pendingRefreshRoot = false;
this._subv... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_modelBindersMap",
"=",
"null",
";",
"this",
".",
"_collectionBinder",
"=",
"null",
";",
"this",
".",
"_bindingIndex",
"=",
"null",
";",
"this",
".",
"_... | Base class for views
@constructs
@param {Object} options Options object
@param {DOM Element|jQuery} options.element A DOM element that will be a root element of the view
@param {Array} options.scope Array of model instances to be used by the view | [
"Base",
"class",
"for",
"views"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L90-L165 | |
53,717 | karfcz/kff | src/View.js | function()
{
if(!this._modelBindersMap) this._initBinding();
if(!this._collectionBinder)
{
this._explicitSubviewsStruct = null;
if(this._template) this.element.innerHTML = this._template;
if(this.render !== noop) this.render();
this.renderSubviews();
}
} | javascript | function()
{
if(!this._modelBindersMap) this._initBinding();
if(!this._collectionBinder)
{
this._explicitSubviewsStruct = null;
if(this._template) this.element.innerHTML = this._template;
if(this.render !== noop) this.render();
this.renderSubviews();
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_modelBindersMap",
")",
"this",
".",
"_initBinding",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"_collectionBinder",
")",
"{",
"this",
".",
"_explicitSubviewsStruct",
"=",
"null",
";",
"if",
"("... | Renders the view. It will be called automatically. Should not be called
directly. | [
"Renders",
"the",
"view",
".",
"It",
"will",
"be",
"called",
"automatically",
".",
"Should",
"not",
"be",
"called",
"directly",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L208-L220 | |
53,718 | karfcz/kff | src/View.js | function()
{
if(this._isRunning && !this._isSuspended)
{
var shouldRefresh = true;
if(typeof this.shouldRefresh === 'function') shouldRefresh = this.shouldRefresh();
if(shouldRefresh)
{
if(typeof this.refresh === 'function') this.refresh();
if(this._collectionBinder)
{
this._collection... | javascript | function()
{
if(this._isRunning && !this._isSuspended)
{
var shouldRefresh = true;
if(typeof this.shouldRefresh === 'function') shouldRefresh = this.shouldRefresh();
if(shouldRefresh)
{
if(typeof this.refresh === 'function') this.refresh();
if(this._collectionBinder)
{
this._collection... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_isRunning",
"&&",
"!",
"this",
".",
"_isSuspended",
")",
"{",
"var",
"shouldRefresh",
"=",
"true",
";",
"if",
"(",
"typeof",
"this",
".",
"shouldRefresh",
"===",
"'function'",
")",
"shouldRefresh",
"="... | Refreshes all binders, subviews and bound views | [
"Refreshes",
"all",
"binders",
"subviews",
"and",
"bound",
"views"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L350-L376 | |
53,719 | karfcz/kff | src/View.js | function()
{
var view = this;
while(view.parentView)
{
view = view.parentView;
}
if(view.dispatcher !== null)
{
view.dispatcher.trigger({ type: 'refresh' });
this._pendingRefreshRoot = false;
}
} | javascript | function()
{
var view = this;
while(view.parentView)
{
view = view.parentView;
}
if(view.dispatcher !== null)
{
view.dispatcher.trigger({ type: 'refresh' });
this._pendingRefreshRoot = false;
}
} | [
"function",
"(",
")",
"{",
"var",
"view",
"=",
"this",
";",
"while",
"(",
"view",
".",
"parentView",
")",
"{",
"view",
"=",
"view",
".",
"parentView",
";",
"}",
"if",
"(",
"view",
".",
"dispatcher",
"!==",
"null",
")",
"{",
"view",
".",
"dispatcher... | Refreshes all views from root | [
"Refreshes",
"all",
"views",
"from",
"root"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L381-L394 | |
53,720 | karfcz/kff | src/View.js | function()
{
this._destroyBinding();
if(this._collectionBinder) this._collectionBinder.destroyBoundViews();
this._modelBindersMap = null;
this._collectionBinder = null;
this._bindingIndex = null;
this._itemAlias = null;
this.element.removeAttribute(settings.DATA_RENDERED_ATTR);
this.undelegateEvents... | javascript | function()
{
this._destroyBinding();
if(this._collectionBinder) this._collectionBinder.destroyBoundViews();
this._modelBindersMap = null;
this._collectionBinder = null;
this._bindingIndex = null;
this._itemAlias = null;
this.element.removeAttribute(settings.DATA_RENDERED_ATTR);
this.undelegateEvents... | [
"function",
"(",
")",
"{",
"this",
".",
"_destroyBinding",
"(",
")",
";",
"if",
"(",
"this",
".",
"_collectionBinder",
")",
"this",
".",
"_collectionBinder",
".",
"destroyBoundViews",
"(",
")",
";",
"this",
".",
"_modelBindersMap",
"=",
"null",
";",
"this"... | Destroys the view (destroys all subviews and unbinds previously bound DOM events.
It will be called automatically. Should not be called directly. | [
"Destroys",
"the",
"view",
"(",
"destroys",
"all",
"subviews",
"and",
"unbinds",
"previously",
"bound",
"DOM",
"events",
".",
"It",
"will",
"be",
"called",
"automatically",
".",
"Should",
"not",
"be",
"called",
"directly",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L400-L431 | |
53,721 | karfcz/kff | src/View.js | function()
{
if(this._collectionBinder)
{
this._collectionBinder.destroyBoundViews();
}
else
{
var subView, i, l;
// Destroy subviews
if(this.subviews !== null)
{
for(i = 0, l = this.subviews.length; i < l; i++)
{
subView = this.subviews[i];
subView.destroyAll();
}
}
... | javascript | function()
{
if(this._collectionBinder)
{
this._collectionBinder.destroyBoundViews();
}
else
{
var subView, i, l;
// Destroy subviews
if(this.subviews !== null)
{
for(i = 0, l = this.subviews.length; i < l; i++)
{
subView = this.subviews[i];
subView.destroyAll();
}
}
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_collectionBinder",
")",
"{",
"this",
".",
"_collectionBinder",
".",
"destroyBoundViews",
"(",
")",
";",
"}",
"else",
"{",
"var",
"subView",
",",
"i",
",",
"l",
";",
"// Destroy subviews",
"if",
"(",
... | Destroys the subviews. It will be called automatically. Should not be called directly. | [
"Destroys",
"the",
"subviews",
".",
"It",
"will",
"be",
"called",
"automatically",
".",
"Should",
"not",
"be",
"called",
"directly",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L532-L554 | |
53,722 | karfcz/kff | src/View.js | function(keyPath)
{
if(typeof keyPath === 'string') keyPath = keyPath.split('.');
var rootCursorName = keyPath[0];
keyPath = keyPath.slice(1);
var rootCursor = this.scope[rootCursorName];
if(!(rootCursor instanceof Cursor)) rootCursor = new Cursor(rootCursor, keyPath);
var cursor = rootCursor.refine(keyP... | javascript | function(keyPath)
{
if(typeof keyPath === 'string') keyPath = keyPath.split('.');
var rootCursorName = keyPath[0];
keyPath = keyPath.slice(1);
var rootCursor = this.scope[rootCursorName];
if(!(rootCursor instanceof Cursor)) rootCursor = new Cursor(rootCursor, keyPath);
var cursor = rootCursor.refine(keyP... | [
"function",
"(",
"keyPath",
")",
"{",
"if",
"(",
"typeof",
"keyPath",
"===",
"'string'",
")",
"keyPath",
"=",
"keyPath",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"rootCursorName",
"=",
"keyPath",
"[",
"0",
"]",
";",
"keyPath",
"=",
"keyPath",
".",
... | Returns a model object bound to the view or to the parent view.
Accepts the model name as a string or key path in the form of "modelName.attribute.nextAttribute etc.".
Will search for "modelName" in current view, then in parent view etc. When found, returns a value of
"attribute.nextAtrribute" using model's mget metho... | [
"Returns",
"a",
"model",
"object",
"bound",
"to",
"the",
"view",
"or",
"to",
"the",
"parent",
"view",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L578-L590 | |
53,723 | karfcz/kff | src/View.js | function(events)
{
if(!Array.isArray(events))
{
if(arguments.length === 2 || arguments.length === 3) this.domEvents.push(Array.prototype.slice.apply(arguments));
return;
}
else if(!Array.isArray(events[0]))
{
events = Array.prototype.slice.apply(arguments);
}
Array.prototype.push.apply(this.domE... | javascript | function(events)
{
if(!Array.isArray(events))
{
if(arguments.length === 2 || arguments.length === 3) this.domEvents.push(Array.prototype.slice.apply(arguments));
return;
}
else if(!Array.isArray(events[0]))
{
events = Array.prototype.slice.apply(arguments);
}
Array.prototype.push.apply(this.domE... | [
"function",
"(",
"events",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"events",
")",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"2",
"||",
"arguments",
".",
"length",
"===",
"3",
")",
"this",
".",
"domEvents",
".",
"push",... | Adds events config to the internal events array.
@private
@param {Array} events Array of arrays of binding config | [
"Adds",
"events",
"config",
"to",
"the",
"internal",
"events",
"array",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L598-L610 | |
53,724 | karfcz/kff | src/View.js | function(viewName, options)
{
var subView, args;
if(this._subviewsArgs && Array.isArray(this._subviewsArgs[viewName]))
{
args = this._subviewsArgs[viewName];
if(typeof args[0] === 'object' && args[0] !== null) options = immerge(options, args[0]);
}
options.parentView = this;
if(viewName === 'View'... | javascript | function(viewName, options)
{
var subView, args;
if(this._subviewsArgs && Array.isArray(this._subviewsArgs[viewName]))
{
args = this._subviewsArgs[viewName];
if(typeof args[0] === 'object' && args[0] !== null) options = immerge(options, args[0]);
}
options.parentView = this;
if(viewName === 'View'... | [
"function",
"(",
"viewName",
",",
"options",
")",
"{",
"var",
"subView",
",",
"args",
";",
"if",
"(",
"this",
".",
"_subviewsArgs",
"&&",
"Array",
".",
"isArray",
"(",
"this",
".",
"_subviewsArgs",
"[",
"viewName",
"]",
")",
")",
"{",
"args",
"=",
"t... | Creates a new subview and adds it to the internal subviews list.
Do not use this method directly, use addSubview method instead.
@private
@param {String} viewName Name of the view
@param {Object} options Options object for the subview constructor
@return {View} Created view | [
"Creates",
"a",
"new",
"subview",
"and",
"adds",
"it",
"to",
"the",
"internal",
"subviews",
"list",
".",
"Do",
"not",
"use",
"this",
"method",
"directly",
"use",
"addSubview",
"method",
"instead",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L709-L729 | |
53,725 | karfcz/kff | src/View.js | function(element, viewName, options)
{
if(this._explicitSubviewsStruct === null) this._explicitSubviewsStruct = [];
this._explicitSubviewsStruct.push({
viewName: viewName,
element: element,
options: options || {}
});
} | javascript | function(element, viewName, options)
{
if(this._explicitSubviewsStruct === null) this._explicitSubviewsStruct = [];
this._explicitSubviewsStruct.push({
viewName: viewName,
element: element,
options: options || {}
});
} | [
"function",
"(",
"element",
",",
"viewName",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"_explicitSubviewsStruct",
"===",
"null",
")",
"this",
".",
"_explicitSubviewsStruct",
"=",
"[",
"]",
";",
"this",
".",
"_explicitSubviewsStruct",
".",
"push",
"("... | Adds subview metadata to the internal list. The subviews from this list
are then rendered in renderSubviews method which is automatically called
when the view is rendered.
This method can be used is in the render method to manually create a view
that is not parsed from html/template (for example for an element that
si... | [
"Adds",
"subview",
"metadata",
"to",
"the",
"internal",
"list",
".",
"The",
"subviews",
"from",
"this",
"list",
"are",
"then",
"rendered",
"in",
"renderSubviews",
"method",
"which",
"is",
"automatically",
"called",
"when",
"the",
"view",
"is",
"rendered",
"."
... | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L744-L752 | |
53,726 | karfcz/kff | src/View.js | function(force)
{
if(this._collectionBinder)
{
this._collectionBinder.refreshBinders(force);
}
else
{
this._refreshOwnBinders(force);
if(this.subviews !== null)
{
for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshBinders(force);
}
}
} | javascript | function(force)
{
if(this._collectionBinder)
{
this._collectionBinder.refreshBinders(force);
}
else
{
this._refreshOwnBinders(force);
if(this.subviews !== null)
{
for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshBinders(force);
}
}
} | [
"function",
"(",
"force",
")",
"{",
"if",
"(",
"this",
".",
"_collectionBinder",
")",
"{",
"this",
".",
"_collectionBinder",
".",
"refreshBinders",
"(",
"force",
")",
";",
"}",
"else",
"{",
"this",
".",
"_refreshOwnBinders",
"(",
"force",
")",
";",
"if",... | Refreshes data-binders in all subviews.
@param {Object} event Any event object that caused refreshing | [
"Refreshes",
"data",
"-",
"binders",
"in",
"all",
"subviews",
"."
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L764-L778 | |
53,727 | karfcz/kff | src/View.js | function()
{
if(this._collectionBinder)
{
this._collectionBinder.refreshIndexedBinders();
}
else
{
if(this._modelBindersMap)
{
this._modelBindersMap.refreshIndexedBinders();
}
if(this.subviews !== null)
{
for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshI... | javascript | function()
{
if(this._collectionBinder)
{
this._collectionBinder.refreshIndexedBinders();
}
else
{
if(this._modelBindersMap)
{
this._modelBindersMap.refreshIndexedBinders();
}
if(this.subviews !== null)
{
for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshI... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_collectionBinder",
")",
"{",
"this",
".",
"_collectionBinder",
".",
"refreshIndexedBinders",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"_modelBindersMap",
")",
"{",
"this",
".",
"_modelB... | Refreshes all indexed binders of this view or subviews
@private
@return {[type]} [description] | [
"Refreshes",
"all",
"indexed",
"binders",
"of",
"this",
"view",
"or",
"subviews"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L786-L803 | |
53,728 | karfcz/kff | src/View.js | function()
{
var l;
var clonedSubview;
var options = this.options;
options.parentView = null;
options.env = this.env;
options._clone = true;
var clonedView = new this.constructor(options);
if(this.subviews !== null)
{
l = this.subviews.length;
clonedView.subviews = new Array(l);
while(l--... | javascript | function()
{
var l;
var clonedSubview;
var options = this.options;
options.parentView = null;
options.env = this.env;
options._clone = true;
var clonedView = new this.constructor(options);
if(this.subviews !== null)
{
l = this.subviews.length;
clonedView.subviews = new Array(l);
while(l--... | [
"function",
"(",
")",
"{",
"var",
"l",
";",
"var",
"clonedSubview",
";",
"var",
"options",
"=",
"this",
".",
"options",
";",
"options",
".",
"parentView",
"=",
"null",
";",
"options",
".",
"env",
"=",
"this",
".",
"env",
";",
"options",
".",
"_clone"... | Clones this binding view
@return {View} Cloned view | [
"Clones",
"this",
"binding",
"view"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L888-L941 | |
53,729 | karfcz/kff | src/View.js | function(element)
{
var i, l;
this.element = element;
this._rebindSubViews(element, {
subviewIndex: 0,
subviewsStructIndex: 0,
index: 0
});
if(this._modelBindersMap)
{
this._modelBindersMap.setView(this);
}
if(this._collectionBinder)
{
this._collectionBinder.view = this;
}
} | javascript | function(element)
{
var i, l;
this.element = element;
this._rebindSubViews(element, {
subviewIndex: 0,
subviewsStructIndex: 0,
index: 0
});
if(this._modelBindersMap)
{
this._modelBindersMap.setView(this);
}
if(this._collectionBinder)
{
this._collectionBinder.view = this;
}
} | [
"function",
"(",
"element",
")",
"{",
"var",
"i",
",",
"l",
";",
"this",
".",
"element",
"=",
"element",
";",
"this",
".",
"_rebindSubViews",
"(",
"element",
",",
"{",
"subviewIndex",
":",
"0",
",",
"subviewsStructIndex",
":",
"0",
",",
"index",
":",
... | Rebinds the view to another DOM element
@private
@param {DOMELement} element New DOM element of the view | [
"Rebinds",
"the",
"view",
"to",
"another",
"DOM",
"element"
] | 533b69e8bc9e9b7f60b403d776678bf1c06ac502 | https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L982-L1004 | |
53,730 | binder-project/binder-logging | lib/reader.js | BinderLogReader | function BinderLogReader () {
this.config = defaultConfig
var staticLogsUrl = this.config.host + ':' + this.config.elasticsearch.port
this.client = new elasticsearch.Client({
host: staticLogsUrl,
log: 'error'
})
} | javascript | function BinderLogReader () {
this.config = defaultConfig
var staticLogsUrl = this.config.host + ':' + this.config.elasticsearch.port
this.client = new elasticsearch.Client({
host: staticLogsUrl,
log: 'error'
})
} | [
"function",
"BinderLogReader",
"(",
")",
"{",
"this",
".",
"config",
"=",
"defaultConfig",
"var",
"staticLogsUrl",
"=",
"this",
".",
"config",
".",
"host",
"+",
"':'",
"+",
"this",
".",
"config",
".",
"elasticsearch",
".",
"port",
"this",
".",
"client",
... | Reads or streams Binder log messages, optionally for a specific application
@constructor | [
"Reads",
"or",
"streams",
"Binder",
"log",
"messages",
"optionally",
"for",
"a",
"specific",
"application"
] | e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632 | https://github.com/binder-project/binder-logging/blob/e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632/lib/reader.js#L30-L37 |
53,731 | binder-project/binder-logging | lib/reader.js | function (config) {
if (!config) {
config = defaultConfig
}
var error = validateConfig(config)
if (error) {
}
config = assign(defaultConfig, config)
return new BinderLogReader(config)
} | javascript | function (config) {
if (!config) {
config = defaultConfig
}
var error = validateConfig(config)
if (error) {
}
config = assign(defaultConfig, config)
return new BinderLogReader(config)
} | [
"function",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"config",
")",
"{",
"config",
"=",
"defaultConfig",
"}",
"var",
"error",
"=",
"validateConfig",
"(",
"config",
")",
"if",
"(",
"error",
")",
"{",
"}",
"config",
"=",
"assign",
"(",
"defaultConfig",
... | Returns an instance of BinderLogReader
@param {object} config - BinderLogReader configuration options | [
"Returns",
"an",
"instance",
"of",
"BinderLogReader"
] | e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632 | https://github.com/binder-project/binder-logging/blob/e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632/lib/reader.js#L161-L170 | |
53,732 | AndreasMadsen/steer | lib/extension.js | function(done) {
var source = __dirname + '/background.js';
var dest = self.dir + '/background.js';
fs.readFile(source, 'utf8', function(err, background) {
if (err) return done(err);
// Make background.js connect with the websocke... | javascript | function(done) {
var source = __dirname + '/background.js';
var dest = self.dir + '/background.js';
fs.readFile(source, 'utf8', function(err, background) {
if (err) return done(err);
// Make background.js connect with the websocke... | [
"function",
"(",
"done",
")",
"{",
"var",
"source",
"=",
"__dirname",
"+",
"'/background.js'",
";",
"var",
"dest",
"=",
"self",
".",
"dir",
"+",
"'/background.js'",
";",
"fs",
".",
"readFile",
"(",
"source",
",",
"'utf8'",
",",
"function",
"(",
"err",
... | write background.js the file that connect to the websocket server defined in this file | [
"write",
"background",
".",
"js",
"the",
"file",
"that",
"connect",
"to",
"the",
"websocket",
"server",
"defined",
"in",
"this",
"file"
] | 5f19587abb1d6384bcff3e4bdede1fdce178d7b2 | https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L78-L90 | |
53,733 | AndreasMadsen/steer | lib/extension.js | closeServer | function closeServer(done) {
if (self.server) {
self.server.close();
self.server.removeListener('error', handlers.relayError);
}
self.httpServer.close(done);
} | javascript | function closeServer(done) {
if (self.server) {
self.server.close();
self.server.removeListener('error', handlers.relayError);
}
self.httpServer.close(done);
} | [
"function",
"closeServer",
"(",
"done",
")",
"{",
"if",
"(",
"self",
".",
"server",
")",
"{",
"self",
".",
"server",
".",
"close",
"(",
")",
";",
"self",
".",
"server",
".",
"removeListener",
"(",
"'error'",
",",
"handlers",
".",
"relayError",
")",
"... | close down the the server used for websockets | [
"close",
"down",
"the",
"the",
"server",
"used",
"for",
"websockets"
] | 5f19587abb1d6384bcff3e4bdede1fdce178d7b2 | https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L123-L129 |
53,734 | AndreasMadsen/steer | lib/extension.js | removeExtensionDir | function removeExtensionDir(done) {
if (!self.dir) return done(null);
rimraf(self.dir, done);
} | javascript | function removeExtensionDir(done) {
if (!self.dir) return done(null);
rimraf(self.dir, done);
} | [
"function",
"removeExtensionDir",
"(",
"done",
")",
"{",
"if",
"(",
"!",
"self",
".",
"dir",
")",
"return",
"done",
"(",
"null",
")",
";",
"rimraf",
"(",
"self",
".",
"dir",
",",
"done",
")",
";",
"}"
] | remove extension files | [
"remove",
"extension",
"files"
] | 5f19587abb1d6384bcff3e4bdede1fdce178d7b2 | https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L132-L136 |
53,735 | thlorenz/ispawn | ispawn.js | createAndSpawn | function createAndSpawn(opts) {
const spawned = createSpawn(opts)
const termination = spawned.spawn()
return { termination, proc: spawned.proc }
} | javascript | function createAndSpawn(opts) {
const spawned = createSpawn(opts)
const termination = spawned.spawn()
return { termination, proc: spawned.proc }
} | [
"function",
"createAndSpawn",
"(",
"opts",
")",
"{",
"const",
"spawned",
"=",
"createSpawn",
"(",
"opts",
")",
"const",
"termination",
"=",
"spawned",
".",
"spawn",
"(",
")",
"return",
"{",
"termination",
",",
"proc",
":",
"spawned",
".",
"proc",
"}",
"}... | Spawns a process with the given options allowing to intercept `stdout`
and `stderr` output of the application itself or the underlying process,
i.e. V8 and Node.js messages.
### onStdout and onStderr interceptors
The functions, `onStdout`, `onStderr` called with each line written to the
respective file descriptor hav... | [
"Spawns",
"a",
"process",
"with",
"the",
"given",
"options",
"allowing",
"to",
"intercept",
"stdout",
"and",
"stderr",
"output",
"of",
"the",
"application",
"itself",
"or",
"the",
"underlying",
"process",
"i",
".",
"e",
".",
"V8",
"and",
"Node",
".",
"js",... | 5709839b44764d60f2cd78e1cf78a6a5afed9ac2 | https://github.com/thlorenz/ispawn/blob/5709839b44764d60f2cd78e1cf78a6a5afed9ac2/ispawn.js#L172-L176 |
53,736 | JimmyRobz/mokuai | utils/bool-string-option.js | boolStringOption | function boolStringOption(value){
if(value === 'true' || value === true) return true;
if(value === 'false' || value === false) return false;
return value;
} | javascript | function boolStringOption(value){
if(value === 'true' || value === true) return true;
if(value === 'false' || value === false) return false;
return value;
} | [
"function",
"boolStringOption",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"'true'",
"||",
"value",
"===",
"true",
")",
"return",
"true",
";",
"if",
"(",
"value",
"===",
"'false'",
"||",
"value",
"===",
"false",
")",
"return",
"false",
";",
"re... | Utility function to get the option value from string or boolean value | [
"Utility",
"function",
"to",
"get",
"the",
"option",
"value",
"from",
"string",
"or",
"boolean",
"value"
] | 02ba6dfd6fb61b4a124e15a8252cff7e940132ac | https://github.com/JimmyRobz/mokuai/blob/02ba6dfd6fb61b4a124e15a8252cff7e940132ac/utils/bool-string-option.js#L2-L6 |
53,737 | spacemaus/postvox | vox-server/interchangeserver.js | createExpressAppServer | function createExpressAppServer(app, port) {
return new P(function(resolve, reject) {
var appServer = app.listen(port, function() {
var addr = appServer.address();
resolve({
app: app,
appServer: appServer,
serverUrl: url.format({ protocol: 'http', hostname: addr.address, ... | javascript | function createExpressAppServer(app, port) {
return new P(function(resolve, reject) {
var appServer = app.listen(port, function() {
var addr = appServer.address();
resolve({
app: app,
appServer: appServer,
serverUrl: url.format({ protocol: 'http', hostname: addr.address, ... | [
"function",
"createExpressAppServer",
"(",
"app",
",",
"port",
")",
"{",
"return",
"new",
"P",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"appServer",
"=",
"app",
".",
"listen",
"(",
"port",
",",
"function",
"(",
")",
"{",
"var",
... | Creates an Express app and begins listening on the configured address.
@param {Function} app The express app.
@param {Number} port The port to listen on.
@returns {Promise<Object>}
app_server: The server listening to the given port.
serverUrl: The url to report to clients. | [
"Creates",
"an",
"Express",
"app",
"and",
"begins",
"listening",
"on",
"the",
"configured",
"address",
"."
] | de98e5ed37edaee1b1edadf93e15eb8f8d21f457 | https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-server/interchangeserver.js#L71-L82 |
53,738 | MauroJr/amp | src/encode.js | encode | function encode(args) {
const argc = args.length;
let len = 1;
let off = 0;
var i;
// data length
for (i = 0; i < argc; i += 1) {
len += 4 + args[i].length;
}
// buffer
const buf = Buffer.alloc(len);
// pack meta
buf[off += 1] = (VERSION << 4) | argc;
// pack args
for (i = 0; i < argc;... | javascript | function encode(args) {
const argc = args.length;
let len = 1;
let off = 0;
var i;
// data length
for (i = 0; i < argc; i += 1) {
len += 4 + args[i].length;
}
// buffer
const buf = Buffer.alloc(len);
// pack meta
buf[off += 1] = (VERSION << 4) | argc;
// pack args
for (i = 0; i < argc;... | [
"function",
"encode",
"(",
"args",
")",
"{",
"const",
"argc",
"=",
"args",
".",
"length",
";",
"let",
"len",
"=",
"1",
";",
"let",
"off",
"=",
"0",
";",
"var",
"i",
";",
"// data length",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"argc",
";",
... | Encode `msg` and `args`.
@param {Array} args
@return {Buffer}
@api public | [
"Encode",
"msg",
"and",
"args",
"."
] | 2b7df0bcf91228d02bdd6d6f1e1238743dbbb086 | https://github.com/MauroJr/amp/blob/2b7df0bcf91228d02bdd6d6f1e1238743dbbb086/src/encode.js#L18-L47 |
53,739 | tmpfs/ttycolor | index.js | proxy | function proxy(options, format) {
var tty = options.tty
, method = options.method
, re = /(%[sdj])+/g
, start
, end;
if(arguments.length === 1) {
return method.apply(console, []);
}
var arg, i, replacing, replacements, matches, tag;
replacing = (typeof format === 'string')
&& re.test(f... | javascript | function proxy(options, format) {
var tty = options.tty
, method = options.method
, re = /(%[sdj])+/g
, start
, end;
if(arguments.length === 1) {
return method.apply(console, []);
}
var arg, i, replacing, replacements, matches, tag;
replacing = (typeof format === 'string')
&& re.test(f... | [
"function",
"proxy",
"(",
"options",
",",
"format",
")",
"{",
"var",
"tty",
"=",
"options",
".",
"tty",
",",
"method",
"=",
"options",
".",
"method",
",",
"re",
"=",
"/",
"(%[sdj])+",
"/",
"g",
",",
"start",
",",
"end",
";",
"if",
"(",
"arguments",... | Escapes replacement values.
@param options Proxy configuration options.
@param options.tty A boolean indicating whether the output is a tty.
@param options.method A method to proxy to.
@param options.stream A writable stream to write to.
@param format The format string.
@param ... The format string arguments. | [
"Escapes",
"replacement",
"values",
"."
] | 4b72de7f61bfd922f227f3f4e7c61fb95ff9c023 | https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L23-L92 |
53,740 | tmpfs/ttycolor | index.js | format | function format(fmt) {
var args = [].slice.call(arguments, 0);
var tty = true;
var test = (typeof fmt === 'function') ? fmt : null;
if(test) {
tty = test();
args.shift();
}
args.unshift({scope: util, method: util.format, tty: tty});
//console.dir(args);
return proxy.apply(null, args);
} | javascript | function format(fmt) {
var args = [].slice.call(arguments, 0);
var tty = true;
var test = (typeof fmt === 'function') ? fmt : null;
if(test) {
tty = test();
args.shift();
}
args.unshift({scope: util, method: util.format, tty: tty});
//console.dir(args);
return proxy.apply(null, args);
} | [
"function",
"format",
"(",
"fmt",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"var",
"tty",
"=",
"true",
";",
"var",
"test",
"=",
"(",
"typeof",
"fmt",
"===",
"'function'",
")",
"?",
... | Retrieve a formatted string. | [
"Retrieve",
"a",
"formatted",
"string",
"."
] | 4b72de7f61bfd922f227f3f4e7c61fb95ff9c023 | https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L150-L161 |
53,741 | tmpfs/ttycolor | index.js | main | function main(option, parser, force) {
if(typeof option === 'function') {
parser = option;
option = null;
}
if(option !== false) {
option = option || parse.option;
parser = parser || parse;
}
//var mode = parse.auto;
if(typeof parser === 'function') {
module.exports.mode = parser(parse.m... | javascript | function main(option, parser, force) {
if(typeof option === 'function') {
parser = option;
option = null;
}
if(option !== false) {
option = option || parse.option;
parser = parser || parse;
}
//var mode = parse.auto;
if(typeof parser === 'function') {
module.exports.mode = parser(parse.m... | [
"function",
"main",
"(",
"option",
",",
"parser",
",",
"force",
")",
"{",
"if",
"(",
"typeof",
"option",
"===",
"'function'",
")",
"{",
"parser",
"=",
"option",
";",
"option",
"=",
"null",
";",
"}",
"if",
"(",
"option",
"!==",
"false",
")",
"{",
"o... | Module main entry point to initialize
console method overrides.
@param option The option name to use when parsing
command line argments.
@param parser The command line parser implementation.
@param force Force initialization. | [
"Module",
"main",
"entry",
"point",
"to",
"initialize",
"console",
"method",
"overrides",
"."
] | 4b72de7f61bfd922f227f3f4e7c61fb95ff9c023 | https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L201-L216 |
53,742 | samsonjs/gitter | lib/index.js | camel | function camel(s) {
return s.replace(/_(.)/g, function(_, l) { return l.toUpperCase() })
} | javascript | function camel(s) {
return s.replace(/_(.)/g, function(_, l) { return l.toUpperCase() })
} | [
"function",
"camel",
"(",
"s",
")",
"{",
"return",
"s",
".",
"replace",
"(",
"/",
"_(.)",
"/",
"g",
",",
"function",
"(",
"_",
",",
"l",
")",
"{",
"return",
"l",
".",
"toUpperCase",
"(",
")",
"}",
")",
"}"
] | created_at => createdAt | [
"created_at",
"=",
">",
"createdAt"
] | ac9f2f618154f03b68a8b49addd28cfd55a260bc | https://github.com/samsonjs/gitter/blob/ac9f2f618154f03b68a8b49addd28cfd55a260bc/lib/index.js#L455-L457 |
53,743 | samsonjs/gitter | lib/index.js | camelize | function camelize(obj) {
if (!obj || typeof obj === 'string') return obj
if (Array.isArray(obj)) return obj.map(camelize)
if (typeof obj === 'object') {
return Object.keys(obj).reduce(function(camelizedObj, k) {
camelizedObj[camel(k)] = camelize(obj[k])
return camelizedObj
}, {})... | javascript | function camelize(obj) {
if (!obj || typeof obj === 'string') return obj
if (Array.isArray(obj)) return obj.map(camelize)
if (typeof obj === 'object') {
return Object.keys(obj).reduce(function(camelizedObj, k) {
camelizedObj[camel(k)] = camelize(obj[k])
return camelizedObj
}, {})... | [
"function",
"camelize",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"typeof",
"obj",
"===",
"'string'",
")",
"return",
"obj",
"if",
"(",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"return",
"obj",
".",
"map",
"(",
"camelize",
")",
"if",
... | camelize all keys of an object, or all objects in an array | [
"camelize",
"all",
"keys",
"of",
"an",
"object",
"or",
"all",
"objects",
"in",
"an",
"array"
] | ac9f2f618154f03b68a8b49addd28cfd55a260bc | https://github.com/samsonjs/gitter/blob/ac9f2f618154f03b68a8b49addd28cfd55a260bc/lib/index.js#L460-L470 |
53,744 | MD4/potato-masher | lib/map.js | _mainMap | function _mainMap(data, schema, options) {
options = options || {};
var mapping = _map(data, schema, options);
if (options.removeChanged) {
var mappedFields = _getMappedFields(schema);
mappedFields.forEach(function (field) {
_removeMappedFields(mapping, field);
});
... | javascript | function _mainMap(data, schema, options) {
options = options || {};
var mapping = _map(data, schema, options);
if (options.removeChanged) {
var mappedFields = _getMappedFields(schema);
mappedFields.forEach(function (field) {
_removeMappedFields(mapping, field);
});
... | [
"function",
"_mainMap",
"(",
"data",
",",
"schema",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"mapping",
"=",
"_map",
"(",
"data",
",",
"schema",
",",
"options",
")",
";",
"if",
"(",
"options",
".",
"removeChang... | Main map function
Returns a new object with its new aspect given by the schema
@param data
@param schema
@param options
@returns {*}
@private | [
"Main",
"map",
"function",
"Returns",
"a",
"new",
"object",
"with",
"its",
"new",
"aspect",
"given",
"by",
"the",
"schema"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L20-L31 |
53,745 | MD4/potato-masher | lib/map.js | _map | function _map(data, schema, options) {
options = options || {};
if (!schema || data === null) {
return data;
}
if (schema instanceof Array) {
return _mapArray(data, schema, options);
}
if (typeof schema === 'object') {
return _mapObject(data, schema, options);
}
r... | javascript | function _map(data, schema, options) {
options = options || {};
if (!schema || data === null) {
return data;
}
if (schema instanceof Array) {
return _mapArray(data, schema, options);
}
if (typeof schema === 'object') {
return _mapObject(data, schema, options);
}
r... | [
"function",
"_map",
"(",
"data",
",",
"schema",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"schema",
"||",
"data",
"===",
"null",
")",
"{",
"return",
"data",
";",
"}",
"if",
"(",
"schema",
"instanceof"... | Returns a new object with its new aspect given by the schema
@param data Object to map
@param schema Fields to map
@param options Options
@returns {*}
@private | [
"Returns",
"a",
"new",
"object",
"with",
"its",
"new",
"aspect",
"given",
"by",
"the",
"schema"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L41-L53 |
53,746 | MD4/potato-masher | lib/map.js | _removeMappedFields | function _removeMappedFields(mapping, path) {
if (typeof path === 'number') {
delete mapping[path];
return mapping;
}
var keys = path.split(_separator);
if (keys.length <= 1) {
delete mapping[path];
return mapping;
}
return _removeMappedFields(
mapping[pat... | javascript | function _removeMappedFields(mapping, path) {
if (typeof path === 'number') {
delete mapping[path];
return mapping;
}
var keys = path.split(_separator);
if (keys.length <= 1) {
delete mapping[path];
return mapping;
}
return _removeMappedFields(
mapping[pat... | [
"function",
"_removeMappedFields",
"(",
"mapping",
",",
"path",
")",
"{",
"if",
"(",
"typeof",
"path",
"===",
"'number'",
")",
"{",
"delete",
"mapping",
"[",
"path",
"]",
";",
"return",
"mapping",
";",
"}",
"var",
"keys",
"=",
"path",
".",
"split",
"("... | !! Function with side effects !!
Removes given fields of a dataset
@param mapping Data to clean
@param path Path to field to delete
@returns {*}
@private | [
"!!",
"Function",
"with",
"side",
"effects",
"!!",
"Removes",
"given",
"fields",
"of",
"a",
"dataset"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L93-L109 |
53,747 | MD4/potato-masher | lib/map.js | _getMappedFields | function _getMappedFields(schema) {
if (schema === undefined ||
schema === null) {
return;
}
if (schema instanceof Array) {
return schema
.reduce(function (memo, key) {
var mappedField = _getMappedFields(key);
if (mappedField !== undefined)... | javascript | function _getMappedFields(schema) {
if (schema === undefined ||
schema === null) {
return;
}
if (schema instanceof Array) {
return schema
.reduce(function (memo, key) {
var mappedField = _getMappedFields(key);
if (mappedField !== undefined)... | [
"function",
"_getMappedFields",
"(",
"schema",
")",
"{",
"if",
"(",
"schema",
"===",
"undefined",
"||",
"schema",
"===",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"schema",
"instanceof",
"Array",
")",
"{",
"return",
"schema",
".",
"reduce",
"(",
... | Returns the fields which are used in the final object
@param schema Target schema
@returns {*}
@private | [
"Returns",
"the",
"fields",
"which",
"are",
"used",
"in",
"the",
"final",
"object"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L117-L147 |
53,748 | MD4/potato-masher | lib/map.js | _mapArray | function _mapArray(data, schema, options) {
var base = [];
if (data instanceof Array && options.keep) {
base = _clone(data);
}
if (typeof data === 'object' && options.keep) {
base = Object
.keys(data)
.map(function(key) {
return data[key];
... | javascript | function _mapArray(data, schema, options) {
var base = [];
if (data instanceof Array && options.keep) {
base = _clone(data);
}
if (typeof data === 'object' && options.keep) {
base = Object
.keys(data)
.map(function(key) {
return data[key];
... | [
"function",
"_mapArray",
"(",
"data",
",",
"schema",
",",
"options",
")",
"{",
"var",
"base",
"=",
"[",
"]",
";",
"if",
"(",
"data",
"instanceof",
"Array",
"&&",
"options",
".",
"keep",
")",
"{",
"base",
"=",
"_clone",
"(",
"data",
")",
";",
"}",
... | Returns a new object with its new aspect from an array schema
@param data Object to map
@param schema Fields to map
@param options Options
@returns {*}
@private | [
"Returns",
"a",
"new",
"object",
"with",
"its",
"new",
"aspect",
"from",
"an",
"array",
"schema"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L157-L174 |
53,749 | MD4/potato-masher | lib/map.js | _mapObject | function _mapObject(data, schema, options) {
return Object
.keys(schema)
.reduce(function (memo, key) {
memo[key] = _mapDataValue(data, schema[key]);
return memo;
}, options.keep ? _clone(data) : {});
} | javascript | function _mapObject(data, schema, options) {
return Object
.keys(schema)
.reduce(function (memo, key) {
memo[key] = _mapDataValue(data, schema[key]);
return memo;
}, options.keep ? _clone(data) : {});
} | [
"function",
"_mapObject",
"(",
"data",
",",
"schema",
",",
"options",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"schema",
")",
".",
"reduce",
"(",
"function",
"(",
"memo",
",",
"key",
")",
"{",
"memo",
"[",
"key",
"]",
"=",
"_mapDataValue",
"("... | Returns a new object with its new aspect from an object schema
@param data Object to map
@param schema Fields to map
@param options Options
@returns {*}
@private | [
"Returns",
"a",
"new",
"object",
"with",
"its",
"new",
"aspect",
"from",
"an",
"object",
"schema"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L184-L191 |
53,750 | MD4/potato-masher | lib/map.js | _mapDataValue | function _mapDataValue(data, nestedSchema) {
if (typeof nestedSchema === 'function') {
return nestedSchema.apply(data);
} else if (typeof nestedSchema === 'object') {
return _map(data, nestedSchema);
} else {
return _getDataValue(data, nestedSchema);
}
} | javascript | function _mapDataValue(data, nestedSchema) {
if (typeof nestedSchema === 'function') {
return nestedSchema.apply(data);
} else if (typeof nestedSchema === 'object') {
return _map(data, nestedSchema);
} else {
return _getDataValue(data, nestedSchema);
}
} | [
"function",
"_mapDataValue",
"(",
"data",
",",
"nestedSchema",
")",
"{",
"if",
"(",
"typeof",
"nestedSchema",
"===",
"'function'",
")",
"{",
"return",
"nestedSchema",
".",
"apply",
"(",
"data",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"nestedSchema",
"=... | Returns the value of an object from a nested schema
@param data Object to map
@param nestedSchema Path to value, function to execute or nested schema
@returns {*}
@private | [
"Returns",
"the",
"value",
"of",
"an",
"object",
"from",
"a",
"nested",
"schema"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L200-L208 |
53,751 | MD4/potato-masher | lib/map.js | _getDataValue | function _getDataValue(data, path) {
if (data === undefined) {
return undefined;
}
if (typeof path === 'number') {
return data[path];
}
if (typeof path === 'string') {
var keys = path.split(_separator);
if (keys.length <= 1) {
return data[keys[0]];
... | javascript | function _getDataValue(data, path) {
if (data === undefined) {
return undefined;
}
if (typeof path === 'number') {
return data[path];
}
if (typeof path === 'string') {
var keys = path.split(_separator);
if (keys.length <= 1) {
return data[keys[0]];
... | [
"function",
"_getDataValue",
"(",
"data",
",",
"path",
")",
"{",
"if",
"(",
"data",
"===",
"undefined",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"typeof",
"path",
"===",
"'number'",
")",
"{",
"return",
"data",
"[",
"path",
"]",
";",
"}",... | Returns the value of an object from its path
@param data Object to map
@param path Path to value in object
@returns {*}
@private | [
"Returns",
"the",
"value",
"of",
"an",
"object",
"from",
"its",
"path"
] | 88e21a45350e7204f4102e7186c5beaa8753bd7f | https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L217-L237 |
53,752 | linyngfly/omelo | lib/server/server.js | function (app) {
let p = pathUtil.getCronPath(app.getBase(), app.getServerType());
if (p) {
return Loader.load(p, app);
}
} | javascript | function (app) {
let p = pathUtil.getCronPath(app.getBase(), app.getServerType());
if (p) {
return Loader.load(p, app);
}
} | [
"function",
"(",
"app",
")",
"{",
"let",
"p",
"=",
"pathUtil",
".",
"getCronPath",
"(",
"app",
".",
"getBase",
"(",
")",
",",
"app",
".",
"getServerType",
"(",
")",
")",
";",
"if",
"(",
"p",
")",
"{",
"return",
"Loader",
".",
"load",
"(",
"p",
... | Load cron handlers from current application | [
"Load",
"cron",
"handlers",
"from",
"current",
"application"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L194-L199 | |
53,753 | linyngfly/omelo | lib/server/server.js | function (server, app) {
let env = app.get(Constants.RESERVED.ENV);
let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
if (!fs.existsSync(p)) {
p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON));
if (!f... | javascript | function (server, app) {
let env = app.get(Constants.RESERVED.ENV);
let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
if (!fs.existsSync(p)) {
p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON));
if (!f... | [
"function",
"(",
"server",
",",
"app",
")",
"{",
"let",
"env",
"=",
"app",
".",
"get",
"(",
"Constants",
".",
"RESERVED",
".",
"ENV",
")",
";",
"let",
"p",
"=",
"path",
".",
"join",
"(",
"app",
".",
"getBase",
"(",
")",
",",
"app",
".",
"get",
... | Load crons from configure file | [
"Load",
"crons",
"from",
"configure",
"file"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L204-L229 | |
53,754 | linyngfly/omelo | lib/server/server.js | function (isGlobal, server, err, msg, session, resp, opts, cb) {
let fm;
if (isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if (fm) {
if (isGlobal) {
fm.afterFilter(err, msg, session, resp, function () {
// do nothing
});
} else {
f... | javascript | function (isGlobal, server, err, msg, session, resp, opts, cb) {
let fm;
if (isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if (fm) {
if (isGlobal) {
fm.afterFilter(err, msg, session, resp, function () {
// do nothing
});
} else {
f... | [
"function",
"(",
"isGlobal",
",",
"server",
",",
"err",
",",
"msg",
",",
"session",
",",
"resp",
",",
"opts",
",",
"cb",
")",
"{",
"let",
"fm",
";",
"if",
"(",
"isGlobal",
")",
"{",
"fm",
"=",
"server",
".",
"globalFilterService",
";",
"}",
"else",... | Fire after filter chain if have | [
"Fire",
"after",
"filter",
"chain",
"if",
"have"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L251-L269 | |
53,755 | linyngfly/omelo | lib/server/server.js | function (isGlobal, server, err, msg, session, resp, opts, cb) {
let handler;
if (isGlobal) {
handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
} else {
handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
}
if (!handler) {
logger.debug('no default error handler to resolve ... | javascript | function (isGlobal, server, err, msg, session, resp, opts, cb) {
let handler;
if (isGlobal) {
handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
} else {
handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
}
if (!handler) {
logger.debug('no default error handler to resolve ... | [
"function",
"(",
"isGlobal",
",",
"server",
",",
"err",
",",
"msg",
",",
"session",
",",
"resp",
",",
"opts",
",",
"cb",
")",
"{",
"let",
"handler",
";",
"if",
"(",
"isGlobal",
")",
"{",
"handler",
"=",
"server",
".",
"app",
".",
"get",
"(",
"Con... | pass err to the global error handler if specified | [
"pass",
"err",
"to",
"the",
"global",
"error",
"handler",
"if",
"specified"
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L274-L291 | |
53,756 | linyngfly/omelo | lib/server/server.js | function (route) {
if (!route) {
return null;
}
let ts = route.split('.');
if (ts.length !== 3) {
return null;
}
return {
route: route,
serverType: ts[0],
handler: ts[1],
method: ts[2]
};
} | javascript | function (route) {
if (!route) {
return null;
}
let ts = route.split('.');
if (ts.length !== 3) {
return null;
}
return {
route: route,
serverType: ts[0],
handler: ts[1],
method: ts[2]
};
} | [
"function",
"(",
"route",
")",
"{",
"if",
"(",
"!",
"route",
")",
"{",
"return",
"null",
";",
"}",
"let",
"ts",
"=",
"route",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
"ts",
".",
"length",
"!==",
"3",
")",
"{",
"return",
"null",
";",
"}"... | Parse route string.
@param {String} route route string, such as: serverName.handlerName.methodName
@return {Object} parse result object or null for illeagle route string | [
"Parse",
"route",
"string",
"."
] | fb5f79fa31c69de36bd1c370bad5edfa753ca601 | https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L313-L328 | |
53,757 | mbroadst/rethunk | lib/metadata.js | Metadata | function Metadata(resolve, reject, query, options) {
this.resolve = this._wrapResolveForProfile(resolve);
this.reject = reject;
this.query = query; // The query in case we have to build a backtrace
this.options = options || {};
this.cursor = false;
} | javascript | function Metadata(resolve, reject, query, options) {
this.resolve = this._wrapResolveForProfile(resolve);
this.reject = reject;
this.query = query; // The query in case we have to build a backtrace
this.options = options || {};
this.cursor = false;
} | [
"function",
"Metadata",
"(",
"resolve",
",",
"reject",
",",
"query",
",",
"options",
")",
"{",
"this",
".",
"resolve",
"=",
"this",
".",
"_wrapResolveForProfile",
"(",
"resolve",
")",
";",
"this",
".",
"reject",
"=",
"reject",
";",
"this",
".",
"query",
... | Metadata we keep per query | [
"Metadata",
"we",
"keep",
"per",
"query"
] | 48cad0fa139883f49489b93afbb87502532a876a | https://github.com/mbroadst/rethunk/blob/48cad0fa139883f49489b93afbb87502532a876a/lib/metadata.js#L3-L9 |
53,758 | iolo/express-toybox | server.js | start | function start(app, config, callback) {
if (httpServer) {
DEBUG && debug('***ignore*** http server is already running!');
callback && callback(false);
return httpServer;
}
config = _.merge({}, DEF_CONFIG, config);
DEBUG && debug('start http server http://' + config.host + ':' +... | javascript | function start(app, config, callback) {
if (httpServer) {
DEBUG && debug('***ignore*** http server is already running!');
callback && callback(false);
return httpServer;
}
config = _.merge({}, DEF_CONFIG, config);
DEBUG && debug('start http server http://' + config.host + ':' +... | [
"function",
"start",
"(",
"app",
",",
"config",
",",
"callback",
")",
"{",
"if",
"(",
"httpServer",
")",
"{",
"DEBUG",
"&&",
"debug",
"(",
"'***ignore*** http server is already running!'",
")",
";",
"callback",
"&&",
"callback",
"(",
"false",
")",
";",
"retu... | start http server.
@param {*} app request listener. might be express(or connect) application instance.
@param {*} [config] http server configurations
@param {String} [config.host='localhost']
@param {Number} [config.port=3000]
@param {Function(http.Server)} callback
@returns {http.Server} http server instance | [
"start",
"http",
"server",
"."
] | c375a1388cfc167017e8dcd2325e71ca86ccb994 | https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/server.js#L26-L54 |
53,759 | iolo/express-toybox | server.js | stop | function stop(callback) {
if (httpServer) {
DEBUG && debug('stop http server');
try {
httpServer.close();
} catch (e) {
}
httpServer = null;
} else {
DEBUG && debug('***ignore*** http server is not running!');
}
callback && callback(false);
} | javascript | function stop(callback) {
if (httpServer) {
DEBUG && debug('stop http server');
try {
httpServer.close();
} catch (e) {
}
httpServer = null;
} else {
DEBUG && debug('***ignore*** http server is not running!');
}
callback && callback(false);
} | [
"function",
"stop",
"(",
"callback",
")",
"{",
"if",
"(",
"httpServer",
")",
"{",
"DEBUG",
"&&",
"debug",
"(",
"'stop http server'",
")",
";",
"try",
"{",
"httpServer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"httpServer",... | stop http server
@param {Function} callback | [
"stop",
"http",
"server"
] | c375a1388cfc167017e8dcd2325e71ca86ccb994 | https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/server.js#L61-L73 |
53,760 | myndzi/should-eventually | index.js | function (resolved, val) {
var should = (negate ?
(new Assertion(val)).not :
(new Assertion(val))
);
if (storedAssertions[0][0] !== 'throw' && !resolved) {
throw val;
}
... | javascript | function (resolved, val) {
var should = (negate ?
(new Assertion(val)).not :
(new Assertion(val))
);
if (storedAssertions[0][0] !== 'throw' && !resolved) {
throw val;
}
... | [
"function",
"(",
"resolved",
",",
"val",
")",
"{",
"var",
"should",
"=",
"(",
"negate",
"?",
"(",
"new",
"Assertion",
"(",
"val",
")",
")",
".",
"not",
":",
"(",
"new",
"Assertion",
"(",
"val",
")",
")",
")",
";",
"if",
"(",
"storedAssertions",
"... | this function will kick off the new chain of assertions on the setttled result of the promise | [
"this",
"function",
"will",
"kick",
"off",
"the",
"new",
"chain",
"of",
"assertions",
"on",
"the",
"setttled",
"result",
"of",
"the",
"promise"
] | 96abbae69f4ee46cda5864b0c59c1a570984ad42 | https://github.com/myndzi/should-eventually/blob/96abbae69f4ee46cda5864b0c59c1a570984ad42/index.js#L88-L146 | |
53,761 | thommeo/generator-fe | app/templates/foundation/js/foundation/foundation.clearing.js | function () {
var self = this;
$(this.scope)
.on('click.fndtn.clearing', 'ul[data-clearing] li',
function (e, current, target) {
var current = current || $(this),
target = target || current,
next = current.next('li'),
settings = ... | javascript | function () {
var self = this;
$(this.scope)
.on('click.fndtn.clearing', 'ul[data-clearing] li',
function (e, current, target) {
var current = current || $(this),
target = target || current,
next = current.next('li'),
settings = ... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"$",
"(",
"this",
".",
"scope",
")",
".",
"on",
"(",
"'click.fndtn.clearing'",
",",
"'ul[data-clearing] li'",
",",
"function",
"(",
"e",
",",
"current",
",",
"target",
")",
"{",
"var",
"curren... | event binding and initial setup | [
"event",
"binding",
"and",
"initial",
"setup"
] | 186d1464fcf628604ecb7f39e56312ee1b08415f | https://github.com/thommeo/generator-fe/blob/186d1464fcf628604ecb7f39e56312ee1b08415f/app/templates/foundation/js/foundation/foundation.clearing.js#L65-L108 | |
53,762 | mattdesl/kami-mesh-buffer | index.js | Mesh | function Mesh(context, isStatic, numVerts, numIndices, vertexAttribs) {
//TODO: use options here...
if (!numVerts)
throw "numVerts not specified, must be > 0";
BaseObject.call(this, context);
this.gl = this.context.gl;
this.numVerts = null;
this.numIndices = null;
this.vertices = null;
this.i... | javascript | function Mesh(context, isStatic, numVerts, numIndices, vertexAttribs) {
//TODO: use options here...
if (!numVerts)
throw "numVerts not specified, must be > 0";
BaseObject.call(this, context);
this.gl = this.context.gl;
this.numVerts = null;
this.numIndices = null;
this.vertices = null;
this.i... | [
"function",
"Mesh",
"(",
"context",
",",
"isStatic",
",",
"numVerts",
",",
"numIndices",
",",
"vertexAttribs",
")",
"{",
"//TODO: use options here...",
"if",
"(",
"!",
"numVerts",
")",
"throw",
"\"numVerts not specified, must be > 0\"",
";",
"BaseObject",
".",
"call... | Creates a new Mesh with the provided parameters.
If numIndices is 0 or falsy, no index buffer will be used
and indices will be an empty ArrayBuffer and a null indexBuffer.
If isStatic is true, then vertexUsage and indexUsage will
be set to gl.STATIC_DRAW. Otherwise they will use gl.DYNAMIC_DRAW.
You may want to adjus... | [
"Creates",
"a",
"new",
"Mesh",
"with",
"the",
"provided",
"parameters",
"."
] | b9b486eaba215728df31d1c1d2a5bf94c83a1337 | https://github.com/mattdesl/kami-mesh-buffer/blob/b9b486eaba215728df31d1c1d2a5bf94c83a1337/index.js#L51-L108 |
53,763 | mattdesl/kami-mesh-buffer | index.js | function() {
this.gl = this.context.gl;
var gl = this.gl;
this.vertexBuffer = gl.createBuffer();
//ignore index buffer if we haven't specified any
this.indexBuffer = this.numIndices > 0
? gl.createBuffer()
: null;
this.dirty = true;
} | javascript | function() {
this.gl = this.context.gl;
var gl = this.gl;
this.vertexBuffer = gl.createBuffer();
//ignore index buffer if we haven't specified any
this.indexBuffer = this.numIndices > 0
? gl.createBuffer()
: null;
this.dirty = true;
} | [
"function",
"(",
")",
"{",
"this",
".",
"gl",
"=",
"this",
".",
"context",
".",
"gl",
";",
"var",
"gl",
"=",
"this",
".",
"gl",
";",
"this",
".",
"vertexBuffer",
"=",
"gl",
".",
"createBuffer",
"(",
")",
";",
"//ignore index buffer if we haven't specifie... | recreates the buffers on context loss | [
"recreates",
"the",
"buffers",
"on",
"context",
"loss"
] | b9b486eaba215728df31d1c1d2a5bf94c83a1337 | https://github.com/mattdesl/kami-mesh-buffer/blob/b9b486eaba215728df31d1c1d2a5bf94c83a1337/index.js#L111-L122 | |
53,764 | mattdesl/kami-mesh-buffer | index.js | function(shader) {
var gl = this.gl;
var offset = 0;
var stride = this.vertexStride;
//bind and update our vertex data before binding attributes
this._updateBuffers();
//for each attribtue
for (var i=0; i<this._vertexAttribs.length; i++) {
var a = this._vertexAttribs[i];
//location of the attrib... | javascript | function(shader) {
var gl = this.gl;
var offset = 0;
var stride = this.vertexStride;
//bind and update our vertex data before binding attributes
this._updateBuffers();
//for each attribtue
for (var i=0; i<this._vertexAttribs.length; i++) {
var a = this._vertexAttribs[i];
//location of the attrib... | [
"function",
"(",
"shader",
")",
"{",
"var",
"gl",
"=",
"this",
".",
"gl",
";",
"var",
"offset",
"=",
"0",
";",
"var",
"stride",
"=",
"this",
".",
"vertexStride",
";",
"//bind and update our vertex data before binding attributes",
"this",
".",
"_updateBuffers",
... | binds this mesh's vertex attributes for the given shader | [
"binds",
"this",
"mesh",
"s",
"vertex",
"attributes",
"for",
"the",
"given",
"shader"
] | b9b486eaba215728df31d1c1d2a5bf94c83a1337 | https://github.com/mattdesl/kami-mesh-buffer/blob/b9b486eaba215728df31d1c1d2a5bf94c83a1337/index.js#L193-L225 | |
53,765 | mattdesl/kami-mesh-buffer | index.js | function(name, numComponents, location, type, normalize, offsetCount) {
this.name = name;
this.numComponents = numComponents;
this.location = typeof location === "number" ? location : null;
this.type = type;
this.normalize = Boolean(normalize);
this.offsetCount = typeof offsetCount === "number" ? offsetCoun... | javascript | function(name, numComponents, location, type, normalize, offsetCount) {
this.name = name;
this.numComponents = numComponents;
this.location = typeof location === "number" ? location : null;
this.type = type;
this.normalize = Boolean(normalize);
this.offsetCount = typeof offsetCount === "number" ? offsetCoun... | [
"function",
"(",
"name",
",",
"numComponents",
",",
"location",
",",
"type",
",",
"normalize",
",",
"offsetCount",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"numComponents",
"=",
"numComponents",
";",
"this",
".",
"location",
"=",
"ty... | Mesh vertex attribute holder.
Location is optional and for advanced users that
want vertex arrays to match across shaders. Any non-numerical
value will be converted to null, and ignored. If a numerical
value is given, it will override the position of this attribute
when given to a mesh.
@class Mesh.Attrib
@construct... | [
"Mesh",
"vertex",
"attribute",
"holder",
"."
] | b9b486eaba215728df31d1c1d2a5bf94c83a1337 | https://github.com/mattdesl/kami-mesh-buffer/blob/b9b486eaba215728df31d1c1d2a5bf94c83a1337/index.js#L269-L276 | |
53,766 | HarryStevens/fsz | index.js | writeJSON | function writeJSON(file, json){
var s = file.split(".");
if (s.length > 0) {
var ext = s[s.length - 1];
if (ext != "json"){
file = file + ".json";
}
}
fs.writeFileSync(file, JSON.stringify(json));
} | javascript | function writeJSON(file, json){
var s = file.split(".");
if (s.length > 0) {
var ext = s[s.length - 1];
if (ext != "json"){
file = file + ".json";
}
}
fs.writeFileSync(file, JSON.stringify(json));
} | [
"function",
"writeJSON",
"(",
"file",
",",
"json",
")",
"{",
"var",
"s",
"=",
"file",
".",
"split",
"(",
"\".\"",
")",
";",
"if",
"(",
"s",
".",
"length",
">",
"0",
")",
"{",
"var",
"ext",
"=",
"s",
"[",
"s",
".",
"length",
"-",
"1",
"]",
"... | Writes a JSON file
@param {string} file Name of the output file (.json extension will be added)
@param {string} json The JSON variable | [
"Writes",
"a",
"JSON",
"file"
] | 2b87d0de824c4270f8cb311ccc34a44ef36a6d33 | https://github.com/HarryStevens/fsz/blob/2b87d0de824c4270f8cb311ccc34a44ef36a6d33/index.js#L49-L58 |
53,767 | HarryStevens/fsz | index.js | getDirectories | function getDirectories(path){
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + "/" + file).isDirectory();
});
} | javascript | function getDirectories(path){
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + "/" + file).isDirectory();
});
} | [
"function",
"getDirectories",
"(",
"path",
")",
"{",
"return",
"fs",
".",
"readdirSync",
"(",
"path",
")",
".",
"filter",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"fs",
".",
"statSync",
"(",
"path",
"+",
"\"/\"",
"+",
"file",
")",
".",
"isDi... | Returns a list of all directories in a parent directory
@param {string} path The path of the parent directory
@return {array} An array with a list of directories | [
"Returns",
"a",
"list",
"of",
"all",
"directories",
"in",
"a",
"parent",
"directory"
] | 2b87d0de824c4270f8cb311ccc34a44ef36a6d33 | https://github.com/HarryStevens/fsz/blob/2b87d0de824c4270f8cb311ccc34a44ef36a6d33/index.js#L67-L71 |
53,768 | wilmoore/knex-pg-middleware | lib/knex.js | create | function create(options) {
return knex(extend({
client: "pg",
debug: debug(),
connection: connection(),
pool: pool()
}, options));
} | javascript | function create(options) {
return knex(extend({
client: "pg",
debug: debug(),
connection: connection(),
pool: pool()
}, options));
} | [
"function",
"create",
"(",
"options",
")",
"{",
"return",
"knex",
"(",
"extend",
"(",
"{",
"client",
":",
"\"pg\"",
",",
"debug",
":",
"debug",
"(",
")",
",",
"connection",
":",
"connection",
"(",
")",
",",
"pool",
":",
"pool",
"(",
")",
"}",
",",
... | Create and return a knex connection.
@param {Object} options
@api public | [
"Create",
"and",
"return",
"a",
"knex",
"connection",
"."
] | 615c391b87d4f60a7ed18518f3dd5d69bb396911 | https://github.com/wilmoore/knex-pg-middleware/blob/615c391b87d4f60a7ed18518f3dd5d69bb396911/lib/knex.js#L23-L30 |
53,769 | wilmoore/knex-pg-middleware | lib/knex.js | connection | function connection() {
return {
ssl: JSON.parse(JSON.stringify(process.env.DATABASE_SSL || "")),
host: process.env.DATABASE_HOST || "localhost",
user: process.env.DATABASE_USER || "",
charset: process.env.DATABASE_CHARSET || "utf8",
password: process.env.DATABASE_PASS || "",
database: process... | javascript | function connection() {
return {
ssl: JSON.parse(JSON.stringify(process.env.DATABASE_SSL || "")),
host: process.env.DATABASE_HOST || "localhost",
user: process.env.DATABASE_USER || "",
charset: process.env.DATABASE_CHARSET || "utf8",
password: process.env.DATABASE_PASS || "",
database: process... | [
"function",
"connection",
"(",
")",
"{",
"return",
"{",
"ssl",
":",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"process",
".",
"env",
".",
"DATABASE_SSL",
"||",
"\"\"",
")",
")",
",",
"host",
":",
"process",
".",
"env",
".",
"DATABASE_... | Return connection configuration. | [
"Return",
"connection",
"configuration",
"."
] | 615c391b87d4f60a7ed18518f3dd5d69bb396911 | https://github.com/wilmoore/knex-pg-middleware/blob/615c391b87d4f60a7ed18518f3dd5d69bb396911/lib/knex.js#L36-L45 |
53,770 | bredele/salute | index.js | type | function type (response) {
return value => {
if (!(value instanceof Error)) {
response.setHeader(
'Content-Type',
lookup(typeof value === 'object' ? 'json' : 'text')
)
}
return value instanceof Array ? JSON.stringify(value) : value
}
} | javascript | function type (response) {
return value => {
if (!(value instanceof Error)) {
response.setHeader(
'Content-Type',
lookup(typeof value === 'object' ? 'json' : 'text')
)
}
return value instanceof Array ? JSON.stringify(value) : value
}
} | [
"function",
"type",
"(",
"response",
")",
"{",
"return",
"value",
"=>",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Error",
")",
")",
"{",
"response",
".",
"setHeader",
"(",
"'Content-Type'",
",",
"lookup",
"(",
"typeof",
"value",
"===",
"'object'"... | Set response content type header.
@param {Object} response
@return {Function}
@api private | [
"Set",
"response",
"content",
"type",
"header",
"."
] | 6a14a9001a97917e93230adc1145e84300b6edc2 | https://github.com/bredele/salute/blob/6a14a9001a97917e93230adc1145e84300b6edc2/index.js#L50-L60 |
53,771 | bredele/salute | index.js | status | function status (res) {
return err => {
const code = err.statusCode
error(res, code || 500)
if (!code) console.log(err)
}
} | javascript | function status (res) {
return err => {
const code = err.statusCode
error(res, code || 500)
if (!code) console.log(err)
}
} | [
"function",
"status",
"(",
"res",
")",
"{",
"return",
"err",
"=>",
"{",
"const",
"code",
"=",
"err",
".",
"statusCode",
"error",
"(",
"res",
",",
"code",
"||",
"500",
")",
"if",
"(",
"!",
"code",
")",
"console",
".",
"log",
"(",
"err",
")",
"}",
... | Set response status code and message.
@param {Object} response
@return {Function}
@api private | [
"Set",
"response",
"status",
"code",
"and",
"message",
"."
] | 6a14a9001a97917e93230adc1145e84300b6edc2 | https://github.com/bredele/salute/blob/6a14a9001a97917e93230adc1145e84300b6edc2/index.js#L71-L77 |
53,772 | jakobmattsson/jscov | spec/scaffolding/oss/express 3.0.6/router/index.js | callbacks | function callbacks(err) {
var fn = route.callbacks[i++];
try {
if ('route' == err) {
nextRoute();
} else if (err && fn) {
if (fn.length < 4) return callbacks(err);
fn(err, req, res, callbacks);
} else if (fn) {
if (fn.length < 4) return fn(req,... | javascript | function callbacks(err) {
var fn = route.callbacks[i++];
try {
if ('route' == err) {
nextRoute();
} else if (err && fn) {
if (fn.length < 4) return callbacks(err);
fn(err, req, res, callbacks);
} else if (fn) {
if (fn.length < 4) return fn(req,... | [
"function",
"callbacks",
"(",
"err",
")",
"{",
"var",
"fn",
"=",
"route",
".",
"callbacks",
"[",
"i",
"++",
"]",
";",
"try",
"{",
"if",
"(",
"'route'",
"==",
"err",
")",
"{",
"nextRoute",
"(",
")",
";",
"}",
"else",
"if",
"(",
"err",
"&&",
"fn"... | invoke route callbacks | [
"invoke",
"route",
"callbacks"
] | ff9f5dd9e720ea0dd00e8d0607f0f1ae84d99b78 | https://github.com/jakobmattsson/jscov/blob/ff9f5dd9e720ea0dd00e8d0607f0f1ae84d99b78/spec/scaffolding/oss/express 3.0.6/router/index.js#L152-L169 |
53,773 | punchcard-cms/input-plugin-file | lib/script.js | clear | function clear (node) {
const replace = node.cloneNode(false);
node.parentNode.replaceChild(replace, node);
return replace;
} | javascript | function clear (node) {
const replace = node.cloneNode(false);
node.parentNode.replaceChild(replace, node);
return replace;
} | [
"function",
"clear",
"(",
"node",
")",
"{",
"const",
"replace",
"=",
"node",
".",
"cloneNode",
"(",
"false",
")",
";",
"node",
".",
"parentNode",
".",
"replaceChild",
"(",
"replace",
",",
"node",
")",
";",
"return",
"replace",
";",
"}"
] | Clear a node's contents
@param {object} node - obj to be emptied | [
"Clear",
"a",
"node",
"s",
"contents"
] | 31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96 | https://github.com/punchcard-cms/input-plugin-file/blob/31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96/lib/script.js#L35-L39 |
53,774 | punchcard-cms/input-plugin-file | lib/script.js | loadHandler | function loadHandler (event) {
const target = event.target;
// change the link to the new file
link.setAttribute('href', target.result);
// make sure checkbox is no longer checked
checkbox.checked = false;
// make link not hidden
link.style.display = '';
// make delete checkbox not h... | javascript | function loadHandler (event) {
const target = event.target;
// change the link to the new file
link.setAttribute('href', target.result);
// make sure checkbox is no longer checked
checkbox.checked = false;
// make link not hidden
link.style.display = '';
// make delete checkbox not h... | [
"function",
"loadHandler",
"(",
"event",
")",
"{",
"const",
"target",
"=",
"event",
".",
"target",
";",
"// change the link to the new file",
"link",
".",
"setAttribute",
"(",
"'href'",
",",
"target",
".",
"result",
")",
";",
"// make sure checkbox is no longer chec... | Load handler for FileReader
@param {[type]} event - handler executed when the load event is fired | [
"Load",
"handler",
"for",
"FileReader"
] | 31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96 | https://github.com/punchcard-cms/input-plugin-file/blob/31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96/lib/script.js#L45-L75 |
53,775 | punchcard-cms/input-plugin-file | lib/script.js | uploadHandler | function uploadHandler (event) {
const target = event.target;
if (target.files && target.files[0]) {
file = target.files[0];
const reader = new FileReader();
reader.addEventListener('load', loadHandler);
reader.readAsDataURL(file);
}
} | javascript | function uploadHandler (event) {
const target = event.target;
if (target.files && target.files[0]) {
file = target.files[0];
const reader = new FileReader();
reader.addEventListener('load', loadHandler);
reader.readAsDataURL(file);
}
} | [
"function",
"uploadHandler",
"(",
"event",
")",
"{",
"const",
"target",
"=",
"event",
".",
"target",
";",
"if",
"(",
"target",
".",
"files",
"&&",
"target",
".",
"files",
"[",
"0",
"]",
")",
"{",
"file",
"=",
"target",
".",
"files",
"[",
"0",
"]",
... | Upload handler for file upload element
@param {[type]} event - handler executed when the load event is fired | [
"Upload",
"handler",
"for",
"file",
"upload",
"element"
] | 31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96 | https://github.com/punchcard-cms/input-plugin-file/blob/31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96/lib/script.js#L81-L92 |
53,776 | punchcard-cms/input-plugin-file | lib/script.js | checkboxHandler | function checkboxHandler (event) {
const target = event.target;
if (target.checked) {
link.style.display = 'none';
if (upload.value) {
upload.value = '';
link = clear(link);
}
}
else {
link.style.display = '';
}
} | javascript | function checkboxHandler (event) {
const target = event.target;
if (target.checked) {
link.style.display = 'none';
if (upload.value) {
upload.value = '';
link = clear(link);
}
}
else {
link.style.display = '';
}
} | [
"function",
"checkboxHandler",
"(",
"event",
")",
"{",
"const",
"target",
"=",
"event",
".",
"target",
";",
"if",
"(",
"target",
".",
"checked",
")",
"{",
"link",
".",
"style",
".",
"display",
"=",
"'none'",
";",
"if",
"(",
"upload",
".",
"value",
")... | Checkbox handler for file delete checkbox
@param {[type]} event - handler executed when the load event is fired | [
"Checkbox",
"handler",
"for",
"file",
"delete",
"checkbox"
] | 31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96 | https://github.com/punchcard-cms/input-plugin-file/blob/31ac6f170ad4c8022b5dc28fffb3ebc9bf266f96/lib/script.js#L98-L111 |
53,777 | scisco/yaml-files | index.js | construct | function construct(data) {
const basepath = process.cwd();
const files = data.map((f) => {
const fullpath = p.join(basepath, f);
const src = fs.readFileSync(fullpath, 'utf8');
const t = yaml.load(src, {
schema: YAML_FILES_SCHEMA,
filename: fullpath
});
return t;
});
const t = ... | javascript | function construct(data) {
const basepath = process.cwd();
const files = data.map((f) => {
const fullpath = p.join(basepath, f);
const src = fs.readFileSync(fullpath, 'utf8');
const t = yaml.load(src, {
schema: YAML_FILES_SCHEMA,
filename: fullpath
});
return t;
});
const t = ... | [
"function",
"construct",
"(",
"data",
")",
"{",
"const",
"basepath",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"const",
"files",
"=",
"data",
".",
"map",
"(",
"(",
"f",
")",
"=>",
"{",
"const",
"fullpath",
"=",
"p",
".",
"join",
"(",
"basepath",
... | Construct function for the yaml schema that reads a list of files
parse them and then merge them
@param {Object} data - input to the schema marker
@returns {Object} a parsed yaml object | [
"Construct",
"function",
"for",
"the",
"yaml",
"schema",
"that",
"reads",
"a",
"list",
"of",
"files",
"parse",
"them",
"and",
"then",
"merge",
"them"
] | 71de1364800a24a5cf86b12264fb6345eaf8f283 | https://github.com/scisco/yaml-files/blob/71de1364800a24a5cf86b12264fb6345eaf8f283/index.js#L42-L58 |
53,778 | 2createStudio/postcss-bad-selectors | lib/index.js | plugin | function plugin(cb) {
return function(css) {
if (lodash.isFunction(cb)) {
var token = cb(css.source.input.file);
if (!lodash.isNull(token)) {
css.eachRule(function(rule) {
if (!areSelectorsValid(rule.selectors, token)) {
throw rule.error('Wrong selector');
}
});
}
}
}
} | javascript | function plugin(cb) {
return function(css) {
if (lodash.isFunction(cb)) {
var token = cb(css.source.input.file);
if (!lodash.isNull(token)) {
css.eachRule(function(rule) {
if (!areSelectorsValid(rule.selectors, token)) {
throw rule.error('Wrong selector');
}
});
}
}
}
} | [
"function",
"plugin",
"(",
"cb",
")",
"{",
"return",
"function",
"(",
"css",
")",
"{",
"if",
"(",
"lodash",
".",
"isFunction",
"(",
"cb",
")",
")",
"{",
"var",
"token",
"=",
"cb",
"(",
"css",
".",
"source",
".",
"input",
".",
"file",
")",
";",
... | PostCSS plugin definition.
@param {Function} cb
@return {Function} | [
"PostCSS",
"plugin",
"definition",
"."
] | 9c5cf7f32d21fd0cd172785a92db714457feb076 | https://github.com/2createStudio/postcss-bad-selectors/blob/9c5cf7f32d21fd0cd172785a92db714457feb076/lib/index.js#L20-L34 |
53,779 | 2createStudio/postcss-bad-selectors | lib/index.js | areSelectorsValid | function areSelectorsValid(selectors, token) {
return lodash.every(selectors, function(selector) {
if (lodash.isRegExp(token)) {
return token.test(lodash.trim(selector));
} else {
return lodash.startsWith(lodash.trim(selector), token);
}
});
} | javascript | function areSelectorsValid(selectors, token) {
return lodash.every(selectors, function(selector) {
if (lodash.isRegExp(token)) {
return token.test(lodash.trim(selector));
} else {
return lodash.startsWith(lodash.trim(selector), token);
}
});
} | [
"function",
"areSelectorsValid",
"(",
"selectors",
",",
"token",
")",
"{",
"return",
"lodash",
".",
"every",
"(",
"selectors",
",",
"function",
"(",
"selector",
")",
"{",
"if",
"(",
"lodash",
".",
"isRegExp",
"(",
"token",
")",
")",
"{",
"return",
"token... | Checks if all selectors in collection are valid.
@param {Array} selectors
@param {String} token
@return {Boolean} | [
"Checks",
"if",
"all",
"selectors",
"in",
"collection",
"are",
"valid",
"."
] | 9c5cf7f32d21fd0cd172785a92db714457feb076 | https://github.com/2createStudio/postcss-bad-selectors/blob/9c5cf7f32d21fd0cd172785a92db714457feb076/lib/index.js#L43-L51 |
53,780 | lmammino/indexed-string-variation | lib/index.js | cleanAlphabet | function cleanAlphabet(alphabet) {
return alphabet.split('').filter(function (item, pos, self) {
return self.indexOf(item) === pos;
}).join('');
} | javascript | function cleanAlphabet(alphabet) {
return alphabet.split('').filter(function (item, pos, self) {
return self.indexOf(item) === pos;
}).join('');
} | [
"function",
"cleanAlphabet",
"(",
"alphabet",
")",
"{",
"return",
"alphabet",
".",
"split",
"(",
"''",
")",
".",
"filter",
"(",
"function",
"(",
"item",
",",
"pos",
",",
"self",
")",
"{",
"return",
"self",
".",
"indexOf",
"(",
"item",
")",
"===",
"po... | remove duplicates from alphabets | [
"remove",
"duplicates",
"from",
"alphabets"
] | 52fb6b5b05940138fb58f9a1c937531ad90adda5 | https://github.com/lmammino/indexed-string-variation/blob/52fb6b5b05940138fb58f9a1c937531ad90adda5/lib/index.js#L26-L30 |
53,781 | lmammino/indexed-string-variation | lib/index.js | generate | function generate(index) {
return index instanceof _bigInteger2.default ? (0, _generateBigInt2.default)(index, alphabet) : (0, _generateInt2.default)(index, alphabet);
} | javascript | function generate(index) {
return index instanceof _bigInteger2.default ? (0, _generateBigInt2.default)(index, alphabet) : (0, _generateInt2.default)(index, alphabet);
} | [
"function",
"generate",
"(",
"index",
")",
"{",
"return",
"index",
"instanceof",
"_bigInteger2",
".",
"default",
"?",
"(",
"0",
",",
"_generateBigInt2",
".",
"default",
")",
"(",
"index",
",",
"alphabet",
")",
":",
"(",
"0",
",",
"_generateInt2",
".",
"d... | string generation function | [
"string",
"generation",
"function"
] | 52fb6b5b05940138fb58f9a1c937531ad90adda5 | https://github.com/lmammino/indexed-string-variation/blob/52fb6b5b05940138fb58f9a1c937531ad90adda5/lib/index.js#L39-L41 |
53,782 | davidfig/settingspanel | docs/code.js | number | function number()
{
const number = document.createElement('div')
document.body.appendChild(number)
number.innerHTML = rand(1000)
number.style.fontSize = '300%'
number.style.position = 'fixed'
number.style.left = number.style.top = '50%'
number.style.color = 'r... | javascript | function number()
{
const number = document.createElement('div')
document.body.appendChild(number)
number.innerHTML = rand(1000)
number.style.fontSize = '300%'
number.style.position = 'fixed'
number.style.left = number.style.top = '50%'
number.style.color = 'r... | [
"function",
"number",
"(",
")",
"{",
"const",
"number",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
"document",
".",
"body",
".",
"appendChild",
"(",
"number",
")",
"number",
".",
"innerHTML",
"=",
"rand",
"(",
"1000",
")",
"number",
".",
... | create and style test text | [
"create",
"and",
"style",
"test",
"text"
] | d9ba20d9b6d398e9dc5ba199d81dfc4fb08b9cfe | https://github.com/davidfig/settingspanel/blob/d9ba20d9b6d398e9dc5ba199d81dfc4fb08b9cfe/docs/code.js#L55-L66 |
53,783 | rohithpr/ipc-messenger | ipc-messenger.js | function(message) {
var pack = {
toMaster: true,
toWorkers: false,
toSource: false,
message: message,
source: process.pid
}
dispatch(pack)
} | javascript | function(message) {
var pack = {
toMaster: true,
toWorkers: false,
toSource: false,
message: message,
source: process.pid
}
dispatch(pack)
} | [
"function",
"(",
"message",
")",
"{",
"var",
"pack",
"=",
"{",
"toMaster",
":",
"true",
",",
"toWorkers",
":",
"false",
",",
"toSource",
":",
"false",
",",
"message",
":",
"message",
",",
"source",
":",
"process",
".",
"pid",
"}",
"dispatch",
"(",
"p... | This function can be used by workers to send a message to the master | [
"This",
"function",
"can",
"be",
"used",
"by",
"workers",
"to",
"send",
"a",
"message",
"to",
"the",
"master"
] | 46fd7471bb4e99367b7da6d23f93ff4eecd43d04 | https://github.com/rohithpr/ipc-messenger/blob/46fd7471bb4e99367b7da6d23f93ff4eecd43d04/ipc-messenger.js#L10-L19 | |
53,784 | rohithpr/ipc-messenger | ipc-messenger.js | function(pack) {
if (pack.toSource !== false || pack.source !== process.pid) {
CALLBACK(pack.message)
}
} | javascript | function(pack) {
if (pack.toSource !== false || pack.source !== process.pid) {
CALLBACK(pack.message)
}
} | [
"function",
"(",
"pack",
")",
"{",
"if",
"(",
"pack",
".",
"toSource",
"!==",
"false",
"||",
"pack",
".",
"source",
"!==",
"process",
".",
"pid",
")",
"{",
"CALLBACK",
"(",
"pack",
".",
"message",
")",
"}",
"}"
] | Message receiver of the workers | [
"Message",
"receiver",
"of",
"the",
"workers"
] | 46fd7471bb4e99367b7da6d23f93ff4eecd43d04 | https://github.com/rohithpr/ipc-messenger/blob/46fd7471bb4e99367b7da6d23f93ff4eecd43d04/ipc-messenger.js#L55-L59 | |
53,785 | rohithpr/ipc-messenger | ipc-messenger.js | function(pack) {
if (cluster.isMaster) {
if (pack.toWorkers === true) {
for (var key in cluster.workers) {
cluster.workers[key].send(pack)
}
}
}
else {
if (pack.toMaster === true || pack.toWorkers === true) {
process.send(pack)
}
}
} | javascript | function(pack) {
if (cluster.isMaster) {
if (pack.toWorkers === true) {
for (var key in cluster.workers) {
cluster.workers[key].send(pack)
}
}
}
else {
if (pack.toMaster === true || pack.toWorkers === true) {
process.send(pack)
}
}
} | [
"function",
"(",
"pack",
")",
"{",
"if",
"(",
"cluster",
".",
"isMaster",
")",
"{",
"if",
"(",
"pack",
".",
"toWorkers",
"===",
"true",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"cluster",
".",
"workers",
")",
"{",
"cluster",
".",
"workers",
"[",
... | Common function called to send messages to other processes | [
"Common",
"function",
"called",
"to",
"send",
"messages",
"to",
"other",
"processes"
] | 46fd7471bb4e99367b7da6d23f93ff4eecd43d04 | https://github.com/rohithpr/ipc-messenger/blob/46fd7471bb4e99367b7da6d23f93ff4eecd43d04/ipc-messenger.js#L62-L75 | |
53,786 | rohithpr/ipc-messenger | ipc-messenger.js | function(process, callback) {
if (callback !== undefined && typeof callback === 'function') {
CALLBACK = callback
}
if (cluster.isMaster) {
process.on('message', masterHandler)
}
else {
process.on('message', workerHandler)
}
} | javascript | function(process, callback) {
if (callback !== undefined && typeof callback === 'function') {
CALLBACK = callback
}
if (cluster.isMaster) {
process.on('message', masterHandler)
}
else {
process.on('message', workerHandler)
}
} | [
"function",
"(",
"process",
",",
"callback",
")",
"{",
"if",
"(",
"callback",
"!==",
"undefined",
"&&",
"typeof",
"callback",
"===",
"'function'",
")",
"{",
"CALLBACK",
"=",
"callback",
"}",
"if",
"(",
"cluster",
".",
"isMaster",
")",
"{",
"process",
"."... | Used to register processes and custom callback functions | [
"Used",
"to",
"register",
"processes",
"and",
"custom",
"callback",
"functions"
] | 46fd7471bb4e99367b7da6d23f93ff4eecd43d04 | https://github.com/rohithpr/ipc-messenger/blob/46fd7471bb4e99367b7da6d23f93ff4eecd43d04/ipc-messenger.js#L78-L88 | |
53,787 | reworkcss/rework-plugin-function | index.js | func | function func(declarations, functions, functionMatcher, parseArgs) {
if (!declarations) return;
if (false !== parseArgs) parseArgs = true;
declarations.forEach(function(decl){
if ('comment' == decl.type) return;
var generatedFuncs = [], result, generatedFunc;
while (decl.value.match(functionMatcher)... | javascript | function func(declarations, functions, functionMatcher, parseArgs) {
if (!declarations) return;
if (false !== parseArgs) parseArgs = true;
declarations.forEach(function(decl){
if ('comment' == decl.type) return;
var generatedFuncs = [], result, generatedFunc;
while (decl.value.match(functionMatcher)... | [
"function",
"func",
"(",
"declarations",
",",
"functions",
",",
"functionMatcher",
",",
"parseArgs",
")",
"{",
"if",
"(",
"!",
"declarations",
")",
"return",
";",
"if",
"(",
"false",
"!==",
"parseArgs",
")",
"parseArgs",
"=",
"true",
";",
"declarations",
"... | Visit declarations and apply functions.
@param {Array} declarations
@param {Object} functions
@param {RegExp} functionMatcher
@param {Boolean} [parseArgs]
@api private | [
"Visit",
"declarations",
"and",
"apply",
"functions",
"."
] | a5b83c1e3a103bad7ec21afba44c7aa015151e30 | https://github.com/reworkcss/rework-plugin-function/blob/a5b83c1e3a103bad7ec21afba44c7aa015151e30/index.js#L33-L70 |
53,788 | iolo/express-toybox | error500.js | error500 | function error500(options) {
options = _.merge({}, DEF_CONFIG, options);
// pre-compile underscore template if available
if (typeof options.template === 'string' && options.template.length > 0) {
options.template = _.template(options.template);
}
return function (err, req, res, next) {
... | javascript | function error500(options) {
options = _.merge({}, DEF_CONFIG, options);
// pre-compile underscore template if available
if (typeof options.template === 'string' && options.template.length > 0) {
options.template = _.template(options.template);
}
return function (err, req, res, next) {
... | [
"function",
"error500",
"(",
"options",
")",
"{",
"options",
"=",
"_",
".",
"merge",
"(",
"{",
"}",
",",
"DEF_CONFIG",
",",
"options",
")",
";",
"// pre-compile underscore template if available",
"if",
"(",
"typeof",
"options",
".",
"template",
"===",
"'string... | express uncaught error handler.
@param {*} options
@param {Number} [options.status=500]
@param {Number} [options.code=8500]
@param {*} [options.mappings={}] map err.name/err.code to error response.
@param {Boolean} [options.stack=false]
@param {String|Function} [options.template] lodash(underscore) micro template for ... | [
"express",
"uncaught",
"error",
"handler",
"."
] | c375a1388cfc167017e8dcd2325e71ca86ccb994 | https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/error500.js#L33-L70 |
53,789 | pd4d10/userscript-meta | index.js | parse | function parse(meta) {
if (typeof meta !== 'string') {
throw new Error('`Parse`\'s first argument should be a string')
}
return meta.split(/[\r\n]/)
.filter(function (line) { // remove blank line
return /\S+/.test(line) &&
line.indexOf('==UserScript==') === -1 &&
line.indexOf('==/Us... | javascript | function parse(meta) {
if (typeof meta !== 'string') {
throw new Error('`Parse`\'s first argument should be a string')
}
return meta.split(/[\r\n]/)
.filter(function (line) { // remove blank line
return /\S+/.test(line) &&
line.indexOf('==UserScript==') === -1 &&
line.indexOf('==/Us... | [
"function",
"parse",
"(",
"meta",
")",
"{",
"if",
"(",
"typeof",
"meta",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`Parse`\\'s first argument should be a string'",
")",
"}",
"return",
"meta",
".",
"split",
"(",
"/",
"[\\r\\n]",
"/",
")",
... | Parse metadata to an object | [
"Parse",
"metadata",
"to",
"an",
"object"
] | f5592b55ff40e782a91020cc7e9560594493f39a | https://github.com/pd4d10/userscript-meta/blob/f5592b55ff40e782a91020cc7e9560594493f39a/index.js#L12-L38 |
53,790 | pd4d10/userscript-meta | index.js | stringify | function stringify(obj) {
if (!isObject(obj)) {
throw new Error('`Stringify`\'s first argument should be an object')
}
var meta = Object.keys(obj)
.map(function (key) {
return getLine(key, obj[key])
}).join('')
return '// ==UserScript==\n' + meta + '// ==/UserScript==\n'
} | javascript | function stringify(obj) {
if (!isObject(obj)) {
throw new Error('`Stringify`\'s first argument should be an object')
}
var meta = Object.keys(obj)
.map(function (key) {
return getLine(key, obj[key])
}).join('')
return '// ==UserScript==\n' + meta + '// ==/UserScript==\n'
} | [
"function",
"stringify",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"isObject",
"(",
"obj",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'`Stringify`\\'s first argument should be an object'",
")",
"}",
"var",
"meta",
"=",
"Object",
".",
"keys",
"(",
"obj",
")"... | Stringify metadata from an object | [
"Stringify",
"metadata",
"from",
"an",
"object"
] | f5592b55ff40e782a91020cc7e9560594493f39a | https://github.com/pd4d10/userscript-meta/blob/f5592b55ff40e782a91020cc7e9560594493f39a/index.js#L52-L63 |
53,791 | haasz/laravel-mix-ext | src/index.js | addOutProperty | function addOutProperty(out, directory, extensions) {
out[directory] = {
extensions: extensions
};
Object.defineProperty(
out[directory],
'directory',
{
get: function () {
return Config.fileLoaderDirs[directory];
},
set: function (value) {
Config.fileLoaderDirs[directory] = value;
},
e... | javascript | function addOutProperty(out, directory, extensions) {
out[directory] = {
extensions: extensions
};
Object.defineProperty(
out[directory],
'directory',
{
get: function () {
return Config.fileLoaderDirs[directory];
},
set: function (value) {
Config.fileLoaderDirs[directory] = value;
},
e... | [
"function",
"addOutProperty",
"(",
"out",
",",
"directory",
",",
"extensions",
")",
"{",
"out",
"[",
"directory",
"]",
"=",
"{",
"extensions",
":",
"extensions",
"}",
";",
"Object",
".",
"defineProperty",
"(",
"out",
"[",
"directory",
"]",
",",
"'directory... | Add an output directory settings to the configuration.
@param {Object} out The output configuration.
@param {string} directory The directory setting key and default name.
@param {string[]} extensions The file extensions. | [
"Add",
"an",
"output",
"directory",
"settings",
"to",
"the",
"configuration",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L232-L251 |
53,792 | haasz/laravel-mix-ext | src/index.js | arraySubtraction | function arraySubtraction(arrA, arrB) {
arrA = arrA.slice();
for (let i = 0; i < arrB.length; ++i) {
arrA = arrA.filter(function (value) {
return value !== arrB[i];
});
}
return arrA;
} | javascript | function arraySubtraction(arrA, arrB) {
arrA = arrA.slice();
for (let i = 0; i < arrB.length; ++i) {
arrA = arrA.filter(function (value) {
return value !== arrB[i];
});
}
return arrA;
} | [
"function",
"arraySubtraction",
"(",
"arrA",
",",
"arrB",
")",
"{",
"arrA",
"=",
"arrA",
".",
"slice",
"(",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"arrB",
".",
"length",
";",
"++",
"i",
")",
"{",
"arrA",
"=",
"arrA",
".",
... | Array subtraction.
@param {Array} arrA The minuend array.
@param {Array} arrB The subtrahend array.
@return {Array} The difference array. | [
"Array",
"subtraction",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L336-L344 |
53,793 | haasz/laravel-mix-ext | src/index.js | getDirFromPublicPath | function getDirFromPublicPath(file) {
return path.posix.dirname(
path.posix.normalize(
path.posix.sep
+ file.path().replace(
new RegExp(
'^' + escapeStringRegExp(path.resolve(Config.publicPath))
),
''
).split(path.sep).join(path.posix.sep)
)
);
} | javascript | function getDirFromPublicPath(file) {
return path.posix.dirname(
path.posix.normalize(
path.posix.sep
+ file.path().replace(
new RegExp(
'^' + escapeStringRegExp(path.resolve(Config.publicPath))
),
''
).split(path.sep).join(path.posix.sep)
)
);
} | [
"function",
"getDirFromPublicPath",
"(",
"file",
")",
"{",
"return",
"path",
".",
"posix",
".",
"dirname",
"(",
"path",
".",
"posix",
".",
"normalize",
"(",
"path",
".",
"posix",
".",
"sep",
"+",
"file",
".",
"path",
"(",
")",
".",
"replace",
"(",
"n... | Get the directory of file from public path.
@param {Object} file The file.
@return {string} The directory of file from public path. | [
"Get",
"the",
"directory",
"of",
"file",
"from",
"public",
"path",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L499-L511 |
53,794 | haasz/laravel-mix-ext | src/index.js | replaceTplTag | function replaceTplTag(dirFromPublicPath, tag, replacements, templateFileLog) {
let tagPath = tag.replace(new RegExp(tplTagPathRegExpStr), '$1');
let tagPathFromPublicPath = path.posix.resolve(dirFromPublicPath, tagPath);
if (
tagPathFromPublicPath in replacements
&&
replacements.hasOwnProperty(tagPathFromPubl... | javascript | function replaceTplTag(dirFromPublicPath, tag, replacements, templateFileLog) {
let tagPath = tag.replace(new RegExp(tplTagPathRegExpStr), '$1');
let tagPathFromPublicPath = path.posix.resolve(dirFromPublicPath, tagPath);
if (
tagPathFromPublicPath in replacements
&&
replacements.hasOwnProperty(tagPathFromPubl... | [
"function",
"replaceTplTag",
"(",
"dirFromPublicPath",
",",
"tag",
",",
"replacements",
",",
"templateFileLog",
")",
"{",
"let",
"tagPath",
"=",
"tag",
".",
"replace",
"(",
"new",
"RegExp",
"(",
"tplTagPathRegExpStr",
")",
",",
"'$1'",
")",
";",
"let",
"tagP... | Replace a template tag.
@param {string} dirFromPublicPath The directory of the file that contains the template tag.
@param {string} tag The template tag.
@param {Object} replacements The replacements.
@param {Object} templateFileLog The template file log.
@return {string} Th... | [
"Replace",
"a",
"template",
"tag",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L524-L545 |
53,795 | haasz/laravel-mix-ext | src/index.js | getCompiledContent | function getCompiledContent(file, fragments, tags, replacements, templateFileLog) {
let content = '';
let fragmentStep = numberOfTplTagRegExpParts + 1;
let dirFromPublicPath = getDirFromPublicPath(file);
let i = 0;
for (; i < tags.length; ++i) {
content += fragments[i * fragmentStep];
content += replaceTplTag(... | javascript | function getCompiledContent(file, fragments, tags, replacements, templateFileLog) {
let content = '';
let fragmentStep = numberOfTplTagRegExpParts + 1;
let dirFromPublicPath = getDirFromPublicPath(file);
let i = 0;
for (; i < tags.length; ++i) {
content += fragments[i * fragmentStep];
content += replaceTplTag(... | [
"function",
"getCompiledContent",
"(",
"file",
",",
"fragments",
",",
"tags",
",",
"replacements",
",",
"templateFileLog",
")",
"{",
"let",
"content",
"=",
"''",
";",
"let",
"fragmentStep",
"=",
"numberOfTplTagRegExpParts",
"+",
"1",
";",
"let",
"dirFromPublicPa... | Get the compiled content of template file.
@param {Object} file The template file.
@param {string[]} fragments The content fragments.
@param {string[]} tags The template tags in original content.
@param {Object} replacements The replacements.
@param {Object} templateFileLog Th... | [
"Get",
"the",
"compiled",
"content",
"of",
"template",
"file",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L559-L575 |
53,796 | haasz/laravel-mix-ext | src/index.js | compileTemplate | function compileTemplate(file, replacements, templateFileLog) {
file = File.find(path.resolve(file));
let content = file.read();
let tags = content.match(new RegExp(tplTagRegExpStr, 'g'));
if (tags && tags.length) {
content = getCompiledContent(
file,
content.split(new RegExp(tplTagRegExpStr)),
tags,
... | javascript | function compileTemplate(file, replacements, templateFileLog) {
file = File.find(path.resolve(file));
let content = file.read();
let tags = content.match(new RegExp(tplTagRegExpStr, 'g'));
if (tags && tags.length) {
content = getCompiledContent(
file,
content.split(new RegExp(tplTagRegExpStr)),
tags,
... | [
"function",
"compileTemplate",
"(",
"file",
",",
"replacements",
",",
"templateFileLog",
")",
"{",
"file",
"=",
"File",
".",
"find",
"(",
"path",
".",
"resolve",
"(",
"file",
")",
")",
";",
"let",
"content",
"=",
"file",
".",
"read",
"(",
")",
";",
"... | Compile the template file.
@param {string} file The template file.
@param {Object} replacements The replacements.
@param {Object} templateFileLog The template file log. | [
"Compile",
"the",
"template",
"file",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L585-L599 |
53,797 | haasz/laravel-mix-ext | src/index.js | processTemplates | function processTemplates(templates) {
var templateProcessingLog = logger.createTemplateProcessingLog();
var replacements = Mix.manifest.get();
for (let template in templates) {
if (templates.hasOwnProperty(template)) {
// Copy to target
fs.copySync(template, templates[template]);
// Compile
compileTem... | javascript | function processTemplates(templates) {
var templateProcessingLog = logger.createTemplateProcessingLog();
var replacements = Mix.manifest.get();
for (let template in templates) {
if (templates.hasOwnProperty(template)) {
// Copy to target
fs.copySync(template, templates[template]);
// Compile
compileTem... | [
"function",
"processTemplates",
"(",
"templates",
")",
"{",
"var",
"templateProcessingLog",
"=",
"logger",
".",
"createTemplateProcessingLog",
"(",
")",
";",
"var",
"replacements",
"=",
"Mix",
".",
"manifest",
".",
"get",
"(",
")",
";",
"for",
"(",
"let",
"t... | Process the template files.
@param {Object} templates The templates. | [
"Process",
"the",
"template",
"files",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L607-L626 |
53,798 | haasz/laravel-mix-ext | src/index.js | watchFile | function watchFile(file, callback) {
let absolutePath = File.find(file).path();
let watcher = chokidar
.watch(
absolutePath,
{
persistent: true
}
)
.on(
'change',
function () {
if (typeof callback === 'function') {
callback(file);
}
watcher.unwatch(absolutePath);
watchFil... | javascript | function watchFile(file, callback) {
let absolutePath = File.find(file).path();
let watcher = chokidar
.watch(
absolutePath,
{
persistent: true
}
)
.on(
'change',
function () {
if (typeof callback === 'function') {
callback(file);
}
watcher.unwatch(absolutePath);
watchFil... | [
"function",
"watchFile",
"(",
"file",
",",
"callback",
")",
"{",
"let",
"absolutePath",
"=",
"File",
".",
"find",
"(",
"file",
")",
".",
"path",
"(",
")",
";",
"let",
"watcher",
"=",
"chokidar",
".",
"watch",
"(",
"absolutePath",
",",
"{",
"persistent"... | Watch the file's changes.
@param {string} file The file.
@param {Function} callback The callback function. | [
"Watch",
"the",
"file",
"s",
"changes",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L635-L655 |
53,799 | haasz/laravel-mix-ext | src/index.js | notify | function notify(message) {
if (Mix.isUsing('notifications')) {
let contentImage = path.join(__dirname, '../img/sunshine.png');
notifier.notify({
title: 'The Extension of Laravel Mix',
message: message,
contentImage: contentImage,
icon: (os.platform() === 'win32' || os.platform() === 'linux') ? contentI... | javascript | function notify(message) {
if (Mix.isUsing('notifications')) {
let contentImage = path.join(__dirname, '../img/sunshine.png');
notifier.notify({
title: 'The Extension of Laravel Mix',
message: message,
contentImage: contentImage,
icon: (os.platform() === 'win32' || os.platform() === 'linux') ? contentI... | [
"function",
"notify",
"(",
"message",
")",
"{",
"if",
"(",
"Mix",
".",
"isUsing",
"(",
"'notifications'",
")",
")",
"{",
"let",
"contentImage",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../img/sunshine.png'",
")",
";",
"notifier",
".",
"notify",
... | Send a cross platform native notification.
@param {string} message The message. | [
"Send",
"a",
"cross",
"platform",
"native",
"notification",
"."
] | bd1c794bdbf934dae233ab697dc5d5593d4b1124 | https://github.com/haasz/laravel-mix-ext/blob/bd1c794bdbf934dae233ab697dc5d5593d4b1124/src/index.js#L663-L673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.