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,300 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | utf8Text | function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed) return buf.toString('utf8', i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString('utf8', i, end);
} | javascript | function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed) return buf.toString('utf8', i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString('utf8', i, end);
} | [
"function",
"utf8Text",
"(",
"buf",
",",
"i",
")",
"{",
"var",
"total",
"=",
"utf8CheckIncomplete",
"(",
"this",
",",
"buf",
",",
"i",
")",
";",
"if",
"(",
"!",
"this",
".",
"lastNeed",
")",
"return",
"buf",
".",
"toString",
"(",
"'utf8'",
",",
"i"... | Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a partial character, the character's bytes are buffered until the required number of bytes are available. | [
"Returns",
"all",
"complete",
"UTF",
"-",
"8",
"characters",
"in",
"a",
"Buffer",
".",
"If",
"the",
"Buffer",
"ended",
"on",
"a",
"partial",
"character",
"the",
"character",
"s",
"bytes",
"are",
"buffered",
"until",
"the",
"required",
"number",
"of",
"byte... | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L13714-L13721 |
5,301 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | utf16End | function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString('utf16le', 0, end);
}
return r;
} | javascript | function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString('utf16le', 0, end);
}
return r;
} | [
"function",
"utf16End",
"(",
"buf",
")",
"{",
"var",
"r",
"=",
"buf",
"&&",
"buf",
".",
"length",
"?",
"this",
".",
"write",
"(",
"buf",
")",
":",
"''",
";",
"if",
"(",
"this",
".",
"lastNeed",
")",
"{",
"var",
"end",
"=",
"this",
".",
"lastTot... | For UTF-16LE we do not explicitly append special replacement characters if we end on a partial character, we simply let v8 handle that. | [
"For",
"UTF",
"-",
"16LE",
"we",
"do",
"not",
"explicitly",
"append",
"special",
"replacement",
"characters",
"if",
"we",
"end",
"on",
"a",
"partial",
"character",
"we",
"simply",
"let",
"v8",
"handle",
"that",
"."
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L13758-L13765 |
5,302 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | through2 | function through2 (construct) {
return function (options, transform, flush) {
if (typeof options == 'function') {
flush = transform
transform = options
options = {}
}
if (typeof transform != 'function')
transform = noop
if (typeof flush != 'function')
flush = null... | javascript | function through2 (construct) {
return function (options, transform, flush) {
if (typeof options == 'function') {
flush = transform
transform = options
options = {}
}
if (typeof transform != 'function')
transform = noop
if (typeof flush != 'function')
flush = null... | [
"function",
"through2",
"(",
"construct",
")",
"{",
"return",
"function",
"(",
"options",
",",
"transform",
",",
"flush",
")",
"{",
"if",
"(",
"typeof",
"options",
"==",
"'function'",
")",
"{",
"flush",
"=",
"transform",
"transform",
"=",
"options",
"optio... | create a new export function, used by both the main export and the .ctor export, contains common logic for dealing with arguments | [
"create",
"a",
"new",
"export",
"function",
"used",
"by",
"both",
"the",
"main",
"export",
"and",
"the",
".",
"ctor",
"export",
"contains",
"common",
"logic",
"for",
"dealing",
"with",
"arguments"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L13828-L13844 |
5,303 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | parseDoc | function parseDoc(doc, newEdits) {
var nRevNum;
var newRevId;
var revInfo;
var opts = {status: 'available'};
if (doc._deleted) {
opts.deleted = true;
}
if (newEdits) {
if (!doc._id) {
doc._id = pouchdbUtils.uuid();
}
newRevId = pouchdbUtils.uuid(32, 16).toLowerCase();
if (doc._... | javascript | function parseDoc(doc, newEdits) {
var nRevNum;
var newRevId;
var revInfo;
var opts = {status: 'available'};
if (doc._deleted) {
opts.deleted = true;
}
if (newEdits) {
if (!doc._id) {
doc._id = pouchdbUtils.uuid();
}
newRevId = pouchdbUtils.uuid(32, 16).toLowerCase();
if (doc._... | [
"function",
"parseDoc",
"(",
"doc",
",",
"newEdits",
")",
"{",
"var",
"nRevNum",
";",
"var",
"newRevId",
";",
"var",
"revInfo",
";",
"var",
"opts",
"=",
"{",
"status",
":",
"'available'",
"}",
";",
"if",
"(",
"doc",
".",
"_deleted",
")",
"{",
"opts",... | Preprocess documents, parse their revisions, assign an id and a revision for new writes that are missing them, etc | [
"Preprocess",
"documents",
"parse",
"their",
"revisions",
"assign",
"an",
"id",
"and",
"a",
"revision",
"for",
"new",
"writes",
"that",
"are",
"missing",
"them",
"etc"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L14006-L14079 |
5,304 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | readAsBinaryString | function readAsBinaryString(blob, callback) {
if (typeof FileReader === 'undefined') {
// fix for Firefox in a web worker
// https://bugzilla.mozilla.org/show_bug.cgi?id=901097
return callback(arrayBufferToBinaryString(
new FileReaderSync().readAsArrayBuffer(blob)));
}
var reader = new FileRead... | javascript | function readAsBinaryString(blob, callback) {
if (typeof FileReader === 'undefined') {
// fix for Firefox in a web worker
// https://bugzilla.mozilla.org/show_bug.cgi?id=901097
return callback(arrayBufferToBinaryString(
new FileReaderSync().readAsArrayBuffer(blob)));
}
var reader = new FileRead... | [
"function",
"readAsBinaryString",
"(",
"blob",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"FileReader",
"===",
"'undefined'",
")",
"{",
"// fix for Firefox in a web worker",
"// https://bugzilla.mozilla.org/show_bug.cgi?id=901097",
"return",
"callback",
"(",
"arrayBuff... | shim for browsers that don't support it | [
"shim",
"for",
"browsers",
"that",
"don",
"t",
"support",
"it"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L14827-L14849 |
5,305 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | yankError | function yankError(callback) {
return function (err, results) {
if (err || (results[0] && results[0].error)) {
callback(err || results[0]);
} else {
callback(null, results.length ? results[0] : results);
}
};
} | javascript | function yankError(callback) {
return function (err, results) {
if (err || (results[0] && results[0].error)) {
callback(err || results[0]);
} else {
callback(null, results.length ? results[0] : results);
}
};
} | [
"function",
"yankError",
"(",
"callback",
")",
"{",
"return",
"function",
"(",
"err",
",",
"results",
")",
"{",
"if",
"(",
"err",
"||",
"(",
"results",
"[",
"0",
"]",
"&&",
"results",
"[",
"0",
"]",
".",
"error",
")",
")",
"{",
"callback",
"(",
"... | Wrapper for functions that call the bulkdocs api with a single doc, if the first result is an error, return an error | [
"Wrapper",
"for",
"functions",
"that",
"call",
"the",
"bulkdocs",
"api",
"with",
"a",
"single",
"doc",
"if",
"the",
"first",
"result",
"is",
"an",
"error",
"return",
"an",
"error"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L16030-L16038 |
5,306 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | cleanDocs | function cleanDocs(docs) {
for (var i = 0; i < docs.length; i++) {
var doc = docs[i];
if (doc._deleted) {
delete doc._attachments; // ignore atts for deleted docs
} else if (doc._attachments) {
// filter out extraneous keys from _attachments
var atts = Object.keys(doc._attachments);
... | javascript | function cleanDocs(docs) {
for (var i = 0; i < docs.length; i++) {
var doc = docs[i];
if (doc._deleted) {
delete doc._attachments; // ignore atts for deleted docs
} else if (doc._attachments) {
// filter out extraneous keys from _attachments
var atts = Object.keys(doc._attachments);
... | [
"function",
"cleanDocs",
"(",
"docs",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"docs",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"doc",
"=",
"docs",
"[",
"i",
"]",
";",
"if",
"(",
"doc",
".",
"_deleted",
")",
"{",
"d... | clean docs given to us by the user | [
"clean",
"docs",
"given",
"to",
"us",
"by",
"the",
"user"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L16041-L16056 |
5,307 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | compareByIdThenRev | function compareByIdThenRev(a, b) {
var idCompare = compare(a._id, b._id);
if (idCompare !== 0) {
return idCompare;
}
var aStart = a._revisions ? a._revisions.start : 0;
var bStart = b._revisions ? b._revisions.start : 0;
return compare(aStart, bStart);
} | javascript | function compareByIdThenRev(a, b) {
var idCompare = compare(a._id, b._id);
if (idCompare !== 0) {
return idCompare;
}
var aStart = a._revisions ? a._revisions.start : 0;
var bStart = b._revisions ? b._revisions.start : 0;
return compare(aStart, bStart);
} | [
"function",
"compareByIdThenRev",
"(",
"a",
",",
"b",
")",
"{",
"var",
"idCompare",
"=",
"compare",
"(",
"a",
".",
"_id",
",",
"b",
".",
"_id",
")",
";",
"if",
"(",
"idCompare",
"!==",
"0",
")",
"{",
"return",
"idCompare",
";",
"}",
"var",
"aStart"... | compare two docs, first by _id then by _rev | [
"compare",
"two",
"docs",
"first",
"by",
"_id",
"then",
"by",
"_rev"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L16059-L16067 |
5,308 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | computeHeight | function computeHeight(revs) {
var height = {};
var edges = [];
pouchdbMerge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {
var rev = pos + "-" + id;
if (isLeaf) {
height[rev] = 0;
}
if (prnt !== undefined) {
edges.push({from: prnt, to: rev});
}
return rev;
});
e... | javascript | function computeHeight(revs) {
var height = {};
var edges = [];
pouchdbMerge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {
var rev = pos + "-" + id;
if (isLeaf) {
height[rev] = 0;
}
if (prnt !== undefined) {
edges.push({from: prnt, to: rev});
}
return rev;
});
e... | [
"function",
"computeHeight",
"(",
"revs",
")",
"{",
"var",
"height",
"=",
"{",
"}",
";",
"var",
"edges",
"=",
"[",
"]",
";",
"pouchdbMerge",
".",
"traverseRevTree",
"(",
"revs",
",",
"function",
"(",
"isLeaf",
",",
"pos",
",",
"id",
",",
"prnt",
")",... | for every node in a revision tree computes its distance from the closest leaf | [
"for",
"every",
"node",
"in",
"a",
"revision",
"tree",
"computes",
"its",
"distance",
"from",
"the",
"closest",
"leaf"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L16071-L16094 |
5,309 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | doNextCompaction | function doNextCompaction(self) {
var task = self._compactionQueue[0];
var opts = task.opts;
var callback = task.callback;
self.get('_local/compaction').catch(function () {
return false;
}).then(function (doc) {
if (doc && doc.last_seq) {
opts.last_seq = doc.last_seq;
}
self._compact(opt... | javascript | function doNextCompaction(self) {
var task = self._compactionQueue[0];
var opts = task.opts;
var callback = task.callback;
self.get('_local/compaction').catch(function () {
return false;
}).then(function (doc) {
if (doc && doc.last_seq) {
opts.last_seq = doc.last_seq;
}
self._compact(opt... | [
"function",
"doNextCompaction",
"(",
"self",
")",
"{",
"var",
"task",
"=",
"self",
".",
"_compactionQueue",
"[",
"0",
"]",
";",
"var",
"opts",
"=",
"task",
".",
"opts",
";",
"var",
"callback",
"=",
"task",
".",
"callback",
";",
"self",
".",
"get",
"(... | all compaction is done in a queue, to avoid attaching too many listeners at once | [
"all",
"compaction",
"is",
"done",
"in",
"a",
"queue",
"to",
"avoid",
"attaching",
"too",
"many",
"listeners",
"at",
"once"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L16132-L16157 |
5,310 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | createFieldSorter | function createFieldSorter(sort) {
function getFieldValuesAsArray(doc) {
return sort.map(function (sorting) {
var fieldName = getKey(sorting);
var parsedField = parseField(fieldName);
var docFieldValue = getFieldFromDoc(doc, parsedField);
return docFieldValue;
});
}
return functi... | javascript | function createFieldSorter(sort) {
function getFieldValuesAsArray(doc) {
return sort.map(function (sorting) {
var fieldName = getKey(sorting);
var parsedField = parseField(fieldName);
var docFieldValue = getFieldFromDoc(doc, parsedField);
return docFieldValue;
});
}
return functi... | [
"function",
"createFieldSorter",
"(",
"sort",
")",
"{",
"function",
"getFieldValuesAsArray",
"(",
"doc",
")",
"{",
"return",
"sort",
".",
"map",
"(",
"function",
"(",
"sorting",
")",
"{",
"var",
"fieldName",
"=",
"getKey",
"(",
"sorting",
")",
";",
"var",
... | create a comparator based on the sort object | [
"create",
"a",
"comparator",
"based",
"on",
"the",
"sort",
"object"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19347-L19368 |
5,311 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | checkFieldInIndex | function checkFieldInIndex(index, field) {
var indexFields = index.def.fields.map(getKey);
for (var i = 0, len = indexFields.length; i < len; i++) {
var indexField = indexFields[i];
if (field === indexField) {
return true;
}
}
return false;
} | javascript | function checkFieldInIndex(index, field) {
var indexFields = index.def.fields.map(getKey);
for (var i = 0, len = indexFields.length; i < len; i++) {
var indexField = indexFields[i];
if (field === indexField) {
return true;
}
}
return false;
} | [
"function",
"checkFieldInIndex",
"(",
"index",
",",
"field",
")",
"{",
"var",
"indexFields",
"=",
"index",
".",
"def",
".",
"fields",
".",
"map",
"(",
"getKey",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"indexFields",
".",
"length"... | couchdb second-lowest collation value | [
"couchdb",
"second",
"-",
"lowest",
"collation",
"value"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19780-L19789 |
5,312 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | sortFieldsByIndex | function sortFieldsByIndex(userFields, index) {
var indexFields = index.def.fields.map(getKey);
return userFields.slice().sort(function (a, b) {
var aIdx = indexFields.indexOf(a);
var bIdx = indexFields.indexOf(b);
if (aIdx === -1) {
aIdx = Number.MAX_VALUE;
}
if (bIdx === -1) {
bId... | javascript | function sortFieldsByIndex(userFields, index) {
var indexFields = index.def.fields.map(getKey);
return userFields.slice().sort(function (a, b) {
var aIdx = indexFields.indexOf(a);
var bIdx = indexFields.indexOf(b);
if (aIdx === -1) {
aIdx = Number.MAX_VALUE;
}
if (bIdx === -1) {
bId... | [
"function",
"sortFieldsByIndex",
"(",
"userFields",
",",
"index",
")",
"{",
"var",
"indexFields",
"=",
"index",
".",
"def",
".",
"fields",
".",
"map",
"(",
"getKey",
")",
";",
"return",
"userFields",
".",
"slice",
"(",
")",
".",
"sort",
"(",
"function",
... | sort the user fields by their position in the index, if they're in the index | [
"sort",
"the",
"user",
"fields",
"by",
"their",
"position",
"in",
"the",
"index",
"if",
"they",
"re",
"in",
"the",
"index"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19805-L19819 |
5,313 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | getBasicInMemoryFields | function getBasicInMemoryFields(index, selector, userFields) {
userFields = sortFieldsByIndex(userFields, index);
// check if any of the user selectors lose precision
var needToFilterInMemory = false;
for (var i = 0, len = userFields.length; i < len; i++) {
var field = userFields[i];
if (needToFilterI... | javascript | function getBasicInMemoryFields(index, selector, userFields) {
userFields = sortFieldsByIndex(userFields, index);
// check if any of the user selectors lose precision
var needToFilterInMemory = false;
for (var i = 0, len = userFields.length; i < len; i++) {
var field = userFields[i];
if (needToFilterI... | [
"function",
"getBasicInMemoryFields",
"(",
"index",
",",
"selector",
",",
"userFields",
")",
"{",
"userFields",
"=",
"sortFieldsByIndex",
"(",
"userFields",
",",
"index",
")",
";",
"// check if any of the user selectors lose precision",
"var",
"needToFilterInMemory",
"=",... | first pass to try to find fields that will need to be sorted in-memory | [
"first",
"pass",
"to",
"try",
"to",
"find",
"fields",
"that",
"will",
"need",
"to",
"be",
"sorted",
"in",
"-",
"memory"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19822-L19838 |
5,314 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | checkIndexFieldsMatch | function checkIndexFieldsMatch(indexFields, sortOrder, fields) {
if (sortOrder) {
// array has to be a strict subarray of index array. furthermore,
// the sortOrder fields need to all be represented in the index
var sortMatches = utils.oneArrayIsStrictSubArrayOfOther(sortOrder, indexFields);
var selec... | javascript | function checkIndexFieldsMatch(indexFields, sortOrder, fields) {
if (sortOrder) {
// array has to be a strict subarray of index array. furthermore,
// the sortOrder fields need to all be represented in the index
var sortMatches = utils.oneArrayIsStrictSubArrayOfOther(sortOrder, indexFields);
var selec... | [
"function",
"checkIndexFieldsMatch",
"(",
"indexFields",
",",
"sortOrder",
",",
"fields",
")",
"{",
"if",
"(",
"sortOrder",
")",
"{",
"// array has to be a strict subarray of index array. furthermore,",
"// the sortOrder fields need to all be represented in the index",
"var",
"so... | check that at least one field in the user's query is represented in the index. order matters in the case of sorts | [
"check",
"that",
"at",
"least",
"one",
"field",
"in",
"the",
"user",
"s",
"query",
"is",
"represented",
"in",
"the",
"index",
".",
"order",
"matters",
"in",
"the",
"case",
"of",
"sorts"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19868-L19882 |
5,315 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | findBestMatchingIndex | function findBestMatchingIndex(selector, userFields, sortOrder, indexes) {
var matchingIndexes = findMatchingIndexes(selector, userFields, sortOrder, indexes);
if (matchingIndexes.length === 0) {
//return `all_docs` as a default index;
//I'm assuming that _all_docs is always first
var defaultIndex = i... | javascript | function findBestMatchingIndex(selector, userFields, sortOrder, indexes) {
var matchingIndexes = findMatchingIndexes(selector, userFields, sortOrder, indexes);
if (matchingIndexes.length === 0) {
//return `all_docs` as a default index;
//I'm assuming that _all_docs is always first
var defaultIndex = i... | [
"function",
"findBestMatchingIndex",
"(",
"selector",
",",
"userFields",
",",
"sortOrder",
",",
"indexes",
")",
"{",
"var",
"matchingIndexes",
"=",
"findMatchingIndexes",
"(",
"selector",
",",
"userFields",
",",
"sortOrder",
",",
"indexes",
")",
";",
"if",
"(",
... | find the best index, i.e. the one that matches the most fields in the user's query | [
"find",
"the",
"best",
"index",
"i",
".",
"e",
".",
"the",
"one",
"that",
"matches",
"the",
"most",
"fields",
"in",
"the",
"user",
"s",
"query"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L19948-L19978 |
5,316 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | massageSort | function massageSort(sort) {
if (!Array.isArray(sort)) {
throw new Error('invalid sort json - should be an array');
}
return sort.map(function (sorting) {
if (typeof sorting === 'string') {
var obj = {};
obj[sorting] = 'asc';
return obj;
} else {
return sorting;
}
});
} | javascript | function massageSort(sort) {
if (!Array.isArray(sort)) {
throw new Error('invalid sort json - should be an array');
}
return sort.map(function (sorting) {
if (typeof sorting === 'string') {
var obj = {};
obj[sorting] = 'asc';
return obj;
} else {
return sorting;
}
});
} | [
"function",
"massageSort",
"(",
"sort",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"sort",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'invalid sort json - should be an array'",
")",
";",
"}",
"return",
"sort",
".",
"map",
"(",
"function",
... | normalize the "sort" value | [
"normalize",
"the",
"sort",
"value"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L20289-L20302 |
5,317 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | filterInclusiveStart | function filterInclusiveStart(rows, targetValue, index) {
var indexFields = index.def.fields;
for (var i = 0, len = rows.length; i < len; i++) {
var row = rows[i];
// shave off any docs at the beginning that are <= the
// target value
var docKey = getKeyFromDoc(row.doc, index);
if (indexFields... | javascript | function filterInclusiveStart(rows, targetValue, index) {
var indexFields = index.def.fields;
for (var i = 0, len = rows.length; i < len; i++) {
var row = rows[i];
// shave off any docs at the beginning that are <= the
// target value
var docKey = getKeyFromDoc(row.doc, index);
if (indexFields... | [
"function",
"filterInclusiveStart",
"(",
"rows",
",",
"targetValue",
",",
"index",
")",
"{",
"var",
"indexFields",
"=",
"index",
".",
"def",
".",
"fields",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"rows",
".",
"length",
";",
"i",
"<",
... | have to do this manually because REASONS. I don't know why CouchDB didn't implement inclusive_start | [
"have",
"to",
"do",
"this",
"manually",
"because",
"REASONS",
".",
"I",
"don",
"t",
"know",
"why",
"CouchDB",
"didn",
"t",
"implement",
"inclusive_start"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L20501-L20526 |
5,318 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | generateReplicationId | function generateReplicationId(src, target, opts) {
var docIds = opts.doc_ids ? opts.doc_ids.sort(pouchdbCollate.collate) : '';
var filterFun = opts.filter ? opts.filter.toString() : '';
var queryParams = '';
var filterViewName = '';
var selector = '';
// possibility for checkpoints to be lost here as beh... | javascript | function generateReplicationId(src, target, opts) {
var docIds = opts.doc_ids ? opts.doc_ids.sort(pouchdbCollate.collate) : '';
var filterFun = opts.filter ? opts.filter.toString() : '';
var queryParams = '';
var filterViewName = '';
var selector = '';
// possibility for checkpoints to be lost here as beh... | [
"function",
"generateReplicationId",
"(",
"src",
",",
"target",
",",
"opts",
")",
"{",
"var",
"docIds",
"=",
"opts",
".",
"doc_ids",
"?",
"opts",
".",
"doc_ids",
".",
"sort",
"(",
"pouchdbCollate",
".",
"collate",
")",
":",
"''",
";",
"var",
"filterFun",... | Generate a unique id particular to this replication. Not guaranteed to align perfectly with CouchDB's rep ids. | [
"Generate",
"a",
"unique",
"id",
"particular",
"to",
"this",
"replication",
".",
"Not",
"guaranteed",
"to",
"align",
"perfectly",
"with",
"CouchDB",
"s",
"rep",
"ids",
"."
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L21762-L21797 |
5,319 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | fin | function fin(promise, finalPromiseFactory) {
return promise.then(function (res) {
return finalPromiseFactory().then(function () {
return res;
});
}, function (reason) {
return finalPromiseFactory().then(function () {
throw reason;
});
});
} | javascript | function fin(promise, finalPromiseFactory) {
return promise.then(function (res) {
return finalPromiseFactory().then(function () {
return res;
});
}, function (reason) {
return finalPromiseFactory().then(function () {
throw reason;
});
});
} | [
"function",
"fin",
"(",
"promise",
",",
"finalPromiseFactory",
")",
"{",
"return",
"promise",
".",
"then",
"(",
"function",
"(",
"res",
")",
"{",
"return",
"finalPromiseFactory",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"res",
";"... | Promise finally util similar to Q.finally | [
"Promise",
"finally",
"util",
"similar",
"to",
"Q",
".",
"finally"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L21913-L21923 |
5,320 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | sumsqr | function sumsqr(values) {
var _sumsqr = 0;
for (var i = 0, len = values.length; i < len; i++) {
var num = values[i];
_sumsqr += (num * num);
}
return _sumsqr;
} | javascript | function sumsqr(values) {
var _sumsqr = 0;
for (var i = 0, len = values.length; i < len; i++) {
var num = values[i];
_sumsqr += (num * num);
}
return _sumsqr;
} | [
"function",
"sumsqr",
"(",
"values",
")",
"{",
"var",
"_sumsqr",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"values",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
"num",
"=",
"values",
"[",
"i",... | no need to implement rereduce=true, because Pouch will never call it | [
"no",
"need",
"to",
"implement",
"rereduce",
"=",
"true",
"because",
"Pouch",
"will",
"never",
"call",
"it"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22041-L22048 |
5,321 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | traverseRevTree | function traverseRevTree(revs, callback) {
var toVisit = revs.slice();
var node;
while ((node = toVisit.pop())) {
var pos = node.pos;
var tree = node.ids;
var branches = tree[2];
var newCtx =
callback(branches.length === 0, pos, tree[0], node.ctx, tree[1]);
for (var i = 0, len = branche... | javascript | function traverseRevTree(revs, callback) {
var toVisit = revs.slice();
var node;
while ((node = toVisit.pop())) {
var pos = node.pos;
var tree = node.ids;
var branches = tree[2];
var newCtx =
callback(branches.length === 0, pos, tree[0], node.ctx, tree[1]);
for (var i = 0, len = branche... | [
"function",
"traverseRevTree",
"(",
"revs",
",",
"callback",
")",
"{",
"var",
"toVisit",
"=",
"revs",
".",
"slice",
"(",
")",
";",
"var",
"node",
";",
"while",
"(",
"(",
"node",
"=",
"toVisit",
".",
"pop",
"(",
")",
")",
")",
"{",
"var",
"pos",
"... | Pretty much all below can be combined into a higher order function to traverse revisions The return value from the callback will be passed as context to all children of that node | [
"Pretty",
"much",
"all",
"below",
"can",
"be",
"combined",
"into",
"a",
"higher",
"order",
"function",
"to",
"traverse",
"revisions",
"The",
"return",
"value",
"from",
"the",
"callback",
"will",
"be",
"passed",
"as",
"context",
"to",
"all",
"children",
"of",... | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22236-L22250 |
5,322 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | collectConflicts | function collectConflicts(metadata) {
var win = winningRev(metadata);
var leaves = collectLeaves(metadata.rev_tree);
var conflicts = [];
for (var i = 0, len = leaves.length; i < len; i++) {
var leaf = leaves[i];
if (leaf.rev !== win && !leaf.opts.deleted) {
conflicts.push(leaf.rev);
}
}
re... | javascript | function collectConflicts(metadata) {
var win = winningRev(metadata);
var leaves = collectLeaves(metadata.rev_tree);
var conflicts = [];
for (var i = 0, len = leaves.length; i < len; i++) {
var leaf = leaves[i];
if (leaf.rev !== win && !leaf.opts.deleted) {
conflicts.push(leaf.rev);
}
}
re... | [
"function",
"collectConflicts",
"(",
"metadata",
")",
"{",
"var",
"win",
"=",
"winningRev",
"(",
"metadata",
")",
";",
"var",
"leaves",
"=",
"collectLeaves",
"(",
"metadata",
".",
"rev_tree",
")",
";",
"var",
"conflicts",
"=",
"[",
"]",
";",
"for",
"(",
... | returns revs of all conflicts that is leaves such that 1. are not deleted and 2. are different than winning revision | [
"returns",
"revs",
"of",
"all",
"conflicts",
"that",
"is",
"leaves",
"such",
"that",
"1",
".",
"are",
"not",
"deleted",
"and",
"2",
".",
"are",
"different",
"than",
"winning",
"revision"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22273-L22284 |
5,323 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | compactTree | function compactTree(metadata) {
var revs = [];
traverseRevTree(metadata.rev_tree, function (isLeaf, pos,
revHash, ctx, opts) {
if (opts.status === 'available' && !isLeaf) {
revs.push(pos + '-' + revHash);
opts.status = 'missing';
}
});
return r... | javascript | function compactTree(metadata) {
var revs = [];
traverseRevTree(metadata.rev_tree, function (isLeaf, pos,
revHash, ctx, opts) {
if (opts.status === 'available' && !isLeaf) {
revs.push(pos + '-' + revHash);
opts.status = 'missing';
}
});
return r... | [
"function",
"compactTree",
"(",
"metadata",
")",
"{",
"var",
"revs",
"=",
"[",
"]",
";",
"traverseRevTree",
"(",
"metadata",
".",
"rev_tree",
",",
"function",
"(",
"isLeaf",
",",
"pos",
",",
"revHash",
",",
"ctx",
",",
"opts",
")",
"{",
"if",
"(",
"o... | compact a tree by marking its non-leafs as missing, and return a list of revs to delete | [
"compact",
"a",
"tree",
"by",
"marking",
"its",
"non",
"-",
"leafs",
"as",
"missing",
"and",
"return",
"a",
"list",
"of",
"revs",
"to",
"delete"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22288-L22298 |
5,324 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | rootToLeaf | function rootToLeaf(revs) {
var paths = [];
var toVisit = revs.slice();
var node;
while ((node = toVisit.pop())) {
var pos = node.pos;
var tree = node.ids;
var id = tree[0];
var opts = tree[1];
var branches = tree[2];
var isLeaf = branches.length === 0;
var history = node.history ? ... | javascript | function rootToLeaf(revs) {
var paths = [];
var toVisit = revs.slice();
var node;
while ((node = toVisit.pop())) {
var pos = node.pos;
var tree = node.ids;
var id = tree[0];
var opts = tree[1];
var branches = tree[2];
var isLeaf = branches.length === 0;
var history = node.history ? ... | [
"function",
"rootToLeaf",
"(",
"revs",
")",
"{",
"var",
"paths",
"=",
"[",
"]",
";",
"var",
"toVisit",
"=",
"revs",
".",
"slice",
"(",
")",
";",
"var",
"node",
";",
"while",
"(",
"(",
"node",
"=",
"toVisit",
".",
"pop",
"(",
")",
")",
")",
"{",... | build up a list of all the paths to the leafs in this revision tree | [
"build",
"up",
"a",
"list",
"of",
"all",
"the",
"paths",
"to",
"the",
"leafs",
"in",
"this",
"revision",
"tree"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22301-L22323 |
5,325 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | binarySearch | function binarySearch(arr, item, comparator) {
var low = 0;
var high = arr.length;
var mid;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(arr[mid], item) < 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
} | javascript | function binarySearch(arr, item, comparator) {
var low = 0;
var high = arr.length;
var mid;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(arr[mid], item) < 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
} | [
"function",
"binarySearch",
"(",
"arr",
",",
"item",
",",
"comparator",
")",
"{",
"var",
"low",
"=",
"0",
";",
"var",
"high",
"=",
"arr",
".",
"length",
";",
"var",
"mid",
";",
"while",
"(",
"low",
"<",
"high",
")",
"{",
"mid",
"=",
"(",
"low",
... | classic binary search | [
"classic",
"binary",
"search"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22341-L22354 |
5,326 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | insertSorted | function insertSorted(arr, item, comparator) {
var idx = binarySearch(arr, item, comparator);
arr.splice(idx, 0, item);
} | javascript | function insertSorted(arr, item, comparator) {
var idx = binarySearch(arr, item, comparator);
arr.splice(idx, 0, item);
} | [
"function",
"insertSorted",
"(",
"arr",
",",
"item",
",",
"comparator",
")",
"{",
"var",
"idx",
"=",
"binarySearch",
"(",
"arr",
",",
"item",
",",
"comparator",
")",
";",
"arr",
".",
"splice",
"(",
"idx",
",",
"0",
",",
"item",
")",
";",
"}"
] | assuming the arr is sorted, insert the item in the proper place | [
"assuming",
"the",
"arr",
"is",
"sorted",
"insert",
"the",
"item",
"in",
"the",
"proper",
"place"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22357-L22360 |
5,327 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | pathToTree | function pathToTree(path, numStemmed) {
var root;
var leaf;
for (var i = numStemmed, len = path.length; i < len; i++) {
var node = path[i];
var currentLeaf = [node.id, node.opts, []];
if (leaf) {
leaf[2].push(currentLeaf);
leaf = currentLeaf;
} else {
root = leaf = currentLeaf;
... | javascript | function pathToTree(path, numStemmed) {
var root;
var leaf;
for (var i = numStemmed, len = path.length; i < len; i++) {
var node = path[i];
var currentLeaf = [node.id, node.opts, []];
if (leaf) {
leaf[2].push(currentLeaf);
leaf = currentLeaf;
} else {
root = leaf = currentLeaf;
... | [
"function",
"pathToTree",
"(",
"path",
",",
"numStemmed",
")",
"{",
"var",
"root",
";",
"var",
"leaf",
";",
"for",
"(",
"var",
"i",
"=",
"numStemmed",
",",
"len",
"=",
"path",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"var",
... | Turn a path as a flat array into a tree with a single branch. If any should be stemmed from the beginning of the array, that's passed in as the second argument | [
"Turn",
"a",
"path",
"as",
"a",
"flat",
"array",
"into",
"a",
"tree",
"with",
"a",
"single",
"branch",
".",
"If",
"any",
"should",
"be",
"stemmed",
"from",
"the",
"beginning",
"of",
"the",
"array",
"that",
"s",
"passed",
"in",
"as",
"the",
"second",
... | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22365-L22379 |
5,328 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | mergeTree | function mergeTree(in_tree1, in_tree2) {
var queue = [{tree1: in_tree1, tree2: in_tree2}];
var conflicts = false;
while (queue.length > 0) {
var item = queue.pop();
var tree1 = item.tree1;
var tree2 = item.tree2;
if (tree1[1].status || tree2[1].status) {
tree1[1].status =
(tree1[1].... | javascript | function mergeTree(in_tree1, in_tree2) {
var queue = [{tree1: in_tree1, tree2: in_tree2}];
var conflicts = false;
while (queue.length > 0) {
var item = queue.pop();
var tree1 = item.tree1;
var tree2 = item.tree2;
if (tree1[1].status || tree2[1].status) {
tree1[1].status =
(tree1[1].... | [
"function",
"mergeTree",
"(",
"in_tree1",
",",
"in_tree2",
")",
"{",
"var",
"queue",
"=",
"[",
"{",
"tree1",
":",
"in_tree1",
",",
"tree2",
":",
"in_tree2",
"}",
"]",
";",
"var",
"conflicts",
"=",
"false",
";",
"while",
"(",
"queue",
".",
"length",
"... | Merge two trees together The roots of tree1 and tree2 must be the same revision | [
"Merge",
"two",
"trees",
"together",
"The",
"roots",
"of",
"tree1",
"and",
"tree2",
"must",
"be",
"the",
"same",
"revision"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22388-L22423 |
5,329 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | stem | function stem(tree, depth) {
// First we break out the tree into a complete list of root to leaf paths
var paths = rootToLeaf(tree);
var stemmedRevs;
var result;
for (var i = 0, len = paths.length; i < len; i++) {
// Then for each path, we cut off the start of the path based on the
// `depth` to stem... | javascript | function stem(tree, depth) {
// First we break out the tree into a complete list of root to leaf paths
var paths = rootToLeaf(tree);
var stemmedRevs;
var result;
for (var i = 0, len = paths.length; i < len; i++) {
// Then for each path, we cut off the start of the path based on the
// `depth` to stem... | [
"function",
"stem",
"(",
"tree",
",",
"depth",
")",
"{",
"// First we break out the tree into a complete list of root to leaf paths",
"var",
"paths",
"=",
"rootToLeaf",
"(",
"tree",
")",
";",
"var",
"stemmedRevs",
";",
"var",
"result",
";",
"for",
"(",
"var",
"i",... | To ensure we dont grow the revision tree infinitely, we stem old revisions | [
"To",
"ensure",
"we",
"dont",
"grow",
"the",
"revision",
"tree",
"infinitely",
"we",
"stem",
"old",
"revisions"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22507-L22562 |
5,330 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | revExists | function revExists(revs, rev) {
var toVisit = revs.slice();
var splitRev = rev.split('-');
var targetPos = parseInt(splitRev[0], 10);
var targetId = splitRev[1];
var node;
while ((node = toVisit.pop())) {
if (node.pos === targetPos && node.ids[0] === targetId) {
return true;
}
var branche... | javascript | function revExists(revs, rev) {
var toVisit = revs.slice();
var splitRev = rev.split('-');
var targetPos = parseInt(splitRev[0], 10);
var targetId = splitRev[1];
var node;
while ((node = toVisit.pop())) {
if (node.pos === targetPos && node.ids[0] === targetId) {
return true;
}
var branche... | [
"function",
"revExists",
"(",
"revs",
",",
"rev",
")",
"{",
"var",
"toVisit",
"=",
"revs",
".",
"slice",
"(",
")",
";",
"var",
"splitRev",
"=",
"rev",
".",
"split",
"(",
"'-'",
")",
";",
"var",
"targetPos",
"=",
"parseInt",
"(",
"splitRev",
"[",
"0... | return true if a rev exists in the rev tree, false otherwise | [
"return",
"true",
"if",
"a",
"rev",
"exists",
"in",
"the",
"rev",
"tree",
"false",
"otherwise"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L22575-L22592 |
5,331 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | matchesSelector | function matchesSelector(doc, selector) {
/* istanbul ignore if */
if (typeof selector !== 'object') {
// match the CouchDB error message
throw 'Selector error: expected a JSON object';
}
selector = massageSelector(selector);
var row = {
'doc': doc
};
var rowsMatched = filterInMemoryFields([... | javascript | function matchesSelector(doc, selector) {
/* istanbul ignore if */
if (typeof selector !== 'object') {
// match the CouchDB error message
throw 'Selector error: expected a JSON object';
}
selector = massageSelector(selector);
var row = {
'doc': doc
};
var rowsMatched = filterInMemoryFields([... | [
"function",
"matchesSelector",
"(",
"doc",
",",
"selector",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"typeof",
"selector",
"!==",
"'object'",
")",
"{",
"// match the CouchDB error message",
"throw",
"'Selector error: expected a JSON object'",
";",
"}",
"selector",... | return true if the given doc matches the supplied selector | [
"return",
"true",
"if",
"the",
"given",
"doc",
"matches",
"the",
"supplied",
"selector"
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L24468-L24482 |
5,332 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | invalidIdError | function invalidIdError(id) {
var err;
if (!id) {
err = pouchdbErrors.createError(pouchdbErrors.MISSING_ID);
} else if (typeof id !== 'string') {
err = pouchdbErrors.createError(pouchdbErrors.INVALID_ID);
} else if (/^_/.test(id) && !(/^_(design|local)/).test(id)) {
err = pouchdbErrors.createError(p... | javascript | function invalidIdError(id) {
var err;
if (!id) {
err = pouchdbErrors.createError(pouchdbErrors.MISSING_ID);
} else if (typeof id !== 'string') {
err = pouchdbErrors.createError(pouchdbErrors.INVALID_ID);
} else if (/^_/.test(id) && !(/^_(design|local)/).test(id)) {
err = pouchdbErrors.createError(p... | [
"function",
"invalidIdError",
"(",
"id",
")",
"{",
"var",
"err",
";",
"if",
"(",
"!",
"id",
")",
"{",
"err",
"=",
"pouchdbErrors",
".",
"createError",
"(",
"pouchdbErrors",
".",
"MISSING_ID",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"id",
"!==",
"... | Determine id an ID is valid - invalid IDs begin with an underescore that does not begin '_design' or '_local' - any other string value is a valid id Returns the specific error object for each case | [
"Determine",
"id",
"an",
"ID",
"is",
"valid",
"-",
"invalid",
"IDs",
"begin",
"with",
"an",
"underescore",
"that",
"does",
"not",
"begin",
"_design",
"or",
"_local",
"-",
"any",
"other",
"string",
"value",
"is",
"a",
"valid",
"id",
"Returns",
"the",
"spe... | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L25237-L25249 |
5,333 | HospitalRun/hospitalrun-frontend | prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js | deprecate | function deprecate (fn, msg) {
if (config('noDeprecation')) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (config('throwDeprecation')) {
throw new Error(msg);
} else if (config('traceDeprecation')) {
console.trace(msg);
} else {
c... | javascript | function deprecate (fn, msg) {
if (config('noDeprecation')) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (config('throwDeprecation')) {
throw new Error(msg);
} else if (config('traceDeprecation')) {
console.trace(msg);
} else {
c... | [
"function",
"deprecate",
"(",
"fn",
",",
"msg",
")",
"{",
"if",
"(",
"config",
"(",
"'noDeprecation'",
")",
")",
"{",
"return",
"fn",
";",
"}",
"var",
"warned",
"=",
"false",
";",
"function",
"deprecated",
"(",
")",
"{",
"if",
"(",
"!",
"warned",
"... | Mark that a method should not be used.
Returns a modified function which warns once by default.
If `localStorage.noDeprecation = true` is set, then it is a no-op.
If `localStorage.throwDeprecation = true` is set, then deprecated functions
will throw an Error when invoked.
If `localStorage.traceDeprecation = true` is... | [
"Mark",
"that",
"a",
"method",
"should",
"not",
"be",
"used",
".",
"Returns",
"a",
"modified",
"function",
"which",
"warns",
"once",
"by",
"default",
"."
] | 60b692a1b7aa6f2ef007c28717e76582014e07ad | https://github.com/HospitalRun/hospitalrun-frontend/blob/60b692a1b7aa6f2ef007c28717e76582014e07ad/prod/service-worker-28ddbc7ef7a575da0539a0f05f4bfdae.js#L30439-L30460 |
5,334 | impress/impress.js | js/impress.js | function( el, props ) {
var key, pkey;
for ( key in props ) {
if ( props.hasOwnProperty( key ) ) {
pkey = pfx( key );
if ( pkey !== null ) {
el.style[ pkey ] = props[ key ];
}
}
}
return el;
} | javascript | function( el, props ) {
var key, pkey;
for ( key in props ) {
if ( props.hasOwnProperty( key ) ) {
pkey = pfx( key );
if ( pkey !== null ) {
el.style[ pkey ] = props[ key ];
}
}
}
return el;
} | [
"function",
"(",
"el",
",",
"props",
")",
"{",
"var",
"key",
",",
"pkey",
";",
"for",
"(",
"key",
"in",
"props",
")",
"{",
"if",
"(",
"props",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"pkey",
"=",
"pfx",
"(",
"key",
")",
";",
"if",
"... | `css` function applies the styles given in `props` object to the element given as `el`. It runs all property names through `pfx` function to make sure proper prefixed version of the property is used. | [
"css",
"function",
"applies",
"the",
"styles",
"given",
"in",
"props",
"object",
"to",
"the",
"element",
"given",
"as",
"el",
".",
"It",
"runs",
"all",
"property",
"names",
"through",
"pfx",
"function",
"to",
"make",
"sure",
"proper",
"prefixed",
"version",
... | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L85-L96 | |
5,335 | impress/impress.js | js/impress.js | function( currentStep, nextStep ) {
if ( lastEntered === currentStep ) {
lib.util.triggerEvent( currentStep, "impress:stepleave", { next: nextStep } );
lastEntered = null;
}
} | javascript | function( currentStep, nextStep ) {
if ( lastEntered === currentStep ) {
lib.util.triggerEvent( currentStep, "impress:stepleave", { next: nextStep } );
lastEntered = null;
}
} | [
"function",
"(",
"currentStep",
",",
"nextStep",
")",
"{",
"if",
"(",
"lastEntered",
"===",
"currentStep",
")",
"{",
"lib",
".",
"util",
".",
"triggerEvent",
"(",
"currentStep",
",",
"\"impress:stepleave\"",
",",
"{",
"next",
":",
"nextStep",
"}",
")",
";"... | `onStepLeave` is called whenever the currentStep element is left but the event is triggered only if the currentStep is the same as lastEntered step. | [
"onStepLeave",
"is",
"called",
"whenever",
"the",
"currentStep",
"element",
"is",
"left",
"but",
"the",
"event",
"is",
"triggered",
"only",
"if",
"the",
"currentStep",
"is",
"the",
"same",
"as",
"lastEntered",
"step",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L273-L278 | |
5,336 | impress/impress.js | js/impress.js | function( rootId ) { //jshint ignore:line
var lib = {};
for ( var libname in libraryFactories ) {
if ( libraryFactories.hasOwnProperty( libname ) ) {
if ( lib[ libname ] !== undefined ) {
throw "impress.js ERROR: Two libraries both tried to use libname: " ... | javascript | function( rootId ) { //jshint ignore:line
var lib = {};
for ( var libname in libraryFactories ) {
if ( libraryFactories.hasOwnProperty( libname ) ) {
if ( lib[ libname ] !== undefined ) {
throw "impress.js ERROR: Two libraries both tried to use libname: " ... | [
"function",
"(",
"rootId",
")",
"{",
"//jshint ignore:line",
"var",
"lib",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"libname",
"in",
"libraryFactories",
")",
"{",
"if",
"(",
"libraryFactories",
".",
"hasOwnProperty",
"(",
"libname",
")",
")",
"{",
"if",
"(... | Call each library factory, and return the lib object that is added to the api. | [
"Call",
"each",
"library",
"factory",
"and",
"return",
"the",
"lib",
"object",
"that",
"is",
"added",
"to",
"the",
"api",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L839-L850 | |
5,337 | impress/impress.js | js/impress.js | function( root ) { //jshint ignore:line
for ( var i = 0; i < preInitPlugins.length; i++ ) {
var thisLevel = preInitPlugins[ i ];
if ( thisLevel !== undefined ) {
for ( var j = 0; j < thisLevel.length; j++ ) {
thisLevel[ j ]( root );
}
... | javascript | function( root ) { //jshint ignore:line
for ( var i = 0; i < preInitPlugins.length; i++ ) {
var thisLevel = preInitPlugins[ i ];
if ( thisLevel !== undefined ) {
for ( var j = 0; j < thisLevel.length; j++ ) {
thisLevel[ j ]( root );
}
... | [
"function",
"(",
"root",
")",
"{",
"//jshint ignore:line",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"preInitPlugins",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"thisLevel",
"=",
"preInitPlugins",
"[",
"i",
"]",
";",
"if",
"(",
"thisLeve... | Called at beginning of init, to execute all pre-init plugins. | [
"Called",
"at",
"beginning",
"of",
"init",
"to",
"execute",
"all",
"pre",
"-",
"init",
"plugins",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L868-L877 | |
5,338 | impress/impress.js | js/impress.js | function( target, type, listenerFunction ) {
eventListenerList.push( { target:target, type:type, listener:listenerFunction } );
} | javascript | function( target, type, listenerFunction ) {
eventListenerList.push( { target:target, type:type, listener:listenerFunction } );
} | [
"function",
"(",
"target",
",",
"type",
",",
"listenerFunction",
")",
"{",
"eventListenerList",
".",
"push",
"(",
"{",
"target",
":",
"target",
",",
"type",
":",
"type",
",",
"listener",
":",
"listenerFunction",
"}",
")",
";",
"}"
] | `pushEventListener` adds an event listener to the gc stack | [
"pushEventListener",
"adds",
"an",
"event",
"listener",
"to",
"the",
"gc",
"stack"
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L967-L969 | |
5,339 | impress/impress.js | js/impress.js | function( target, type, listenerFunction ) {
target.addEventListener( type, listenerFunction );
pushEventListener( target, type, listenerFunction );
} | javascript | function( target, type, listenerFunction ) {
target.addEventListener( type, listenerFunction );
pushEventListener( target, type, listenerFunction );
} | [
"function",
"(",
"target",
",",
"type",
",",
"listenerFunction",
")",
"{",
"target",
".",
"addEventListener",
"(",
"type",
",",
"listenerFunction",
")",
";",
"pushEventListener",
"(",
"target",
",",
"type",
",",
"listenerFunction",
")",
";",
"}"
] | `addEventListener` combines DOM addEventListener with gc.pushEventListener | [
"addEventListener",
"combines",
"DOM",
"addEventListener",
"with",
"gc",
".",
"pushEventListener"
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L972-L975 | |
5,340 | impress/impress.js | js/impress.js | function( el, eventName, detail ) {
var event = document.createEvent( "CustomEvent" );
event.initCustomEvent( eventName, true, true, detail );
el.dispatchEvent( event );
} | javascript | function( el, eventName, detail ) {
var event = document.createEvent( "CustomEvent" );
event.initCustomEvent( eventName, true, true, detail );
el.dispatchEvent( event );
} | [
"function",
"(",
"el",
",",
"eventName",
",",
"detail",
")",
"{",
"var",
"event",
"=",
"document",
".",
"createEvent",
"(",
"\"CustomEvent\"",
")",
";",
"event",
".",
"initCustomEvent",
"(",
"eventName",
",",
"true",
",",
"true",
",",
"detail",
")",
";",... | `triggerEvent` builds a custom DOM event with given `eventName` and `detail` data and triggers it on element given as `el`. | [
"triggerEvent",
"builds",
"a",
"custom",
"DOM",
"event",
"with",
"given",
"eventName",
"and",
"detail",
"data",
"and",
"triggers",
"it",
"on",
"element",
"given",
"as",
"el",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L1232-L1236 | |
5,341 | impress/impress.js | js/impress.js | function( event ) {
var step = event.target;
currentStepTimeout = util.toNumber( step.dataset.autoplay, autoplayDefault );
if ( status === "paused" ) {
setAutoplayTimeout( 0 );
} else {
setAutoplayTimeout( currentStepTimeout );
}
} | javascript | function( event ) {
var step = event.target;
currentStepTimeout = util.toNumber( step.dataset.autoplay, autoplayDefault );
if ( status === "paused" ) {
setAutoplayTimeout( 0 );
} else {
setAutoplayTimeout( currentStepTimeout );
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"step",
"=",
"event",
".",
"target",
";",
"currentStepTimeout",
"=",
"util",
".",
"toNumber",
"(",
"step",
".",
"dataset",
".",
"autoplay",
",",
"autoplayDefault",
")",
";",
"if",
"(",
"status",
"===",
"\"paused... | If default autoplay time was defined in the presentation root, or in this step, set timeout. | [
"If",
"default",
"autoplay",
"time",
"was",
"defined",
"in",
"the",
"presentation",
"root",
"or",
"in",
"this",
"step",
"set",
"timeout",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L1320-L1328 | |
5,342 | impress/impress.js | js/impress.js | function() {
if ( consoleWindow ) {
// Set notes to next steps notes.
var newNotes = document.querySelector( '.active' ).querySelector( '.notes' );
if ( newNotes ) {
newNotes = newNotes.innerHTML;
} else {
... | javascript | function() {
if ( consoleWindow ) {
// Set notes to next steps notes.
var newNotes = document.querySelector( '.active' ).querySelector( '.notes' );
if ( newNotes ) {
newNotes = newNotes.innerHTML;
} else {
... | [
"function",
"(",
")",
"{",
"if",
"(",
"consoleWindow",
")",
"{",
"// Set notes to next steps notes.",
"var",
"newNotes",
"=",
"document",
".",
"querySelector",
"(",
"'.active'",
")",
".",
"querySelector",
"(",
"'.notes'",
")",
";",
"if",
"(",
"newNotes",
")",
... | Sync the notes to the step | [
"Sync",
"the",
"notes",
"to",
"the",
"step"
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L2182-L2212 | |
5,343 | impress/impress.js | js/impress.js | function() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var ampm = '';
if ( lang.useAMPM ) {
ampm = ( hours < 12 ) ? 'AM' : 'PM';
hours = ( hour... | javascript | function() {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var ampm = '';
if ( lang.useAMPM ) {
ampm = ( hours < 12 ) ? 'AM' : 'PM';
hours = ( hour... | [
"function",
"(",
")",
"{",
"var",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"var",
"hours",
"=",
"now",
".",
"getHours",
"(",
")",
";",
"var",
"minutes",
"=",
"now",
".",
"getMinutes",
"(",
")",
";",
"var",
"seconds",
"=",
"now",
".",
"getSeconds... | Show a clock | [
"Show",
"a",
"clock"
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L2297-L2329 | |
5,344 | impress/impress.js | js/impress.js | function() {
stepids = [];
var steps = root.querySelectorAll( ".step" );
for ( var i = 0; i < steps.length; i++ )
{
stepids[ i + 1 ] = steps[ i ].id;
}
} | javascript | function() {
stepids = [];
var steps = root.querySelectorAll( ".step" );
for ( var i = 0; i < steps.length; i++ )
{
stepids[ i + 1 ] = steps[ i ].id;
}
} | [
"function",
"(",
")",
"{",
"stepids",
"=",
"[",
"]",
";",
"var",
"steps",
"=",
"root",
".",
"querySelectorAll",
"(",
"\".step\"",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"steps",
".",
"length",
";",
"i",
"++",
")",
"{",
"step... | Get stepids from the steps under impress root | [
"Get",
"stepids",
"from",
"the",
"steps",
"under",
"impress",
"root"
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L3511-L3518 | |
5,345 | impress/impress.js | js/impress.js | function( index ) {
var id = "impress-toolbar-group-" + index;
if ( !groups[ index ] ) {
groups[ index ] = document.createElement( "span" );
groups[ index ].id = id;
var nextIndex = getNextGroupIndex( index );
if ( nextIndex === undefined ) {
... | javascript | function( index ) {
var id = "impress-toolbar-group-" + index;
if ( !groups[ index ] ) {
groups[ index ] = document.createElement( "span" );
groups[ index ].id = id;
var nextIndex = getNextGroupIndex( index );
if ( nextIndex === undefined ) {
... | [
"function",
"(",
"index",
")",
"{",
"var",
"id",
"=",
"\"impress-toolbar-group-\"",
"+",
"index",
";",
"if",
"(",
"!",
"groups",
"[",
"index",
"]",
")",
"{",
"groups",
"[",
"index",
"]",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",... | Get the span element that is a child of toolbar, identified by index.
If span element doesn't exist yet, it is created.
Note: Because of Run-to-completion, this is not a race condition.
https://developer.mozilla.org/en/docs/Web/JavaScript/EventLoop#Run-to-completion
:param: index Method will return the element <sp... | [
"Get",
"the",
"span",
"element",
"that",
"is",
"a",
"child",
"of",
"toolbar",
"identified",
"by",
"index",
"."
] | c61403d57ad4603a45117d893e99877d58530604 | https://github.com/impress/impress.js/blob/c61403d57ad4603a45117d893e99877d58530604/js/impress.js#L4192-L4205 | |
5,346 | webpack/webpack-dev-server | client-src/default/index.js | sendMsg | function sendMsg(type, data) {
if (
typeof self !== 'undefined' &&
(typeof WorkerGlobalScope === 'undefined' ||
!(self instanceof WorkerGlobalScope))
) {
self.postMessage(
{
type: `webpack${type}`,
data,
},
'*'
);
}
} | javascript | function sendMsg(type, data) {
if (
typeof self !== 'undefined' &&
(typeof WorkerGlobalScope === 'undefined' ||
!(self instanceof WorkerGlobalScope))
) {
self.postMessage(
{
type: `webpack${type}`,
data,
},
'*'
);
}
} | [
"function",
"sendMsg",
"(",
"type",
",",
"data",
")",
"{",
"if",
"(",
"typeof",
"self",
"!==",
"'undefined'",
"&&",
"(",
"typeof",
"WorkerGlobalScope",
"===",
"'undefined'",
"||",
"!",
"(",
"self",
"instanceof",
"WorkerGlobalScope",
")",
")",
")",
"{",
"se... | Send messages to the outside, so plugins can consume it. | [
"Send",
"messages",
"to",
"the",
"outside",
"so",
"plugins",
"can",
"consume",
"it",
"."
] | efe850b6d32791cf2f8da3bd8e43b3f62b15ed96 | https://github.com/webpack/webpack-dev-server/blob/efe850b6d32791cf2f8da3bd8e43b3f62b15ed96/client-src/default/index.js#L67-L81 |
5,347 | google/shaka-player | build/generateExterns.js | removeExportAnnotationsFromComment | function removeExportAnnotationsFromComment(comment) {
// Remove @export annotations.
comment = comment.replace(EXPORT_REGEX, '')
// Split into lines, remove empty comment lines, then recombine.
comment = comment.split('\n')
.filter(function(line) { return !/^ *\*? *$/.test(line); })
.join('\n');
... | javascript | function removeExportAnnotationsFromComment(comment) {
// Remove @export annotations.
comment = comment.replace(EXPORT_REGEX, '')
// Split into lines, remove empty comment lines, then recombine.
comment = comment.split('\n')
.filter(function(line) { return !/^ *\*? *$/.test(line); })
.join('\n');
... | [
"function",
"removeExportAnnotationsFromComment",
"(",
"comment",
")",
"{",
"// Remove @export annotations.",
"comment",
"=",
"comment",
".",
"replace",
"(",
"EXPORT_REGEX",
",",
"''",
")",
"// Split into lines, remove empty comment lines, then recombine.",
"comment",
"=",
"c... | Take the original block comment and prep it for the externs by removing
export annotations and blank lines.
@param {string}
@return {string} | [
"Take",
"the",
"original",
"block",
"comment",
"and",
"prep",
"it",
"for",
"the",
"externs",
"by",
"removing",
"export",
"annotations",
"and",
"blank",
"lines",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/build/generateExterns.js#L286-L296 |
5,348 | google/shaka-player | build/generateExterns.js | getAllExpressionStatements | function getAllExpressionStatements(node) {
console.assert(node.body && node.body.body);
var expressionStatements = [];
node.body.body.forEach(function(childNode) {
if (childNode.type == 'ExpressionStatement') {
expressionStatements.push(childNode);
} else if (childNode.body) {
var childExpres... | javascript | function getAllExpressionStatements(node) {
console.assert(node.body && node.body.body);
var expressionStatements = [];
node.body.body.forEach(function(childNode) {
if (childNode.type == 'ExpressionStatement') {
expressionStatements.push(childNode);
} else if (childNode.body) {
var childExpres... | [
"function",
"getAllExpressionStatements",
"(",
"node",
")",
"{",
"console",
".",
"assert",
"(",
"node",
".",
"body",
"&&",
"node",
".",
"body",
".",
"body",
")",
";",
"var",
"expressionStatements",
"=",
"[",
"]",
";",
"node",
".",
"body",
".",
"body",
... | Recursively find all expression statements in all block nodes.
@param {ASTNode} node
@return {!Array.<ASTNode>} | [
"Recursively",
"find",
"all",
"expression",
"statements",
"in",
"all",
"block",
"nodes",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/build/generateExterns.js#L304-L316 |
5,349 | google/shaka-player | build/generateExterns.js | createExternsFromConstructor | function createExternsFromConstructor(className, constructorNode) {
// Example code:
//
// /** @interface @exportInterface */
// FooLike = function() {};
//
// /** @exportInterface @type {number} */
// FooLike.prototype.bar;
//
// /** @constructor @export @implements {FooLike} */
// Foo = function()... | javascript | function createExternsFromConstructor(className, constructorNode) {
// Example code:
//
// /** @interface @exportInterface */
// FooLike = function() {};
//
// /** @exportInterface @type {number} */
// FooLike.prototype.bar;
//
// /** @constructor @export @implements {FooLike} */
// Foo = function()... | [
"function",
"createExternsFromConstructor",
"(",
"className",
",",
"constructorNode",
")",
"{",
"// Example code:",
"//",
"// /** @interface @exportInterface */",
"// FooLike = function() {};",
"//",
"// /** @exportInterface @type {number} */",
"// FooLike.prototype.bar;",
"//",
"// ... | Look for exports in a constructor body. If we don't do this, we may end up
with errors about classes not fully implementing their interfaces. In
reality, the interface is implemented by assigning members on "this".
@param {string} className
@param {ASTNode} constructorNode
@return {string} | [
"Look",
"for",
"exports",
"in",
"a",
"constructor",
"body",
".",
"If",
"we",
"don",
"t",
"do",
"this",
"we",
"may",
"end",
"up",
"with",
"errors",
"about",
"classes",
"not",
"fully",
"implementing",
"their",
"interfaces",
".",
"In",
"reality",
"the",
"in... | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/build/generateExterns.js#L502-L560 |
5,350 | google/shaka-player | lib/util/object_utils.js | function(val) {
switch (typeof val) {
case 'undefined':
case 'boolean':
case 'number':
case 'string':
case 'symbol':
case 'function':
return val;
case 'object':
default: {
// typeof null === 'object'
if (!val) return val... | javascript | function(val) {
switch (typeof val) {
case 'undefined':
case 'boolean':
case 'number':
case 'string':
case 'symbol':
case 'function':
return val;
case 'object':
default: {
// typeof null === 'object'
if (!val) return val... | [
"function",
"(",
"val",
")",
"{",
"switch",
"(",
"typeof",
"val",
")",
"{",
"case",
"'undefined'",
":",
"case",
"'boolean'",
":",
"case",
"'number'",
":",
"case",
"'string'",
":",
"case",
"'symbol'",
":",
"case",
"'function'",
":",
"return",
"val",
";",
... | This recursively clones the value |val|, using the captured variable |seenObjects| to track the objects we have already cloned. | [
"This",
"recursively",
"clones",
"the",
"value",
"|val|",
"using",
"the",
"captured",
"variable",
"|seenObjects|",
"to",
"track",
"the",
"objects",
"we",
"have",
"already",
"cloned",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/lib/util/object_utils.js#L36-L82 | |
5,351 | google/shaka-player | lib/player.js | getAdjustedTime | function getAdjustedTime(stream, time) {
if (!stream) return null;
const idx = stream.findSegmentPosition(time - period.startTime);
if (idx == null) return null;
const ref = stream.getSegmentReference(idx);
if (!ref) return null;
const refTime = ref.startTime + period.startTime;
goog.asserts... | javascript | function getAdjustedTime(stream, time) {
if (!stream) return null;
const idx = stream.findSegmentPosition(time - period.startTime);
if (idx == null) return null;
const ref = stream.getSegmentReference(idx);
if (!ref) return null;
const refTime = ref.startTime + period.startTime;
goog.asserts... | [
"function",
"getAdjustedTime",
"(",
"stream",
",",
"time",
")",
"{",
"if",
"(",
"!",
"stream",
")",
"return",
"null",
";",
"const",
"idx",
"=",
"stream",
".",
"findSegmentPosition",
"(",
"time",
"-",
"period",
".",
"startTime",
")",
";",
"if",
"(",
"id... | This method is called after StreamingEngine.init resolves, which means that all the active streams have had createSegmentIndex called. | [
"This",
"method",
"is",
"called",
"after",
"StreamingEngine",
".",
"init",
"resolves",
"which",
"means",
"that",
"all",
"the",
"active",
"streams",
"have",
"had",
"createSegmentIndex",
"called",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/lib/player.js#L3905-L3914 |
5,352 | google/shaka-player | karma.conf.js | allUsableBrowserLaunchers | function allUsableBrowserLaunchers(config) {
var browsers = [];
// Load all launcher plugins.
// The format of the items in this list is something like:
// {
// 'launcher:foo1': ['type', Function],
// 'launcher:foo2': ['type', Function],
// }
// Where the launchers grouped together into one item we... | javascript | function allUsableBrowserLaunchers(config) {
var browsers = [];
// Load all launcher plugins.
// The format of the items in this list is something like:
// {
// 'launcher:foo1': ['type', Function],
// 'launcher:foo2': ['type', Function],
// }
// Where the launchers grouped together into one item we... | [
"function",
"allUsableBrowserLaunchers",
"(",
"config",
")",
"{",
"var",
"browsers",
"=",
"[",
"]",
";",
"// Load all launcher plugins.",
"// The format of the items in this list is something like:",
"// {",
"// 'launcher:foo1': ['type', Function],",
"// 'launcher:foo2': ['type',... | Determines which launchers and customLaunchers can be used and returns an array of strings. | [
"Determines",
"which",
"launchers",
"and",
"customLaunchers",
"can",
"be",
"used",
"and",
"returns",
"an",
"array",
"of",
"strings",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/karma.conf.js#L315-L365 |
5,353 | google/shaka-player | demo/service_worker.js | onInstall | function onInstall(event) {
const preCacheApplication = async () => {
const cache = await caches.open(CACHE_NAME);
// Fetching these with addAll fails for CORS-restricted content, so we use
// fetchAndCache with no-cors mode to work around it.
// Optional resources: failure on these will NOT fail the... | javascript | function onInstall(event) {
const preCacheApplication = async () => {
const cache = await caches.open(CACHE_NAME);
// Fetching these with addAll fails for CORS-restricted content, so we use
// fetchAndCache with no-cors mode to work around it.
// Optional resources: failure on these will NOT fail the... | [
"function",
"onInstall",
"(",
"event",
")",
"{",
"const",
"preCacheApplication",
"=",
"async",
"(",
")",
"=>",
"{",
"const",
"cache",
"=",
"await",
"caches",
".",
"open",
"(",
"CACHE_NAME",
")",
";",
"// Fetching these with addAll fails for CORS-restricted content, ... | This event fires when the service worker is installed.
@param {!InstallEvent} event | [
"This",
"event",
"fires",
"when",
"the",
"service",
"worker",
"is",
"installed",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L144-L168 |
5,354 | google/shaka-player | demo/service_worker.js | onActivate | function onActivate(event) {
// Delete old caches to save space.
const dropOldCaches = async () => {
const cacheNames = await caches.keys();
// Return true on all the caches we want to clean up.
// Note that caches are shared across the origin, so only remove
// caches we are sure we created.
c... | javascript | function onActivate(event) {
// Delete old caches to save space.
const dropOldCaches = async () => {
const cacheNames = await caches.keys();
// Return true on all the caches we want to clean up.
// Note that caches are shared across the origin, so only remove
// caches we are sure we created.
c... | [
"function",
"onActivate",
"(",
"event",
")",
"{",
"// Delete old caches to save space.",
"const",
"dropOldCaches",
"=",
"async",
"(",
")",
"=>",
"{",
"const",
"cacheNames",
"=",
"await",
"caches",
".",
"keys",
"(",
")",
";",
"// Return true on all the caches we want... | This event fires when the service worker is activated.
This can be after installation or upgrade.
@param {!ExtendableEvent} event | [
"This",
"event",
"fires",
"when",
"the",
"service",
"worker",
"is",
"activated",
".",
"This",
"can",
"be",
"after",
"installation",
"or",
"upgrade",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L176-L194 |
5,355 | google/shaka-player | demo/service_worker.js | onFetch | function onFetch(event) {
// Make sure this is a request we should be handling in the first place.
// If it's not, it's important to leave it alone and not call respondWith.
let useCache = false;
for (const prefix of CACHEABLE_URL_PREFIXES) {
if (event.request.url.startsWith(prefix)) {
useCache = true... | javascript | function onFetch(event) {
// Make sure this is a request we should be handling in the first place.
// If it's not, it's important to leave it alone and not call respondWith.
let useCache = false;
for (const prefix of CACHEABLE_URL_PREFIXES) {
if (event.request.url.startsWith(prefix)) {
useCache = true... | [
"function",
"onFetch",
"(",
"event",
")",
"{",
"// Make sure this is a request we should be handling in the first place.",
"// If it's not, it's important to leave it alone and not call respondWith.",
"let",
"useCache",
"=",
"false",
";",
"for",
"(",
"const",
"prefix",
"of",
"CAC... | This event fires when any resource is fetched.
This is where we can use the cache to respond offline.
@param {!FetchEvent} event | [
"This",
"event",
"fires",
"when",
"any",
"resource",
"is",
"fetched",
".",
"This",
"is",
"where",
"we",
"can",
"use",
"the",
"cache",
"to",
"respond",
"offline",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L202-L230 |
5,356 | google/shaka-player | demo/service_worker.js | fetchCacheableResource | async function fetchCacheableResource(request) {
const cache = await caches.open(CACHE_NAME);
const cachedResponse = await cache.match(request);
if (!navigator.onLine) {
// We are offline, and we know it. Just return the cached response, to
// avoid a bunch of pointless errors in the JS console that wil... | javascript | async function fetchCacheableResource(request) {
const cache = await caches.open(CACHE_NAME);
const cachedResponse = await cache.match(request);
if (!navigator.onLine) {
// We are offline, and we know it. Just return the cached response, to
// avoid a bunch of pointless errors in the JS console that wil... | [
"async",
"function",
"fetchCacheableResource",
"(",
"request",
")",
"{",
"const",
"cache",
"=",
"await",
"caches",
".",
"open",
"(",
"CACHE_NAME",
")",
";",
"const",
"cachedResponse",
"=",
"await",
"cache",
".",
"match",
"(",
"request",
")",
";",
"if",
"("... | Fetch a cacheable resource. Decide whether to request from the network,
the cache, or both, and return the appropriate version of the resource.
@param {!Request} request
@return {!Promise.<!Response>} | [
"Fetch",
"a",
"cacheable",
"resource",
".",
"Decide",
"whether",
"to",
"request",
"from",
"the",
"network",
"the",
"cache",
"or",
"both",
"and",
"return",
"the",
"appropriate",
"version",
"of",
"the",
"resource",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L239-L268 |
5,357 | google/shaka-player | demo/service_worker.js | fetchAndCache | async function fetchAndCache(cache, request) {
const response = await fetch(request);
cache.put(request, response.clone());
return response;
} | javascript | async function fetchAndCache(cache, request) {
const response = await fetch(request);
cache.put(request, response.clone());
return response;
} | [
"async",
"function",
"fetchAndCache",
"(",
"cache",
",",
"request",
")",
"{",
"const",
"response",
"=",
"await",
"fetch",
"(",
"request",
")",
";",
"cache",
".",
"put",
"(",
"request",
",",
"response",
".",
"clone",
"(",
")",
")",
";",
"return",
"respo... | Fetch the resource from the network, then store this new version in the
cache.
@param {!Cache} cache
@param {!Request} request
@return {!Promise.<!Response>} | [
"Fetch",
"the",
"resource",
"from",
"the",
"network",
"then",
"store",
"this",
"new",
"version",
"in",
"the",
"cache",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L278-L282 |
5,358 | google/shaka-player | demo/service_worker.js | timeout | function timeout(seconds, asyncProcess) {
return Promise.race([
asyncProcess,
new Promise(function(_, reject) {
setTimeout(reject, seconds * 1000);
}),
]);
} | javascript | function timeout(seconds, asyncProcess) {
return Promise.race([
asyncProcess,
new Promise(function(_, reject) {
setTimeout(reject, seconds * 1000);
}),
]);
} | [
"function",
"timeout",
"(",
"seconds",
",",
"asyncProcess",
")",
"{",
"return",
"Promise",
".",
"race",
"(",
"[",
"asyncProcess",
",",
"new",
"Promise",
"(",
"function",
"(",
"_",
",",
"reject",
")",
"{",
"setTimeout",
"(",
"reject",
",",
"seconds",
"*",... | Returns a Promise which is resolved only if |asyncProcess| is resolved, and
only if it is resolved in less than |seconds| seconds.
If the returned Promise is resolved, it returns the same value as
|asyncProcess|.
If |asyncProcess| fails, the returned Promise is rejected.
If |asyncProcess| takes too long, the returned... | [
"Returns",
"a",
"Promise",
"which",
"is",
"resolved",
"only",
"if",
"|asyncProcess|",
"is",
"resolved",
"and",
"only",
"if",
"it",
"is",
"resolved",
"in",
"less",
"than",
"|seconds|",
"seconds",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/service_worker.js#L300-L307 |
5,359 | google/shaka-player | demo/cast_receiver/receiver_app.js | ShakaReceiver | function ShakaReceiver() {
/** @private {HTMLMediaElement} */
this.video_ = null;
/** @private {shaka.Player} */
this.player_ = null;
/** @private {shaka.cast.CastReceiver} */
this.receiver_ = null;
/** @private {Element} */
this.controlsElement_ = null;
/** @private {?number} */
this.controlsTi... | javascript | function ShakaReceiver() {
/** @private {HTMLMediaElement} */
this.video_ = null;
/** @private {shaka.Player} */
this.player_ = null;
/** @private {shaka.cast.CastReceiver} */
this.receiver_ = null;
/** @private {Element} */
this.controlsElement_ = null;
/** @private {?number} */
this.controlsTi... | [
"function",
"ShakaReceiver",
"(",
")",
"{",
"/** @private {HTMLMediaElement} */",
"this",
".",
"video_",
"=",
"null",
";",
"/** @private {shaka.Player} */",
"this",
".",
"player_",
"=",
"null",
";",
"/** @private {shaka.cast.CastReceiver} */",
"this",
".",
"receiver_",
... | A Chromecast receiver demo app.
@constructor
@suppress {missingProvide} | [
"A",
"Chromecast",
"receiver",
"demo",
"app",
"."
] | 01f7af9d4ee3eeb712719480cb55b7573a2b41fd | https://github.com/google/shaka-player/blob/01f7af9d4ee3eeb712719480cb55b7573a2b41fd/demo/cast_receiver/receiver_app.js#L27-L55 |
5,360 | agershun/alasql | src/99worker-start.js | alasql | function alasql(sql,params,cb){
params = params||[];
// Avoid setting params if not needed even with callback
if(typeof params === 'function'){
scope = cb;
cb = params;
params = [];
}
if(typeof params !== 'object'){
params = [params];
}
// Increase last request id
var id = alasql.lastid++;
/... | javascript | function alasql(sql,params,cb){
params = params||[];
// Avoid setting params if not needed even with callback
if(typeof params === 'function'){
scope = cb;
cb = params;
params = [];
}
if(typeof params !== 'object'){
params = [params];
}
// Increase last request id
var id = alasql.lastid++;
/... | [
"function",
"alasql",
"(",
"sql",
",",
"params",
",",
"cb",
")",
"{",
"params",
"=",
"params",
"||",
"[",
"]",
";",
"// Avoid setting params if not needed even with callback",
"if",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"{",
"scope",
"=",
"cb",
... | Main procedure for worker
@function
@param {string} sql SQL statement
@param {object} params List of parameters (can be omitted)
@param {callback} cb Callback function
@return {object} Query result | [
"Main",
"procedure",
"for",
"worker"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/99worker-start.js#L26-L47 |
5,361 | agershun/alasql | src/832xlsxml.js | hstyle | function hstyle(st) {
// Prepare string
var s = '';
for (var key in st) {
s += '<' + key;
for (var attr in st[key]) {
s += ' ';
if (attr.substr(0, 2) == 'x:') {
s += attr;
} else {
s += 'ss:';
}
s += attr + '="' + st[key][attr] + '"';
}
s += '/>';
}
v... | javascript | function hstyle(st) {
// Prepare string
var s = '';
for (var key in st) {
s += '<' + key;
for (var attr in st[key]) {
s += ' ';
if (attr.substr(0, 2) == 'x:') {
s += attr;
} else {
s += 'ss:';
}
s += attr + '="' + st[key][attr] + '"';
}
s += '/>';
}
v... | [
"function",
"hstyle",
"(",
"st",
")",
"{",
"// Prepare string",
"var",
"s",
"=",
"''",
";",
"for",
"(",
"var",
"key",
"in",
"st",
")",
"{",
"s",
"+=",
"'<'",
"+",
"key",
";",
"for",
"(",
"var",
"attr",
"in",
"st",
"[",
"key",
"]",
")",
"{",
"... | First style Generate style | [
"First",
"style",
"Generate",
"style"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/832xlsxml.js#L66-L94 |
5,362 | agershun/alasql | bin/alasql-cli.js | execute | function execute(sql, params) {
if (0 === sql.trim().length) {
console.error("\nNo SQL to process\n");
yargs.showHelp();
process.exit(1);
}
for (var i = 1; i < params.length; i++) {
var a = params[i];
if (a[0] !== '"' && a[0] !== "'") {
if (+a == a) { // jshint ignore:line
params[i] = +a;
}
}... | javascript | function execute(sql, params) {
if (0 === sql.trim().length) {
console.error("\nNo SQL to process\n");
yargs.showHelp();
process.exit(1);
}
for (var i = 1; i < params.length; i++) {
var a = params[i];
if (a[0] !== '"' && a[0] !== "'") {
if (+a == a) { // jshint ignore:line
params[i] = +a;
}
}... | [
"function",
"execute",
"(",
"sql",
",",
"params",
")",
"{",
"if",
"(",
"0",
"===",
"sql",
".",
"trim",
"(",
")",
".",
"length",
")",
"{",
"console",
".",
"error",
"(",
"\"\\nNo SQL to process\\n\"",
")",
";",
"yargs",
".",
"showHelp",
"(",
")",
";",
... | Execute SQL query
@sql {String} SQL query
@param {String} Parameters
@returns {null} Result will be printet to console.log | [
"Execute",
"SQL",
"query"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/bin/alasql-cli.js#L92-L122 |
5,363 | agershun/alasql | bin/alasql-cli.js | isDirectory | function isDirectory(filePath) {
var isDir = false;
try {
var absolutePath = path.resolve(filePath);
isDir = fs.lstatSync(absolutePath).isDirectory();
} catch (e) {
isDir = e.code === 'ENOENT';
}
return isDir;
} | javascript | function isDirectory(filePath) {
var isDir = false;
try {
var absolutePath = path.resolve(filePath);
isDir = fs.lstatSync(absolutePath).isDirectory();
} catch (e) {
isDir = e.code === 'ENOENT';
}
return isDir;
} | [
"function",
"isDirectory",
"(",
"filePath",
")",
"{",
"var",
"isDir",
"=",
"false",
";",
"try",
"{",
"var",
"absolutePath",
"=",
"path",
".",
"resolve",
"(",
"filePath",
")",
";",
"isDir",
"=",
"fs",
".",
"lstatSync",
"(",
"absolutePath",
")",
".",
"is... | Is this padh a Directory
@param {String} filePath
@returns {Boolean} | [
"Is",
"this",
"padh",
"a",
"Directory"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/bin/alasql-cli.js#L130-L139 |
5,364 | agershun/alasql | src/839zip.js | pack | function pack(items) {
var data = arguments,
idx = 0,
buffer,
bufferSize = 0;
// Calculate buffer size
items = items.split('');
items.forEach(function(type) {
if (type == 'v') {
bufferSize += 2;
} else if (type == 'V' || type == 'l') {
bufferSize += 4;
}
});
// Fill buffer
buff... | javascript | function pack(items) {
var data = arguments,
idx = 0,
buffer,
bufferSize = 0;
// Calculate buffer size
items = items.split('');
items.forEach(function(type) {
if (type == 'v') {
bufferSize += 2;
} else if (type == 'V' || type == 'l') {
bufferSize += 4;
}
});
// Fill buffer
buff... | [
"function",
"pack",
"(",
"items",
")",
"{",
"var",
"data",
"=",
"arguments",
",",
"idx",
"=",
"0",
",",
"buffer",
",",
"bufferSize",
"=",
"0",
";",
"// Calculate buffer size",
"items",
"=",
"items",
".",
"split",
"(",
"''",
")",
";",
"items",
".",
"f... | Pack data in the buffer
@function
@param {array} items
@return {string} | [
"Pack",
"data",
"in",
"the",
"buffer"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/839zip.js#L290-L322 |
5,365 | agershun/alasql | src/843xml.js | xmlparse | function xmlparse(xml) {
xml = xml.trim();
// strip comments
xml = xml.replace(/<!--[\s\S]*?-->/g, '');
return document();
/**
* XML document.
*/
function document() {
return {
declaration: declaration(),
root: tag(),
};
}
/**
* Declaration.
*/
function declaration() {
var m = match(/... | javascript | function xmlparse(xml) {
xml = xml.trim();
// strip comments
xml = xml.replace(/<!--[\s\S]*?-->/g, '');
return document();
/**
* XML document.
*/
function document() {
return {
declaration: declaration(),
root: tag(),
};
}
/**
* Declaration.
*/
function declaration() {
var m = match(/... | [
"function",
"xmlparse",
"(",
"xml",
")",
"{",
"xml",
"=",
"xml",
".",
"trim",
"(",
")",
";",
"// strip comments",
"xml",
"=",
"xml",
".",
"replace",
"(",
"/",
"<!--[\\s\\S]*?-->",
"/",
"g",
",",
"''",
")",
";",
"return",
"document",
"(",
")",
";",
... | Parse the given string of `xml`.
@param {String} xml
@return {Object}
@api public | [
"Parse",
"the",
"given",
"string",
"of",
"xml",
"."
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/843xml.js#L24-L166 |
5,366 | agershun/alasql | src/843xml.js | match | function match(re) {
var m = xml.match(re);
if (!m) return;
xml = xml.slice(m[0].length);
return m;
} | javascript | function match(re) {
var m = xml.match(re);
if (!m) return;
xml = xml.slice(m[0].length);
return m;
} | [
"function",
"match",
"(",
"re",
")",
"{",
"var",
"m",
"=",
"xml",
".",
"match",
"(",
"re",
")",
";",
"if",
"(",
"!",
"m",
")",
"return",
";",
"xml",
"=",
"xml",
".",
"slice",
"(",
"m",
"[",
"0",
"]",
".",
"length",
")",
";",
"return",
"m",
... | Match `re` and advance the string. | [
"Match",
"re",
"and",
"advance",
"the",
"string",
"."
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/843xml.js#L144-L149 |
5,367 | agershun/alasql | lib/xmldoc/xmldoc.js | extend | function extend(destination, source) {
for (var prop in source)
if (source.hasOwnProperty(prop))
destination[prop] = source[prop];
} | javascript | function extend(destination, source) {
for (var prop in source)
if (source.hasOwnProperty(prop))
destination[prop] = source[prop];
} | [
"function",
"extend",
"(",
"destination",
",",
"source",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"source",
")",
"if",
"(",
"source",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"destination",
"[",
"prop",
"]",
"=",
"source",
"[",
"prop",
"]",
";... | a relatively standard extend method | [
"a",
"relatively",
"standard",
"extend",
"method"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/lib/xmldoc/xmldoc.js#L223-L227 |
5,368 | agershun/alasql | src/63createvertex.js | findVertex | function findVertex(name) {
var objects = alasql.databases[alasql.useid].objects;
for (var k in objects) {
if (objects[k].name === name) {
return objects[k];
}
}
return undefined;
} | javascript | function findVertex(name) {
var objects = alasql.databases[alasql.useid].objects;
for (var k in objects) {
if (objects[k].name === name) {
return objects[k];
}
}
return undefined;
} | [
"function",
"findVertex",
"(",
"name",
")",
"{",
"var",
"objects",
"=",
"alasql",
".",
"databases",
"[",
"alasql",
".",
"useid",
"]",
".",
"objects",
";",
"for",
"(",
"var",
"k",
"in",
"objects",
")",
"{",
"if",
"(",
"objects",
"[",
"k",
"]",
".",
... | Find vertex by name | [
"Find",
"vertex",
"by",
"name"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/63createvertex.js#L394-L402 |
5,369 | agershun/alasql | src/38query.js | queryfn | function queryfn(query, oldscope, cb, A, B) {
var aaa = query.sources.length;
var ms;
query.sourceslen = query.sources.length;
var slen = query.sourceslen;
query.query = query; // TODO Remove to prevent memory leaks
query.A = A;
query.B = B;
query.cb = cb;
query.oldscope = oldscope;
// Run all s... | javascript | function queryfn(query, oldscope, cb, A, B) {
var aaa = query.sources.length;
var ms;
query.sourceslen = query.sources.length;
var slen = query.sourceslen;
query.query = query; // TODO Remove to prevent memory leaks
query.A = A;
query.B = B;
query.cb = cb;
query.oldscope = oldscope;
// Run all s... | [
"function",
"queryfn",
"(",
"query",
",",
"oldscope",
",",
"cb",
",",
"A",
",",
"B",
")",
"{",
"var",
"aaa",
"=",
"query",
".",
"sources",
".",
"length",
";",
"var",
"ms",
";",
"query",
".",
"sourceslen",
"=",
"query",
".",
"sources",
".",
"length"... | Main query procedure | [
"Main",
"query",
"procedure"
] | ac380c9869aec93f2ae41621225e22547d1d221b | https://github.com/agershun/alasql/blob/ac380c9869aec93f2ae41621225e22547d1d221b/src/38query.js#L2-L80 |
5,370 | hyperledger/indy-sdk | samples/nodejs/src/anoncredsRevocationScenario.js | createAndOpenWallet | async function createAndOpenWallet(actor) {
const walletConfig = {"id": actor + ".wallet"}
const walletCredentials = {"key": actor + ".wallet_key"}
await indy.createWallet(walletConfig, walletCredentials)
return await indy.openWallet(walletConfig, walletCredentials)
} | javascript | async function createAndOpenWallet(actor) {
const walletConfig = {"id": actor + ".wallet"}
const walletCredentials = {"key": actor + ".wallet_key"}
await indy.createWallet(walletConfig, walletCredentials)
return await indy.openWallet(walletConfig, walletCredentials)
} | [
"async",
"function",
"createAndOpenWallet",
"(",
"actor",
")",
"{",
"const",
"walletConfig",
"=",
"{",
"\"id\"",
":",
"actor",
"+",
"\".wallet\"",
"}",
"const",
"walletCredentials",
"=",
"{",
"\"key\"",
":",
"actor",
"+",
"\".wallet_key\"",
"}",
"await",
"indy... | Functions for wallet | [
"Functions",
"for",
"wallet"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/samples/nodejs/src/anoncredsRevocationScenario.js#L45-L50 |
5,371 | hyperledger/indy-sdk | samples/nodejs/src/anoncredsRevocationScenario.js | createAndOpenPoolHandle | async function createAndOpenPoolHandle(actor) {
const poolName = actor + "-pool-sandbox"
const poolGenesisTxnPath = await util.getPoolGenesisTxnPath(poolName)
const poolConfig = {"genesis_txn": poolGenesisTxnPath}
await indy.createPoolLedgerConfig(poolName, poolConfig)
.catch(e => {
... | javascript | async function createAndOpenPoolHandle(actor) {
const poolName = actor + "-pool-sandbox"
const poolGenesisTxnPath = await util.getPoolGenesisTxnPath(poolName)
const poolConfig = {"genesis_txn": poolGenesisTxnPath}
await indy.createPoolLedgerConfig(poolName, poolConfig)
.catch(e => {
... | [
"async",
"function",
"createAndOpenPoolHandle",
"(",
"actor",
")",
"{",
"const",
"poolName",
"=",
"actor",
"+",
"\"-pool-sandbox\"",
"const",
"poolGenesisTxnPath",
"=",
"await",
"util",
".",
"getPoolGenesisTxnPath",
"(",
"poolName",
")",
"const",
"poolConfig",
"=",
... | Functions for pool handler | [
"Functions",
"for",
"pool",
"handler"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/samples/nodejs/src/anoncredsRevocationScenario.js#L61-L71 |
5,372 | hyperledger/indy-sdk | samples/nodejs/src/anoncredsRevocationScenario.js | postRevocRegDefRequestToLedger | async function postRevocRegDefRequestToLedger(poolHandle, wallet, did, revRegDef) {
const revocRegRequest = await indy.buildRevocRegDefRequest(did, revRegDef)
await ensureSignAndSubmitRequest(poolHandle, wallet, did, revocRegRequest)
} | javascript | async function postRevocRegDefRequestToLedger(poolHandle, wallet, did, revRegDef) {
const revocRegRequest = await indy.buildRevocRegDefRequest(did, revRegDef)
await ensureSignAndSubmitRequest(poolHandle, wallet, did, revocRegRequest)
} | [
"async",
"function",
"postRevocRegDefRequestToLedger",
"(",
"poolHandle",
",",
"wallet",
",",
"did",
",",
"revRegDef",
")",
"{",
"const",
"revocRegRequest",
"=",
"await",
"indy",
".",
"buildRevocRegDefRequest",
"(",
"did",
",",
"revRegDef",
")",
"await",
"ensureSi... | Main "run" function | [
"Main",
"run",
"function"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/samples/nodejs/src/anoncredsRevocationScenario.js#L159-L162 |
5,373 | hyperledger/indy-sdk | wrappers/dotnet/docs/styles/docfx.js | renderLinks | function renderLinks() {
if ($("meta[property='docfx:newtab']").attr("content") === "true") {
$(document.links).filter(function () {
return this.hostname !== window.location.hostname;
}).attr('target', '_blank');
}
} | javascript | function renderLinks() {
if ($("meta[property='docfx:newtab']").attr("content") === "true") {
$(document.links).filter(function () {
return this.hostname !== window.location.hostname;
}).attr('target', '_blank');
}
} | [
"function",
"renderLinks",
"(",
")",
"{",
"if",
"(",
"$",
"(",
"\"meta[property='docfx:newtab']\"",
")",
".",
"attr",
"(",
"\"content\"",
")",
"===",
"\"true\"",
")",
"{",
"$",
"(",
"document",
".",
"links",
")",
".",
"filter",
"(",
"function",
"(",
")",... | Open links to different host in a new window. | [
"Open",
"links",
"to",
"different",
"host",
"in",
"a",
"new",
"window",
"."
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/wrappers/dotnet/docs/styles/docfx.js#L68-L74 |
5,374 | hyperledger/indy-sdk | wrappers/dotnet/docs/styles/docfx.js | highlight | function highlight() {
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});
$('pre code[highlight-lines]').each(function (i, block) {
if (block.innerHTML === "") return;
var lines = block.innerHTML.split('\n');
queryString = block.getAttribute('highlight-lines');... | javascript | function highlight() {
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});
$('pre code[highlight-lines]').each(function (i, block) {
if (block.innerHTML === "") return;
var lines = block.innerHTML.split('\n');
queryString = block.getAttribute('highlight-lines');... | [
"function",
"highlight",
"(",
")",
"{",
"$",
"(",
"'pre code'",
")",
".",
"each",
"(",
"function",
"(",
"i",
",",
"block",
")",
"{",
"hljs",
".",
"highlightBlock",
"(",
"block",
")",
";",
"}",
")",
";",
"$",
"(",
"'pre code[highlight-lines]'",
")",
"... | Enable highlight.js | [
"Enable",
"highlight",
".",
"js"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/wrappers/dotnet/docs/styles/docfx.js#L77-L114 |
5,375 | hyperledger/indy-sdk | wrappers/dotnet/docs/styles/docfx.js | renderSearchBox | function renderSearchBox() {
autoCollapse();
$(window).on('resize', autoCollapse);
$(document).on('click', '.navbar-collapse.in', function (e) {
if ($(e.target).is('a')) {
$(this).collapse('hide');
}
});
function autoCollapse() {
var navbar = $('#autocoll... | javascript | function renderSearchBox() {
autoCollapse();
$(window).on('resize', autoCollapse);
$(document).on('click', '.navbar-collapse.in', function (e) {
if ($(e.target).is('a')) {
$(this).collapse('hide');
}
});
function autoCollapse() {
var navbar = $('#autocoll... | [
"function",
"renderSearchBox",
"(",
")",
"{",
"autoCollapse",
"(",
")",
";",
"$",
"(",
"window",
")",
".",
"on",
"(",
"'resize'",
",",
"autoCollapse",
")",
";",
"$",
"(",
"document",
")",
".",
"on",
"(",
"'click'",
",",
"'.navbar-collapse.in'",
",",
"f... | Adjust the position of search box in navbar | [
"Adjust",
"the",
"position",
"of",
"search",
"box",
"in",
"navbar"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/wrappers/dotnet/docs/styles/docfx.js#L139-L158 |
5,376 | hyperledger/indy-sdk | wrappers/dotnet/docs/styles/docfx.js | highlightKeywords | function highlightKeywords() {
var q = url('?q');
if (q !== null) {
var keywords = q.split("%20");
keywords.forEach(function (keyword) {
if (keyword !== "") {
$('.data-searchable *').mark(keyword);
$('article *').mark(keyword);
}
});
... | javascript | function highlightKeywords() {
var q = url('?q');
if (q !== null) {
var keywords = q.split("%20");
keywords.forEach(function (keyword) {
if (keyword !== "") {
$('.data-searchable *').mark(keyword);
$('article *').mark(keyword);
}
});
... | [
"function",
"highlightKeywords",
"(",
")",
"{",
"var",
"q",
"=",
"url",
"(",
"'?q'",
")",
";",
"if",
"(",
"q",
"!==",
"null",
")",
"{",
"var",
"keywords",
"=",
"q",
".",
"split",
"(",
"\"%20\"",
")",
";",
"keywords",
".",
"forEach",
"(",
"function"... | Highlight the searching keywords | [
"Highlight",
"the",
"searching",
"keywords"
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/wrappers/dotnet/docs/styles/docfx.js#L224-L235 |
5,377 | hyperledger/indy-sdk | wrappers/dotnet/docs/styles/lunr.js | function (config) {
var builder = new lunr.Builder
builder.pipeline.add(
lunr.trimmer,
lunr.stopWordFilter,
lunr.stemmer
)
builder.searchPipeline.add(
lunr.stemmer
)
config.call(builder, builder)
return builder.build()
} | javascript | function (config) {
var builder = new lunr.Builder
builder.pipeline.add(
lunr.trimmer,
lunr.stopWordFilter,
lunr.stemmer
)
builder.searchPipeline.add(
lunr.stemmer
)
config.call(builder, builder)
return builder.build()
} | [
"function",
"(",
"config",
")",
"{",
"var",
"builder",
"=",
"new",
"lunr",
".",
"Builder",
"builder",
".",
"pipeline",
".",
"add",
"(",
"lunr",
".",
"trimmer",
",",
"lunr",
".",
"stopWordFilter",
",",
"lunr",
".",
"stemmer",
")",
"builder",
".",
"searc... | A convenience function for configuring and constructing
a new lunr Index.
A lunr.Builder instance is created and the pipeline setup
with a trimmer, stop word filter and stemmer.
This builder object is yielded to the configuration function
that is passed as a parameter, allowing the list of fields
and other builder pa... | [
"A",
"convenience",
"function",
"for",
"configuring",
"and",
"constructing",
"a",
"new",
"lunr",
"Index",
"."
] | cb5dc804ca94850f35dfb429fa4e53b3fff21d67 | https://github.com/hyperledger/indy-sdk/blob/cb5dc804ca94850f35dfb429fa4e53b3fff21d67/wrappers/dotnet/docs/styles/lunr.js#L40-L55 | |
5,378 | lihongxun945/jquery-weui | src/js/picker.js | isPopover | function isPopover() {
var toPopover = false;
if (!p.params.convertToPopover && !p.params.onlyInPopover) return toPopover;
if (!p.inline && p.params.input) {
if (p.params.onlyInPopover) toPopover = true;
else {
if ($.device.ios) {
... | javascript | function isPopover() {
var toPopover = false;
if (!p.params.convertToPopover && !p.params.onlyInPopover) return toPopover;
if (!p.inline && p.params.input) {
if (p.params.onlyInPopover) toPopover = true;
else {
if ($.device.ios) {
... | [
"function",
"isPopover",
"(",
")",
"{",
"var",
"toPopover",
"=",
"false",
";",
"if",
"(",
"!",
"p",
".",
"params",
".",
"convertToPopover",
"&&",
"!",
"p",
".",
"params",
".",
"onlyInPopover",
")",
"return",
"toPopover",
";",
"if",
"(",
"!",
"p",
"."... | Should be converted to popover | [
"Should",
"be",
"converted",
"to",
"popover"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/picker.js#L47-L62 |
5,379 | lihongxun945/jquery-weui | src/js/hammer.js | each | function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
... | javascript | function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
... | [
"function",
"each",
"(",
"obj",
",",
"iterator",
",",
"context",
")",
"{",
"var",
"i",
";",
"if",
"(",
"!",
"obj",
")",
"{",
"return",
";",
"}",
"if",
"(",
"obj",
".",
"forEach",
")",
"{",
"obj",
".",
"forEach",
"(",
"iterator",
",",
"context",
... | walk objects and arrays
@param {Object} obj
@param {Function} iterator
@param {Object} context | [
"walk",
"objects",
"and",
"arrays"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L52-L72 |
5,380 | lihongxun945/jquery-weui | src/js/hammer.js | deprecate | function deprecate(method, name, message) {
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
return function() {
var e = new Error('get-stack-trace');
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
... | javascript | function deprecate(method, name, message) {
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
return function() {
var e = new Error('get-stack-trace');
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
... | [
"function",
"deprecate",
"(",
"method",
",",
"name",
",",
"message",
")",
"{",
"var",
"deprecationMessage",
"=",
"'DEPRECATED METHOD: '",
"+",
"name",
"+",
"'\\n'",
"+",
"message",
"+",
"' AT \\n'",
";",
"return",
"function",
"(",
")",
"{",
"var",
"e",
"="... | wrap a method with a deprecation warning and stack trace
@param {Function} method
@param {String} name
@param {String} message
@returns {Function} A new function wrapping the supplied method. | [
"wrap",
"a",
"method",
"with",
"a",
"deprecation",
"warning",
"and",
"stack",
"trace"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L81-L95 |
5,381 | lihongxun945/jquery-weui | src/js/hammer.js | boolOrFn | function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
} | javascript | function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
} | [
"function",
"boolOrFn",
"(",
"val",
",",
"args",
")",
"{",
"if",
"(",
"typeof",
"val",
"==",
"TYPE_FUNCTION",
")",
"{",
"return",
"val",
".",
"apply",
"(",
"args",
"?",
"args",
"[",
"0",
"]",
"||",
"undefined",
":",
"undefined",
",",
"args",
")",
"... | let a boolean value also be a function that must return a boolean
this first item in args will be used as the context
@param {Boolean|Function} val
@param {Array} [args]
@returns {Boolean} | [
"let",
"a",
"boolean",
"value",
"also",
"be",
"a",
"function",
"that",
"must",
"return",
"a",
"boolean",
"this",
"first",
"item",
"in",
"args",
"will",
"be",
"used",
"as",
"the",
"context"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L197-L202 |
5,382 | lihongxun945/jquery-weui | src/js/hammer.js | addEventListeners | function addEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.addEventListener(type, handler, false);
});
} | javascript | function addEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.addEventListener(type, handler, false);
});
} | [
"function",
"addEventListeners",
"(",
"target",
",",
"types",
",",
"handler",
")",
"{",
"each",
"(",
"splitStr",
"(",
"types",
")",
",",
"function",
"(",
"type",
")",
"{",
"target",
".",
"addEventListener",
"(",
"type",
",",
"handler",
",",
"false",
")",... | addEventListener with multiple events at once
@param {EventTarget} target
@param {String} types
@param {Function} handler | [
"addEventListener",
"with",
"multiple",
"events",
"at",
"once"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L220-L224 |
5,383 | lihongxun945/jquery-weui | src/js/hammer.js | removeEventListeners | function removeEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.removeEventListener(type, handler, false);
});
} | javascript | function removeEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.removeEventListener(type, handler, false);
});
} | [
"function",
"removeEventListeners",
"(",
"target",
",",
"types",
",",
"handler",
")",
"{",
"each",
"(",
"splitStr",
"(",
"types",
")",
",",
"function",
"(",
"type",
")",
"{",
"target",
".",
"removeEventListener",
"(",
"type",
",",
"handler",
",",
"false",
... | removeEventListener with multiple events at once
@param {EventTarget} target
@param {String} types
@param {Function} handler | [
"removeEventListener",
"with",
"multiple",
"events",
"at",
"once"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L232-L236 |
5,384 | lihongxun945/jquery-weui | src/js/hammer.js | inArray | function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
return i;
}
... | javascript | function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
return i;
}
... | [
"function",
"inArray",
"(",
"src",
",",
"find",
",",
"findByKey",
")",
"{",
"if",
"(",
"src",
".",
"indexOf",
"&&",
"!",
"findByKey",
")",
"{",
"return",
"src",
".",
"indexOf",
"(",
"find",
")",
";",
"}",
"else",
"{",
"var",
"i",
"=",
"0",
";",
... | find if a array contains the object using indexOf or a simple polyFill
@param {Array} src
@param {String} find
@param {String} [findByKey]
@return {Boolean|Number} false when not found, or the index | [
"find",
"if",
"a",
"array",
"contains",
"the",
"object",
"using",
"indexOf",
"or",
"a",
"simple",
"polyFill"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L281-L294 |
5,385 | lihongxun945/jquery-weui | src/js/hammer.js | Input | function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when disabled th... | javascript | function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when disabled th... | [
"function",
"Input",
"(",
"manager",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"manager",
"=",
"manager",
";",
"this",
".",
"callback",
"=",
"callback",
";",
"this",
".",
"element",
"=",
"manager",
".",
"element",
";",
... | create new input type manager
@param {Manager} manager
@param {Function} callback
@returns {Input}
@constructor | [
"create",
"new",
"input",
"type",
"manager"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L419-L436 |
5,386 | lihongxun945/jquery-weui | src/js/hammer.js | computeIntervalInputData | function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity, velocityX, velocityY, direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
... | javascript | function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity, velocityX, velocityY, direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
... | [
"function",
"computeIntervalInputData",
"(",
"session",
",",
"input",
")",
"{",
"var",
"last",
"=",
"session",
".",
"lastInterval",
"||",
"input",
",",
"deltaTime",
"=",
"input",
".",
"timeStamp",
"-",
"last",
".",
"timeStamp",
",",
"velocity",
",",
"velocit... | velocity is calculated every x ms
@param {Object} session
@param {Object} input | [
"velocity",
"is",
"calculated",
"every",
"x",
"ms"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L605-L633 |
5,387 | lihongxun945/jquery-weui | src/js/hammer.js | simpleCloneInputData | function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i... | javascript | function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i... | [
"function",
"simpleCloneInputData",
"(",
"input",
")",
"{",
"// make a simple copy of the pointers because we will get a reference if we don't",
"// we only need clientXY for the calculations",
"var",
"pointers",
"=",
"[",
"]",
";",
"var",
"i",
"=",
"0",
";",
"while",
"(",
... | create a simple clone from the input used for storage of firstInput and firstMultiple
@param {Object} input
@returns {Object} clonedInputData | [
"create",
"a",
"simple",
"clone",
"from",
"the",
"input",
"used",
"for",
"storage",
"of",
"firstInput",
"and",
"firstMultiple"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L640-L660 |
5,388 | lihongxun945/jquery-weui | src/js/hammer.js | getCenter | function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0, y = 0, i = 0;
while (i < pointer... | javascript | function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0, y = 0, i = 0;
while (i < pointer... | [
"function",
"getCenter",
"(",
"pointers",
")",
"{",
"var",
"pointersLength",
"=",
"pointers",
".",
"length",
";",
"// no need to loop when only one touch",
"if",
"(",
"pointersLength",
"===",
"1",
")",
"{",
"return",
"{",
"x",
":",
"round",
"(",
"pointers",
"[... | get the center of all the pointers
@param {Array} pointers
@return {Object} center contains `x` and `y` properties | [
"get",
"the",
"center",
"of",
"all",
"the",
"pointers"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L667-L689 |
5,389 | lihongxun945/jquery-weui | src/js/hammer.js | getScale | function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
} | javascript | function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
} | [
"function",
"getScale",
"(",
"start",
",",
"end",
")",
"{",
"return",
"getDistance",
"(",
"end",
"[",
"0",
"]",
",",
"end",
"[",
"1",
"]",
",",
"PROPS_CLIENT_XY",
")",
"/",
"getDistance",
"(",
"start",
"[",
"0",
"]",
",",
"start",
"[",
"1",
"]",
... | calculate the scale factor between two pointersets
no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
@param {Array} start array of pointers
@param {Array} end array of pointers
@return {Number} scale | [
"calculate",
"the",
"scale",
"factor",
"between",
"two",
"pointersets",
"no",
"scale",
"is",
"1",
"and",
"goes",
"down",
"to",
"0",
"when",
"pinched",
"together",
"and",
"bigger",
"when",
"pinched",
"out"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L772-L774 |
5,390 | lihongxun945/jquery-weui | src/js/hammer.js | MouseInput | function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.pressed = false; // mousedown state
Input.apply(this, arguments);
} | javascript | function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.pressed = false; // mousedown state
Input.apply(this, arguments);
} | [
"function",
"MouseInput",
"(",
")",
"{",
"this",
".",
"evEl",
"=",
"MOUSE_ELEMENT_EVENTS",
";",
"this",
".",
"evWin",
"=",
"MOUSE_WINDOW_EVENTS",
";",
"this",
".",
"pressed",
"=",
"false",
";",
"// mousedown state",
"Input",
".",
"apply",
"(",
"this",
",",
... | Mouse events input
@constructor
@extends Input | [
"Mouse",
"events",
"input"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L790-L797 |
5,391 | lihongxun945/jquery-weui | src/js/hammer.js | PointerEventInput | function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = (this.manager.session.pointerEvents = []);
} | javascript | function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = (this.manager.session.pointerEvents = []);
} | [
"function",
"PointerEventInput",
"(",
")",
"{",
"this",
".",
"evEl",
"=",
"POINTER_ELEMENT_EVENTS",
";",
"this",
".",
"evWin",
"=",
"POINTER_WINDOW_EVENTS",
";",
"Input",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"store",
"=",
"("... | Pointer events input
@constructor
@extends Input | [
"Pointer",
"events",
"input"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L864-L871 |
5,392 | lihongxun945/jquery-weui | src/js/hammer.js | PEhandler | function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
... | javascript | function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
... | [
"function",
"PEhandler",
"(",
"ev",
")",
"{",
"var",
"store",
"=",
"this",
".",
"store",
";",
"var",
"removePointer",
"=",
"false",
";",
"var",
"eventTypeNormalized",
"=",
"ev",
".",
"type",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"'ms'",
",... | handle mouse events
@param {Object} ev | [
"handle",
"mouse",
"events"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L878-L920 |
5,393 | lihongxun945/jquery-weui | src/js/hammer.js | SingleTouchInput | function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
} | javascript | function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
} | [
"function",
"SingleTouchInput",
"(",
")",
"{",
"this",
".",
"evTarget",
"=",
"SINGLE_TOUCH_TARGET_EVENTS",
";",
"this",
".",
"evWin",
"=",
"SINGLE_TOUCH_WINDOW_EVENTS",
";",
"this",
".",
"started",
"=",
"false",
";",
"Input",
".",
"apply",
"(",
"this",
",",
... | Touch events input
@constructor
@extends Input | [
"Touch",
"events",
"input"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L938-L944 |
5,394 | lihongxun945/jquery-weui | src/js/hammer.js | Recognizer | function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requir... | javascript | function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requir... | [
"function",
"Recognizer",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"assign",
"(",
"{",
"}",
",",
"this",
".",
"defaults",
",",
"options",
"||",
"{",
"}",
")",
";",
"this",
".",
"id",
"=",
"uniqueId",
"(",
")",
";",
"this",
".",
"man... | Recognizer
Every recognizer needs to extend from this class.
@constructor
@param {Object} options | [
"Recognizer",
"Every",
"recognizer",
"needs",
"to",
"extend",
"from",
"this",
"class",
"."
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1393-L1407 |
5,395 | lihongxun945/jquery-weui | src/js/hammer.js | function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (!simultaneous[otherRecognizer.id]) {
... | javascript | function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (!simultaneous[otherRecognizer.id]) {
... | [
"function",
"(",
"otherRecognizer",
")",
"{",
"if",
"(",
"invokeArrayArg",
"(",
"otherRecognizer",
",",
"'recognizeWith'",
",",
"this",
")",
")",
"{",
"return",
"this",
";",
"}",
"var",
"simultaneous",
"=",
"this",
".",
"simultaneous",
";",
"otherRecognizer",
... | recognize simultaneous with an other recognizer.
@param {Recognizer} otherRecognizer
@returns {Recognizer} this | [
"recognize",
"simultaneous",
"with",
"an",
"other",
"recognizer",
"."
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1434-L1446 | |
5,396 | lihongxun945/jquery-weui | src/js/hammer.js | function() {
var i = 0;
while (i < this.requireFail.length) {
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
return false;
}
i++;
}
return true;
} | javascript | function() {
var i = 0;
while (i < this.requireFail.length) {
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
return false;
}
i++;
}
return true;
} | [
"function",
"(",
")",
"{",
"var",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"this",
".",
"requireFail",
".",
"length",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"requireFail",
"[",
"i",
"]",
".",
"state",
"&",
"(",
"STATE_FAILED",
"|",
"STA... | can we emit?
@returns {boolean} | [
"can",
"we",
"emit?"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1565-L1574 | |
5,397 | lihongxun945/jquery-weui | src/js/hammer.js | function(inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
... | javascript | function(inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
... | [
"function",
"(",
"inputData",
")",
"{",
"// make a new copy of the inputData",
"// so we can change the inputData without messing up the other recognizers",
"var",
"inputDataClone",
"=",
"assign",
"(",
"{",
"}",
",",
"inputData",
")",
";",
"// is is enabled and allow recognizing?... | update the recognizer
@param {Object} inputData | [
"update",
"the",
"recognizer"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1580-L1604 | |
5,398 | lihongxun945/jquery-weui | src/js/hammer.js | stateStr | function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
} else if (state & STATE_ENDED) {
return 'end';
} else if (state & STATE_CHANGED) {
return 'move';
} else if (state & STATE_BEGAN) {
return 'start';
}
return '';
} | javascript | function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
} else if (state & STATE_ENDED) {
return 'end';
} else if (state & STATE_CHANGED) {
return 'move';
} else if (state & STATE_BEGAN) {
return 'start';
}
return '';
} | [
"function",
"stateStr",
"(",
"state",
")",
"{",
"if",
"(",
"state",
"&",
"STATE_CANCELLED",
")",
"{",
"return",
"'cancel'",
";",
"}",
"else",
"if",
"(",
"state",
"&",
"STATE_ENDED",
")",
"{",
"return",
"'end'",
";",
"}",
"else",
"if",
"(",
"state",
"... | get a usable string, used as event postfix
@param {Const} state
@returns {String} state | [
"get",
"a",
"usable",
"string",
"used",
"as",
"event",
"postfix"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1635-L1646 |
5,399 | lihongxun945/jquery-weui | src/js/hammer.js | directionStr | function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
} else if (direction == DIRECTION_UP) {
return 'up';
} else if (direction == DIRECTION_LEFT) {
return 'left';
} else if (direction == DIRECTION_RIGHT) {
return 'right';
}
return '... | javascript | function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
} else if (direction == DIRECTION_UP) {
return 'up';
} else if (direction == DIRECTION_LEFT) {
return 'left';
} else if (direction == DIRECTION_RIGHT) {
return 'right';
}
return '... | [
"function",
"directionStr",
"(",
"direction",
")",
"{",
"if",
"(",
"direction",
"==",
"DIRECTION_DOWN",
")",
"{",
"return",
"'down'",
";",
"}",
"else",
"if",
"(",
"direction",
"==",
"DIRECTION_UP",
")",
"{",
"return",
"'up'",
";",
"}",
"else",
"if",
"(",... | direction cons to string
@param {Const} direction
@returns {String} | [
"direction",
"cons",
"to",
"string"
] | e1efdff32318e8bf84e06778094a1705d5d99ddb | https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1653-L1664 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.