id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
7,900
firebase/angularfire
src/database/FirebaseArray.js
function(indexOrItem) { this._assertNotDestroyed('$save'); var self = this; var item = self._resolveItem(indexOrItem); var key = self.$keyAt(item); var def = $q.defer(); if( key !== null ) { var ref = self.$ref().ref.child(key); var da...
javascript
function(indexOrItem) { this._assertNotDestroyed('$save'); var self = this; var item = self._resolveItem(indexOrItem); var key = self.$keyAt(item); var def = $q.defer(); if( key !== null ) { var ref = self.$ref().ref.child(key); var da...
[ "function", "(", "indexOrItem", ")", "{", "this", ".", "_assertNotDestroyed", "(", "'$save'", ")", ";", "var", "self", "=", "this", ";", "var", "item", "=", "self", ".", "_resolveItem", "(", "indexOrItem", ")", ";", "var", "key", "=", "self", ".", "$ke...
Pass either an item in the array or the index of an item and it will be saved back to Firebase. While the array is read-only and its structure should not be changed, it is okay to modify properties on the objects it contains and then save those back individually. Returns a future which is resolved when the data has su...
[ "Pass", "either", "an", "item", "in", "the", "array", "or", "the", "index", "of", "an", "item", "and", "it", "will", "be", "saved", "back", "to", "Firebase", ".", "While", "the", "array", "is", "read", "-", "only", "and", "its", "structure", "should", ...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L155-L184
7,901
firebase/angularfire
src/database/FirebaseArray.js
function(rec, prevChild) { var i; if( prevChild === null ) { i = 0; } else { i = this.$indexFor(prevChild)+1; if( i === 0 ) { i = this.$list.length; } } this.$list.splice(i, 0, rec); this._indexCache[this.$$getKey(...
javascript
function(rec, prevChild) { var i; if( prevChild === null ) { i = 0; } else { i = this.$indexFor(prevChild)+1; if( i === 0 ) { i = this.$list.length; } } this.$list.splice(i, 0, rec); this._indexCache[this.$$getKey(...
[ "function", "(", "rec", ",", "prevChild", ")", "{", "var", "i", ";", "if", "(", "prevChild", "===", "null", ")", "{", "i", "=", "0", ";", "}", "else", "{", "i", "=", "this", ".", "$indexFor", "(", "prevChild", ")", "+", "1", ";", "if", "(", "...
Used to insert a new record into the array at a specific position. If prevChild is null, is inserted first, if prevChild is not found, it is inserted last, otherwise, it goes immediately after prevChild. @param {object} rec @param {string|null} prevChild @private
[ "Used", "to", "insert", "a", "new", "record", "into", "the", "array", "at", "a", "specific", "position", ".", "If", "prevChild", "is", "null", "is", "inserted", "first", "if", "prevChild", "is", "not", "found", "it", "is", "inserted", "last", "otherwise", ...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L512-L524
7,902
firebase/angularfire
src/database/FirebaseArray.js
function(indexOrItem) { var list = this.$list; if( angular.isNumber(indexOrItem) && indexOrItem >= 0 && list.length >= indexOrItem ) { return list[indexOrItem]; } else if( angular.isObject(indexOrItem) ) { // it must be an item in this array; it's not suff...
javascript
function(indexOrItem) { var list = this.$list; if( angular.isNumber(indexOrItem) && indexOrItem >= 0 && list.length >= indexOrItem ) { return list[indexOrItem]; } else if( angular.isObject(indexOrItem) ) { // it must be an item in this array; it's not suff...
[ "function", "(", "indexOrItem", ")", "{", "var", "list", "=", "this", ".", "$list", ";", "if", "(", "angular", ".", "isNumber", "(", "indexOrItem", ")", "&&", "indexOrItem", ">=", "0", "&&", "list", ".", "length", ">=", "indexOrItem", ")", "{", "return...
Resolves a variable which may contain an integer or an item that exists in this array. Returns the item or null if it does not exist. @param indexOrItem @returns {*} @private
[ "Resolves", "a", "variable", "which", "may", "contain", "an", "integer", "or", "an", "item", "that", "exists", "in", "this", "array", ".", "Returns", "the", "item", "or", "null", "if", "it", "does", "not", "exist", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L551-L566
7,903
lance-gg/lance
src/physics/SimplePhysics/BruteForceCollisionDetection.js
getBox
function getBox(o) { return { xMin: o.position.x, xMax: o.position.x + o.width, yMin: o.position.y, yMax: o.position.y + o.height }; }
javascript
function getBox(o) { return { xMin: o.position.x, xMax: o.position.x + o.width, yMin: o.position.y, yMax: o.position.y + o.height }; }
[ "function", "getBox", "(", "o", ")", "{", "return", "{", "xMin", ":", "o", ".", "position", ".", "x", ",", "xMax", ":", "o", ".", "position", ".", "x", "+", "o", ".", "width", ",", "yMin", ":", "o", ".", "position", ".", "y", ",", "yMax", ":"...
get bounding box of object o
[ "get", "bounding", "box", "of", "object", "o" ]
af5dcaec10c9a2e3e373bf53528d4a1d0f57e3b6
https://github.com/lance-gg/lance/blob/af5dcaec10c9a2e3e373bf53528d4a1d0f57e3b6/src/physics/SimplePhysics/BruteForceCollisionDetection.js#L138-L145
7,904
expressjs/morgan
index.js
clfdate
function clfdate (dateTime) { var date = dateTime.getUTCDate() var hour = dateTime.getUTCHours() var mins = dateTime.getUTCMinutes() var secs = dateTime.getUTCSeconds() var year = dateTime.getUTCFullYear() var month = CLF_MONTH[dateTime.getUTCMonth()] return pad2(date) + '/' + month + '/' + year + '...
javascript
function clfdate (dateTime) { var date = dateTime.getUTCDate() var hour = dateTime.getUTCHours() var mins = dateTime.getUTCMinutes() var secs = dateTime.getUTCSeconds() var year = dateTime.getUTCFullYear() var month = CLF_MONTH[dateTime.getUTCMonth()] return pad2(date) + '/' + month + '/' + year + '...
[ "function", "clfdate", "(", "dateTime", ")", "{", "var", "date", "=", "dateTime", ".", "getUTCDate", "(", ")", "var", "hour", "=", "dateTime", ".", "getUTCHours", "(", ")", "var", "mins", "=", "dateTime", ".", "getUTCMinutes", "(", ")", "var", "secs", ...
Format a Date in the common log format. @private @param {Date} dateTime @return {string}
[ "Format", "a", "Date", "in", "the", "common", "log", "format", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L351-L363
7,905
expressjs/morgan
index.js
createBufferStream
function createBufferStream (stream, interval) { var buf = [] var timer = null // flush function function flush () { timer = null stream.write(buf.join('')) buf.length = 0 } // write function function write (str) { if (timer === null) { timer = setTimeout(flush, interval) } ...
javascript
function createBufferStream (stream, interval) { var buf = [] var timer = null // flush function function flush () { timer = null stream.write(buf.join('')) buf.length = 0 } // write function function write (str) { if (timer === null) { timer = setTimeout(flush, interval) } ...
[ "function", "createBufferStream", "(", "stream", ",", "interval", ")", "{", "var", "buf", "=", "[", "]", "var", "timer", "=", "null", "// flush function", "function", "flush", "(", ")", "{", "timer", "=", "null", "stream", ".", "write", "(", "buf", ".", ...
Create a basic buffering stream. @param {object} stream @param {number} interval @public
[ "Create", "a", "basic", "buffering", "stream", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L402-L424
7,906
expressjs/morgan
index.js
getFormatFunction
function getFormatFunction (name) { // lookup format var fmt = morgan[name] || name || morgan.default // return compiled format return typeof fmt !== 'function' ? compile(fmt) : fmt }
javascript
function getFormatFunction (name) { // lookup format var fmt = morgan[name] || name || morgan.default // return compiled format return typeof fmt !== 'function' ? compile(fmt) : fmt }
[ "function", "getFormatFunction", "(", "name", ")", "{", "// lookup format", "var", "fmt", "=", "morgan", "[", "name", "]", "||", "name", "||", "morgan", ".", "default", "// return compiled format", "return", "typeof", "fmt", "!==", "'function'", "?", "compile", ...
Lookup and compile a named format function. @param {string} name @return {function} @public
[ "Lookup", "and", "compile", "a", "named", "format", "function", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L447-L455
7,907
vuejs/vue-hot-reload-api
src/index.js
injectHook
function injectHook(options, name, hook) { const existing = options[name] options[name] = existing ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook] : [hook] }
javascript
function injectHook(options, name, hook) { const existing = options[name] options[name] = existing ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook] : [hook] }
[ "function", "injectHook", "(", "options", ",", "name", ",", "hook", ")", "{", "const", "existing", "=", "options", "[", "name", "]", "options", "[", "name", "]", "=", "existing", "?", "Array", ".", "isArray", "(", "existing", ")", "?", "existing", ".",...
Inject a hook to a hot reloadable component so that we can keep track of it. @param {Object} options @param {String} name @param {Function} hook
[ "Inject", "a", "hook", "to", "a", "hot", "reloadable", "component", "so", "that", "we", "can", "keep", "track", "of", "it", "." ]
5dc0e49332802fa0154de3fed7dde31437309698
https://github.com/vuejs/vue-hot-reload-api/blob/5dc0e49332802fa0154de3fed7dde31437309698/src/index.js#L109-L114
7,908
vuejs/vue-hot-reload-api
src/index.js
patchScopedSlots
function patchScopedSlots (instance) { if (!instance._u) return // https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js const original = instance._u instance._u = slots => { try { // 2.6.4 ~ 2.6.6 return original(slots, true) } catch (e) { // 2...
javascript
function patchScopedSlots (instance) { if (!instance._u) return // https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js const original = instance._u instance._u = slots => { try { // 2.6.4 ~ 2.6.6 return original(slots, true) } catch (e) { // 2...
[ "function", "patchScopedSlots", "(", "instance", ")", "{", "if", "(", "!", "instance", ".", "_u", ")", "return", "// https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js", "const", "original", "=", "instance", ".", "_u", "instance",...
2.6 optimizes template-compiled scoped slots and skips updates if child only uses scoped slots. We need to patch the scoped slots resolving helper to temporarily mark all scoped slots as unstable in order to force child updates.
[ "2", ".", "6", "optimizes", "template", "-", "compiled", "scoped", "slots", "and", "skips", "updates", "if", "child", "only", "uses", "scoped", "slots", ".", "We", "need", "to", "patch", "the", "scoped", "slots", "resolving", "helper", "to", "temporarily", ...
5dc0e49332802fa0154de3fed7dde31437309698
https://github.com/vuejs/vue-hot-reload-api/blob/5dc0e49332802fa0154de3fed7dde31437309698/src/index.js#L255-L271
7,909
alibaba/uirecorder
chrome-extension/js/mobile.js
getNodeInfo
function getNodeInfo(x, y){ var nodeInfo = {}; var bestNodeInfo = { node: null, boundSize: 0 }; getBestNode(appTree, x, y, bestNodeInfo); var bestNode = bestNodeInfo.node; if(bestNode){ var text = bestNode.text || bestNode.label; ...
javascript
function getNodeInfo(x, y){ var nodeInfo = {}; var bestNodeInfo = { node: null, boundSize: 0 }; getBestNode(appTree, x, y, bestNodeInfo); var bestNode = bestNodeInfo.node; if(bestNode){ var text = bestNode.text || bestNode.label; ...
[ "function", "getNodeInfo", "(", "x", ",", "y", ")", "{", "var", "nodeInfo", "=", "{", "}", ";", "var", "bestNodeInfo", "=", "{", "node", ":", "null", ",", "boundSize", ":", "0", "}", ";", "getBestNode", "(", "appTree", ",", "x", ",", "y", ",", "b...
get node info by x,y
[ "get", "node", "info", "by", "x", "y" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/mobile.js#L445-L469
7,910
alibaba/uirecorder
lib/start.js
getRootPath
function getRootPath(){ var rootPath = path.resolve('.'); while(rootPath){ if(fs.existsSync(rootPath + '/config.json')){ break; } rootPath = rootPath.substring(0, rootPath.lastIndexOf(path.sep)); } return rootPath; }
javascript
function getRootPath(){ var rootPath = path.resolve('.'); while(rootPath){ if(fs.existsSync(rootPath + '/config.json')){ break; } rootPath = rootPath.substring(0, rootPath.lastIndexOf(path.sep)); } return rootPath; }
[ "function", "getRootPath", "(", ")", "{", "var", "rootPath", "=", "path", ".", "resolve", "(", "'.'", ")", ";", "while", "(", "rootPath", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "rootPath", "+", "'/config.json'", ")", ")", "{", "break", ";...
get test root
[ "get", "test", "root" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/lib/start.js#L1618-L1627
7,911
alibaba/uirecorder
lib/start.js
startRecorderServer
function startRecorderServer(config, onReady, onCommand, onEnd){ var server = http.createServer(function(req, res){ if(req.url === '/proxy.pac'){ var wdproxy = config.wdproxy; if(wdproxy){ res.writeHead(200, { 'Content-Type': 'text/plain' }); var pacCo...
javascript
function startRecorderServer(config, onReady, onCommand, onEnd){ var server = http.createServer(function(req, res){ if(req.url === '/proxy.pac'){ var wdproxy = config.wdproxy; if(wdproxy){ res.writeHead(200, { 'Content-Type': 'text/plain' }); var pacCo...
[ "function", "startRecorderServer", "(", "config", ",", "onReady", ",", "onCommand", ",", "onEnd", ")", "{", "var", "server", "=", "http", ".", "createServer", "(", "function", "(", "req", ",", "res", ")", "{", "if", "(", "req", ".", "url", "===", "'/pr...
start recorder server
[ "start", "recorder", "server" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/lib/start.js#L1635-L1701
7,912
alibaba/uirecorder
chrome-extension/js/foreground.js
getDomPath
function getDomPath(target, isAllDom){ var arrAllPaths = []; var node = target, path; while(node){ var nodeName = node.nodeName.toLowerCase(); if(/^#document/.test(nodeName)){ path = getRelativeDomPath(node, target, isAllDom); if(path){ ...
javascript
function getDomPath(target, isAllDom){ var arrAllPaths = []; var node = target, path; while(node){ var nodeName = node.nodeName.toLowerCase(); if(/^#document/.test(nodeName)){ path = getRelativeDomPath(node, target, isAllDom); if(path){ ...
[ "function", "getDomPath", "(", "target", ",", "isAllDom", ")", "{", "var", "arrAllPaths", "=", "[", "]", ";", "var", "node", "=", "target", ",", "path", ";", "while", "(", "node", ")", "{", "var", "nodeName", "=", "node", ".", "nodeName", ".", "toLow...
get selector path
[ "get", "selector", "path" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L166-L184
7,913
alibaba/uirecorder
chrome-extension/js/foreground.js
getFrameId
function getFrameId(){ var frame = -1; if(isIframe){ try{ var frameElement = window.frameElement; if(frameElement !== null){ frame = getDomPath(frameElement) || -1; } else{ frame = '!'+loc...
javascript
function getFrameId(){ var frame = -1; if(isIframe){ try{ var frameElement = window.frameElement; if(frameElement !== null){ frame = getDomPath(frameElement) || -1; } else{ frame = '!'+loc...
[ "function", "getFrameId", "(", ")", "{", "var", "frame", "=", "-", "1", ";", "if", "(", "isIframe", ")", "{", "try", "{", "var", "frameElement", "=", "window", ".", "frameElement", ";", "if", "(", "frameElement", "!==", "null", ")", "{", "frame", "="...
get frame id
[ "get", "frame", "id" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L436-L461
7,914
alibaba/uirecorder
chrome-extension/js/foreground.js
unsafeEval
function unsafeEval(str){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.innerHTML = '('+str+')();'; head.appendChild(script); head.removeChild(script); }
javascript
function unsafeEval(str){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.innerHTML = '('+str+')();'; head.appendChild(script); head.removeChild(script); }
[ "function", "unsafeEval", "(", "str", ")", "{", "var", "head", "=", "document", ".", "getElementsByTagName", "(", "\"head\"", ")", "[", "0", "]", ";", "var", "script", "=", "document", ".", "createElement", "(", "\"script\"", ")", ";", "script", ".", "in...
eval with unsafe window
[ "eval", "with", "unsafe", "window" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L985-L991
7,915
alibaba/uirecorder
chrome-extension/js/foreground.js
hookAlertFunction
function hookAlertFunction(){ var rawAlert = window.alert; function sendAlertCmd(cmd, data){ var cmdInfo = { cmd: cmd, data: data || {} }; window.postMessage({ 'type': 'uiRecorderAlertComm...
javascript
function hookAlertFunction(){ var rawAlert = window.alert; function sendAlertCmd(cmd, data){ var cmdInfo = { cmd: cmd, data: data || {} }; window.postMessage({ 'type': 'uiRecorderAlertComm...
[ "function", "hookAlertFunction", "(", ")", "{", "var", "rawAlert", "=", "window", ".", "alert", ";", "function", "sendAlertCmd", "(", "cmd", ",", "data", ")", "{", "var", "cmdInfo", "=", "{", "cmd", ":", "cmd", ",", "data", ":", "data", "||", "{", "}...
hook alert, confirm, prompt
[ "hook", "alert", "confirm", "prompt" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L994-L1054
7,916
alibaba/uirecorder
chrome-extension/js/foreground.js
getFixedParent
function getFixedParent(target){ var documentElement = document.documentElement; var node = target; var nodeName, path, offset, left, top, savedParent; var notFirstNode = false; // 当前点击控件以可见范围内进行定位,其它以全局定位(很多局部控件是不可见的) while(node !== null){ nod...
javascript
function getFixedParent(target){ var documentElement = document.documentElement; var node = target; var nodeName, path, offset, left, top, savedParent; var notFirstNode = false; // 当前点击控件以可见范围内进行定位,其它以全局定位(很多局部控件是不可见的) while(node !== null){ nod...
[ "function", "getFixedParent", "(", "target", ")", "{", "var", "documentElement", "=", "document", ".", "documentElement", ";", "var", "node", "=", "target", ";", "var", "nodeName", ",", "path", ",", "offset", ",", "left", ",", "top", ",", "savedParent", ";...
get the fixed offset parent
[ "get", "the", "fixed", "offset", "parent" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L1352-L1396
7,917
alibaba/uirecorder
chrome-extension/js/background.js
setRecorderWork
function setRecorderWork(enable){ isWorking = enable; if(isWorking){ chrome.browserAction.setTitle({title: __('icon_record_tip')}); chrome.browserAction.setIcon({path: workIcon===1?ENABLE_ICON1:ENABLE_ICON2}); workIcon *= -1; workIconTimer = setTimeout(function(){ set...
javascript
function setRecorderWork(enable){ isWorking = enable; if(isWorking){ chrome.browserAction.setTitle({title: __('icon_record_tip')}); chrome.browserAction.setIcon({path: workIcon===1?ENABLE_ICON1:ENABLE_ICON2}); workIcon *= -1; workIconTimer = setTimeout(function(){ set...
[ "function", "setRecorderWork", "(", "enable", ")", "{", "isWorking", "=", "enable", ";", "if", "(", "isWorking", ")", "{", "chrome", ".", "browserAction", ".", "setTitle", "(", "{", "title", ":", "__", "(", "'icon_record_tip'", ")", "}", ")", ";", "chrom...
set recorder work status
[ "set", "recorder", "work", "status" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/background.js#L157-L172
7,918
alibaba/uirecorder
chrome-extension/js/background.js
saveCommand
function saveCommand(windowId, frame, cmd, data){ if(isModuleLoading){ return; } var cmdInfo = { window: windowId, frame: frame, cmd: cmd, data: data, fix: false }; checkLostKey(windowId); switch(cmd){ case 'keyDown': allKeyMa...
javascript
function saveCommand(windowId, frame, cmd, data){ if(isModuleLoading){ return; } var cmdInfo = { window: windowId, frame: frame, cmd: cmd, data: data, fix: false }; checkLostKey(windowId); switch(cmd){ case 'keyDown': allKeyMa...
[ "function", "saveCommand", "(", "windowId", ",", "frame", ",", "cmd", ",", "data", ")", "{", "if", "(", "isModuleLoading", ")", "{", "return", ";", "}", "var", "cmdInfo", "=", "{", "window", ":", "windowId", ",", "frame", ":", "frame", ",", "cmd", ":...
save recoreded command
[ "save", "recoreded", "command" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/background.js#L180-L210
7,919
techfort/LokiJS
benchmark/benchmark_web.js
runStep
function runStep(step) { switch (step) { case 1 : trace("-- Beginning benchmark --"); initializeDB(); initializeUnique(); setTimeout(function() { runStep(2); }, 100); break; case 2 : benchGet(); setTimeout(function() { runStep(3); }, 100); break; case 3 :...
javascript
function runStep(step) { switch (step) { case 1 : trace("-- Beginning benchmark --"); initializeDB(); initializeUnique(); setTimeout(function() { runStep(2); }, 100); break; case 2 : benchGet(); setTimeout(function() { runStep(3); }, 100); break; case 3 :...
[ "function", "runStep", "(", "step", ")", "{", "switch", "(", "step", ")", "{", "case", "1", ":", "trace", "(", "\"-- Beginning benchmark --\"", ")", ";", "initializeDB", "(", ")", ";", "initializeUnique", "(", ")", ";", "setTimeout", "(", "function", "(", ...
async yielding after each step to avoid browser warnings of long running scripts
[ "async", "yielding", "after", "each", "step", "to", "avoid", "browser", "warnings", "of", "long", "running", "scripts" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/benchmark/benchmark_web.js#L294-L345
7,920
techfort/LokiJS
examples/quickstart2.js
databaseInitialize
function databaseInitialize() { // on the first load of (non-existent database), we will have no collections so we can // detect the absence of our collections and add (and configure) them now. var entries = db.getCollection("entries"); if (entries === null) { entries = db.addCollection("entries"); } ...
javascript
function databaseInitialize() { // on the first load of (non-existent database), we will have no collections so we can // detect the absence of our collections and add (and configure) them now. var entries = db.getCollection("entries"); if (entries === null) { entries = db.addCollection("entries"); } ...
[ "function", "databaseInitialize", "(", ")", "{", "// on the first load of (non-existent database), we will have no collections so we can ", "// detect the absence of our collections and add (and configure) them now.", "var", "entries", "=", "db", ".", "getCollection", "(", "\"entries\"...
implement the autoloadback referenced in loki constructor
[ "implement", "the", "autoloadback", "referenced", "in", "loki", "constructor" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/examples/quickstart2.js#L17-L27
7,921
techfort/LokiJS
examples/quickstart4.js
runProgramLogic
function runProgramLogic() { var entries = db.getCollection("entries"); var entryCount = entries.count(); var now = new Date(); console.log("old number of entries in database : " + entryCount); entries.insert({ x: now.getTime(), y: 100 - entryCount }); entryCount = entries.count(); console.log("new num...
javascript
function runProgramLogic() { var entries = db.getCollection("entries"); var entryCount = entries.count(); var now = new Date(); console.log("old number of entries in database : " + entryCount); entries.insert({ x: now.getTime(), y: 100 - entryCount }); entryCount = entries.count(); console.log("new num...
[ "function", "runProgramLogic", "(", ")", "{", "var", "entries", "=", "db", ".", "getCollection", "(", "\"entries\"", ")", ";", "var", "entryCount", "=", "entries", ".", "count", "(", ")", ";", "var", "now", "=", "new", "Date", "(", ")", ";", "console",...
place any bootstrap logic which needs to be run after loadDatabase has completed
[ "place", "any", "bootstrap", "logic", "which", "needs", "to", "be", "run", "after", "loadDatabase", "has", "completed" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/examples/quickstart4.js#L35-L57
7,922
techfort/LokiJS
examples/quickstart3.js
databaseInitialize
function databaseInitialize() { var entries = db.getCollection("entries"); var messages = db.getCollection("messages"); // Since our LokiFsStructuredAdapter is partitioned, the default 'quickstart3.db' // file will actually contain only the loki database shell and each of the collections // will be saved int...
javascript
function databaseInitialize() { var entries = db.getCollection("entries"); var messages = db.getCollection("messages"); // Since our LokiFsStructuredAdapter is partitioned, the default 'quickstart3.db' // file will actually contain only the loki database shell and each of the collections // will be saved int...
[ "function", "databaseInitialize", "(", ")", "{", "var", "entries", "=", "db", ".", "getCollection", "(", "\"entries\"", ")", ";", "var", "messages", "=", "db", ".", "getCollection", "(", "\"messages\"", ")", ";", "// Since our LokiFsStructuredAdapter is partitioned,...
Now let's implement the autoload callback referenced in loki constructor
[ "Now", "let", "s", "implement", "the", "autoload", "callback", "referenced", "in", "loki", "constructor" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/examples/quickstart3.js#L29-L54
7,923
techfort/LokiJS
examples/loki-continuum.js
Balance
function Balance(amount, balanceDate, description, affectingActor) { this.amount = amount; this.balanceDate = balanceDate; this.description = description; this.affectingActor = affectingActor; }
javascript
function Balance(amount, balanceDate, description, affectingActor) { this.amount = amount; this.balanceDate = balanceDate; this.description = description; this.affectingActor = affectingActor; }
[ "function", "Balance", "(", "amount", ",", "balanceDate", ",", "description", ",", "affectingActor", ")", "{", "this", ".", "amount", "=", "amount", ";", "this", ".", "balanceDate", "=", "balanceDate", ";", "this", ".", "description", "=", "description", ";"...
consolidating Balance and Tranction classes transactions inherited balance and added 'affectingActor' reference
[ "consolidating", "Balance", "and", "Tranction", "classes", "transactions", "inherited", "balance", "and", "added", "affectingActor", "reference" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/examples/loki-continuum.js#L221-L226
7,924
techfort/LokiJS
spec/generic/transforms.spec.js
fdmap
function fdmap(left, right) { // PhantomJS does not support es6 Object.assign //left = Object.assign(left, right); Object.keys(right).forEach(function(key) { left[key] = right[key]; }); return left; }
javascript
function fdmap(left, right) { // PhantomJS does not support es6 Object.assign //left = Object.assign(left, right); Object.keys(right).forEach(function(key) { left[key] = right[key]; }); return left; }
[ "function", "fdmap", "(", "left", ",", "right", ")", "{", "// PhantomJS does not support es6 Object.assign", "//left = Object.assign(left, right);", "Object", ".", "keys", "(", "right", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "left", "[", "key"...
Since our collection options do not specify cloning, this is only safe because we have cloned internal objects with dataOptions before modifying them.
[ "Since", "our", "collection", "options", "do", "not", "specify", "cloning", "this", "is", "only", "safe", "because", "we", "have", "cloned", "internal", "objects", "with", "dataOptions", "before", "modifying", "them", "." ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/spec/generic/transforms.spec.js#L358-L365
7,925
techfort/LokiJS
benchmark/bindex-stress.js
createDatabase
function createDatabase() { var idx, a, b; db = new loki('sorting-bench.db'); coll = db.addCollection('profile', { indices: ['a', 'b', 'c'] }); for(idx=0;idx<INITIAL_DOCUMENT_COUNT;idx++) { coll.insert(genRandomObject()); } }
javascript
function createDatabase() { var idx, a, b; db = new loki('sorting-bench.db'); coll = db.addCollection('profile', { indices: ['a', 'b', 'c'] }); for(idx=0;idx<INITIAL_DOCUMENT_COUNT;idx++) { coll.insert(genRandomObject()); } }
[ "function", "createDatabase", "(", ")", "{", "var", "idx", ",", "a", ",", "b", ";", "db", "=", "new", "loki", "(", "'sorting-bench.db'", ")", ";", "coll", "=", "db", ".", "addCollection", "(", "'profile'", ",", "{", "indices", ":", "[", "'a'", ",", ...
create database, collection, and seed initial documents
[ "create", "database", "collection", "and", "seed", "initial", "documents" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/benchmark/bindex-stress.js#L29-L39
7,926
techfort/LokiJS
benchmark/benchmark_binary.js
initializeDatabase
function initializeDatabase(silent, docCount) { var start, end, totalTime; var totalTimes = []; var totalMS = 0.0; if (typeof docCount === "undefined") { docCount = 5000; } arraySize = docCount; for (var idx = 0; idx < arraySize; idx++) { var v1 = genRandomVal(); var v2 = genRandomVal(); ...
javascript
function initializeDatabase(silent, docCount) { var start, end, totalTime; var totalTimes = []; var totalMS = 0.0; if (typeof docCount === "undefined") { docCount = 5000; } arraySize = docCount; for (var idx = 0; idx < arraySize; idx++) { var v1 = genRandomVal(); var v2 = genRandomVal(); ...
[ "function", "initializeDatabase", "(", "silent", ",", "docCount", ")", "{", "var", "start", ",", "end", ",", "totalTime", ";", "var", "totalTimes", "=", "[", "]", ";", "var", "totalMS", "=", "0.0", ";", "if", "(", "typeof", "docCount", "===", "\"undefine...
scenario for many individual, consecutive inserts
[ "scenario", "for", "many", "individual", "consecutive", "inserts" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/benchmark/benchmark_binary.js#L61-L106
7,927
techfort/LokiJS
benchmark/benchmark_binary.js
perfFindInterlacedInserts
function perfFindInterlacedInserts(multiplier) { var start, end; var totalTimes = []; var totalMS = 0; var loopIterations = arraySize; if (typeof (multiplier) != "undefined") { loopIterations = loopIterations * multiplier; } for (var idx = 0; idx < loopIterations; idx++) { var customidx = Math.f...
javascript
function perfFindInterlacedInserts(multiplier) { var start, end; var totalTimes = []; var totalMS = 0; var loopIterations = arraySize; if (typeof (multiplier) != "undefined") { loopIterations = loopIterations * multiplier; } for (var idx = 0; idx < loopIterations; idx++) { var customidx = Math.f...
[ "function", "perfFindInterlacedInserts", "(", "multiplier", ")", "{", "var", "start", ",", "end", ";", "var", "totalTimes", "=", "[", "]", ";", "var", "totalMS", "=", "0", ";", "var", "loopIterations", "=", "arraySize", ";", "if", "(", "typeof", "(", "mu...
Find Interlaced Inserts -> insert 5000, for 5000 more iterations insert same test obj after
[ "Find", "Interlaced", "Inserts", "-", ">", "insert", "5000", "for", "5000", "more", "iterations", "insert", "same", "test", "obj", "after" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/benchmark/benchmark_binary.js#L186-L225
7,928
techfort/LokiJS
examples/quickstart-transforms.js
seedData
function seedData() { var users = db.getCollection("users"); users.insert({ name: "odin", gender: "m", age: 1000, tags : ["woden", "knowlege", "sorcery", "frenzy", "runes"], items: ["gungnir"], attributes: { eyes: 1} }); users.insert({ name: "frigg", gender: "f", age: 800, tags: ["foreknowlege"], items: ["eski"]...
javascript
function seedData() { var users = db.getCollection("users"); users.insert({ name: "odin", gender: "m", age: 1000, tags : ["woden", "knowlege", "sorcery", "frenzy", "runes"], items: ["gungnir"], attributes: { eyes: 1} }); users.insert({ name: "frigg", gender: "f", age: 800, tags: ["foreknowlege"], items: ["eski"]...
[ "function", "seedData", "(", ")", "{", "var", "users", "=", "db", ".", "getCollection", "(", "\"users\"", ")", ";", "users", ".", "insert", "(", "{", "name", ":", "\"odin\"", ",", "gender", ":", "\"m\"", ",", "age", ":", "1000", ",", "tags", ":", "...
example-specific seeding of user data
[ "example", "-", "specific", "seeding", "of", "user", "data" ]
dda4764ee43b644c29779ab533ba0dc327838ff4
https://github.com/techfort/LokiJS/blob/dda4764ee43b644c29779ab533ba0dc327838ff4/examples/quickstart-transforms.js#L77-L89
7,929
JasonEtco/actions-toolkit
bin/create-action.js
readTemplate
async function readTemplate (filename) { const templateDir = path.join(__dirname, 'template') return readFile(path.join(templateDir, filename), 'utf8') }
javascript
async function readTemplate (filename) { const templateDir = path.join(__dirname, 'template') return readFile(path.join(templateDir, filename), 'utf8') }
[ "async", "function", "readTemplate", "(", "filename", ")", "{", "const", "templateDir", "=", "path", ".", "join", "(", "__dirname", ",", "'template'", ")", "return", "readFile", "(", "path", ".", "join", "(", "templateDir", ",", "filename", ")", ",", "'utf...
Reads a template file from disk. @param {string} filename The template filename to read. @returns {Promise<string>} The template file string contents.
[ "Reads", "a", "template", "file", "from", "disk", "." ]
294ac11efd551cc382f3fed79c190e536069d6ce
https://github.com/JasonEtco/actions-toolkit/blob/294ac11efd551cc382f3fed79c190e536069d6ce/bin/create-action.js#L20-L23
7,930
JasonEtco/actions-toolkit
bin/create-action.js
createDockerfile
async function createDockerfile (answers) { const dockerfileTemplate = await readTemplate('Dockerfile') return dockerfileTemplate .replace(':NAME', answers.name) .replace(':DESCRIPTION', answers.description) .replace(':ICON', answers.icon) .replace(':COLOR', answers.color) }
javascript
async function createDockerfile (answers) { const dockerfileTemplate = await readTemplate('Dockerfile') return dockerfileTemplate .replace(':NAME', answers.name) .replace(':DESCRIPTION', answers.description) .replace(':ICON', answers.icon) .replace(':COLOR', answers.color) }
[ "async", "function", "createDockerfile", "(", "answers", ")", "{", "const", "dockerfileTemplate", "=", "await", "readTemplate", "(", "'Dockerfile'", ")", "return", "dockerfileTemplate", ".", "replace", "(", "':NAME'", ",", "answers", ".", "name", ")", ".", "repl...
Creates a Dockerfile contents string, replacing variables in the Dockerfile template with values passed in by the user from the CLI prompt. @param {PromptAnswers} answers The CLI prompt answers. @returns {Promise<string>} The Dockerfile contents.
[ "Creates", "a", "Dockerfile", "contents", "string", "replacing", "variables", "in", "the", "Dockerfile", "template", "with", "values", "passed", "in", "by", "the", "user", "from", "the", "CLI", "prompt", "." ]
294ac11efd551cc382f3fed79c190e536069d6ce
https://github.com/JasonEtco/actions-toolkit/blob/294ac11efd551cc382f3fed79c190e536069d6ce/bin/create-action.js#L86-L93
7,931
JasonEtco/actions-toolkit
bin/create-action.js
createPackageJson
function createPackageJson (name) { const { version, devDependencies } = require('../package.json') return { name, private: true, main: 'index.js', scripts: { start: 'node ./index.js', test: 'jest' }, dependencies: { 'actions-toolkit': `^${version}` }, devDependenci...
javascript
function createPackageJson (name) { const { version, devDependencies } = require('../package.json') return { name, private: true, main: 'index.js', scripts: { start: 'node ./index.js', test: 'jest' }, dependencies: { 'actions-toolkit': `^${version}` }, devDependenci...
[ "function", "createPackageJson", "(", "name", ")", "{", "const", "{", "version", ",", "devDependencies", "}", "=", "require", "(", "'../package.json'", ")", "return", "{", "name", ",", "private", ":", "true", ",", "main", ":", "'index.js'", ",", "scripts", ...
Creates a `package.json` object with the latest version of `actions-toolkit` ready to be installed. @param {string} name The action package name. @returns {object} The `package.json` contents.
[ "Creates", "a", "package", ".", "json", "object", "with", "the", "latest", "version", "of", "actions", "-", "toolkit", "ready", "to", "be", "installed", "." ]
294ac11efd551cc382f3fed79c190e536069d6ce
https://github.com/JasonEtco/actions-toolkit/blob/294ac11efd551cc382f3fed79c190e536069d6ce/bin/create-action.js#L115-L132
7,932
CreateJS/SoundJS
lib/flashaudioplugin.js
function() { if (isExpressInstallActive) { var obj = getElementById(EXPRESS_INSTALL_ID); if (obj && storedAltContent) { obj.parentNode.replaceChild(storedAltContent, obj); if (storedAltContentId) { setVisibility(storedAltContentId, true); if (ua.ie && ua.win) { storedAltContent.style.di...
javascript
function() { if (isExpressInstallActive) { var obj = getElementById(EXPRESS_INSTALL_ID); if (obj && storedAltContent) { obj.parentNode.replaceChild(storedAltContent, obj); if (storedAltContentId) { setVisibility(storedAltContentId, true); if (ua.ie && ua.win) { storedAltContent.style.di...
[ "function", "(", ")", "{", "if", "(", "isExpressInstallActive", ")", "{", "var", "obj", "=", "getElementById", "(", "EXPRESS_INSTALL_ID", ")", ";", "if", "(", "obj", "&&", "storedAltContent", ")", "{", "obj", ".", "parentNode", ".", "replaceChild", "(", "s...
For internal usage only
[ "For", "internal", "usage", "only" ]
416db509bfd0741eaa8c88600e1197e027f986e6
https://github.com/CreateJS/SoundJS/blob/416db509bfd0741eaa8c88600e1197e027f986e6/lib/flashaudioplugin.js#L795-L808
7,933
CreateJS/SoundJS
lib/flashaudioplugin.js
Loader
function Loader(loadItem) { this.AbstractLoader_constructor(loadItem, false, createjs.Types.SOUND); // Public properties /** * ID used to facilitate communication with flash. * Not doc'd because this should not be altered externally * @property flashId * @type {String} */ this.flashId = null; }
javascript
function Loader(loadItem) { this.AbstractLoader_constructor(loadItem, false, createjs.Types.SOUND); // Public properties /** * ID used to facilitate communication with flash. * Not doc'd because this should not be altered externally * @property flashId * @type {String} */ this.flashId = null; }
[ "function", "Loader", "(", "loadItem", ")", "{", "this", ".", "AbstractLoader_constructor", "(", "loadItem", ",", "false", ",", "createjs", ".", "Types", ".", "SOUND", ")", ";", "// Public properties", "/**\n\t\t * ID used to facilitate communication with flash.\n\t\t * N...
Loader provides a mechanism to preload Flash content via PreloadJS or internally. Instances are returned to the preloader, and the load method is called when the asset needs to be requested. @class FlashAudioLoader @param {String} loadItem The item to be loaded @param {Object} flash The flash instance that will do the...
[ "Loader", "provides", "a", "mechanism", "to", "preload", "Flash", "content", "via", "PreloadJS", "or", "internally", ".", "Instances", "are", "returned", "to", "the", "preloader", "and", "the", "load", "method", "is", "called", "when", "the", "asset", "needs",...
416db509bfd0741eaa8c88600e1197e027f986e6
https://github.com/CreateJS/SoundJS/blob/416db509bfd0741eaa8c88600e1197e027f986e6/lib/flashaudioplugin.js#L831-L844
7,934
mapbox/mapbox-gl-draw
src/lib/create_supplementary_points.js
processMultiGeometry
function processMultiGeometry() { const subType = type.replace(Constants.geojsonTypes.MULTI_PREFIX, ''); coordinates.forEach((subCoordinates, index) => { const subFeature = { type: Constants.geojsonTypes.FEATURE, properties: geojson.properties, geometry: { type: subType, ...
javascript
function processMultiGeometry() { const subType = type.replace(Constants.geojsonTypes.MULTI_PREFIX, ''); coordinates.forEach((subCoordinates, index) => { const subFeature = { type: Constants.geojsonTypes.FEATURE, properties: geojson.properties, geometry: { type: subType, ...
[ "function", "processMultiGeometry", "(", ")", "{", "const", "subType", "=", "type", ".", "replace", "(", "Constants", ".", "geojsonTypes", ".", "MULTI_PREFIX", ",", "''", ")", ";", "coordinates", ".", "forEach", "(", "(", "subCoordinates", ",", "index", ")",...
Split a multi-geometry into constituent geometries, and accumulate the supplementary points for each of those constituents
[ "Split", "a", "multi", "-", "geometry", "into", "constituent", "geometries", "and", "accumulate", "the", "supplementary", "points", "for", "each", "of", "those", "constituents" ]
7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8
https://github.com/mapbox/mapbox-gl-draw/blob/7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8/src/lib/create_supplementary_points.js#L65-L78
7,935
mapbox/mapbox-gl-draw
src/lib/sort_features.js
sortFeatures
function sortFeatures(features) { return features.map(feature => { if (feature.geometry.type === Constants.geojsonTypes.POLYGON) { feature.area = area.geometry({ type: Constants.geojsonTypes.FEATURE, property: {}, geometry: feature.geometry }); } return feature; }).so...
javascript
function sortFeatures(features) { return features.map(feature => { if (feature.geometry.type === Constants.geojsonTypes.POLYGON) { feature.area = area.geometry({ type: Constants.geojsonTypes.FEATURE, property: {}, geometry: feature.geometry }); } return feature; }).so...
[ "function", "sortFeatures", "(", "features", ")", "{", "return", "features", ".", "map", "(", "feature", "=>", "{", "if", "(", "feature", ".", "geometry", ".", "type", "===", "Constants", ".", "geojsonTypes", ".", "POLYGON", ")", "{", "feature", ".", "ar...
Sort in the order above, then sort polygons by area ascending.
[ "Sort", "in", "the", "order", "above", "then", "sort", "polygons", "by", "area", "ascending", "." ]
7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8
https://github.com/mapbox/mapbox-gl-draw/blob/7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8/src/lib/sort_features.js#L21-L35
7,936
mapbox/mapbox-gl-draw
src/setup.js
function() { ctx.options.styles.forEach(style => { if (ctx.map.getLayer(style.id)) { ctx.map.removeLayer(style.id); } }); if (ctx.map.getSource(Constants.sources.COLD)) { ctx.map.removeSource(Constants.sources.COLD); } if (ctx.map.getSource(Constants.sou...
javascript
function() { ctx.options.styles.forEach(style => { if (ctx.map.getLayer(style.id)) { ctx.map.removeLayer(style.id); } }); if (ctx.map.getSource(Constants.sources.COLD)) { ctx.map.removeSource(Constants.sources.COLD); } if (ctx.map.getSource(Constants.sou...
[ "function", "(", ")", "{", "ctx", ".", "options", ".", "styles", ".", "forEach", "(", "style", "=>", "{", "if", "(", "ctx", ".", "map", ".", "getLayer", "(", "style", ".", "id", ")", ")", "{", "ctx", ".", "map", ".", "removeLayer", "(", "style", ...
Check for layers and sources before attempting to remove If user adds draw control and removes it before the map is loaded, layers and sources will be missing
[ "Check", "for", "layers", "and", "sources", "before", "attempting", "to", "remove", "If", "user", "adds", "draw", "control", "and", "removes", "it", "before", "the", "map", "is", "loaded", "layers", "and", "sources", "will", "be", "missing" ]
7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8
https://github.com/mapbox/mapbox-gl-draw/blob/7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8/src/setup.js#L110-L124
7,937
mapbox/mapbox-gl-draw
src/lib/mouse_event_point.js
mouseEventPoint
function mouseEventPoint(mouseEvent, container) { const rect = container.getBoundingClientRect(); return new Point( mouseEvent.clientX - rect.left - (container.clientLeft || 0), mouseEvent.clientY - rect.top - (container.clientTop || 0) ); }
javascript
function mouseEventPoint(mouseEvent, container) { const rect = container.getBoundingClientRect(); return new Point( mouseEvent.clientX - rect.left - (container.clientLeft || 0), mouseEvent.clientY - rect.top - (container.clientTop || 0) ); }
[ "function", "mouseEventPoint", "(", "mouseEvent", ",", "container", ")", "{", "const", "rect", "=", "container", ".", "getBoundingClientRect", "(", ")", ";", "return", "new", "Point", "(", "mouseEvent", ".", "clientX", "-", "rect", ".", "left", "-", "(", "...
Returns a Point representing a mouse event's position relative to a containing element. @param {MouseEvent} mouseEvent @param {Node} container @returns {Point}
[ "Returns", "a", "Point", "representing", "a", "mouse", "event", "s", "position", "relative", "to", "a", "containing", "element", "." ]
7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8
https://github.com/mapbox/mapbox-gl-draw/blob/7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8/src/lib/mouse_event_point.js#L11-L17
7,938
mapbox/mapbox-gl-draw
src/lib/map_event_to_bounding_box.js
mapEventToBoundingBox
function mapEventToBoundingBox(mapEvent, buffer = 0) { return [ [mapEvent.point.x - buffer, mapEvent.point.y - buffer], [mapEvent.point.x + buffer, mapEvent.point.y + buffer] ]; }
javascript
function mapEventToBoundingBox(mapEvent, buffer = 0) { return [ [mapEvent.point.x - buffer, mapEvent.point.y - buffer], [mapEvent.point.x + buffer, mapEvent.point.y + buffer] ]; }
[ "function", "mapEventToBoundingBox", "(", "mapEvent", ",", "buffer", "=", "0", ")", "{", "return", "[", "[", "mapEvent", ".", "point", ".", "x", "-", "buffer", ",", "mapEvent", ".", "point", ".", "y", "-", "buffer", "]", ",", "[", "mapEvent", ".", "p...
Returns a bounding box representing the event's location. @param {Event} mapEvent - Mapbox GL JS map event, with a point properties. @return {Array<Array<number>>} Bounding box.
[ "Returns", "a", "bounding", "box", "representing", "the", "event", "s", "location", "." ]
7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8
https://github.com/mapbox/mapbox-gl-draw/blob/7f6fd83f04bfb9e2300a352ca7f14b0203cd48c8/src/lib/map_event_to_bounding_box.js#L7-L12
7,939
line/line-bot-sdk-nodejs
examples/kitchensink/index.js
handleEvent
function handleEvent(event) { if (event.replyToken && event.replyToken.match(/^(.)\1*$/)) { return console.log("Test hook recieved: " + JSON.stringify(event.message)); } switch (event.type) { case 'message': const message = event.message; switch (message.type) { case 'text': ...
javascript
function handleEvent(event) { if (event.replyToken && event.replyToken.match(/^(.)\1*$/)) { return console.log("Test hook recieved: " + JSON.stringify(event.message)); } switch (event.type) { case 'message': const message = event.message; switch (message.type) { case 'text': ...
[ "function", "handleEvent", "(", "event", ")", "{", "if", "(", "event", ".", "replyToken", "&&", "event", ".", "replyToken", ".", "match", "(", "/", "^(.)\\1*$", "/", ")", ")", "{", "return", "console", ".", "log", "(", "\"Test hook recieved: \"", "+", "J...
callback function to handle a single event
[ "callback", "function", "to", "handle", "a", "single", "event" ]
aa3f04749250341a3fd700ceffc3ac68e76c3402
https://github.com/line/line-bot-sdk-nodejs/blob/aa3f04749250341a3fd700ceffc3ac68e76c3402/examples/kitchensink/index.js#L62-L112
7,940
algolia/places
docs/source/javascripts/sidebar.js
activeLinks
function activeLinks(sidebarContainer) { const linksContainer = sidebarContainer.querySelector('ul'); linksContainer.addEventListener('click', e => { if (e.target.tagName === 'A') { Array.from(linksContainer.querySelectorAll('a')).forEach(item => item.classList.remove('active') ); e.t...
javascript
function activeLinks(sidebarContainer) { const linksContainer = sidebarContainer.querySelector('ul'); linksContainer.addEventListener('click', e => { if (e.target.tagName === 'A') { Array.from(linksContainer.querySelectorAll('a')).forEach(item => item.classList.remove('active') ); e.t...
[ "function", "activeLinks", "(", "sidebarContainer", ")", "{", "const", "linksContainer", "=", "sidebarContainer", ".", "querySelector", "(", "'ul'", ")", ";", "linksContainer", ".", "addEventListener", "(", "'click'", ",", "e", "=>", "{", "if", "(", "e", ".", ...
The Following code is used to set active items On the documentation sidebar depending on the clicked item
[ "The", "Following", "code", "is", "used", "to", "set", "active", "items", "On", "the", "documentation", "sidebar", "depending", "on", "the", "clicked", "item" ]
c183814eb967202e1c0aa2ed655f33f60e008c13
https://github.com/algolia/places/blob/c183814eb967202e1c0aa2ed655f33f60e008c13/docs/source/javascripts/sidebar.js#L152-L163
7,941
zendeskgarden/react-components
packages/forms/src/fields/common/Field.js
Field
function Field({ id, children }) { const fieldProps = useField(id); return <FieldContext.Provider value={fieldProps}>{children}</FieldContext.Provider>; }
javascript
function Field({ id, children }) { const fieldProps = useField(id); return <FieldContext.Provider value={fieldProps}>{children}</FieldContext.Provider>; }
[ "function", "Field", "(", "{", "id", ",", "children", "}", ")", "{", "const", "fieldProps", "=", "useField", "(", "id", ")", ";", "return", "<", "FieldContext", ".", "Provider", "value", "=", "{", "fieldProps", "}", ">", "{", "children", "}", "<", "/...
Provides accessibility attributes to child form fields. Does not render a corresponding DOM element.
[ "Provides", "accessibility", "attributes", "to", "child", "form", "fields", ".", "Does", "not", "render", "a", "corresponding", "DOM", "element", "." ]
51c52457959e6c12f049e789d76d8cd7ed17d872
https://github.com/zendeskgarden/react-components/blob/51c52457959e6c12f049e789d76d8cd7ed17d872/packages/forms/src/fields/common/Field.js#L18-L22
7,942
zendeskgarden/react-components
packages/typography/src/views/Ellipsis.js
Ellipsis
function Ellipsis({ children, title, tag, ...other }) { const CustomTagEllipsis = StyledEllipsis.withComponent(tag); let textContent = null; if (title !== undefined) { textContent = title; } else if (typeof children === 'string') { textContent = children; } return ( <CustomTagEllipsis title={...
javascript
function Ellipsis({ children, title, tag, ...other }) { const CustomTagEllipsis = StyledEllipsis.withComponent(tag); let textContent = null; if (title !== undefined) { textContent = title; } else if (typeof children === 'string') { textContent = children; } return ( <CustomTagEllipsis title={...
[ "function", "Ellipsis", "(", "{", "children", ",", "title", ",", "tag", ",", "...", "other", "}", ")", "{", "const", "CustomTagEllipsis", "=", "StyledEllipsis", ".", "withComponent", "(", "tag", ")", ";", "let", "textContent", "=", "null", ";", "if", "("...
A component that automatically includes a native `title` attribute and any text-overflow styling. All other props are spread onto the element. @param {*} props
[ "A", "component", "that", "automatically", "includes", "a", "native", "title", "attribute", "and", "any", "text", "-", "overflow", "styling", "." ]
51c52457959e6c12f049e789d76d8cd7ed17d872
https://github.com/zendeskgarden/react-components/blob/51c52457959e6c12f049e789d76d8cd7ed17d872/packages/typography/src/views/Ellipsis.js#L36-L52
7,943
josdejong/workerpool
lib/Promise.js
function (result) { // update status me.resolved = true; me.rejected = false; me.pending = false; _onSuccess.forEach(function (fn) { fn(result); }); _process = function (onSuccess, onFail) { onSuccess(result); }; _resolve = _reject = function () { }; return me; ...
javascript
function (result) { // update status me.resolved = true; me.rejected = false; me.pending = false; _onSuccess.forEach(function (fn) { fn(result); }); _process = function (onSuccess, onFail) { onSuccess(result); }; _resolve = _reject = function () { }; return me; ...
[ "function", "(", "result", ")", "{", "// update status", "me", ".", "resolved", "=", "true", ";", "me", ".", "rejected", "=", "false", ";", "me", ".", "pending", "=", "false", ";", "_onSuccess", ".", "forEach", "(", "function", "(", "fn", ")", "{", "...
Resolve the promise @param {*} result @type {Function}
[ "Resolve", "the", "promise" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/Promise.js#L62-L79
7,944
josdejong/workerpool
lib/Promise.js
function (error) { // update status me.resolved = false; me.rejected = true; me.pending = false; _onFail.forEach(function (fn) { fn(error); }); _process = function (onSuccess, onFail) { onFail(error); }; _resolve = _reject = function () { } return me; }
javascript
function (error) { // update status me.resolved = false; me.rejected = true; me.pending = false; _onFail.forEach(function (fn) { fn(error); }); _process = function (onSuccess, onFail) { onFail(error); }; _resolve = _reject = function () { } return me; }
[ "function", "(", "error", ")", "{", "// update status", "me", ".", "resolved", "=", "false", ";", "me", ".", "rejected", "=", "true", ";", "me", ".", "pending", "=", "false", ";", "_onFail", ".", "forEach", "(", "function", "(", "fn", ")", "{", "fn",...
Reject the promise @param {Error} error @type {Function}
[ "Reject", "the", "promise" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/Promise.js#L86-L103
7,945
josdejong/workerpool
lib/Pool.js
Pool
function Pool(script, options) { if (typeof script === 'string') { this.script = script || null; } else { this.script = null; options = script; } this.workers = []; // queue with all workers this.tasks = []; // queue with tasks awaiting execution options = options || {}; this.forkArgs...
javascript
function Pool(script, options) { if (typeof script === 'string') { this.script = script || null; } else { this.script = null; options = script; } this.workers = []; // queue with all workers this.tasks = []; // queue with tasks awaiting execution options = options || {}; this.forkArgs...
[ "function", "Pool", "(", "script", ",", "options", ")", "{", "if", "(", "typeof", "script", "===", "'string'", ")", "{", "this", ".", "script", "=", "script", "||", "null", ";", "}", "else", "{", "this", ".", "script", "=", "null", ";", "options", ...
A pool to manage workers @param {String} [script] Optional worker script @param {Object} [options] Available options: maxWorkers: Number @constructor
[ "A", "pool", "to", "manage", "workers" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/Pool.js#L12-L57
7,946
josdejong/workerpool
lib/WorkerHandler.js
getDefaultWorker
function getDefaultWorker() { if (environment.platform == 'browser') { // test whether the browser supports all features that we need if (typeof Blob === 'undefined') { throw new Error('Blob not supported by the browser'); } if (!window.URL || typeof window.URL.createObjectURL !== 'function') { ...
javascript
function getDefaultWorker() { if (environment.platform == 'browser') { // test whether the browser supports all features that we need if (typeof Blob === 'undefined') { throw new Error('Blob not supported by the browser'); } if (!window.URL || typeof window.URL.createObjectURL !== 'function') { ...
[ "function", "getDefaultWorker", "(", ")", "{", "if", "(", "environment", ".", "platform", "==", "'browser'", ")", "{", "// test whether the browser supports all features that we need", "if", "(", "typeof", "Blob", "===", "'undefined'", ")", "{", "throw", "new", "Err...
get the default worker script
[ "get", "the", "default", "worker", "script" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/WorkerHandler.js#L32-L50
7,947
josdejong/workerpool
lib/WorkerHandler.js
resolveForkOptions
function resolveForkOptions(opts) { opts = opts || {}; var processExecArgv = process.execArgv.join(' '); var inspectorActive = processExecArgv.indexOf('--inspect') !== -1; var debugBrk = processExecArgv.indexOf('--debug-brk') !== -1; var execArgv = []; if (inspectorActive) { execArgv.push('--inspect='...
javascript
function resolveForkOptions(opts) { opts = opts || {}; var processExecArgv = process.execArgv.join(' '); var inspectorActive = processExecArgv.indexOf('--inspect') !== -1; var debugBrk = processExecArgv.indexOf('--debug-brk') !== -1; var execArgv = []; if (inspectorActive) { execArgv.push('--inspect='...
[ "function", "resolveForkOptions", "(", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "var", "processExecArgv", "=", "process", ".", "execArgv", ".", "join", "(", "' '", ")", ";", "var", "inspectorActive", "=", "processExecArgv", ".", "indexOf...
add debug flags to child processes if the node inspector is active
[ "add", "debug", "flags", "to", "child", "processes", "if", "the", "node", "inspector", "is", "active" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/WorkerHandler.js#L104-L127
7,948
josdejong/workerpool
lib/WorkerHandler.js
objectToError
function objectToError (obj) { var temp = new Error('') var props = Object.keys(obj) for (var i = 0; i < props.length; i++) { temp[props[i]] = obj[props[i]] } return temp }
javascript
function objectToError (obj) { var temp = new Error('') var props = Object.keys(obj) for (var i = 0; i < props.length; i++) { temp[props[i]] = obj[props[i]] } return temp }
[ "function", "objectToError", "(", "obj", ")", "{", "var", "temp", "=", "new", "Error", "(", "''", ")", "var", "props", "=", "Object", ".", "keys", "(", "obj", ")", "for", "(", "var", "i", "=", "0", ";", "i", "<", "props", ".", "length", ";", "i...
Converts a serialized error to Error @param {Object} obj Error that has been serialized and parsed to object @return {Error} The equivalent Error.
[ "Converts", "a", "serialized", "error", "to", "Error" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/WorkerHandler.js#L134-L143
7,949
josdejong/workerpool
lib/WorkerHandler.js
onError
function onError(error) { me.terminated = true; if (me.terminating && me.terminationHandler) { me.terminationHandler(me); } me.terminating = false; for (var id in me.processing) { if (me.processing[id] !== undefined) { me.processing[id].resolver.reject(error); } } ...
javascript
function onError(error) { me.terminated = true; if (me.terminating && me.terminationHandler) { me.terminationHandler(me); } me.terminating = false; for (var id in me.processing) { if (me.processing[id] !== undefined) { me.processing[id].resolver.reject(error); } } ...
[ "function", "onError", "(", "error", ")", "{", "me", ".", "terminated", "=", "true", ";", "if", "(", "me", ".", "terminating", "&&", "me", ".", "terminationHandler", ")", "{", "me", ".", "terminationHandler", "(", "me", ")", ";", "}", "me", ".", "ter...
reject all running tasks on worker error
[ "reject", "all", "running", "tasks", "on", "worker", "error" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/WorkerHandler.js#L222-L235
7,950
josdejong/workerpool
lib/WorkerHandler.js
dispatchQueuedRequests
function dispatchQueuedRequests() { me.requestQueue.forEach(me.worker.send.bind(me.worker)); me.requestQueue = []; }
javascript
function dispatchQueuedRequests() { me.requestQueue.forEach(me.worker.send.bind(me.worker)); me.requestQueue = []; }
[ "function", "dispatchQueuedRequests", "(", ")", "{", "me", ".", "requestQueue", ".", "forEach", "(", "me", ".", "worker", ".", "send", ".", "bind", "(", "me", ".", "worker", ")", ")", ";", "me", ".", "requestQueue", "=", "[", "]", ";", "}" ]
send all queued requests to worker
[ "send", "all", "queued", "requests", "to", "worker" ]
52a67c7f9218a9351a90f9fec263337c57df3095
https://github.com/josdejong/workerpool/blob/52a67c7f9218a9351a90f9fec263337c57df3095/lib/WorkerHandler.js#L238-L242
7,951
Caligatio/jsSHA
src/sha_dev.js
hex2packed
function hex2packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, length = str.length, i, num, intOffset, byteOffset, existingByteLen, shiftModifier; if (0 !== (length % 2)) { throw new Error("String of HEX type must be in byte increments"); } packed = existingPacked || [0]; e...
javascript
function hex2packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, length = str.length, i, num, intOffset, byteOffset, existingByteLen, shiftModifier; if (0 !== (length % 2)) { throw new Error("String of HEX type must be in byte increments"); } packed = existingPacked || [0]; e...
[ "function", "hex2packed", "(", "str", ",", "existingPacked", ",", "existingPackedLen", ",", "bigEndianMod", ")", "{", "var", "packed", ",", "length", "=", "str", ".", "length", ",", "i", ",", "num", ",", "intOffset", ",", "byteOffset", ",", "existingByteLen"...
Convert a hex string to an array of big-endian words @private @param {string} str String to be converted to binary representation @param {Array<number>} existingPacked A packed int array of bytes to append the results to @param {number} existingPackedLen The number of bits in the existingPacked array @param {number} b...
[ "Convert", "a", "hex", "string", "to", "an", "array", "of", "big", "-", "endian", "words" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L172-L207
7,952
Caligatio/jsSHA
src/sha_dev.js
bytes2packed
function bytes2packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, codePnt, i, existingByteLen, intOffset, byteOffset, shiftModifier; packed = existingPacked || [0]; existingPackedLen = existingPackedLen || 0; existingByteLen = existingPackedLen >>> 3; shiftModifier = (bigEndianMod...
javascript
function bytes2packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, codePnt, i, existingByteLen, intOffset, byteOffset, shiftModifier; packed = existingPacked || [0]; existingPackedLen = existingPackedLen || 0; existingByteLen = existingPackedLen >>> 3; shiftModifier = (bigEndianMod...
[ "function", "bytes2packed", "(", "str", ",", "existingPacked", ",", "existingPackedLen", ",", "bigEndianMod", ")", "{", "var", "packed", ",", "codePnt", ",", "i", ",", "existingByteLen", ",", "intOffset", ",", "byteOffset", ",", "shiftModifier", ";", "packed", ...
Convert a string of raw bytes to an array of big-endian words @private @param {string} str String of raw bytes to be converted to binary representation @param {Array<number>} existingPacked A packed int array of bytes to append the results to @param {number} existingPackedLen The number of bits in the existingPacked a...
[ "Convert", "a", "string", "of", "raw", "bytes", "to", "an", "array", "of", "big", "-", "endian", "words" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L224-L248
7,953
Caligatio/jsSHA
src/sha_dev.js
b642packed
function b642packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, byteCnt = 0, index, i, j, tmpInt, strPart, firstEqual, b64Tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", existingByteLen, intOffset, byteOffset, shiftModifier; if (-1 === str.search(/^[a-zA-Z0-...
javascript
function b642packed(str, existingPacked, existingPackedLen, bigEndianMod) { var packed, byteCnt = 0, index, i, j, tmpInt, strPart, firstEqual, b64Tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", existingByteLen, intOffset, byteOffset, shiftModifier; if (-1 === str.search(/^[a-zA-Z0-...
[ "function", "b642packed", "(", "str", ",", "existingPacked", ",", "existingPackedLen", ",", "bigEndianMod", ")", "{", "var", "packed", ",", "byteCnt", "=", "0", ",", "index", ",", "i", ",", "j", ",", "tmpInt", ",", "strPart", ",", "firstEqual", ",", "b64...
Convert a base-64 string to an array of big-endian words @private @param {string} str String to be converted to binary representation @param {Array<number>} existingPacked A packed int array of bytes to append the results to @param {number} existingPackedLen The number of bits in the existingPacked array @param {numbe...
[ "Convert", "a", "base", "-", "64", "string", "to", "an", "array", "of", "big", "-", "endian", "words" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L265-L314
7,954
Caligatio/jsSHA
src/sha_dev.js
arraybuffer2packed
function arraybuffer2packed(arr, existingPacked, existingPackedLen, bigEndianMod) { var packed, i, existingByteLen, intOffset, byteOffset, shiftModifier, arrView; packed = existingPacked || [0]; existingPackedLen = existingPackedLen || 0; existingByteLen = existingPackedLen >>> 3; shiftModifier = (bigEndian...
javascript
function arraybuffer2packed(arr, existingPacked, existingPackedLen, bigEndianMod) { var packed, i, existingByteLen, intOffset, byteOffset, shiftModifier, arrView; packed = existingPacked || [0]; existingPackedLen = existingPackedLen || 0; existingByteLen = existingPackedLen >>> 3; shiftModifier = (bigEndian...
[ "function", "arraybuffer2packed", "(", "arr", ",", "existingPacked", ",", "existingPackedLen", ",", "bigEndianMod", ")", "{", "var", "packed", ",", "i", ",", "existingByteLen", ",", "intOffset", ",", "byteOffset", ",", "shiftModifier", ",", "arrView", ";", "pack...
Convert an ArrayBuffer to an array of big-endian words @private @param {ArrayBuffer} arr ArrayBuffer to be converted to binary representation @param {Array<number>} existingPacked A packed int array of bytes to append the results to @param {number} existingPackedLen The number of bits in the existingPacked array @para...
[ "Convert", "an", "ArrayBuffer", "to", "an", "array", "of", "big", "-", "endian", "words" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L332-L354
7,955
Caligatio/jsSHA
src/sha_dev.js
packed2b64
function packed2b64(packed, outputLength, bigEndianMod, formatOpts) { var str = "", length = outputLength / 8, i, j, triplet, int1, int2, shiftModifier, b64Tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 3)...
javascript
function packed2b64(packed, outputLength, bigEndianMod, formatOpts) { var str = "", length = outputLength / 8, i, j, triplet, int1, int2, shiftModifier, b64Tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 3)...
[ "function", "packed2b64", "(", "packed", ",", "outputLength", ",", "bigEndianMod", ",", "formatOpts", ")", "{", "var", "str", "=", "\"\"", ",", "length", "=", "outputLength", "/", "8", ",", "i", ",", "j", ",", "triplet", ",", "int1", ",", "int2", ",", ...
Convert an array of big-endian words to a base-64 string @private @param {Array<number>} packed Array of integers to be converted to base-64 representation @param {number} outputLength Length of output in bits @param {number} bigEndianMod Modifier for whether hash function is big or small endian @param {{outputUpper :...
[ "Convert", "an", "array", "of", "big", "-", "endian", "words", "to", "a", "base", "-", "64", "string" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L402-L429
7,956
Caligatio/jsSHA
src/sha_dev.js
packed2bytes
function packed2bytes(packed, outputLength, bigEndianMod) { var str = "", length = outputLength / 8, i, srcByte, shiftModifier; shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 1) { srcByte = (packed[i >>> 2] >>> (8 * (shiftModifier + bigEndianMod * (i % 4)))) & 0xFF; str += ...
javascript
function packed2bytes(packed, outputLength, bigEndianMod) { var str = "", length = outputLength / 8, i, srcByte, shiftModifier; shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 1) { srcByte = (packed[i >>> 2] >>> (8 * (shiftModifier + bigEndianMod * (i % 4)))) & 0xFF; str += ...
[ "function", "packed2bytes", "(", "packed", ",", "outputLength", ",", "bigEndianMod", ")", "{", "var", "str", "=", "\"\"", ",", "length", "=", "outputLength", "/", "8", ",", "i", ",", "srcByte", ",", "shiftModifier", ";", "shiftModifier", "=", "(", "bigEndi...
Convert an array of big-endian words to raw bytes string @private @param {Array<number>} packed Array of integers to be converted to a raw bytes string representation @param {number} outputLength Length of output in bits @param {number} bigEndianMod Modifier for whether hash function is big or small endian @return {st...
[ "Convert", "an", "array", "of", "big", "-", "endian", "words", "to", "raw", "bytes", "string" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L443-L456
7,957
Caligatio/jsSHA
src/sha_dev.js
packed2arraybuffer
function packed2arraybuffer(packed, outputLength, bigEndianMod) { var length = outputLength / 8, i, retVal = new ArrayBuffer(length), shiftModifier, arrView; arrView = new Uint8Array(retVal); shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 1) { arrView[i] = (packed[i >>> 2] >...
javascript
function packed2arraybuffer(packed, outputLength, bigEndianMod) { var length = outputLength / 8, i, retVal = new ArrayBuffer(length), shiftModifier, arrView; arrView = new Uint8Array(retVal); shiftModifier = (bigEndianMod === -1) ? 3 : 0; for (i = 0; i < length; i += 1) { arrView[i] = (packed[i >>> 2] >...
[ "function", "packed2arraybuffer", "(", "packed", ",", "outputLength", ",", "bigEndianMod", ")", "{", "var", "length", "=", "outputLength", "/", "8", ",", "i", ",", "retVal", "=", "new", "ArrayBuffer", "(", "length", ")", ",", "shiftModifier", ",", "arrView",...
Convert an array of big-endian words to an ArrayBuffer @private @param {Array<number>} packed Array of integers to be converted to an ArrayBuffer @param {number} outputLength Length of output in bits @param {number} bigEndianMod Modifier for whether hash function is big or small endian @return {ArrayBuffer} Raw bytes ...
[ "Convert", "an", "array", "of", "big", "-", "endian", "words", "to", "an", "ArrayBuffer" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L470-L483
7,958
Caligatio/jsSHA
src/sha_dev.js
getOutputOpts
function getOutputOpts(options) { var retVal = {"outputUpper" : false, "b64Pad" : "=", "shakeLen" : -1}, outputOptions; outputOptions = options || {}; retVal["outputUpper"] = outputOptions["outputUpper"] || false; if (true === outputOptions.hasOwnProperty("b64Pad")) { retVal["b64Pad"] = outputOptions...
javascript
function getOutputOpts(options) { var retVal = {"outputUpper" : false, "b64Pad" : "=", "shakeLen" : -1}, outputOptions; outputOptions = options || {}; retVal["outputUpper"] = outputOptions["outputUpper"] || false; if (true === outputOptions.hasOwnProperty("b64Pad")) { retVal["b64Pad"] = outputOptions...
[ "function", "getOutputOpts", "(", "options", ")", "{", "var", "retVal", "=", "{", "\"outputUpper\"", ":", "false", ",", "\"b64Pad\"", ":", "\"=\"", ",", "\"shakeLen\"", ":", "-", "1", "}", ",", "outputOptions", ";", "outputOptions", "=", "options", "||", "...
Validate hash list containing output formatting options, ensuring presence of every option or adding the default value @private @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined), shakeLen : (number|undefined)}=} options Hash list of output formatting options @return {{outputUpper : boolean, b64Pa...
[ "Validate", "hash", "list", "containing", "output", "formatting", "options", "ensuring", "presence", "of", "every", "option", "or", "adding", "the", "default", "value" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L495-L528
7,959
Caligatio/jsSHA
src/sha_dev.js
rotl_64
function rotl_64(x, n) { if (n > 32) { n = n - 32; return new Int_64( x.lowOrder << n | x.highOrder >>> (32 - n), x.highOrder << n | x.lowOrder >>> (32 - n) ); } else if (0 !== n) { return new Int_64( x.highOrder << n | x.lowOrder >>> (32 - n), x.lowOrder << n | x.highOrder >>> (3...
javascript
function rotl_64(x, n) { if (n > 32) { n = n - 32; return new Int_64( x.lowOrder << n | x.highOrder >>> (32 - n), x.highOrder << n | x.lowOrder >>> (32 - n) ); } else if (0 !== n) { return new Int_64( x.highOrder << n | x.lowOrder >>> (32 - n), x.lowOrder << n | x.highOrder >>> (3...
[ "function", "rotl_64", "(", "x", ",", "n", ")", "{", "if", "(", "n", ">", "32", ")", "{", "n", "=", "n", "-", "32", ";", "return", "new", "Int_64", "(", "x", ".", "lowOrder", "<<", "n", "|", "x", ".", "highOrder", ">>>", "(", "32", "-", "n"...
The 64-bit implementation of circular rotate left @private @param {Int_64} x The 64-bit integer argument @param {number} n The number of bits to shift @return {Int_64} The x shifted circularly by n bits
[ "The", "64", "-", "bit", "implementation", "of", "circular", "rotate", "left" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L679-L700
7,960
Caligatio/jsSHA
src/sha_dev.js
rotr_64
function rotr_64(x, n) { var retVal = null, tmp = new Int_64(x.highOrder, x.lowOrder); if (32 >= n) { retVal = new Int_64( (tmp.highOrder >>> n) | ((tmp.lowOrder << (32 - n)) & 0xFFFFFFFF), (tmp.lowOrder >>> n) | ((tmp.highOrder << (32 - n)) & 0xFFFFFFFF) ); } else { retVal = new Int_6...
javascript
function rotr_64(x, n) { var retVal = null, tmp = new Int_64(x.highOrder, x.lowOrder); if (32 >= n) { retVal = new Int_64( (tmp.highOrder >>> n) | ((tmp.lowOrder << (32 - n)) & 0xFFFFFFFF), (tmp.lowOrder >>> n) | ((tmp.highOrder << (32 - n)) & 0xFFFFFFFF) ); } else { retVal = new Int_6...
[ "function", "rotr_64", "(", "x", ",", "n", ")", "{", "var", "retVal", "=", "null", ",", "tmp", "=", "new", "Int_64", "(", "x", ".", "highOrder", ",", "x", ".", "lowOrder", ")", ";", "if", "(", "32", ">=", "n", ")", "{", "retVal", "=", "new", ...
The 64-bit implementation of circular rotate right @private @param {Int_64} x The 64-bit integer argument @param {number} n The number of bits to shift @return {Int_64} The x shifted circularly by n bits
[ "The", "64", "-", "bit", "implementation", "of", "circular", "rotate", "right" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L723-L743
7,961
Caligatio/jsSHA
src/sha_dev.js
shr_64
function shr_64(x, n) { var retVal = null; if (32 >= n) { retVal = new Int_64( x.highOrder >>> n, x.lowOrder >>> n | ((x.highOrder << (32 - n)) & 0xFFFFFFFF) ); } else { retVal = new Int_64( 0, x.highOrder >>> (n - 32) ); } return retVal; }
javascript
function shr_64(x, n) { var retVal = null; if (32 >= n) { retVal = new Int_64( x.highOrder >>> n, x.lowOrder >>> n | ((x.highOrder << (32 - n)) & 0xFFFFFFFF) ); } else { retVal = new Int_64( 0, x.highOrder >>> (n - 32) ); } return retVal; }
[ "function", "shr_64", "(", "x", ",", "n", ")", "{", "var", "retVal", "=", "null", ";", "if", "(", "32", ">=", "n", ")", "{", "retVal", "=", "new", "Int_64", "(", "x", ".", "highOrder", ">>>", "n", ",", "x", ".", "lowOrder", ">>>", "n", "|", "...
The 64-bit implementation of shift right @private @param {Int_64} x The 64-bit integer argument @param {number} n The number of bits to shift @return {Int_64} The x shifted by n bits
[ "The", "64", "-", "bit", "implementation", "of", "shift", "right" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L766-L786
7,962
Caligatio/jsSHA
src/sha_dev.js
ch_64
function ch_64(x, y, z) { return new Int_64( (x.highOrder & y.highOrder) ^ (~x.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (~x.lowOrder & z.lowOrder) ); }
javascript
function ch_64(x, y, z) { return new Int_64( (x.highOrder & y.highOrder) ^ (~x.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (~x.lowOrder & z.lowOrder) ); }
[ "function", "ch_64", "(", "x", ",", "y", ",", "z", ")", "{", "return", "new", "Int_64", "(", "(", "x", ".", "highOrder", "&", "y", ".", "highOrder", ")", "^", "(", "~", "x", ".", "highOrder", "&", "z", ".", "highOrder", ")", ",", "(", "x", "....
The 64-bit implementation of the NIST specified Ch function @private @param {Int_64} x The first 64-bit integer argument @param {Int_64} y The second 64-bit integer argument @param {Int_64} z The third 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Ch", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L825-L831
7,963
Caligatio/jsSHA
src/sha_dev.js
maj_32
function maj_32(x, y, z) { return (x & y) ^ (x & z) ^ (y & z); }
javascript
function maj_32(x, y, z) { return (x & y) ^ (x & z) ^ (y & z); }
[ "function", "maj_32", "(", "x", ",", "y", ",", "z", ")", "{", "return", "(", "x", "&", "y", ")", "^", "(", "x", "&", "z", ")", "^", "(", "y", "&", "z", ")", ";", "}" ]
The 32-bit implementation of the NIST specified Maj function @private @param {number} x The first 32-bit integer argument @param {number} y The second 32-bit integer argument @param {number} z The third 32-bit integer argument @return {number} The NIST specified output of the function
[ "The", "32", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Maj", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L842-L845
7,964
Caligatio/jsSHA
src/sha_dev.js
maj_64
function maj_64(x, y, z) { return new Int_64( (x.highOrder & y.highOrder) ^ (x.highOrder & z.highOrder) ^ (y.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (x.lowOrder & z.lowOrder) ^ (y.lowOrder & z.lowOrder) ); }
javascript
function maj_64(x, y, z) { return new Int_64( (x.highOrder & y.highOrder) ^ (x.highOrder & z.highOrder) ^ (y.highOrder & z.highOrder), (x.lowOrder & y.lowOrder) ^ (x.lowOrder & z.lowOrder) ^ (y.lowOrder & z.lowOrder) ); }
[ "function", "maj_64", "(", "x", ",", "y", ",", "z", ")", "{", "return", "new", "Int_64", "(", "(", "x", ".", "highOrder", "&", "y", ".", "highOrder", ")", "^", "(", "x", ".", "highOrder", "&", "z", ".", "highOrder", ")", "^", "(", "y", ".", "...
The 64-bit implementation of the NIST specified Maj function @private @param {Int_64} x The first 64-bit integer argument @param {Int_64} y The second 64-bit integer argument @param {Int_64} z The third 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Maj", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L856-L866
7,965
Caligatio/jsSHA
src/sha_dev.js
sigma0_64
function sigma0_64(x) { var rotr28 = rotr_64(x, 28), rotr34 = rotr_64(x, 34), rotr39 = rotr_64(x, 39); return new Int_64( rotr28.highOrder ^ rotr34.highOrder ^ rotr39.highOrder, rotr28.lowOrder ^ rotr34.lowOrder ^ rotr39.lowOrder); }
javascript
function sigma0_64(x) { var rotr28 = rotr_64(x, 28), rotr34 = rotr_64(x, 34), rotr39 = rotr_64(x, 39); return new Int_64( rotr28.highOrder ^ rotr34.highOrder ^ rotr39.highOrder, rotr28.lowOrder ^ rotr34.lowOrder ^ rotr39.lowOrder); }
[ "function", "sigma0_64", "(", "x", ")", "{", "var", "rotr28", "=", "rotr_64", "(", "x", ",", "28", ")", ",", "rotr34", "=", "rotr_64", "(", "x", ",", "34", ")", ",", "rotr39", "=", "rotr_64", "(", "x", ",", "39", ")", ";", "return", "new", "Int...
The 64-bit implementation of the NIST specified Sigma0 function @private @param {Int_64} x The 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Sigma0", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L887-L895
7,966
Caligatio/jsSHA
src/sha_dev.js
sigma1_64
function sigma1_64(x) { var rotr14 = rotr_64(x, 14), rotr18 = rotr_64(x, 18), rotr41 = rotr_64(x, 41); return new Int_64( rotr14.highOrder ^ rotr18.highOrder ^ rotr41.highOrder, rotr14.lowOrder ^ rotr18.lowOrder ^ rotr41.lowOrder); }
javascript
function sigma1_64(x) { var rotr14 = rotr_64(x, 14), rotr18 = rotr_64(x, 18), rotr41 = rotr_64(x, 41); return new Int_64( rotr14.highOrder ^ rotr18.highOrder ^ rotr41.highOrder, rotr14.lowOrder ^ rotr18.lowOrder ^ rotr41.lowOrder); }
[ "function", "sigma1_64", "(", "x", ")", "{", "var", "rotr14", "=", "rotr_64", "(", "x", ",", "14", ")", ",", "rotr18", "=", "rotr_64", "(", "x", ",", "18", ")", ",", "rotr41", "=", "rotr_64", "(", "x", ",", "41", ")", ";", "return", "new", "Int...
The 64-bit implementation of the NIST specified Sigma1 function @private @param {Int_64} x The 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Sigma1", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L916-L924
7,967
Caligatio/jsSHA
src/sha_dev.js
gamma0_64
function gamma0_64(x) { var rotr1 = rotr_64(x, 1), rotr8 = rotr_64(x, 8), shr7 = shr_64(x, 7); return new Int_64( rotr1.highOrder ^ rotr8.highOrder ^ shr7.highOrder, rotr1.lowOrder ^ rotr8.lowOrder ^ shr7.lowOrder ); }
javascript
function gamma0_64(x) { var rotr1 = rotr_64(x, 1), rotr8 = rotr_64(x, 8), shr7 = shr_64(x, 7); return new Int_64( rotr1.highOrder ^ rotr8.highOrder ^ shr7.highOrder, rotr1.lowOrder ^ rotr8.lowOrder ^ shr7.lowOrder ); }
[ "function", "gamma0_64", "(", "x", ")", "{", "var", "rotr1", "=", "rotr_64", "(", "x", ",", "1", ")", ",", "rotr8", "=", "rotr_64", "(", "x", ",", "8", ")", ",", "shr7", "=", "shr_64", "(", "x", ",", "7", ")", ";", "return", "new", "Int_64", ...
The 64-bit implementation of the NIST specified Gamma0 function @private @param {Int_64} x The 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Gamma0", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L945-L953
7,968
Caligatio/jsSHA
src/sha_dev.js
gamma1_64
function gamma1_64(x) { var rotr19 = rotr_64(x, 19), rotr61 = rotr_64(x, 61), shr6 = shr_64(x, 6); return new Int_64( rotr19.highOrder ^ rotr61.highOrder ^ shr6.highOrder, rotr19.lowOrder ^ rotr61.lowOrder ^ shr6.lowOrder ); }
javascript
function gamma1_64(x) { var rotr19 = rotr_64(x, 19), rotr61 = rotr_64(x, 61), shr6 = shr_64(x, 6); return new Int_64( rotr19.highOrder ^ rotr61.highOrder ^ shr6.highOrder, rotr19.lowOrder ^ rotr61.lowOrder ^ shr6.lowOrder ); }
[ "function", "gamma1_64", "(", "x", ")", "{", "var", "rotr19", "=", "rotr_64", "(", "x", ",", "19", ")", ",", "rotr61", "=", "rotr_64", "(", "x", ",", "61", ")", ",", "shr6", "=", "shr_64", "(", "x", ",", "6", ")", ";", "return", "new", "Int_64"...
The 64-bit implementation of the NIST specified Gamma1 function @private @param {Int_64} x The 64-bit integer argument @return {Int_64} The NIST specified output of the function
[ "The", "64", "-", "bit", "implementation", "of", "the", "NIST", "specified", "Gamma1", "function" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L974-L983
7,969
Caligatio/jsSHA
src/sha_dev.js
safeAdd_32_2
function safeAdd_32_2(a, b) { var lsw = (a & 0xFFFF) + (b & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
javascript
function safeAdd_32_2(a, b) { var lsw = (a & 0xFFFF) + (b & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
[ "function", "safeAdd_32_2", "(", "a", ",", "b", ")", "{", "var", "lsw", "=", "(", "a", "&", "0xFFFF", ")", "+", "(", "b", "&", "0xFFFF", ")", ",", "msw", "=", "(", "a", ">>>", "16", ")", "+", "(", "b", ">>>", "16", ")", "+", "(", "lsw", "...
Add two 32-bit integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {number} a The first 32-bit integer argument to be added @param {number} b The second 32-bit integer argument to be added @return {number} The sum of a + b
[ "Add", "two", "32", "-", "bit", "integers", "wrapping", "at", "2^32", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L994-L1000
7,970
Caligatio/jsSHA
src/sha_dev.js
safeAdd_32_4
function safeAdd_32_4(a, b, c, d) { var lsw = (a & 0xFFFF) + (b & 0xFFFF) + (c & 0xFFFF) + (d & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (c >>> 16) + (d >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
javascript
function safeAdd_32_4(a, b, c, d) { var lsw = (a & 0xFFFF) + (b & 0xFFFF) + (c & 0xFFFF) + (d & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (c >>> 16) + (d >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
[ "function", "safeAdd_32_4", "(", "a", ",", "b", ",", "c", ",", "d", ")", "{", "var", "lsw", "=", "(", "a", "&", "0xFFFF", ")", "+", "(", "b", "&", "0xFFFF", ")", "+", "(", "c", "&", "0xFFFF", ")", "+", "(", "d", "&", "0xFFFF", ")", ",", "...
Add four 32-bit integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {number} a The first 32-bit integer argument to be added @param {number} b The second 32-bit integer argument to be added @param {number} c The third 32-bit integer argument t...
[ "Add", "four", "32", "-", "bit", "integers", "wrapping", "at", "2^32", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1013-L1020
7,971
Caligatio/jsSHA
src/sha_dev.js
safeAdd_32_5
function safeAdd_32_5(a, b, c, d, e) { var lsw = (a & 0xFFFF) + (b & 0xFFFF) + (c & 0xFFFF) + (d & 0xFFFF) + (e & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (c >>> 16) + (d >>> 16) + (e >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
javascript
function safeAdd_32_5(a, b, c, d, e) { var lsw = (a & 0xFFFF) + (b & 0xFFFF) + (c & 0xFFFF) + (d & 0xFFFF) + (e & 0xFFFF), msw = (a >>> 16) + (b >>> 16) + (c >>> 16) + (d >>> 16) + (e >>> 16) + (lsw >>> 16); return ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); }
[ "function", "safeAdd_32_5", "(", "a", ",", "b", ",", "c", ",", "d", ",", "e", ")", "{", "var", "lsw", "=", "(", "a", "&", "0xFFFF", ")", "+", "(", "b", "&", "0xFFFF", ")", "+", "(", "c", "&", "0xFFFF", ")", "+", "(", "d", "&", "0xFFFF", "...
Add five 32-bit integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {number} a The first 32-bit integer argument to be added @param {number} b The second 32-bit integer argument to be added @param {number} c The third 32-bit integer argument t...
[ "Add", "five", "32", "-", "bit", "integers", "wrapping", "at", "2^32", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1034-L1042
7,972
Caligatio/jsSHA
src/sha_dev.js
safeAdd_64_2
function safeAdd_64_2(x, y) { var lsw, msw, lowOrder, highOrder; lsw = (x.lowOrder & 0xFFFF) + (y.lowOrder & 0xFFFF); msw = (x.lowOrder >>> 16) + (y.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); lsw = (x.highOrder & 0xFFFF) + (y.highOrder & 0xFFFF) + (msw >>> 16); m...
javascript
function safeAdd_64_2(x, y) { var lsw, msw, lowOrder, highOrder; lsw = (x.lowOrder & 0xFFFF) + (y.lowOrder & 0xFFFF); msw = (x.lowOrder >>> 16) + (y.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFFF) << 16) | (lsw & 0xFFFF); lsw = (x.highOrder & 0xFFFF) + (y.highOrder & 0xFFFF) + (msw >>> 16); m...
[ "function", "safeAdd_64_2", "(", "x", ",", "y", ")", "{", "var", "lsw", ",", "msw", ",", "lowOrder", ",", "highOrder", ";", "lsw", "=", "(", "x", ".", "lowOrder", "&", "0xFFFF", ")", "+", "(", "y", ".", "lowOrder", "&", "0xFFFF", ")", ";", "msw",...
Add two 64-bit integers, wrapping at 2^64. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {Int_64} x The first 64-bit integer argument to be added @param {Int_64} y The second 64-bit integer argument to be added @return {Int_64} The sum of x + y
[ "Add", "two", "64", "-", "bit", "integers", "wrapping", "at", "2^64", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1053-L1066
7,973
Caligatio/jsSHA
src/sha_dev.js
safeAdd_64_4
function safeAdd_64_4(a, b, c, d) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFF...
javascript
function safeAdd_64_4(a, b, c, d) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (lsw >>> 16); lowOrder = ((msw & 0xFFF...
[ "function", "safeAdd_64_4", "(", "a", ",", "b", ",", "c", ",", "d", ")", "{", "var", "lsw", ",", "msw", ",", "lowOrder", ",", "highOrder", ";", "lsw", "=", "(", "a", ".", "lowOrder", "&", "0xFFFF", ")", "+", "(", "b", ".", "lowOrder", "&", "0xF...
Add four 64-bit integers, wrapping at 2^64. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {Int_64} a The first 64-bit integer argument to be added @param {Int_64} b The second 64-bit integer argument to be added @param {Int_64} c The third 64-bit integer argument t...
[ "Add", "four", "64", "-", "bit", "integers", "wrapping", "at", "2^64", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1079-L1096
7,974
Caligatio/jsSHA
src/sha_dev.js
safeAdd_64_5
function safeAdd_64_5(a, b, c, d, e) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF) + (e.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (e.lowOrde...
javascript
function safeAdd_64_5(a, b, c, d, e) { var lsw, msw, lowOrder, highOrder; lsw = (a.lowOrder & 0xFFFF) + (b.lowOrder & 0xFFFF) + (c.lowOrder & 0xFFFF) + (d.lowOrder & 0xFFFF) + (e.lowOrder & 0xFFFF); msw = (a.lowOrder >>> 16) + (b.lowOrder >>> 16) + (c.lowOrder >>> 16) + (d.lowOrder >>> 16) + (e.lowOrde...
[ "function", "safeAdd_64_5", "(", "a", ",", "b", ",", "c", ",", "d", ",", "e", ")", "{", "var", "lsw", ",", "msw", ",", "lowOrder", ",", "highOrder", ";", "lsw", "=", "(", "a", ".", "lowOrder", "&", "0xFFFF", ")", "+", "(", "b", ".", "lowOrder",...
Add five 64-bit integers, wrapping at 2^64. This uses 16-bit operations internally to work around bugs in some JS interpreters. @private @param {Int_64} a The first 64-bit integer argument to be added @param {Int_64} b The second 64-bit integer argument to be added @param {Int_64} c The third 64-bit integer argument t...
[ "Add", "five", "64", "-", "bit", "integers", "wrapping", "at", "2^64", ".", "This", "uses", "16", "-", "bit", "operations", "internally", "to", "work", "around", "bugs", "in", "some", "JS", "interpreters", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1110-L1131
7,975
Caligatio/jsSHA
src/sha_dev.js
xor_64_2
function xor_64_2(a, b) { return new Int_64( a.highOrder ^ b.highOrder, a.lowOrder ^ b.lowOrder ); }
javascript
function xor_64_2(a, b) { return new Int_64( a.highOrder ^ b.highOrder, a.lowOrder ^ b.lowOrder ); }
[ "function", "xor_64_2", "(", "a", ",", "b", ")", "{", "return", "new", "Int_64", "(", "a", ".", "highOrder", "^", "b", ".", "highOrder", ",", "a", ".", "lowOrder", "^", "b", ".", "lowOrder", ")", ";", "}" ]
XORs two given arguments. @private @param {Int_64} a First argument to be XORed @param {Int_64} b Second argument to be XORed @return {Int_64} The XOR of the arguments
[ "XORs", "two", "given", "arguments", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1141-L1147
7,976
Caligatio/jsSHA
src/sha_dev.js
xor_64_5
function xor_64_5(a, b, c, d, e) { return new Int_64( a.highOrder ^ b.highOrder ^ c.highOrder ^ d.highOrder ^ e.highOrder, a.lowOrder ^ b.lowOrder ^ c.lowOrder ^ d.lowOrder ^ e.lowOrder ); }
javascript
function xor_64_5(a, b, c, d, e) { return new Int_64( a.highOrder ^ b.highOrder ^ c.highOrder ^ d.highOrder ^ e.highOrder, a.lowOrder ^ b.lowOrder ^ c.lowOrder ^ d.lowOrder ^ e.lowOrder ); }
[ "function", "xor_64_5", "(", "a", ",", "b", ",", "c", ",", "d", ",", "e", ")", "{", "return", "new", "Int_64", "(", "a", ".", "highOrder", "^", "b", ".", "highOrder", "^", "c", ".", "highOrder", "^", "d", ".", "highOrder", "^", "e", ".", "highO...
XORs five given arguments. @private @param {Int_64} a First argument to be XORed @param {Int_64} b Second argument to be XORed @param {Int_64} c Third argument to be XORed @param {Int_64} d Fourth argument to be XORed @param {Int_64} e Fifth argument to be XORed @return {Int_64} The XOR of the arguments
[ "XORs", "five", "given", "arguments", "." ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1160-L1166
7,977
Caligatio/jsSHA
src/sha_dev.js
cloneSHA3State
function cloneSHA3State(state) { var clone = [], i; for (i = 0; i < 5; i += 1) { clone[i] = state[i].slice(); } return clone; }
javascript
function cloneSHA3State(state) { var clone = [], i; for (i = 0; i < 5; i += 1) { clone[i] = state[i].slice(); } return clone; }
[ "function", "cloneSHA3State", "(", "state", ")", "{", "var", "clone", "=", "[", "]", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "5", ";", "i", "+=", "1", ")", "{", "clone", "[", "i", "]", "=", "state", "[", "i", "]", ".", "s...
Returns a clone of the given SHA3 state @private @param {Array<Array<Int_64>>} state The state to be cloned @return {Array<Array<Int_64>>} The cloned state
[ "Returns", "a", "clone", "of", "the", "given", "SHA3", "state" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1175-L1183
7,978
Caligatio/jsSHA
src/sha_dev.js
getNewState
function getNewState(variant) { var retVal = [], H_trunc, H_full, i; if (("SHA-1" === variant) && ((1 & SUPPORTED_ALGS) !== 0)) { retVal = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; } else if ((variant.lastIndexOf("SHA-", 0) === 0) && ((6 & SUPPORTED_ALGS) !== 0)) { H_tru...
javascript
function getNewState(variant) { var retVal = [], H_trunc, H_full, i; if (("SHA-1" === variant) && ((1 & SUPPORTED_ALGS) !== 0)) { retVal = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; } else if ((variant.lastIndexOf("SHA-", 0) === 0) && ((6 & SUPPORTED_ALGS) !== 0)) { H_tru...
[ "function", "getNewState", "(", "variant", ")", "{", "var", "retVal", "=", "[", "]", ",", "H_trunc", ",", "H_full", ",", "i", ";", "if", "(", "(", "\"SHA-1\"", "===", "variant", ")", "&&", "(", "(", "1", "&", "SUPPORTED_ALGS", ")", "!==", "0", ")",...
Gets the state values for the specified SHA variant @param {string} variant The SHA variant @return {Array<number|Int_64|Array<null>>} The initial state values
[ "Gets", "the", "state", "values", "for", "the", "specified", "SHA", "variant" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1191-L1262
7,979
Caligatio/jsSHA
src/sha_dev.js
roundSHA1
function roundSHA1(block, H) { var W = [], a, b, c, d, e, T, ch = ch_32, parity = parity_32, maj = maj_32, rotl = rotl_32, safeAdd_2 = safeAdd_32_2, t, safeAdd_5 = safeAdd_32_5; a = H[0]; b = H[1]; c = H[2]; d = H[3]; e = H[4]; for (t = 0; t < 80; t += 1) { if (t < 16) { W[t] = block[...
javascript
function roundSHA1(block, H) { var W = [], a, b, c, d, e, T, ch = ch_32, parity = parity_32, maj = maj_32, rotl = rotl_32, safeAdd_2 = safeAdd_32_2, t, safeAdd_5 = safeAdd_32_5; a = H[0]; b = H[1]; c = H[2]; d = H[3]; e = H[4]; for (t = 0; t < 80; t += 1) { if (t < 16) { W[t] = block[...
[ "function", "roundSHA1", "(", "block", ",", "H", ")", "{", "var", "W", "=", "[", "]", ",", "a", ",", "b", ",", "c", ",", "d", ",", "e", ",", "T", ",", "ch", "=", "ch_32", ",", "parity", "=", "parity_32", ",", "maj", "=", "maj_32", ",", "rot...
Performs a round of SHA-1 hashing over a 512-byte block @private @param {Array<number>} block The binary array representation of the block to hash @param {Array<number>} H The intermediate H values from a previous round @return {Array<number>} The resulting H values
[ "Performs", "a", "round", "of", "SHA", "-", "1", "hashing", "over", "a", "512", "-", "byte", "block" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1274-L1326
7,980
Caligatio/jsSHA
src/sha_dev.js
finalizeSHA1
function finalizeSHA1(remainder, remainderBinLen, processedBinLen, H, outputLen) { var i, appendedMessageLength, offset, totalLen; /* The 65 addition is a hack but it works. The correct number is actually 72 (64 + 8) but the below math fails if remainderBinLen + 72 % 512 = 0. Since remainderBinLen % 8 ...
javascript
function finalizeSHA1(remainder, remainderBinLen, processedBinLen, H, outputLen) { var i, appendedMessageLength, offset, totalLen; /* The 65 addition is a hack but it works. The correct number is actually 72 (64 + 8) but the below math fails if remainderBinLen + 72 % 512 = 0. Since remainderBinLen % 8 ...
[ "function", "finalizeSHA1", "(", "remainder", ",", "remainderBinLen", ",", "processedBinLen", ",", "H", ",", "outputLen", ")", "{", "var", "i", ",", "appendedMessageLength", ",", "offset", ",", "totalLen", ";", "/* The 65 addition is a hack but it works. The correct nu...
Finalizes the SHA-1 hash @private @param {Array<number>} remainder Any leftover unprocessed packed ints that still need to be processed @param {number} remainderBinLen The number of bits in remainder @param {number} processedBinLen The number of bits already processed @param {Array<number>} H The intermediate H values...
[ "Finalizes", "the", "SHA", "-", "1", "hash" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1343-L1378
7,981
Caligatio/jsSHA
src/sha_dev.js
finalizeSHA3
function finalizeSHA3(remainder, remainderBinLen, processedBinLen, state, blockSize, delimiter, outputLen) { var i, retVal = [], binaryStringInc = blockSize >>> 5, state_offset = 0, remainderIntLen = remainderBinLen >>> 5, temp; /* Process as many blocks as possible, some may be here for multiple rounds ...
javascript
function finalizeSHA3(remainder, remainderBinLen, processedBinLen, state, blockSize, delimiter, outputLen) { var i, retVal = [], binaryStringInc = blockSize >>> 5, state_offset = 0, remainderIntLen = remainderBinLen >>> 5, temp; /* Process as many blocks as possible, some may be here for multiple rounds ...
[ "function", "finalizeSHA3", "(", "remainder", ",", "remainderBinLen", ",", "processedBinLen", ",", "state", ",", "blockSize", ",", "delimiter", ",", "outputLen", ")", "{", "var", "i", ",", "retVal", "=", "[", "]", ",", "binaryStringInc", "=", "blockSize", ">...
Finalizes the SHA-3 hash @private @param {Array<number>} remainder Any leftover unprocessed packed ints that still need to be processed @param {number} remainderBinLen The number of bits in remainder @param {number} processedBinLen The number of bits already processed @param {Array<Array<Int_64>>} state The state from...
[ "Finalizes", "the", "SHA", "-", "3", "hash" ]
766f8ff7d926347b008a252a41b06565df747ac5
https://github.com/Caligatio/jsSHA/blob/766f8ff7d926347b008a252a41b06565df747ac5/src/sha_dev.js#L1799-L1848
7,982
solkimicreb/react-easy-state
src/scheduler.js
batchMethod
function batchMethod (obj, method) { const descriptor = Object.getOwnPropertyDescriptor(obj, method) if (descriptor) { const newDescriptor = Object.assign({}, descriptor, { set (value) { return descriptor.set.call(this, batchFn(value)) } }) Object.defineProperty(obj, method, newDescr...
javascript
function batchMethod (obj, method) { const descriptor = Object.getOwnPropertyDescriptor(obj, method) if (descriptor) { const newDescriptor = Object.assign({}, descriptor, { set (value) { return descriptor.set.call(this, batchFn(value)) } }) Object.defineProperty(obj, method, newDescr...
[ "function", "batchMethod", "(", "obj", ",", "method", ")", "{", "const", "descriptor", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "obj", ",", "method", ")", "if", "(", "descriptor", ")", "{", "const", "newDescriptor", "=", "Object", ".", "assign", ...
batches obj.onevent = fn like calls
[ "batches", "obj", ".", "onevent", "=", "fn", "like", "calls" ]
cb9694cab826c35c9fa4ac232eb1758d05342cd2
https://github.com/solkimicreb/react-easy-state/blob/cb9694cab826c35c9fa4ac232eb1758d05342cd2/src/scheduler.js#L41-L51
7,983
erikbrinkman/d3-dag
src/dag/equals.js
toSet
function toSet(arr) { const set = {}; arr.forEach((e) => (set[e] = true)); return set; }
javascript
function toSet(arr) { const set = {}; arr.forEach((e) => (set[e] = true)); return set; }
[ "function", "toSet", "(", "arr", ")", "{", "const", "set", "=", "{", "}", ";", "arr", ".", "forEach", "(", "(", "e", ")", "=>", "(", "set", "[", "e", "]", "=", "true", ")", ")", ";", "return", "set", ";", "}" ]
Compare two dag_like objects for equality
[ "Compare", "two", "dag_like", "objects", "for", "equality" ]
26c84107c51585c9b0111fd68f91955be87d25e4
https://github.com/erikbrinkman/d3-dag/blob/26c84107c51585c9b0111fd68f91955be87d25e4/src/dag/equals.js#L2-L6
7,984
erikbrinkman/d3-dag
src/dag/index.js
copy
function copy() { const nodes = []; const cnodes = []; const mapping = {}; this.each((node) => { nodes.push(node); const cnode = new Node(node.id, node.data); cnodes.push(cnode); mapping[cnode.id] = cnode; }); cnodes.forEach((cnode, i) => { const node = nodes[i]; cnode.children = no...
javascript
function copy() { const nodes = []; const cnodes = []; const mapping = {}; this.each((node) => { nodes.push(node); const cnode = new Node(node.id, node.data); cnodes.push(cnode); mapping[cnode.id] = cnode; }); cnodes.forEach((cnode, i) => { const node = nodes[i]; cnode.children = no...
[ "function", "copy", "(", ")", "{", "const", "nodes", "=", "[", "]", ";", "const", "cnodes", "=", "[", "]", ";", "const", "mapping", "=", "{", "}", ";", "this", ".", "each", "(", "(", "node", ")", "=>", "{", "nodes", ".", "push", "(", "node", ...
Must be internal for new Node creation Copy this dag returning a new DAG pointing to the same data with same structure.
[ "Must", "be", "internal", "for", "new", "Node", "creation", "Copy", "this", "dag", "returning", "a", "new", "DAG", "pointing", "to", "the", "same", "data", "with", "same", "structure", "." ]
26c84107c51585c9b0111fd68f91955be87d25e4
https://github.com/erikbrinkman/d3-dag/blob/26c84107c51585c9b0111fd68f91955be87d25e4/src/dag/index.js#L30-L52
7,985
stellarterm/stellarterm
api/functions/history.js
getLumenPrice
function getLumenPrice() { return Promise.all([ rp('https://poloniex.com/public?command=returnTicker') .then(data => { return parseFloat(JSON.parse(data).BTC_STR.last); }) .catch(() => { return null; }) , rp('https://bittrex.com/api/v1.1/public/getticker?market=BTC-...
javascript
function getLumenPrice() { return Promise.all([ rp('https://poloniex.com/public?command=returnTicker') .then(data => { return parseFloat(JSON.parse(data).BTC_STR.last); }) .catch(() => { return null; }) , rp('https://bittrex.com/api/v1.1/public/getticker?market=BTC-...
[ "function", "getLumenPrice", "(", ")", "{", "return", "Promise", ".", "all", "(", "[", "rp", "(", "'https://poloniex.com/public?command=returnTicker'", ")", ".", "then", "(", "data", "=>", "{", "return", "parseFloat", "(", "JSON", ".", "parse", "(", "data", ...
Get lumen price in terms of btc
[ "Get", "lumen", "price", "in", "terms", "of", "btc" ]
4d6125088be80fed230a1f71b9d8a26b2b7d443e
https://github.com/stellarterm/stellarterm/blob/4d6125088be80fed230a1f71b9d8a26b2b7d443e/api/functions/history.js#L140-L169
7,986
apache/cordova-cli
src/telemetry.js
showPrompt
function showPrompt () { return new Promise(function (resolve, reject) { var msg = 'May Cordova anonymously report usage statistics to improve the tool over time?'; insight._permissionTimeout = module.exports.timeoutInSecs || 30; insight.askPermission(msg, function (unused, optIn) { ...
javascript
function showPrompt () { return new Promise(function (resolve, reject) { var msg = 'May Cordova anonymously report usage statistics to improve the tool over time?'; insight._permissionTimeout = module.exports.timeoutInSecs || 30; insight.askPermission(msg, function (unused, optIn) { ...
[ "function", "showPrompt", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "msg", "=", "'May Cordova anonymously report usage statistics to improve the tool over time?'", ";", "insight", ".", "_permissionTimeout...
Returns true if the user opted in, and false otherwise
[ "Returns", "true", "if", "the", "user", "opted", "in", "and", "false", "otherwise" ]
7c4b092779e82f02c0fb7ad40d70483310601e37
https://github.com/apache/cordova-cli/blob/7c4b092779e82f02c0fb7ad40d70483310601e37/src/telemetry.js#L34-L51
7,987
intljusticemission/react-big-calendar
src/utils/DayEventLayout.js
onSameRow
function onSameRow(a, b, minimumStartDifference) { return ( // Occupies the same start slot. Math.abs(b.start - a.start) < minimumStartDifference || // A's start slot overlaps with b's end slot. (b.start > a.start && b.start < a.end) ) }
javascript
function onSameRow(a, b, minimumStartDifference) { return ( // Occupies the same start slot. Math.abs(b.start - a.start) < minimumStartDifference || // A's start slot overlaps with b's end slot. (b.start > a.start && b.start < a.end) ) }
[ "function", "onSameRow", "(", "a", ",", "b", ",", "minimumStartDifference", ")", "{", "return", "(", "// Occupies the same start slot.", "Math", ".", "abs", "(", "b", ".", "start", "-", "a", ".", "start", ")", "<", "minimumStartDifference", "||", "// A's start...
Return true if event a and b is considered to be on the same row.
[ "Return", "true", "if", "event", "a", "and", "b", "is", "considered", "to", "be", "on", "the", "same", "row", "." ]
5d9a16faf3568cef22970b7d6992c33f7a95bc33
https://github.com/intljusticemission/react-big-calendar/blob/5d9a16faf3568cef22970b7d6992c33f7a95bc33/src/utils/DayEventLayout.js#L92-L99
7,988
segmentio/evergreen
src/theme/src/withTheme.js
withTheme
function withTheme(WrappedComponent) { const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component' return class extends React.Component { static displayName = `withTheme(${displayName})` render() { return ( <ThemeConsumer> {theme => <WrappedComponen...
javascript
function withTheme(WrappedComponent) { const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component' return class extends React.Component { static displayName = `withTheme(${displayName})` render() { return ( <ThemeConsumer> {theme => <WrappedComponen...
[ "function", "withTheme", "(", "WrappedComponent", ")", "{", "const", "displayName", "=", "WrappedComponent", ".", "displayName", "||", "WrappedComponent", ".", "name", "||", "'Component'", "return", "class", "extends", "React", ".", "Component", "{", "static", "di...
HOC that uses ThemeConsumer. @param {React.Component} WrappedComponent - Component that gets theme.
[ "HOC", "that", "uses", "ThemeConsumer", "." ]
8c48fa7dccce80018a29b8c6857c9915256897ec
https://github.com/segmentio/evergreen/blob/8c48fa7dccce80018a29b8c6857c9915256897ec/src/theme/src/withTheme.js#L8-L23
7,989
kazupon/vue-i18n
dist/vue-i18n.esm.js
stripQuotes
function stripQuotes (str) { var a = str.charCodeAt(0); var b = str.charCodeAt(str.length - 1); return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str }
javascript
function stripQuotes (str) { var a = str.charCodeAt(0); var b = str.charCodeAt(str.length - 1); return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str }
[ "function", "stripQuotes", "(", "str", ")", "{", "var", "a", "=", "str", ".", "charCodeAt", "(", "0", ")", ";", "var", "b", "=", "str", ".", "charCodeAt", "(", "str", ".", "length", "-", "1", ")", ";", "return", "a", "===", "b", "&&", "(", "a",...
Strip quotes from a string
[ "Strip", "quotes", "from", "a", "string" ]
d28e3b25d9bd9eac51fc3714a4a2940772d85c3d
https://github.com/kazupon/vue-i18n/blob/d28e3b25d9bd9eac51fc3714a4a2940772d85c3d/dist/vue-i18n.esm.js#L841-L847
7,990
kazupon/vue-i18n
dist/vue-i18n.esm.browser.js
getPathCharType
function getPathCharType (ch) { if (ch === undefined || ch === null) { return 'eof' } const code = ch.charCodeAt(0); switch (code) { case 0x5B: // [ case 0x5D: // ] case 0x2E: // . case 0x22: // " case 0x27: // ' return ch case 0x5F: // _ case 0x24: // $ case 0x2D: // - ...
javascript
function getPathCharType (ch) { if (ch === undefined || ch === null) { return 'eof' } const code = ch.charCodeAt(0); switch (code) { case 0x5B: // [ case 0x5D: // ] case 0x2E: // . case 0x22: // " case 0x27: // ' return ch case 0x5F: // _ case 0x24: // $ case 0x2D: // - ...
[ "function", "getPathCharType", "(", "ch", ")", "{", "if", "(", "ch", "===", "undefined", "||", "ch", "===", "null", ")", "{", "return", "'eof'", "}", "const", "code", "=", "ch", ".", "charCodeAt", "(", "0", ")", ";", "switch", "(", "code", ")", "{"...
Determine the type of a character in a keypath.
[ "Determine", "the", "type", "of", "a", "character", "in", "a", "keypath", "." ]
d28e3b25d9bd9eac51fc3714a4a2940772d85c3d
https://github.com/kazupon/vue-i18n/blob/d28e3b25d9bd9eac51fc3714a4a2940772d85c3d/dist/vue-i18n.esm.browser.js#L814-L843
7,991
kazupon/vue-i18n
dist/vue-i18n.esm.browser.js
parse$1
function parse$1 (path) { const keys = []; let index = -1; let mode = BEFORE_PATH; let subPathDepth = 0; let c; let key; let newChar; let type; let transition; let action; let typeMap; const actions = []; actions[PUSH] = function () { if (key !== undefined) { keys.push(key); k...
javascript
function parse$1 (path) { const keys = []; let index = -1; let mode = BEFORE_PATH; let subPathDepth = 0; let c; let key; let newChar; let type; let transition; let action; let typeMap; const actions = []; actions[PUSH] = function () { if (key !== undefined) { keys.push(key); k...
[ "function", "parse$1", "(", "path", ")", "{", "const", "keys", "=", "[", "]", ";", "let", "index", "=", "-", "1", ";", "let", "mode", "=", "BEFORE_PATH", ";", "let", "subPathDepth", "=", "0", ";", "let", "c", ";", "let", "key", ";", "let", "newCh...
Parse a string path into an array of segments
[ "Parse", "a", "string", "path", "into", "an", "array", "of", "segments" ]
d28e3b25d9bd9eac51fc3714a4a2940772d85c3d
https://github.com/kazupon/vue-i18n/blob/d28e3b25d9bd9eac51fc3714a4a2940772d85c3d/dist/vue-i18n.esm.browser.js#L863-L956
7,992
dundalek/markmap
lib/d3-flextree.js
wrapTree
function wrapTree(t) { var wt = { t: t, prelim: 0, mod: 0, shift: 0, change: 0, msel: 0, mser: 0, }; t.x = 0; t.y = 0; if (size) { wt.x_size = 1; wt.y_size = 1; } else if (typeof nodeSize == "object") { // fixed array wt.x_size =...
javascript
function wrapTree(t) { var wt = { t: t, prelim: 0, mod: 0, shift: 0, change: 0, msel: 0, mser: 0, }; t.x = 0; t.y = 0; if (size) { wt.x_size = 1; wt.y_size = 1; } else if (typeof nodeSize == "object") { // fixed array wt.x_size =...
[ "function", "wrapTree", "(", "t", ")", "{", "var", "wt", "=", "{", "t", ":", "t", ",", "prelim", ":", "0", ",", "mod", ":", "0", ",", "shift", ":", "0", ",", "change", ":", "0", ",", "msel", ":", "0", ",", "mser", ":", "0", ",", "}", ";",...
Every node in the tree is wrapped in an object that holds data used during the algorithm
[ "Every", "node", "in", "the", "tree", "is", "wrapped", "in", "an", "object", "that", "holds", "data", "used", "during", "the", "algorithm" ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L54-L93
7,993
dundalek/markmap
lib/d3-flextree.js
zerothWalk
function zerothWalk(wt, initial) { wt.t.y = initial; wt.t.depth = 0; _zerothWalk(wt); }
javascript
function zerothWalk(wt, initial) { wt.t.y = initial; wt.t.depth = 0; _zerothWalk(wt); }
[ "function", "zerothWalk", "(", "wt", ",", "initial", ")", "{", "wt", ".", "t", ".", "y", "=", "initial", ";", "wt", ".", "t", ".", "depth", "=", "0", ";", "_zerothWalk", "(", "wt", ")", ";", "}" ]
Recursively set the y coordinate of the children, based on the y coordinate of the parent, and its height. Also set parent and depth.
[ "Recursively", "set", "the", "y", "coordinate", "of", "the", "children", "based", "on", "the", "y", "coordinate", "of", "the", "parent", "and", "its", "height", ".", "Also", "set", "parent", "and", "depth", "." ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L98-L102
7,994
dundalek/markmap
lib/d3-flextree.js
setRightThread
function setRightThread(wt, i, sr, modsumsr) { var ri = wt.children[i].er; ri.tr = sr; var diff = (modsumsr - sr.mod) - wt.children[i].mser; ri.mod += diff; ri.prelim -= diff; wt.children[i].er = wt.children[i - 1].er; wt.children[i].mser = wt.children[i - 1].mser; }
javascript
function setRightThread(wt, i, sr, modsumsr) { var ri = wt.children[i].er; ri.tr = sr; var diff = (modsumsr - sr.mod) - wt.children[i].mser; ri.mod += diff; ri.prelim -= diff; wt.children[i].er = wt.children[i - 1].er; wt.children[i].mser = wt.children[i - 1].mser; }
[ "function", "setRightThread", "(", "wt", ",", "i", ",", "sr", ",", "modsumsr", ")", "{", "var", "ri", "=", "wt", ".", "children", "[", "i", "]", ".", "er", ";", "ri", ".", "tr", "=", "sr", ";", "var", "diff", "=", "(", "modsumsr", "-", "sr", ...
Symmetrical to setLeftThread.
[ "Symmetrical", "to", "setLeftThread", "." ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L250-L258
7,995
dundalek/markmap
lib/d3-flextree.js
positionRoot
function positionRoot(wt) { wt.prelim = ( wt.children[0].prelim + wt.children[0].mod - wt.children[0].x_size/2 + wt.children[wt.num_children - 1].mod + wt.children[wt.num_children - 1].prelim + wt.children[wt.num_children - ...
javascript
function positionRoot(wt) { wt.prelim = ( wt.children[0].prelim + wt.children[0].mod - wt.children[0].x_size/2 + wt.children[wt.num_children - 1].mod + wt.children[wt.num_children - 1].prelim + wt.children[wt.num_children - ...
[ "function", "positionRoot", "(", "wt", ")", "{", "wt", ".", "prelim", "=", "(", "wt", ".", "children", "[", "0", "]", ".", "prelim", "+", "wt", ".", "children", "[", "0", "]", ".", "mod", "-", "wt", ".", "children", "[", "0", "]", ".", "x_size"...
Position root between children, taking into account their mod.
[ "Position", "root", "between", "children", "taking", "into", "account", "their", "mod", "." ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L261-L268
7,996
dundalek/markmap
lib/d3-flextree.js
addChildSpacing
function addChildSpacing(wt) { var d = 0, modsumdelta = 0; for (var i = 0; i < wt.num_children; i++) { d += wt.children[i].shift; modsumdelta += d + wt.children[i].change; ...
javascript
function addChildSpacing(wt) { var d = 0, modsumdelta = 0; for (var i = 0; i < wt.num_children; i++) { d += wt.children[i].shift; modsumdelta += d + wt.children[i].change; ...
[ "function", "addChildSpacing", "(", "wt", ")", "{", "var", "d", "=", "0", ",", "modsumdelta", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "wt", ".", "num_children", ";", "i", "++", ")", "{", "d", "+=", "wt", ".", "children",...
Process change and shift to add intermediate spacing to mod.
[ "Process", "change", "and", "shift", "to", "add", "intermediate", "spacing", "to", "mod", "." ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L290-L297
7,997
dundalek/markmap
lib/d3-flextree.js
renormalize
function renormalize(wt) { // If a fixed tree size is specified, scale x and y based on the extent. // Compute the left-most, right-most, and depth-most nodes for extents. if (size != null) { var left = wt, right = wt, bottom = wt; var toVisit = [wt], node; w...
javascript
function renormalize(wt) { // If a fixed tree size is specified, scale x and y based on the extent. // Compute the left-most, right-most, and depth-most nodes for extents. if (size != null) { var left = wt, right = wt, bottom = wt; var toVisit = [wt], node; w...
[ "function", "renormalize", "(", "wt", ")", "{", "// If a fixed tree size is specified, scale x and y based on the extent.", "// Compute the left-most, right-most, and depth-most nodes for extents.", "if", "(", "size", "!=", "null", ")", "{", "var", "left", "=", "wt", ",", "ri...
Renormalize the coordinates
[ "Renormalize", "the", "coordinates" ]
c09614be60676725ccbc1cfd161f07aa7269e5c9
https://github.com/dundalek/markmap/blob/c09614be60676725ccbc1cfd161f07aa7269e5c9/lib/d3-flextree.js#L313-L357
7,998
contentful/contentful.js
lib/paged-sync.js
getSyncPage
function getSyncPage (http, items, query, { paginate }) { if (query.nextSyncToken) { query.sync_token = query.nextSyncToken delete query.nextSyncToken } if (query.nextPageToken) { query.sync_token = query.nextPageToken delete query.nextPageToken } if (query.sync_token) { delete query.ini...
javascript
function getSyncPage (http, items, query, { paginate }) { if (query.nextSyncToken) { query.sync_token = query.nextSyncToken delete query.nextSyncToken } if (query.nextPageToken) { query.sync_token = query.nextPageToken delete query.nextPageToken } if (query.sync_token) { delete query.ini...
[ "function", "getSyncPage", "(", "http", ",", "items", ",", "query", ",", "{", "paginate", "}", ")", "{", "if", "(", "query", ".", "nextSyncToken", ")", "{", "query", ".", "sync_token", "=", "query", ".", "nextSyncToken", "delete", "query", ".", "nextSync...
If the response contains a nextPageUrl, extracts the sync token to get the next page and calls itself again with that token. Otherwise, if the response contains a nextSyncUrl, extracts the sync token and returns it. On each call of this function, any retrieved items are collected in the supplied items array, which gets...
[ "If", "the", "response", "contains", "a", "nextPageUrl", "extracts", "the", "sync", "token", "to", "get", "the", "next", "page", "and", "calls", "itself", "again", "with", "that", "token", ".", "Otherwise", "if", "the", "response", "contains", "a", "nextSync...
0a3cd39b0b39b554129ec699024bfd09558c29a9
https://github.com/contentful/contentful.js/blob/0a3cd39b0b39b554129ec699024bfd09558c29a9/lib/paged-sync.js#L128-L166
7,999
downshift-js/downshift
src/utils.js
scrollIntoView
function scrollIntoView(node, menuNode) { if (node === null) { return } const actions = computeScrollIntoView(node, { boundary: menuNode, block: 'nearest', scrollMode: 'if-needed', }) actions.forEach(({el, top, left}) => { el.scrollTop = top el.scrollLeft = left }) }
javascript
function scrollIntoView(node, menuNode) { if (node === null) { return } const actions = computeScrollIntoView(node, { boundary: menuNode, block: 'nearest', scrollMode: 'if-needed', }) actions.forEach(({el, top, left}) => { el.scrollTop = top el.scrollLeft = left }) }
[ "function", "scrollIntoView", "(", "node", ",", "menuNode", ")", "{", "if", "(", "node", "===", "null", ")", "{", "return", "}", "const", "actions", "=", "computeScrollIntoView", "(", "node", ",", "{", "boundary", ":", "menuNode", ",", "block", ":", "'ne...
Scroll node into view if necessary @param {HTMLElement} node the element that should scroll into view @param {HTMLElement} menuNode the menu element of the component
[ "Scroll", "node", "into", "view", "if", "necessary" ]
7dc7a5b4a06c640f0c375878b78b82b65119f89b
https://github.com/downshift-js/downshift/blob/7dc7a5b4a06c640f0c375878b78b82b65119f89b/src/utils.js#L25-L39