repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
perry-mitchell/webdav-client
source/factory.js
getDirectoryContents
function getDirectoryContents(remotePath, options) { const getOptions = merge(baseOptions, options || {}); return directoryContents.getDirectoryContents(remotePath, getOptions); }
javascript
function getDirectoryContents(remotePath, options) { const getOptions = merge(baseOptions, options || {}); return directoryContents.getDirectoryContents(remotePath, getOptions); }
[ "function", "getDirectoryContents", "(", "remotePath", ",", "options", ")", "{", "const", "getOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "directoryContents", ".", "getDirectoryContents", "(", "remotePath", ","...
Get the contents of a remote directory @param {String} remotePath The path to fetch the contents of @param {GetDirectoryContentsOptions=} options Options for the remote the request @returns {Promise.<Array.<Stat>>} A promise that resolves with an array of remote item stats @memberof ClientInterface @example const conte...
[ "Get", "the", "contents", "of", "a", "remote", "directory" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L199-L202
train
perry-mitchell/webdav-client
source/factory.js
getFileContents
function getFileContents(remoteFilename, options) { const getOptions = merge(baseOptions, options || {}); getOptions.format = getOptions.format || "binary"; if (["binary", "text"].indexOf(getOptions.format) < 0) { throw new Error("Unknown format: " + getOptions.format...
javascript
function getFileContents(remoteFilename, options) { const getOptions = merge(baseOptions, options || {}); getOptions.format = getOptions.format || "binary"; if (["binary", "text"].indexOf(getOptions.format) < 0) { throw new Error("Unknown format: " + getOptions.format...
[ "function", "getFileContents", "(", "remoteFilename", ",", "options", ")", "{", "const", "getOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "getOptions", ".", "format", "=", "getOptions", ".", "format", "||", "\"binary\...
Get the contents of a remote file @param {String} remoteFilename The file to fetch @param {OptionsWithFormat=} options Options for the request @memberof ClientInterface @returns {Promise.<Buffer|String>} A promise that resolves with the contents of the remote file @example // Fetching data: const buff = await client.ge...
[ "Get", "the", "contents", "of", "a", "remote", "file" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L216-L225
train
perry-mitchell/webdav-client
source/factory.js
getFileDownloadLink
function getFileDownloadLink(remoteFilename, options) { const getOptions = merge(baseOptions, options || {}); return getFile.getFileLink(remoteFilename, getOptions); }
javascript
function getFileDownloadLink(remoteFilename, options) { const getOptions = merge(baseOptions, options || {}); return getFile.getFileLink(remoteFilename, getOptions); }
[ "function", "getFileDownloadLink", "(", "remoteFilename", ",", "options", ")", "{", "const", "getOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "getFile", ".", "getFileLink", "(", "remoteFilename", ",", "getOpti...
Get the download link of a remote file Only supported for Basic authentication or unauthenticated connections. @param {String} remoteFilename The file url to fetch @param {UserOptions=} options Options for the request @memberof ClientInterface @returns {String} A download URL
[ "Get", "the", "download", "link", "of", "a", "remote", "file", "Only", "supported", "for", "Basic", "authentication", "or", "unauthenticated", "connections", "." ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L235-L238
train
perry-mitchell/webdav-client
source/factory.js
getFileUploadLink
function getFileUploadLink(remoteFilename, options) { var putOptions = merge(baseOptions, options || {}); return putFile.getFileUploadLink(remoteFilename, putOptions); }
javascript
function getFileUploadLink(remoteFilename, options) { var putOptions = merge(baseOptions, options || {}); return putFile.getFileUploadLink(remoteFilename, putOptions); }
[ "function", "getFileUploadLink", "(", "remoteFilename", ",", "options", ")", "{", "var", "putOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "putFile", ".", "getFileUploadLink", "(", "remoteFilename", ",", "putOp...
Get a file upload link Only supported for Basic authentication or unauthenticated connections. @param {String} remoteFilename The path of the remote file location @param {PutOptions=} options The options for the request @memberof ClientInterface @returns {String} A upload URL
[ "Get", "a", "file", "upload", "link", "Only", "supported", "for", "Basic", "authentication", "or", "unauthenticated", "connections", "." ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L248-L251
train
perry-mitchell/webdav-client
source/factory.js
moveFile
function moveFile(remotePath, targetRemotePath, options) { const moveOptions = merge(baseOptions, options || {}); return move.moveFile(remotePath, targetRemotePath, moveOptions); }
javascript
function moveFile(remotePath, targetRemotePath, options) { const moveOptions = merge(baseOptions, options || {}); return move.moveFile(remotePath, targetRemotePath, moveOptions); }
[ "function", "moveFile", "(", "remotePath", ",", "targetRemotePath", ",", "options", ")", "{", "const", "moveOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "move", ".", "moveFile", "(", "remotePath", ",", "ta...
Move a remote item to another path @param {String} remotePath The remote item path @param {String} targetRemotePath The new path after moving @param {UserOptions=} options Options for the request @memberof ClientInterface @returns {Promise} A promise that resolves once the request has completed @example await client.mo...
[ "Move", "a", "remote", "item", "to", "another", "path" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L274-L277
train
perry-mitchell/webdav-client
source/factory.js
putFileContents
function putFileContents(remoteFilename, data, options) { const putOptions = merge(baseOptions, options || {}); return putFile.putFileContents(remoteFilename, data, putOptions); }
javascript
function putFileContents(remoteFilename, data, options) { const putOptions = merge(baseOptions, options || {}); return putFile.putFileContents(remoteFilename, data, putOptions); }
[ "function", "putFileContents", "(", "remoteFilename", ",", "data", ",", "options", ")", "{", "const", "putOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "putFile", ".", "putFileContents", "(", "remoteFilename", ...
Write contents to a remote file path @param {String} remoteFilename The path of the remote file @param {String|Buffer} data The data to write @param {PutOptions=} options The options for the request @returns {Promise} A promise that resolves once the contents have been written @memberof ClientInterface @example await c...
[ "Write", "contents", "to", "a", "remote", "file", "path" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L291-L294
train
perry-mitchell/webdav-client
source/factory.js
stat
function stat(remotePath, options) { const getOptions = merge(baseOptions, options || {}); return stats.getStat(remotePath, getOptions); }
javascript
function stat(remotePath, options) { const getOptions = merge(baseOptions, options || {}); return stats.getStat(remotePath, getOptions); }
[ "function", "stat", "(", "remotePath", ",", "options", ")", "{", "const", "getOptions", "=", "merge", "(", "baseOptions", ",", "options", "||", "{", "}", ")", ";", "return", "stats", ".", "getStat", "(", "remotePath", ",", "getOptions", ")", ";", "}" ]
Stat a remote object @param {String} remotePath The path of the item @param {OptionsForAdvancedResponses=} options Options for the request @memberof ClientInterface @returns {Promise.<Stat>} A promise that resolves with the stat data
[ "Stat", "a", "remote", "object" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/factory.js#L303-L306
train
perry-mitchell/webdav-client
source/request.js
encodePath
function encodePath(path) { const replaced = path.replace(/\//g, SEP_PATH_POSIX).replace(/\\\\/g, SEP_PATH_WINDOWS); const formatted = encodeURIComponent(replaced); return formatted .split(SEP_PATH_WINDOWS) .join("\\\\") .split(SEP_PATH_POSIX) .join("/"); }
javascript
function encodePath(path) { const replaced = path.replace(/\//g, SEP_PATH_POSIX).replace(/\\\\/g, SEP_PATH_WINDOWS); const formatted = encodeURIComponent(replaced); return formatted .split(SEP_PATH_WINDOWS) .join("\\\\") .split(SEP_PATH_POSIX) .join("/"); }
[ "function", "encodePath", "(", "path", ")", "{", "const", "replaced", "=", "path", ".", "replace", "(", "/", "\\/", "/", "g", ",", "SEP_PATH_POSIX", ")", ".", "replace", "(", "/", "\\\\\\\\", "/", "g", ",", "SEP_PATH_WINDOWS", ")", ";", "const", "forma...
Encode a path for use with WebDAV servers @param {String} path The path to encode @returns {String} The encoded path (separators protected)
[ "Encode", "a", "path", "for", "use", "with", "WebDAV", "servers" ]
d23165a7e3e3760312fe39ec1227e729a4e3ab80
https://github.com/perry-mitchell/webdav-client/blob/d23165a7e3e3760312fe39ec1227e729a4e3ab80/source/request.js#L13-L21
train
lumapps/lumX
modules/select/demo/js/demo-select_controller.js
callApi
function callApi() { vm.pageInfiniteScroll++; vm.loadingInfiniteScroll = true; return $http .get( 'https://randomuser.me/api/?results=10&seed=lumapps&page=' + vm.pageInfiniteScroll ) .then(function(response) { ...
javascript
function callApi() { vm.pageInfiniteScroll++; vm.loadingInfiniteScroll = true; return $http .get( 'https://randomuser.me/api/?results=10&seed=lumapps&page=' + vm.pageInfiniteScroll ) .then(function(response) { ...
[ "function", "callApi", "(", ")", "{", "vm", ".", "pageInfiniteScroll", "++", ";", "vm", ".", "loadingInfiniteScroll", "=", "true", ";", "return", "$http", ".", "get", "(", "'https://randomuser.me/api/?results=10&seed=lumapps&page='", "+", "vm", ".", "pageInfiniteScr...
Call sample API. @return {Promise} Promise containing an array of users.
[ "Call", "sample", "API", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/modules/select/demo/js/demo-select_controller.js#L405-L432
train
lumapps/lumX
modules/notification/js/notification_service.js
reComputeElementsPosition
function reComputeElementsPosition() { var baseOffset = 0; for (var idx = notificationList.length -1; idx >= 0; idx--) { notificationList[idx].height = getElementHeight(notificationList[idx].elem[0]); notificationList[idx].margin = baseOffset;...
javascript
function reComputeElementsPosition() { var baseOffset = 0; for (var idx = notificationList.length -1; idx >= 0; idx--) { notificationList[idx].height = getElementHeight(notificationList[idx].elem[0]); notificationList[idx].margin = baseOffset;...
[ "function", "reComputeElementsPosition", "(", ")", "{", "var", "baseOffset", "=", "0", ";", "for", "(", "var", "idx", "=", "notificationList", ".", "length", "-", "1", ";", "idx", ">=", "0", ";", "idx", "--", ")", "{", "notificationList", "[", "idx", "...
Compute the notification list element new position. Usefull when the height change programmatically and you need other notifications to fit.
[ "Compute", "the", "notification", "list", "element", "new", "position", ".", "Usefull", "when", "the", "height", "change", "programmatically", "and", "you", "need", "other", "notifications", "to", "fit", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/modules/notification/js/notification_service.js#L102-L115
train
lumapps/lumX
modules/notification/js/notification_service.js
buildDialogActions
function buildDialogActions(_buttons, _callback, _unbind) { var $compile = $injector.get('$compile'); var dialogActions = angular.element('<div/>', { class: 'dialog__footer' }); var dialogLastBtn = angular.element('<button/>', ...
javascript
function buildDialogActions(_buttons, _callback, _unbind) { var $compile = $injector.get('$compile'); var dialogActions = angular.element('<div/>', { class: 'dialog__footer' }); var dialogLastBtn = angular.element('<button/>', ...
[ "function", "buildDialogActions", "(", "_buttons", ",", "_callback", ",", "_unbind", ")", "{", "var", "$compile", "=", "$injector", ".", "get", "(", "'$compile'", ")", ";", "var", "dialogActions", "=", "angular", ".", "element", "(", "'<div/>'", ",", "{", ...
ALERT & CONFIRM
[ "ALERT", "&", "CONFIRM" ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/modules/notification/js/notification_service.js#L254-L320
train
lumapps/lumX
dist/lumx.js
_closePanes
function _closePanes() { toggledPanes = {}; if (lxSelect.choicesViewSize === 'large') { if (angular.isDefined(lxSelect.choices) && lxSelect.choices !== null) { lxSelect.panes = [lxSelect.choices]; } else { lxSelect.panes = ...
javascript
function _closePanes() { toggledPanes = {}; if (lxSelect.choicesViewSize === 'large') { if (angular.isDefined(lxSelect.choices) && lxSelect.choices !== null) { lxSelect.panes = [lxSelect.choices]; } else { lxSelect.panes = ...
[ "function", "_closePanes", "(", ")", "{", "toggledPanes", "=", "{", "}", ";", "if", "(", "lxSelect", ".", "choicesViewSize", "===", "'large'", ")", "{", "if", "(", "angular", ".", "isDefined", "(", "lxSelect", ".", "choices", ")", "&&", "lxSelect", ".", ...
Close all panes.
[ "Close", "all", "panes", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4436-L4452
train
lumapps/lumX
dist/lumx.js
_findIndex
function _findIndex(haystack, needle) { if (angular.isUndefined(haystack) || haystack.length === 0) { return -1; } for (var i = 0, len = haystack.length; i < len; i++) { if (haystack[i] === needle) { return i; } ...
javascript
function _findIndex(haystack, needle) { if (angular.isUndefined(haystack) || haystack.length === 0) { return -1; } for (var i = 0, len = haystack.length; i < len; i++) { if (haystack[i] === needle) { return i; } ...
[ "function", "_findIndex", "(", "haystack", ",", "needle", ")", "{", "if", "(", "angular", ".", "isUndefined", "(", "haystack", ")", "||", "haystack", ".", "length", "===", "0", ")", "{", "return", "-", "1", ";", "}", "for", "(", "var", "i", "=", "0...
Find the index of an element in an array. @param {Array} haystack The array in which to search for the value. @param {*} needle The value to search in the array. @return {number} The index of the value of the array, or -1 if not found.
[ "Find", "the", "index", "of", "an", "element", "in", "an", "array", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4461-L4473
train
lumapps/lumX
dist/lumx.js
_getLongestMatchingPath
function _getLongestMatchingPath(containing) { if (angular.isUndefined(lxSelect.matchingPaths) || lxSelect.matchingPaths.length === 0) { return undefined; } containing = containing || lxSelect.matchingPaths[0]; var longest = lxSelect.matchingPaths[0]; ...
javascript
function _getLongestMatchingPath(containing) { if (angular.isUndefined(lxSelect.matchingPaths) || lxSelect.matchingPaths.length === 0) { return undefined; } containing = containing || lxSelect.matchingPaths[0]; var longest = lxSelect.matchingPaths[0]; ...
[ "function", "_getLongestMatchingPath", "(", "containing", ")", "{", "if", "(", "angular", ".", "isUndefined", "(", "lxSelect", ".", "matchingPaths", ")", "||", "lxSelect", ".", "matchingPaths", ".", "length", "===", "0", ")", "{", "return", "undefined", ";", ...
Get the longest matching path containing the given string. @param {string} [containing] The string we want the matching path to contain. If none given, just take the longest matching path of the first matching path.
[ "Get", "the", "longest", "matching", "path", "containing", "the", "given", "string", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4481-L4508
train
lumapps/lumX
dist/lumx.js
_keyLeft
function _keyLeft() { if (lxSelect.choicesViewMode !== 'panes' || lxSelect.panes.length < 2) { return; } var previousPaneIndex = lxSelect.panes.length - 2; lxSelect.activeChoiceIndex = ( Object.keys(lxSelect.panes[previousPaneIndex]) || [...
javascript
function _keyLeft() { if (lxSelect.choicesViewMode !== 'panes' || lxSelect.panes.length < 2) { return; } var previousPaneIndex = lxSelect.panes.length - 2; lxSelect.activeChoiceIndex = ( Object.keys(lxSelect.panes[previousPaneIndex]) || [...
[ "function", "_keyLeft", "(", ")", "{", "if", "(", "lxSelect", ".", "choicesViewMode", "!==", "'panes'", "||", "lxSelect", ".", "panes", ".", "length", "<", "2", ")", "{", "return", ";", "}", "var", "previousPaneIndex", "=", "lxSelect", ".", "panes", ".",...
When the left key is pressed and we are displaying the choices in pane mode, close the most right opened pane.
[ "When", "the", "left", "key", "is", "pressed", "and", "we", "are", "displaying", "the", "choices", "in", "pane", "mode", "close", "the", "most", "right", "opened", "pane", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4544-L4558
train
lumapps/lumX
dist/lumx.js
_keyRight
function _keyRight() { if (lxSelect.choicesViewMode !== 'panes' || lxSelect.activeChoiceIndex === -1) { return; } var paneOpened = _openPane((lxSelect.panes.length - 1), lxSelect.activeChoiceIndex, true); if (paneOpened) { lxSelect.active...
javascript
function _keyRight() { if (lxSelect.choicesViewMode !== 'panes' || lxSelect.activeChoiceIndex === -1) { return; } var paneOpened = _openPane((lxSelect.panes.length - 1), lxSelect.activeChoiceIndex, true); if (paneOpened) { lxSelect.active...
[ "function", "_keyRight", "(", ")", "{", "if", "(", "lxSelect", ".", "choicesViewMode", "!==", "'panes'", "||", "lxSelect", ".", "activeChoiceIndex", "===", "-", "1", ")", "{", "return", ";", "}", "var", "paneOpened", "=", "_openPane", "(", "(", "lxSelect",...
When the right key is pressed and we are displaying the choices in pane mode, open the currently selected pane.
[ "When", "the", "right", "key", "is", "pressed", "and", "we", "are", "displaying", "the", "choices", "in", "pane", "mode", "open", "the", "currently", "selected", "pane", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4581-L4593
train
lumapps/lumX
dist/lumx.js
_keySelect
function _keySelect() { var filteredChoices; if (lxSelect.choicesViewMode === 'panes') { filteredChoices = lxSelect.panes[(lxSelect.panes.length - 1)]; if (!lxSelect.isLeaf(filteredChoices[lxSelect.activeChoiceIndex])) { return; ...
javascript
function _keySelect() { var filteredChoices; if (lxSelect.choicesViewMode === 'panes') { filteredChoices = lxSelect.panes[(lxSelect.panes.length - 1)]; if (!lxSelect.isLeaf(filteredChoices[lxSelect.activeChoiceIndex])) { return; ...
[ "function", "_keySelect", "(", ")", "{", "var", "filteredChoices", ";", "if", "(", "lxSelect", ".", "choicesViewMode", "===", "'panes'", ")", "{", "filteredChoices", "=", "lxSelect", ".", "panes", "[", "(", "lxSelect", ".", "panes", ".", "length", "-", "1"...
When the enter key is pressed, select the currently active choice.
[ "When", "the", "enter", "key", "is", "pressed", "select", "the", "currently", "active", "choice", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4598-L4628
train
lumapps/lumX
dist/lumx.js
_openPane
function _openPane(parentIndex, indexOrKey, checkIsLeaf) { if (angular.isDefined(toggledPanes[parentIndex])) { return false; } var pane = pane || lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (...
javascript
function _openPane(parentIndex, indexOrKey, checkIsLeaf) { if (angular.isDefined(toggledPanes[parentIndex])) { return false; } var pane = pane || lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (...
[ "function", "_openPane", "(", "parentIndex", ",", "indexOrKey", ",", "checkIsLeaf", ")", "{", "if", "(", "angular", ".", "isDefined", "(", "toggledPanes", "[", "parentIndex", "]", ")", ")", "{", "return", "false", ";", "}", "var", "pane", "=", "pane", "|...
Open a pane. If the pane is already opened, don't do anything. @param {number} parentIndex The index of the parent of the pane to open. @param {number|string} indexOrKey The index or the name of the pane to open. @param {boolean} [checkIsLeaf=false] Check if the pane we want to open is...
[ "Open", "a", "pane", ".", "If", "the", "pane", "is", "already", "opened", "don", "t", "do", "anything", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4677-L4710
train
lumapps/lumX
dist/lumx.js
_searchPath
function _searchPath(container, regexp, previousKey, limitToFields) { limitToFields = limitToFields || []; limitToFields = (angular.isArray(limitToFields)) ? limitToFields : [limitToFields]; var results = []; angular.forEach(container, function forEachItemsInContainer(i...
javascript
function _searchPath(container, regexp, previousKey, limitToFields) { limitToFields = limitToFields || []; limitToFields = (angular.isArray(limitToFields)) ? limitToFields : [limitToFields]; var results = []; angular.forEach(container, function forEachItemsInContainer(i...
[ "function", "_searchPath", "(", "container", ",", "regexp", ",", "previousKey", ",", "limitToFields", ")", "{", "limitToFields", "=", "limitToFields", "||", "[", "]", ";", "limitToFields", "=", "(", "angular", ".", "isArray", "(", "limitToFields", ")", ")", ...
Search for any path in an object containing the given regexp as a key or as a value. @param {*} container The container in which to search for the regexp. @param {RegExp} regexp The regular expression to search in keys or values of the object (nested) @param {string} previousKey ...
[ "Search", "for", "any", "path", "in", "an", "object", "containing", "the", "given", "regexp", "as", "a", "key", "or", "as", "a", "value", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4722-L4763
train
lumapps/lumX
dist/lumx.js
isLeaf
function isLeaf(obj) { if (angular.isUndefined(obj)) { return false; } if (angular.isArray(obj)) { return false; } if (!angular.isObject(obj)) { return true; } if (obj.isLeaf) { ...
javascript
function isLeaf(obj) { if (angular.isUndefined(obj)) { return false; } if (angular.isArray(obj)) { return false; } if (!angular.isObject(obj)) { return true; } if (obj.isLeaf) { ...
[ "function", "isLeaf", "(", "obj", ")", "{", "if", "(", "angular", ".", "isUndefined", "(", "obj", ")", ")", "{", "return", "false", ";", "}", "if", "(", "angular", ".", "isArray", "(", "obj", ")", ")", "{", "return", "false", ";", "}", "if", "(",...
Check if an object is a leaf object. A leaf object is an object that contains the `isLeaf` property or that has property that are anything else than object or arrays. @param {*} obj The object to check if it's a leaf @return {boolean} If the object is a leaf object.
[ "Check", "if", "an", "object", "is", "a", "leaf", "object", ".", "A", "leaf", "object", "is", "an", "object", "that", "contains", "the", "isLeaf", "property", "or", "that", "has", "property", "that", "are", "anything", "else", "than", "object", "or", "ar...
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4882-L4914
train
lumapps/lumX
dist/lumx.js
isPaneToggled
function isPaneToggled(parentIndex, indexOrKey) { var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { return false; } var key = indexOrKey; if (an...
javascript
function isPaneToggled(parentIndex, indexOrKey) { var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { return false; } var key = indexOrKey; if (an...
[ "function", "isPaneToggled", "(", "parentIndex", ",", "indexOrKey", ")", "{", "var", "pane", "=", "lxSelect", ".", "choicesViewSize", "===", "'large'", "?", "lxSelect", ".", "panes", "[", "parentIndex", "]", ":", "lxSelect", ".", "openedPanes", "[", "parentInd...
Check if a pane is toggled. @param {number} parentIndex The parent index of the pane in which to check. @param {number|string} indexOrKey The index or the name of the pane to check. @return {boolean} If the pane is toggled or not.
[ "Check", "if", "a", "pane", "is", "toggled", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4923-L4936
train
lumapps/lumX
dist/lumx.js
isMatchingPath
function isMatchingPath(parentIndex, indexOrKey) { var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { return; } var key = indexOrKey; if (angular...
javascript
function isMatchingPath(parentIndex, indexOrKey) { var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { return; } var key = indexOrKey; if (angular...
[ "function", "isMatchingPath", "(", "parentIndex", ",", "indexOrKey", ")", "{", "var", "pane", "=", "lxSelect", ".", "choicesViewSize", "===", "'large'", "?", "lxSelect", ".", "panes", "[", "parentIndex", "]", ":", "lxSelect", ".", "openedPanes", "[", "parentIn...
Check if a path of a pane is matching the filter. @param {number} parentIndex The index of the pane. @param {number|string} indexOrKey The index or the name of the item to check.
[ "Check", "if", "a", "path", "of", "a", "pane", "is", "matching", "the", "filter", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4944-L4966
train
lumapps/lumX
dist/lumx.js
keyEvent
function keyEvent(evt) { if (evt.keyCode !== 8) { lxSelect.activeSelectedIndex = -1; } if (!LxDropdownService.isOpen('dropdown-' + lxSelect.uuid)) { lxSelect.activeChoiceIndex = -1; } switch (evt.keyCode) { cas...
javascript
function keyEvent(evt) { if (evt.keyCode !== 8) { lxSelect.activeSelectedIndex = -1; } if (!LxDropdownService.isOpen('dropdown-' + lxSelect.uuid)) { lxSelect.activeChoiceIndex = -1; } switch (evt.keyCode) { cas...
[ "function", "keyEvent", "(", "evt", ")", "{", "if", "(", "evt", ".", "keyCode", "!==", "8", ")", "{", "lxSelect", ".", "activeSelectedIndex", "=", "-", "1", ";", "}", "if", "(", "!", "LxDropdownService", ".", "isOpen", "(", "'dropdown-'", "+", "lxSelec...
Handle a key press event @param {Event} evt The key press event.
[ "Handle", "a", "key", "press", "event" ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L4994-L5041
train
lumapps/lumX
dist/lumx.js
toggleChoice
function toggleChoice(choice, evt) { if (lxSelect.multiple && !lxSelect.autocomplete && angular.isDefined(evt)) { evt.stopPropagation(); } if (lxSelect.areChoicesOpened() && lxSelect.multiple) { var dropdownElement = angular.element(angular.element(ev...
javascript
function toggleChoice(choice, evt) { if (lxSelect.multiple && !lxSelect.autocomplete && angular.isDefined(evt)) { evt.stopPropagation(); } if (lxSelect.areChoicesOpened() && lxSelect.multiple) { var dropdownElement = angular.element(angular.element(ev...
[ "function", "toggleChoice", "(", "choice", ",", "evt", ")", "{", "if", "(", "lxSelect", ".", "multiple", "&&", "!", "lxSelect", ".", "autocomplete", "&&", "angular", ".", "isDefined", "(", "evt", ")", ")", "{", "evt", ".", "stopPropagation", "(", ")", ...
Toggle the given choice. If it was selected, unselect it. If it wasn't selected, select it. @param {Object} choice The choice to toggle. @param {Event} [evt] The event that triggered the function.
[ "Toggle", "the", "given", "choice", ".", "If", "it", "was", "selected", "unselect", "it", ".", "If", "it", "wasn", "t", "selected", "select", "it", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L5133-L5173
train
lumapps/lumX
dist/lumx.js
togglePane
function togglePane(evt, parentIndex, indexOrKey, selectLeaf) { selectLeaf = (angular.isUndefined(selectLeaf)) ? true : selectLeaf; var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { ...
javascript
function togglePane(evt, parentIndex, indexOrKey, selectLeaf) { selectLeaf = (angular.isUndefined(selectLeaf)) ? true : selectLeaf; var pane = lxSelect.choicesViewSize === 'large' ? lxSelect.panes[parentIndex] : lxSelect.openedPanes[parentIndex]; if (angular.isUndefined(pane)) { ...
[ "function", "togglePane", "(", "evt", ",", "parentIndex", ",", "indexOrKey", ",", "selectLeaf", ")", "{", "selectLeaf", "=", "(", "angular", ".", "isUndefined", "(", "selectLeaf", ")", ")", "?", "true", ":", "selectLeaf", ";", "var", "pane", "=", "lxSelect...
Toggle a pane. @param {Event} evt The click event that led to toggle the pane. @param {number} parentIndex The index of the containing pane. @param {number|string} indexOrKey The index or the name of the pane to toggle. @param {boolean} [selectLeaf=true] Indicates if we ...
[ "Toggle", "a", "pane", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L5184-L5217
train
lumapps/lumX
dist/lumx.js
updateFilter
function updateFilter() { if (angular.isFunction(lxSelect.resetDropdownSize)) { lxSelect.resetDropdownSize(); } if (angular.isDefined(lxSelect.filter)) { lxSelect.matchingPaths = lxSelect.filter({ newValue: lxSelect.filterModel ...
javascript
function updateFilter() { if (angular.isFunction(lxSelect.resetDropdownSize)) { lxSelect.resetDropdownSize(); } if (angular.isDefined(lxSelect.filter)) { lxSelect.matchingPaths = lxSelect.filter({ newValue: lxSelect.filterModel ...
[ "function", "updateFilter", "(", ")", "{", "if", "(", "angular", ".", "isFunction", "(", "lxSelect", ".", "resetDropdownSize", ")", ")", "{", "lxSelect", ".", "resetDropdownSize", "(", ")", ";", "}", "if", "(", "angular", ".", "isDefined", "(", "lxSelect",...
Update the filter. Either filter the choices available or highlight the path to the matching elements.
[ "Update", "the", "filter", ".", "Either", "filter", "the", "choices", "available", "or", "highlight", "the", "path", "to", "the", "matching", "elements", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L5276-L5315
train
lumapps/lumX
dist/lumx.js
searchPath
function searchPath(newValue) { if (!newValue || newValue.length < 2) { return undefined; } var regexp = new RegExp(LxUtils.escapeRegexp(newValue), 'ig'); return _searchPath(lxSelect.choices, regexp); }
javascript
function searchPath(newValue) { if (!newValue || newValue.length < 2) { return undefined; } var regexp = new RegExp(LxUtils.escapeRegexp(newValue), 'ig'); return _searchPath(lxSelect.choices, regexp); }
[ "function", "searchPath", "(", "newValue", ")", "{", "if", "(", "!", "newValue", "||", "newValue", ".", "length", "<", "2", ")", "{", "return", "undefined", ";", "}", "var", "regexp", "=", "new", "RegExp", "(", "LxUtils", ".", "escapeRegexp", "(", "new...
Search in the multipane select for the paths matching the search. @param {string} newValue The filter string.
[ "Search", "in", "the", "multipane", "select", "for", "the", "paths", "matching", "the", "search", "." ]
50bfa6202261c5b311a59e8a2cc0d5eea6db1655
https://github.com/lumapps/lumX/blob/50bfa6202261c5b311a59e8a2cc0d5eea6db1655/dist/lumx.js#L5368-L5376
train
mozilla/aframe-xr
src/components/ar-mode-ui.js
createEnterARButton
function createEnterARButton (clickHandler) { var arButton; // Create elements. arButton = document.createElement('button'); arButton.className = ENTER_AR_BTN_CLASS; arButton.setAttribute('title', 'Enter AR mode.'); arButton.setAttribute('aframe-injected', ''); arButton.addEventListener('click', functio...
javascript
function createEnterARButton (clickHandler) { var arButton; // Create elements. arButton = document.createElement('button'); arButton.className = ENTER_AR_BTN_CLASS; arButton.setAttribute('title', 'Enter AR mode.'); arButton.setAttribute('aframe-injected', ''); arButton.addEventListener('click', functio...
[ "function", "createEnterARButton", "(", "clickHandler", ")", "{", "var", "arButton", ";", "// Create elements.", "arButton", "=", "document", ".", "createElement", "(", "'button'", ")", ";", "arButton", ".", "className", "=", "ENTER_AR_BTN_CLASS", ";", "arButton", ...
Creates a button that when clicked will enter into stereo-rendering mode for AR. Structure: <div><button></div> @param {function} enterARHandler @returns {Element} Wrapper <div>.
[ "Creates", "a", "button", "that", "when", "clicked", "will", "enter", "into", "stereo", "-", "rendering", "mode", "for", "AR", "." ]
7ec17af3e65325b62fd2112e8158eb2e4310c0e0
https://github.com/mozilla/aframe-xr/blob/7ec17af3e65325b62fd2112e8158eb2e4310c0e0/src/components/ar-mode-ui.js#L135-L150
train
ryanhugh/searchneu
frontend/components/panels/LocationLinks.js
LocationLinks
function LocationLinks(props) { const elements = props.locations.map((location, index, locations) => { let buildingName; if (location.match(/\d+\s*$/i)) { buildingName = location.replace(/\d+\s*$/i, ''); } else { buildingName = location; } let optionalComma = null; if (index !== l...
javascript
function LocationLinks(props) { const elements = props.locations.map((location, index, locations) => { let buildingName; if (location.match(/\d+\s*$/i)) { buildingName = location.replace(/\d+\s*$/i, ''); } else { buildingName = location; } let optionalComma = null; if (index !== l...
[ "function", "LocationLinks", "(", "props", ")", "{", "const", "elements", "=", "props", ".", "locations", ".", "map", "(", "(", "location", ",", "index", ",", "locations", ")", "=>", "{", "let", "buildingName", ";", "if", "(", "location", ".", "match", ...
Calculate the Google Maps links from a given section. This is used in both the mobile section panel and the desktop section panel.
[ "Calculate", "the", "Google", "Maps", "links", "from", "a", "given", "section", ".", "This", "is", "used", "in", "both", "the", "mobile", "section", "panel", "and", "the", "desktop", "section", "panel", "." ]
9ede451e45924a86611fbbc252087ee3cccb4c63
https://github.com/ryanhugh/searchneu/blob/9ede451e45924a86611fbbc252087ee3cccb4c63/frontend/components/panels/LocationLinks.js#L15-L63
train
crazychicken/t-scroll
theme/js/custom.js
setCookie
function setCookie(pr_name, exdays) { var d = new Date(); d = (d.getTime() + (exdays*24*60*60*1000)); document.cookie = pr_name+"="+d + ";" + ";path=/"; }
javascript
function setCookie(pr_name, exdays) { var d = new Date(); d = (d.getTime() + (exdays*24*60*60*1000)); document.cookie = pr_name+"="+d + ";" + ";path=/"; }
[ "function", "setCookie", "(", "pr_name", ",", "exdays", ")", "{", "var", "d", "=", "new", "Date", "(", ")", ";", "d", "=", "(", "d", ".", "getTime", "(", ")", "+", "(", "exdays", "*", "24", "*", "60", "*", "60", "*", "1000", ")", ")", ";", ...
set the value, save data browser
[ "set", "the", "value", "save", "data", "browser" ]
a0e721f2e641fcae3f22b242e384d892fdd0d6e6
https://github.com/crazychicken/t-scroll/blob/a0e721f2e641fcae3f22b242e384d892fdd0d6e6/theme/js/custom.js#L47-L51
train
crazychicken/t-scroll
theme/js/custom.js
getCookie
function getCookie(pr_name) { var name = pr_name + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; c = c.trim(); if (c.indexOf(pr_name+"=") === 0) { return c.substring(name.length, c.length); ...
javascript
function getCookie(pr_name) { var name = pr_name + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; c = c.trim(); if (c.indexOf(pr_name+"=") === 0) { return c.substring(name.length, c.length); ...
[ "function", "getCookie", "(", "pr_name", ")", "{", "var", "name", "=", "pr_name", "+", "\"=\"", ";", "var", "ca", "=", "document", ".", "cookie", ".", "split", "(", "';'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ca", ".", "l...
get the cookie and check value
[ "get", "the", "cookie", "and", "check", "value" ]
a0e721f2e641fcae3f22b242e384d892fdd0d6e6
https://github.com/crazychicken/t-scroll/blob/a0e721f2e641fcae3f22b242e384d892fdd0d6e6/theme/js/custom.js#L53-L65
train
Asana/node-asana
lib/auth/app.js
App
function App(options) { this.clientId = options.clientId; this.clientSecret = options.clientSecret || null; this.redirectUri = options.redirectUri || null; this.scope = options.scope || 'default'; this.asanaBaseUrl = options.asanaBaseUrl || 'https://app.asana.com/'; }
javascript
function App(options) { this.clientId = options.clientId; this.clientSecret = options.clientSecret || null; this.redirectUri = options.redirectUri || null; this.scope = options.scope || 'default'; this.asanaBaseUrl = options.asanaBaseUrl || 'https://app.asana.com/'; }
[ "function", "App", "(", "options", ")", "{", "this", ".", "clientId", "=", "options", ".", "clientId", ";", "this", ".", "clientSecret", "=", "options", ".", "clientSecret", "||", "null", ";", "this", ".", "redirectUri", "=", "options", ".", "redirectUri",...
An abstraction around an App used with Asana. @options {Object} Options to construct the app @option {String} clientId The ID of the app @option {String} [clientSecret] The secret key, if available here @option {String} [redirectUri] The default redirect URI @option {String} [scope] Scope to use, support...
[ "An", "abstraction", "around", "an", "App", "used", "with", "Asana", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/app.js#L41-L47
train
Asana/node-asana
lib/auth/chrome_extension_flow.js
ChromeExtensionFlow
function ChromeExtensionFlow(options) { BaseBrowserFlow.call(this, options); this._authorizationPromise = null; this._receiverUrl = chrome.runtime.getURL( options.receiverPath || 'asana_oauth_receiver.html'); }
javascript
function ChromeExtensionFlow(options) { BaseBrowserFlow.call(this, options); this._authorizationPromise = null; this._receiverUrl = chrome.runtime.getURL( options.receiverPath || 'asana_oauth_receiver.html'); }
[ "function", "ChromeExtensionFlow", "(", "options", ")", "{", "BaseBrowserFlow", ".", "call", "(", "this", ",", "options", ")", ";", "this", ".", "_authorizationPromise", "=", "null", ";", "this", ".", "_receiverUrl", "=", "chrome", ".", "runtime", ".", "getU...
An Oauth flow that runs in a Chrome browser extension and requests user authorization by opening a temporary tab to prompt the user. @param {Object} options See `BaseBrowserFlow` for options, plus the below: @options {String} [receiverPath] Full path and filename from the base directory of the extension to the receiver...
[ "An", "Oauth", "flow", "that", "runs", "in", "a", "Chrome", "browser", "extension", "and", "requests", "user", "authorization", "by", "opening", "a", "temporary", "tab", "to", "prompt", "the", "user", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/chrome_extension_flow.js#L19-L24
train
Asana/node-asana
lib/auth/native_flow.js
NativeFlow
function NativeFlow(options) { this.app = options.app; this.instructions = options.instructions || defaultInstructions; this.prompt = options.prompt || defaultPrompt; this.redirectUri = oauthUtil.NATIVE_REDIRECT_URI; }
javascript
function NativeFlow(options) { this.app = options.app; this.instructions = options.instructions || defaultInstructions; this.prompt = options.prompt || defaultPrompt; this.redirectUri = oauthUtil.NATIVE_REDIRECT_URI; }
[ "function", "NativeFlow", "(", "options", ")", "{", "this", ".", "app", "=", "options", ".", "app", ";", "this", ".", "instructions", "=", "options", ".", "instructions", "||", "defaultInstructions", ";", "this", ".", "prompt", "=", "options", ".", "prompt...
An Oauth flow that can be run from the console or an app that does not have the ability to open and manage a browser on its own. @param {Object} options @option {App} app App to authenticate for @option {String function(String)} [instructions] Function returning the instructions to output to the user. Passed the author...
[ "An", "Oauth", "flow", "that", "can", "be", "run", "from", "the", "console", "or", "an", "app", "that", "does", "not", "have", "the", "ability", "to", "open", "and", "manage", "a", "browser", "on", "its", "own", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/native_flow.js#L44-L49
train
Asana/node-asana
lib/util/collection.js
Collection
function Collection(response, dispatcher, dispatchOptions) { if (!Collection.isCollectionResponse(response)) { throw new Error( 'Cannot create Collection from response that does not have resources'); } this.data = response.data; this._response = response; this._dispatcher = dispatcher; this._di...
javascript
function Collection(response, dispatcher, dispatchOptions) { if (!Collection.isCollectionResponse(response)) { throw new Error( 'Cannot create Collection from response that does not have resources'); } this.data = response.data; this._response = response; this._dispatcher = dispatcher; this._di...
[ "function", "Collection", "(", "response", ",", "dispatcher", ",", "dispatchOptions", ")", "{", "if", "(", "!", "Collection", ".", "isCollectionResponse", "(", "response", ")", ")", "{", "throw", "new", "Error", "(", "'Cannot create Collection from response that doe...
Create a Collection object from a response containing a list of resources. @param {Object} response Full payload from a response to a collection request. @param {Dispatcher} dispatcher @param {Object} [dispatchOptions] @returns {Object} Collection
[ "Create", "a", "Collection", "object", "from", "a", "response", "containing", "a", "list", "of", "resources", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/util/collection.js#L21-L31
train
Asana/node-asana
lib/util/resource_stream.js
ResourceStream
function ResourceStream(collection) { var me = this; BufferedReadable.call(me, { objectMode: true }); // @type {Collection} The collection whose data was last pushed into the // stream, such that if we have to go back for more, we should fetch // its `nextPage`. me._collection = collection; ...
javascript
function ResourceStream(collection) { var me = this; BufferedReadable.call(me, { objectMode: true }); // @type {Collection} The collection whose data was last pushed into the // stream, such that if we have to go back for more, we should fetch // its `nextPage`. me._collection = collection; ...
[ "function", "ResourceStream", "(", "collection", ")", "{", "var", "me", "=", "this", ";", "BufferedReadable", ".", "call", "(", "me", ",", "{", "objectMode", ":", "true", "}", ")", ";", "// @type {Collection} The collection whose data was last pushed into the", "// ...
A ResourceStream is a Node stream implementation for objects that are fetched from the API. Basically, any Collection of resources from the API can be wrapped in this stream, and the stream will fetch new pages of items as needed. @param {Collection} collection Response from initial collection request. @constructor
[ "A", "ResourceStream", "is", "a", "Node", "stream", "implementation", "for", "objects", "that", "are", "fetched", "from", "the", "API", ".", "Basically", "any", "Collection", "of", "resources", "from", "the", "API", "can", "be", "wrapped", "in", "this", "str...
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/util/resource_stream.js#L14-L30
train
Asana/node-asana
lib/auth/oauth_authenticator.js
OauthAuthenticator
function OauthAuthenticator(options) { Authenticator.call(this); if (typeof(options.credentials) === 'string') { this.credentials = { 'access_token': options.credentials }; } else { this.credentials = options.credentials || null; } this.flow = options.flow || null; this.app = options.app; ...
javascript
function OauthAuthenticator(options) { Authenticator.call(this); if (typeof(options.credentials) === 'string') { this.credentials = { 'access_token': options.credentials }; } else { this.credentials = options.credentials || null; } this.flow = options.flow || null; this.app = options.app; ...
[ "function", "OauthAuthenticator", "(", "options", ")", "{", "Authenticator", ".", "call", "(", "this", ")", ";", "if", "(", "typeof", "(", "options", ".", "credentials", ")", "===", "'string'", ")", "{", "this", ".", "credentials", "=", "{", "'access_token...
Creates an authenticator that uses Oauth for authentication. @param {Object} options Configure the authenticator; must specify one of `flow` or `credentials`. @option {App} app The app being authenticated for. @option {OauthFlow} [flow] The flow to use to get credentials when needed. @op...
[ "Creates", "an", "authenticator", "that", "uses", "Oauth", "for", "authentication", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/oauth_authenticator.js#L19-L30
train
Asana/node-asana
lib/client.js
Client
function Client(dispatcher, options) { options = options || {}; /** * The internal dispatcher. This is mostly used by the resources but provided * for custom requests to the API or API features that have not yet been added * to the client. * @type {Dispatcher} */ this.dispatcher = dispatcher; /**...
javascript
function Client(dispatcher, options) { options = options || {}; /** * The internal dispatcher. This is mostly used by the resources but provided * for custom requests to the API or API features that have not yet been added * to the client. * @type {Dispatcher} */ this.dispatcher = dispatcher; /**...
[ "function", "Client", "(", "dispatcher", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "/**\n * The internal dispatcher. This is mostly used by the resources but provided\n * for custom requests to the API or API features that have not yet been added\n ...
Constructs a Client with instances of all the resources using the dispatcher. It also keeps a reference to the dispatcher so that way the end user can have access to it. @class @classdesc A wrapper for the Asana API which is authenticated for one user @param {Dispatcher} dispatcher The request dispatcher to use @param ...
[ "Constructs", "a", "Client", "with", "instances", "of", "all", "the", "resources", "using", "the", "dispatcher", ".", "It", "also", "keeps", "a", "reference", "to", "the", "dispatcher", "so", "that", "way", "the", "end", "user", "can", "have", "access", "t...
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/client.js#L21-L113
train
Asana/node-asana
gulpfile.js
browserTask
function browserTask(minify) { return function() { var task = browserify( { entries: [index], standalone: 'Asana' }) .bundle() .pipe(vinylSourceStream('asana' + (minify ? '-min' : '') + '.js')); if (minify) { task = task .pipe(vinylBuffer()) ...
javascript
function browserTask(minify) { return function() { var task = browserify( { entries: [index], standalone: 'Asana' }) .bundle() .pipe(vinylSourceStream('asana' + (minify ? '-min' : '') + '.js')); if (minify) { task = task .pipe(vinylBuffer()) ...
[ "function", "browserTask", "(", "minify", ")", "{", "return", "function", "(", ")", "{", "var", "task", "=", "browserify", "(", "{", "entries", ":", "[", "index", "]", ",", "standalone", ":", "'Asana'", "}", ")", ".", "bundle", "(", ")", ".", "pipe",...
Bundles the code, full version to `asana.js` and minified to `asana-min.js`
[ "Bundles", "the", "code", "full", "version", "to", "asana", ".", "js", "and", "minified", "to", "asana", "-", "min", ".", "js" ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/gulpfile.js#L31-L47
train
Asana/node-asana
lib/auth/auto_detect.js
autoDetect
function autoDetect(env) { env = env || defaultEnvironment(); if (typeof(env.chrome) !== 'undefined' && env.chrome.runtime && env.chrome.runtime.id) { if (env.chrome.tabs && env.chrome.tabs.create) { return ChromeExtensionFlow; } else { // Chrome packaged app, not supported yet. return...
javascript
function autoDetect(env) { env = env || defaultEnvironment(); if (typeof(env.chrome) !== 'undefined' && env.chrome.runtime && env.chrome.runtime.id) { if (env.chrome.tabs && env.chrome.tabs.create) { return ChromeExtensionFlow; } else { // Chrome packaged app, not supported yet. return...
[ "function", "autoDetect", "(", "env", ")", "{", "env", "=", "env", "||", "defaultEnvironment", "(", ")", ";", "if", "(", "typeof", "(", "env", ".", "chrome", ")", "!==", "'undefined'", "&&", "env", ".", "chrome", ".", "runtime", "&&", "env", ".", "ch...
Auto-detects the type of Oauth flow to use that's appropriate to the environment. @returns {Function|null} The type of Oauth flow to use, or null if no appropriate type could be determined.
[ "Auto", "-", "detects", "the", "type", "of", "Oauth", "flow", "to", "use", "that", "s", "appropriate", "to", "the", "environment", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/auto_detect.js#L14-L34
train
Asana/node-asana
examples/oauth/webserver/oauth_webserver.js
createClient
function createClient() { return Asana.Client.create({ clientId: clientId, clientSecret: clientSecret, redirectUri: 'http://localhost:' + port + '/oauth_callback' }); }
javascript
function createClient() { return Asana.Client.create({ clientId: clientId, clientSecret: clientSecret, redirectUri: 'http://localhost:' + port + '/oauth_callback' }); }
[ "function", "createClient", "(", ")", "{", "return", "Asana", ".", "Client", ".", "create", "(", "{", "clientId", ":", "clientId", ",", "clientSecret", ":", "clientSecret", ",", "redirectUri", ":", "'http://localhost:'", "+", "port", "+", "'/oauth_callback'", ...
Create an Asana client. Do this per request since it keeps state that shouldn't be shared across requests.
[ "Create", "an", "Asana", "client", ".", "Do", "this", "per", "request", "since", "it", "keeps", "state", "that", "shouldn", "t", "be", "shared", "across", "requests", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/examples/oauth/webserver/oauth_webserver.js#L28-L34
train
Asana/node-asana
lib/auth/oauth_util.js
parseOauthResultFromUrl
function parseOauthResultFromUrl(currentUrl) { var oauthUrl = url.parse(currentUrl); return oauthUrl.hash ? querystring.parse(oauthUrl.hash.substr(1)) : null; }
javascript
function parseOauthResultFromUrl(currentUrl) { var oauthUrl = url.parse(currentUrl); return oauthUrl.hash ? querystring.parse(oauthUrl.hash.substr(1)) : null; }
[ "function", "parseOauthResultFromUrl", "(", "currentUrl", ")", "{", "var", "oauthUrl", "=", "url", ".", "parse", "(", "currentUrl", ")", ";", "return", "oauthUrl", ".", "hash", "?", "querystring", ".", "parse", "(", "oauthUrl", ".", "hash", ".", "substr", ...
Parses a URL and returns any Oauth result that may be encoded therein. @param currentUrl {String} Complete URL of a page. @returns {Object|null} Oauth fields found in the hash of the URL, or null if the URL does not contain a valid hash.
[ "Parses", "a", "URL", "and", "returns", "any", "Oauth", "result", "that", "may", "be", "encoded", "therein", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/oauth_util.js#L24-L27
train
Asana/node-asana
lib/auth/oauth_util.js
removeOauthResultFromCurrentUrl
function removeOauthResultFromCurrentUrl() { if (window.history && window.history.replaceState) { var url = window.location.href; var hashIndex = url.indexOf('#'); window.history.replaceState({}, document.title, url.substring(0, hashIndex)); } else { window.location.hash = ''; } }
javascript
function removeOauthResultFromCurrentUrl() { if (window.history && window.history.replaceState) { var url = window.location.href; var hashIndex = url.indexOf('#'); window.history.replaceState({}, document.title, url.substring(0, hashIndex)); } else { window.location.hash = ''; } }
[ "function", "removeOauthResultFromCurrentUrl", "(", ")", "{", "if", "(", "window", ".", "history", "&&", "window", ".", "history", ".", "replaceState", ")", "{", "var", "url", "=", "window", ".", "location", ".", "href", ";", "var", "hashIndex", "=", "url"...
Clean Oauth results out of the current browser URL, for security and cleanliness purposes. @returns {Object|null} Oauth fields found in the hash of the URL, or null if the URL does not contain a valid hash.
[ "Clean", "Oauth", "results", "out", "of", "the", "current", "browser", "URL", "for", "security", "and", "cleanliness", "purposes", "." ]
afcc41fedba997654f0e52a1652da128d5961486
https://github.com/Asana/node-asana/blob/afcc41fedba997654f0e52a1652da128d5961486/lib/auth/oauth_util.js#L35-L44
train
protobufjs/bytebuffer.js
dist/bytebuffer-node.js
stringSource
function stringSource(s) { var i=0; return function() { return i < s.length ? s.charCodeAt(i++) : null; }; }
javascript
function stringSource(s) { var i=0; return function() { return i < s.length ? s.charCodeAt(i++) : null; }; }
[ "function", "stringSource", "(", "s", ")", "{", "var", "i", "=", "0", ";", "return", "function", "(", ")", "{", "return", "i", "<", "s", ".", "length", "?", "s", ".", "charCodeAt", "(", "i", "++", ")", ":", "null", ";", "}", ";", "}" ]
Creates a source function for a string. @param {string} s String to read from @returns {function():number|null} Source function returning the next char code respectively `null` if there are no more characters left. @throws {TypeError} If the argument is invalid @inner
[ "Creates", "a", "source", "function", "for", "a", "string", "." ]
4144951c7f583d9394d18487ff0b2b7474b1e775
https://github.com/protobufjs/bytebuffer.js/blob/4144951c7f583d9394d18487ff0b2b7474b1e775/dist/bytebuffer-node.js#L205-L209
train
protobufjs/bytebuffer.js
dist/bytebuffer-node.js
stringDestination
function stringDestination() { var cs = [], ps = []; return function() { if (arguments.length === 0) return ps.join('')+stringFromCharCode.apply(String, cs); if (cs.length + arguments.length > 1024) ps.push(stringFromCharCode.apply(String, cs)), ...
javascript
function stringDestination() { var cs = [], ps = []; return function() { if (arguments.length === 0) return ps.join('')+stringFromCharCode.apply(String, cs); if (cs.length + arguments.length > 1024) ps.push(stringFromCharCode.apply(String, cs)), ...
[ "function", "stringDestination", "(", ")", "{", "var", "cs", "=", "[", "]", ",", "ps", "=", "[", "]", ";", "return", "function", "(", ")", "{", "if", "(", "arguments", ".", "length", "===", "0", ")", "return", "ps", ".", "join", "(", "''", ")", ...
Creates a destination function for a string. @returns {function(number=):undefined|string} Destination function successively called with the next char code. Returns the final string when called without arguments. @inner
[ "Creates", "a", "destination", "function", "for", "a", "string", "." ]
4144951c7f583d9394d18487ff0b2b7474b1e775
https://github.com/protobufjs/bytebuffer.js/blob/4144951c7f583d9394d18487ff0b2b7474b1e775/dist/bytebuffer-node.js#L217-L226
train
protobufjs/bytebuffer.js
src/helpers.js
assertLong
function assertLong(value, unsigned) { if (typeof value === 'number') { return Long.fromNumber(value, unsigned); } else if (typeof value === 'string') { return Long.fromString(value, unsigned); } else if (value && value instanceof Long) { if (typeof unsigned !== 'undefined') { ...
javascript
function assertLong(value, unsigned) { if (typeof value === 'number') { return Long.fromNumber(value, unsigned); } else if (typeof value === 'string') { return Long.fromString(value, unsigned); } else if (value && value instanceof Long) { if (typeof unsigned !== 'undefined') { ...
[ "function", "assertLong", "(", "value", ",", "unsigned", ")", "{", "if", "(", "typeof", "value", "===", "'number'", ")", "{", "return", "Long", ".", "fromNumber", "(", "value", ",", "unsigned", ")", ";", "}", "else", "if", "(", "typeof", "value", "==="...
Asserts that a value is an integer or Long. @param {number|!Long} value Value to assert @param {boolean=} unsigned Whether explicitly unsigned @returns {number|!Long} Type-safe value @throws {TypeError} If `value` is not an integer or Long @inner
[ "Asserts", "that", "a", "value", "is", "an", "integer", "or", "Long", "." ]
4144951c7f583d9394d18487ff0b2b7474b1e775
https://github.com/protobufjs/bytebuffer.js/blob/4144951c7f583d9394d18487ff0b2b7474b1e775/src/helpers.js#L41-L54
train
protobufjs/bytebuffer.js
src/helpers.js
assertOffset
function assertOffset(offset, min, cap, size) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset = offset | 0; if (offset < min || offset > cap-size) throw RangeError("Illegal offset: "+min+" <= "+value+" <= "+cap+"-"+...
javascript
function assertOffset(offset, min, cap, size) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset = offset | 0; if (offset < min || offset > cap-size) throw RangeError("Illegal offset: "+min+" <= "+value+" <= "+cap+"-"+...
[ "function", "assertOffset", "(", "offset", ",", "min", ",", "cap", ",", "size", ")", "{", "if", "(", "typeof", "offset", "!==", "'number'", "||", "offset", "%", "1", "!==", "0", ")", "throw", "TypeError", "(", "\"Illegal offset: \"", "+", "offset", "+", ...
Asserts that `min <= offset <= cap-size` and returns the type-safe offset. @param {number} offset Offset to assert @param {number} min Minimum offset @param {number} cap Cap offset @param {number} size Required size in bytes @returns {number} Type-safe offset @throws {TypeError} If `offset` is not an integer @throws {R...
[ "Asserts", "that", "min", "<", "=", "offset", "<", "=", "cap", "-", "size", "and", "returns", "the", "type", "-", "safe", "offset", "." ]
4144951c7f583d9394d18487ff0b2b7474b1e775
https://github.com/protobufjs/bytebuffer.js/blob/4144951c7f583d9394d18487ff0b2b7474b1e775/src/helpers.js#L67-L74
train
protobufjs/bytebuffer.js
src/helpers.js
assertRange
function assertRange(begin, end, min, cap) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: "+begin+" (not a number)"); begin = begin | 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: "+range[1]+" (not a number)"); end = e...
javascript
function assertRange(begin, end, min, cap) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: "+begin+" (not a number)"); begin = begin | 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: "+range[1]+" (not a number)"); end = e...
[ "function", "assertRange", "(", "begin", ",", "end", ",", "min", ",", "cap", ")", "{", "if", "(", "typeof", "begin", "!==", "'number'", "||", "begin", "%", "1", "!==", "0", ")", "throw", "TypeError", "(", "\"Illegal begin: \"", "+", "begin", "+", "\" (...
Asserts that `min <= begin <= end <= cap`. Updates `rangeVal` with the type-safe range. @param {number} begin Begin offset @param {number} end End offset @param {number} min Minimum offset @param {number} cap Cap offset @throws {TypeError} If `begin` or `end` is not an integer @throws {RangeError} If `begin < min || be...
[ "Asserts", "that", "min", "<", "=", "begin", "<", "=", "end", "<", "=", "cap", ".", "Updates", "rangeVal", "with", "the", "type", "-", "safe", "range", "." ]
4144951c7f583d9394d18487ff0b2b7474b1e775
https://github.com/protobufjs/bytebuffer.js/blob/4144951c7f583d9394d18487ff0b2b7474b1e775/src/helpers.js#L92-L102
train
googleads/videojs-ima
src/sdk-impl.js
function(controller) { /** * Plugin controller. */ this.controller = controller; /** * IMA SDK AdDisplayContainer. */ this.adDisplayContainer = null; /** * True if the AdDisplayContainer has been initialized. False otherwise. */ this.adDisplayContainerInitialized = false; /** * IMA...
javascript
function(controller) { /** * Plugin controller. */ this.controller = controller; /** * IMA SDK AdDisplayContainer. */ this.adDisplayContainer = null; /** * True if the AdDisplayContainer has been initialized. False otherwise. */ this.adDisplayContainerInitialized = false; /** * IMA...
[ "function", "(", "controller", ")", "{", "/**\n * Plugin controller.\n */", "this", ".", "controller", "=", "controller", ";", "/**\n * IMA SDK AdDisplayContainer.\n */", "this", ".", "adDisplayContainer", "=", "null", ";", "/**\n * True if the AdDisplayContainer has ...
Implementation of the IMA SDK for the plugin. @param {Object} controller Reference to the parent controller. @constructor @struct @final
[ "Implementation", "of", "the", "IMA", "SDK", "for", "the", "plugin", "." ]
e0d59f5a479467d954b3f31431f6535c6b8deb66
https://github.com/googleads/videojs-ima/blob/e0d59f5a479467d954b3f31431f6535c6b8deb66/src/sdk-impl.js#L31-L140
train
googleads/videojs-ima
src/controller.js
function(player, options) { /** * Stores user-provided settings. * @type {Object} */ this.settings = {}; /** * Content and ads ended listeners passed by the publisher to the plugin. * These will be called when the plugin detects that content *and all * ads* have completed. This differs from the...
javascript
function(player, options) { /** * Stores user-provided settings. * @type {Object} */ this.settings = {}; /** * Content and ads ended listeners passed by the publisher to the plugin. * These will be called when the plugin detects that content *and all * ads* have completed. This differs from the...
[ "function", "(", "player", ",", "options", ")", "{", "/**\n * Stores user-provided settings.\n * @type {Object}\n */", "this", ".", "settings", "=", "{", "}", ";", "/**\n * Content and ads ended listeners passed by the publisher to the plugin.\n * These will be called when th...
The grand coordinator of the plugin. Facilitates communication between all other plugin classes. @param {Object} player Instance of the video.js player. @param {Object} options Options provided by the implementation. @constructor @struct @final
[ "The", "grand", "coordinator", "of", "the", "plugin", ".", "Facilitates", "communication", "between", "all", "other", "plugin", "classes", "." ]
e0d59f5a479467d954b3f31431f6535c6b8deb66
https://github.com/googleads/videojs-ima/blob/e0d59f5a479467d954b3f31431f6535c6b8deb66/src/controller.js#L33-L79
train
cowbell/cordova-plugin-geofence
www/geofence.js
function (geofences, success, error) { if (!Array.isArray(geofences)) { geofences = [geofences]; } geofences.forEach(coerceProperties); if (isIOS) { return addOrUpdateIOS(geofences, success, error); } return execPromise(success, error, "Geofence...
javascript
function (geofences, success, error) { if (!Array.isArray(geofences)) { geofences = [geofences]; } geofences.forEach(coerceProperties); if (isIOS) { return addOrUpdateIOS(geofences, success, error); } return execPromise(success, error, "Geofence...
[ "function", "(", "geofences", ",", "success", ",", "error", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "geofences", ")", ")", "{", "geofences", "=", "[", "geofences", "]", ";", "}", "geofences", ".", "forEach", "(", "coerceProperties", ")"...
Adding new geofence to monitor. Geofence could override the previously one with the same id. @name addOrUpdate @param {Geofence|Array} geofences @param {Function} success callback @param {Function} error callback @return {Promise}
[ "Adding", "new", "geofence", "to", "monitor", ".", "Geofence", "could", "override", "the", "previously", "one", "with", "the", "same", "id", "." ]
091907de34304202dc461f8787b292294ee6d1b0
https://github.com/cowbell/cordova-plugin-geofence/blob/091907de34304202dc461f8787b292294ee6d1b0/www/geofence.js#L51-L63
train
cowbell/cordova-plugin-geofence
www/geofence.js
function (ids, success, error) { if (!Array.isArray(ids)) { ids = [ids]; } return execPromise(success, error, "GeofencePlugin", "remove", ids); }
javascript
function (ids, success, error) { if (!Array.isArray(ids)) { ids = [ids]; } return execPromise(success, error, "GeofencePlugin", "remove", ids); }
[ "function", "(", "ids", ",", "success", ",", "error", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "ids", ")", ")", "{", "ids", "=", "[", "ids", "]", ";", "}", "return", "execPromise", "(", "success", ",", "error", ",", "\"GeofencePlugin...
Removing geofences with given ids @name remove @param {Number|Array} ids @param {Function} success callback @param {Function} error callback @return {Promise}
[ "Removing", "geofences", "with", "given", "ids" ]
091907de34304202dc461f8787b292294ee6d1b0
https://github.com/cowbell/cordova-plugin-geofence/blob/091907de34304202dc461f8787b292294ee6d1b0/www/geofence.js#L73-L78
train
dgraph-io/dgraph-js
examples/tls/index.js
newClientStub
function newClientStub() { // First create the appropriate TLS certs with dgraph cert: // $ dgraph cert // $ dgraph cert -n localhost // $ dgraph cert -c user const rootCaCert = fs.readFileSync(path.join(__dirname, 'tls', 'ca.crt')); const clientCertKey = fs.readFileSync(path.join(__...
javascript
function newClientStub() { // First create the appropriate TLS certs with dgraph cert: // $ dgraph cert // $ dgraph cert -n localhost // $ dgraph cert -c user const rootCaCert = fs.readFileSync(path.join(__dirname, 'tls', 'ca.crt')); const clientCertKey = fs.readFileSync(path.join(__...
[ "function", "newClientStub", "(", ")", "{", "// First create the appropriate TLS certs with dgraph cert:", "// $ dgraph cert", "// $ dgraph cert -n localhost", "// $ dgraph cert -c user", "const", "rootCaCert", "=", "fs", ".", "readFileSync", "(", "path", ".", "join",...
Create a client stub.
[ "Create", "a", "client", "stub", "." ]
c32c1af2c3d536bf0d14252be604a863556920a7
https://github.com/dgraph-io/dgraph-js/blob/c32c1af2c3d536bf0d14252be604a863556920a7/examples/tls/index.js#L8-L19
train
dgraph-io/dgraph-js
examples/tls/index.js
dropAll
async function dropAll(dgraphClient) { const op = new dgraph.Operation(); op.setDropAll(true); await dgraphClient.alter(op); }
javascript
async function dropAll(dgraphClient) { const op = new dgraph.Operation(); op.setDropAll(true); await dgraphClient.alter(op); }
[ "async", "function", "dropAll", "(", "dgraphClient", ")", "{", "const", "op", "=", "new", "dgraph", ".", "Operation", "(", ")", ";", "op", ".", "setDropAll", "(", "true", ")", ";", "await", "dgraphClient", ".", "alter", "(", "op", ")", ";", "}" ]
Drop All - discard all data and start from a clean slate.
[ "Drop", "All", "-", "discard", "all", "data", "and", "start", "from", "a", "clean", "slate", "." ]
c32c1af2c3d536bf0d14252be604a863556920a7
https://github.com/dgraph-io/dgraph-js/blob/c32c1af2c3d536bf0d14252be604a863556920a7/examples/tls/index.js#L27-L31
train
dgraph-io/dgraph-js
examples/tls/index.js
createData
async function createData(dgraphClient) { // Create a new transaction. const txn = dgraphClient.newTxn(); try { // Create data. const p = { name: "Alice", age: 26, married: true, loc: { type: "Point", coordinates...
javascript
async function createData(dgraphClient) { // Create a new transaction. const txn = dgraphClient.newTxn(); try { // Create data. const p = { name: "Alice", age: 26, married: true, loc: { type: "Point", coordinates...
[ "async", "function", "createData", "(", "dgraphClient", ")", "{", "// Create a new transaction.", "const", "txn", "=", "dgraphClient", ".", "newTxn", "(", ")", ";", "try", "{", "// Create data.", "const", "p", "=", "{", "name", ":", "\"Alice\"", ",", "age", ...
Create data using JSON.
[ "Create", "data", "using", "JSON", "." ]
c32c1af2c3d536bf0d14252be604a863556920a7
https://github.com/dgraph-io/dgraph-js/blob/c32c1af2c3d536bf0d14252be604a863556920a7/examples/tls/index.js#L48-L101
train
darthbatman/billboard-top-100
billboard-top-100.js
yyyymmddDateFromMonthDayYearDate
function yyyymmddDateFromMonthDayYearDate(monthDayYearDate) { var yyyy = monthDayYearDate.split(',')[1].trim(); var dd = monthDayYearDate.split(' ')[1].split(',')[0]; var mm = ''; switch (monthDayYearDate.split(' ')[0]) { case 'January': mm = '01'; break; case 'February': mm = '02'; break; case '...
javascript
function yyyymmddDateFromMonthDayYearDate(monthDayYearDate) { var yyyy = monthDayYearDate.split(',')[1].trim(); var dd = monthDayYearDate.split(' ')[1].split(',')[0]; var mm = ''; switch (monthDayYearDate.split(' ')[0]) { case 'January': mm = '01'; break; case 'February': mm = '02'; break; case '...
[ "function", "yyyymmddDateFromMonthDayYearDate", "(", "monthDayYearDate", ")", "{", "var", "yyyy", "=", "monthDayYearDate", ".", "split", "(", "','", ")", "[", "1", "]", ".", "trim", "(", ")", ";", "var", "dd", "=", "monthDayYearDate", ".", "split", "(", "'...
Converts Month Day, Year date to YYYY-MM-DD date @param {string} monthDayYearDate - The Month Day, Year date @return {string} The YYYY-MM-DD date @example yyyymmddDateFromMonthDayYearDate("November 19, 2016") // 2016-11-19
[ "Converts", "Month", "Day", "Year", "date", "to", "YYYY", "-", "MM", "-", "DD", "date" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L53-L96
train
darthbatman/billboard-top-100
billboard-top-100.js
getTitleFromChartItem
function getTitleFromChartItem(chartItem) { var title; try { title = chartItem.children[1].children[5].children[1].children[1].children[1].children[0].data.replace(/\n/g, ''); } catch (e) { title = ''; } return title; }
javascript
function getTitleFromChartItem(chartItem) { var title; try { title = chartItem.children[1].children[5].children[1].children[1].children[1].children[0].data.replace(/\n/g, ''); } catch (e) { title = ''; } return title; }
[ "function", "getTitleFromChartItem", "(", "chartItem", ")", "{", "var", "title", ";", "try", "{", "title", "=", "chartItem", ".", "children", "[", "1", "]", ".", "children", "[", "5", "]", ".", "children", "[", "1", "]", ".", "children", "[", "1", "]...
IMPLEMENTATION FUNCTIONS Gets the title from the specified chart item @param {HTMLElement} chartItem - The chart item @return {string} The title @example getTitleFromChartItem(<div class="chart-list-item">...</div>) // 'The Real Slim Shady'
[ "IMPLEMENTATION", "FUNCTIONS", "Gets", "the", "title", "from", "the", "specified", "chart", "item" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L110-L118
train
darthbatman/billboard-top-100
billboard-top-100.js
getArtistFromChartItem
function getArtistFromChartItem(chartItem) { var artist; try { artist = chartItem.children[1].children[5].children[1].children[3].children[0].data.replace(/\n/g, ''); } catch (e) { artist = ''; } if (artist.trim().length < 1) { try { artist = chartItem.children[1].children[5].children[1].children[3].child...
javascript
function getArtistFromChartItem(chartItem) { var artist; try { artist = chartItem.children[1].children[5].children[1].children[3].children[0].data.replace(/\n/g, ''); } catch (e) { artist = ''; } if (artist.trim().length < 1) { try { artist = chartItem.children[1].children[5].children[1].children[3].child...
[ "function", "getArtistFromChartItem", "(", "chartItem", ")", "{", "var", "artist", ";", "try", "{", "artist", "=", "chartItem", ".", "children", "[", "1", "]", ".", "children", "[", "5", "]", ".", "children", "[", "1", "]", ".", "children", "[", "3", ...
Gets the artist from the specified chart item @param {HTMLElement} chartItem - The chart item @return {string} The artist @example getArtistFromChartItem(<div class="chart-list-item">...</div>) // 'Eminem'
[ "Gets", "the", "artist", "from", "the", "specified", "chart", "item" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L130-L145
train
darthbatman/billboard-top-100
billboard-top-100.js
getPositionLastWeekFromChartItem
function getPositionLastWeekFromChartItem(chartItem) { var positionLastWeek; try { if (chartItem.children[3].children.length > 5) { positionLastWeek = chartItem.children[3].children[5].children[3].children[3].children[0].data } else { positionLastWeek = chartItem.children[3].children[3].children[1].children...
javascript
function getPositionLastWeekFromChartItem(chartItem) { var positionLastWeek; try { if (chartItem.children[3].children.length > 5) { positionLastWeek = chartItem.children[3].children[5].children[3].children[3].children[0].data } else { positionLastWeek = chartItem.children[3].children[3].children[1].children...
[ "function", "getPositionLastWeekFromChartItem", "(", "chartItem", ")", "{", "var", "positionLastWeek", ";", "try", "{", "if", "(", "chartItem", ".", "children", "[", "3", "]", ".", "children", ".", "length", ">", "5", ")", "{", "positionLastWeek", "=", "char...
Gets the position last week from the specified chart item @param {HTMLElement} chartItem - The chart item @return {number} The position last week @example getPositionLastWeekFromChartItem(<div class="chart-list-item">...</div>) // 4
[ "Gets", "the", "position", "last", "week", "from", "the", "specified", "chart", "item" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L201-L213
train
darthbatman/billboard-top-100
billboard-top-100.js
getPeakPositionFromChartItem
function getPeakPositionFromChartItem(chartItem) { var peakPosition; try { if (chartItem.children[3].children.length > 5) { peakPosition = chartItem.children[3].children[5].children[5].children[3].children[0].data; } else { peakPosition = chartItem.children[3].children[3].children[3].children[3].children[0]...
javascript
function getPeakPositionFromChartItem(chartItem) { var peakPosition; try { if (chartItem.children[3].children.length > 5) { peakPosition = chartItem.children[3].children[5].children[5].children[3].children[0].data; } else { peakPosition = chartItem.children[3].children[3].children[3].children[3].children[0]...
[ "function", "getPeakPositionFromChartItem", "(", "chartItem", ")", "{", "var", "peakPosition", ";", "try", "{", "if", "(", "chartItem", ".", "children", "[", "3", "]", ".", "children", ".", "length", ">", "5", ")", "{", "peakPosition", "=", "chartItem", "....
Gets the peak position from the specified chart item @param {HTMLElement} chartItem - The chart item @return {number} The peak position @example getPeakPositionFromChartItem(<div class="chart-list-item">...</div>) // 4
[ "Gets", "the", "peak", "position", "from", "the", "specified", "chart", "item" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L225-L237
train
darthbatman/billboard-top-100
billboard-top-100.js
getWeeksOnChartFromChartItem
function getWeeksOnChartFromChartItem(chartItem) { var weeksOnChart; try { if (chartItem.children[3].children.length > 5) { weeksOnChart = chartItem.children[3].children[5].children[7].children[3].children[0].data; } else { weeksOnChart = chartItem.children[3].children[3].children[5].children[3].children[0]...
javascript
function getWeeksOnChartFromChartItem(chartItem) { var weeksOnChart; try { if (chartItem.children[3].children.length > 5) { weeksOnChart = chartItem.children[3].children[5].children[7].children[3].children[0].data; } else { weeksOnChart = chartItem.children[3].children[3].children[5].children[3].children[0]...
[ "function", "getWeeksOnChartFromChartItem", "(", "chartItem", ")", "{", "var", "weeksOnChart", ";", "try", "{", "if", "(", "chartItem", ".", "children", "[", "3", "]", ".", "children", ".", "length", ">", "5", ")", "{", "weeksOnChart", "=", "chartItem", "....
Gets the weeks on chart last week from the specified chart item @param {HTMLElement} chartItem - The chart item @return {number} The weeks on chart @example getWeeksOnChartFromChartItem(<div class="chart-list-item">...</div>) // 4
[ "Gets", "the", "weeks", "on", "chart", "last", "week", "from", "the", "specified", "chart", "item" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L249-L261
train
darthbatman/billboard-top-100
billboard-top-100.js
getNeighboringChart
function getNeighboringChart(chartItem, neighboringWeek) { if (neighboringWeek == NeighboringWeek.Previous) { if (chartItem[0].attribs.class.indexOf('dropdown__date-selector-option--disabled') == -1) { return { url: BILLBOARD_BASE_URL + chartItem[0].children[1].attribs.href, date: chartItem[0].children[1]...
javascript
function getNeighboringChart(chartItem, neighboringWeek) { if (neighboringWeek == NeighboringWeek.Previous) { if (chartItem[0].attribs.class.indexOf('dropdown__date-selector-option--disabled') == -1) { return { url: BILLBOARD_BASE_URL + chartItem[0].children[1].attribs.href, date: chartItem[0].children[1]...
[ "function", "getNeighboringChart", "(", "chartItem", ",", "neighboringWeek", ")", "{", "if", "(", "neighboringWeek", "==", "NeighboringWeek", ".", "Previous", ")", "{", "if", "(", "chartItem", "[", "0", "]", ".", "attribs", ".", "class", ".", "indexOf", "(",...
Gets the neighboring chart for a given chart item and neighboring week type. @param {HTMLElement} chartItem - The chart item @param {enum} neighboringWeek - The type of neighboring week @return {object} The neighboring chart with url and week @example getNeighboringChart(<div class="dropdown__date-selector-option">....
[ "Gets", "the", "neighboring", "chart", "for", "a", "given", "chart", "item", "and", "neighboring", "week", "type", "." ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L274-L294
train
darthbatman/billboard-top-100
billboard-top-100.js
getChart
function getChart(chartName, date, cb) { // check if chart was specified if (typeof chartName === 'function') { // if chartName not specified, default to hot-100 chart for current week, // and set callback method accordingly cb = chartName; chartName = 'hot-100'; date = ''; } // check if date was specifi...
javascript
function getChart(chartName, date, cb) { // check if chart was specified if (typeof chartName === 'function') { // if chartName not specified, default to hot-100 chart for current week, // and set callback method accordingly cb = chartName; chartName = 'hot-100'; date = ''; } // check if date was specifi...
[ "function", "getChart", "(", "chartName", ",", "date", ",", "cb", ")", "{", "// check if chart was specified", "if", "(", "typeof", "chartName", "===", "'function'", ")", "{", "// if chartName not specified, default to hot-100 chart for current week, ", "// and set callback m...
Gets information for specified chart and date @param {string} chartName - The specified chart @param {string} date - Date represented as string in format 'YYYY-MM-DD' @param {function} cb - The specified callback method @example getChart('hot-100', '2016-08-27', function(err, chart) {...})
[ "Gets", "information", "for", "specified", "chart", "and", "date" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L307-L373
train
darthbatman/billboard-top-100
billboard-top-100.js
listCharts
function listCharts(cb) { if (typeof cb !== 'function') { cb('Specified callback is not a function.', null); return; } request(BILLBOARD_CHARTS_URL, function completedRequest(error, response, html) { if (error) { cb(error, null); return; } var $ = cheerio.load(html); /** * A chart * @typedef ...
javascript
function listCharts(cb) { if (typeof cb !== 'function') { cb('Specified callback is not a function.', null); return; } request(BILLBOARD_CHARTS_URL, function completedRequest(error, response, html) { if (error) { cb(error, null); return; } var $ = cheerio.load(html); /** * A chart * @typedef ...
[ "function", "listCharts", "(", "cb", ")", "{", "if", "(", "typeof", "cb", "!==", "'function'", ")", "{", "cb", "(", "'Specified callback is not a function.'", ",", "null", ")", ";", "return", ";", "}", "request", "(", "BILLBOARD_CHARTS_URL", ",", "function", ...
Gets all charts available via Billboard @param {string} chart - The specified chart @param {string} date - Date represented as string in format 'YYYY-MM-DD' @param {function} cb - The specified callback method @example listCharts(function(err, charts) {...})
[ "Gets", "all", "charts", "available", "via", "Billboard" ]
6169e74bda974c004575dd71f28d50eb07aa1dcf
https://github.com/darthbatman/billboard-top-100/blob/6169e74bda974c004575dd71f28d50eb07aa1dcf/billboard-top-100.js#L386-L424
train
woocommerce/wc-api-node
index.js
WooCommerceAPI
function WooCommerceAPI(opt) { if (!(this instanceof WooCommerceAPI)) { return new WooCommerceAPI(opt); } opt = opt || {}; if (!(opt.url)) { throw new Error('url is required'); } if (!(opt.consumerKey)) { throw new Error('consumerKey is required'); } if (!(opt.consumerSecret)) { thro...
javascript
function WooCommerceAPI(opt) { if (!(this instanceof WooCommerceAPI)) { return new WooCommerceAPI(opt); } opt = opt || {}; if (!(opt.url)) { throw new Error('url is required'); } if (!(opt.consumerKey)) { throw new Error('consumerKey is required'); } if (!(opt.consumerSecret)) { thro...
[ "function", "WooCommerceAPI", "(", "opt", ")", "{", "if", "(", "!", "(", "this", "instanceof", "WooCommerceAPI", ")", ")", "{", "return", "new", "WooCommerceAPI", "(", "opt", ")", ";", "}", "opt", "=", "opt", "||", "{", "}", ";", "if", "(", "!", "(...
WooCommerce REST API wrapper @param {Object} opt
[ "WooCommerce", "REST", "API", "wrapper" ]
0844e882ffd675bcae489d89621fb39350eec483
https://github.com/woocommerce/wc-api-node/blob/0844e882ffd675bcae489d89621fb39350eec483/index.js#L16-L37
train
salsify/ember-css-modules
lib/resolve-path.js
resolveExternalPath
function resolveExternalPath(importPath, options) { let baseIndex = importPath[0] === '@' ? importPath.indexOf('/') + 1 : 0; let addonName = importPath.substring(0, importPath.indexOf('/', baseIndex)); let addon = options.parent.addons.find(addon => addon.name === addonName); if (!addon) { throw new Error(...
javascript
function resolveExternalPath(importPath, options) { let baseIndex = importPath[0] === '@' ? importPath.indexOf('/') + 1 : 0; let addonName = importPath.substring(0, importPath.indexOf('/', baseIndex)); let addon = options.parent.addons.find(addon => addon.name === addonName); if (!addon) { throw new Error(...
[ "function", "resolveExternalPath", "(", "importPath", ",", "options", ")", "{", "let", "baseIndex", "=", "importPath", "[", "0", "]", "===", "'@'", "?", "importPath", ".", "indexOf", "(", "'/'", ")", "+", "1", ":", "0", ";", "let", "addonName", "=", "i...
Resolve absolute paths pointing to external addons
[ "Resolve", "absolute", "paths", "pointing", "to", "external", "addons" ]
cb6b2bf03eb6512f7fa3f66bf886540a16fdbfdc
https://github.com/salsify/ember-css-modules/blob/cb6b2bf03eb6512f7fa3f66bf886540a16fdbfdc/lib/resolve-path.js#L40-L55
train
salsify/ember-css-modules
addon/decorators.js
isStage1ClassDescriptor
function isStage1ClassDescriptor(possibleDesc) { let [target] = possibleDesc; return ( possibleDesc.length === 1 && typeof target === 'function' && 'prototype' in target && !target.__isComputedDecorator ); }
javascript
function isStage1ClassDescriptor(possibleDesc) { let [target] = possibleDesc; return ( possibleDesc.length === 1 && typeof target === 'function' && 'prototype' in target && !target.__isComputedDecorator ); }
[ "function", "isStage1ClassDescriptor", "(", "possibleDesc", ")", "{", "let", "[", "target", "]", "=", "possibleDesc", ";", "return", "(", "possibleDesc", ".", "length", "===", "1", "&&", "typeof", "target", "===", "'function'", "&&", "'prototype'", "in", "targ...
These utilities are from @ember-decorators/utils https://github.com/ember-decorators/ember-decorators/blob/f3e3d636a38d99992af326a1012d69bf10a2cb4c/packages/utils/addon/-private/class-field-descriptor.js
[ "These", "utilities", "are", "from" ]
cb6b2bf03eb6512f7fa3f66bf886540a16fdbfdc
https://github.com/salsify/ember-css-modules/blob/cb6b2bf03eb6512f7fa3f66bf886540a16fdbfdc/addon/decorators.js#L126-L135
train
madebymany/sir-trevor-js
src/block_mixins/droppable.js
function() { this.inner.setAttribute('tabindex', 0); this.inner.addEventListener('keyup', (e) => { if (e.target !== this.inner) { return; } switch(e.keyCode) { case 13: this.mediator.trigger("block:create", 'Text', null, this.el, { autoFocus: true }); break; case...
javascript
function() { this.inner.setAttribute('tabindex', 0); this.inner.addEventListener('keyup', (e) => { if (e.target !== this.inner) { return; } switch(e.keyCode) { case 13: this.mediator.trigger("block:create", 'Text', null, this.el, { autoFocus: true }); break; case...
[ "function", "(", ")", "{", "this", ".", "inner", ".", "setAttribute", "(", "'tabindex'", ",", "0", ")", ";", "this", ".", "inner", ".", "addEventListener", "(", "'keyup'", ",", "(", "e", ")", "=>", "{", "if", "(", "e", ".", "target", "!==", "this",...
Allow this block to be managed with the keyboard
[ "Allow", "this", "block", "to", "be", "managed", "with", "the", "keyboard" ]
1e604eb0715ba4b78ed20e8a0eef0abb76985edb
https://github.com/madebymany/sir-trevor-js/blob/1e604eb0715ba4b78ed20e8a0eef0abb76985edb/src/block_mixins/droppable.js#L73-L87
train
madebymany/sir-trevor-js
examples/javascript/example_block.js
function(){ var dataObj = {}; var content = this.getTextBlock().html(); if (content.length > 0) { dataObj.text = SirTrevor.toMarkdown(content, this.type); } this.setData(dataObj); }
javascript
function(){ var dataObj = {}; var content = this.getTextBlock().html(); if (content.length > 0) { dataObj.text = SirTrevor.toMarkdown(content, this.type); } this.setData(dataObj); }
[ "function", "(", ")", "{", "var", "dataObj", "=", "{", "}", ";", "var", "content", "=", "this", ".", "getTextBlock", "(", ")", ".", "html", "(", ")", ";", "if", "(", "content", ".", "length", ">", "0", ")", "{", "dataObj", ".", "text", "=", "Si...
Function; Executed on save of the block, once the block is validated toData expects a way for the block to be transformed from inputs into structured data The default toData function provides a pretty comprehensive way of turning data into JSON In this example we take the text data and save it to the data object on the...
[ "Function", ";", "Executed", "on", "save", "of", "the", "block", "once", "the", "block", "is", "validated", "toData", "expects", "a", "way", "for", "the", "block", "to", "be", "transformed", "from", "inputs", "into", "structured", "data", "The", "default", ...
1e604eb0715ba4b78ed20e8a0eef0abb76985edb
https://github.com/madebymany/sir-trevor-js/blob/1e604eb0715ba4b78ed20e8a0eef0abb76985edb/examples/javascript/example_block.js#L126-L135
train
madebymany/sir-trevor-js
src/blocks/scribe-plugins/scribe-paste-plugin.js
removeWrappingParagraphForFirefox
function removeWrappingParagraphForFirefox(value) { var fakeContent = document.createElement('div'); fakeContent.innerHTML = value; if (fakeContent.childNodes.length === 1) { var node = [].slice.call(fakeContent.childNodes)[0]; if (node && node.nodeName === "P") { value = node.innerHTML; } } ...
javascript
function removeWrappingParagraphForFirefox(value) { var fakeContent = document.createElement('div'); fakeContent.innerHTML = value; if (fakeContent.childNodes.length === 1) { var node = [].slice.call(fakeContent.childNodes)[0]; if (node && node.nodeName === "P") { value = node.innerHTML; } } ...
[ "function", "removeWrappingParagraphForFirefox", "(", "value", ")", "{", "var", "fakeContent", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "fakeContent", ".", "innerHTML", "=", "value", ";", "if", "(", "fakeContent", ".", "childNodes", ".", ...
In firefox when you paste any text is wraps in a paragraph block which we don't want.
[ "In", "firefox", "when", "you", "paste", "any", "text", "is", "wraps", "in", "a", "paragraph", "block", "which", "we", "don", "t", "want", "." ]
1e604eb0715ba4b78ed20e8a0eef0abb76985edb
https://github.com/madebymany/sir-trevor-js/blob/1e604eb0715ba4b78ed20e8a0eef0abb76985edb/src/blocks/scribe-plugins/scribe-paste-plugin.js#L28-L40
train
roman01la/html-to-react-components
lib/html2jsx.js
eachObj
function eachObj(obj, iteratee, context) { for (var key in obj) { if (obj.hasOwnProperty(key)) { iteratee.call(context || obj, key, obj[key]); } } }
javascript
function eachObj(obj, iteratee, context) { for (var key in obj) { if (obj.hasOwnProperty(key)) { iteratee.call(context || obj, key, obj[key]); } } }
[ "function", "eachObj", "(", "obj", ",", "iteratee", ",", "context", ")", "{", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "iteratee", ".", "call", "(", "context", "||", "obj",...
Iterates over elements of object invokes iteratee for each element @param {object} obj Collection object @param {function} iteratee Callback function called in iterative processing @param {any} context This arg (aka Context)
[ "Iterates", "over", "elements", "of", "object", "invokes", "iteratee", "for", "each", "element" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L146-L152
train
roman01la/html-to-react-components
lib/html2jsx.js
jsxTagName
function jsxTagName(tagName) { var name = tagName.toLowerCase(); if (ELEMENT_TAG_NAME_MAPPING.hasOwnProperty(name)) { name = ELEMENT_TAG_NAME_MAPPING[name]; } return name; }
javascript
function jsxTagName(tagName) { var name = tagName.toLowerCase(); if (ELEMENT_TAG_NAME_MAPPING.hasOwnProperty(name)) { name = ELEMENT_TAG_NAME_MAPPING[name]; } return name; }
[ "function", "jsxTagName", "(", "tagName", ")", "{", "var", "name", "=", "tagName", ".", "toLowerCase", "(", ")", ";", "if", "(", "ELEMENT_TAG_NAME_MAPPING", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "name", "=", "ELEMENT_TAG_NAME_MAPPING", "[", "nam...
Convert tag name to tag name suitable for JSX. @param {string} tagName String of tag name @return {string}
[ "Convert", "tag", "name", "to", "tag", "name", "suitable", "for", "JSX", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L174-L182
train
roman01la/html-to-react-components
lib/html2jsx.js
trimEnd
function trimEnd(haystack, needle) { return endsWith(haystack, needle) ? haystack.slice(0, -needle.length) : haystack; }
javascript
function trimEnd(haystack, needle) { return endsWith(haystack, needle) ? haystack.slice(0, -needle.length) : haystack; }
[ "function", "trimEnd", "(", "haystack", ",", "needle", ")", "{", "return", "endsWith", "(", "haystack", ",", "needle", ")", "?", "haystack", ".", "slice", "(", "0", ",", "-", "needle", ".", "length", ")", ":", "haystack", ";", "}" ]
Trim the specified substring off the string. If the string does not end with the specified substring, this is a no-op. @param {string} haystack String to search in @param {string} needle String to search for @return {string}
[ "Trim", "the", "specified", "substring", "off", "the", "string", ".", "If", "the", "string", "does", "not", "end", "with", "the", "specified", "substring", "this", "is", "a", "no", "-", "op", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L229-L233
train
roman01la/html-to-react-components
lib/html2jsx.js
isNumeric
function isNumeric(input) { return input !== undefined && input !== null && (typeof input === 'number' || parseInt(input, 10) == input); }
javascript
function isNumeric(input) { return input !== undefined && input !== null && (typeof input === 'number' || parseInt(input, 10) == input); }
[ "function", "isNumeric", "(", "input", ")", "{", "return", "input", "!==", "undefined", "&&", "input", "!==", "null", "&&", "(", "typeof", "input", "===", "'number'", "||", "parseInt", "(", "input", ",", "10", ")", "==", "input", ")", ";", "}" ]
Determines if the specified string consists entirely of numeric characters.
[ "Determines", "if", "the", "specified", "string", "consists", "entirely", "of", "numeric", "characters", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L265-L269
train
roman01la/html-to-react-components
lib/html2jsx.js
function (html) { this.reset(); var containerEl = createElement('div'); containerEl.innerHTML = '\n' + this._cleanInput(html) + '\n'; if (this.config.createClass) { if (this.config.outputClassName) { this.output = 'var ' + this.config.outputClassName + ' = React.createClass({\n'; }...
javascript
function (html) { this.reset(); var containerEl = createElement('div'); containerEl.innerHTML = '\n' + this._cleanInput(html) + '\n'; if (this.config.createClass) { if (this.config.outputClassName) { this.output = 'var ' + this.config.outputClassName + ' = React.createClass({\n'; }...
[ "function", "(", "html", ")", "{", "this", ".", "reset", "(", ")", ";", "var", "containerEl", "=", "createElement", "(", "'div'", ")", ";", "containerEl", ".", "innerHTML", "=", "'\\n'", "+", "this", ".", "_cleanInput", "(", "html", ")", "+", "'\\n'", ...
Main entry point to the converter. Given the specified HTML, returns a JSX object representing it. @param {string} html HTML to convert @return {string} JSX
[ "Main", "entry", "point", "to", "the", "converter", ".", "Given", "the", "specified", "HTML", "returns", "a", "JSX", "object", "representing", "it", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L326-L362
train
roman01la/html-to-react-components
lib/html2jsx.js
function (containerEl) { // Only a single child element if ( containerEl.childNodes.length === 1 && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT ) { return true; } // Only one element, and all other children are whitespace var foundElement = false; for (var i = ...
javascript
function (containerEl) { // Only a single child element if ( containerEl.childNodes.length === 1 && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT ) { return true; } // Only one element, and all other children are whitespace var foundElement = false; for (var i = ...
[ "function", "(", "containerEl", ")", "{", "// Only a single child element", "if", "(", "containerEl", ".", "childNodes", ".", "length", "===", "1", "&&", "containerEl", ".", "childNodes", "[", "0", "]", ".", "nodeType", "===", "NODE_TYPE", ".", "ELEMENT", ")",...
Determines if there's only one top-level node in the DOM tree. That is, all the HTML is wrapped by a single HTML tag. @param {DOMElement} containerEl Container element @return {boolean}
[ "Determines", "if", "there", "s", "only", "one", "top", "-", "level", "node", "in", "the", "DOM", "tree", ".", "That", "is", "all", "the", "HTML", "is", "wrapped", "by", "a", "single", "HTML", "tag", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L387-L413
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { this.level++; for (var i = 0, count = node.childNodes.length; i < count; i++) { this._visit(node.childNodes[i]); } this.level--; }
javascript
function (node) { this.level++; for (var i = 0, count = node.childNodes.length; i < count; i++) { this._visit(node.childNodes[i]); } this.level--; }
[ "function", "(", "node", ")", "{", "this", ".", "level", "++", ";", "for", "(", "var", "i", "=", "0", ",", "count", "=", "node", ".", "childNodes", ".", "length", ";", "i", "<", "count", ";", "i", "++", ")", "{", "this", ".", "_visit", "(", "...
Traverses all the children of the specified node @param {Node} node
[ "Traverses", "all", "the", "children", "of", "the", "specified", "node" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L441-L447
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { switch (node.nodeType) { case NODE_TYPE.ELEMENT: this._beginVisitElement(node); break; case NODE_TYPE.TEXT: this._visitText(node); break; case NODE_TYPE.COMMENT: this._visitComment(node); break; default: console.war...
javascript
function (node) { switch (node.nodeType) { case NODE_TYPE.ELEMENT: this._beginVisitElement(node); break; case NODE_TYPE.TEXT: this._visitText(node); break; case NODE_TYPE.COMMENT: this._visitComment(node); break; default: console.war...
[ "function", "(", "node", ")", "{", "switch", "(", "node", ".", "nodeType", ")", "{", "case", "NODE_TYPE", ".", "ELEMENT", ":", "this", ".", "_beginVisitElement", "(", "node", ")", ";", "break", ";", "case", "NODE_TYPE", ".", "TEXT", ":", "this", ".", ...
Handle pre-visit behaviour for the specified node. @param {Node} node
[ "Handle", "pre", "-", "visit", "behaviour", "for", "the", "specified", "node", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L454-L471
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { switch (node.nodeType) { case NODE_TYPE.ELEMENT: this._endVisitElement(node); break; // No ending tags required for these types case NODE_TYPE.TEXT: case NODE_TYPE.COMMENT: break; } }
javascript
function (node) { switch (node.nodeType) { case NODE_TYPE.ELEMENT: this._endVisitElement(node); break; // No ending tags required for these types case NODE_TYPE.TEXT: case NODE_TYPE.COMMENT: break; } }
[ "function", "(", "node", ")", "{", "switch", "(", "node", ".", "nodeType", ")", "{", "case", "NODE_TYPE", ".", "ELEMENT", ":", "this", ".", "_endVisitElement", "(", "node", ")", ";", "break", ";", "// No ending tags required for these types", "case", "NODE_TYP...
Handles post-visit behaviour for the specified node. @param {Node} node
[ "Handles", "post", "-", "visit", "behaviour", "for", "the", "specified", "node", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L478-L488
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { var tagName = jsxTagName(node.tagName); var attributes = []; for (var i = 0, count = node.attributes.length; i < count; i++) { attributes.push(this._getElementAttribute(node, node.attributes[i])); } if (tagName === 'textarea') { // Hax: textareas need their inner text ...
javascript
function (node) { var tagName = jsxTagName(node.tagName); var attributes = []; for (var i = 0, count = node.attributes.length; i < count; i++) { attributes.push(this._getElementAttribute(node, node.attributes[i])); } if (tagName === 'textarea') { // Hax: textareas need their inner text ...
[ "function", "(", "node", ")", "{", "var", "tagName", "=", "jsxTagName", "(", "node", ".", "tagName", ")", ";", "var", "attributes", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "count", "=", "node", ".", "attributes", ".", "length", ...
Handles pre-visit behaviour for the specified element node @param {DOMElement} node
[ "Handles", "pre", "-", "visit", "behaviour", "for", "the", "specified", "element", "node" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L495-L521
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { var tagName = jsxTagName(node.tagName); // De-indent a bit // TODO: It's inefficient to do it this way :/ this.output = trimEnd(this.output, this.config.indent); if (this._isSelfClosing(node)) { this.output += ' />'; } else { this.output += '</' + tagName + '>'; ...
javascript
function (node) { var tagName = jsxTagName(node.tagName); // De-indent a bit // TODO: It's inefficient to do it this way :/ this.output = trimEnd(this.output, this.config.indent); if (this._isSelfClosing(node)) { this.output += ' />'; } else { this.output += '</' + tagName + '>'; ...
[ "function", "(", "node", ")", "{", "var", "tagName", "=", "jsxTagName", "(", "node", ".", "tagName", ")", ";", "// De-indent a bit", "// TODO: It's inefficient to do it this way :/", "this", ".", "output", "=", "trimEnd", "(", "this", ".", "output", ",", "this",...
Handles post-visit behaviour for the specified element node @param {Node} node
[ "Handles", "post", "-", "visit", "behaviour", "for", "the", "specified", "element", "node" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L528-L542
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node) { var parentTag = node.parentNode && jsxTagName(node.parentNode.tagName); if (parentTag === 'textarea' || parentTag === 'style') { // Ignore text content of textareas and styles, as it will have already been moved // to a "defaultValue" attribute and "dangerouslySetInnerHTML" attribu...
javascript
function (node) { var parentTag = node.parentNode && jsxTagName(node.parentNode.tagName); if (parentTag === 'textarea' || parentTag === 'style') { // Ignore text content of textareas and styles, as it will have already been moved // to a "defaultValue" attribute and "dangerouslySetInnerHTML" attribu...
[ "function", "(", "node", ")", "{", "var", "parentTag", "=", "node", ".", "parentNode", "&&", "jsxTagName", "(", "node", ".", "parentNode", ".", "tagName", ")", ";", "if", "(", "parentTag", "===", "'textarea'", "||", "parentTag", "===", "'style'", ")", "{...
Handles processing of the specified text node @param {TextNode} node
[ "Handles", "processing", "of", "the", "specified", "text", "node" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L563-L594
train
roman01la/html-to-react-components
lib/html2jsx.js
function (node, attribute) { switch (attribute.name) { case 'style': return this._getStyleAttribute(attribute.value); default: var tagName = jsxTagName(node.tagName); var name = (ELEMENT_ATTRIBUTE_MAPPING[tagName] && ELEMENT_ATTRIBUTE_MAPPING[tagName][attrib...
javascript
function (node, attribute) { switch (attribute.name) { case 'style': return this._getStyleAttribute(attribute.value); default: var tagName = jsxTagName(node.tagName); var name = (ELEMENT_ATTRIBUTE_MAPPING[tagName] && ELEMENT_ATTRIBUTE_MAPPING[tagName][attrib...
[ "function", "(", "node", ",", "attribute", ")", "{", "switch", "(", "attribute", ".", "name", ")", "{", "case", "'style'", ":", "return", "this", ".", "_getStyleAttribute", "(", "attribute", ".", "value", ")", ";", "default", ":", "var", "tagName", "=", ...
Gets a JSX formatted version of the specified attribute from the node @param {DOMElement} node @param {object} attribute @return {string}
[ "Gets", "a", "JSX", "formatted", "version", "of", "the", "specified", "attribute", "from", "the", "node" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L612-L633
train
roman01la/html-to-react-components
lib/html2jsx.js
function (output, indent) { var classIndention = new RegExp('\\n' + indent + indent + indent, 'g'); return output.replace(classIndention, '\n'); }
javascript
function (output, indent) { var classIndention = new RegExp('\\n' + indent + indent + indent, 'g'); return output.replace(classIndention, '\n'); }
[ "function", "(", "output", ",", "indent", ")", "{", "var", "classIndention", "=", "new", "RegExp", "(", "'\\\\n'", "+", "indent", "+", "indent", "+", "indent", ",", "'g'", ")", ";", "return", "output", ".", "replace", "(", "classIndention", ",", "'\\n'",...
Removes class-level indention in the JSX output. To be used when the JSX output is configured to not contain a class deifinition. @param {string} output JSX output with class-level indention @param {string} indent Configured indention @return {string} JSX output wihtout class-level indention
[ "Removes", "class", "-", "level", "indention", "in", "the", "JSX", "output", ".", "To", "be", "used", "when", "the", "JSX", "output", "is", "configured", "to", "not", "contain", "a", "class", "deifinition", "." ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L654-L657
train
roman01la/html-to-react-components
lib/html2jsx.js
function (rawStyle) { this.styles = {}; rawStyle.split(';').forEach(function (style) { style = style.trim(); var firstColon = style.indexOf(':'); var key = style.substr(0, firstColon); var value = style.substr(firstColon + 1).trim(); if (key !== '') { // Style key should be...
javascript
function (rawStyle) { this.styles = {}; rawStyle.split(';').forEach(function (style) { style = style.trim(); var firstColon = style.indexOf(':'); var key = style.substr(0, firstColon); var value = style.substr(firstColon + 1).trim(); if (key !== '') { // Style key should be...
[ "function", "(", "rawStyle", ")", "{", "this", ".", "styles", "=", "{", "}", ";", "rawStyle", ".", "split", "(", "';'", ")", ".", "forEach", "(", "function", "(", "style", ")", "{", "style", "=", "style", ".", "trim", "(", ")", ";", "var", "first...
Parse the specified inline style attribute value @param {string} rawStyle Raw style attribute
[ "Parse", "the", "specified", "inline", "style", "attribute", "value" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L674-L687
train
roman01la/html-to-react-components
lib/html2jsx.js
function () { var output = []; eachObj(this.styles, function (key, value) { output.push(this.toJSXKey(key) + ': ' + this.toJSXValue(value)); }, this); return output.join(', '); }
javascript
function () { var output = []; eachObj(this.styles, function (key, value) { output.push(this.toJSXKey(key) + ': ' + this.toJSXValue(value)); }, this); return output.join(', '); }
[ "function", "(", ")", "{", "var", "output", "=", "[", "]", ";", "eachObj", "(", "this", ".", "styles", ",", "function", "(", "key", ",", "value", ")", "{", "output", ".", "push", "(", "this", ".", "toJSXKey", "(", "key", ")", "+", "': '", "+", ...
Convert the style information represented by this parser into a JSX string @return {string}
[ "Convert", "the", "style", "information", "represented", "by", "this", "parser", "into", "a", "JSX", "string" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L695-L701
train
roman01la/html-to-react-components
lib/html2jsx.js
function (value) { if (isNumeric(value)) { return value } else if (value.startsWith("'") || value.startsWith("\"")) { return value } else { return '\'' + value.replace(/'/g, '"') + '\''; } }
javascript
function (value) { if (isNumeric(value)) { return value } else if (value.startsWith("'") || value.startsWith("\"")) { return value } else { return '\'' + value.replace(/'/g, '"') + '\''; } }
[ "function", "(", "value", ")", "{", "if", "(", "isNumeric", "(", "value", ")", ")", "{", "return", "value", "}", "else", "if", "(", "value", ".", "startsWith", "(", "\"'\"", ")", "||", "value", ".", "startsWith", "(", "\"\\\"\"", ")", ")", "{", "re...
Convert the CSS style value to a JSX style value @param {string} value CSS style value @return {string} JSX style value
[ "Convert", "the", "CSS", "style", "value", "to", "a", "JSX", "style", "value" ]
74b76fafbd0728f77c2bbe32a0b26a94e604442b
https://github.com/roman01la/html-to-react-components/blob/74b76fafbd0728f77c2bbe32a0b26a94e604442b/lib/html2jsx.js#L723-L731
train
snorpey/glitch-canvas
dist/glitch-canvas-browser.es6.js
imageToImageData
function imageToImageData ( image ) { if ( image instanceof HTMLImageElement ) { // http://stackoverflow.com/a/3016076/229189 if ( ! image.naturalWidth || ! image.naturalHeight || image.complete === false ) { throw new Error( "This this image hasn't finished loading: " + image.src ); } const canvas = new C...
javascript
function imageToImageData ( image ) { if ( image instanceof HTMLImageElement ) { // http://stackoverflow.com/a/3016076/229189 if ( ! image.naturalWidth || ! image.naturalHeight || image.complete === false ) { throw new Error( "This this image hasn't finished loading: " + image.src ); } const canvas = new C...
[ "function", "imageToImageData", "(", "image", ")", "{", "if", "(", "image", "instanceof", "HTMLImageElement", ")", "{", "// http://stackoverflow.com/a/3016076/229189", "if", "(", "!", "image", ".", "naturalWidth", "||", "!", "image", ".", "naturalHeight", "||", "i...
import Canvas from 'canvas';
[ "import", "Canvas", "from", "canvas", ";" ]
d9012df97cfdb888dddc16b5f5c775a134d4b151
https://github.com/snorpey/glitch-canvas/blob/d9012df97cfdb888dddc16b5f5c775a134d4b151/dist/glitch-canvas-browser.es6.js#L105-L134
train
substance/substance
model/annotationHelpers.js
transferAnnotations
function transferAnnotations (doc, path, offset, newPath, newOffset) { var index = doc.getIndex('annotations') var annotations = index.get(path, offset) for (let i = 0; i < annotations.length; i++) { let a = annotations[i] var isInside = (offset > a.start.offset && offset < a.end.offset) var start = a...
javascript
function transferAnnotations (doc, path, offset, newPath, newOffset) { var index = doc.getIndex('annotations') var annotations = index.get(path, offset) for (let i = 0; i < annotations.length; i++) { let a = annotations[i] var isInside = (offset > a.start.offset && offset < a.end.offset) var start = a...
[ "function", "transferAnnotations", "(", "doc", ",", "path", ",", "offset", ",", "newPath", ",", "newOffset", ")", "{", "var", "index", "=", "doc", ".", "getIndex", "(", "'annotations'", ")", "var", "annotations", "=", "index", ".", "get", "(", "path", ",...
used when breaking a node to transfer annotations to the new property
[ "used", "when", "breaking", "a", "node", "to", "transfer", "annotations", "to", "the", "new", "property" ]
b4310f24b4466a96af7fe313e8f615d56cda3a84
https://github.com/substance/substance/blob/b4310f24b4466a96af7fe313e8f615d56cda3a84/model/annotationHelpers.js#L148-L220
train
substance/substance
util/EventEmitter.js
_disconnect
function _disconnect (context) { /* eslint-disable no-invalid-this */ // Remove all connections to the context forEach(this.__events__, (bindings, event) => { for (let i = bindings.length - 1; i >= 0; i--) { // bindings[i] may have been removed by the previous steps // so check it still exists ...
javascript
function _disconnect (context) { /* eslint-disable no-invalid-this */ // Remove all connections to the context forEach(this.__events__, (bindings, event) => { for (let i = bindings.length - 1; i >= 0; i--) { // bindings[i] may have been removed by the previous steps // so check it still exists ...
[ "function", "_disconnect", "(", "context", ")", "{", "/* eslint-disable no-invalid-this */", "// Remove all connections to the context", "forEach", "(", "this", ".", "__events__", ",", "(", "bindings", ",", "event", ")", "=>", "{", "for", "(", "let", "i", "=", "bi...
removes a listener from all events
[ "removes", "a", "listener", "from", "all", "events" ]
b4310f24b4466a96af7fe313e8f615d56cda3a84
https://github.com/substance/substance/blob/b4310f24b4466a96af7fe313e8f615d56cda3a84/util/EventEmitter.js#L177-L191
train
substance/substance
ui/RenderingEngine.js
_create
function _create (state, vel) { let comp = vel._comp console.assert(!comp, 'Component instance should not exist when this method is used.') let parent = vel.parent._comp // making sure the parent components have been instantiated if (!parent) { parent = _create(state, vel.parent) } // TODO: probably w...
javascript
function _create (state, vel) { let comp = vel._comp console.assert(!comp, 'Component instance should not exist when this method is used.') let parent = vel.parent._comp // making sure the parent components have been instantiated if (!parent) { parent = _create(state, vel.parent) } // TODO: probably w...
[ "function", "_create", "(", "state", ",", "vel", ")", "{", "let", "comp", "=", "vel", ".", "_comp", "console", ".", "assert", "(", "!", "comp", ",", "'Component instance should not exist when this method is used.'", ")", "let", "parent", "=", "vel", ".", "pare...
called to initialize a captured component, i.e. creating a Component instance from a VirtualElement
[ "called", "to", "initialize", "a", "captured", "component", "i", ".", "e", ".", "creating", "a", "Component", "instance", "from", "a", "VirtualElement" ]
b4310f24b4466a96af7fe313e8f615d56cda3a84
https://github.com/substance/substance/blob/b4310f24b4466a96af7fe313e8f615d56cda3a84/ui/RenderingEngine.js#L372-L407
train
liquality/chainabstractionlayer
packages/bitcoin-utils/lib/index.js
compressPubKey
function compressPubKey (pubKey) { const x = pubKey.substring(2, 66) const y = pubKey.substring(66, 130) const even = parseInt(y.substring(62, 64), 16) % 2 === 0 const prefix = even ? '02' : '03' return prefix + x }
javascript
function compressPubKey (pubKey) { const x = pubKey.substring(2, 66) const y = pubKey.substring(66, 130) const even = parseInt(y.substring(62, 64), 16) % 2 === 0 const prefix = even ? '02' : '03' return prefix + x }
[ "function", "compressPubKey", "(", "pubKey", ")", "{", "const", "x", "=", "pubKey", ".", "substring", "(", "2", ",", "66", ")", "const", "y", "=", "pubKey", ".", "substring", "(", "66", ",", "130", ")", "const", "even", "=", "parseInt", "(", "y", "...
Get compressed pubKey from pubKey. @param {!string} pubKey - 65 byte string with prefix, x, y. @return {string} Returns the compressed pubKey of uncompressed pubKey.
[ "Get", "compressed", "pubKey", "from", "pubKey", "." ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/bitcoin-utils/lib/index.js#L21-L28
train
liquality/chainabstractionlayer
packages/bitcoin-utils/lib/index.js
pubKeyToAddress
function pubKeyToAddress (pubKey, network, type) { pubKey = ensureBuffer(pubKey) const pubKeyHash = hash160(pubKey) const addr = pubKeyHashToAddress(pubKeyHash, network, type) return addr }
javascript
function pubKeyToAddress (pubKey, network, type) { pubKey = ensureBuffer(pubKey) const pubKeyHash = hash160(pubKey) const addr = pubKeyHashToAddress(pubKeyHash, network, type) return addr }
[ "function", "pubKeyToAddress", "(", "pubKey", ",", "network", ",", "type", ")", "{", "pubKey", "=", "ensureBuffer", "(", "pubKey", ")", "const", "pubKeyHash", "=", "hash160", "(", "pubKey", ")", "const", "addr", "=", "pubKeyHashToAddress", "(", "pubKeyHash", ...
Get address from pubKey. @param {!string|Buffer} pubKey - 65 byte uncompressed pubKey or 33 byte compressed pubKey. @param {!string} network - bitcoin, testnet, or litecoin. @param {!string} type - pubKeyHash or scriptHash. @return {string} Returns the address of pubKey.
[ "Get", "address", "from", "pubKey", "." ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/bitcoin-utils/lib/index.js#L37-L42
train
liquality/chainabstractionlayer
packages/bitcoin-utils/lib/index.js
pubKeyHashToAddress
function pubKeyHashToAddress (pubKeyHash, network, type) { pubKeyHash = ensureBuffer(pubKeyHash) const prefixHash = Buffer.concat([Buffer.from(networks[network][type], 'hex'), pubKeyHash]) const checksum = Buffer.from(sha256(sha256(prefixHash)).slice(0, 8), 'hex') const addr = base58.encode(Buffer.concat([prefi...
javascript
function pubKeyHashToAddress (pubKeyHash, network, type) { pubKeyHash = ensureBuffer(pubKeyHash) const prefixHash = Buffer.concat([Buffer.from(networks[network][type], 'hex'), pubKeyHash]) const checksum = Buffer.from(sha256(sha256(prefixHash)).slice(0, 8), 'hex') const addr = base58.encode(Buffer.concat([prefi...
[ "function", "pubKeyHashToAddress", "(", "pubKeyHash", ",", "network", ",", "type", ")", "{", "pubKeyHash", "=", "ensureBuffer", "(", "pubKeyHash", ")", "const", "prefixHash", "=", "Buffer", ".", "concat", "(", "[", "Buffer", ".", "from", "(", "networks", "["...
Get address from pubKeyHash. @param {!string} pubKeyHash - hash160 of pubKey. @param {!string} network - bitcoin, testnet, or litecoin. @param {!string} type - pubKeyHash or scriptHash. @return {string} Returns the address derived from pubKeyHash.
[ "Get", "address", "from", "pubKeyHash", "." ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/bitcoin-utils/lib/index.js#L51-L57
train
liquality/chainabstractionlayer
packages/bitcoin-utils/lib/index.js
getAddressNetwork
function getAddressNetwork (address) { const prefix = base58.decode(address).toString('hex').substring(0, 2).toUpperCase() const networkKey = findKey(networks, network => [network.pubKeyHash, network.scriptHash].includes(prefix)) return networks[networkKey] }
javascript
function getAddressNetwork (address) { const prefix = base58.decode(address).toString('hex').substring(0, 2).toUpperCase() const networkKey = findKey(networks, network => [network.pubKeyHash, network.scriptHash].includes(prefix)) return networks[networkKey] }
[ "function", "getAddressNetwork", "(", "address", ")", "{", "const", "prefix", "=", "base58", ".", "decode", "(", "address", ")", ".", "toString", "(", "'hex'", ")", ".", "substring", "(", "0", ",", "2", ")", ".", "toUpperCase", "(", ")", "const", "netw...
Get a network object from an address @param {string} address The bitcoin address @return {Network}
[ "Get", "a", "network", "object", "from", "an", "address" ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/bitcoin-utils/lib/index.js#L126-L131
train
liquality/chainabstractionlayer
packages/crypto/lib/index.js
ensureBuffer
function ensureBuffer (message) { if (Buffer.isBuffer(message)) return message switch (typeof message) { case 'string': message = isHex(message) ? Buffer.from(message, 'hex') : Buffer.from(message) break case 'object': message = Buffer.from(JSON.stringify(message)) break } retu...
javascript
function ensureBuffer (message) { if (Buffer.isBuffer(message)) return message switch (typeof message) { case 'string': message = isHex(message) ? Buffer.from(message, 'hex') : Buffer.from(message) break case 'object': message = Buffer.from(JSON.stringify(message)) break } retu...
[ "function", "ensureBuffer", "(", "message", ")", "{", "if", "(", "Buffer", ".", "isBuffer", "(", "message", ")", ")", "return", "message", "switch", "(", "typeof", "message", ")", "{", "case", "'string'", ":", "message", "=", "isHex", "(", "message", ")"...
Ensure message is in buffer format. @param {string} message - any string. @return {string} Returns Buffer of string.
[ "Ensure", "message", "is", "in", "buffer", "format", "." ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/crypto/lib/index.js#L18-L31
train
liquality/chainabstractionlayer
packages/crypto/lib/index.js
padHexStart
function padHexStart (hex, length) { let len = length || hex.length len += len % 2 return hex.padStart(len, '0') }
javascript
function padHexStart (hex, length) { let len = length || hex.length len += len % 2 return hex.padStart(len, '0') }
[ "function", "padHexStart", "(", "hex", ",", "length", ")", "{", "let", "len", "=", "length", "||", "hex", ".", "length", "len", "+=", "len", "%", "2", "return", "hex", ".", "padStart", "(", "len", ",", "'0'", ")", "}" ]
Pad a hex string with '0' @param {string} hex - The hex string to pad. @param {number} [length] - The length of the final string. @return Returns a padded string with length greater or equal to the given length rounded up to the nearest even number.
[ "Pad", "a", "hex", "string", "with", "0" ]
2c402490422fa0ffe4fee6aac1e54083f7fb9ff4
https://github.com/liquality/chainabstractionlayer/blob/2c402490422fa0ffe4fee6aac1e54083f7fb9ff4/packages/crypto/lib/index.js#L77-L82
train
apache/cordova-osx
bin/templates/scripts/cordova/lib/run.js
runApp
function runApp (appDir, appName) { var binPath = path.join(appDir, 'Contents', 'MacOS', appName); events.emit('log', 'Starting: ' + binPath); return spawn(binPath); }
javascript
function runApp (appDir, appName) { var binPath = path.join(appDir, 'Contents', 'MacOS', appName); events.emit('log', 'Starting: ' + binPath); return spawn(binPath); }
[ "function", "runApp", "(", "appDir", ",", "appName", ")", "{", "var", "binPath", "=", "path", ".", "join", "(", "appDir", ",", "'Contents'", ",", "'MacOS'", ",", "appName", ")", ";", "events", ".", "emit", "(", "'log'", ",", "'Starting: '", "+", "binPa...
runs the app @return {Promise} Resolves when run succeeds otherwise rejects
[ "runs", "the", "app" ]
ea2d3c7482a4baf6ba3906dd2d0d929101ed7843
https://github.com/apache/cordova-osx/blob/ea2d3c7482a4baf6ba3906dd2d0d929101ed7843/bin/templates/scripts/cordova/lib/run.js#L50-L54
train
instructure/instructure-ui
packages/babel-plugin-transform-class-display-name/lib/index.js
isReactClass
function isReactClass (node) { if (!node || !t.isCallExpression(node)) return false // not _createClass call if (!node.callee || node.callee.name !== '_createClass') return false // no call arguments const args = node.arguments if (!args || args.length !== 2) return false if (!t.isIdentifi...
javascript
function isReactClass (node) { if (!node || !t.isCallExpression(node)) return false // not _createClass call if (!node.callee || node.callee.name !== '_createClass') return false // no call arguments const args = node.arguments if (!args || args.length !== 2) return false if (!t.isIdentifi...
[ "function", "isReactClass", "(", "node", ")", "{", "if", "(", "!", "node", "||", "!", "t", ".", "isCallExpression", "(", "node", ")", ")", "return", "false", "// not _createClass call", "if", "(", "!", "node", ".", "callee", "||", "node", ".", "callee", ...
Determine if an AST node is likely a class extending React.Component
[ "Determine", "if", "an", "AST", "node", "is", "likely", "a", "class", "extending", "React", ".", "Component" ]
7cee93b56f34679824b49d79e0d5821e4c9b5ea7
https://github.com/instructure/instructure-ui/blob/7cee93b56f34679824b49d79e0d5821e4c9b5ea7/packages/babel-plugin-transform-class-display-name/lib/index.js#L29-L47
train
instructure/instructure-ui
packages/babel-plugin-transform-class-display-name/lib/index.js
isRenderMethod
function isRenderMethod (props) { return props.some((prop) => { return prop.key.name === 'key' && prop.value.value === 'render' }) && props.some((prop) => { return prop.key.name === 'value' && t.isFunctionExpression(prop.value) }) }
javascript
function isRenderMethod (props) { return props.some((prop) => { return prop.key.name === 'key' && prop.value.value === 'render' }) && props.some((prop) => { return prop.key.name === 'value' && t.isFunctionExpression(prop.value) }) }
[ "function", "isRenderMethod", "(", "props", ")", "{", "return", "props", ".", "some", "(", "(", "prop", ")", "=>", "{", "return", "prop", ".", "key", ".", "name", "===", "'key'", "&&", "prop", ".", "value", ".", "value", "===", "'render'", "}", ")", ...
Determine if a property definition is for a render method
[ "Determine", "if", "a", "property", "definition", "is", "for", "a", "render", "method" ]
7cee93b56f34679824b49d79e0d5821e4c9b5ea7
https://github.com/instructure/instructure-ui/blob/7cee93b56f34679824b49d79e0d5821e4c9b5ea7/packages/babel-plugin-transform-class-display-name/lib/index.js#L52-L58
train