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
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
lihongxun945/jquery-weui
src/js/hammer.js
getRecognizerByNameIfManager
function getRecognizerByNameIfManager(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) { return manager.get(otherRecognizer); } return otherRecognizer; }
javascript
function getRecognizerByNameIfManager(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) { return manager.get(otherRecognizer); } return otherRecognizer; }
[ "function", "getRecognizerByNameIfManager", "(", "otherRecognizer", ",", "recognizer", ")", "{", "var", "manager", "=", "recognizer", ".", "manager", ";", "if", "(", "manager", ")", "{", "return", "manager", ".", "get", "(", "otherRecognizer", ")", ";", "}", ...
get a recognizer by name if it is bound to a manager @param {Recognizer|String} otherRecognizer @param {Recognizer} recognizer @returns {Recognizer}
[ "get", "a", "recognizer", "by", "name", "if", "it", "is", "bound", "to", "a", "manager" ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1672-L1678
train
lihongxun945/jquery-weui
src/js/hammer.js
function(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED if (isRecognized && (eventType...
javascript
function(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED if (isRecognized && (eventType...
[ "function", "(", "input", ")", "{", "var", "state", "=", "this", ".", "state", ";", "var", "eventType", "=", "input", ".", "eventType", ";", "var", "isRecognized", "=", "state", "&", "(", "STATE_BEGAN", "|", "STATE_CHANGED", ")", ";", "var", "isValid", ...
Process the input and return the state for the recognizer @memberof AttrRecognizer @param {Object} input @returns {*} State
[ "Process", "the", "input", "and", "return", "the", "state", "for", "the", "recognizer" ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L1719-L1738
train
lihongxun945/jquery-weui
src/js/hammer.js
Hammer
function Hammer(element, options) { options = options || {}; options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); return new Manager(element, options); }
javascript
function Hammer(element, options) { options = options || {}; options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); return new Manager(element, options); }
[ "function", "Hammer", "(", "element", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "recognizers", "=", "ifUndefined", "(", "options", ".", "recognizers", ",", "Hammer", ".", "defaults", ".", "preset", ")", ";"...
Simple way to create a manager with a default set of recognizers. @param {HTMLElement} element @param {Object} [options] @constructor
[ "Simple", "way", "to", "create", "a", "manager", "with", "a", "default", "set", "of", "recognizers", "." ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L2139-L2143
train
lihongxun945/jquery-weui
src/js/hammer.js
function(recognizer) { if (recognizer instanceof Recognizer) { return recognizer; } var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) { if (recognizers[i].options.event == recognizer) { return recognizers[i]; ...
javascript
function(recognizer) { if (recognizer instanceof Recognizer) { return recognizer; } var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) { if (recognizers[i].options.event == recognizer) { return recognizers[i]; ...
[ "function", "(", "recognizer", ")", "{", "if", "(", "recognizer", "instanceof", "Recognizer", ")", "{", "return", "recognizer", ";", "}", "var", "recognizers", "=", "this", ".", "recognizers", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "reco...
get a recognizer by its event name. @param {Recognizer|String} recognizer @returns {Recognizer|Null}
[ "get", "a", "recognizer", "by", "its", "event", "name", "." ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L2387-L2399
train
lihongxun945/jquery-weui
src/js/hammer.js
function(recognizer) { if (invokeArrayArg(recognizer, 'add', this)) { return this; } // remove existing var existing = this.get(recognizer.options.event); if (existing) { this.remove(existing); } this.recognizers.push(recognizer); ...
javascript
function(recognizer) { if (invokeArrayArg(recognizer, 'add', this)) { return this; } // remove existing var existing = this.get(recognizer.options.event); if (existing) { this.remove(existing); } this.recognizers.push(recognizer); ...
[ "function", "(", "recognizer", ")", "{", "if", "(", "invokeArrayArg", "(", "recognizer", ",", "'add'", ",", "this", ")", ")", "{", "return", "this", ";", "}", "// remove existing", "var", "existing", "=", "this", ".", "get", "(", "recognizer", ".", "opti...
add a recognizer to the manager existing recognizers with the same event name will be removed @param {Recognizer} recognizer @returns {Recognizer|Manager}
[ "add", "a", "recognizer", "to", "the", "manager", "existing", "recognizers", "with", "the", "same", "event", "name", "will", "be", "removed" ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L2407-L2423
train
lihongxun945/jquery-weui
src/js/hammer.js
function(event, data) { // we also want to trigger dom events if (this.options.domEvents) { triggerDomEvent(event, data); } // no handlers, so skip it all var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) ...
javascript
function(event, data) { // we also want to trigger dom events if (this.options.domEvents) { triggerDomEvent(event, data); } // no handlers, so skip it all var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) ...
[ "function", "(", "event", ",", "data", ")", "{", "// we also want to trigger dom events", "if", "(", "this", ".", "options", ".", "domEvents", ")", "{", "triggerDomEvent", "(", "event", ",", "data", ")", ";", "}", "// no handlers, so skip it all", "var", "handle...
emit event to the listeners @param {String} event @param {Object} data
[ "emit", "event", "to", "the", "listeners" ]
e1efdff32318e8bf84e06778094a1705d5d99ddb
https://github.com/lihongxun945/jquery-weui/blob/e1efdff32318e8bf84e06778094a1705d5d99ddb/src/js/hammer.js#L2500-L2522
train
josdejong/mathjs
tools/entryGenerator.js
generateDependenciesFiles
function generateDependenciesFiles ({ suffix, factories, entryFolder }) { const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars // a map containing: // { // 'sqrt': true, // 'subset': true, // ... // } const exists = {} Object.keys(factories).forEach(f...
javascript
function generateDependenciesFiles ({ suffix, factories, entryFolder }) { const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars // a map containing: // { // 'sqrt': true, // 'subset': true, // ... // } const exists = {} Object.keys(factories).forEach(f...
[ "function", "generateDependenciesFiles", "(", "{", "suffix", ",", "factories", ",", "entryFolder", "}", ")", "{", "const", "braceOpen", "=", "'{'", "// a hack to be able to create a single brace open character in handlebars", "// a map containing:", "// {", "// 'sqrt': true,"...
Generate index files like dependenciesAny.generated.js dependenciesNumber.generated.js And the individual files for every dependencies collection.
[ "Generate", "index", "files", "like", "dependenciesAny", ".", "generated", ".", "js", "dependenciesNumber", ".", "generated", ".", "js", "And", "the", "individual", "files", "for", "every", "dependencies", "collection", "." ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/tools/entryGenerator.js#L186-L258
train
josdejong/mathjs
src/utils/object.js
_deepFlatten
function _deepFlatten (nestedObject, flattenedObject) { for (const prop in nestedObject) { if (nestedObject.hasOwnProperty(prop)) { const value = nestedObject[prop] if (typeof value === 'object' && value !== null) { _deepFlatten(value, flattenedObject) } else { flattenedObject[pr...
javascript
function _deepFlatten (nestedObject, flattenedObject) { for (const prop in nestedObject) { if (nestedObject.hasOwnProperty(prop)) { const value = nestedObject[prop] if (typeof value === 'object' && value !== null) { _deepFlatten(value, flattenedObject) } else { flattenedObject[pr...
[ "function", "_deepFlatten", "(", "nestedObject", ",", "flattenedObject", ")", "{", "for", "(", "const", "prop", "in", "nestedObject", ")", "{", "if", "(", "nestedObject", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "const", "value", "=", "nestedObject...
helper function used by deepFlatten
[ "helper", "function", "used", "by", "deepFlatten" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/object.js#L174-L185
train
josdejong/mathjs
src/utils/number.js
zeros
function zeros (length) { const arr = [] for (let i = 0; i < length; i++) { arr.push(0) } return arr }
javascript
function zeros (length) { const arr = [] for (let i = 0; i < length; i++) { arr.push(0) } return arr }
[ "function", "zeros", "(", "length", ")", "{", "const", "arr", "=", "[", "]", "for", "(", "let", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "arr", ".", "push", "(", "0", ")", "}", "return", "arr", "}" ]
Create an array filled with zeros. @param {number} length @return {Array}
[ "Create", "an", "array", "filled", "with", "zeros", "." ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/number.js#L521-L527
train
josdejong/mathjs
src/core/function/config.js
findIndex
function findIndex (array, item) { return array .map(function (i) { return i.toLowerCase() }) .indexOf(item.toLowerCase()) }
javascript
function findIndex (array, item) { return array .map(function (i) { return i.toLowerCase() }) .indexOf(item.toLowerCase()) }
[ "function", "findIndex", "(", "array", ",", "item", ")", "{", "return", "array", ".", "map", "(", "function", "(", "i", ")", "{", "return", "i", ".", "toLowerCase", "(", ")", "}", ")", ".", "indexOf", "(", "item", ".", "toLowerCase", "(", ")", ")",...
Find a string in an array. Case insensitive search @param {Array.<string>} array @param {string} item @return {number} Returns the index when found. Returns -1 when not found
[ "Find", "a", "string", "in", "an", "array", ".", "Case", "insensitive", "search" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/core/function/config.js#L100-L106
train
josdejong/mathjs
src/core/function/config.js
validateOption
function validateOption (options, name, values) { if (options[name] !== undefined && !contains(values, options[name])) { const index = findIndex(values, options[name]) if (index !== -1) { // right value, wrong casing // TODO: lower case values are deprecated since v3, remove this warning some day....
javascript
function validateOption (options, name, values) { if (options[name] !== undefined && !contains(values, options[name])) { const index = findIndex(values, options[name]) if (index !== -1) { // right value, wrong casing // TODO: lower case values are deprecated since v3, remove this warning some day....
[ "function", "validateOption", "(", "options", ",", "name", ",", "values", ")", "{", "if", "(", "options", "[", "name", "]", "!==", "undefined", "&&", "!", "contains", "(", "values", ",", "options", "[", "name", "]", ")", ")", "{", "const", "index", "...
Validate an option @param {Object} options Object with options @param {string} name Name of the option to validate @param {Array.<string>} values Array with valid values for this option
[ "Validate", "an", "option" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/core/function/config.js#L114-L128
train
josdejong/mathjs
src/type/unit/physicalConstants.js
unitFactory
function unitFactory (name, valueStr, unitStr) { const dependencies = ['config', 'Unit', 'BigNumber'] return factory(name, dependencies, ({ config, Unit, BigNumber }) => { // Note that we can parse into number or BigNumber. // We do not parse into Fractions as that doesn't make sense: we would lose precisi...
javascript
function unitFactory (name, valueStr, unitStr) { const dependencies = ['config', 'Unit', 'BigNumber'] return factory(name, dependencies, ({ config, Unit, BigNumber }) => { // Note that we can parse into number or BigNumber. // We do not parse into Fractions as that doesn't make sense: we would lose precisi...
[ "function", "unitFactory", "(", "name", ",", "valueStr", ",", "unitStr", ")", "{", "const", "dependencies", "=", "[", "'config'", ",", "'Unit'", ",", "'BigNumber'", "]", "return", "factory", "(", "name", ",", "dependencies", ",", "(", "{", "config", ",", ...
helper function to create a factory function which creates a physical constant, a Unit with either a number value or a BigNumber value depending on the configuration
[ "helper", "function", "to", "create", "a", "factory", "function", "which", "creates", "a", "physical", "constant", "a", "Unit", "with", "either", "a", "number", "value", "or", "a", "BigNumber", "value", "depending", "on", "the", "configuration" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/type/unit/physicalConstants.js#L74-L89
train
josdejong/mathjs
src/type/unit/physicalConstants.js
numberFactory
function numberFactory (name, value) { const dependencies = ['config', 'BigNumber'] return factory(name, dependencies, ({ config, BigNumber }) => { return config.number === 'BigNumber' ? new BigNumber(value) : value }) }
javascript
function numberFactory (name, value) { const dependencies = ['config', 'BigNumber'] return factory(name, dependencies, ({ config, BigNumber }) => { return config.number === 'BigNumber' ? new BigNumber(value) : value }) }
[ "function", "numberFactory", "(", "name", ",", "value", ")", "{", "const", "dependencies", "=", "[", "'config'", ",", "'BigNumber'", "]", "return", "factory", "(", "name", ",", "dependencies", ",", "(", "{", "config", ",", "BigNumber", "}", ")", "=>", "{...
helper function to create a factory function which creates a numeric constant, either a number or BigNumber depending on the configuration
[ "helper", "function", "to", "create", "a", "factory", "function", "which", "creates", "a", "numeric", "constant", "either", "a", "number", "or", "BigNumber", "depending", "on", "the", "configuration" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/type/unit/physicalConstants.js#L93-L101
train
josdejong/mathjs
gulpfile.js
addDeprecatedFunctions
function addDeprecatedFunctions (done) { const code = String(fs.readFileSync(COMPILED_MAIN_ANY)) const updatedCode = code + '\n\n' + 'exports[\'var\'] = exports.deprecatedVar;\n' + 'exports[\'typeof\'] = exports.deprecatedTypeof;\n' + 'exports[\'eval\'] = exports.deprecatedEval;\n' + 'exports[\'imp...
javascript
function addDeprecatedFunctions (done) { const code = String(fs.readFileSync(COMPILED_MAIN_ANY)) const updatedCode = code + '\n\n' + 'exports[\'var\'] = exports.deprecatedVar;\n' + 'exports[\'typeof\'] = exports.deprecatedTypeof;\n' + 'exports[\'eval\'] = exports.deprecatedEval;\n' + 'exports[\'imp...
[ "function", "addDeprecatedFunctions", "(", "done", ")", "{", "const", "code", "=", "String", "(", "fs", ".", "readFileSync", "(", "COMPILED_MAIN_ANY", ")", ")", "const", "updatedCode", "=", "code", "+", "'\\n\\n'", "+", "'exports[\\'var\\'] = exports.deprecatedVar;\...
Add links to deprecated functions in the node.js transpiled code mainAny.js These names are not valid in ES6 where we use them as functions instead of properties.
[ "Add", "links", "to", "deprecated", "functions", "in", "the", "node", ".", "js", "transpiled", "code", "mainAny", ".", "js", "These", "names", "are", "not", "valid", "in", "ES6", "where", "we", "use", "them", "as", "functions", "instead", "of", "properties...
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/gulpfile.js#L228-L242
train
josdejong/mathjs
src/function/matrix/forEach.js
_forEach
function _forEach (array, callback) { // figure out what number of arguments the callback function expects const args = maxArgumentCount(callback) const recurse = function (value, index) { if (Array.isArray(value)) { forEachArray(value, function (child, i) { // we create a copy of the index arr...
javascript
function _forEach (array, callback) { // figure out what number of arguments the callback function expects const args = maxArgumentCount(callback) const recurse = function (value, index) { if (Array.isArray(value)) { forEachArray(value, function (child, i) { // we create a copy of the index arr...
[ "function", "_forEach", "(", "array", ",", "callback", ")", "{", "// figure out what number of arguments the callback function expects", "const", "args", "=", "maxArgumentCount", "(", "callback", ")", "const", "recurse", "=", "function", "(", "value", ",", "index", ")...
forEach for a multi dimensional array @param {Array} array @param {Function} callback @private
[ "forEach", "for", "a", "multi", "dimensional", "array" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/function/matrix/forEach.js#L49-L71
train
josdejong/mathjs
src/utils/array.js
_validate
function _validate (array, size, dim) { let i const len = array.length if (len !== size[dim]) { throw new DimensionError(len, size[dim]) } if (dim < size.length - 1) { // recursively validate each child array const dimNext = dim + 1 for (i = 0; i < len; i++) { const child = array[i] ...
javascript
function _validate (array, size, dim) { let i const len = array.length if (len !== size[dim]) { throw new DimensionError(len, size[dim]) } if (dim < size.length - 1) { // recursively validate each child array const dimNext = dim + 1 for (i = 0; i < len; i++) { const child = array[i] ...
[ "function", "_validate", "(", "array", ",", "size", ",", "dim", ")", "{", "let", "i", "const", "len", "=", "array", ".", "length", "if", "(", "len", "!==", "size", "[", "dim", "]", ")", "{", "throw", "new", "DimensionError", "(", "len", ",", "size"...
Recursively validate whether each element in a multi dimensional array has a size corresponding to the provided size array. @param {Array} array Array to be validated @param {number[]} size Array with the size of each dimension @param {number} dim Current dimension @throws DimensionError @private
[ "Recursively", "validate", "whether", "each", "element", "in", "a", "multi", "dimensional", "array", "has", "a", "size", "corresponding", "to", "the", "provided", "size", "array", "." ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/array.js#L36-L62
train
josdejong/mathjs
src/utils/array.js
_resize
function _resize (array, size, dim, defaultValue) { let i let elem const oldLen = array.length const newLen = size[dim] const minLen = Math.min(oldLen, newLen) // apply new length array.length = newLen if (dim < size.length - 1) { // non-last dimension const dimNext = dim + 1 // resize ex...
javascript
function _resize (array, size, dim, defaultValue) { let i let elem const oldLen = array.length const newLen = size[dim] const minLen = Math.min(oldLen, newLen) // apply new length array.length = newLen if (dim < size.length - 1) { // non-last dimension const dimNext = dim + 1 // resize ex...
[ "function", "_resize", "(", "array", ",", "size", ",", "dim", ",", "defaultValue", ")", "{", "let", "i", "let", "elem", "const", "oldLen", "=", "array", ".", "length", "const", "newLen", "=", "size", "[", "dim", "]", "const", "minLen", "=", "Math", "...
Recursively resize a multi dimensional array @param {Array} array Array to be resized @param {number[]} size Array with the size of each dimension @param {number} dim Current dimension @param {*} [defaultValue] Value to be filled in in new entries, undefined by default. @private
[ "Recursively", "resize", "a", "multi", "dimensional", "array" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/array.js#L144-L193
train
josdejong/mathjs
src/utils/array.js
_reshape
function _reshape (array, sizes) { // testing if there are enough elements for the requested shape let tmpArray = array let tmpArray2 // for each dimensions starting by the last one and ignoring the first one for (let sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) { const size = sizes[sizeIndex...
javascript
function _reshape (array, sizes) { // testing if there are enough elements for the requested shape let tmpArray = array let tmpArray2 // for each dimensions starting by the last one and ignoring the first one for (let sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) { const size = sizes[sizeIndex...
[ "function", "_reshape", "(", "array", ",", "sizes", ")", "{", "// testing if there are enough elements for the requested shape", "let", "tmpArray", "=", "array", "let", "tmpArray2", "// for each dimensions starting by the last one and ignoring the first one", "for", "(", "let", ...
Iteratively re-shape a multi dimensional array to fit the specified dimensions @param {Array} array Array to be reshaped @param {Array.<number>} sizes List of sizes for each dimension @returns {Array} Array whose data has been formatted to fit the specified dimensions
[ "Iteratively", "re", "-", "shape", "a", "multi", "dimensional", "array", "to", "fit", "the", "specified", "dimensions" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/array.js#L258-L277
train
josdejong/mathjs
src/utils/array.js
_squeeze
function _squeeze (array, dims, dim) { let i, ii if (dim < dims) { const next = dim + 1 for (i = 0, ii = array.length; i < ii; i++) { array[i] = _squeeze(array[i], dims, next) } } else { while (Array.isArray(array)) { array = array[0] } } return array }
javascript
function _squeeze (array, dims, dim) { let i, ii if (dim < dims) { const next = dim + 1 for (i = 0, ii = array.length; i < ii; i++) { array[i] = _squeeze(array[i], dims, next) } } else { while (Array.isArray(array)) { array = array[0] } } return array }
[ "function", "_squeeze", "(", "array", ",", "dims", ",", "dim", ")", "{", "let", "i", ",", "ii", "if", "(", "dim", "<", "dims", ")", "{", "const", "next", "=", "dim", "+", "1", "for", "(", "i", "=", "0", ",", "ii", "=", "array", ".", "length",...
Recursively squeeze a multi dimensional array @param {Array} array @param {number} dims Required number of dimensions @param {number} dim Current dimension @returns {Array | *} Returns the squeezed array @private
[ "Recursively", "squeeze", "a", "multi", "dimensional", "array" ]
dd830a8892a5c78907a0f2a616df46c90ddd693e
https://github.com/josdejong/mathjs/blob/dd830a8892a5c78907a0f2a616df46c90ddd693e/src/utils/array.js#L317-L332
train