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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,700 | onivim/oni | extensions/oni-plugin-prettier/requirePackage.js | requireLocalPkg | function requireLocalPkg(fspath, pkgName) {
const modulePath = findPkg(fspath, pkgName)
if (modulePath) {
try {
return require(modulePath)
} catch (e) {
console.warn(`Failed to load ${pkgName} from ${modulePath}. Using bundled`)
}
}
return require(pkgName... | javascript | function requireLocalPkg(fspath, pkgName) {
const modulePath = findPkg(fspath, pkgName)
if (modulePath) {
try {
return require(modulePath)
} catch (e) {
console.warn(`Failed to load ${pkgName} from ${modulePath}. Using bundled`)
}
}
return require(pkgName... | [
"function",
"requireLocalPkg",
"(",
"fspath",
",",
"pkgName",
")",
"{",
"const",
"modulePath",
"=",
"findPkg",
"(",
"fspath",
",",
"pkgName",
")",
"if",
"(",
"modulePath",
")",
"{",
"try",
"{",
"return",
"require",
"(",
"modulePath",
")",
"}",
"catch",
"... | Require package explicitely installed relative to given path.
Fallback to bundled one if no pacakge was found bottom up.
@param {string} fspath file system path starting point to resolve package
@param {string} pkgName package's name to require
@returns module | [
"Require",
"package",
"explicitely",
"installed",
"relative",
"to",
"given",
"path",
".",
"Fallback",
"to",
"bundled",
"one",
"if",
"no",
"pacakge",
"was",
"found",
"bottom",
"up",
"."
] | ebe9ffded341f111f7606c661b089931c3271057 | https://github.com/onivim/oni/blob/ebe9ffded341f111f7606c661b089931c3271057/extensions/oni-plugin-prettier/requirePackage.js#L39-L50 |
5,701 | evcohen/eslint-plugin-jsx-a11y | src/rules/label-has-for.js | validateNesting | function validateNesting(node) {
let queue = [...node.parent.children];
let child;
let opener;
while (queue.length) {
child = queue.shift();
opener = child.openingElement;
if (child.type === 'JSXElement' && opener && (opener.name.name === 'input' || opener.name.name === 'textarea')) {
return t... | javascript | function validateNesting(node) {
let queue = [...node.parent.children];
let child;
let opener;
while (queue.length) {
child = queue.shift();
opener = child.openingElement;
if (child.type === 'JSXElement' && opener && (opener.name.name === 'input' || opener.name.name === 'textarea')) {
return t... | [
"function",
"validateNesting",
"(",
"node",
")",
"{",
"let",
"queue",
"=",
"[",
"...",
"node",
".",
"parent",
".",
"children",
"]",
";",
"let",
"child",
";",
"let",
"opener",
";",
"while",
"(",
"queue",
".",
"length",
")",
"{",
"child",
"=",
"queue",... | Breadth-first search, assuming that HTML for forms is shallow. | [
"Breadth",
"-",
"first",
"search",
"assuming",
"that",
"HTML",
"for",
"forms",
"is",
"shallow",
"."
] | b7915dc5b8272dc1db103a82d6c961e6f4ad377e | https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/b7915dc5b8272dc1db103a82d6c961e6f4ad377e/src/rules/label-has-for.js#L30-L45 |
5,702 | Vincit/objection.js | lib/utils/objectUtils.js | isPlainObject | function isPlainObject(value) {
return (
isObject(value) &&
(!value.constructor || value.constructor === Object) &&
(!value.toString || value.toString === Object.prototype.toString)
);
} | javascript | function isPlainObject(value) {
return (
isObject(value) &&
(!value.constructor || value.constructor === Object) &&
(!value.toString || value.toString === Object.prototype.toString)
);
} | [
"function",
"isPlainObject",
"(",
"value",
")",
"{",
"return",
"(",
"isObject",
"(",
"value",
")",
"&&",
"(",
"!",
"value",
".",
"constructor",
"||",
"value",
".",
"constructor",
"===",
"Object",
")",
"&&",
"(",
"!",
"value",
".",
"toString",
"||",
"va... | Quick and dirty check if an object is a plain object and not for example an instance of some class. | [
"Quick",
"and",
"dirty",
"check",
"if",
"an",
"object",
"is",
"a",
"plain",
"object",
"and",
"not",
"for",
"example",
"an",
"instance",
"of",
"some",
"class",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/objectUtils.js#L22-L28 |
5,703 | Vincit/objection.js | lib/queryBuilder/graph/GraphUpsert.js | pruneGraphs | function pruneGraphs(graph, graphOptions) {
return currentGraph => {
pruneRelatedBranches(graph, currentGraph, graphOptions);
if (!graphOptions.isInsertOnly()) {
pruneDeletedBranches(graph, currentGraph);
}
return currentGraph;
};
} | javascript | function pruneGraphs(graph, graphOptions) {
return currentGraph => {
pruneRelatedBranches(graph, currentGraph, graphOptions);
if (!graphOptions.isInsertOnly()) {
pruneDeletedBranches(graph, currentGraph);
}
return currentGraph;
};
} | [
"function",
"pruneGraphs",
"(",
"graph",
",",
"graphOptions",
")",
"{",
"return",
"currentGraph",
"=>",
"{",
"pruneRelatedBranches",
"(",
"graph",
",",
"currentGraph",
",",
"graphOptions",
")",
";",
"if",
"(",
"!",
"graphOptions",
".",
"isInsertOnly",
"(",
")"... | Remove branches from the graph that require no operations. For example we never want to do anything for descendant nodes of a node that is deleted or unrelated. We never delete recursively. | [
"Remove",
"branches",
"from",
"the",
"graph",
"that",
"require",
"no",
"operations",
".",
"For",
"example",
"we",
"never",
"want",
"to",
"do",
"anything",
"for",
"descendant",
"nodes",
"of",
"a",
"node",
"that",
"is",
"deleted",
"or",
"unrelated",
".",
"We... | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/queryBuilder/graph/GraphUpsert.js#L72-L82 |
5,704 | Vincit/objection.js | lib/utils/promiseUtils/mapAfterAllReturn.js | mapAfterAllReturn | function mapAfterAllReturn(arr, mapper, returnValue) {
const results = new Array(arr.length);
let containsPromise = false;
for (let i = 0, l = arr.length; i < l; ++i) {
results[i] = mapper(arr[i]);
if (isPromise(results[i])) {
containsPromise = true;
}
}
if (containsPromise) {
return ... | javascript | function mapAfterAllReturn(arr, mapper, returnValue) {
const results = new Array(arr.length);
let containsPromise = false;
for (let i = 0, l = arr.length; i < l; ++i) {
results[i] = mapper(arr[i]);
if (isPromise(results[i])) {
containsPromise = true;
}
}
if (containsPromise) {
return ... | [
"function",
"mapAfterAllReturn",
"(",
"arr",
",",
"mapper",
",",
"returnValue",
")",
"{",
"const",
"results",
"=",
"new",
"Array",
"(",
"arr",
".",
"length",
")",
";",
"let",
"containsPromise",
"=",
"false",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
... | Map `arr` with `mapper` and after that return `returnValue`. If none of the mapped values is a promise, return synchronously for performance reasons. | [
"Map",
"arr",
"with",
"mapper",
"and",
"after",
"that",
"return",
"returnValue",
".",
"If",
"none",
"of",
"the",
"mapped",
"values",
"is",
"a",
"promise",
"return",
"synchronously",
"for",
"performance",
"reasons",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/promiseUtils/mapAfterAllReturn.js#L8-L25 |
5,705 | Vincit/objection.js | lib/utils/promiseUtils/map.js | promiseMap | function promiseMap(items, mapper, opt) {
switch (items.length) {
case 0:
return mapZero();
case 1:
return mapOne(items, mapper);
default:
return mapMany(items, mapper, opt);
}
} | javascript | function promiseMap(items, mapper, opt) {
switch (items.length) {
case 0:
return mapZero();
case 1:
return mapOne(items, mapper);
default:
return mapMany(items, mapper, opt);
}
} | [
"function",
"promiseMap",
"(",
"items",
",",
"mapper",
",",
"opt",
")",
"{",
"switch",
"(",
"items",
".",
"length",
")",
"{",
"case",
"0",
":",
"return",
"mapZero",
"(",
")",
";",
"case",
"1",
":",
"return",
"mapOne",
"(",
"items",
",",
"mapper",
"... | Works like Bluebird.map. | [
"Works",
"like",
"Bluebird",
".",
"map",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/promiseUtils/map.js#L6-L15 |
5,706 | Vincit/objection.js | lib/utils/clone.js | initCloneArray | function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
... | javascript | function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
... | [
"function",
"initCloneArray",
"(",
"array",
")",
"{",
"var",
"length",
"=",
"array",
".",
"length",
",",
"result",
"=",
"new",
"array",
".",
"constructor",
"(",
"length",
")",
";",
"// Add properties assigned by `RegExp#exec`.",
"if",
"(",
"length",
"&&",
"typ... | Initializes an array clone.
@private
@param {Array} array The array to clone.
@returns {Array} Returns the initialized clone. | [
"Initializes",
"an",
"array",
"clone",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/clone.js#L1605-L1615 |
5,707 | Vincit/objection.js | lib/queryBuilder/graph/GraphOperation.js | createInputColumnSelector | function createInputColumnSelector(nodes) {
return builder => {
const selects = new Map();
for (const node of nodes) {
const databaseJson = node.obj.$toDatabaseJson(builder);
for (const column of Object.keys(databaseJson)) {
if (!shouldSelectColumn(column, selects, node)) {
con... | javascript | function createInputColumnSelector(nodes) {
return builder => {
const selects = new Map();
for (const node of nodes) {
const databaseJson = node.obj.$toDatabaseJson(builder);
for (const column of Object.keys(databaseJson)) {
if (!shouldSelectColumn(column, selects, node)) {
con... | [
"function",
"createInputColumnSelector",
"(",
"nodes",
")",
"{",
"return",
"builder",
"=>",
"{",
"const",
"selects",
"=",
"new",
"Map",
"(",
")",
";",
"for",
"(",
"const",
"node",
"of",
"nodes",
")",
"{",
"const",
"databaseJson",
"=",
"node",
".",
"obj",... | Returns a function that only selects the columns that exist in the input. | [
"Returns",
"a",
"function",
"that",
"only",
"selects",
"the",
"columns",
"that",
"exist",
"in",
"the",
"input",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/queryBuilder/graph/GraphOperation.js#L120-L150 |
5,708 | Vincit/objection.js | lib/utils/identifierMapping.js | memoize | function memoize(func) {
const cache = new Map();
return input => {
let output = cache.get(input);
if (output === undefined) {
output = func(input);
cache.set(input, output);
}
return output;
};
} | javascript | function memoize(func) {
const cache = new Map();
return input => {
let output = cache.get(input);
if (output === undefined) {
output = func(input);
cache.set(input, output);
}
return output;
};
} | [
"function",
"memoize",
"(",
"func",
")",
"{",
"const",
"cache",
"=",
"new",
"Map",
"(",
")",
";",
"return",
"input",
"=>",
"{",
"let",
"output",
"=",
"cache",
".",
"get",
"(",
"input",
")",
";",
"if",
"(",
"output",
"===",
"undefined",
")",
"{",
... | Super fast memoize for single argument functions. | [
"Super",
"fast",
"memoize",
"for",
"single",
"argument",
"functions",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/identifierMapping.js#L6-L19 |
5,709 | Vincit/objection.js | lib/utils/identifierMapping.js | camelCase | function camelCase(str, { upperCase = false } = {}) {
if (str.length === 0) {
return str;
}
if (upperCase && isAllUpperCaseSnakeCase(str)) {
// Only convert to lower case if the string is all upper
// case snake_case. This allowes camelCase strings to go
// through without changing.
str = str... | javascript | function camelCase(str, { upperCase = false } = {}) {
if (str.length === 0) {
return str;
}
if (upperCase && isAllUpperCaseSnakeCase(str)) {
// Only convert to lower case if the string is all upper
// case snake_case. This allowes camelCase strings to go
// through without changing.
str = str... | [
"function",
"camelCase",
"(",
"str",
",",
"{",
"upperCase",
"=",
"false",
"}",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"str",
".",
"length",
"===",
"0",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(",
"upperCase",
"&&",
"isAllUpperCaseSnakeCase",
"(",
... | snake_case to camelCase converter that simply reverses the actions done by `snakeCase` function. | [
"snake_case",
"to",
"camelCase",
"converter",
"that",
"simply",
"reverses",
"the",
"actions",
"done",
"by",
"snakeCase",
"function",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/identifierMapping.js#L76-L104 |
5,710 | Vincit/objection.js | lib/utils/identifierMapping.js | mapLastPart | function mapLastPart(mapper, separator) {
return str => {
const idx = str.lastIndexOf(separator);
const mapped = mapper(str.slice(idx + separator.length));
return str.slice(0, idx + separator.length) + mapped;
};
} | javascript | function mapLastPart(mapper, separator) {
return str => {
const idx = str.lastIndexOf(separator);
const mapped = mapper(str.slice(idx + separator.length));
return str.slice(0, idx + separator.length) + mapped;
};
} | [
"function",
"mapLastPart",
"(",
"mapper",
",",
"separator",
")",
"{",
"return",
"str",
"=>",
"{",
"const",
"idx",
"=",
"str",
".",
"lastIndexOf",
"(",
"separator",
")",
";",
"const",
"mapped",
"=",
"mapper",
"(",
"str",
".",
"slice",
"(",
"idx",
"+",
... | Returns a function that splits the inputs string into pieces using `separator`, only calls `mapper` for the last part and concatenates the string back together. If no separators are found, `mapper` is called for the entire string. | [
"Returns",
"a",
"function",
"that",
"splits",
"the",
"inputs",
"string",
"into",
"pieces",
"using",
"separator",
"only",
"calls",
"mapper",
"for",
"the",
"last",
"part",
"and",
"concatenates",
"the",
"string",
"back",
"together",
".",
"If",
"no",
"separators",... | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/identifierMapping.js#L125-L131 |
5,711 | Vincit/objection.js | lib/utils/identifierMapping.js | keyMapper | function keyMapper(mapper) {
return obj => {
if (!isObject(obj) || Array.isArray(obj)) {
return obj;
}
const keys = Object.keys(obj);
const out = {};
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
out[mapper(key)] = obj[key];
}
return out;
};
} | javascript | function keyMapper(mapper) {
return obj => {
if (!isObject(obj) || Array.isArray(obj)) {
return obj;
}
const keys = Object.keys(obj);
const out = {};
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
out[mapper(key)] = obj[key];
}
return out;
};
} | [
"function",
"keyMapper",
"(",
"mapper",
")",
"{",
"return",
"obj",
"=>",
"{",
"if",
"(",
"!",
"isObject",
"(",
"obj",
")",
"||",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
";",
"}",
"const",
"keys",
"=",
"Object",
".",
"... | Returns a function that takes an object as an input and maps the object's keys using `mapper`. If the input is not an object, the input is returned unchanged. | [
"Returns",
"a",
"function",
"that",
"takes",
"an",
"object",
"as",
"an",
"input",
"and",
"maps",
"the",
"object",
"s",
"keys",
"using",
"mapper",
".",
"If",
"the",
"input",
"is",
"not",
"an",
"object",
"the",
"input",
"is",
"returned",
"unchanged",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/identifierMapping.js#L135-L151 |
5,712 | Vincit/objection.js | lib/utils/normalizeIds.js | normalizeIds | function normalizeIds(ids, prop, opt) {
opt = opt || {};
let isComposite = prop.size > 1;
let ret;
if (isComposite) {
// For composite ids these are okay:
//
// 1. [1, 'foo', 4]
// 2. {a: 1, b: 'foo', c: 4}
// 3. [[1, 'foo', 4], [4, 'bar', 1]]
// 4. [{a: 1, b: 'foo', c: 4}, {a: 4, b: '... | javascript | function normalizeIds(ids, prop, opt) {
opt = opt || {};
let isComposite = prop.size > 1;
let ret;
if (isComposite) {
// For composite ids these are okay:
//
// 1. [1, 'foo', 4]
// 2. {a: 1, b: 'foo', c: 4}
// 3. [[1, 'foo', 4], [4, 'bar', 1]]
// 4. [{a: 1, b: 'foo', c: 4}, {a: 4, b: '... | [
"function",
"normalizeIds",
"(",
"ids",
",",
"prop",
",",
"opt",
")",
"{",
"opt",
"=",
"opt",
"||",
"{",
"}",
";",
"let",
"isComposite",
"=",
"prop",
".",
"size",
">",
"1",
";",
"let",
"ret",
";",
"if",
"(",
"isComposite",
")",
"{",
"// For composi... | ids is of type RelationProperty. | [
"ids",
"is",
"of",
"type",
"RelationProperty",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/normalizeIds.js#L6-L88 |
5,713 | Vincit/objection.js | lib/queryBuilder/join/utils.js | forEachChildExpression | function forEachChildExpression(expr, modelClass, callback) {
if (expr.node.$allRecursive || expr.maxRecursionDepth > RELATION_RECURSION_LIMIT) {
throw modelClass.createValidationError({
type: ValidationErrorType.RelationExpression,
message: `recursion depth of eager expression ${expr.toString()} too ... | javascript | function forEachChildExpression(expr, modelClass, callback) {
if (expr.node.$allRecursive || expr.maxRecursionDepth > RELATION_RECURSION_LIMIT) {
throw modelClass.createValidationError({
type: ValidationErrorType.RelationExpression,
message: `recursion depth of eager expression ${expr.toString()} too ... | [
"function",
"forEachChildExpression",
"(",
"expr",
",",
"modelClass",
",",
"callback",
")",
"{",
"if",
"(",
"expr",
".",
"node",
".",
"$allRecursive",
"||",
"expr",
".",
"maxRecursionDepth",
">",
"RELATION_RECURSION_LIMIT",
")",
"{",
"throw",
"modelClass",
".",
... | Given a relation expression, goes through all first level children. | [
"Given",
"a",
"relation",
"expression",
"goes",
"through",
"all",
"first",
"level",
"children",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/queryBuilder/join/utils.js#L9-L18 |
5,714 | Vincit/objection.js | lib/utils/promiseUtils/after.js | after | function after(obj, func) {
if (isPromise(obj)) {
return obj.then(func);
} else {
return func(obj);
}
} | javascript | function after(obj, func) {
if (isPromise(obj)) {
return obj.then(func);
} else {
return func(obj);
}
} | [
"function",
"after",
"(",
"obj",
",",
"func",
")",
"{",
"if",
"(",
"isPromise",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
".",
"then",
"(",
"func",
")",
";",
"}",
"else",
"{",
"return",
"func",
"(",
"obj",
")",
";",
"}",
"}"
] | Call `func` after `obj` has been resolved. Call `func` synchronously if `obj` is not a promise for performance reasons. | [
"Call",
"func",
"after",
"obj",
"has",
"been",
"resolved",
".",
"Call",
"func",
"synchronously",
"if",
"obj",
"is",
"not",
"a",
"promise",
"for",
"performance",
"reasons",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/promiseUtils/after.js#L7-L13 |
5,715 | Vincit/objection.js | lib/utils/promiseUtils/try.js | promiseTry | function promiseTry(callback) {
try {
const maybePromise = callback();
if (isPromise(maybePromise)) {
return maybePromise;
} else {
return Promise.resolve(maybePromise);
}
} catch (err) {
return Promise.reject(err);
}
} | javascript | function promiseTry(callback) {
try {
const maybePromise = callback();
if (isPromise(maybePromise)) {
return maybePromise;
} else {
return Promise.resolve(maybePromise);
}
} catch (err) {
return Promise.reject(err);
}
} | [
"function",
"promiseTry",
"(",
"callback",
")",
"{",
"try",
"{",
"const",
"maybePromise",
"=",
"callback",
"(",
")",
";",
"if",
"(",
"isPromise",
"(",
"maybePromise",
")",
")",
"{",
"return",
"maybePromise",
";",
"}",
"else",
"{",
"return",
"Promise",
".... | Works like Bluebird.try. | [
"Works",
"like",
"Bluebird",
".",
"try",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/utils/promiseUtils/try.js#L6-L18 |
5,716 | Vincit/objection.js | lib/model/modelQueryProps.js | splitQueryProps | function splitQueryProps(model, json) {
const keys = Object.keys(json);
if (hasQueryProps(json, keys)) {
const queryProps = {};
const modelProps = {};
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
const value = json[key];
if (isQueryProp(value)) {
query... | javascript | function splitQueryProps(model, json) {
const keys = Object.keys(json);
if (hasQueryProps(json, keys)) {
const queryProps = {};
const modelProps = {};
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
const value = json[key];
if (isQueryProp(value)) {
query... | [
"function",
"splitQueryProps",
"(",
"model",
",",
"json",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"json",
")",
";",
"if",
"(",
"hasQueryProps",
"(",
"json",
",",
"keys",
")",
")",
"{",
"const",
"queryProps",
"=",
"{",
"}",
";",
... | Removes query properties from `json` and stores them into a hidden property inside `model` so that they can be later merged back to `json`. | [
"Removes",
"query",
"properties",
"from",
"json",
"and",
"stores",
"them",
"into",
"a",
"hidden",
"property",
"inside",
"model",
"so",
"that",
"they",
"can",
"be",
"later",
"merged",
"back",
"to",
"json",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/model/modelQueryProps.js#L11-L35 |
5,717 | Vincit/objection.js | lib/model/modelQueryProps.js | mergeQueryProps | function mergeQueryProps(model, json, omitProps, builder) {
json = convertExistingQueryProps(json, builder);
json = convertAndMergeHiddenQueryProps(model, json, omitProps, builder);
return json;
} | javascript | function mergeQueryProps(model, json, omitProps, builder) {
json = convertExistingQueryProps(json, builder);
json = convertAndMergeHiddenQueryProps(model, json, omitProps, builder);
return json;
} | [
"function",
"mergeQueryProps",
"(",
"model",
",",
"json",
",",
"omitProps",
",",
"builder",
")",
"{",
"json",
"=",
"convertExistingQueryProps",
"(",
"json",
",",
"builder",
")",
";",
"json",
"=",
"convertAndMergeHiddenQueryProps",
"(",
"model",
",",
"json",
",... | Merges and converts `model`'s query properties into `json`. | [
"Merges",
"and",
"converts",
"model",
"s",
"query",
"properties",
"into",
"json",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/model/modelQueryProps.js#L61-L66 |
5,718 | Vincit/objection.js | lib/model/modelQueryProps.js | convertExistingQueryProps | function convertExistingQueryProps(json, builder) {
const keys = Object.keys(json);
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
const value = json[key];
if (isQueryProp(value)) {
json[key] = queryPropToKnexRaw(value, builder);
}
}
return json;
} | javascript | function convertExistingQueryProps(json, builder) {
const keys = Object.keys(json);
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
const value = json[key];
if (isQueryProp(value)) {
json[key] = queryPropToKnexRaw(value, builder);
}
}
return json;
} | [
"function",
"convertExistingQueryProps",
"(",
"json",
",",
"builder",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"json",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"l",
"=",
"keys",
".",
"length",
";",
"i",
"<",
"l",
";",
"... | Converts the query properties in `json` to knex raw instances. `json` may have query properties even though we removed them. For example they may have been added in lifecycle hooks. | [
"Converts",
"the",
"query",
"properties",
"in",
"json",
"to",
"knex",
"raw",
"instances",
".",
"json",
"may",
"have",
"query",
"properties",
"even",
"though",
"we",
"removed",
"them",
".",
"For",
"example",
"they",
"may",
"have",
"been",
"added",
"in",
"li... | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/model/modelQueryProps.js#L71-L84 |
5,719 | Vincit/objection.js | lib/model/modelQueryProps.js | convertAndMergeHiddenQueryProps | function convertAndMergeHiddenQueryProps(model, json, omitProps, builder) {
const queryProps = model[QUERY_PROPS_PROPERTY];
if (!queryProps) {
// The model has no query properties.
return json;
}
const modelClass = model.constructor;
const keys = Object.keys(queryProps);
for (let i = 0, l = keys.... | javascript | function convertAndMergeHiddenQueryProps(model, json, omitProps, builder) {
const queryProps = model[QUERY_PROPS_PROPERTY];
if (!queryProps) {
// The model has no query properties.
return json;
}
const modelClass = model.constructor;
const keys = Object.keys(queryProps);
for (let i = 0, l = keys.... | [
"function",
"convertAndMergeHiddenQueryProps",
"(",
"model",
",",
"json",
",",
"omitProps",
",",
"builder",
")",
"{",
"const",
"queryProps",
"=",
"model",
"[",
"QUERY_PROPS_PROPERTY",
"]",
";",
"if",
"(",
"!",
"queryProps",
")",
"{",
"// The model has no query pro... | Converts and merges the query props that were split from the model and stored into QUERY_PROPS_PROPERTY. | [
"Converts",
"and",
"merges",
"the",
"query",
"props",
"that",
"were",
"split",
"from",
"the",
"model",
"and",
"stored",
"into",
"QUERY_PROPS_PROPERTY",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/model/modelQueryProps.js#L88-L109 |
5,720 | Vincit/objection.js | lib/model/modelQueryProps.js | queryPropToKnexRaw | function queryPropToKnexRaw(queryProp, builder) {
if (!queryProp) {
return queryProp;
}
if (queryProp.isObjectionQueryBuilderBase) {
return buildObjectionQueryBuilder(queryProp, builder);
} else if (isKnexRawConvertable(queryProp)) {
return buildKnexRawConvertable(queryProp, builder);
} else {
... | javascript | function queryPropToKnexRaw(queryProp, builder) {
if (!queryProp) {
return queryProp;
}
if (queryProp.isObjectionQueryBuilderBase) {
return buildObjectionQueryBuilder(queryProp, builder);
} else if (isKnexRawConvertable(queryProp)) {
return buildKnexRawConvertable(queryProp, builder);
} else {
... | [
"function",
"queryPropToKnexRaw",
"(",
"queryProp",
",",
"builder",
")",
"{",
"if",
"(",
"!",
"queryProp",
")",
"{",
"return",
"queryProp",
";",
"}",
"if",
"(",
"queryProp",
".",
"isObjectionQueryBuilderBase",
")",
"{",
"return",
"buildObjectionQueryBuilder",
"(... | Converts a query property into a knex `raw` instance. | [
"Converts",
"a",
"query",
"property",
"into",
"a",
"knex",
"raw",
"instance",
"."
] | 868f0e13d51c03033100ac9796f165630657ad90 | https://github.com/Vincit/objection.js/blob/868f0e13d51c03033100ac9796f165630657ad90/lib/model/modelQueryProps.js#L112-L124 |
5,721 | ZijianHe/koa-router | lib/layer.js | Layer | function Layer(path, methods, middleware, opts) {
this.opts = opts || {};
this.name = this.opts.name || null;
this.methods = [];
this.paramNames = [];
this.stack = Array.isArray(middleware) ? middleware : [middleware];
methods.forEach(function(method) {
var l = this.methods.push(method.toUpperCase());
... | javascript | function Layer(path, methods, middleware, opts) {
this.opts = opts || {};
this.name = this.opts.name || null;
this.methods = [];
this.paramNames = [];
this.stack = Array.isArray(middleware) ? middleware : [middleware];
methods.forEach(function(method) {
var l = this.methods.push(method.toUpperCase());
... | [
"function",
"Layer",
"(",
"path",
",",
"methods",
",",
"middleware",
",",
"opts",
")",
"{",
"this",
".",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"name",
"=",
"this",
".",
"opts",
".",
"name",
"||",
"null",
";",
"this",
".",
"method... | Initialize a new routing Layer with given `method`, `path`, and `middleware`.
@param {String|RegExp} path Path string or regular expression.
@param {Array} methods Array of HTTP verbs.
@param {Array} middleware Layer callback/middleware or series of.
@param {Object=} opts
@param {String=} opts.name route name
@param {... | [
"Initialize",
"a",
"new",
"routing",
"Layer",
"with",
"given",
"method",
"path",
"and",
"middleware",
"."
] | 49498ff35138edb218b90b58dd99dfe9b53ae916 | https://github.com/ZijianHe/koa-router/blob/49498ff35138edb218b90b58dd99dfe9b53ae916/lib/layer.js#L21-L50 |
5,722 | dropbox/zxcvbn | demo/mustache.js | debug | function debug(e, template, line, file) {
file = file || "<template>";
var lines = template.split("\n"),
start = Math.max(line - 3, 0),
end = Math.min(lines.length, line + 3),
context = lines.slice(start, end);
var c;
for (var i = 0, len = context.length; i < len; ++i) {
... | javascript | function debug(e, template, line, file) {
file = file || "<template>";
var lines = template.split("\n"),
start = Math.max(line - 3, 0),
end = Math.min(lines.length, line + 3),
context = lines.slice(start, end);
var c;
for (var i = 0, len = context.length; i < len; ++i) {
... | [
"function",
"debug",
"(",
"e",
",",
"template",
",",
"line",
",",
"file",
")",
"{",
"file",
"=",
"file",
"||",
"\"<template>\"",
";",
"var",
"lines",
"=",
"template",
".",
"split",
"(",
"\"\\n\"",
")",
",",
"start",
"=",
"Math",
".",
"max",
"(",
"l... | Adds the `template`, `line`, and `file` properties to the given error
object and alters the message to provide more useful debugging information. | [
"Adds",
"the",
"template",
"line",
"and",
"file",
"properties",
"to",
"the",
"given",
"error",
"object",
"and",
"alters",
"the",
"message",
"to",
"provide",
"more",
"useful",
"debugging",
"information",
"."
] | 67c4ece9efc40c9d0a1d7d995b2b22a91be500c2 | https://github.com/dropbox/zxcvbn/blob/67c4ece9efc40c9d0a1d7d995b2b22a91be500c2/demo/mustache.js#L102-L122 |
5,723 | dropbox/zxcvbn | demo/mustache.js | lookup | function lookup(name, stack, defaultValue) {
if (name === ".") {
return stack[stack.length - 1];
}
var names = name.split(".");
var lastIndex = names.length - 1;
var target = names[lastIndex];
var value, context, i = stack.length, j, localStack;
while (i) {
localStack = stack.s... | javascript | function lookup(name, stack, defaultValue) {
if (name === ".") {
return stack[stack.length - 1];
}
var names = name.split(".");
var lastIndex = names.length - 1;
var target = names[lastIndex];
var value, context, i = stack.length, j, localStack;
while (i) {
localStack = stack.s... | [
"function",
"lookup",
"(",
"name",
",",
"stack",
",",
"defaultValue",
")",
"{",
"if",
"(",
"name",
"===",
"\".\"",
")",
"{",
"return",
"stack",
"[",
"stack",
".",
"length",
"-",
"1",
"]",
";",
"}",
"var",
"names",
"=",
"name",
".",
"split",
"(",
... | Looks up the value of the given `name` in the given context `stack`. | [
"Looks",
"up",
"the",
"value",
"of",
"the",
"given",
"name",
"in",
"the",
"given",
"context",
"stack",
"."
] | 67c4ece9efc40c9d0a1d7d995b2b22a91be500c2 | https://github.com/dropbox/zxcvbn/blob/67c4ece9efc40c9d0a1d7d995b2b22a91be500c2/demo/mustache.js#L127-L168 |
5,724 | dropbox/zxcvbn | demo/mustache.js | _compile | function _compile(template, options) {
var args = "view,partials,stack,lookup,escapeHTML,renderSection,render";
var body = parse(template, options);
var fn = new Function(args, body);
// This anonymous function wraps the generated function so we can do
// argument coercion, setup some variables, an... | javascript | function _compile(template, options) {
var args = "view,partials,stack,lookup,escapeHTML,renderSection,render";
var body = parse(template, options);
var fn = new Function(args, body);
// This anonymous function wraps the generated function so we can do
// argument coercion, setup some variables, an... | [
"function",
"_compile",
"(",
"template",
",",
"options",
")",
"{",
"var",
"args",
"=",
"\"view,partials,stack,lookup,escapeHTML,renderSection,render\"",
";",
"var",
"body",
"=",
"parse",
"(",
"template",
",",
"options",
")",
";",
"var",
"fn",
"=",
"new",
"Functi... | Used by `compile` to generate a reusable function for the given `template`. | [
"Used",
"by",
"compile",
"to",
"generate",
"a",
"reusable",
"function",
"for",
"the",
"given",
"template",
"."
] | 67c4ece9efc40c9d0a1d7d995b2b22a91be500c2 | https://github.com/dropbox/zxcvbn/blob/67c4ece9efc40c9d0a1d7d995b2b22a91be500c2/demo/mustache.js#L471-L490 |
5,725 | AliasIO/Wappalyzer | src/wappalyzer.js | addDetected | function addDetected(app, pattern, type, value, key) {
app.detected = true;
// Set confidence level
app.confidence[`${type} ${key ? `${key} ` : ''}${pattern.regex}`] = pattern.confidence === undefined ? 100 : parseInt(pattern.confidence, 10);
// Detect version number
if (pattern.version) {
const version... | javascript | function addDetected(app, pattern, type, value, key) {
app.detected = true;
// Set confidence level
app.confidence[`${type} ${key ? `${key} ` : ''}${pattern.regex}`] = pattern.confidence === undefined ? 100 : parseInt(pattern.confidence, 10);
// Detect version number
if (pattern.version) {
const version... | [
"function",
"addDetected",
"(",
"app",
",",
"pattern",
",",
"type",
",",
"value",
",",
"key",
")",
"{",
"app",
".",
"detected",
"=",
"true",
";",
"// Set confidence level",
"app",
".",
"confidence",
"[",
"`",
"${",
"type",
"}",
"${",
"key",
"?",
"`",
... | Mark application as detected, set confidence and version | [
"Mark",
"application",
"as",
"detected",
"set",
"confidence",
"and",
"version"
] | 47c1c22712f3108c194444f11c0ca317d5df8b9a | https://github.com/AliasIO/Wappalyzer/blob/47c1c22712f3108c194444f11c0ca317d5df8b9a/src/wappalyzer.js#L32-L68 |
5,726 | AliasIO/Wappalyzer | src/drivers/webextension/js/driver.js | getOption | function getOption(name, defaultValue = null) {
return new Promise(async (resolve, reject) => {
let value = defaultValue;
try {
const option = await browser.storage.local.get(name);
if (option[name] !== undefined) {
value = option[name];
}
} catch (error) {
wappalyzer.log... | javascript | function getOption(name, defaultValue = null) {
return new Promise(async (resolve, reject) => {
let value = defaultValue;
try {
const option = await browser.storage.local.get(name);
if (option[name] !== undefined) {
value = option[name];
}
} catch (error) {
wappalyzer.log... | [
"function",
"getOption",
"(",
"name",
",",
"defaultValue",
"=",
"null",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"value",
"=",
"defaultValue",
";",
"try",
"{",
"const",
"option",
"=",
"aw... | Get a value from localStorage | [
"Get",
"a",
"value",
"from",
"localStorage"
] | 47c1c22712f3108c194444f11c0ca317d5df8b9a | https://github.com/AliasIO/Wappalyzer/blob/47c1c22712f3108c194444f11c0ca317d5df8b9a/src/drivers/webextension/js/driver.js#L43-L61 |
5,727 | AliasIO/Wappalyzer | src/drivers/webextension/js/driver.js | setOption | function setOption(name, value) {
return new Promise(async (resolve, reject) => {
try {
await browser.storage.local.set({ [name]: value });
} catch (error) {
wappalyzer.log(error.message, 'driver', 'error');
return reject(error.message);
}
return resolve();
});
} | javascript | function setOption(name, value) {
return new Promise(async (resolve, reject) => {
try {
await browser.storage.local.set({ [name]: value });
} catch (error) {
wappalyzer.log(error.message, 'driver', 'error');
return reject(error.message);
}
return resolve();
});
} | [
"function",
"setOption",
"(",
"name",
",",
"value",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"try",
"{",
"await",
"browser",
".",
"storage",
".",
"local",
".",
"set",
"(",
"{",
"[",
"name",
... | Set a value in localStorage | [
"Set",
"a",
"value",
"in",
"localStorage"
] | 47c1c22712f3108c194444f11c0ca317d5df8b9a | https://github.com/AliasIO/Wappalyzer/blob/47c1c22712f3108c194444f11c0ca317d5df8b9a/src/drivers/webextension/js/driver.js#L66-L78 |
5,728 | AliasIO/Wappalyzer | src/drivers/webextension/js/driver.js | openTab | function openTab(args) {
browser.tabs.create({
url: args.url,
active: args.background === undefined || !args.background,
});
} | javascript | function openTab(args) {
browser.tabs.create({
url: args.url,
active: args.background === undefined || !args.background,
});
} | [
"function",
"openTab",
"(",
"args",
")",
"{",
"browser",
".",
"tabs",
".",
"create",
"(",
"{",
"url",
":",
"args",
".",
"url",
",",
"active",
":",
"args",
".",
"background",
"===",
"undefined",
"||",
"!",
"args",
".",
"background",
",",
"}",
")",
"... | Open a tab | [
"Open",
"a",
"tab"
] | 47c1c22712f3108c194444f11c0ca317d5df8b9a | https://github.com/AliasIO/Wappalyzer/blob/47c1c22712f3108c194444f11c0ca317d5df8b9a/src/drivers/webextension/js/driver.js#L83-L88 |
5,729 | AliasIO/Wappalyzer | src/drivers/webextension/js/driver.js | post | async function post(url, body) {
try {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(body),
});
wappalyzer.log(`POST ${url}: ${response.status}`, 'driver');
} catch (error) {
wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error');
}
} | javascript | async function post(url, body) {
try {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(body),
});
wappalyzer.log(`POST ${url}: ${response.status}`, 'driver');
} catch (error) {
wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error');
}
} | [
"async",
"function",
"post",
"(",
"url",
",",
"body",
")",
"{",
"try",
"{",
"const",
"response",
"=",
"await",
"fetch",
"(",
"url",
",",
"{",
"method",
":",
"'POST'",
",",
"body",
":",
"JSON",
".",
"stringify",
"(",
"body",
")",
",",
"}",
")",
";... | Make a POST request | [
"Make",
"a",
"POST",
"request"
] | 47c1c22712f3108c194444f11c0ca317d5df8b9a | https://github.com/AliasIO/Wappalyzer/blob/47c1c22712f3108c194444f11c0ca317d5df8b9a/src/drivers/webextension/js/driver.js#L93-L104 |
5,730 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject... | javascript | function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject... | [
"function",
"(",
"it",
",",
"S",
")",
"{",
"if",
"(",
"!",
"_isObject",
"(",
"it",
")",
")",
"return",
"it",
";",
"var",
"fn",
",",
"val",
";",
"if",
"(",
"S",
"&&",
"typeof",
"(",
"fn",
"=",
"it",
".",
"toString",
")",
"==",
"'function'",
"&... | instead of the ES6 spec version, we didn't implement @@toPrimitive case and the second argument - flag - preferred type is a string | [
"instead",
"of",
"the",
"ES6",
"spec",
"version",
"we",
"didn",
"t",
"implement"
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L57-L64 | |
5,731 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | isEmpty | function isEmpty(data) {
if (Array.isArray(data)) {
return data.length === 0;
}
return Object.keys(data).length === 0;
} | javascript | function isEmpty(data) {
if (Array.isArray(data)) {
return data.length === 0;
}
return Object.keys(data).length === 0;
} | [
"function",
"isEmpty",
"(",
"data",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"data",
")",
")",
"{",
"return",
"data",
".",
"length",
"===",
"0",
";",
"}",
"return",
"Object",
".",
"keys",
"(",
"data",
")",
".",
"length",
"===",
"0",
";"... | Check if the given array or object is empty. | [
"Check",
"if",
"the",
"given",
"array",
"or",
"object",
"is",
"empty",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L532-L537 |
5,732 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | forOwn | function forOwn(object, iteratee) {
Object.keys(object).forEach(function (key) { return iteratee(object[key], key, object); });
} | javascript | function forOwn(object, iteratee) {
Object.keys(object).forEach(function (key) { return iteratee(object[key], key, object); });
} | [
"function",
"forOwn",
"(",
"object",
",",
"iteratee",
")",
"{",
"Object",
".",
"keys",
"(",
"object",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"iteratee",
"(",
"object",
"[",
"key",
"]",
",",
"key",
",",
"object",
")",
... | Iterates over own enumerable string keyed properties of an object and
invokes `iteratee` for each property. | [
"Iterates",
"over",
"own",
"enumerable",
"string",
"keyed",
"properties",
"of",
"an",
"object",
"and",
"invokes",
"iteratee",
"for",
"each",
"property",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L542-L544 |
5,733 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | map | function map(object, iteratee) {
return Object.keys(object).map(function (key) {
return iteratee(object[key], key, object);
});
} | javascript | function map(object, iteratee) {
return Object.keys(object).map(function (key) {
return iteratee(object[key], key, object);
});
} | [
"function",
"map",
"(",
"object",
",",
"iteratee",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"object",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"iteratee",
"(",
"object",
"[",
"key",
"]",
",",
"key",
",",
"object",
")... | Create an array from the object. | [
"Create",
"an",
"array",
"from",
"the",
"object",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L548-L552 |
5,734 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | orderBy | function orderBy(collection, keys, directions) {
var index = -1;
var result = collection.map(function (value) {
var criteria = keys.map(function (key) { return value[key]; });
return { criteria: criteria, index: ++index, value: value };
});
return baseSortBy(result, function (object, oth... | javascript | function orderBy(collection, keys, directions) {
var index = -1;
var result = collection.map(function (value) {
var criteria = keys.map(function (key) { return value[key]; });
return { criteria: criteria, index: ++index, value: value };
});
return baseSortBy(result, function (object, oth... | [
"function",
"orderBy",
"(",
"collection",
",",
"keys",
",",
"directions",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"var",
"result",
"=",
"collection",
".",
"map",
"(",
"function",
"(",
"value",
")",
"{",
"var",
"criteria",
"=",
"keys",
".",
"map... | Creates an array of elements, sorted in specified order by the results
of running each element in a collection thru each iteratee. | [
"Creates",
"an",
"array",
"of",
"elements",
"sorted",
"in",
"specified",
"order",
"by",
"the",
"results",
"of",
"running",
"each",
"element",
"in",
"a",
"collection",
"thru",
"each",
"iteratee",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L583-L592 |
5,735 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | groupBy | function groupBy(collection, iteratee) {
return collection.reduce(function (records, record) {
var key = iteratee(record);
if (records[key] === undefined) {
records[key] = [];
}
records[key].push(record);
return records;
}, {});
} | javascript | function groupBy(collection, iteratee) {
return collection.reduce(function (records, record) {
var key = iteratee(record);
if (records[key] === undefined) {
records[key] = [];
}
records[key].push(record);
return records;
}, {});
} | [
"function",
"groupBy",
"(",
"collection",
",",
"iteratee",
")",
"{",
"return",
"collection",
".",
"reduce",
"(",
"function",
"(",
"records",
",",
"record",
")",
"{",
"var",
"key",
"=",
"iteratee",
"(",
"record",
")",
";",
"if",
"(",
"records",
"[",
"ke... | Creates an object composed of keys generated from the results of running
each element of collection thru iteratee. | [
"Creates",
"an",
"object",
"composed",
"of",
"keys",
"generated",
"from",
"the",
"results",
"of",
"running",
"each",
"element",
"of",
"collection",
"thru",
"iteratee",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L597-L606 |
5,736 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | Type | function Type(model, value, mutator) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
/**
* Whether if the attribute can accept `null` as a value.
*/
_this.isNullable = false;
_this.value = value;
_this.mutator = mutator;
return... | javascript | function Type(model, value, mutator) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
/**
* Whether if the attribute can accept `null` as a value.
*/
_this.isNullable = false;
_this.value = value;
_this.mutator = mutator;
return... | [
"function",
"Type",
"(",
"model",
",",
"value",
",",
"mutator",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
")",
"/* istanbul ignore next */",
"||",
"this",
";",
"/**\n * Whether if the attribute can accept `null` as a va... | Create a new type instance. | [
"Create",
"a",
"new",
"type",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L685-L694 |
5,737 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | Attr | function Attr(model, value, mutator) {
var _this = _super.call(this, model, value, mutator) /* istanbul ignore next */ || this;
_this.value = value;
return _this;
} | javascript | function Attr(model, value, mutator) {
var _this = _super.call(this, model, value, mutator) /* istanbul ignore next */ || this;
_this.value = value;
return _this;
} | [
"function",
"Attr",
"(",
"model",
",",
"value",
",",
"mutator",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
",",
"value",
",",
"mutator",
")",
"/* istanbul ignore next */",
"||",
"this",
";",
"_this",
".",
"value",
... | Create a new attr instance. | [
"Create",
"a",
"new",
"attr",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L717-L721 |
5,738 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | HasOne | function HasOne(model, related, foreignKey, localKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.foreignKey = foreignKey;
_this.localKey = localKey;
return _this;
} | javascript | function HasOne(model, related, foreignKey, localKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.foreignKey = foreignKey;
_this.localKey = localKey;
return _this;
} | [
"function",
"HasOne",
"(",
"model",
",",
"related",
",",
"foreignKey",
",",
"localKey",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
")",
"/* istanbul ignore next */",
"||",
"this",
";",
"_this",
".",
"related",
"=",
"... | Create a new has one instance. | [
"Create",
"a",
"new",
"has",
"one",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L956-L962 |
5,739 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | HasManyBy | function HasManyBy(model, parent, foreignKey, ownerKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.parent = _this.model.relation(parent);
_this.foreignKey = foreignKey;
_this.ownerKey = ownerKey;
return _this;
} | javascript | function HasManyBy(model, parent, foreignKey, ownerKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.parent = _this.model.relation(parent);
_this.foreignKey = foreignKey;
_this.ownerKey = ownerKey;
return _this;
} | [
"function",
"HasManyBy",
"(",
"model",
",",
"parent",
",",
"foreignKey",
",",
"ownerKey",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
")",
"/* istanbul ignore next */",
"||",
"this",
";",
"_this",
".",
"parent",
"=",
... | Create a new has many by instance. | [
"Create",
"a",
"new",
"has",
"many",
"by",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L1216-L1222 |
5,740 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | HasManyThrough | function HasManyThrough(model, related, through, firstKey, secondKey, localKey, secondLocalKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.through = _this.model.relation(through);
_this.firstKey = firstK... | javascript | function HasManyThrough(model, related, through, firstKey, secondKey, localKey, secondLocalKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.through = _this.model.relation(through);
_this.firstKey = firstK... | [
"function",
"HasManyThrough",
"(",
"model",
",",
"related",
",",
"through",
",",
"firstKey",
",",
"secondKey",
",",
"localKey",
",",
"secondLocalKey",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
")",
"/* istanbul ignore n... | Create a new has many through instance. | [
"Create",
"a",
"new",
"has",
"many",
"through",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L1288-L1297 |
5,741 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | MorphTo | function MorphTo(model, id, type) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.id = id;
_this.type = type;
return _this;
} | javascript | function MorphTo(model, id, type) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.id = id;
_this.type = type;
return _this;
} | [
"function",
"MorphTo",
"(",
"model",
",",
"id",
",",
"type",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"model",
")",
"/* istanbul ignore next */",
"||",
"this",
";",
"_this",
".",
"id",
"=",
"id",
";",
"_this",
".",
"typ... | Create a new morph to instance. | [
"Create",
"a",
"new",
"morph",
"to",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L1480-L1485 |
5,742 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | denormalizeImmutable | function denormalizeImmutable(schema, input, unvisit) {
return Object.keys(schema).reduce(function (object, key) {
// Immutable maps cast keys to strings on write so we need to ensure
// we're accessing them using string keys.
var stringKey = '' + key;
if (object.has(stringKey)) {
return object... | javascript | function denormalizeImmutable(schema, input, unvisit) {
return Object.keys(schema).reduce(function (object, key) {
// Immutable maps cast keys to strings on write so we need to ensure
// we're accessing them using string keys.
var stringKey = '' + key;
if (object.has(stringKey)) {
return object... | [
"function",
"denormalizeImmutable",
"(",
"schema",
",",
"input",
",",
"unvisit",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"schema",
")",
".",
"reduce",
"(",
"function",
"(",
"object",
",",
"key",
")",
"{",
"// Immutable maps cast keys to strings on write ... | Denormalize an immutable entity.
@param {Schema} schema
@param {Immutable.Map|Immutable.Record} input
@param {function} unvisit
@param {function} getDenormalizedEntity
@return {Immutable.Map|Immutable.Record} | [
"Denormalize",
"an",
"immutable",
"entity",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L2553-L2565 |
5,743 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | Query | function Query(state, entity) {
/**
* Primary key ids to filter records by. It is used for filtering records
* direct key lookup when a user is trying to fetch records by its
* primary key.
*
* It should not be used if there is a logic which prevents index usage, for... | javascript | function Query(state, entity) {
/**
* Primary key ids to filter records by. It is used for filtering records
* direct key lookup when a user is trying to fetch records by its
* primary key.
*
* It should not be used if there is a logic which prevents index usage, for... | [
"function",
"Query",
"(",
"state",
",",
"entity",
")",
"{",
"/**\n * Primary key ids to filter records by. It is used for filtering records\n * direct key lookup when a user is trying to fetch records by its\n * primary key.\n *\n * It should not be used if th... | Create a new Query instance. | [
"Create",
"a",
"new",
"Query",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L3769-L3823 |
5,744 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | function (context, payload) {
var state = context.state;
var entity = state.$name;
return context.dispatch(state.$connection + "/insertOrUpdate", __assign({ entity: entity }, payload), { root: true });
} | javascript | function (context, payload) {
var state = context.state;
var entity = state.$name;
return context.dispatch(state.$connection + "/insertOrUpdate", __assign({ entity: entity }, payload), { root: true });
} | [
"function",
"(",
"context",
",",
"payload",
")",
"{",
"var",
"state",
"=",
"context",
".",
"state",
";",
"var",
"entity",
"=",
"state",
".",
"$name",
";",
"return",
"context",
".",
"dispatch",
"(",
"state",
".",
"$connection",
"+",
"\"/insertOrUpdate\"",
... | Insert or update given data to the state. Unlike `insert`, this method
will not replace existing data within the state, but it will update only
the submitted data with the same primary key. | [
"Insert",
"or",
"update",
"given",
"data",
"to",
"the",
"state",
".",
"Unlike",
"insert",
"this",
"method",
"will",
"not",
"replace",
"existing",
"data",
"within",
"the",
"state",
"but",
"it",
"will",
"update",
"only",
"the",
"submitted",
"data",
"with",
"... | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L4717-L4721 | |
5,745 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | function (state, payload) {
var entity = payload.entity;
var data = payload.data;
var options = OptionsBuilder.createPersistOptions(payload);
var result = payload.result;
result.data = (new Query(state, entity)).create(data, options);
} | javascript | function (state, payload) {
var entity = payload.entity;
var data = payload.data;
var options = OptionsBuilder.createPersistOptions(payload);
var result = payload.result;
result.data = (new Query(state, entity)).create(data, options);
} | [
"function",
"(",
"state",
",",
"payload",
")",
"{",
"var",
"entity",
"=",
"payload",
".",
"entity",
";",
"var",
"data",
"=",
"payload",
".",
"data",
";",
"var",
"options",
"=",
"OptionsBuilder",
".",
"createPersistOptions",
"(",
"payload",
")",
";",
"var... | Save given data to the store by replacing all existing records in the
store. If you want to save data without replacing existing records,
use the `insert` method instead. | [
"Save",
"given",
"data",
"to",
"the",
"store",
"by",
"replacing",
"all",
"existing",
"records",
"in",
"the",
"store",
".",
"If",
"you",
"want",
"to",
"save",
"data",
"without",
"replacing",
"existing",
"records",
"use",
"the",
"insert",
"method",
"instead",
... | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L4903-L4909 | |
5,746 | vuex-orm/vuex-orm | dist/vuex-orm.esm.js | Schema | function Schema(model) {
var _this = this;
/**
* List of generated schemas.
*/
this.schemas = {};
this.model = model;
var models = model.database().models();
Object.keys(models).forEach(function (name) { _this.one(models[name]); });
} | javascript | function Schema(model) {
var _this = this;
/**
* List of generated schemas.
*/
this.schemas = {};
this.model = model;
var models = model.database().models();
Object.keys(models).forEach(function (name) { _this.one(models[name]); });
} | [
"function",
"Schema",
"(",
"model",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"/**\n * List of generated schemas.\n */",
"this",
".",
"schemas",
"=",
"{",
"}",
";",
"this",
".",
"model",
"=",
"model",
";",
"var",
"models",
"=",
"model",
"."... | Create a new schema instance. | [
"Create",
"a",
"new",
"schema",
"instance",
"."
] | 36ab228a09566b1f6cdce9cec90d5795760120cb | https://github.com/vuex-orm/vuex-orm/blob/36ab228a09566b1f6cdce9cec90d5795760120cb/dist/vuex-orm.esm.js#L5041-L5050 |
5,747 | sdelements/lets-chat | media/js/util/message.js | encodeEntities | function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(surrogatePairRegexp, function(value) {
var hi = value.charCodeAt(0),
low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x1... | javascript | function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(surrogatePairRegexp, function(value) {
var hi = value.charCodeAt(0),
low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x1... | [
"function",
"encodeEntities",
"(",
"value",
")",
"{",
"return",
"value",
".",
"replace",
"(",
"/",
"&",
"/",
"g",
",",
"'&'",
")",
".",
"replace",
"(",
"surrogatePairRegexp",
",",
"function",
"(",
"value",
")",
"{",
"var",
"hi",
"=",
"value",
".",
... | Message Text Formatting | [
"Message",
"Text",
"Formatting"
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/util/message.js#L19-L32 |
5,748 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value, token) {
var score, pos;
if (!value) return 0;
value = String(value || '');
pos = value.search(token.regex);
if (pos === -1) return 0;
score = token.string.length / value.length;
if (pos === 0) score += 0.5;
return score;
} | javascript | function(value, token) {
var score, pos;
if (!value) return 0;
value = String(value || '');
pos = value.search(token.regex);
if (pos === -1) return 0;
score = token.string.length / value.length;
if (pos === 0) score += 0.5;
return score;
} | [
"function",
"(",
"value",
",",
"token",
")",
"{",
"var",
"score",
",",
"pos",
";",
"if",
"(",
"!",
"value",
")",
"return",
"0",
";",
"value",
"=",
"String",
"(",
"value",
"||",
"''",
")",
";",
"pos",
"=",
"value",
".",
"search",
"(",
"token",
"... | Calculates how close of a match the
given value is against a search token.
@param {mixed} value
@param {object} token
@return {number} | [
"Calculates",
"how",
"close",
"of",
"a",
"match",
"the",
"given",
"value",
"is",
"against",
"a",
"search",
"token",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L133-L143 | |
5,749 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(a, b) {
if (typeof a === 'number' && typeof b === 'number') {
return a > b ? 1 : (a < b ? -1 : 0);
}
a = asciifold(String(a || ''));
b = asciifold(String(b || ''));
if (a > b) return 1;
if (b > a) return -1;
return 0;
} | javascript | function(a, b) {
if (typeof a === 'number' && typeof b === 'number') {
return a > b ? 1 : (a < b ? -1 : 0);
}
a = asciifold(String(a || ''));
b = asciifold(String(b || ''));
if (a > b) return 1;
if (b > a) return -1;
return 0;
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"typeof",
"a",
"===",
"'number'",
"&&",
"typeof",
"b",
"===",
"'number'",
")",
"{",
"return",
"a",
">",
"b",
"?",
"1",
":",
"(",
"a",
"<",
"b",
"?",
"-",
"1",
":",
"0",
")",
";",
"}",
"... | utilities - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | [
"utilities",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L390-L399 | |
5,750 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(self, types, fn) {
var type;
var trigger = self.trigger;
var event_args = {};
// override trigger method
self.trigger = function() {
var type = arguments[0];
if (types.indexOf(type) !== -1) {
event_args[type] = arguments;
} else {
return trigger.apply(self, arguments);
}
};
... | javascript | function(self, types, fn) {
var type;
var trigger = self.trigger;
var event_args = {};
// override trigger method
self.trigger = function() {
var type = arguments[0];
if (types.indexOf(type) !== -1) {
event_args[type] = arguments;
} else {
return trigger.apply(self, arguments);
}
};
... | [
"function",
"(",
"self",
",",
"types",
",",
"fn",
")",
"{",
"var",
"type",
";",
"var",
"trigger",
"=",
"self",
".",
"trigger",
";",
"var",
"event_args",
"=",
"{",
"}",
";",
"// override trigger method",
"self",
".",
"trigger",
"=",
"function",
"(",
")"... | Debounce all fired events types listed in `types`
while executing the provided `fn`.
@param {object} self
@param {array} types
@param {function} fn | [
"Debounce",
"all",
"fired",
"events",
"types",
"listed",
"in",
"types",
"while",
"executing",
"the",
"provided",
"fn",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L864-L889 | |
5,751 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function($from, $to, properties) {
var i, n, styles = {};
if (properties) {
for (i = 0, n = properties.length; i < n; i++) {
styles[properties[i]] = $from.css(properties[i]);
}
} else {
styles = $from.css();
}
$to.css(styles);
} | javascript | function($from, $to, properties) {
var i, n, styles = {};
if (properties) {
for (i = 0, n = properties.length; i < n; i++) {
styles[properties[i]] = $from.css(properties[i]);
}
} else {
styles = $from.css();
}
$to.css(styles);
} | [
"function",
"(",
"$from",
",",
"$to",
",",
"properties",
")",
"{",
"var",
"i",
",",
"n",
",",
"styles",
"=",
"{",
"}",
";",
"if",
"(",
"properties",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"n",
"=",
"properties",
".",
"length",
";",
"i",
"<... | Copies CSS properties from one element to another.
@param {object} $from
@param {object} $to
@param {array} properties | [
"Copies",
"CSS",
"properties",
"from",
"one",
"element",
"to",
"another",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L942-L952 | |
5,752 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
var field_label = self.settings.labelField;
var field_optgroup = self.settings.optgroupLabelField;
var templates = {
'optgroup': function(data) {
return '<div class="optgroup">' + data.html + '</div>';
},
'optgroup_header': function(data, escape) {
retur... | javascript | function() {
var self = this;
var field_label = self.settings.labelField;
var field_optgroup = self.settings.optgroupLabelField;
var templates = {
'optgroup': function(data) {
return '<div class="optgroup">' + data.html + '</div>';
},
'optgroup_header': function(data, escape) {
retur... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"field_label",
"=",
"self",
".",
"settings",
".",
"labelField",
";",
"var",
"field_optgroup",
"=",
"self",
".",
"settings",
".",
"optgroupLabelField",
";",
"var",
"templates",
"=",
"{",
"... | Sets up default rendering functions. | [
"Sets",
"up",
"default",
"rendering",
"functions",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1330-L1354 | |
5,753 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var key, fn, callbacks = {
'initialize' : 'onInitialize',
'change' : 'onChange',
'item_add' : 'onItemAdd',
'item_remove' : 'onItemRemove',
'clear' : 'onClear',
'option_add' : 'onOptionAdd',
'option_remove' : 'onOptionRemove',
'opt... | javascript | function() {
var key, fn, callbacks = {
'initialize' : 'onInitialize',
'change' : 'onChange',
'item_add' : 'onItemAdd',
'item_remove' : 'onItemRemove',
'clear' : 'onClear',
'option_add' : 'onOptionAdd',
'option_remove' : 'onOptionRemove',
'opt... | [
"function",
"(",
")",
"{",
"var",
"key",
",",
"fn",
",",
"callbacks",
"=",
"{",
"'initialize'",
":",
"'onInitialize'",
",",
"'change'",
":",
"'onChange'",
",",
"'item_add'",
":",
"'onItemAdd'",
",",
"'item_remove'",
":",
"'onItemRemove'",
",",
"'clear'",
":"... | Maps fired events to callbacks provided
in the settings used when creating the control. | [
"Maps",
"fired",
"events",
"to",
"callbacks",
"provided",
"in",
"the",
"settings",
"used",
"when",
"creating",
"the",
"control",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1360-L1387 | |
5,754 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(e) {
var self = this;
var defaultPrevented = e.isDefaultPrevented();
var $target = $(e.target);
if (self.isFocused) {
// retain focus by preventing native handling. if the
// event target is the input it should not be modified.
// otherwise, text selection within the input won't work.... | javascript | function(e) {
var self = this;
var defaultPrevented = e.isDefaultPrevented();
var $target = $(e.target);
if (self.isFocused) {
// retain focus by preventing native handling. if the
// event target is the input it should not be modified.
// otherwise, text selection within the input won't work.... | [
"function",
"(",
"e",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"defaultPrevented",
"=",
"e",
".",
"isDefaultPrevented",
"(",
")",
";",
"var",
"$target",
"=",
"$",
"(",
"e",
".",
"target",
")",
";",
"if",
"(",
"self",
".",
"isFocused",
")",... | Triggered when the main control element
has a mouse down event.
@param {object} e
@return {boolean} | [
"Triggered",
"when",
"the",
"main",
"control",
"element",
"has",
"a",
"mouse",
"down",
"event",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1414-L1440 | |
5,755 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(e) {
var value, $target, $option, self = this;
if (e.preventDefault) {
e.preventDefault();
e.stopPropagation();
}
$target = $(e.currentTarget);
if ($target.hasClass('create')) {
self.createItem(null, function() {
if (self.settings.closeAfterSelect) {
self.close();
... | javascript | function(e) {
var value, $target, $option, self = this;
if (e.preventDefault) {
e.preventDefault();
e.stopPropagation();
}
$target = $(e.currentTarget);
if ($target.hasClass('create')) {
self.createItem(null, function() {
if (self.settings.closeAfterSelect) {
self.close();
... | [
"function",
"(",
"e",
")",
"{",
"var",
"value",
",",
"$target",
",",
"$option",
",",
"self",
"=",
"this",
";",
"if",
"(",
"e",
".",
"preventDefault",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"e",
".",
"stopPropagation",
"(",
")",
";",
... | Triggered when the user clicks on an option
in the autocomplete dropdown menu.
@param {object} e
@returns {boolean} | [
"Triggered",
"when",
"the",
"user",
"clicks",
"on",
"an",
"option",
"in",
"the",
"autocomplete",
"dropdown",
"menu",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1713-L1741 | |
5,756 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(e) {
var self = this;
if (self.isLocked) return;
if (self.settings.mode === 'multi') {
e.preventDefault();
self.setActiveItem(e.currentTarget, e);
}
} | javascript | function(e) {
var self = this;
if (self.isLocked) return;
if (self.settings.mode === 'multi') {
e.preventDefault();
self.setActiveItem(e.currentTarget, e);
}
} | [
"function",
"(",
"e",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"isLocked",
")",
"return",
";",
"if",
"(",
"self",
".",
"settings",
".",
"mode",
"===",
"'multi'",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"self... | Triggered when the user clicks on an item
that has been selected.
@param {object} e
@returns {boolean} | [
"Triggered",
"when",
"the",
"user",
"clicks",
"on",
"an",
"item",
"that",
"has",
"been",
"selected",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1750-L1758 | |
5,757 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value) {
var $input = this.$control_input;
var changed = $input.val() !== value;
if (changed) {
$input.val(value).triggerHandler('update');
this.lastValue = value;
}
} | javascript | function(value) {
var $input = this.$control_input;
var changed = $input.val() !== value;
if (changed) {
$input.val(value).triggerHandler('update');
this.lastValue = value;
}
} | [
"function",
"(",
"value",
")",
"{",
"var",
"$input",
"=",
"this",
".",
"$control_input",
";",
"var",
"changed",
"=",
"$input",
".",
"val",
"(",
")",
"!==",
"value",
";",
"if",
"(",
"changed",
")",
"{",
"$input",
".",
"val",
"(",
"value",
")",
".",
... | Sets the input field of the control to the specified value.
@param {string} value | [
"Sets",
"the",
"input",
"field",
"of",
"the",
"control",
"to",
"the",
"specified",
"value",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1790-L1797 | |
5,758 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value, silent) {
var events = silent ? [] : ['change'];
debounce_events(this, events, function() {
this.clear();
this.addItems(value, silent);
});
} | javascript | function(value, silent) {
var events = silent ? [] : ['change'];
debounce_events(this, events, function() {
this.clear();
this.addItems(value, silent);
});
} | [
"function",
"(",
"value",
",",
"silent",
")",
"{",
"var",
"events",
"=",
"silent",
"?",
"[",
"]",
":",
"[",
"'change'",
"]",
";",
"debounce_events",
"(",
"this",
",",
"events",
",",
"function",
"(",
")",
"{",
"this",
".",
"clear",
"(",
")",
";",
... | Resets the selected items to the given value.
@param {mixed} value | [
"Resets",
"the",
"selected",
"items",
"to",
"the",
"given",
"value",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1820-L1827 | |
5,759 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function($item, e) {
var self = this;
var eventName;
var i, idx, begin, end, item, swap;
var $last;
if (self.settings.mode === 'single') return;
$item = $($item);
// clear the active selection
if (!$item.length) {
$(self.$activeItems).removeClass('active');
self.$activeItems = [];
... | javascript | function($item, e) {
var self = this;
var eventName;
var i, idx, begin, end, item, swap;
var $last;
if (self.settings.mode === 'single') return;
$item = $($item);
// clear the active selection
if (!$item.length) {
$(self.$activeItems).removeClass('active');
self.$activeItems = [];
... | [
"function",
"(",
"$item",
",",
"e",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"eventName",
";",
"var",
"i",
",",
"idx",
",",
"begin",
",",
"end",
",",
"item",
",",
"swap",
";",
"var",
"$last",
";",
"if",
"(",
"self",
".",
"settings",
".... | Sets the selected item.
@param {object} $item
@param {object} e (optional) | [
"Sets",
"the",
"selected",
"item",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1835-L1892 | |
5,760 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
self.setTextboxValue('');
self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
self.isInputHidden = true;
} | javascript | function() {
var self = this;
self.setTextboxValue('');
self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
self.isInputHidden = true;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"setTextboxValue",
"(",
"''",
")",
";",
"self",
".",
"$control_input",
".",
"css",
"(",
"{",
"opacity",
":",
"0",
",",
"position",
":",
"'absolute'",
",",
"left",
":",
"self",
... | Hides the input element out of view, while
retaining its focus. | [
"Hides",
"the",
"input",
"element",
"out",
"of",
"view",
"while",
"retaining",
"its",
"focus",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1952-L1958 | |
5,761 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
if (self.isDisabled) return;
self.ignoreFocus = true;
self.$control_input[0].focus();
window.setTimeout(function() {
self.ignoreFocus = false;
self.onFocus();
}, 0);
} | javascript | function() {
var self = this;
if (self.isDisabled) return;
self.ignoreFocus = true;
self.$control_input[0].focus();
window.setTimeout(function() {
self.ignoreFocus = false;
self.onFocus();
}, 0);
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"isDisabled",
")",
"return",
";",
"self",
".",
"ignoreFocus",
"=",
"true",
";",
"self",
".",
"$control_input",
"[",
"0",
"]",
".",
"focus",
"(",
")",
";",
"window",... | Gives the control focus. | [
"Gives",
"the",
"control",
"focus",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L1971-L1981 | |
5,762 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(query) {
var i, value, score, result, calculateScore;
var self = this;
var settings = self.settings;
var options = this.getSearchOptions();
// validate user-provided result scoring function
if (settings.score) {
calculateScore = self.settings.score.apply(this, [query]);
if (typ... | javascript | function(query) {
var i, value, score, result, calculateScore;
var self = this;
var settings = self.settings;
var options = this.getSearchOptions();
// validate user-provided result scoring function
if (settings.score) {
calculateScore = self.settings.score.apply(this, [query]);
if (typ... | [
"function",
"(",
"query",
")",
"{",
"var",
"i",
",",
"value",
",",
"score",
",",
"result",
",",
"calculateScore",
";",
"var",
"self",
"=",
"this",
";",
"var",
"settings",
"=",
"self",
".",
"settings",
";",
"var",
"options",
"=",
"this",
".",
"getSear... | Searches through available options and returns
a sorted array of matches.
Returns an object containing:
- query {string}
- tokens {array}
- total {int}
- items {array}
@param {string} query
@returns {object} | [
"Searches",
"through",
"available",
"options",
"and",
"returns",
"a",
"sorted",
"array",
"of",
"matches",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2041-L2074 | |
5,763 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(data) {
var key = hash_key(data[this.settings.optgroupValueField]);
if (!key) return false;
data.$order = data.$order || ++this.order;
this.optgroups[key] = data;
return key;
} | javascript | function(data) {
var key = hash_key(data[this.settings.optgroupValueField]);
if (!key) return false;
data.$order = data.$order || ++this.order;
this.optgroups[key] = data;
return key;
} | [
"function",
"(",
"data",
")",
"{",
"var",
"key",
"=",
"hash_key",
"(",
"data",
"[",
"this",
".",
"settings",
".",
"optgroupValueField",
"]",
")",
";",
"if",
"(",
"!",
"key",
")",
"return",
"false",
";",
"data",
".",
"$order",
"=",
"data",
".",
"$or... | Registers an option group to the pool of option groups.
@param {object} data
@return {boolean|string} | [
"Registers",
"an",
"option",
"group",
"to",
"the",
"pool",
"of",
"option",
"groups",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2251-L2258 | |
5,764 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(id, data) {
data[this.settings.optgroupValueField] = id;
if (id = this.registerOptionGroup(data)) {
this.trigger('optgroup_add', id, data);
}
} | javascript | function(id, data) {
data[this.settings.optgroupValueField] = id;
if (id = this.registerOptionGroup(data)) {
this.trigger('optgroup_add', id, data);
}
} | [
"function",
"(",
"id",
",",
"data",
")",
"{",
"data",
"[",
"this",
".",
"settings",
".",
"optgroupValueField",
"]",
"=",
"id",
";",
"if",
"(",
"id",
"=",
"this",
".",
"registerOptionGroup",
"(",
"data",
")",
")",
"{",
"this",
".",
"trigger",
"(",
"... | Registers a new optgroup for options
to be bucketed into.
@param {string} id
@param {object} data | [
"Registers",
"a",
"new",
"optgroup",
"for",
"options",
"to",
"be",
"bucketed",
"into",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2267-L2272 | |
5,765 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value, data) {
var self = this;
var $item, $item_new;
var value_new, index_item, cache_items, cache_options, order_old;
value = hash_key(value);
value_new = hash_key(data[self.settings.valueField]);
// sanity checks
if (value === null) return;
if (!self.options.hasOwnProperty(va... | javascript | function(value, data) {
var self = this;
var $item, $item_new;
var value_new, index_item, cache_items, cache_options, order_old;
value = hash_key(value);
value_new = hash_key(data[self.settings.valueField]);
// sanity checks
if (value === null) return;
if (!self.options.hasOwnProperty(va... | [
"function",
"(",
"value",
",",
"data",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"$item",
",",
"$item_new",
";",
"var",
"value_new",
",",
"index_item",
",",
"cache_items",
",",
"cache_options",
",",
"order_old",
";",
"value",
"=",
"hash_key",
"("... | Updates an option available for selection. If
it is visible in the selected items or options
dropdown, it will be re-rendered automatically.
@param {string} value
@param {object} data | [
"Updates",
"an",
"option",
"available",
"for",
"selection",
".",
"If",
"it",
"is",
"visible",
"in",
"the",
"selected",
"items",
"or",
"options",
"dropdown",
"it",
"will",
"be",
"re",
"-",
"rendered",
"automatically",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2304-L2358 | |
5,766 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value, silent) {
var self = this;
value = hash_key(value);
var cache_items = self.renderCache['item'];
var cache_options = self.renderCache['option'];
if (cache_items) delete cache_items[value];
if (cache_options) delete cache_options[value];
delete self.userOptions[value];
delete s... | javascript | function(value, silent) {
var self = this;
value = hash_key(value);
var cache_items = self.renderCache['item'];
var cache_options = self.renderCache['option'];
if (cache_items) delete cache_items[value];
if (cache_options) delete cache_options[value];
delete self.userOptions[value];
delete s... | [
"function",
"(",
"value",
",",
"silent",
")",
"{",
"var",
"self",
"=",
"this",
";",
"value",
"=",
"hash_key",
"(",
"value",
")",
";",
"var",
"cache_items",
"=",
"self",
".",
"renderCache",
"[",
"'item'",
"]",
";",
"var",
"cache_options",
"=",
"self",
... | Removes a single option.
@param {string} value
@param {boolean} silent | [
"Removes",
"a",
"single",
"option",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2366-L2380 | |
5,767 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
self.loadedSearches = {};
self.userOptions = {};
self.renderCache = {};
self.options = self.sifter.items = {};
self.lastQuery = null;
self.trigger('option_clear');
self.clear();
} | javascript | function() {
var self = this;
self.loadedSearches = {};
self.userOptions = {};
self.renderCache = {};
self.options = self.sifter.items = {};
self.lastQuery = null;
self.trigger('option_clear');
self.clear();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"loadedSearches",
"=",
"{",
"}",
";",
"self",
".",
"userOptions",
"=",
"{",
"}",
";",
"self",
".",
"renderCache",
"=",
"{",
"}",
";",
"self",
".",
"options",
"=",
"self",
".... | Clears all options. | [
"Clears",
"all",
"options",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2385-L2395 | |
5,768 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(value, $els) {
value = hash_key(value);
if (typeof value !== 'undefined' && value !== null) {
for (var i = 0, n = $els.length; i < n; i++) {
if ($els[i].getAttribute('data-value') === value) {
return $($els[i]);
}
}
}
return $();
} | javascript | function(value, $els) {
value = hash_key(value);
if (typeof value !== 'undefined' && value !== null) {
for (var i = 0, n = $els.length; i < n; i++) {
if ($els[i].getAttribute('data-value') === value) {
return $($els[i]);
}
}
}
return $();
} | [
"function",
"(",
"value",
",",
"$els",
")",
"{",
"value",
"=",
"hash_key",
"(",
"value",
")",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'undefined'",
"&&",
"value",
"!==",
"null",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"$els"... | Finds the first element with a "data-value" attribute
that matches the given value.
@param {mixed} value
@param {object} $els
@return {object} | [
"Finds",
"the",
"first",
"element",
"with",
"a",
"data",
"-",
"value",
"attribute",
"that",
"matches",
"the",
"given",
"value",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2431-L2443 | |
5,769 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(values, silent) {
var items = $.isArray(values) ? values : [values];
for (var i = 0, n = items.length; i < n; i++) {
this.isPending = (i < n - 1);
this.addItem(items[i], silent);
}
} | javascript | function(values, silent) {
var items = $.isArray(values) ? values : [values];
for (var i = 0, n = items.length; i < n; i++) {
this.isPending = (i < n - 1);
this.addItem(items[i], silent);
}
} | [
"function",
"(",
"values",
",",
"silent",
")",
"{",
"var",
"items",
"=",
"$",
".",
"isArray",
"(",
"values",
")",
"?",
"values",
":",
"[",
"values",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"items",
".",
"length",
";",
"i",
... | "Selects" multiple items at once. Adds them to the list
at the current caret position.
@param {string} value
@param {boolean} silent | [
"Selects",
"multiple",
"items",
"at",
"once",
".",
"Adds",
"them",
"to",
"the",
"list",
"at",
"the",
"current",
"caret",
"position",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2463-L2469 | |
5,770 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(input, triggerDropdown) {
var self = this;
var caret = self.caretPos;
input = input || $.trim(self.$control_input.val() || '');
var callback = arguments[arguments.length - 1];
if (typeof callback !== 'function') callback = function() {};
if (typeof triggerDropdown !== 'boolean') {
tr... | javascript | function(input, triggerDropdown) {
var self = this;
var caret = self.caretPos;
input = input || $.trim(self.$control_input.val() || '');
var callback = arguments[arguments.length - 1];
if (typeof callback !== 'function') callback = function() {};
if (typeof triggerDropdown !== 'boolean') {
tr... | [
"function",
"(",
"input",
",",
"triggerDropdown",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"caret",
"=",
"self",
".",
"caretPos",
";",
"input",
"=",
"input",
"||",
"$",
".",
"trim",
"(",
"self",
".",
"$control_input",
".",
"val",
"(",
")",
... | Invokes the `create` method provided in the
selectize options that should provide the data
for the new item, given the user input.
Once this completes, it will be added
to the item list.
@param {string} value
@param {boolean} [triggerDropdown]
@param {function} [callback]
@return {boolean} | [
"Invokes",
"the",
"create",
"method",
"provided",
"in",
"the",
"selectize",
"options",
"that",
"should",
"provide",
"the",
"data",
"for",
"the",
"new",
"item",
"given",
"the",
"user",
"input",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2584-L2631 | |
5,771 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var invalid, self = this;
if (self.isRequired) {
if (self.items.length) self.isInvalid = false;
self.$control_input.prop('required', invalid);
}
self.refreshClasses();
} | javascript | function() {
var invalid, self = this;
if (self.isRequired) {
if (self.items.length) self.isInvalid = false;
self.$control_input.prop('required', invalid);
}
self.refreshClasses();
} | [
"function",
"(",
")",
"{",
"var",
"invalid",
",",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"isRequired",
")",
"{",
"if",
"(",
"self",
".",
"items",
".",
"length",
")",
"self",
".",
"isInvalid",
"=",
"false",
";",
"self",
".",
"$control_inp... | Updates all state-dependent attributes
and CSS classes. | [
"Updates",
"all",
"state",
"-",
"dependent",
"attributes",
"and",
"CSS",
"classes",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2651-L2658 | |
5,772 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
var isFull = self.isFull();
var isLocked = self.isLocked;
self.$wrapper
.toggleClass('rtl', self.rtl);
self.$control
.toggleClass('focus', self.isFocused)
.toggleClass('disabled', self.isDisabled)
.toggleClass('required', self.isRequired)
.toggl... | javascript | function() {
var self = this;
var isFull = self.isFull();
var isLocked = self.isLocked;
self.$wrapper
.toggleClass('rtl', self.rtl);
self.$control
.toggleClass('focus', self.isFocused)
.toggleClass('disabled', self.isDisabled)
.toggleClass('required', self.isRequired)
.toggl... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"isFull",
"=",
"self",
".",
"isFull",
"(",
")",
";",
"var",
"isLocked",
"=",
"self",
".",
"isLocked",
";",
"self",
".",
"$wrapper",
".",
"toggleClass",
"(",
"'rtl'",
",",
"self",
".... | Updates all state-dependent CSS classes. | [
"Updates",
"all",
"state",
"-",
"dependent",
"CSS",
"classes",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2663-L2684 | |
5,773 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
self.focus();
self.isOpen = true;
self.refreshState();
self.$dropdown.css({visibility: 'hidden', display: 'block'});
self.positionDropdown();
self.$dropdown.css({visibil... | javascript | function() {
var self = this;
if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
self.focus();
self.isOpen = true;
self.refreshState();
self.$dropdown.css({visibility: 'hidden', display: 'block'});
self.positionDropdown();
self.$dropdown.css({visibil... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"isLocked",
"||",
"self",
".",
"isOpen",
"||",
"(",
"self",
".",
"settings",
".",
"mode",
"===",
"'multi'",
"&&",
"self",
".",
"isFull",
"(",
")",
")",
")",
"retu... | Shows the autocomplete dropdown containing
the available options. | [
"Shows",
"the",
"autocomplete",
"dropdown",
"containing",
"the",
"available",
"options",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2746-L2757 | |
5,774 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var $control = this.$control;
var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
offset.top += $control.outerHeight(true);
this.$dropdown.css({
width : $control.outerWidth(),
top : offset.top,
left : offset.left
});
} | javascript | function() {
var $control = this.$control;
var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
offset.top += $control.outerHeight(true);
this.$dropdown.css({
width : $control.outerWidth(),
top : offset.top,
left : offset.left
});
} | [
"function",
"(",
")",
"{",
"var",
"$control",
"=",
"this",
".",
"$control",
";",
"var",
"offset",
"=",
"this",
".",
"settings",
".",
"dropdownParent",
"===",
"'body'",
"?",
"$control",
".",
"offset",
"(",
")",
":",
"$control",
".",
"position",
"(",
")"... | Calculates and applies the appropriate
position of the dropdown. | [
"Calculates",
"and",
"applies",
"the",
"appropriate",
"position",
"of",
"the",
"dropdown",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2782-L2792 | |
5,775 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function($el) {
var caret = Math.min(this.caretPos, this.items.length);
if (caret === 0) {
this.$control.prepend($el);
} else {
$(this.$control[0].childNodes[caret]).before($el);
}
this.setCaret(caret + 1);
} | javascript | function($el) {
var caret = Math.min(this.caretPos, this.items.length);
if (caret === 0) {
this.$control.prepend($el);
} else {
$(this.$control[0].childNodes[caret]).before($el);
}
this.setCaret(caret + 1);
} | [
"function",
"(",
"$el",
")",
"{",
"var",
"caret",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"caretPos",
",",
"this",
".",
"items",
".",
"length",
")",
";",
"if",
"(",
"caret",
"===",
"0",
")",
"{",
"this",
".",
"$control",
".",
"prepend",
"(",
... | A helper method for inserting an element
at the current caret position.
@param {object} $el | [
"A",
"helper",
"method",
"for",
"inserting",
"an",
"element",
"at",
"the",
"current",
"caret",
"position",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2822-L2830 | |
5,776 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(i) {
var self = this;
if (self.settings.mode === 'single') {
i = self.items.length;
} else {
i = Math.max(0, Math.min(self.items.length, i));
}
if(!self.isPending) {
// the input must be moved by leaving it in place and moving the
// siblings, due to the fact that focus canno... | javascript | function(i) {
var self = this;
if (self.settings.mode === 'single') {
i = self.items.length;
} else {
i = Math.max(0, Math.min(self.items.length, i));
}
if(!self.isPending) {
// the input must be moved by leaving it in place and moving the
// siblings, due to the fact that focus canno... | [
"function",
"(",
"i",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"settings",
".",
"mode",
"===",
"'single'",
")",
"{",
"i",
"=",
"self",
".",
"items",
".",
"length",
";",
"}",
"else",
"{",
"i",
"=",
"Math",
".",
"max",
... | Moves the caret to the specified index.
@param {int} i | [
"Moves",
"the",
"caret",
"to",
"the",
"specified",
"index",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L2968-L2994 | |
5,777 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
self.$input.prop('disabled', true);
self.$control_input.prop('disabled', true).prop('tabindex', -1);
self.isDisabled = true;
self.lock();
} | javascript | function() {
var self = this;
self.$input.prop('disabled', true);
self.$control_input.prop('disabled', true).prop('tabindex', -1);
self.isDisabled = true;
self.lock();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"$input",
".",
"prop",
"(",
"'disabled'",
",",
"true",
")",
";",
"self",
".",
"$control_input",
".",
"prop",
"(",
"'disabled'",
",",
"true",
")",
".",
"prop",
"(",
"'tabindex'",... | Disables user input on the control completely.
While disabled, it cannot receive focus. | [
"Disables",
"user",
"input",
"on",
"the",
"control",
"completely",
".",
"While",
"disabled",
"it",
"cannot",
"receive",
"focus",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L3018-L3024 | |
5,778 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
self.$input.prop('disabled', false);
self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
self.isDisabled = false;
self.unlock();
} | javascript | function() {
var self = this;
self.$input.prop('disabled', false);
self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
self.isDisabled = false;
self.unlock();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"$input",
".",
"prop",
"(",
"'disabled'",
",",
"false",
")",
";",
"self",
".",
"$control_input",
".",
"prop",
"(",
"'disabled'",
",",
"false",
")",
".",
"prop",
"(",
"'tabindex'... | Enables the control so that it can respond
to focus and user input. | [
"Enables",
"the",
"control",
"so",
"that",
"it",
"can",
"respond",
"to",
"focus",
"and",
"user",
"input",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L3030-L3036 | |
5,779 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function() {
var self = this;
var eventNS = self.eventNS;
var revertSettings = self.revertSettings;
self.trigger('destroy');
self.off();
self.$wrapper.remove();
self.$dropdown.remove();
self.$input
.html('')
.append(revertSettings.$children)
.removeAttr('tabindex')
.removeCla... | javascript | function() {
var self = this;
var eventNS = self.eventNS;
var revertSettings = self.revertSettings;
self.trigger('destroy');
self.off();
self.$wrapper.remove();
self.$dropdown.remove();
self.$input
.html('')
.append(revertSettings.$children)
.removeAttr('tabindex')
.removeCla... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"eventNS",
"=",
"self",
".",
"eventNS",
";",
"var",
"revertSettings",
"=",
"self",
".",
"revertSettings",
";",
"self",
".",
"trigger",
"(",
"'destroy'",
")",
";",
"self",
".",
"off",
... | Completely destroys the control and
unbinds all event listeners so that it can
be garbage collected. | [
"Completely",
"destroys",
"the",
"control",
"and",
"unbinds",
"all",
"event",
"listeners",
"so",
"that",
"it",
"can",
"be",
"garbage",
"collected",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L3043-L3069 | |
5,780 | sdelements/lets-chat | media/js/vendor/selectize/selectize.js | function(input) {
var self = this;
if (!self.settings.create) return false;
var filter = self.settings.createFilter;
return input.length
&& (typeof filter !== 'function' || filter.apply(self, [input]))
&& (typeof filter !== 'string' || new RegExp(filter).test(input))
&& (!(filter instanceof RegE... | javascript | function(input) {
var self = this;
if (!self.settings.create) return false;
var filter = self.settings.createFilter;
return input.length
&& (typeof filter !== 'function' || filter.apply(self, [input]))
&& (typeof filter !== 'string' || new RegExp(filter).test(input))
&& (!(filter instanceof RegE... | [
"function",
"(",
"input",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"settings",
".",
"create",
")",
"return",
"false",
";",
"var",
"filter",
"=",
"self",
".",
"settings",
".",
"createFilter",
";",
"return",
"input",
".",... | Determines whether or not to display the
create item prompt, given a user input.
@param {string} input
@return {boolean} | [
"Determines",
"whether",
"or",
"not",
"to",
"display",
"the",
"create",
"item",
"prompt",
"given",
"a",
"user",
"input",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/selectize/selectize.js#L3147-L3155 | |
5,781 | sdelements/lets-chat | media/js/vendor/bootstrap-daterangepicker/daterangepicker.js | function (e) {
var el = $(e.target);
var date = moment(el.val(), this.format);
if (!date.isValid()) return;
var startDate, endDate;
if (el.attr('name') === 'daterangepicker_start') {
startDate = date;
endDate = this.endDate;
... | javascript | function (e) {
var el = $(e.target);
var date = moment(el.val(), this.format);
if (!date.isValid()) return;
var startDate, endDate;
if (el.attr('name') === 'daterangepicker_start') {
startDate = date;
endDate = this.endDate;
... | [
"function",
"(",
"e",
")",
"{",
"var",
"el",
"=",
"$",
"(",
"e",
".",
"target",
")",
";",
"var",
"date",
"=",
"moment",
"(",
"el",
".",
"val",
"(",
")",
",",
"this",
".",
"format",
")",
";",
"if",
"(",
"!",
"date",
".",
"isValid",
"(",
")",... | when a date is typed into the start to end date textboxes | [
"when",
"a",
"date",
"is",
"typed",
"into",
"the",
"start",
"to",
"end",
"date",
"textboxes"
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/bootstrap-daterangepicker/daterangepicker.js#L675-L689 | |
5,782 | sdelements/lets-chat | media/js/vendor/jquery-validate/jquery.validate.js | function( element, method ) {
return $( element ).data( "msg" + method[ 0 ].toUpperCase() +
method.substring( 1 ).toLowerCase() ) || $( element ).data("msg");
} | javascript | function( element, method ) {
return $( element ).data( "msg" + method[ 0 ].toUpperCase() +
method.substring( 1 ).toLowerCase() ) || $( element ).data("msg");
} | [
"function",
"(",
"element",
",",
"method",
")",
"{",
"return",
"$",
"(",
"element",
")",
".",
"data",
"(",
"\"msg\"",
"+",
"method",
"[",
"0",
"]",
".",
"toUpperCase",
"(",
")",
"+",
"method",
".",
"substring",
"(",
"1",
")",
".",
"toLowerCase",
"(... | return the custom message for the given element and validation method specified in the element's HTML5 data attribute return the generic message if present and no method specific message is present | [
"return",
"the",
"custom",
"message",
"for",
"the",
"given",
"element",
"and",
"validation",
"method",
"specified",
"in",
"the",
"element",
"s",
"HTML5",
"data",
"attribute",
"return",
"the",
"generic",
"message",
"if",
"present",
"and",
"no",
"method",
"speci... | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/jquery-validate/jquery.validate.js#L627-L630 | |
5,783 | sdelements/lets-chat | media/js/vendor/jquery-validate/jquery.validate.js | function( name, method ) {
var m = this.settings.messages[name];
return m && (m.constructor === String ? m : m[method]);
} | javascript | function( name, method ) {
var m = this.settings.messages[name];
return m && (m.constructor === String ? m : m[method]);
} | [
"function",
"(",
"name",
",",
"method",
")",
"{",
"var",
"m",
"=",
"this",
".",
"settings",
".",
"messages",
"[",
"name",
"]",
";",
"return",
"m",
"&&",
"(",
"m",
".",
"constructor",
"===",
"String",
"?",
"m",
":",
"m",
"[",
"method",
"]",
")",
... | return the custom message for the given element name and validation method | [
"return",
"the",
"custom",
"message",
"for",
"the",
"given",
"element",
"name",
"and",
"validation",
"method"
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/jquery-validate/jquery.validate.js#L633-L636 | |
5,784 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | compareAscending | function compareAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var value = ac[index],
other = bc[index];
if (value !== other) {
if (value > other || typeof value == 'undefined') {
... | javascript | function compareAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var value = ac[index],
other = bc[index];
if (value !== other) {
if (value > other || typeof value == 'undefined') {
... | [
"function",
"compareAscending",
"(",
"a",
",",
"b",
")",
"{",
"var",
"ac",
"=",
"a",
".",
"criteria",
",",
"bc",
"=",
"b",
".",
"criteria",
",",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"ac",
".",
"length",
";",
"while",
"(",
"++",
"index",
... | Used by `sortBy` to compare transformed `collection` elements, stable sorting
them in ascending order.
@private
@param {Object} a The object to compare to `b`.
@param {Object} b The object to compare to `a`.
@returns {number} Returns the sort order indicator of `1` or `-1`. | [
"Used",
"by",
"sortBy",
"to",
"compare",
"transformed",
"collection",
"elements",
"stable",
"sorting",
"them",
"in",
"ascending",
"order",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L116-L142 |
5,785 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | slice | function slice(array, start, end) {
start || (start = 0);
if (typeof end == 'undefined') {
end = array ? array.length : 0;
}
var index = -1,
length = end - start || 0,
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = array[start + index... | javascript | function slice(array, start, end) {
start || (start = 0);
if (typeof end == 'undefined') {
end = array ? array.length : 0;
}
var index = -1,
length = end - start || 0,
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = array[start + index... | [
"function",
"slice",
"(",
"array",
",",
"start",
",",
"end",
")",
"{",
"start",
"||",
"(",
"start",
"=",
"0",
")",
";",
"if",
"(",
"typeof",
"end",
"==",
"'undefined'",
")",
"{",
"end",
"=",
"array",
"?",
"array",
".",
"length",
":",
"0",
";",
... | Slices the `collection` from the `start` index up to, but not including,
the `end` index.
Note: This function is used instead of `Array#slice` to support node lists
in IE < 9 and to ensure dense arrays are returned.
@private
@param {Array|Object|string} collection The collection to slice.
@param {number} start The st... | [
"Slices",
"the",
"collection",
"from",
"the",
"start",
"index",
"up",
"to",
"but",
"not",
"including",
"the",
"end",
"index",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L169-L182 |
5,786 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | createAggregator | function createAggregator(setter) {
return function(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
... | javascript | function createAggregator(setter) {
return function(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
... | [
"function",
"createAggregator",
"(",
"setter",
")",
"{",
"return",
"function",
"(",
"collection",
",",
"callback",
",",
"thisArg",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"callback",
"=",
"createCallback",
"(",
"callback",
",",
"thisArg",
",",
"3",
... | Creates a function that aggregates a collection, creating an object composed
of keys generated from the results of running each element of the collection
through a callback. The given `setter` function sets the keys and values
of the composed object.
@private
@param {Function} setter The setter function.
@returns {Fun... | [
"Creates",
"a",
"function",
"that",
"aggregates",
"a",
"collection",
"creating",
"an",
"object",
"composed",
"of",
"keys",
"generated",
"from",
"the",
"results",
"of",
"running",
"each",
"element",
"of",
"the",
"collection",
"through",
"a",
"callback",
".",
"T... | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L775-L795 |
5,787 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | invert | function invert(object) {
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
result[object[key]] = key;
}
return result;
} | javascript | function invert(object) {
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
result[object[key]] = key;
}
return result;
} | [
"function",
"invert",
"(",
"object",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"props",
"=",
"keys",
"(",
"object",
")",
",",
"length",
"=",
"props",
".",
"length",
",",
"result",
"=",
"{",
"}",
";",
"while",
"(",
"++",
"index",
"<",
"length"... | Creates an object composed of the inverted keys and values of the given object.
@static
@memberOf _
@category Objects
@param {Object} object The object to invert.
@returns {Object} Returns the created inverted object.
@example
_.invert({ 'first': 'fred', 'second': 'barney' });
// => { 'fred': 'first', 'barney': 'seco... | [
"Creates",
"an",
"object",
"composed",
"of",
"the",
"inverted",
"keys",
"and",
"values",
"of",
"the",
"given",
"object",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L1266-L1277 |
5,788 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | isBoolean | function isBoolean(value) {
return value === true || value === false ||
value && typeof value == 'object' && toString.call(value) == boolClass || false;
} | javascript | function isBoolean(value) {
return value === true || value === false ||
value && typeof value == 'object' && toString.call(value) == boolClass || false;
} | [
"function",
"isBoolean",
"(",
"value",
")",
"{",
"return",
"value",
"===",
"true",
"||",
"value",
"===",
"false",
"||",
"value",
"&&",
"typeof",
"value",
"==",
"'object'",
"&&",
"toString",
".",
"call",
"(",
"value",
")",
"==",
"boolClass",
"||",
"false"... | Checks if `value` is a boolean value.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
@example
_.isBoolean(null);
// => false | [
"Checks",
"if",
"value",
"is",
"a",
"boolean",
"value",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L1292-L1295 |
5,789 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | isString | function isString(value) {
return typeof value == 'string' ||
value && typeof value == 'object' && toString.call(value) == stringClass || false;
} | javascript | function isString(value) {
return typeof value == 'string' ||
value && typeof value == 'object' && toString.call(value) == stringClass || false;
} | [
"function",
"isString",
"(",
"value",
")",
"{",
"return",
"typeof",
"value",
"==",
"'string'",
"||",
"value",
"&&",
"typeof",
"value",
"==",
"'object'",
"&&",
"toString",
".",
"call",
"(",
"value",
")",
"==",
"stringClass",
"||",
"false",
";",
"}"
] | Checks if `value` is a string.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a string, else `false`.
@example
_.isString('fred');
// => true | [
"Checks",
"if",
"value",
"is",
"a",
"string",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L1593-L1596 |
5,790 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | values | function values(object) {
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
} | javascript | function values(object) {
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
} | [
"function",
"values",
"(",
"object",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"props",
"=",
"keys",
"(",
"object",
")",
",",
"length",
"=",
"props",
".",
"length",
",",
"result",
"=",
"Array",
"(",
"length",
")",
";",
"while",
"(",
"++",
"in... | Creates an array composed of the own enumerable property values of `object`.
@static
@memberOf _
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property values.
@example
_.values({ 'one': 1, 'two': 2, 'three': 3 });
// => [1, 2, 3] (property order is not guarantee... | [
"Creates",
"an",
"array",
"composed",
"of",
"the",
"own",
"enumerable",
"property",
"values",
"of",
"object",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L1741-L1751 |
5,791 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | where | function where(collection, properties, first) {
return (first && isEmpty(properties))
? undefined
: (first ? find : filter)(collection, properties);
} | javascript | function where(collection, properties, first) {
return (first && isEmpty(properties))
? undefined
: (first ? find : filter)(collection, properties);
} | [
"function",
"where",
"(",
"collection",
",",
"properties",
",",
"first",
")",
"{",
"return",
"(",
"first",
"&&",
"isEmpty",
"(",
"properties",
")",
")",
"?",
"undefined",
":",
"(",
"first",
"?",
"find",
":",
"filter",
")",
"(",
"collection",
",",
"prop... | Performs a deep comparison of each element in a `collection` to the given
`properties` object, returning an array of all elements that have equivalent
property values.
@static
@memberOf _
@type Function
@category Collections
@param {Array|Object|string} collection The collection to iterate over.
@param {Object} props ... | [
"Performs",
"a",
"deep",
"comparison",
"of",
"each",
"element",
"in",
"a",
"collection",
"to",
"the",
"given",
"properties",
"object",
"returning",
"an",
"array",
"of",
"all",
"elements",
"that",
"have",
"equivalent",
"property",
"values",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L2870-L2874 |
5,792 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | defer | function defer(func) {
if (!isFunction(func)) {
throw new TypeError;
}
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
} | javascript | function defer(func) {
if (!isFunction(func)) {
throw new TypeError;
}
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
} | [
"function",
"defer",
"(",
"func",
")",
"{",
"if",
"(",
"!",
"isFunction",
"(",
"func",
")",
")",
"{",
"throw",
"new",
"TypeError",
";",
"}",
"var",
"args",
"=",
"slice",
"(",
"arguments",
",",
"1",
")",
";",
"return",
"setTimeout",
"(",
"function",
... | Defers executing the `func` function until the current call stack has cleared.
Additional arguments will be provided to `func` when it is invoked.
@static
@memberOf _
@category Functions
@param {Function} func The function to defer.
@param {...*} [arg] Arguments to invoke the function with.
@returns {number} Returns t... | [
"Defers",
"executing",
"the",
"func",
"function",
"until",
"the",
"current",
"call",
"stack",
"has",
"cleared",
".",
"Additional",
"arguments",
"will",
"be",
"provided",
"to",
"func",
"when",
"it",
"is",
"invoked",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L3947-L3953 |
5,793 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | result | function result(object, key) {
if (object) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
}
} | javascript | function result(object, key) {
if (object) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
}
} | [
"function",
"result",
"(",
"object",
",",
"key",
")",
"{",
"if",
"(",
"object",
")",
"{",
"var",
"value",
"=",
"object",
"[",
"key",
"]",
";",
"return",
"isFunction",
"(",
"value",
")",
"?",
"object",
"[",
"key",
"]",
"(",
")",
":",
"value",
";",... | Resolves the value of property `key` on `object`. If `key` is a function
it will be invoked with the `this` binding of `object` and its result returned,
else the property value is returned. If `object` is falsey then `undefined`
is returned.
@static
@memberOf _
@category Utilities
@param {Object} object The object to ... | [
"Resolves",
"the",
"value",
"of",
"property",
"key",
"on",
"object",
".",
"If",
"key",
"is",
"a",
"function",
"it",
"will",
"be",
"invoked",
"with",
"the",
"this",
"binding",
"of",
"object",
"and",
"its",
"result",
"returned",
"else",
"the",
"property",
... | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L4446-L4451 |
5,794 | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | template | function template(text, data, options) {
var _ = lodash,
settings = _.templateSettings;
text = String(text || '');
options = defaults({}, options, settings);
var index = 0,
source = "__p += '",
variable = options.variable;
var reDelimiters = RegExp(
(options.escape |... | javascript | function template(text, data, options) {
var _ = lodash,
settings = _.templateSettings;
text = String(text || '');
options = defaults({}, options, settings);
var index = 0,
source = "__p += '",
variable = options.variable;
var reDelimiters = RegExp(
(options.escape |... | [
"function",
"template",
"(",
"text",
",",
"data",
",",
"options",
")",
"{",
"var",
"_",
"=",
"lodash",
",",
"settings",
"=",
"_",
".",
"templateSettings",
";",
"text",
"=",
"String",
"(",
"text",
"||",
"''",
")",
";",
"options",
"=",
"defaults",
"(",... | A micro-templating method that handles arbitrary delimiters, preserves
whitespace, and correctly escapes quotes within interpolated code.
Note: In the development build, `_.template` utilizes sourceURLs for easier
debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
For more ... | [
"A",
"micro",
"-",
"templating",
"method",
"that",
"handles",
"arbitrary",
"delimiters",
"preserves",
"whitespace",
"and",
"correctly",
"escapes",
"quotes",
"within",
"interpolated",
"code",
"."
] | 318d2ed0852d2f299fc76b32f2240371ccee95ad | https://github.com/sdelements/lets-chat/blob/318d2ed0852d2f299fc76b32f2240371ccee95ad/media/js/vendor/lodash/lodash.underscore.js#L4539-L4593 |
5,795 | brianc/node-postgres | lib/result.js | function (rowMode, types) {
this.command = null
this.rowCount = null
this.oid = null
this.rows = []
this.fields = []
this._parsers = []
this._types = types
this.RowCtor = null
this.rowAsArray = rowMode === 'array'
if (this.rowAsArray) {
this.parseRow = this._parseRowAsArray
}
} | javascript | function (rowMode, types) {
this.command = null
this.rowCount = null
this.oid = null
this.rows = []
this.fields = []
this._parsers = []
this._types = types
this.RowCtor = null
this.rowAsArray = rowMode === 'array'
if (this.rowAsArray) {
this.parseRow = this._parseRowAsArray
}
} | [
"function",
"(",
"rowMode",
",",
"types",
")",
"{",
"this",
".",
"command",
"=",
"null",
"this",
".",
"rowCount",
"=",
"null",
"this",
".",
"oid",
"=",
"null",
"this",
".",
"rows",
"=",
"[",
"]",
"this",
".",
"fields",
"=",
"[",
"]",
"this",
".",... | result object returned from query in the 'end' event and also passed as second argument to provided callback | [
"result",
"object",
"returned",
"from",
"query",
"in",
"the",
"end",
"event",
"and",
"also",
"passed",
"as",
"second",
"argument",
"to",
"provided",
"callback"
] | 4b530a9e0fb317567766260a2c57e28c88d55861 | https://github.com/brianc/node-postgres/blob/4b530a9e0fb317567766260a2c57e28c88d55861/lib/result.js#L15-L28 | |
5,796 | brianc/node-postgres | lib/utils.js | arrayString | function arrayString (val) {
var result = '{'
for (var i = 0; i < val.length; i++) {
if (i > 0) {
result = result + ','
}
if (val[i] === null || typeof val[i] === 'undefined') {
result = result + 'NULL'
} else if (Array.isArray(val[i])) {
result = result + arrayString(val[i])
}... | javascript | function arrayString (val) {
var result = '{'
for (var i = 0; i < val.length; i++) {
if (i > 0) {
result = result + ','
}
if (val[i] === null || typeof val[i] === 'undefined') {
result = result + 'NULL'
} else if (Array.isArray(val[i])) {
result = result + arrayString(val[i])
}... | [
"function",
"arrayString",
"(",
"val",
")",
"{",
"var",
"result",
"=",
"'{'",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"val",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"result",
"=",
"result",
"+",
... | convert a JS array to a postgres array literal uses comma separator so won't work for types like box that use a different array separator. | [
"convert",
"a",
"JS",
"array",
"to",
"a",
"postgres",
"array",
"literal",
"uses",
"comma",
"separator",
"so",
"won",
"t",
"work",
"for",
"types",
"like",
"box",
"that",
"use",
"a",
"different",
"array",
"separator",
"."
] | 4b530a9e0fb317567766260a2c57e28c88d55861 | https://github.com/brianc/node-postgres/blob/4b530a9e0fb317567766260a2c57e28c88d55861/lib/utils.js#L25-L43 |
5,797 | nicolodavis/boardgame.io | src/client/debug/debug.js | SanitizeCtx | function SanitizeCtx(ctx) {
let r = {};
for (const key in ctx) {
if (!key.startsWith('_')) {
r[key] = ctx[key];
}
}
return r;
} | javascript | function SanitizeCtx(ctx) {
let r = {};
for (const key in ctx) {
if (!key.startsWith('_')) {
r[key] = ctx[key];
}
}
return r;
} | [
"function",
"SanitizeCtx",
"(",
"ctx",
")",
"{",
"let",
"r",
"=",
"{",
"}",
";",
"for",
"(",
"const",
"key",
"in",
"ctx",
")",
"{",
"if",
"(",
"!",
"key",
".",
"startsWith",
"(",
"'_'",
")",
")",
"{",
"r",
"[",
"key",
"]",
"=",
"ctx",
"[",
... | Removes all the keys in ctx that begin with a _. | [
"Removes",
"all",
"the",
"keys",
"in",
"ctx",
"that",
"begin",
"with",
"a",
"_",
"."
] | e46f19552ede4751af97e2fac8086add3bed220a | https://github.com/nicolodavis/boardgame.io/blob/e46f19552ede4751af97e2fac8086add3bed220a/src/client/debug/debug.js#L25-L33 |
5,798 | nicolodavis/boardgame.io | examples/react-web/src/ui/chess3d/game.js | Load | function Load(pgn) {
let chess = null;
if (Chess.Chess) {
chess = new Chess.Chess();
} else {
chess = new Chess();
}
chess.load_pgn(pgn);
return chess;
} | javascript | function Load(pgn) {
let chess = null;
if (Chess.Chess) {
chess = new Chess.Chess();
} else {
chess = new Chess();
}
chess.load_pgn(pgn);
return chess;
} | [
"function",
"Load",
"(",
"pgn",
")",
"{",
"let",
"chess",
"=",
"null",
";",
"if",
"(",
"Chess",
".",
"Chess",
")",
"{",
"chess",
"=",
"new",
"Chess",
".",
"Chess",
"(",
")",
";",
"}",
"else",
"{",
"chess",
"=",
"new",
"Chess",
"(",
")",
";",
... | Helper to instantiate chess.js correctly on both browser and Node. | [
"Helper",
"to",
"instantiate",
"chess",
".",
"js",
"correctly",
"on",
"both",
"browser",
"and",
"Node",
"."
] | e46f19552ede4751af97e2fac8086add3bed220a | https://github.com/nicolodavis/boardgame.io/blob/e46f19552ede4751af97e2fac8086add3bed220a/examples/react-web/src/ui/chess3d/game.js#L14-L23 |
5,799 | loadimpact/k6 | samples/pantheon.js | doLogin | function doLogin() {
// Request the login page.
let res = http.get(baseURL + "/user/login");
check(res, {
"title is correct": (res) => res.html("title").text() == "User account | David li commerce-test",
});
// TODO: Add attr() to k6/html!
// Extract hidden input fields.
let formBuildID = res.body.match('name... | javascript | function doLogin() {
// Request the login page.
let res = http.get(baseURL + "/user/login");
check(res, {
"title is correct": (res) => res.html("title").text() == "User account | David li commerce-test",
});
// TODO: Add attr() to k6/html!
// Extract hidden input fields.
let formBuildID = res.body.match('name... | [
"function",
"doLogin",
"(",
")",
"{",
"// Request the login page.",
"let",
"res",
"=",
"http",
".",
"get",
"(",
"baseURL",
"+",
"\"/user/login\"",
")",
";",
"check",
"(",
"res",
",",
"{",
"\"title is correct\"",
":",
"(",
"res",
")",
"=>",
"res",
".",
"h... | Request the login page and perform a user login | [
"Request",
"the",
"login",
"page",
"and",
"perform",
"a",
"user",
"login"
] | 03645ba7059a4ca9eb22035f5adb52f1a91e7534 | https://github.com/loadimpact/k6/blob/03645ba7059a4ca9eb22035f5adb52f1a91e7534/samples/pantheon.js#L130-L161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.