code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function jscoverage_findPos(obj) { var result = 0; do { result += obj.offsetTop; obj = obj.offsetParent; } while (obj); return result; }
Initializes the _$jscoverage object in a window. This should be the first function called in the page. @param w this should always be the global window object
jscoverage_findPos
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_getViewportHeight() { //#JSCOVERAGE_IF /MSIE/.test(navigator.userAgent) if (self.innerHeight) { // all except Explorer return self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode return document.documentElem...
Initializes the _$jscoverage object in a window. This should be the first function called in the page. @param w this should always be the global window object
jscoverage_getViewportHeight
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_beginLengthyOperation() { jscoverage_inLengthyOperation = true; /* blacklist buggy browsers */ //#JSCOVERAGE_IF if (! /Opera|WebKit/.test(navigator.userAgent)) { /* Change the cursor style of each element. Note that changing the class of the element (to one with a busy cursor) is...
Indicates visually that a lengthy operation has begun. The progress bar is displayed, and the cursor is changed to busy (on browsers which support this).
jscoverage_beginLengthyOperation
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_endLengthyOperation() { setTimeout(function() { jscoverage_inLengthyOperation = false; var tabs = document.getElementById('tabs').getElementsByTagName('div'); var i; for (i = 0; i < tabs.length; i++) { tabs.item(i).style.cursor = ''; } }, 50); }
Removes the progress bar and busy cursor.
jscoverage_endLengthyOperation
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_setSize() { //#JSCOVERAGE_IF /MSIE/.test(navigator.userAgent) var viewportHeight = jscoverage_getViewportHeight(); /* border-top-width: 1px padding-top: 10px padding-bottom: 10px border-bottom-width: 1px margin-bottom: 10px ---- ...
Removes the progress bar and busy cursor.
jscoverage_setSize
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_getBooleanValue(s) { s = s.toLowerCase(); if (s === 'false' || s === 'f' || s === 'no' || s === 'n' || s === 'off' || s === '0') { return false; } return true; }
Returns the boolean value of a string. Values 'false', 'f', 'no', 'n', 'off', and '0' (upper or lower case) are false. @param s the string @return a boolean value
jscoverage_getBooleanValue
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_removeTab(id) { var tab = document.getElementById(id + 'Tab'); if(tab){ tab.parentNode.removeChild(tab); } var tabPage = document.getElementById(id + 'TabPage'); if(tabPage){ tabPage.parentNode.removeChild(tabPage); } }
Returns the boolean value of a string. Values 'false', 'f', 'no', 'n', 'off', and '0' (upper or lower case) are false. @param s the string @return a boolean value
jscoverage_removeTab
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_isValidURL(url) { // RFC 3986 var matches = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(url); if (matches === null) { return false; } var scheme = matches[1]; if (typeof scheme === 'string') { scheme = scheme.toLowerCase(); return scheme === '' || sch...
Returns the boolean value of a string. Values 'false', 'f', 'no', 'n', 'off', and '0' (upper or lower case) are false. @param s the string @return a boolean value
jscoverage_isValidURL
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_initTabContents(queryString) { var showMissingColumn = false; var url = null; var windowURL = null; var parameters, parameter, i, index, name, value; if (queryString.length > 0) { // chop off the question mark queryString = queryString.substring(1); parameters = queryString.spl...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_initTabContents
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
isValidURL = function (url) { var result = jscoverage_isValidURL(url); if (! result) { alert('Invalid URL: ' + url); } return result; }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
isValidURL
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_body_load() { function reportError(e) { jscoverage_endLengthyOperation(); var summaryThrobber = document.getElementById('summaryThrobber'); summaryThrobber.style.visibility = 'hidden'; var div = document.getElementById('summaryErrorDiv'); div.innerHTML = 'Error: ' + e; } ...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_body_load
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function reportError(e) { jscoverage_endLengthyOperation(); var summaryThrobber = document.getElementById('summaryThrobber'); summaryThrobber.style.visibility = 'hidden'; var div = document.getElementById('summaryErrorDiv'); div.innerHTML = 'Error: ' + e; }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
reportError
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_body_resize() { if (/MSIE/.test(navigator.userAgent)) { jscoverage_setSize(); } }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_body_resize
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_updateBrowser() { var input = document.getElementById("location"); frames[0].location = input.value; }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_updateBrowser
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_openWindow() { var input = document.getElementById("location"); var url = input.value; window.open(url,'jscoverage_window'); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_openWindow
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_input_keypress(e) { if (e.keyCode === 13) { if (e.shiftKey) { jscoverage_openWindow(); } else { jscoverage_updateBrowser(); } } }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_input_keypress
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_browser_load() { /* update the input box */ var input = document.getElementById("location"); /* sometimes IE seems to fire this after the tab has been removed */ if (input) { input.value = frames[0].location; } }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_browser_load
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_createHandler(file, line) { return function () { jscoverage_get(file, line); return false; }; }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_createHandler
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_createLink(file, line) { var link = document.createElement("a"); link.href = '#'+file; link.onclick = jscoverage_createHandler(file, line); var text; if (line) { text = line.toString(); } else { text = file; } link.appendChild(document.createTextNode(text)); return lin...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_createLink
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_recalculateSummaryTabBy(type) { sortReOrder = true; if (sortColumn !== type) sortOrder = 1; sortColumn = type; jscoverage_recalculateSummaryTab(null); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_recalculateSummaryTabBy
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_recalculateSummaryTab(cc) { var checkbox = document.getElementById('checkbox'); var showMissingColumn = checkbox.checked; if (! cc) { cc = window._$jscoverage; } if (! cc) { //#JSCOVERAGE_IF 0 throw "No coverage information found."; //#JSCOVERAGE_ENDIF } var totals = { files:...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_recalculateSummaryTab
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function getFilesSortedByCoverage(filesIn) { var tbody = document.getElementById("summaryTbody"); if (tbody.children.length < 2) { sortOrder=1; return filesIn; } var files = []; for (var i=0;i<tbody.children.length;i++) { files[i] = {}; files[i].file = tbody.children[i].children[0].children[0]....
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
getFilesSortedByCoverage
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_appendMissingColumn() { var headerRow = document.getElementById('headerRow'); var missingHeader = document.createElement('th'); missingHeader.id = 'missingHeader'; missingHeader.innerHTML = '<abbr title="List of statements missed during execution">Missing</abbr>'; headerRow.appendChild(mis...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_appendMissingColumn
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_removeMissingColumn() { var missingNode; missingNode = document.getElementById('missingHeader'); missingNode.parentNode.removeChild(missingNode); missingNode = document.getElementById('missingCell'); missingNode.parentNode.removeChild(missingNode); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_removeMissingColumn
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_checkbox_click() { if (jscoverage_inLengthyOperation) { return false; } jscoverage_beginLengthyOperation(); var checkbox = document.getElementById('checkbox'); var showMissingColumn = checkbox.checked; setTimeout(function() { if (showMissingColumn) { jscoverage_appendMissin...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_checkbox_click
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function encodeHTML(str){ return String(str) .replace(/&/g, '&amp;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;') .replace(/`/g, '&#96;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
encodeHTML
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_makeTable() { var fileInfo = _$jscoverage[jscoverage_currentFile]; var coverage = fileInfo.lineData; var branchData = fileInfo.branchData; var lines = fileInfo.source; // this can happen if there is an error in the original JavaScript file if (! lines) { lines = []; } var rows ...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_makeTable
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function joinTableRows() { tableHTML = rows.join(''); /* This may be a long delay, so set a timeout of 100 ms to make sure the display is updated. */ setTimeout(function() {appendTable(jscoverage_currentFile);}, 100); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
joinTableRows
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function appendTable(jscoverage_currentFile) { var sourceDiv = document.getElementById('sourceDiv'); sourceDiv.innerHTML = tableHTML; setTimeout(jscoverage_scrollToLine, 0); }
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
appendTable
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_scrollToLine() { jscoverage_selectTab('sourceTab'); if (! window.jscoverage_currentLine) { jscoverage_endLengthyOperation(); return; } var div = document.getElementById('sourceDiv'); if (jscoverage_currentLine === 1) { div.scrollTop = 0; } else { var cell = document.get...
Initializes the contents of the tabs. This sets the initial values of the input field and iframe in the "Browser" tab and the checkbox in the "Summary" tab. @param queryString this should always be location.search
jscoverage_scrollToLine
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_get(file, line) { if (jscoverage_inLengthyOperation) { return; } jscoverage_beginLengthyOperation(); setTimeout(function() { var sourceDiv = document.getElementById('sourceDiv'); sourceDiv.innerHTML = ''; jscoverage_selectTab('sourceTab'); if (file === jscoverage_currentF...
Loads the given file (and optional line) in the source tab.
jscoverage_get
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_recalculateSourceTab() { if (! jscoverage_currentFile) { jscoverage_endLengthyOperation(); return; } setTimeout(jscoverage_makeTable, 0); }
Calculates coverage statistics for the current source file.
jscoverage_recalculateSourceTab
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_initTabControl() { var tabs = document.getElementById('tabs'); var i; var child; var tabNum = 0; for (i = 0; i < tabs.childNodes.length; i++) { child = tabs.childNodes.item(i); if (child.nodeType === 1) { if (child.className !== 'disabled') { child.onclick = jscoverag...
Initializes the tab control. This function must be called when the document is loaded.
jscoverage_initTabControl
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_selectTab(tab) { if (typeof tab !== 'number') { tab = jscoverage_tabIndexOf(tab); } var tabs = document.getElementById('tabs'); var tabPages = document.getElementById('tabPages'); var nodeList; var tabNum; var i; var node; nodeList = tabs.childNodes; tabNum = 0; for (i = 0...
Selects a tab. @param tab the integer index of the tab (0, 1, 2, or 3) OR the ID of the tab element OR the tab element itself
jscoverage_selectTab
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_tabIndexOf(tab) { if (typeof tab === 'string') { tab = document.getElementById(tab); } var tabs = document.getElementById('tabs'); var i; var child; var tabNum = 0; for (i = 0; i < tabs.childNodes.length; i++) { child = tabs.childNodes.item(i); if (child.nodeType === 1) { ...
Returns an integer (0, 1, 2, or 3) representing the index of a given tab. @param tab the ID of the tab element OR the tab element itself
jscoverage_tabIndexOf
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_tab_click(e) { if (jscoverage_inLengthyOperation) { return; } var target; //#JSCOVERAGE_IF if (e) { target = e.target; } else if (window.event) { // IE target = window.event.srcElement; } if (target.className === 'selected') { return; } jscoverage_beginLengthy...
Returns an integer (0, 1, 2, or 3) representing the index of a given tab. @param tab the ID of the tab element OR the tab element itself
jscoverage_tab_click
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_storeButton_click() { if (jscoverage_inLengthyOperation) { return; } jscoverage_beginLengthyOperation(); var img = document.getElementById('storeImg'); img.style.visibility = 'visible'; var request = jscoverage_createRequest(); request.open('POST', '/jscoverage-store', true); r...
Returns an integer (0, 1, 2, or 3) representing the index of a given tab. @param tab the ID of the tab element OR the tab element itself
jscoverage_storeButton_click
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
function jscoverage_stopButton_click() { if (jscoverage_inLengthyOperation) { return; } jscoverage_beginLengthyOperation(); var img = document.getElementById('storeImg'); img.style.visibility = 'visible'; var request = jscoverage_createRequest(); request.open('GET', '/stop', true); request.onready...
Returns an integer (0, 1, 2, or 3) representing the index of a given tab. @param tab the ID of the tab element OR the tab element itself
jscoverage_stopButton_click
javascript
alibaba/f2etest
f2etest-web/public/jscover/jscoverage.js
https://github.com/alibaba/f2etest/blob/master/f2etest-web/public/jscover/jscoverage.js
MIT
constructor() { this.emitter = createNanoEvents(); /** @type {HTMLFormElement | null} */ this.container = null; domReady.then(() => { this.container = document.querySelector('.view-toggler'); // stop browsers remembering previous form state this.container.output[0].checked = true; ...
Tabs that toggle between showing the SVG image and XML markup.
constructor
javascript
jakearchibald/svgomg
src/js/page/ui/view-toggler.js
https://github.com/jakearchibald/svgomg/blob/master/src/js/page/ui/view-toggler.js
MIT
replyByType = function (name, json, request, h) { if (request.headers.accept === 'application/xml') { return h.response(Js2xmlparser(name, json)).type('application/xml'); } return h.response(json).type('application/json'); }
allows a reply to have either a json or xml response @param {String} name @param {Object} json @param {Object} request @param {Object} reply
replyByType
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-complex.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-complex.js
MIT
replyByType = function (name, json, request, h) { if (request.headers.accept === 'application/xml') { return h.response(Js2xmlparser(name, json)).type('application/xml'); } return h.response(json).type('application/json'); }
allows a reply to have either a json or xml response @param {String} name @param {Object} json @param {Object} request @param {Object} reply
replyByType
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-complex.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-complex.js
MIT
defaultHandler = function (request, h) { const sum = { id: 'x78P9c', a: 5, b: 5, operator: '+', equals: 10, created: '2015-12-01', modified: '2015-12-01' }; const list = { items: [sum], count: 1, pageSize: 10, page: 1, pageCount: 1 }; if (request.path.indexOf('...
mock handler for routes @param {Object} request @param {Object} reply
defaultHandler
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-complex.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-complex.js
MIT
defaultHandler = function (request, h) { const sum = { id: 'x78P9c', a: 5, b: 5, operator: '+', equals: 10, created: '2015-12-01', modified: '2015-12-01' }; const list = { items: [sum], count: 1, pageSize: 10, page: 1, pageCount: 1 }; if (request.path.indexOf('...
mock handler for routes @param {Object} request @param {Object} reply
defaultHandler
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-complex.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-complex.js
MIT
replyByType = function (name, json, request, h) { if (request.headers.accept === 'application/xml') { return h.response(Js2xmlparser(name, json)).type('application/xml'); } return h.response(json).type('application/json'); }
allows a reply to have either a json or xml response @param {string} name @param {Object} json @param {Object} request @param {Object} reply
replyByType
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-simple.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-simple.js
MIT
replyByType = function (name, json, request, h) { if (request.headers.accept === 'application/xml') { return h.response(Js2xmlparser(name, json)).type('application/xml'); } return h.response(json).type('application/json'); }
allows a reply to have either a json or xml response @param {string} name @param {Object} json @param {Object} request @param {Object} reply
replyByType
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-simple.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-simple.js
MIT
defaultHandler = function (request, h) { const sum = { id: 'x78P9c', a: 5, b: 5, operator: '+', equals: 10, created: '2015-12-01', modified: '2015-12-01' }; const list = { items: [sum], count: 1, pageSize: 10, page: 1, pageCount: 1 }; if (request.path.indexOf('...
mock handler for routes @param {Object} request @param {Object} reply
defaultHandler
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-simple.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-simple.js
MIT
defaultHandler = function (request, h) { const sum = { id: 'x78P9c', a: 5, b: 5, operator: '+', equals: 10, created: '2015-12-01', modified: '2015-12-01' }; const list = { items: [sum], count: 1, pageSize: 10, page: 1, pageCount: 1 }; if (request.path.indexOf('...
mock handler for routes @param {Object} request @param {Object} reply
defaultHandler
javascript
hapi-swagger/hapi-swagger
examples/assets/routes-simple.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/examples/assets/routes-simple.js
MIT
appendDataContext = function (plugin, settings) { plugin.ext('onPostHandler', (request, h) => { const response = request.response; const routePrefix = plugin.realm.modifiers.route.prefix; // if the reply is a view add settings data into template system if (response.variety === 'view') { // skip...
appends settings data in template context @param {Object} plugin @param {Object} settings @return {Object}
appendDataContext
javascript
hapi-swagger/hapi-swagger
lib/index.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/index.js
MIT
appendDataContext = function (plugin, settings) { plugin.ext('onPostHandler', (request, h) => { const response = request.response; const routePrefix = plugin.realm.modifiers.route.prefix; // if the reply is a view add settings data into template system if (response.variety === 'view') { // skip...
appends settings data in template context @param {Object} plugin @param {Object} settings @return {Object}
appendDataContext
javascript
hapi-swagger/hapi-swagger
lib/index.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/index.js
MIT
findAPIKeyPrefix = function (settings) { // Need JWT plugin to work with Hapi v17+ to test this again /* $lab:coverage:off$ */ let out = ''; if (settings.securityDefinitions) { Object.keys(settings.securityDefinitions).forEach((key) => { if (settings.securityDefinitions[key]['x-keyPrefix']) { ...
finds any keyPrefix in securityDefinitions - also add x- to name @param {Object} settings @return {string}
findAPIKeyPrefix
javascript
hapi-swagger/hapi-swagger
lib/index.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/index.js
MIT
findAPIKeyPrefix = function (settings) { // Need JWT plugin to work with Hapi v17+ to test this again /* $lab:coverage:off$ */ let out = ''; if (settings.securityDefinitions) { Object.keys(settings.securityDefinitions).forEach((key) => { if (settings.securityDefinitions[key]['x-keyPrefix']) { ...
finds any keyPrefix in securityDefinitions - also add x- to name @param {Object} settings @return {string}
findAPIKeyPrefix
javascript
hapi-swagger/hapi-swagger
lib/index.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/index.js
MIT
buildAlternativesArray = (schemas) => { return schemas .map((schema) => { const childMetaName = Utilities.getJoiMetaProperty(schema, 'swaggerLabel'); const altName = childMetaName || Utilities.getJoiLabel(schema) || name; //name, joiObj, parent, parameterType, useDefinitions, isAlt ...
parse alternatives property @param {Object} property @param {Object} joiObj @param {string} name @param {string} parameterType @param {Boolean} useDefinitions @return {Object}
buildAlternativesArray
javascript
hapi-swagger/hapi-swagger
lib/properties.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/properties.js
MIT
buildAlternativesArray = (schemas) => { return schemas .map((schema) => { const childMetaName = Utilities.getJoiMetaProperty(schema, 'swaggerLabel'); const altName = childMetaName || Utilities.getJoiLabel(schema) || name; //name, joiObj, parent, parameterType, useDefinitions, isAlt ...
parse alternatives property @param {Object} property @param {Object} joiObj @param {string} name @param {string} parameterType @param {Boolean} useDefinitions @return {Object}
buildAlternativesArray
javascript
hapi-swagger/hapi-swagger
lib/properties.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/properties.js
MIT
tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }
is passed item a regex @param {Object} obj @return {Boolean}
tryRegexExec
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }
is passed item a regex @param {Object} obj @return {Boolean}
tryRegexExec
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
makeCompareFunction = function (f, direction) { if (typeof f !== 'function') { const prop = f; // make unary function f = function (v1) { return v1[prop]; }; } if (f.length === 1) { // f is a unary function mapping a single item to its sort score const uf = f; ...
get chained functions for sorting @return {Function}
makeCompareFunction
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
makeCompareFunction = function (f, direction) { if (typeof f !== 'function') { const prop = f; // make unary function f = function (v1) { return v1[prop]; }; } if (f.length === 1) { // f is a unary function mapping a single item to its sort score const uf = f; ...
get chained functions for sorting @return {Function}
makeCompareFunction
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
extend = function (f, d) { f = makeCompareFunction(f, d); f.thenBy = tb; return f; }
get chained functions for sorting @return {Function}
extend
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
extend = function (f, d) { f = makeCompareFunction(f, d); f.thenBy = tb; return f; }
get chained functions for sorting @return {Function}
extend
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
tb = function (y, d) { const self = this; y = makeCompareFunction(y, d); return extend((a, b) => { return self(a, b) || y(a, b); }); }
get chained functions for sorting @return {Function}
tb
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
tb = function (y, d) { const self = this; y = makeCompareFunction(y, d); return extend((a, b) => { return self(a, b) || y(a, b); }); }
get chained functions for sorting @return {Function}
tb
javascript
hapi-swagger/hapi-swagger
lib/utilities.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/lib/utilities.js
MIT
validateJWT = (decoded) => { if (!people[decoded.id]) { return { valid: false }; } return { valid: true }; }
creates a Hapi server using JWT auth @param {Object} swaggerOptions @param {Object} routes @param {Function} callback
validateJWT
javascript
hapi-swagger/hapi-swagger
test/helper.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/test/helper.js
MIT
validateJWT = (decoded) => { if (!people[decoded.id]) { return { valid: false }; } return { valid: true }; }
creates a Hapi server using JWT auth @param {Object} swaggerOptions @param {Object} routes @param {Function} callback
validateJWT
javascript
hapi-swagger/hapi-swagger
test/helper.js
https://github.com/hapi-swagger/hapi-swagger/blob/master/test/helper.js
MIT
function px2dp(px) { return px * deviceW / basePx }
Sample React Native App https://github.com/facebook/react-native @flow
px2dp
javascript
ptomasroos/react-native-tab-navigator
example/TabDemo/launcher.js
https://github.com/ptomasroos/react-native-tab-navigator/blob/master/example/TabDemo/launcher.js
MIT
render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Home </Text> </View> ) }
Sample React Native App https://github.com/facebook/react-native @flow
render
javascript
ptomasroos/react-native-tab-navigator
example/TabDemo/launcher.js
https://github.com/ptomasroos/react-native-tab-navigator/blob/master/example/TabDemo/launcher.js
MIT
render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Profile </Text> </View> ) }
Sample React Native App https://github.com/facebook/react-native @flow
render
javascript
ptomasroos/react-native-tab-navigator
example/TabDemo/launcher.js
https://github.com/ptomasroos/react-native-tab-navigator/blob/master/example/TabDemo/launcher.js
MIT
render() { return ( <TabNavigator style={styles.container}> <TabNavigator.Item selected={this.state.selectedTab === 'home'} title="Home" selectedTitleStyle={{color: "#3496f0"}} renderIcon={() => <Icon name="home" size={px2dp(22)} color="#666"/>} render...
Sample React Native App https://github.com/facebook/react-native @flow
render
javascript
ptomasroos/react-native-tab-navigator
example/TabDemo/launcher.js
https://github.com/ptomasroos/react-native-tab-navigator/blob/master/example/TabDemo/launcher.js
MIT
function parseTime(str) { if (!str) { return 0; } var strings = str.split(":"); var l = strings.length, i = l; var ms = 0, parsed; if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { throw new Error("tick only understands numbers and 'h:m:s'"); ...
Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into number of milliseconds. This is used to support human-readable strings passed to clock.tick()
parseTime
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function getEpoch(epoch) { if (!epoch) { return 0; } if (typeof epoch.getTime === "function") { return epoch.getTime(); } if (typeof epoch === "number") { return epoch; } throw new TypeError("now should be milliseconds since UNIX epoch"); }
Used to grok the `now` parameter to createClock.
getEpoch
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function inRange(from, to, timer) { return timer && timer.callAt >= from && timer.callAt <= to; }
Used to grok the `now` parameter to createClock.
inRange
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function mirrorDateProperties(target, source) { var prop; for (prop in source) { if (source.hasOwnProperty(prop)) { target[prop] = source[prop]; } } // set special now implementation if (source.now) { target.now = function now(...
Used to grok the `now` parameter to createClock.
mirrorDateProperties
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function createDate() { function ClockDate(year, month, date, hour, minute, second, ms) { // Defensive and verbose to avoid potential harm in passing // explicit undefined when user does not pass argument switch (arguments.length) { case 0: return ...
Used to grok the `now` parameter to createClock.
createDate
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function ClockDate(year, month, date, hour, minute, second, ms) { // Defensive and verbose to avoid potential harm in passing // explicit undefined when user does not pass argument switch (arguments.length) { case 0: return new NativeDate(ClockDate.clock.n...
Used to grok the `now` parameter to createClock.
ClockDate
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function addTimer(clock, timer) { if (timer.func === undefined) { throw new Error("Callback must be provided to timer calls"); } if (!clock.timers) { clock.timers = {}; } timer.id = uniqueTimerId++; timer.createdAt = clock.now; timer.call...
Used to grok the `now` parameter to createClock.
addTimer
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function compareTimers(a, b) { // Sort first by absolute timing if (a.callAt < b.callAt) { return -1; } if (a.callAt > b.callAt) { return 1; } // Sort next by immediate, immediate timers take precedence if (a.immediate && !b.immediate) { ...
Used to grok the `now` parameter to createClock.
compareTimers
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function firstTimerInRange(clock, from, to) { var timers = clock.timers, timer = null, id, isInRange; for (id in timers) { if (timers.hasOwnProperty(id)) { isInRange = inRange(from, to, timers[id]); if (isInRange && (!time...
Used to grok the `now` parameter to createClock.
firstTimerInRange
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function callTimer(clock, timer) { var exception; if (typeof timer.interval === "number") { clock.timers[timer.id].callAt += timer.interval; } else { delete clock.timers[timer.id]; } try { if (typeof timer.func === "function") { ...
Used to grok the `now` parameter to createClock.
callTimer
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function timerType(timer) { if (timer.immediate) { return "Immediate"; } else if (typeof timer.interval !== "undefined") { return "Interval"; } else { return "Timeout"; } }
Used to grok the `now` parameter to createClock.
timerType
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function clearTimer(clock, timerId, ttype) { if (!timerId) { // null appears to be allowed in most browsers, and appears to be // relied upon by some libraries, like Bootstrap carousel return; } if (!clock.timers) { clock.timers = []; } ...
Used to grok the `now` parameter to createClock.
clearTimer
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function uninstall(clock, target) { var method, i, l; for (i = 0, l = clock.methods.length; i < l; i++) { method = clock.methods[i]; if (target[method].hadOwnProperty) { target[method] = clock["_" + method]; } else { ...
Used to grok the `now` parameter to createClock.
uninstall
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function hijackMethod(target, method, clock) { var prop; clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method); clock["_" + method] = target[method]; if (method === "Date") { var date = mirrorDateProperties(clock[method], target[method]); ...
Used to grok the `now` parameter to createClock.
hijackMethod
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function createClock(now) { var clock = { now: getEpoch(now), timeouts: {}, Date: createDate() }; clock.Date.clock = clock; clock.setTimeout = function setTimeout(func, timeout) { return addTimer(clock, { func: func, ...
Used to grok the `now` parameter to createClock.
createClock
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function getEffectiveOptions(opts) { var options = {}; Object.keys(defaultOptions).forEach(function (key) { options[key] = defaultOptions[key]; }); if (opts) { Object.keys(opts).forEach(function (key) { options[key] = opts[key]; }); } return options; }
Used to grok the `now` parameter to createClock.
getEffectiveOptions
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function resolveFilename(request, parent) { var filename = m._resolveFilename(request, parent); if (Array.isArray(filename)) { filename = filename[1]; } return filename; }
Used to grok the `now` parameter to createClock.
resolveFilename
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function hookedLoader(request, parent, isMain) { var subst, allow, file; if (!originalLoader) { throw new Error("Loader has not been hooked"); } if (registeredMocks.hasOwnProperty(request)) { return registeredMocks[request]; } if (registeredSubstitutes.hasOwnProperty(request))...
Used to grok the `now` parameter to createClock.
hookedLoader
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function enable(opts) { if (originalLoader) { // Already hooked return; } options = getEffectiveOptions(opts); if (options.useCleanCache) { originalCache = m._cache; m._cache = {}; } originalLoader = m._load; m._load = hookedLoader; }
Used to grok the `now` parameter to createClock.
enable
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function disable() { if (!originalLoader) { // Not hooked return; } if (options.useCleanCache) { m._cache = originalCache; originalCache = null; } m._load = originalLoader; originalLoader = null; }
Used to grok the `now` parameter to createClock.
disable
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function resetCache() { if (options.useCleanCache && originalCache) { m._cache = {}; } }
Used to grok the `now` parameter to createClock.
resetCache
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function warnOnReplace(enable) { options.warnOnReplace = enable; }
Used to grok the `now` parameter to createClock.
warnOnReplace
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function warnOnUnregistered(enable) { options.warnOnUnregistered = enable; }
Used to grok the `now` parameter to createClock.
warnOnUnregistered
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function registerMock(mod, mock) { if (options.warnOnReplace && registeredMocks.hasOwnProperty(mod)) { console.warn("WARNING: Replacing existing mock for module: " + mod); } registeredMocks[mod] = mock; }
Used to grok the `now` parameter to createClock.
registerMock
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function deregisterMock(mod) { if (registeredMocks.hasOwnProperty(mod)) { delete registeredMocks[mod]; } }
Used to grok the `now` parameter to createClock.
deregisterMock
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function registerSubstitute(mod, subst) { if (options.warnOnReplace && registeredSubstitutes.hasOwnProperty(mod)) { console.warn("WARNING: Replacing existing substitute for module: " + mod); } registeredSubstitutes[mod] = { name: subst }; }
Used to grok the `now` parameter to createClock.
registerSubstitute
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function deregisterSubstitute(mod) { if (registeredSubstitutes.hasOwnProperty(mod)) { delete registeredSubstitutes[mod]; } }
Used to grok the `now` parameter to createClock.
deregisterSubstitute
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function registerAllowable(mod, unhook) { registeredAllowables[mod] = { unhook: !!unhook, paths: [] }; }
Used to grok the `now` parameter to createClock.
registerAllowable
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function registerAllowables(mods, unhook) { mods.forEach(function (mod) { registerAllowable(mod, unhook); }); }
Used to grok the `now` parameter to createClock.
registerAllowables
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function deregisterAllowable(mod) { if (registeredAllowables.hasOwnProperty(mod)) { var allow = registeredAllowables[mod]; if (allow.unhook) { allow.paths.forEach(function (p) { delete m._cache[p]; }); } delete registeredAllowables[mod]; } ...
Used to grok the `now` parameter to createClock.
deregisterAllowable
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function deregisterAllowables(mods) { mods.forEach(function (mod) { deregisterAllowable(mod); }); }
Used to grok the `now` parameter to createClock.
deregisterAllowables
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function deregisterAll() { Object.keys(registeredAllowables).forEach(function (mod) { var allow = registeredAllowables[mod]; if (allow.unhook) { allow.paths.forEach(function (p) { delete m._cache[p]; }); } }); registeredMocks = {}; registe...
Used to grok the `now` parameter to createClock.
deregisterAll
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT
function cleanUpNextTick() { draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } }
Used to grok the `now` parameter to createClock.
cleanUpNextTick
javascript
rowanmanning/joblint
build/test.js
https://github.com/rowanmanning/joblint/blob/master/build/test.js
MIT